Commit e58f733f authored by Christos Gentsos's avatar Christos Gentsos

Mitig: also TMR the cmd_addr variables in the I2C implementation

parent 33021e21
......@@ -15,10 +15,12 @@
static struct io_descriptor *io __xMR;
static uint16_t rx_state __xMR = CMD;
static uint8_t std_cmd_addr;
static uint8_t tmp_std_cmd_addr;
static uint16_t std_cmd_addr __xMR;
static int16_t cmd_index __xMR;
static int16_t cmd_len __xMR;
static uint8_t ext_cmd_addr;
static uint8_t tmp_ext_cmd_addr;
static uint16_t ext_cmd_addr __xMR;
static uint16_t blk_wrote_len_byte __xMR;
static uint16_t last_byte_read_got_nack __xMR;
......@@ -58,7 +60,8 @@ static void __xMR I2C_slave_rx_complete_int(const struct i2c_s_async_descriptor
// set the PEC checksum
if (use_pec)
pec_checksum = crc8_byte(CONF_SERCOM_2_I2CS_ADDRESS << 1);
io_read(io, &std_cmd_addr, 1);
io_read(io, &tmp_std_cmd_addr, 1);
std_cmd_addr = tmp_std_cmd_addr;
if (use_pec)
pec_checksum = crc8_byte(pec_checksum ^ std_cmd_addr);
if (std_cmd_addr == 0xFF) {
......@@ -116,7 +119,8 @@ static void __xMR I2C_slave_rx_complete_int(const struct i2c_s_async_descriptor
rx_state = DATA;
break;
case EXT_CMD:
io_read(io, &ext_cmd_addr, 1);
io_read(io, &tmp_ext_cmd_addr, 1);
ext_cmd_addr = tmp_ext_cmd_addr;
if (use_pec)
pec_checksum = crc8_byte(pec_checksum ^ ext_cmd_addr);
if ((cmd_index = in_addr_space(ext_cmds, ext_cmd_addr)) != -1) {
......
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