Generic hardware access library
|
00001 #include "hal/ConfigROMDumper.hh" 00002 #include <iostream> 00003 #include <iomanip> 00004 00005 HAL::ConfigROMDumper::ConfigROMDumper() { 00006 } 00007 00008 void HAL::ConfigROMDumper::dumpROM( const VMEConfigurationSpaceHandler& configHandler, 00009 const uint32_t slotId ) { 00010 std::vector<unsigned char> rom; 00011 uint32_t adr = 0x03; 00012 uint32_t result; 00013 00014 for ( uint32_t offset = 0; adr <= 0x74f; offset += 4, adr+=4 ) { 00015 configHandler.configRead( "checksum", slotId, &result, offset ); 00016 rom.push_back( (unsigned char)result ); 00017 } 00018 00019 displayItem( rom, 1, 0x000003, "checksum", "checksum of configuration ROM"); 00020 displayItem( rom, 3, 0x000007, "romLength", "length of the Configuration ROM "); 00021 displayItem( rom, 1, 0x000013, "CRWidth", "Configuration ROM (CR) access width"); 00022 displayItem( rom, 1, 0x000017, "CSRWidth", "Configuration Status Reg (CSR) access width"); 00023 displayItem( rom, 1, 0x00001b, "specificationId", "CR/CSR specification ID"); 00024 displayItem( rom, 2, 0x00001f, "CR", "to identify valid CR"); 00025 displayItem( rom, 3, 0x000027, "manufacturerId", "Manufacturer Id" ); 00026 displayItem( rom, 4, 0x000033, "boardId", "Board Id (from manufacturer)" ); 00027 displayItem( rom, 4, 0x000043, "revisionId", "Board-Revision Id (from manufacturer)"); 00028 displayItem( rom, 3, 0x000053, "descriptionPtr", "Pointer to Null terminated string " ); 00029 displayItem( rom, 1, 0x00007f, "programId", "Program Id (if available)" ); 00030 displayItem( rom, 3, 0x000083, "userCRStart", "0 or Pointer to start of User CR " ); 00031 displayItem( rom, 3, 0x00008f, "userCREnd", "0 or Pointer to end of User CR " ); 00032 displayItem( rom, 3, 0x00009b, "CRAMStart", "0 or Pointer to start of CRAM " ); 00033 displayItem( rom, 3, 0x0000a7, "CRAMEnd", "0 or Pointer to end of CRAM " ); 00034 displayItem( rom, 3, 0x0000b3, "userCSRStart", "0 or Pointer to start of User CSR " ); 00035 displayItem( rom, 3, 0x0000bf, "userCSREnd", "0 or Pointer to end of User CSR " ); 00036 displayItem( rom, 3, 0x0000cb, "serialNumberStart", "0 or Pointer to start of Serialnumber "); 00037 displayItem( rom, 3, 0x0000d7, "serialNumberEnd", "0 or Pointer to end of Serialnumber " ); 00038 00039 displayItem( rom, 1, 0x0000e3, "slaveCharacts", "characteristics of slave interface" ); 00040 displayItem( rom, 1, 0x0000e7, "userSlaveCharacts", "user defined characteristics of slave interface"); 00041 displayItem( rom, 1, 0x0000eb, "masterCharcts", "characteristics of master interface" ); 00042 displayItem( rom, 1, 0x0000ef, "userMasterCharacts", "user defined characteristics of master interface" ); 00043 displayItem( rom, 1, 0x0000f3, "irqHandlerCap", "interrupt handler capabilities" ); 00044 displayItem( rom, 1, 0x0000f7, "interrupterCap", "interrupter capabilities" ); 00045 displayItem( rom, 1, 0x0000ff, "CRAMWidth", "access width of CRAM" ); 00046 00047 displayItem( rom, 1, 0x000103, "dataAccessWidth-F0", "Data access width for function 0" ); 00048 displayItem( rom, 1, 0x000107, "dataAccessWidth-F1", "Data access width for function 1" ); 00049 displayItem( rom, 1, 0x00010b, "dataAccessWidth-F2", "Data access width for function 2" ); 00050 displayItem( rom, 1, 0x00010f, "dataAccessWidth-F3", "Data access width for function 3" ); 00051 displayItem( rom, 1, 0x000113, "dataAccessWidth-F4", "Data access width for function 4" ); 00052 displayItem( rom, 1, 0x000117, "dataAccessWidth-F5", "Data access width for function 5" ); 00053 displayItem( rom, 1, 0x00011b, "dataAccessWidth-F6", "Data access width for function 6" ); 00054 displayItem( rom, 1, 0x00011f, "dataAccessWidth-F7", "Data access width for function 7" ); 00055 displayItem( rom, 8, 0x000123, "AMCAP-F0", "AM-capability for function 0" ); 00056 displayItem( rom, 8, 0x000143, "AMCAP-F1", "AM-capability for function 1" ); 00057 displayItem( rom, 8, 0x000163, "AMCAP-F2", "AM-capability for function 2" ); 00058 displayItem( rom, 8, 0x000183, "AMCAP-F3", "AM-capability for function 3" ); 00059 displayItem( rom, 8, 0x0001a3, "AMCAP-F4", "AM-capability for function 4" ); 00060 displayItem( rom, 8, 0x0001c3, "AMCAP-F5", "AM-capability for function 5" ); 00061 displayItem( rom, 8, 0x0001e3, "AMCAP-F6", "AM-capability for function 6" ); 00062 displayItem( rom, 8, 0x000203, "AMCAP-F7", "AM-capability for function 7" ); 00063 00064 displayItem( rom,16, 0x000223, "XAMCAP-F0-low", "XAM-capability for function 0 low" ); 00065 displayItem( rom,16, 0x000263, "XAMCAP-F0-high", "XAM-capability for function 0 high" ); 00066 displayItem( rom,16, 0x0002a3, "XAMCAP-F1-low", "XAM-capability for function 0 low" ); 00067 displayItem( rom,16, 0x0002e3, "XAMCAP-F1-high", "XAM-capability for function 0 high" ); 00068 displayItem( rom,16, 0x000323, "XAMCAP-F2-low", "XAM-capability for function 0 low" ); 00069 displayItem( rom,16, 0x000363, "XAMCAP-F2-high", "XAM-capability for function 0 high" ); 00070 displayItem( rom,16, 0x0003a3, "XAMCAP-F3-low", "XAM-capability for function 0 low" ); 00071 displayItem( rom,16, 0x0003e3, "XAMCAP-F3-high", "XAM-capability for function 0 high" ); 00072 displayItem( rom,16, 0x000423, "XAMCAP-F4-low", "XAM-capability for function 0 low" ); 00073 displayItem( rom,16, 0x000463, "XAMCAP-F4-high", "XAM-capability for function 0 high" ); 00074 displayItem( rom,16, 0x0004a3, "XAMCAP-F5-low", "XAM-capability for function 0 low" ); 00075 displayItem( rom,16, 0x0004e3, "XAMCAP-F5-high", "XAM-capability for function 0 high" ); 00076 displayItem( rom,16, 0x000523, "XAMCAP-F6-low", "XAM-capability for function 0 low" ); 00077 displayItem( rom,16, 0x000563, "XAMCAP-F6-high", "XAM-capability for function 0 high" ); 00078 displayItem( rom,16, 0x0005a3, "XAMCAP-F7-low", "XAM-capability for function 0 low" ); 00079 displayItem( rom,16, 0x0005e3, "XAMCAP-F7-high", "XAM-capability for function 0 high" ); 00080 00081 displayItem( rom, 4, 0x000623, "ADEM-F0", "Address Decoder Mask function 0" ); 00082 displayItem( rom, 4, 0x000633, "ADEM-F1", "Address Decoder Mask function 1" ); 00083 displayItem( rom, 4, 0x000643, "ADEM-F2", "Address Decoder Mask function 2" ); 00084 displayItem( rom, 4, 0x000653, "ADEM-F3", "Address Decoder Mask function 3" ); 00085 displayItem( rom, 4, 0x000663, "ADEM-F4", "Address Decoder Mask function 4" ); 00086 displayItem( rom, 4, 0x000673, "ADEM-F5", "Address Decoder Mask function 5" ); 00087 displayItem( rom, 4, 0x000683, "ADEM-F6", "Address Decoder Mask function 6" ); 00088 displayItem( rom, 4, 0x000693, "ADEM-F7", "Address Decoder Mask function 7" ); 00089 00090 displayItem( rom, 1, 0x0006af, "MasterDataWidth", "Master data access Width" ); 00091 displayItem( rom, 8, 0x0006b3, "MasterAMCAP", "Master AM Capapbilities" ); 00092 displayItem( rom,16, 0x0006d3, "MasterXAMCAP-low", "Master CAM Capapbilities" ); 00093 displayItem( rom,16, 0x000713, "MasterXAMCAP-high", "Master CAM Capapbilities" ); 00094 } 00095 00096 void HAL::ConfigROMDumper::displayItem( const std::vector<unsigned char>rom, 00097 const uint32_t length, 00098 const uint32_t address, 00099 const std::string key, 00100 const std::string description ) { 00101 std::cout << std::hex << std::setw(8) << std::setfill('0') << address << " : " 00102 << std::setw(18) << std::setfill(' ') << key << " : "; 00103 00104 uint32_t ix = (address-3) / 4; 00105 for ( uint32_t ic = 0; ic < length; ic++ ) { 00106 std::cout << std::setw(2) << std::setfill('0') << std::hex << ((uint32_t) rom[ix]) 00107 << " "; 00108 ix ++; 00109 } 00110 00111 uint32_t pad = (17-length) * 3; 00112 std::cout << std::setw(pad) << std::setfill(' ') << " : " << description << std::endl; 00113 }