# HG changeset patch # User Florian Pose # Date 1161172231 0 # Node ID 2e50ddc3e77784d85d60c4483f54a135ce48026c # Parent 42d239bab6ae82795b34f841cc20a0ebece558fa Added FMMU debugging. diff -r 42d239bab6ae -r 2e50ddc3e777 master/master.c --- a/master/master.c Wed Oct 18 10:30:34 2006 +0000 +++ b/master/master.c Wed Oct 18 11:50:31 2006 +0000 @@ -710,6 +710,18 @@ sync_size = ec_slave_calc_sync_size(slave, fmmu->sync); + if (slave->master->debug_level) { + EC_DBG("Slave %i, FMMU %i:\n", + slave->ring_position, fmmu->index); + + EC_DBG(" Logical address: 0x%04X\n", fmmu->logical_start_address); + EC_DBG(" Size: %i\n", sync_size); + EC_DBG(" Physical address: 0x%04X\n", + fmmu->sync->physical_start_address); + EC_DBG(" Direction: %s\n", + ((fmmu->sync->control_register & 0x04) ? "output" : "input")); + } + 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 diff -r 42d239bab6ae -r 2e50ddc3e777 master/slave.c --- a/master/slave.c Wed Oct 18 10:30:34 2006 +0000 +++ b/master/slave.c Wed Oct 18 11:50:31 2006 +0000 @@ -464,11 +464,14 @@ ) { unsigned int i; + ec_fmmu_t *fmmu; // FMMU configuration already prepared? - for (i = 0; i < slave->fmmu_count; i++) - if (slave->fmmus[i].domain == domain && slave->fmmus[i].sync == sync) + for (i = 0; i < slave->fmmu_count; i++) { + fmmu = &slave->fmmus[i]; + if (fmmu->domain == domain && fmmu->sync == sync) return 0; + } // reserve new FMMU... @@ -477,9 +480,13 @@ return -1; } - slave->fmmus[slave->fmmu_count].domain = domain; - slave->fmmus[slave->fmmu_count].sync = sync; - slave->fmmus[slave->fmmu_count].logical_start_address = 0; + fmmu = &slave->fmmus[slave->fmmu_count]; + + fmmu->index = slave->fmmu_count; + fmmu->domain = domain; + fmmu->sync = sync; + fmmu->logical_start_address = 0; + slave->fmmu_count++; slave->registered = 1; diff -r 42d239bab6ae -r 2e50ddc3e777 master/slave.h --- a/master/slave.h Wed Oct 18 10:30:34 2006 +0000 +++ b/master/slave.h Wed Oct 18 11:50:31 2006 +0000 @@ -173,6 +173,7 @@ typedef struct { + unsigned int index; /**< FMMU index */ const ec_domain_t *domain; /**< domain */ const ec_sii_sync_t *sync; /**< sync manager */ uint32_t logical_start_address; /**< logical start address */