Fix style issues with previous commit
parent
cc98a14839
commit
4191505b76
|
@ -2884,7 +2884,7 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
|
||||
uint32_t num_sbdata_regs = get_num_sbdata_regs(target);
|
||||
|
||||
// Test 1: Simple write/read test
|
||||
/* Test 1: Simple write/read test */
|
||||
test_passed = true;
|
||||
sbcs = set_field(sbcs_orig, DMI_SBCS_SBAUTOINCREMENT, 0);
|
||||
dmi_write(target, DMI_SBCS, sbcs);
|
||||
|
@ -2910,7 +2910,8 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
uint32_t *val = read_memory_sba_simple(target, addr, num_sbdata_regs, sbcs);
|
||||
for (uint32_t j = 0; j < num_sbdata_regs; j++) {
|
||||
if (((test_patterns[j]+i)&compare_mask) != (val[j]&compare_mask)) {
|
||||
LOG_ERROR("System Bus Access Test 1: Error reading non-autoincremented address %x, expected val = %x, read val = %x", addr, test_patterns[j]+i, val[j]);
|
||||
LOG_ERROR("System Bus Access Test 1: Error reading non-autoincremented address %x,"
|
||||
"expected val = %x, read val = %x", addr, test_patterns[j]+i, val[j]);
|
||||
test_passed = false;
|
||||
}
|
||||
}
|
||||
|
@ -2920,7 +2921,7 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
if (test_passed)
|
||||
LOG_INFO("System Bus Access Test 1: Simple write/read test PASSED.");
|
||||
|
||||
// Test 2: Address autoincrement test
|
||||
/* Test 2: Address autoincrement test */
|
||||
target_addr_t curr_addr;
|
||||
target_addr_t prev_addr;
|
||||
test_passed = true;
|
||||
|
@ -2965,7 +2966,8 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
dmi_read(target, &val, DMI_SBDATA0);
|
||||
read_sbcs_nonbusy(target, &sbcs);
|
||||
if (i != val) {
|
||||
LOG_ERROR("System Bus Access Test 2: Error reading auto-incremented address, expected val = %x, read val = %x",i,val);
|
||||
LOG_ERROR("System Bus Access Test 2: Error reading auto-incremented address,"
|
||||
"expected val = %x, read val = %x", i, val);
|
||||
test_passed = false;
|
||||
}
|
||||
}
|
||||
|
@ -2973,7 +2975,7 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
if (test_passed)
|
||||
LOG_INFO("System Bus Access Test 2: Address auto-increment test PASSED.");
|
||||
|
||||
// Test 3: Read from illegal address
|
||||
/* Test 3: Read from illegal address */
|
||||
uint32_t *illegal_addr_read = read_memory_sba_simple(target, illegal_address, 1, sbcs_orig);
|
||||
free(illegal_addr_read);
|
||||
|
||||
|
@ -2986,7 +2988,7 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
LOG_ERROR("System Bus Access Test 3: Illegal address read test FAILED.");
|
||||
}
|
||||
|
||||
// Test 4: Write to illegal address
|
||||
/* Test 4: Write to illegal address */
|
||||
write_memory_sba_simple(target, illegal_address, test_patterns, 1, sbcs_orig);
|
||||
|
||||
dmi_read(target, &rd_val, DMI_SBCS);
|
||||
|
@ -2998,7 +3000,7 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
LOG_ERROR("System Bus Access Test 4: Illegal address write test FAILED.");
|
||||
}
|
||||
|
||||
// Test 5: Write with unsupported sbaccess size
|
||||
/* Test 5: Write with unsupported sbaccess size */
|
||||
uint32_t sbaccess128 = get_field(sbcs_orig, DMI_SBCS_SBACCESS128);
|
||||
|
||||
if (sbaccess128) {
|
||||
|
@ -3011,9 +3013,6 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
|
||||
dmi_read(target, &rd_val, DMI_SBCS);
|
||||
|
||||
LOG_INFO("SBCS.SBACCESS128 = %x",sbaccess128);
|
||||
LOG_INFO("SBCS.SBERROR = %x",get_field(rd_val,DMI_SBCS_SBERROR));
|
||||
|
||||
if (get_field(rd_val, DMI_SBCS_SBERROR) == 3) {
|
||||
sbcs = set_field(sbcs_orig, DMI_SBCS_SBERROR, 1);
|
||||
dmi_write(target, DMI_SBCS, sbcs);
|
||||
|
@ -3027,7 +3026,7 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
}
|
||||
}
|
||||
|
||||
// Test 6: Write to misaligned address
|
||||
/* Test 6: Write to misaligned address */
|
||||
sbcs = set_field(sbcs_orig, DMI_SBCS_SBACCESS, 1);
|
||||
dmi_write(target, DMI_SBCS, sbcs);
|
||||
|
||||
|
@ -3050,13 +3049,11 @@ static int riscv013_test_sba_config_reg(struct target *target,
|
|||
sbcs = set_field(sbcs_orig, DMI_SBCS_SBREADONADDR, 1);
|
||||
dmi_write(target, DMI_SBCS, sbcs);
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
for (int i = 0; i < 16; i++)
|
||||
dmi_write(target, DMI_SBDATA0, 0xdeadbeef);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
for (int i = 0; i < 16; i++)
|
||||
dmi_write(target, DMI_SBADDRESS0, legal_address);
|
||||
}
|
||||
|
||||
dmi_read(target, &rd_val, DMI_SBCS);
|
||||
if (get_field(rd_val, DMI_SBCS_SBBUSYERROR)) {
|
||||
|
@ -3102,10 +3099,9 @@ void write_memory_sba_simple(struct target *target, target_addr_t addr,
|
|||
|
||||
/* Write SBDATA registers starting with highest address, since write to
|
||||
* SBDATA0 triggers write */
|
||||
for (int i = write_size-1; i >= 0; i--) {
|
||||
for (int i = write_size-1; i >= 0; i--)
|
||||
dmi_write(target, DMI_SBDATA0+i, write_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t *read_memory_sba_simple(struct target *target, target_addr_t addr,
|
||||
uint32_t read_size, uint32_t sbcs)
|
||||
|
@ -3123,7 +3119,7 @@ uint32_t* read_memory_sba_simple(struct target *target, target_addr_t addr,
|
|||
uint32_t sbcs_readonaddr = set_field(sbcs, DMI_SBCS_SBREADONADDR, 1);
|
||||
dmi_write(target, DMI_SBCS, sbcs_readonaddr);
|
||||
|
||||
// Write addresses starting with highest address register
|
||||
/* Write addresses starting with highest address register */
|
||||
for (int i = sba_size/32-1; i >= 0; i--) {
|
||||
masked_addr = (addr >> 32*i) & 0xffffffff;
|
||||
|
||||
|
@ -3135,9 +3131,8 @@ uint32_t* read_memory_sba_simple(struct target *target, target_addr_t addr,
|
|||
|
||||
read_sbcs_nonbusy(target, &rd_sbcs);
|
||||
|
||||
for (uint32_t i = 0; i < read_size; i++) {
|
||||
for (uint32_t i = 0; i < read_size; i++)
|
||||
dmi_read(target, &(rd_val[i]), DMI_SBDATA0+i);
|
||||
}
|
||||
|
||||
return rd_val;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue