diff --git a/NEWS b/NEWS index 5aef5486..2a54d561 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,12 @@ $Id$ ------------------------------------------------------------------------------- +Changes in version XXX: + +* Allow gaps in PDO mapping read from CoE. + +------------------------------------------------------------------------------- + Changes in version 1.3.2: * New feature: Read dynamic PDO mapping from SDO dictionary. diff --git a/master/fsm_coe_map.c b/master/fsm_coe_map.c index b4101337..e8b9156b 100644 --- a/master/fsm_coe_map.c +++ b/master/fsm_coe_map.c @@ -467,6 +467,30 @@ void ec_fsm_coe_map_state_pdo_entry( pdo_entry->subindex = (pdo_entry_info >> 8) & 0xFF; pdo_entry->bit_length = pdo_entry_info & 0xFF; + if (!pdo_entry->index && !pdo_entry->subindex) { + char gapname[] = "Gap"; + + // we have a gap in the PDO, next PDO entry + if (fsm->slave->master->debug_level) { + EC_DBG(" PDO entry gap: %u bit.\n", + pdo_entry->bit_length); + } + + if (!(pdo_entry->name = (char *) + kmalloc(strlen(gapname) + 1, GFP_KERNEL))) { + EC_ERR("Failed to allocate GAP entry name.\n"); + kfree(pdo_entry); + fsm->state = ec_fsm_coe_map_state_error; + return; + } + + memcpy(pdo_entry->name, gapname, strlen(gapname) + 1); + list_add_tail(&pdo_entry->list, &fsm->pdo->entries); + fsm->pdo_subindex++; + ec_fsm_coe_map_action_next_pdo_entry(fsm); + return; + } + if (!(sdo = ec_slave_get_sdo(fsm->slave, pdo_entry->index))) { EC_ERR("Slave %u has no SDO 0x%04X.\n", fsm->slave->ring_position, pdo_entry->index);