Added debugging for configuration function of the application interface.
authorFlorian Pose <fp@igh-essen.com>
Fri, 01 Aug 2008 09:24:26 +0000
changeset 1181 9e5954a2a46e
parent 1180 846907b8cc4b
child 1182 f5e725aa5483
Added debugging for configuration function of the application interface.
TODO
master/domain.c
master/master.c
master/slave_config.c
--- a/TODO	Fri Aug 01 08:58:35 2008 +0000
+++ b/TODO	Fri Aug 01 09:24:26 2008 +0000
@@ -13,7 +13,6 @@
 * Race in jiffies frame timeout?
 * Remove ec_sync_t::assign_source?
 * Repair rcethercat status.
-* Debug output for all configuration functions of the application interface.
 * Abort code messages in userspace.
 
 Future issues:
--- a/master/domain.c	Fri Aug 01 08:58:35 2008 +0000
+++ b/master/domain.c	Fri Aug 01 09:24:26 2008 +0000
@@ -322,6 +322,10 @@
     ec_slave_config_t *sc;
     int ret;
     
+    if (domain->master->debug_level)
+        EC_DBG("ecrt_domain_reg_pdo_entry_list(domain = 0x%x, regs = 0x%x)\n",
+                (u32) domain, (u32) regs);
+
     for (reg = regs; reg->index; reg++) {
         if (!(sc = ecrt_master_slave_config(domain->master, reg->alias,
                         reg->position, reg->vendor_id, reg->product_code)))
@@ -348,6 +352,10 @@
 
 void ecrt_domain_external_memory(ec_domain_t *domain, uint8_t *mem)
 {
+    if (domain->master->debug_level)
+        EC_DBG("ecrt_domain_external_memory(domain = 0x%x, mem = 0x%x)\n",
+                (u32) domain, (u32) mem);
+
     down(&domain->master->master_sem);
 
     ec_domain_clear_data(domain);
--- a/master/master.c	Fri Aug 01 08:58:35 2008 +0000
+++ b/master/master.c	Fri Aug 01 09:24:26 2008 +0000
@@ -1219,6 +1219,9 @@
     ec_domain_t *domain, *last_domain;
     unsigned int index;
 
+    if (master->debug_level)
+        EC_DBG("ecrt_master_create_domain(master = 0x%x)\n", (u32) master);
+
     if (!(domain = (ec_domain_t *) kmalloc(sizeof(ec_domain_t), GFP_KERNEL))) {
         EC_ERR("Error allocating domain memory!\n");
         return NULL;
@@ -1238,6 +1241,9 @@
 
     up(&master->master_sem);
 
+    if (master->debug_level)
+        EC_DBG("Created domain %u.\n", domain->index);
+
     return domain;
 }
 
@@ -1248,6 +1254,9 @@
     uint32_t domain_offset;
     ec_domain_t *domain;
 
+    if (master->debug_level)
+        EC_DBG("ecrt_master_activate(master = 0x%x)\n", (u32) master);
+
     down(&master->master_sem);
 
     // finish all domains
@@ -1384,6 +1393,12 @@
     ec_slave_config_t *sc;
     unsigned int found = 0;
 
+
+    if (master->debug_level)
+        EC_DBG("ecrt_master_slave_config(master = 0x%x, alias = %u, "
+                "position = %u, vendor_id = %u, product_code = %u)\n",
+                (u32) master, alias, position, vendor_id, product_code);
+
     list_for_each_entry(sc, &master->configs, list) {
         if (sc->alias == alias && sc->position == position) {
             found = 1;
@@ -1432,6 +1447,11 @@
 void ecrt_master_callbacks(ec_master_t *master, int (*request_cb)(void *),
         void (*release_cb)(void *), void *cb_data)
 {
+    if (master->debug_level)
+        EC_DBG("ecrt_master_callbacks(master = 0x%x, request_cb = 0x%x, "
+                " release_cb = 0x%x, cb_data = 0x%x)\n", (u32) master,
+                (u32) request_cb, (u32) release_cb, (u32) cb_data);
+
     master->ext_request_cb = request_cb;
     master->ext_release_cb = release_cb;
     master->ext_cb_data = cb_data;
--- a/master/slave_config.c	Fri Aug 01 08:58:35 2008 +0000
+++ b/master/slave_config.c	Fri Aug 01 09:24:26 2008 +0000
@@ -709,6 +709,11 @@
 {
     ec_sdo_request_t *req;
 
+    if (sc->master->debug_level)
+        EC_DBG("ecrt_slave_config_create_sdo_request(sc = 0x%x, "
+                "index = 0x%04X, subindex = 0x%02X, size = %u)\n", (u32) sc,
+                index, subindex, size);
+
     if (!(req = (ec_sdo_request_t *)
                 kmalloc(sizeof(ec_sdo_request_t), GFP_KERNEL))) {
         EC_ERR("Failed to allocate Sdo request memory!\n");