Skip to content

Commit

Permalink
fix code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: anandaravuri <ananda.ravuri@intel.com>
  • Loading branch information
anandaravuri committed Feb 22, 2024
1 parent 39b4acc commit 025cdc4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
9 changes: 4 additions & 5 deletions libraries/afu-test/afu_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ class afu {

// Error out if the # of tokens != 1
if (tokens.size() < 1) {
logger_->info("Not found FPGA DEVICE");
logger_->info("no FPGA DEVICE found");
return false;
}

if (tokens.size() > 1) {
std::cout << "more than one FPGA DEVICE found \n";
logger_->info("more than one FPGA DEVICE found ");
return false;
}

Expand All @@ -241,9 +241,8 @@ class afu {

int open_handle(const char *afu_id) {

if (!enum_fpga_device()) {
std::cout << "Not Found FME device\n";
}
enum_fpga_device();

auto filter = fpga::properties::get(); // Get an empty properties object

// The following code attempts to get a token+handle for the DEVICE.
Expand Down
42 changes: 22 additions & 20 deletions samples/host_exerciser/host_exerciser_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,9 @@ class host_exerciser_cmd : public test_command
auto d_afu = dynamic_cast<host_exerciser*>(afu);
token_device_ = d_afu->get_token_device();

if (!token_device_)
return;

// Check if memory calibration has failed and error out before proceeding
// with the test. The dfl-emif driver creates sysfs entries to report the
// calibration status for each memory channel. sysobjects are the OPAE-API's
Expand All @@ -865,28 +868,27 @@ class host_exerciser_cmd : public test_command
// strange and perhaps unnecessary limitation. Therefore, future work is to
// fix that and clean up the code below.

if (token_device_) {
for (size_t i = 0; i < MAX_NUM_MEM_CHANNELS; i++) {
std::stringstream mem_cal_glob;
// Construct the glob string to search for the cal_fail sysfs entry
// for the i'th mem channel
mem_cal_glob << "*dfl*/**/inf" << i << "_cal_fail";
// Ask for a sysobject with this glob string
fpga::sysobject::ptr_t testobj = fpga::sysobject::get(
token_device_, mem_cal_glob.str().c_str(), FPGA_OBJECT_GLOB);

// if test obj !=null, the sysfs entry was found.
// Read the calibration status from the sysfs entry.
// A non-zero value (typically '1') means
// calibration has failed --> we error out.
if (testobj && testobj->read64(0)) {
std::cout
<< "This sysfs entry reports that memory calibration has failed:"
<< mem_cal_glob.str().c_str() << std::endl;
return;
}
for (size_t i = 0; i < MAX_NUM_MEM_CHANNELS; i++) {
std::stringstream mem_cal_glob;
// Construct the glob string to search for the cal_fail sysfs entry
// for the i'th mem channel
mem_cal_glob << "*dfl*/**/inf" << i << "_cal_fail";
// Ask for a sysobject with this glob string
fpga::sysobject::ptr_t testobj = fpga::sysobject::get(
token_device_, mem_cal_glob.str().c_str(), FPGA_OBJECT_GLOB);

// if test obj !=null, the sysfs entry was found.
// Read the calibration status from the sysfs entry.
// A non-zero value (typically '1') means
// calibration has failed --> we error out.
if (testobj && testobj->read64(0)) {
std::cout
<< "This sysfs entry reports that memory calibration has failed:"
<< mem_cal_glob.str().c_str() << std::endl;
return;
}
}

}

protected:
Expand Down

0 comments on commit 025cdc4

Please sign in to comment.