On Sat, Mar 6, 2010 at 5:29 AM, Øyvind Harboe <[email protected]> wrote:
> But look at the definition of CFI_MAX_BUS_WIDTH:
>
> #define CFI_MAX_BUS_WIDTH 4
>
> You're replacing 8 w/4, that's not a no-op and if correct, deserves
> a good explanation in the commit comment...
Agree, commit message is not explaining at all!
Let me put here a longer explanation, and change later the commit message.
Allover the code, the pattern is:
uint8_t command[8];
cfi_command(..., command);
...target_write_memory(..., bank->bus_width, 1, command)...
But:
- cfi_command() will only set the first CFI_MAX_BUS_WIDTH elements of
array command[];
- target_write_memory() will use only first (bank->bus_width * 1)
elements of array;
- bank->bus_width has already been constrained to be <= CFI_MAX_BUS_WIDTH.
So the right size for command[] is CFI_MAX_BUS_WIDTH.
Probably, a better patch should merge the code pattern above in a
single function, e.g. cfi_write_command_to_target(), that allocates
local array, sets it, writes it to target and frees it.
This would be less flexible, but would highlight the needed array size.
Best Regards,
Antonio Borneo
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development