SASC
DVBSoftCAM

st20.h

Go to the documentation of this file.
00001 /*
00002  * Softcam plugin to VDR (C++)
00003  *
00004  * This code is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This code is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
00018  */
00019 
00020 #ifndef __ST20_H
00021 #define __ST20_H
00022 
00023 class cLineBuff;
00024 
00025 // ----------------------------------------------------------------
00026 
00027 #define IPTR 0
00028 #define WPTR 1
00029 #define AREG 2
00030 #define BREG 3
00031 #define CREG 4
00032 
00033 #define FLASHS  0x7FE00000
00034 #define FLASHE  0x7FFFFFFF
00035 #define RAMS    0x40000000
00036 #define RAME    0x401FFFFF
00037 #define IRAMS   0x80000000
00038 #define IRAME   0x800017FF
00039 
00040 #define ERR_ILL_OP -1
00041 #define ERR_CNT    -2
00042 
00043 // ----------------------------------------------------------------
00044 
00045 #define STACKMAX  16
00046 #define STACKMASK (STACKMAX-1)
00047 
00048 class cST20 {
00049 private:
00050   unsigned int Iptr, Wptr;
00051   unsigned char *flash, *ram;
00052   unsigned int flashSize, ramSize;
00053   int sptr, stack[STACKMAX];
00054   unsigned char iram[0x1800];
00055   int invalid;
00056   //
00057   bool verbose;
00058   cLineBuff *loglb;
00059   //
00060   unsigned char *Addr(unsigned int off);
00061   void LogOp(const char *op);
00062   void LogOpOper(int op, int oper);
00063 public:
00064   cST20(void);
00065   ~cST20();
00066   void Init(unsigned int IPtr, unsigned int WPtr);
00067   void SetCallFrame(unsigned int raddr, int p1, int p2, int p3);
00068   void SetFlash(unsigned char *m, int len);
00069   void SetRam(unsigned char *m, int len);
00070   int Decode(int count);
00071   //
00072   unsigned int GetReg(int reg) const;
00073   void SetReg(int reg, unsigned int val);
00074   unsigned int ReadWord(unsigned int off);
00075   unsigned short ReadShort(unsigned int off);
00076   unsigned char ReadByte(unsigned int off);
00077   void WriteWord(unsigned int off, unsigned int val);
00078   void WriteShort(unsigned int off, unsigned short val);
00079   void WriteByte(unsigned int off, unsigned char val);
00080   };
00081 
00082 #endif // __ST20_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines