#include "TPCCommandCoderReadback.h" #include //use when to compile on outdated slc #include int main( int argc, char** argv ) { // // Create TPCCommandCoderReadback object and read data block for Tag ptag and ID pid // string ptag; int pid; ptag = "TPC-FEE_1_12_1"; // The RCU to configure pid = 1; // The configuration ID for ( int i = 0; i < argc; i++ ) { if ( strcmp(argv[i], "-t") == 0 ) { ptag = argv[i+1]; } else if ( strcmp(argv[i], "-i") == 0 ) { pid = atoi( argv[i+1] ); } } //cerr << "ptag " << ptag << ", pid " << pid << endl; uint32_t *instrmem; // the intruction memory to be sent to RCU int32_t length = 0; // Will hold the intruction Mem length // Create the TPC CommandCoder object CommandCoderBase *CoCo = new TPCCommandCoderReadback(); //cerr.setf( ios::hex, ios::basefield ); // Create the data block. Returns length (in bytes) of data block. length = CoCo->createDataBlock( const_cast( ptag.c_str() ), pid ); cerr << "length in bytes:" << length << endl; // Fill data into instruction memory buffer. instrmem = CoCo->getDataBlock(); /* // Dump data to screen cerr << "codeAltroInstructionMemoryBlock: " << instrmem << endl; cerr.setf( ios::hex, ios::basefield ); for ( int i = 0; i < length / 4; i++ ) { cerr << setw( 3 ) << i << " | "; cerr << instrmem[ i ] << endl; } */ /* // Dump errors: cerr << "Errors:" << length << endl; vector errors = CoCo->getError(); for(int i = 0; i < errors.size(); i++){ cerr << i << "\t" << errors.at(i) << endl << endl; } */ // Dump data to screen (binary format) if ( instrmem != NULL ) cout.write( ( char* ) instrmem, length ); /* // Write to file ofstream *file = new ofstream(); file->open("standard.binary"); file->write((char*)instrmem, length*sizeof(long int)); file->close(); delete file; */ return 1; }