1121 } |
1121 } |
1122 |
1122 |
1123 /*****************************************************************************/ |
1123 /*****************************************************************************/ |
1124 |
1124 |
1125 /** |
1125 /** |
1126 Initializes a sync manager configuration page with EEPROM data. |
|
1127 The referenced memory (\a data) must be at least EC_SYNC_SIZE bytes. |
|
1128 */ |
|
1129 |
|
1130 void ec_slave_sync_config(const ec_slave_t *slave, /**< EtherCAT slave */ |
|
1131 const ec_sync_t *sync, /**< sync manager */ |
|
1132 uint8_t *data /**> configuration memory */ |
|
1133 ) |
|
1134 { |
|
1135 size_t sync_size; |
|
1136 |
|
1137 sync_size = ec_slave_calc_sync_size(slave, sync); |
|
1138 |
|
1139 if (slave->master->debug_level) { |
|
1140 EC_DBG("Slave %3i, SM %i: Addr 0x%04X, Size %3i, Ctrl 0x%02X, En %i\n", |
|
1141 slave->ring_position, sync->index, sync->physical_start_address, |
|
1142 sync_size, sync->control_register, sync->enable); |
|
1143 } |
|
1144 |
|
1145 EC_WRITE_U16(data, sync->physical_start_address); |
|
1146 EC_WRITE_U16(data + 2, sync_size); |
|
1147 EC_WRITE_U8 (data + 4, sync->control_register); |
|
1148 EC_WRITE_U8 (data + 5, 0x00); // status byte (read only) |
|
1149 EC_WRITE_U16(data + 6, sync->enable ? 0x0001 : 0x0000); // enable |
|
1150 } |
|
1151 |
|
1152 /*****************************************************************************/ |
|
1153 |
|
1154 /** |
|
1155 \return non-zero if slave is a bus coupler |
1126 \return non-zero if slave is a bus coupler |
1156 */ |
1127 */ |
1157 |
1128 |
1158 int ec_slave_is_coupler(const ec_slave_t *slave /**< EtherCAT slave */) |
1129 int ec_slave_is_coupler(const ec_slave_t *slave /**< EtherCAT slave */) |
1159 { |
1130 { |