Skip to content
Snippets Groups Projects
Commit 57876eb2 authored by Florian Pose's avatar Florian Pose
Browse files

Enable sync managers only if SII enable is set and size is greater zero.

parent d4e05d47
No related branches found
No related tags found
No related merge requests found
...@@ -105,17 +105,20 @@ void ec_sync_config( ...@@ -105,17 +105,20 @@ void ec_sync_config(
uint8_t *data /**> Configuration memory. */ uint8_t *data /**> Configuration memory. */
) )
{ {
// enable only if SII enable is set and size is > 0.
uint16_t enable = sync->enable && data_size;
if (sync->slave->master->debug_level) { if (sync->slave->master->debug_level) {
EC_DBG("SM%i: Addr 0x%04X, Size %3i, Ctrl 0x%02X, En %i\n", EC_DBG("SM%u: Addr 0x%04X, Size %3u, Ctrl 0x%02X, En %u\n",
sync->index, sync->physical_start_address, sync->index, sync->physical_start_address,
data_size, sync->control_register, sync->enable); data_size, sync->control_register, enable);
} }
EC_WRITE_U16(data, sync->physical_start_address); EC_WRITE_U16(data, sync->physical_start_address);
EC_WRITE_U16(data + 2, data_size); EC_WRITE_U16(data + 2, data_size);
EC_WRITE_U8 (data + 4, sync->control_register); EC_WRITE_U8 (data + 4, sync->control_register);
EC_WRITE_U8 (data + 5, 0x00); // status byte (read only) EC_WRITE_U8 (data + 5, 0x00); // status byte (read only)
EC_WRITE_U16(data + 6, sync->enable ? 0x0001 : 0x0000); // enable EC_WRITE_U16(data + 6, enable);
} }
/*****************************************************************************/ /*****************************************************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment