Commit 390b6321 authored by Fabio Utzig's avatar Fabio Utzig
Browse files

Fix mem_read to return correct value of read memory

MEM_READ was returning the wrong data for the memory
register being read. This did not impact the software
because the returned value was not being used. It is
now fixed to return the correct data.

Thanks to Marcos Faustino <mrfaustino@pede.com.br> for
pointing this out!
parent 34526459
......@@ -307,9 +307,14 @@ static int send_mem_read(libusb_device_handle *handle, const uint32_t addr, uint
int retval = send_u32(handle, "x", addr, ",4");
if (retval)
return retval;
if (val)
*val = le32_to_cpu(buf.u32[0]);
if (val) {
uint32_t u = 0;
u |= buf.u8[8] << 24;
u |= buf.u8[7] << 16;
u |= buf.u8[6] << 8;
u |= buf.u8[5];
*val = le32_to_cpu(u);
}
return 0;
}
......
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