fdhwlib
2.0.25
|
00001 /*************************************************************************** 00002 pbussim.h - description 00003 00004 begin : Wed Oct 22 2003 00005 copyright : (C) 2003 by A Kopmann 00006 email : kopmann@ipe.fzk.de 00007 status : 00008 test : 00009 history : 00010 ***************************************************************************/ 00011 00012 #ifndef PBUSSIM_H 00013 #define PBUSSIM_H 00014 00015 #include <string> 00016 00017 #include "pbusimp.h" 00018 00019 00020 class semaphore; 00021 00022 #ifdef USE_SHM 00023 class sharedMemory; 00024 #endif 00025 00026 #ifdef USE_EXT_SIM 00027 class Subrack; 00028 class SimPageController; 00029 #endif 00030 00080 class PbusSim : public PbusImp 00081 { 00082 public: 00083 PbusSim(); 00084 00085 ~PbusSim(); 00086 00087 const char *getMode(); 00088 00089 int getModeId(); 00090 00091 const char *getLibName(); 00092 00093 int get(std::string item, std::string *value); 00094 00095 int init(char *inifile, int host=0); 00096 00097 int free(int host=0); 00098 00099 void reset(); 00100 00101 unsigned long getState(); 00102 00103 int waitForIR(int timeout); 00104 00105 int checkIR(); 00106 00107 unsigned long getIRvector(); 00108 00109 unsigned long readIRvector(); 00110 00111 void writeIRvector(unsigned long vector); 00112 00113 unsigned long rawRead(unsigned long addr); 00114 00115 void rawWrite(unsigned long addr, unsigned long data); 00116 00117 void readBlock(unsigned long addr, unsigned long * data, 00118 unsigned long n, unsigned long incr=1); 00119 00121 int getSlotId(unsigned long addr); 00122 00124 int getChannelId(unsigned long addr); 00125 00127 int getPixelNumber(unsigned long addr); 00128 00130 bool isMemoryAccess(unsigned long addr); 00131 00133 unsigned long simRegisterAddress(int addr); 00134 00185 unsigned long simAddress(unsigned long); 00186 00191 static void initSimulation(char *inifile); 00192 00194 static void freeSimulation(); 00195 00197 unsigned long simRead(unsigned long addr); 00198 00199 00205 void simWrite(unsigned long addr, unsigned long data); 00206 00207 00208 protected: // Members 00209 00211 static unsigned long maxAddr; 00212 00214 static unsigned long *mem; 00215 00220 static unsigned short *sMem; 00221 00222 00223 #ifdef USE_SHM 00224 00225 static sharedMemory *shm; 00226 #endif 00227 00228 #ifdef USE_EXT_SIM 00229 00232 static Subrack *s; 00233 00235 static SimPageController *pc; 00236 #endif 00237 00238 }; 00239 00240 #endif 00241