9 #include "gcp/util/common/CoordAxes.h"
10 #include "gcp/util/common/Coord.h"
21 #define REGMAP_REVISION 1
73 REG_RW = REG_R | REG_W,
100 REG_DOUBLE = 0x80000,
101 REG_DEFAULT = REG_UINT,
103 REG_DPRAM = 0x100000,
140 CBI_REG_RW_VME = CBI_REG_R_VME | CBI_REG_W_VME,
163 #define VME_A16_BASE 0x0
164 #define VME_A24D16_BASE 0x0
165 #define VME_A24D32_BASE 0x0
166 #define VME_A32_BASE 0x0
171 #define REG_NAME_LEN 31
177 typedef struct RegMapBlock RegMapBlock;
178 typedef struct RegMapBoard RegMapBoard;
179 typedef struct RegMap RegMap;
188 char name_[REG_NAME_LEN+1];
189 std::string* comment_;
190 char axesHelp_[REG_NAME_LEN+1];
192 RegAddrMode addr_mode_;
217 unsigned nBytePerEl_;
226 RegMapBlock(RegMapBoard* parent,
void* tbrd,
void* tblk,
227 unsigned iBlock,
unsigned nper_brd_blocks);
243 unsigned nBytePerEl() {
258 return archivedOnly ? byteOffsetInArcRegMapOf(coord) :
259 byteOffsetInWholeRegMapOf(coord);
266 return (iArcSlot_ < 0) ? -1 : (int)(iArcSlot_ + elementOffsetOf(coord));
270 return iSlot_ + (int)elementOffsetOf(coord);
276 return archivedOnly ? slotOffsetInArcRegMapOf(coord) :
277 slotOffsetInWholeRegMapOf(coord);
292 return (flags_ & REG_BOOL);
297 return (flags_ & REG_CHAR);
302 return (flags_ & REG_UCHAR);
307 return (flags_ & REG_USHORT);
312 return (flags_ & REG_SHORT);
317 return (flags_ & REG_UINT);
322 return (flags_ & REG_INT);
327 return (flags_ & REG_FLOAT);
332 return (flags_ & REG_DOUBLE);
337 return (flags_ & REG_UTC);
342 bool isPreAveraged();
343 bool isPostAveraged();
349 void checkConsistency();
354 void checkType(
unsigned flags);
359 void checkIntegration(
unsigned flags);
364 void checkAttributes();
366 friend std::ostream& operator<<(std::ostream& os, RegMapBlock& block);
375 char name[REG_NAME_LEN+1];
376 std::string* comment_;
377 std::vector<RegMapBlock*> blocks;
383 std::map<std::string, RegMapBlock*> mapOfBlocks_;
405 int byteOffsetInRegMap(
bool archivedOnly) {
406 return archivedOnly ? iArcByte_ : iByte_;
411 int slotOffsetInRegMap(
bool archivedOnly) {
412 return archivedOnly ? iArcSlot_ : iSlot_;
417 unsigned nByte(
bool archivedOnly) {
418 return archivedOnly ? nArcByte_ : nByte_;
423 RegMapBoard(RegMap* parent,
void* vbrd,
unsigned iboard,
424 void* vper_brd_blocks,
unsigned nper_brd_blocks);
430 RegMapBlock* findRegMapBlock(std::string blockName);
434 std::vector<RegMapBlock*> matchRegMapBlock(std::string regExpStr);
442 std::vector<RegMapBoard*> boards_;
448 std::map<std::string, RegMapBoard*> mapOfBoards_;
459 RegMap(
void *regtmp,
bool addDefaults=
true);
468 int byteOffsetInArcRegMapOf(std::string board, std::string block,
470 int byteOffsetInWholeRegMapOf(std::string board, std::string block,
475 int byteOffsetInRegMapOf(
bool archivedOnly,
476 std::string board, std::string block,
478 return archivedOnly ? byteOffsetInArcRegMapOf(board, block, coord) :
479 byteOffsetInWholeRegMapOf(board, block, coord);
487 int byteOffsetInRegMapOf(
bool archivedOnly,
490 return archivedOnly ? byteOffsetInArcRegMapOf(blk, coord) :
491 byteOffsetInWholeRegMapOf(blk, coord);
494 unsigned nByte() {
return nByte_;};
495 unsigned nArcByte() {
return nArcByte_;};
499 int nByte(
bool archivedOnly) {
500 return archivedOnly ? nArcByte() : nByte();
505 RegMapBlock* findRegMapBlock(std::string board_name, std::string block_name,
506 bool booldoThrow=
false);
514 RegMap* del_RegMap(RegMap* regmap);
520 RegMap *alias_RegMap(RegMap *regmap);
524 int equiv_RegMap(RegMap *regmap1, RegMap *regmap2);
526 RegMapBoard *find_RegMapBoard(RegMap *regmap, std::string board_name);
527 RegMapBlock *find_RegMapBoard_Block(RegMapBoard *board, std::string block_name);
528 RegMapBlock *find_RegMapBlock(RegMap *regmap, std::string board_name,
529 std::string block_name);
562 enum {REG_NASPECT = 7};
564 char *name_RegAspect(RegAspect aspect);
572 enum {REG_NINTEG = 3};
574 char *name_RegInteg(RegInteg integ);
619 unsigned nBytePerEl_;
625 int find_RegMapReg(RegMap *regmap, std::string board_name, std::string block_name,
626 RegAspect facet,
unsigned index,
unsigned n,
629 int init_RegMapReg(RegMap *regmap,
unsigned board,
unsigned block,
630 unsigned index,
unsigned nreg, RegAspect aspect,
639 RegValidity input_RegMapReg(
InputStream *stream,
int tell, RegMap *regmap,
640 RegInputMode mode,
int extend, RegMapReg *reg);
651 int output_RegMapReg(
OutputStream *stream, RegMap *regmap, RegOutputMode mode,
654 void clr_RegMapReg(RegMapReg *reg);
661 int pack_int_string(
char *
string,
int ndata,
unsigned *data);
666 int unpack_int_string(
unsigned *data,
int ndata,
int size,
char *
string);
672 int unpack_double_string(
double *data,
int ndata,
int size,
char *
string);
Definition: CoordAxes.h:25
Definition: CoordRange.h:20