From: openocd-gerrit <ope...@us...> - 2023-11-18 11:24:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via a69a4e23f4630fb21daea6f8264881c0546e340b (commit) from 8bf7f603ae8c441c7734c9dcdc5ee2805a620fb4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a69a4e23f4630fb21daea6f8264881c0546e340b Author: Ahmed BOUDJELIDA <abo...@na...> Date: Mon Oct 16 11:04:16 2023 +0200 contrib/firmware: extend the number of bytes to be sent in the i2c bit-banging read operation Change-Id: Iaeb3d5ba37da1bd77d36ad0ebbc6b45c46860dec Signed-off-by: Ahmed BOUDJELIDA <abo...@na...> Reviewed-on: https://review.openocd.org/c/openocd/+/7810 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/contrib/firmware/angie/c/src/usb.c b/contrib/firmware/angie/c/src/usb.c index e284efdf5..0a43ff9f6 100644 --- a/contrib/firmware/angie/c/src/usb.c +++ b/contrib/firmware/angie/c/src/usb.c @@ -757,14 +757,13 @@ void i2c_recieve(void) PIN_SDA_DIR = 0; if (EP6FIFOBUF[0] == 1) { uint8_t rdwr = EP6FIFOBUF[0]; //read - uint8_t reg_adr_check = EP6FIFOBUF[1]; - uint8_t count = EP6FIFOBUF[2]; //request data count + uint8_t data_count = EP6FIFOBUF[1]; //data sent count + uint8_t count = EP6FIFOBUF[2]; //requested data count uint8_t adr = EP6FIFOBUF[3]; //address - uint8_t reg_adr = EP6FIFOBUF[4]; uint8_t address = get_address(adr, rdwr); //address byte (read command) uint8_t address_2 = get_address(adr, 0); //address byte 2 (write command) - printf("%d\n", address); + printf("%d\n", address - 1); /* start: */ start_cd(); @@ -774,10 +773,12 @@ void i2c_recieve(void) uint8_t ack = get_ack(); /* send data */ - if (reg_adr_check) { //if there is a byte reg - send_byte(reg_adr); - /* ack(): */ - ack = get_ack(); + if (data_count) { //if there is a byte reg + for (uint8_t i = 0; i < data_count; i++) { + send_byte(EP6FIFOBUF[i + 4]); + /* ack(): */ + ack = get_ack(); + } } /* repeated start: */ @@ -788,13 +789,15 @@ void i2c_recieve(void) ack = get_ack(); /* receive data */ - for (uint8_t i = 0; i < count; i++) { + for (uint8_t i = 0; i < count - 1; i++) { EP8FIFOBUF[i] = receive_byte(); - /* send ack: */ + /* send ack: */ send_ack(); } + EP8FIFOBUF[count - 1] = receive_byte(); + /* stop */ stop_cd(); ----------------------------------------------------------------------- Summary of changes: contrib/firmware/angie/c/src/usb.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) hooks/post-receive -- Main OpenOCD repository |