Commit eeb980c7 authored by Tristan Gingold's avatar Tristan Gingold

fip_urv.c: always increment cmd offset

parent ee2db136
Pipeline #4872 failed
......@@ -419,11 +419,13 @@ static void do_i2c_run (struct i2c_cmd *i2c)
/* Read the command to be executed */
unsigned char cmd_i2c = i2c->cmds[i2c->coff];
/* And skip it */
i2c->coff++;
if ((cmd_i2c & 0x0f) == I2C_CMD_SET_TARG) {
/* Set target */
i2c->bus = cmd_i2c >> 4;
REGS->i2c[OC_I2C_CFG] = i2c->bus;
i2c->coff++;
/* This is a prefix command. The next byte contains the address */
cmd_i2c = I2C_CMD_SET_ADDR;
......@@ -500,12 +502,10 @@ static void do_i2c_run (struct i2c_cmd *i2c)
/* Set bit0 if the command is a read. */
REGS->i2c[OC_I2C_RXTX] = i2c->addr | (cmd_i2c == I2C_CMD_START_R);
REGS->i2c[OC_I2C_CR] = 0x90; /* START + WRITE */
i2c->coff++;
} else if (cmd_i2c == I2C_CMD_WRITE || cmd_i2c == I2C_CMD_WRITE_STOP) {
/* Write Operation */
i2c->coff++;
i2c->len = i2c->cmds[i2c->coff];
i2c->coff++;
do_i2c_write(i2c);
......@@ -516,10 +516,9 @@ static void do_i2c_run (struct i2c_cmd *i2c)
/* Read Operation */
if (cmd_i2c != I2C_CMD_READLEN_STOP) {
i2c->coff++;
i2c->len = i2c->cmds[i2c->coff];
i2c->coff++;
}
i2c->coff++;
do_i2c_read(i2c);
} else {
......
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