--- a/master/slave.c Wed Mar 07 13:12:33 2007 +0000
+++ b/master/slave.c Wed Mar 07 13:29:29 2007 +0000
@@ -591,21 +591,22 @@
/*****************************************************************************/
/**
- Prepares an FMMU configuration.
- Configuration data for the FMMU is saved in the slave structure and is
- written to the slave in ecrt_master_activate().
- The FMMU configuration is done in a way, that the complete data range
- of the corresponding sync manager is covered. Seperate FMMUs are configured
- for each domain.
- If the FMMU configuration is already prepared, the function returns with
- success.
- \return 0 in case of success, else < 0
-*/
-
-int ec_slave_prepare_fmmu(ec_slave_t *slave, /**< EtherCAT slave */
- const ec_domain_t *domain, /**< domain */
- const ec_sync_t *sync /**< sync manager */
- )
+ * Prepares an FMMU configuration.
+ * Configuration data for the FMMU is saved in the slave structure and is
+ * written to the slave in ecrt_master_activate().
+ * The FMMU configuration is done in a way, that the complete data range
+ * of the corresponding sync manager is covered. Seperate FMMUs are configured
+ * for each domain.
+ * If the FMMU configuration is already prepared, the function returns with
+ * success.
+ * \return 0 in case of success, else < 0
+ */
+
+int ec_slave_prepare_fmmu(
+ ec_slave_t *slave, /**< EtherCAT slave */
+ const ec_domain_t *domain, /**< domain */
+ const ec_sync_t *sync /**< sync manager */
+ )
{
unsigned int i;
ec_fmmu_t *fmmu;
@@ -626,12 +627,11 @@
fmmu = &slave->fmmus[slave->fmmu_count];
- fmmu->index = slave->fmmu_count;
+ ec_fmmu_init(fmmu, slave, slave->fmmu_count++);
fmmu->domain = domain;
fmmu->sync = sync;
fmmu->logical_start_address = 0;
- slave->fmmu_count++;
slave->pdos_registered = 1;
ec_slave_request_state(slave, EC_SLAVE_STATE_OP);
@@ -1152,42 +1152,6 @@
/*****************************************************************************/
/**
- Initializes an FMMU configuration page.
- The referenced memory (\a data) must be at least EC_FMMU_SIZE bytes.
-*/
-
-void ec_slave_fmmu_config(const ec_slave_t *slave, /**< EtherCAT slave */
- const ec_fmmu_t *fmmu, /**< FMMU */
- uint8_t *data /**> configuration memory */
- )
-{
- size_t sync_size;
-
- sync_size = ec_slave_calc_sync_size(slave, fmmu->sync);
-
- if (slave->master->debug_level) {
- EC_DBG("Slave %3i, FMMU %2i:"
- " LogAddr 0x%08X, Size %3i, PhysAddr 0x%04X, Dir %s\n",
- slave->ring_position, fmmu->index, fmmu->logical_start_address,
- sync_size, fmmu->sync->physical_start_address,
- ((fmmu->sync->control_register & 0x04) ? "out" : "in"));
- }
-
- EC_WRITE_U32(data, fmmu->logical_start_address);
- EC_WRITE_U16(data + 4, sync_size); // size of fmmu
- EC_WRITE_U8 (data + 6, 0x00); // logical start bit
- EC_WRITE_U8 (data + 7, 0x07); // logical end bit
- EC_WRITE_U16(data + 8, fmmu->sync->physical_start_address);
- EC_WRITE_U8 (data + 10, 0x00); // physical start bit
- EC_WRITE_U8 (data + 11, ((fmmu->sync->control_register & 0x04)
- ? 0x02 : 0x01));
- EC_WRITE_U16(data + 12, 0x0001); // enable
- EC_WRITE_U16(data + 14, 0x0000); // reserved
-}
-
-/*****************************************************************************/
-
-/**
\return non-zero if slave is a bus coupler
*/