#ifndef SVTVME_PRIVATE_H #define SVTVME_PRIVATE_H #include #include #include #include /* read/write flags, i.e. the requisite for VME Read or Write operation */ const int SVTVME_ALWAYS = 0; const int SVTVME_NEVER = 1; const int SVTVME_TMODE = 2; const int SVTVME_FREEZE = 4; const int SVTVME_TMorFZ = 6; /* accessType flags, if an object needs a special treatment... */ const int SVTVME_normal = 0; /* standard VME object */ const int SVTVME_needRMW = 1; /* needs ReadModifyWrite for setting, e.g. is just a bit field in a larger register */ const int SVTVME_needFIFO = 2; /* need FISION slave to be in FIFO mode */ /* revert flag: if a one bit flag need inversion to become "standard" */ const int SVTVME_revert = 1; /* if no inversion is needed will user normal */ /* the basic object is a VME register or a bit subset of it */ typedef struct svtvme_object_s { int id; uint4 addr; uint4 mask; uint4 shift; uint4 nbits; int readFlag, writeFlag, accessFlag, revert; struct svtvme_board_s *board; char longName[80]; char shortName[10]; } svtvme_object; /* ram's contain prom and spy buffers as well, this is the basic vme object that is read many words at a time */ typedef struct svtvme_ram_s { int id; uint4 addr; uint4 mask; uint4 shift; uint4 length; struct svtvme_board_s *board; int readFlag, writeFlag, accessFlag; char longName[80]; char shortName[10]; } svtvme_ram; /* spy buffers are an extension of RAMS, so they contain a pointer to an svtvme_ram structure first, then additional data */ typedef struct svtvme_spy_s { int id; int ramId; struct svtvme_ram_s *ram; int counterRegId; int freezeRegId; int wrappedRegId; } svtvme_spy; /* fifo's have all in all little to share with ram's as far as methods go, so this is a separate structure with no embedded svtvme_ram object */ typedef struct svtvme_fifo_s { int id; uint4 addr; uint4 mask; uint4 shift; uint4 length; int emptyRegId; struct svtvme_board_s *board; int readFlag, accessFlag; char longName[80]; char shortName[10]; } svtvme_fifo; /* a board has registers (objects), rams, spys and fifos */ typedef struct svtvme_board_s { int id; int nobj; int nram; int nspy; int nfifo; char longName[80]; char shortName[4]; struct svtvme_object_s *objs[100]; struct svtvme_ram_s *rams[20]; struct svtvme_fifo_s *fifos[10]; struct svtvme_spy_s *spys[10]; } svtvme_board; /* declare global variables */ int svtvmeVerboseLevel; int svtvmeErrorReportLevel; int svtvmeIsInitialised=0; int svtvmeSvtbIsInitialised=0; int svtvmeAmbIsInitialised=0; int svtvmeAmsIsInitialised=0; int svtvmeHbIsInitialised=0; int svtvmeMrgIsInitialised=0; int svtvmeHfIsInitialised=0; int svtvmeTfIsInitialised=0; int svtvmeXtfaIsInitialised=0; int svtvmeScIsInitialised=0; int svtvmeXtfcIsInitialised=0; int svtvmeNumObjects; int svtvmeNumRams; int svtvmeNumSpys; int svtvmeNumFifos; /* gloabl arrays */ #define svtvmeMaxBoardTypes 10 #define svtvmeMaxObjects 1000 #define svtvmeMaxRams 500 #define svtvmeMaxSpys 500 #define svtvmeMaxFifos 500 svtvme_object *SVTVME_OBJS[svtvmeMaxObjects]; svtvme_ram *SVTVME_RAMS[svtvmeMaxRams]; svtvme_spy *SVTVME_SPYS[svtvmeMaxSpys]; svtvme_fifo *SVTVME_FIFOS[svtvmeMaxFifos]; svtvme_board *svtvme_boards[svtvmeMaxBoardTypes]; const int svtvme_boardTypes[svtvmeMaxBoardTypes]= {SVTVME_SVTB, SVTVME_AMB, SVTVME_AMS, SVTVME_HB, SVTVME_MRG, SVTVME_HF, SVTVME_TF, SVTVME_XTFA, SVTVME_SC, SVTVME_XTFC}; /* boards */ svtvme_board SVTVMEBOARD_SVTB; svtvme_board SVTVMEBOARD_AMB; svtvme_board SVTVMEBOARD_AMS; svtvme_board SVTVMEBOARD_HB; svtvme_board SVTVMEBOARD_MRG; svtvme_board SVTVMEBOARD_HF; svtvme_board SVTVMEBOARD_TF; svtvme_board SVTVMEBOARD_XTFA; svtvme_board SVTVMEBOARD_SC; svtvme_board SVTVMEBOARD_XTFC; /* function prototypes */ int svtvme_initialise_generic(); int svtvme_initialise_amb(); int svtvme_initialise_ams(); int svtvme_initialise_hb(); int svtvme_initialise_mrg(); int svtvme_initialise_hf(); int svtvme_initialise_tf(); int svtvme_initialise_xtfa(); int svtvme_initialise_sc(); int svtvme_initialise_xtfc(); int svtvme_initialise_common_stuff(); int svtvme_create_object(svtvme_board *board, char *lname, char *sname, uint4 addr, uint4 mask, uint4 shift, int nbits, int rFlag, int wFlag, int accFlag, int revertFlag); int svtvme_create_ram(svtvme_board *board, char *lname, char *sname, uint4 addr, uint4 mask, uint4 shift, int length, int rFlag, int wFlag, int accFlag); int svtvme_create_fifo(svtvme_board *board, char *lname, char *sname, uint4 addr, uint4 mask, uint4 shift, int length, int rFlag, int accFlag, int emptyReg); int svtvme_create_spy(svtvme_board *board, char *lname, char *sname, uint4 addr, uint4 mask, uint4 shift, int length, int rFlag, int wFlag, int accFlag, int cntReg, int frzReg, int wrpReg); int svtvme_print_board_definitions(int boardType); int svtvme_print_board_structure(svtvme_board board); #endif /* SVTVME_PRIVATE_H */