fdhwlib  2.0.25
Using Register Lists

The register lists are intended for a simple high level interface to the electronics.

The register lists provide unified information and access to registers and their items.

Register object:

  • Name
  • Readable
  • Writable
  • Length
  • Number of elements
  • Base address
  • Address shift for register vector
  • Item list

Display list of all registers:

for (i=0;i<theFlt[col]->nRegs;i++) {
	regName = theFlt[col]->regList[i]->getName();
	printf("   %-25s |  %2d %2d %6d %6d %6d    %08x\n", regName,
			theFlt[col]->regList[i]->isReadable(), 
			theFlt[col]->regList[i]->isWriteable(),
			theFlt[col]->regList[i]->getLength(), 
			theFlt[col]->regList[i]->getAddrShift()+2, 
			theFlt[col]->regList[i]->getBlockLength(), 
			theFlt[col]->regList[i]->getAddr()<<2); 
}			
 

Display the register items

// Display the defined bitfields
nBitFields = theFlt[col]->regList[i]->itemN;
if (nBitFields > 0){
	printf("\n");
	for (j=0;j<nBitFields;j++){
	   printf("        %-20s | %4d  ", 
			theFlt[col]->regList[i]->itemList[j]->getName(),
			theFlt[col]->regList[i]->itemList[j]->getByteShift()
		);	
	   low = theFlt[col]->regList[i]->itemList[j]->getLowBit();
	   len = theFlt[col]->regList[i]->itemList[j]->getLength();
	   for(k=31;k>=0;k--){
		 if (k>=low+len) printf("_");
		 else if (k>=low) printf("x");
		 else printf("_");
	   }	
	   printf("  %08x\n", theFlt[col]->regList[i]->itemList[j]->getMask() << low);
	}
}