@@ -29,7 +29,8 @@ class ProgramBarStress: public Program
2929 virtual Description getDescription ()
3030 {
3131 return {" Bar Stress" , " Stress the Bar Accessor" ,
32- " roc-bar-stress --id 42:00.0 --cycles 100000 --print-freq 10000" };
32+ " roc-bar-stress --id 04:00.0 --channel=1 --address=0x0f00040 --value=0x18 \n "
33+ " \t --cycles 100000 --print-freq 10000" };
3334 }
3435
3536 virtual void addOptions (boost::program_options::options_description& options)
@@ -42,16 +43,19 @@ class ProgramBarStress: public Program
4243 po::value<long long >(&mOptions .printFrequency )->default_value (10 ),
4344 " Print every #print-freq cycles" );
4445 Options::addOptionCardId (options);
46+ Options::addOptionRegisterAddress (options);
47+ Options::addOptionRegisterValue (options);
48+ Options::addOptionChannel (options);
4549 }
4650
47- int stress (BarInterface *bar, long long cycles, long long printFrequency)
51+ int stress (BarInterface *bar, uint32_t address, uint32_t value, long long cycles, long long printFrequency)
4852 {
4953
5054 std::chrono::high_resolution_clock::time_point start = std::chrono::high_resolution_clock::now ();
5155 std::chrono::high_resolution_clock::time_point finish = std::chrono::high_resolution_clock::now ();
5256
5357 for (long long i=0 ;; i++){
54- bar->writeRegister (SWT_WR_WORD_L, 0x42 );
58+ bar->writeRegister (address/ 4 , value );
5559
5660 if (i && ((i%printFrequency == 0 ) || (i == cycles))){
5761 finish = std::chrono::high_resolution_clock::now ();
@@ -76,25 +80,22 @@ class ProgramBarStress: public Program
7680 {
7781
7882 auto cardId = Options::getOptionCardId (map);
83+ int channelNumber = Options::getOptionChannel (map);
84+ uint32_t registerAddress = Options::getOptionRegisterAddress (map);
85+ uint32_t registerValue = Options::getOptionRegisterValue (map);
86+ auto params = AliceO2::roc::Parameters::makeParameters (cardId, channelNumber);
87+ auto bar = AliceO2::roc::ChannelFactory ().getBar (params);
7988
8089 getLogger () << " Card ID: " << cardId << InfoLogger::endm;
8190 getLogger () << " Total BAR write operations: " << mOptions .cycles << InfoLogger::endm;
8291 getLogger () << " Print frequency: " << mOptions .printFrequency << InfoLogger::endm;
8392
84- std::shared_ptr<BarInterface>
85- bar0 = ChannelFactory ().getBar (cardId, 0 );
86- std::shared_ptr<BarInterface>
87- bar2 = ChannelFactory ().getBar (cardId, 2 );
88-
89- if (isVerbose ())
90- getLogger () << " Resetting card..." << InfoLogger::endm;
91- bar0->writeRegister (Cru::Registers::RESET_CONTROL.index , 0x1 );
92-
9393 if (isVerbose ())
9494 getLogger () << " Running operations..." << InfoLogger::endm;
9595
9696 auto start = std::chrono::high_resolution_clock::now ();
97- long long cycles_run = stress (bar2.get (), mOptions .cycles , mOptions .printFrequency );
97+ long long cycles_run = stress (bar.get (), registerAddress, registerValue,
98+ mOptions .cycles , mOptions .printFrequency );
9899 auto finish = std::chrono::high_resolution_clock::now ();
99100
100101 if (!cycles_run)
0 commit comments