Generic hardware access library
|
00001 #include "hal/ConfigCSRDumper.hh" 00002 00003 #include <iostream> 00004 #include <iomanip> 00005 00006 HAL::ConfigCSRDumper::ConfigCSRDumper() { 00007 } 00008 00009 void HAL::ConfigCSRDumper::dumpCSR( const VMEConfigurationSpaceHandler& configHandler, 00010 const uint32_t slotId ) { 00011 00012 std::vector<unsigned char> csr; 00013 uint32_t adr = 0x7ff63; 00014 uint32_t result; 00015 00016 for ( uint32_t offset = 0; adr <= 0x7ffff; offset += 4, adr+=4 ) { 00017 configHandler.configRead( "CSRStart", slotId, &result, offset ); 00018 csr.push_back( (unsigned char)result ); 00019 } 00020 00021 displayItem( csr, 1, 0x07ffff, "bar", "CR/CSR Base Address Register (BAR)"); 00022 displayItem( csr, 1, 0x07fffb, "bitSet", "Bit Set Register"); 00023 displayItem( csr, 1, 0x07fff7, "bitClear", "Bit Clear Register"); 00024 displayItem( csr, 1, 0x07fff3, "cramOwner", "CRAM owner Register"); 00025 displayItem( csr, 1, 0x07ffef, "userBitSet", "User Bit Set Register"); 00026 displayItem( csr, 1, 0x07ffeb, "userBitClear", "User Bit Clear Register"); 00027 00028 displayItem( csr, 4, 0x07ffd3, "ADER-F7", "Address Decoder Compare Register function 7"); 00029 displayItem( csr, 4, 0x07ffc3, "ADER-F6", "Address Decoder Compare Register function 6"); 00030 displayItem( csr, 4, 0x07ffb3, "ADER-F5", "Address Decoder Compare Register function 5"); 00031 displayItem( csr, 4, 0x07ffa3, "ADER-F4", "Address Decoder Compare Register function 4"); 00032 displayItem( csr, 4, 0x07ff93, "ADER-F3", "Address Decoder Compare Register function 3"); 00033 displayItem( csr, 4, 0x07ff83, "ADER-F2", "Address Decoder Compare Register function 2"); 00034 displayItem( csr, 4, 0x07ff73, "ADER-F1", "Address Decoder Compare Register function 1"); 00035 displayItem( csr, 4, 0x07ff63, "ADER-F0", "Address Decoder Compare Register function 0"); 00036 } 00037 00038 void HAL::ConfigCSRDumper::displayItem( const std::vector<unsigned char>csr, 00039 const uint32_t length, 00040 const uint32_t address, 00041 const std::string key, 00042 const std::string description ) { 00043 std::cout << std::hex << std::setw(8) << std::setfill('0') << address << " : " 00044 << std::setw(18) << std::setfill(' ') << key << " : "; 00045 00046 uint32_t ix = (address-0x7ff63) / 4; 00047 for ( uint32_t ic = 0; ic < length; ic++ ) { 00048 std::cout << std::setw(2) << std::setfill('0') << std::hex << ((uint32_t) csr[ix]) 00049 << " "; 00050 ix ++; 00051 } 00052 00053 uint32_t pad = (5-length) * 3; 00054 std::cout << std::setw(pad) << std::setfill(' ') << " : " << description << std::endl; 00055 }