Commit a8c6809f authored by Jorge Machado's avatar Jorge Machado

Improve comments. Unify variables. Remove useless variables

parent d74bcb21
......@@ -50,6 +50,8 @@
#define SDB_7SOLS_VENDOR 0x000075cb
// Products
#define SDB_DIO_PID 0x00000001
// V2 DIO gateware product ID. The 0x3 value should
// be used to mantain backward compatibility
#define SDB_DIO_PID_V2 0x00000003
#define SDB_DIO_NAME "DIO"
......@@ -216,9 +218,7 @@ static int spec_sdb_fpga_dev_register(struct fmc_device *fmc, struct fpga_dev *f
int i, j, r;
unsigned int n_irqs = 0;
unsigned int n_res = 0;
int find_v2 = 0;
int v1_found = 0;
int v2_found = 0;
int version_found = 0;
if(fdev->n_cores <= 0 || fdev->n_cores >= FPGA_DEV_MAX_CORES)
return -EINVAL;
......@@ -240,13 +240,13 @@ static int spec_sdb_fpga_dev_register(struct fmc_device *fmc, struct fpga_dev *f
fdev->cores[i].pid,&size);
if(start < 0) {
// If DIO V1 is not found, try to find DIO V2
if(fdev->cores[i].vid == SDB_7SOLS_VENDOR) {
// If DIO V1 is not found, continue to find DIO V2
if(fdev->cores[i].pid == SDB_DIO_PID) {
find_v2 = 1;
continue;
}
else if(fdev->cores[i].pid == SDB_DIO_PID_V2 && v1_found == 1){
// If DIO V2 is not found, check if DIO V2 has been found previously
else if(fdev->cores[i].pid == SDB_DIO_PID_V2 && version_found == 1){
continue;
}
}
......@@ -256,12 +256,14 @@ static int spec_sdb_fpga_dev_register(struct fmc_device *fmc, struct fpga_dev *f
}
if(fdev->cores[i].vid == SDB_7SOLS_VENDOR) {
//DIO v1 has been detected
if(fdev->cores[i].pid == SDB_DIO_PID) {
v1_found = 1;
version_found = 1;
}
//DIO v2 has been detected
else if(fdev->cores[i].pid == SDB_DIO_PID_V2)
{
v2_found = 1;
version_found = 2;
}
}
......@@ -287,8 +289,8 @@ static int spec_sdb_fpga_dev_register(struct fmc_device *fmc, struct fpga_dev *f
fdev->dev.resource = res;
fdev->dev.num_resources = n_res;
//set V2 device name if necessary
if(v2_found == 1) {
//Set V2 device name if it has been detected
if(version_found == 2) {
fdev->dev.name = FPGA_DEVS_DIO_DEV_PDEV_NAME_V2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment