contrib/firmware: extend the number of bytes to be sent in the i2c bit-banging read... 10/7810/5
authorAhmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Mon, 16 Oct 2023 09:04:16 +0000 (11:04 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 18 Nov 2023 11:24:02 +0000 (11:24 +0000)
Change-Id: Iaeb3d5ba37da1bd77d36ad0ebbc6b45c46860dec
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7810
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
contrib/firmware/angie/c/src/usb.c

index e284efdf58226308ef747958dd0459db445fe22b..0a43ff9f656286d3d03f9537d4822e6d8cfe35c3 100644 (file)
@@ -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();
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)