printk durch Makros ersetzt.
authorFlorian Pose <fp@igh-essen.com>
Fri, 24 Feb 2006 16:10:52 +0000
changeset 84 b4ae98855cea
parent 83 e8b76a509bc9
child 85 eb24637883ef
printk durch Makros ersetzt.
Makefile
master/canopen.c
master/device.c
master/domain.c
master/frame.c
master/globals.h
master/master.c
master/module.c
master/slave.c
--- a/Makefile	Fri Feb 24 14:09:51 2006 +0000
+++ b/Makefile	Fri Feb 24 16:10:52 2006 +0000
@@ -33,7 +33,6 @@
 
 clean:
 	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
-	@rm -rf */.tmp_versions
 
 config conf $(CONFIG_FILE):
 	@echo "# EtherCAT Konfigurationsdatei Kernel 2.6" > $(CONFIG_FILE)
--- a/master/canopen.c	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/canopen.c	Fri Feb 24 16:10:52 2006 +0000
@@ -38,7 +38,7 @@
     master = slave->master;
 
     if (size == 0 || size > 4) {
-        printk(KERN_ERR "EtherCAT: Illegal SDO data size: %i!\n", size);
+        EC_ERR("Illegal SDO data size: %i!\n", size);
         return -1;
     }
 
@@ -62,7 +62,7 @@
     if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Mailbox send - Slave %i did not respond!\n",
+        EC_ERR("Mailbox send - Slave %i did not respond!\n",
                slave->ring_position);
         return -1;
     }
@@ -77,8 +77,8 @@
         if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
         if (unlikely(frame.working_counter != 1)) {
-            printk(KERN_ERR "EtherCAT: Mailbox check - Slave %i did not"
-                   " respond!\n", slave->ring_position);
+            EC_ERR("Mailbox check - Slave %i did not respond!\n",
+                   slave->ring_position);
             return -1;
         }
 
@@ -91,8 +91,7 @@
     }
 
     if (!tries_left) {
-        printk(KERN_ERR "EtherCAT: Mailbox check - Slave %i timed out.\n",
-               slave->ring_position);
+        EC_ERR("Mailbox check - Slave %i timed out.\n", slave->ring_position);
         return -1;
     }
 
@@ -101,8 +100,8 @@
     if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Mailbox receive - Slave %i did not"
-               " respond!\n", slave->ring_position);
+        EC_ERR("Mailbox receive - Slave %i did not respond!\n",
+               slave->ring_position);
         return -1;
     }
 
@@ -112,7 +111,7 @@
         EC_READ_U16(frame.data + 9) != sdo_index || // Index
         EC_READ_U8 (frame.data + 11) != sdo_subindex) // Subindex
     {
-        printk(KERN_ERR "EtherCAT: Illegal mailbox response at slave %i!\n",
+        EC_ERR("Illegal mailbox response at slave %i!\n",
                slave->ring_position);
         return -1;
     }
@@ -156,7 +155,7 @@
     if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Mailbox send - Slave %i did not respond!\n",
+        EC_ERR("Mailbox send - Slave %i did not respond!\n",
                slave->ring_position);
         return -1;
     }
@@ -171,8 +170,8 @@
         if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
         if (unlikely(frame.working_counter != 1)) {
-            printk(KERN_ERR "EtherCAT: Mailbox check - Slave %i did not"
-                   " respond!\n", slave->ring_position);
+            EC_ERR("Mailbox check - Slave %i did not respond!\n",
+                   slave->ring_position);
             return -1;
         }
 
@@ -185,8 +184,7 @@
     }
 
     if (!tries_left) {
-        printk(KERN_ERR "EtherCAT: Mailbox check - Slave %i timed out.\n",
-               slave->ring_position);
+        EC_ERR("Mailbox check - Slave %i timed out.\n", slave->ring_position);
         return -1;
     }
 
@@ -195,8 +193,8 @@
     if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Mailbox receive - Slave %i did not"
-               " respond!\n", slave->ring_position);
+        EC_ERR("Mailbox receive - Slave %i did not respond!\n",
+               slave->ring_position);
         return -1;
     }
 
@@ -206,7 +204,7 @@
         EC_READ_U16(frame.data + 9) != sdo_index || // Index
         EC_READ_U8 (frame.data + 11) != sdo_subindex) // Subindex
     {
-        printk(KERN_ERR "EtherCAT: Illegal mailbox response at slave %i!\n",
+        EC_ERR("Illegal mailbox response at slave %i!\n",
                slave->ring_position);
         return -1;
     }
--- a/master/device.c	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/device.c	Fri Feb 24 16:10:52 2006 +0000
@@ -39,7 +39,7 @@
     device->error_reported = 0;
 
     if ((device->tx_skb = dev_alloc_skb(ETH_HLEN + EC_MAX_FRAME_SIZE)) == NULL) {
-        printk(KERN_ERR "EtherCAT: Error allocating device socket buffer!\n");
+        EC_ERR("Error allocating device socket buffer!\n");
         return -1;
     }
 
@@ -85,17 +85,17 @@
     unsigned int i;
 
     if (!device) {
-        printk(KERN_ERR "EtherCAT: Trying to open a NULL device!\n");
+        EC_ERR("Trying to open a NULL device!\n");
         return -1;
     }
 
     if (!device->dev) {
-        printk(KERN_ERR "EtherCAT: No net_device to open!\n");
+        EC_ERR("No net_device to open!\n");
         return -1;
     }
 
     if (device->open) {
-        printk(KERN_WARNING "EtherCAT: Device already opened!\n");
+        EC_WARN("Device already opened!\n");
     }
     else {
         // Device could have received frames before
@@ -122,12 +122,12 @@
 int ec_device_close(ec_device_t *device /**< EtherCAT-Gerät */)
 {
     if (!device->dev) {
-        printk(KERN_ERR "EtherCAT: No device to close!\n");
+        EC_ERR("No device to close!\n");
         return -1;
     }
 
     if (!device->open) {
-        printk(KERN_WARNING "EtherCAT: Device already closed!\n");
+        EC_WARN("Device already closed!\n");
     }
     else {
         if (device->dev->stop(device->dev) == 0) device->open = 0;
@@ -186,7 +186,7 @@
     device->rx_data_size = 0;
 
     if (unlikely(device->master->debug_level > 1)) {
-        printk(KERN_DEBUG "EtherCAT: Sending frame:\n");
+        EC_DBG("Sending frame:\n");
         ec_data_print(device->tx_skb->data + ETH_HLEN, device->tx_skb->len);
     }
 
@@ -240,31 +240,23 @@
 
 void ec_device_print(ec_device_t *device /**< EtherCAT-Gerät */)
 {
-    printk(KERN_DEBUG "---EtherCAT device information begin---\n");
-
-    if (device)
-    {
-        printk(KERN_DEBUG "Assigned net_device: %X\n",
-               (unsigned) device->dev);
-        printk(KERN_DEBUG "Transmit socket buffer: %X\n",
-               (unsigned) device->tx_skb);
-        printk(KERN_DEBUG "Time of last transmission: %u\n",
-               (unsigned) device->tx_time);
-        printk(KERN_DEBUG "Time of last receive: %u\n",
-               (unsigned) device->rx_time);
-        printk(KERN_DEBUG "Actual device state: %i\n",
-               (int) device->state);
-        printk(KERN_DEBUG "Receive buffer: %X\n",
-               (unsigned) device->rx_data);
-        printk(KERN_DEBUG "Receive buffer fill state: %u/%u\n",
-               (unsigned) device->rx_data_size, EC_MAX_FRAME_SIZE);
-    }
-    else
-    {
-        printk(KERN_DEBUG "Device is NULL!\n");
-    }
-
-    printk(KERN_DEBUG "---EtherCAT device information end---\n");
+    EC_DBG("---EtherCAT device information begin---\n");
+
+    if (device) {
+        EC_DBG("Assigned net_device: %X\n", (u32) device->dev);
+        EC_DBG("Transmit socket buffer: %X\n", (u32) device->tx_skb);
+        EC_DBG("Time of last transmission: %u\n", (u32) device->tx_time);
+        EC_DBG("Time of last receive: %u\n", (u32) device->rx_time);
+        EC_DBG("Actual device state: %i\n", (u8) device->state);
+        EC_DBG("Receive buffer: %X\n", (u32) device->rx_data);
+        EC_DBG("Receive buffer fill state: %u/%u\n",
+               (u32) device->rx_data_size, EC_MAX_FRAME_SIZE);
+    }
+    else {
+        EC_DBG("Device is NULL!\n");
+    }
+
+    EC_DBG("---EtherCAT device information end---\n");
 }
 
 /*****************************************************************************/
@@ -275,12 +267,12 @@
 
 void ec_device_debug(const ec_device_t *device /**< EtherCAT-Gerät */)
 {
-    printk(KERN_DEBUG "EtherCAT: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
+    EC_DBG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
     ec_data_print(device->tx_skb->data + ETH_HLEN, device->tx_skb->len);
-    printk(KERN_DEBUG "------------------------------------------------\n");
+    EC_DBG("------------------------------------------------\n");
     ec_data_print_diff(device->tx_skb->data + ETH_HLEN, device->rx_data,
                        device->rx_data_size);
-    printk(KERN_DEBUG "EtherCAT: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
+    EC_DBG("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
 }
 
 /*****************************************************************************/
@@ -295,10 +287,13 @@
 {
     size_t i;
 
-    printk(KERN_DEBUG);
+    EC_DBG("");
     for (i = 0; i < size; i++) {
         printk("%02X ", data[i]);
-        if ((i + 1) % 16 == 0) printk("\n" KERN_DEBUG);
+        if ((i + 1) % 16 == 0) {
+            printk("\n");
+            EC_DBG("");
+        }
     }
     printk("\n");
 }
@@ -316,11 +311,14 @@
 {
     size_t i;
 
-    printk(KERN_DEBUG);
+    EC_DBG("");
     for (i = 0; i < size; i++) {
         if (d1[i] == d2[i]) printk(".. ");
         else printk("%02X ", d2[i]);
-        if ((i + 1) % 16 == 0) printk("\n" KERN_DEBUG);
+        if ((i + 1) % 16 == 0) {
+            printk("\n");
+            EC_DBG("");
+        }
     }
     printk("\n");
 }
@@ -365,7 +363,7 @@
     device->state = EC_DEVICE_STATE_RECEIVED;
 
     if (unlikely(device->master->debug_level > 1)) {
-        printk(KERN_DEBUG "EtherCAT: Received frame:\n");
+        EC_DBG("Received frame:\n");
         ec_data_print_diff(device->tx_skb->data + ETH_HLEN, device->rx_data,
                            device->rx_data_size);
     }
--- a/master/domain.c	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/domain.c	Fri Feb 24 16:10:52 2006 +0000
@@ -76,12 +76,12 @@
 
     if (!(field_reg = (ec_field_reg_t *) kmalloc(sizeof(ec_field_reg_t),
                                                  GFP_KERNEL))) {
-        printk(KERN_ERR "EtherCAT: Failed to allocate field registration.\n");
+        EC_ERR("Failed to allocate field registration.\n");
         return -1;
     }
 
     if (ec_slave_set_fmmu(slave, domain, sync)) {
-        printk(KERN_ERR "EtherCAT: FMMU configuration failed.\n");
+        EC_ERR("FMMU configuration failed.\n");
         kfree(field_reg);
         return -1;
     }
@@ -112,7 +112,7 @@
     unsigned int i, j, found, data_offset;
 
     if (domain->data) {
-        printk(KERN_ERR "EtherCAT: Domain already allocated!\n");
+        EC_ERR("Domain already allocated!\n");
         return -1;
     }
 
@@ -133,13 +133,12 @@
     }
 
     if (!domain->data_size) {
-        printk(KERN_WARNING "EtherCAT: Domain 0x%08X contains no data!\n",
-               (u32) domain);
+        EC_WARN("Domain 0x%08X contains no data!\n", (u32) domain);
     }
     else {
         // Prozessdaten allozieren
         if (!(domain->data = kmalloc(domain->data_size, GFP_KERNEL))) {
-            printk(KERN_ERR "EtherCAT: Failed to allocate domain data!\n");
+            EC_ERR("Failed to allocate domain data!\n");
             return -1;
         }
 
@@ -161,7 +160,7 @@
             }
 
             if (!found) { // Sollte nie passieren
-                printk(KERN_ERR "EtherCAT: FMMU not found. Please report!\n");
+                EC_ERR("FMMU not found. Please report!\n");
                 return -1;
             }
         }
@@ -209,7 +208,7 @@
     uint32_t field_offset;
 
     if (!field_count) {
-        printk(KERN_ERR "EtherCAT: field_count may not be 0!\n");
+        EC_ERR("field_count may not be 0!\n");
         return NULL;
     }
 
@@ -219,17 +218,16 @@
     if ((slave = ec_address(master, address)) == NULL) return NULL;
 
     if (!(type = slave->type)) {
-        printk(KERN_ERR "EtherCAT: Slave \"%s\" (position %i) has unknown"
-               " type!\n", address, slave->ring_position);
+        EC_ERR("Slave \"%s\" (position %i) has unknown type!\n", address,
+               slave->ring_position);
         return NULL;
     }
 
     if (strcmp(vendor_name, type->vendor_name) ||
         strcmp(product_name, type->product_name)) {
-        printk(KERN_ERR "EtherCAT: Invalid slave type at position %i -"
-               " Requested: \"%s %s\", found: \"%s %s\".\n",
-               slave->ring_position, vendor_name, product_name,
-               type->vendor_name, type->product_name);
+        EC_ERR("Invalid slave type at position %i - Requested: \"%s %s\","
+               " found: \"%s %s\".\n", slave->ring_position, vendor_name,
+               product_name, type->vendor_name, type->product_name);
         return NULL;
     }
 
@@ -251,10 +249,9 @@
         }
     }
 
-    printk(KERN_ERR "EtherCAT: Slave %i (\"%s %s\") has less than %i field(s)"
-	   " of type %i, starting at %i (only %i)!\n", slave->ring_position,
-           vendor_name, product_name, field_count, field_type, field_index,
-	   field_idx);
+    EC_ERR("Slave %i (\"%s %s\") registration mismatch: Type %i, index %i,"
+           " count %i.\n", slave->ring_position, vendor_name, product_name,
+           field_type, field_index, field_count);
     return NULL;
 }
 
@@ -292,8 +289,7 @@
                           domain->data + offset);
 
         if (unlikely(ec_frame_send(frame) < 0)) {
-            printk(KERN_ERR "EtherCAT: Could not send process data"
-                   " command!\n");
+            EC_ERR("Could not send process data command!\n");
             return -1;
         }
 
@@ -315,13 +311,12 @@
         }
 
         if (unlikely(ec_frame_receive(frame) < 0)) {
-            printk(KERN_ERR "EtherCAT: Receive error!\n");
+            EC_ERR("Receive error!\n");
             return -1;
         }
 
         if (unlikely(frame->state != ec_frame_received)) {
-            printk(KERN_WARNING "EtherCAT: Process data command not"
-                   " received!\n");
+            EC_WARN("Process data command not received!\n");
             return -1;
         }
 
@@ -335,8 +330,8 @@
 
     if (working_counter_sum != domain->response_count) {
         domain->response_count = working_counter_sum;
-        printk(KERN_INFO "EtherCAT: Domain %08X state change - %i slaves"
-               " responding.\n", (unsigned int) domain, working_counter_sum);
+        EC_INFO("Domain %08X state change - %i slaves responding.\n",
+                (u32) domain, working_counter_sum);
     }
 
     return 0;
--- a/master/frame.c	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/frame.c	Fri Feb 24 16:10:52 2006 +0000
@@ -52,7 +52,7 @@
                         )
 {
     if (unlikely(node_address == 0x0000))
-        printk(KERN_WARNING "EtherCAT: Warning - Using node address 0x0000!\n");
+        EC_WARN("Using node address 0x0000!\n");
 
     EC_FUNC_HEADER;
 
@@ -86,7 +86,7 @@
                         )
 {
     if (unlikely(node_address == 0x0000))
-        printk(KERN_WARNING "EtherCAT: Warning - Using node address 0x0000!\n");
+        EC_WARN("Using node address 0x0000!\n");
 
     EC_FUNC_HEADER;
 
@@ -255,11 +255,11 @@
     uint8_t *data;
 
     if (unlikely(frame->master->debug_level > 0)) {
-        printk(KERN_DEBUG "EtherCAT: ec_frame_send\n");
+        EC_DBG("ec_frame_send\n");
     }
 
     if (unlikely(frame->state != ec_frame_ready)) {
-        printk(KERN_WARNING "EtherCAT: Frame not in \"ready\" state!\n");
+        EC_WARN("Frame not in \"ready\" state!\n");
     }
 
     command_size = frame->data_length + EC_COMMAND_HEADER_SIZE
@@ -267,22 +267,21 @@
     frame_size = command_size + EC_FRAME_HEADER_SIZE;
 
     if (unlikely(frame_size > EC_MAX_FRAME_SIZE)) {
-        printk(KERN_ERR "EtherCAT: Frame too long (%i)!\n", frame_size);
+        EC_ERR("Frame too long (%i)!\n", frame_size);
         return -1;
     }
 
     if (frame_size < EC_MIN_FRAME_SIZE) frame_size = EC_MIN_FRAME_SIZE;
 
     if (unlikely(frame->master->debug_level > 0)) {
-        printk(KERN_DEBUG "EtherCAT: Frame length: %i\n", frame_size);
+        EC_DBG("Frame length: %i\n", frame_size);
     }
 
     frame->index = frame->master->command_index;
     frame->master->command_index = (frame->master->command_index + 1) % 0x0100;
 
     if (unlikely(frame->master->debug_level > 0)) {
-        printk(KERN_DEBUG "EtherCAT: Sending command index 0x%X\n",
-               frame->index);
+        EC_DBG("Sending command index 0x%X\n", frame->index);
     }
 
     frame->state = ec_frame_sent;
@@ -338,7 +337,7 @@
     ec_device_t *device;
 
     if (unlikely(frame->state != ec_frame_sent)) {
-        printk(KERN_ERR "EtherCAT: Frame was not sent!\n");
+        EC_ERR("Frame was not sent!\n");
         return -1;
     }
 
@@ -349,8 +348,7 @@
     device->state = EC_DEVICE_STATE_READY;
 
     if (unlikely(received_length < EC_FRAME_HEADER_SIZE)) {
-        printk(KERN_ERR "EtherCAT: Received frame with incomplete EtherCAT"
-               " frame header!\n");
+        EC_ERR("Received frame with incomplete EtherCAT frame header!\n");
         ec_device_debug(device);
         return -1;
     }
@@ -362,8 +360,7 @@
     data += EC_FRAME_HEADER_SIZE;
 
     if (unlikely(frame_length > received_length)) {
-        printk(KERN_ERR "EtherCAT: Received corrupted frame (length does"
-               " not match)!\n");
+        EC_ERR("Received corrupted frame (length does not match)!\n");
         ec_device_debug(device);
         return -1;
     }
@@ -376,8 +373,7 @@
 
     if (unlikely(EC_FRAME_HEADER_SIZE + EC_COMMAND_HEADER_SIZE
                  + data_length + EC_COMMAND_FOOTER_SIZE > received_length)) {
-        printk(KERN_ERR "EtherCAT: Received frame with incomplete command"
-               " data!\n");
+        EC_ERR("Received frame with incomplete command data!\n");
         ec_device_debug(device);
         return -1;
     }
@@ -386,7 +382,7 @@
                  || frame->index != command_index
                  || frame->data_length != data_length))
     {
-        printk(KERN_WARNING "EtherCAT: WARNING - Send/Receive anomaly!\n");
+        EC_WARN("WARNING - Send/Receive anomaly!\n");
         ec_device_debug(device);
         ec_device_call_isr(device); // Empfangenes "vergessen"
         return -1;
@@ -419,7 +415,7 @@
     unsigned int tries_left;
 
     if (unlikely(ec_frame_send(frame) < 0)) {
-        printk(KERN_ERR "EtherCAT: Frame sending failed!\n");
+        EC_ERR("Frame sending failed!\n");
         return -1;
     }
 
@@ -434,12 +430,12 @@
                     && tries_left));
 
     if (unlikely(!tries_left)) {
-        printk(KERN_ERR "EtherCAT: Frame timeout!\n");
+        EC_ERR("Frame timeout!\n");
         return -1;
     }
 
     if (unlikely(ec_frame_receive(frame) < 0)) {
-        printk(KERN_ERR "EtherCAT: Frame receiving failed!\n");
+        EC_ERR("Frame receiving failed!\n");
         return -1;
     }
 
--- a/master/globals.h	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/globals.h	Fri Feb 24 16:10:52 2006 +0000
@@ -30,6 +30,15 @@
 #define NULL ((void *) 0) /**< NULL-Define, falls noch nicht definiert. */
 #endif
 
+#define EC_INFO(fmt, args...) \
+    printk(KERN_INFO "EtherCAT: " fmt, ##args)
+#define EC_ERR(fmt, args...) \
+    printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args)
+#define EC_WARN(fmt, args...) \
+    printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args)
+#define EC_DBG(fmt, args...) \
+    printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args)
+
 /*****************************************************************************/
 
 /**
--- a/master/master.c	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/master.c	Fri Feb 24 16:10:52 2006 +0000
@@ -119,12 +119,12 @@
 int ec_master_open(ec_master_t *master /**< Der EtherCAT-Master */)
 {
     if (!master->device_registered) {
-        printk(KERN_ERR "EtherCAT: No device registered!\n");
+        EC_ERR("No device registered!\n");
         return -1;
     }
 
     if (ec_device_open(&master->device) < 0) {
-        printk(KERN_ERR "EtherCAT: Could not open device!\n");
+        EC_ERR("Could not open device!\n");
         return -1;
     }
 
@@ -140,14 +140,12 @@
 void ec_master_close(ec_master_t *master /**< EtherCAT-Master */)
 {
     if (!master->device_registered) {
-        printk(KERN_WARNING "EtherCAT: Warning -"
-               " Trying to close an unregistered device!\n");
+        EC_WARN("Warning - Trying to close an unregistered device!\n");
         return;
     }
 
-    if (ec_device_close(&master->device) < 0) {
-        printk(KERN_WARNING "EtherCAT: Warning - Could not close device!\n");
-    }
+    if (ec_device_close(&master->device) < 0)
+        EC_WARN("Warning - Could not close device!\n");
 }
 
 /*****************************************************************************/
@@ -167,7 +165,7 @@
     unsigned char data[2];
 
     if (master->slaves || master->slave_count)
-        printk(KERN_WARNING "EtherCAT: Slave scan already done!\n");
+        EC_WARN("Slave scan already done!\n");
     ec_master_clear_slaves(master);
 
     // Determine number of slaves on bus
@@ -176,15 +174,14 @@
     if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
     master->slave_count = frame.working_counter;
-    printk("EtherCAT: Found %i slaves on bus.\n", master->slave_count);
+    EC_INFO("Found %i slaves on bus.\n", master->slave_count);
 
     if (!master->slave_count) return 0;
 
     if (!(master->slaves = (ec_slave_t *) kmalloc(master->slave_count
                                                       * sizeof(ec_slave_t),
                                                       GFP_KERNEL))) {
-        printk(KERN_ERR "EtherCAT: Could not allocate memory for bus"
-               " slaves!\n");
+        EC_ERR("Could not allocate memory for bus slaves!\n");
         return -1;
     }
 
@@ -210,8 +207,8 @@
         if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
 
         if (unlikely(frame.working_counter != 1)) {
-            printk(KERN_ERR "EtherCAT: Slave %i did not repond while writing"
-                   " station address!\n", i);
+            EC_ERR("Slave %i did not repond while writing station address!\n",
+                   i);
             return -1;
         }
 
@@ -229,12 +226,10 @@
             ident++;
         }
 
-        if (!slave->type) {
-            printk(KERN_WARNING "EtherCAT: Unknown slave device (vendor"
-                   " 0x%08X, code 0x%08X) at position %i.\n",
-                   slave->sii_vendor_id, slave->sii_product_code, i);
-            return 0;
-        }
+        if (!slave->type)
+            EC_WARN("Unknown slave device (vendor 0x%08X, code 0x%08X) at"
+                    " position %i.\n", slave->sii_vendor_id,
+                    slave->sii_product_code, i);
     }
 
     return 0;
@@ -253,8 +248,7 @@
     if (master->frames_lost) {
         rdtscl(t);
         if ((t - master->t_lost_output) / cpu_khz > 1000) {
-            printk(KERN_ERR "EtherCAT: %u frame(s) LOST!\n",
-                   master->frames_lost);
+            EC_WARN("%u frame(s) LOST!\n", master->frames_lost);
             master->frames_lost = 0;
             master->t_lost_output = t;
         }
@@ -291,15 +285,13 @@
     if (!address || address[0] == 0) return NULL;
 
     if (address[0] == '#') {
-        printk(KERN_ERR "EtherCAT: Bus ID \"%s\" - #<SSID> not implemented"
-               " yet!\n", address);
+        EC_ERR("Bus ID \"%s\" - #<SSID> not implemented yet!\n", address);
         return NULL;
     }
 
     first = simple_strtoul(address, &remainder, 0);
     if (remainder == address) {
-        printk(KERN_ERR "EtherCAT: Bus ID \"%s\" - First number empty!\n",
-               address);
+        EC_ERR("Bus ID \"%s\" - First number empty!\n", address);
         return NULL;
     }
 
@@ -308,8 +300,7 @@
             return master->slaves + first;
         }
 
-        printk(KERN_ERR "EtherCAT: Bus ID \"%s\" - Absolute position"
-               " illegal!\n", address);
+        EC_ERR("Bus ID \"%s\" - Absolute position illegal!\n", address);
     }
 
     else if (remainder[0] == ':') { // field position
@@ -318,14 +309,12 @@
         second = simple_strtoul(remainder, &remainder2, 0);
 
         if (remainder2 == remainder) {
-            printk(KERN_ERR "EtherCAT: Bus ID \"%s\" - Sencond number"
-                   " empty!\n", address);
+            EC_ERR("Bus ID \"%s\" - Sencond number empty!\n", address);
             return NULL;
         }
 
         if (remainder2[0]) {
-            printk(KERN_ERR "EtherCAT: Bus ID \"%s\" - Illegal trailer"
-                   " (2)!\n", address);
+            EC_ERR("Bus ID \"%s\" - Illegal trailer (2)!\n", address);
             return NULL;
         }
 
@@ -344,10 +333,10 @@
         }
     }
 
-    else {
-        printk(KERN_ERR "EtherCAT: Bus ID \"%s\" - Illegal trailer!\n",
-               address);
-    }
+    else
+        EC_ERR("Bus ID \"%s\" - Illegal trailer!\n", address);
+
+    // FIXME ???
 
     return NULL;
 }
@@ -419,12 +408,12 @@
     ec_domain_t *domain;
 
     if (master->domain_count >= EC_MASTER_MAX_DOMAINS) {
-        printk(KERN_ERR "EtherCAT: Maximum number of domains reached!\n");
+        EC_ERR("Maximum number of domains reached!\n");
         return NULL;
     }
 
     if (!(domain = (ec_domain_t *) kmalloc(sizeof(ec_domain_t), GFP_KERNEL))) {
-        printk(KERN_ERR "EthertCAT: Error allocating domain memory!\n");
+        EC_ERR("Error allocating domain memory!\n");
         return NULL;
     }
 
@@ -457,18 +446,21 @@
     const ec_fmmu_t *fmmu;
     uint8_t data[256];
     uint32_t domain_offset;
+    unsigned int frame_count;
+    ec_domain_t *domain;
 
     // Domains erstellen
     domain_offset = 0;
     for (i = 0; i < master->domain_count; i++) {
-        ec_domain_t *domain = master->domains[i];
+        domain = master->domains[i];
         if (ec_domain_alloc(domain, domain_offset)) {
-            printk(KERN_INFO "EtherCAT: Failed to allocate domain %i!\n", i);
+            EC_ERR("Failed to allocate domain %i!\n", i);
             return -1;
         }
-        printk(KERN_INFO "EtherCAT: Domain %i - Allocated %i bytes (%i"
-               " Frame(s))\n", i, domain->data_size,
-               domain->data_size / EC_MAX_FRAME_SIZE + 1);
+        frame_count = domain->data_size / EC_MAX_FRAME_SIZE + 1;
+        if (!domain->data_size) frame_count = 0;
+        EC_INFO("Domain %i - Allocated %i bytes (%i Frame(s))\n", i,
+                domain->data_size, frame_count);
         domain_offset += domain->data_size;
     }
 
@@ -483,7 +475,7 @@
 
         // Check if slave was registered...
         if (!slave->type) {
-            printk(KERN_INFO "EtherCAT: Slave %i has unknown type!\n", i);
+            EC_WARN("Slave %i has unknown type!\n", i);
             continue;
         }
 
@@ -499,8 +491,8 @@
                                EC_FMMU_SIZE * slave->base_fmmu_count, data);
             if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
             if (unlikely(frame.working_counter != 1)) {
-                printk(KERN_ERR "EtherCAT: Resetting FMMUs - Slave %i did"
-                       " not respond!\n", slave->ring_position);
+                EC_ERR("Resetting FMMUs - Slave %i did not respond!\n",
+                       slave->ring_position);
                 return -1;
             }
         }
@@ -512,8 +504,8 @@
                                EC_SYNC_SIZE * slave->base_sync_count, data);
             if (unlikely(ec_frame_send_receive(&frame) < 0)) return -1;
             if (unlikely(frame.working_counter != 1)) {
-                printk(KERN_ERR "EtherCAT: Resetting SMs - Slave %i did not"
-                       " respond!\n", slave->ring_position);
+                EC_ERR("Resetting SMs - Slave %i did not respond!\n",
+                       slave->ring_position);
                 return -1;
             }
         }
@@ -530,8 +522,8 @@
             if (unlikely(ec_frame_send_receive(&frame))) return -1;
 
             if (unlikely(frame.working_counter != 1)) {
-                printk(KERN_ERR "EtherCAT: Setting sync manager %i - Slave"
-                       " %i did not respond!\n", j, slave->ring_position);
+                EC_ERR("Setting sync manager %i - Slave %i did not respond!\n",
+                       j, slave->ring_position);
                 return -1;
             }
         }
@@ -543,8 +535,7 @@
         // Slaves that are not registered are only brought into PREOP
         // state -> nice blinking and mailbox comm. possible
         if (!slave->registered && !slave->type->bus_coupler) {
-            printk(KERN_WARNING "EtherCAT: Slave %i was not registered!\n",
-                   slave->ring_position);
+            EC_WARN("Slave %i was not registered!\n", slave->ring_position);
             continue;
         }
 
@@ -560,8 +551,8 @@
             if (unlikely(ec_frame_send_receive(&frame))) return -1;
 
             if (unlikely(frame.working_counter != 1)) {
-                printk(KERN_ERR "EtherCAT: Setting FMMU %i - Slave %i did not"
-                       " respond!\n", j, slave->ring_position);
+                EC_ERR("Setting FMMU %i - Slave %i did not respond!\n", j,
+                       slave->ring_position);
                 return -1;
             }
         }
@@ -624,7 +615,7 @@
 {
     master->debug_level = level;
 
-    printk(KERN_INFO "EtherCAT: Master debug level set to %i.\n", level);
+    EC_INFO("Master debug level set to %i.\n", level);
 }
 
 /*****************************************************************************/
@@ -639,13 +630,13 @@
 {
     unsigned int i;
 
-    printk(KERN_INFO "EtherCAT: *** Begin master information ***\n");
+    EC_INFO("*** Begin master information ***\n");
 
     for (i = 0; i < master->slave_count; i++) {
         ec_slave_print(&master->slaves[i]);
     }
 
-    printk(KERN_INFO "EtherCAT: *** End master information ***\n");
+    EC_INFO("*** End master information ***\n");
 }
 
 /*****************************************************************************/
--- a/master/module.c	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/module.c	Fri Feb 24 16:10:52 2006 +0000
@@ -71,31 +71,25 @@
 {
     unsigned int i;
 
-    printk(KERN_ERR "EtherCAT: Master driver, %s\n", COMPILE_INFO);
+    EC_INFO("Master driver, %s\n", COMPILE_INFO);
 
     if (ec_master_count < 1) {
-        printk(KERN_ERR "EtherCAT: Error - Illegal"
-               " ec_master_count: %i\n", ec_master_count);
+        EC_ERR("Error - Illegal ec_master_count: %i\n", ec_master_count);
         return -1;
     }
 
-    printk(KERN_ERR "EtherCAT: Initializing %i EtherCAT master(s)...\n",
-           ec_master_count);
-
-    if ((ec_masters =
-         (ec_master_t *) kmalloc(sizeof(ec_master_t)
-                                 * ec_master_count,
-                                 GFP_KERNEL)) == NULL) {
-        printk(KERN_ERR "EtherCAT: Could not allocate"
-               " memory for EtherCAT master(s)!\n");
+    EC_INFO("Initializing %i EtherCAT master(s)...\n", ec_master_count);
+
+    if ((ec_masters = (ec_master_t *) kmalloc(sizeof(ec_master_t)
+                                              * ec_master_count,
+                                              GFP_KERNEL)) == NULL) {
+        EC_ERR("Could not allocate memory for EtherCAT master(s)!\n");
         return -1;
     }
 
     if ((ec_masters_reserved =
-         (int *) kmalloc(sizeof(int) * ec_master_count,
-                         GFP_KERNEL)) == NULL) {
-        printk(KERN_ERR "EtherCAT: Could not allocate"
-               " memory for reservation flags!\n");
+         (int *) kmalloc(sizeof(int) * ec_master_count, GFP_KERNEL)) == NULL) {
+        EC_ERR("Could not allocate memory for reservation flags!\n");
         kfree(ec_masters);
         return -1;
     }
@@ -105,7 +99,7 @@
         ec_masters_reserved[i] = 0;
     }
 
-    printk(KERN_ERR "EtherCAT: Master driver initialized.\n");
+    EC_INFO("Master driver initialized.\n");
 
     return 0;
 }
@@ -122,20 +116,19 @@
 {
     unsigned int i;
 
-    printk(KERN_ERR "EtherCAT: Cleaning up master driver...\n");
+    EC_INFO("Cleaning up master driver...\n");
 
     if (ec_masters) {
         for (i = 0; i < ec_master_count; i++) {
             if (ec_masters_reserved[i]) {
-                printk(KERN_WARNING "EtherCAT: Warning -"
-                       " Master %i is still in use!\n", i);
+                EC_WARN("Master %i is still in use!\n", i);
             }
             ec_master_clear(&ec_masters[i]);
         }
         kfree(ec_masters);
     }
 
-    printk(KERN_ERR "EtherCAT: Master driver cleaned up.\n");
+    EC_INFO("Master driver cleaned up.\n");
 }
 
 /******************************************************************************
@@ -167,20 +160,19 @@
     ec_master_t *master;
 
     if (master_index >= ec_master_count) {
-        printk(KERN_ERR "EtherCAT: Master %i does not exist!\n", master_index);
+        EC_ERR("Master %i does not exist!\n", master_index);
         return NULL;
     }
 
     if (!dev) {
-        printk("EtherCAT: Device is NULL!\n");
+        EC_WARN("Device is NULL!\n");
         return NULL;
     }
 
     master = ec_masters + master_index;
 
     if (master->device_registered) {
-        printk(KERN_ERR "EtherCAT: Master %i already has a device!\n",
-               master_index);
+        EC_ERR("Master %i already has a device!\n", master_index);
         return NULL;
     }
 
@@ -212,15 +204,14 @@
     ec_master_t *master;
 
     if (master_index >= ec_master_count) {
-        printk(KERN_WARNING "EtherCAT: Master %i does not exist!\n",
-               master_index);
+        EC_WARN("Master %i does not exist!\n", master_index);
         return;
     }
 
     master = ec_masters + master_index;
 
     if (!master->device_registered || &master->device != ecd) {
-        printk(KERN_ERR "EtherCAT: Unable to unregister device!\n");
+        EC_WARN("Unable to unregister device!\n");
         return;
     }
 
@@ -248,40 +239,39 @@
     ec_master_t *master;
 
     if (index < 0 || index >= ec_master_count) {
-        printk(KERN_ERR "EtherCAT: Master %i does not exist!\n", index);
+        EC_ERR("Master %i does not exist!\n", index);
         goto req_return;
     }
 
     if (ec_masters_reserved[index]) {
-        printk(KERN_ERR "EtherCAT: Master %i already in use!\n", index);
+        EC_ERR("Master %i already in use!\n", index);
         goto req_return;
     }
 
     master = &ec_masters[index];
 
     if (!master->device_registered) {
-        printk(KERN_ERR "EtherCAT: Master %i has no device assigned yet!\n",
-               index);
+        EC_ERR("Master %i has no device assigned yet!\n", index);
         goto req_return;
     }
 
     if (!try_module_get(master->device.module)) {
-        printk(KERN_ERR "EtherCAT: Failed to reserve device module!\n");
+        EC_ERR("Failed to reserve device module!\n");
         goto req_return;
     }
 
     if (ec_master_open(master) < 0) {
-        printk(KERN_ERR "EtherCAT: Failed to open device!\n");
+        EC_ERR("Failed to open device!\n");
         goto req_module_put;
     }
 
     if (ec_scan_for_slaves(master) != 0) {
-        printk(KERN_ERR "EtherCAT: Bus scan failed!\n");
+        EC_ERR("Bus scan failed!\n");
         goto req_close;
     }
 
     ec_masters_reserved[index] = 1;
-    printk(KERN_INFO "EtherCAT: Reserved master %i.\n", index);
+    EC_INFO("Reserved master %i.\n", index);
 
     return master;
 
@@ -312,8 +302,7 @@
         if (&ec_masters[i] == master)
         {
             if (!master->device_registered) {
-                printk(KERN_WARNING "EtherCAT: Failed to release device"
-                       "module because of no device!\n");
+                EC_WARN("Failed to release device module: No device!\n");
                 return;
             }
 
@@ -323,14 +312,13 @@
             module_put(master->device.module);
             ec_masters_reserved[i] = 0;
 
-            printk(KERN_INFO "EtherCAT: Released master %i.\n", i);
+            EC_INFO("Released master %i.\n", i);
 
             return;
         }
     }
 
-    printk(KERN_WARNING "EtherCAT: Master %X was never requested!\n",
-           (unsigned int) master);
+    EC_WARN("Master %X was never requested!\n", (u32) master);
 }
 
 /*****************************************************************************/
--- a/master/slave.c	Fri Feb 24 14:09:51 2006 +0000
+++ b/master/slave.c	Fri Feb 24 16:10:52 2006 +0000
@@ -71,8 +71,8 @@
     if (unlikely(ec_frame_send_receive(&frame))) return -1;
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Slave %i did not respond while reading base"
-               " data!\n", slave->ring_position);
+        EC_ERR("Slave %i did not respond while reading base data!\n",
+               slave->ring_position);
         return -1;
     }
 
@@ -88,24 +88,24 @@
     // Read identification from "Slave Information Interface" (SII)
 
     if (unlikely(ec_slave_sii_read(slave, 0x0008, &slave->sii_vendor_id))) {
-        printk(KERN_ERR "EtherCAT: Could not read SII vendor id!\n");
+        EC_ERR("Could not read SII vendor id!\n");
         return -1;
     }
 
     if (unlikely(ec_slave_sii_read(slave, 0x000A, &slave->sii_product_code))) {
-        printk(KERN_ERR "EtherCAT: Could not read SII product code!\n");
+        EC_ERR("Could not read SII product code!\n");
         return -1;
     }
 
     if (unlikely(ec_slave_sii_read(slave, 0x000C,
                                    &slave->sii_revision_number))) {
-        printk(KERN_ERR "EtherCAT: Could not read SII revision number!\n");
+        EC_ERR("Could not read SII revision number!\n");
         return -1;
     }
 
     if (unlikely(ec_slave_sii_read(slave, 0x000E,
                                    &slave->sii_serial_number))) {
-        printk(KERN_ERR "EtherCAT: Could not read SII serial number!\n");
+        EC_ERR("Could not read SII serial number!\n");
         return -1;
     }
 
@@ -147,8 +147,7 @@
     if (unlikely(ec_frame_send_receive(&frame))) return -1;
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: SII-read - Slave %i did not respond!\n",
-               slave->ring_position);
+        EC_ERR("SII-read - Slave %i did not respond!\n", slave->ring_position);
         return -1;
     }
 
@@ -167,8 +166,8 @@
         if (unlikely(ec_frame_send_receive(&frame))) return -1;
 
         if (unlikely(frame.working_counter != 1)) {
-            printk(KERN_ERR "EtherCAT: SII-read status -"
-                   " Slave %i did not respond!\n", slave->ring_position);
+            EC_ERR("SII-read status - Slave %i did not respond!\n",
+                   slave->ring_position);
             return -1;
         }
 
@@ -181,8 +180,7 @@
     }
 
     if (unlikely(!tries_left)) {
-        printk(KERN_WARNING "EtherCAT: SSI-read. Slave %i timed out!\n",
-               slave->ring_position);
+        EC_ERR("SSI-read. Slave %i timed out!\n", slave->ring_position);
         return -1;
     }
 
@@ -213,14 +211,13 @@
                        2, data);
 
     if (unlikely(ec_frame_send_receive(&frame) != 0)) {
-        printk(KERN_ERR "EtherCAT: Could no acknowledge state %02X - Unable to"
-               " send!\n", state);
+        EC_WARN("Could no acknowledge state %02X - Unable to send!\n", state);
         return;
     }
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Could not acknowledge state %02X - Slave"
-               " %i did not respond!\n", state, slave->ring_position);
+        EC_WARN("Could not acknowledge state %02X - Slave %i did not"
+                " respond!\n", state, slave->ring_position);
         return;
     }
 
@@ -233,28 +230,27 @@
                            0x0130, 2);
 
         if (unlikely(ec_frame_send_receive(&frame) != 0)) {
-            printk(KERN_ERR "EtherCAT: Could not check state acknowledgement"
-                   " %02X - Unable to send!\n", state);
+            EC_WARN("Could not check state acknowledgement %02X - Unable to"
+                    " send!\n", state);
             return;
         }
 
         if (unlikely(frame.working_counter != 1)) {
-            printk(KERN_ERR "EtherCAT: Could not check state acknowledgement"
-                   " %02X - Slave %i did not respond!\n", state,
-                   slave->ring_position);
+            EC_WARN("Could not check state acknowledgement %02X - Slave %i did"
+                    " not respond!\n", state, slave->ring_position);
             return;
         }
 
         if (unlikely(EC_READ_U8(frame.data) != state)) {
-            printk(KERN_ERR "EtherCAT: Could not acknowledge state %02X on"
-                   " slave %i (code %02X)!\n", state, slave->ring_position,
-                   EC_READ_U8(frame.data));
+            EC_WARN("Could not acknowledge state %02X on slave %i (code"
+                    " %02X)!\n", state, slave->ring_position,
+                    EC_READ_U8(frame.data));
             return;
         }
 
         if (likely(EC_READ_U8(frame.data) == state)) {
-            printk(KERN_INFO "EtherCAT: Acknowleged state %02X on slave %i.\n",
-                   state, slave->ring_position);
+            EC_INFO("Acknowleged state %02X on slave %i.\n", state,
+                    slave->ring_position);
             return;
         }
 
@@ -262,9 +258,8 @@
     }
 
     if (unlikely(!tries_left)) {
-        printk(KERN_ERR "EtherCAT: Could not check state acknowledgement %02X"
-               " of slave %i - Timeout while checking!\n", state,
-               slave->ring_position);
+        EC_WARN("Could not check state acknowledgement %02X of slave %i -"
+                " Timeout while checking!\n", state, slave->ring_position);
         return;
     }
 }
@@ -293,14 +288,13 @@
                        2, data);
 
     if (unlikely(ec_frame_send_receive(&frame) != 0)) {
-        printk(KERN_ERR "EtherCAT: Could not set state %02X - Unable to"
-               " send!\n", state);
-        return -1;
-    }
-
-    if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Could not set state %02X - Slave %i did not"
-               " respond!\n", state, slave->ring_position);
+        EC_ERR("Could not set state %02X - Unable to send!\n", state);
+        return -1;
+    }
+
+    if (unlikely(frame.working_counter != 1)) {
+        EC_ERR("Could not set state %02X - Slave %i did not respond!\n", state,
+               slave->ring_position);
         return -1;
     }
 
@@ -313,21 +307,20 @@
                            0x0130, 2);
 
         if (unlikely(ec_frame_send_receive(&frame) != 0)) {
-            printk(KERN_ERR "EtherCAT: Could not check state %02X - Unable to"
-                   " send!\n", state);
+            EC_ERR("Could not check state %02X - Unable to send!\n", state);
             return -1;
         }
 
         if (unlikely(frame.working_counter != 1)) {
-            printk(KERN_ERR "EtherCAT: Could not check state %02X - Slave %i"
-                   " did not respond!\n", state, slave->ring_position);
+            EC_ERR("Could not check state %02X - Slave %i did not respond!\n",
+                   state, slave->ring_position);
             return -1;
         }
 
         if (unlikely(EC_READ_U8(frame.data) & 0x10)) { // State change error
-            printk(KERN_ERR "EtherCAT: Could not set state %02X - Slave %i"
-                   " refused state change (code %02X)!\n", state,
-                   slave->ring_position, EC_READ_U8(frame.data));
+            EC_ERR("Could not set state %02X - Slave %i refused state change"
+                   " (code %02X)!\n", state, slave->ring_position,
+                   EC_READ_U8(frame.data));
             ec_slave_state_ack(slave, EC_READ_U8(frame.data) & 0x0F);
             return -1;
         }
@@ -341,8 +334,7 @@
     }
 
     if (unlikely(!tries_left)) {
-        printk(KERN_ERR "EtherCAT: Could not check state %02X of slave %i -"
-               " Timeout while checking!\n", state,
+        EC_ERR("Could not check state %02X of slave %i - Timeout!\n", state,
                slave->ring_position);
         return -1;
     }
@@ -378,8 +370,7 @@
             return 0;
 
     if (slave->fmmu_count >= slave->base_fmmu_count) {
-        printk(KERN_ERR "EtherCAT: Slave %i supports only %i FMMUs.\n",
-               slave->ring_position, slave->base_fmmu_count);
+        EC_ERR("Slave %i FMMU limit reached!\n", slave->ring_position);
         return -1;
     }
 
@@ -400,31 +391,31 @@
 
 void ec_slave_print(const ec_slave_t *slave /**< EtherCAT-Slave */)
 {
-    printk(KERN_INFO "--- EtherCAT slave information ---\n");
+    EC_INFO("--- EtherCAT slave information ---\n");
 
     if (slave->type) {
-        printk(KERN_INFO "  Vendor \"%s\", Product \"%s\": %s\n",
-               slave->type->vendor_name, slave->type->product_name,
-               slave->type->description);
+        EC_INFO("  Vendor \"%s\", Product \"%s\": %s\n",
+                slave->type->vendor_name, slave->type->product_name,
+                slave->type->description);
     }
     else {
-        printk(KERN_INFO "  *** This slave has no type information! ***\n");
-    }
-
-    printk(KERN_INFO "  Ring position: %i, Station address: 0x%04X\n",
-           slave->ring_position, slave->station_address);
-
-    printk(KERN_INFO "  Base information:\n");
-    printk(KERN_INFO "    Type %u, Revision %i, Build %i\n",
-           slave->base_type, slave->base_revision, slave->base_build);
-    printk(KERN_INFO "    Supported FMMUs: %i, Sync managers: %i\n",
-           slave->base_fmmu_count, slave->base_sync_count);
-
-    printk(KERN_INFO "  Slave information interface:\n");
-    printk(KERN_INFO "    Vendor-ID: 0x%08X, Product code: 0x%08X\n",
-           slave->sii_vendor_id, slave->sii_product_code);
-    printk(KERN_INFO "    Revision number: 0x%08X, Serial number: 0x%08X\n",
-           slave->sii_revision_number, slave->sii_serial_number);
+        EC_INFO("  *** This slave has no type information! ***\n");
+    }
+
+    EC_INFO("  Ring position: %i, Station address: 0x%04X\n",
+            slave->ring_position, slave->station_address);
+
+    EC_INFO("  Base information:\n");
+    EC_INFO("    Type %u, Revision %i, Build %i\n",
+            slave->base_type, slave->base_revision, slave->base_build);
+    EC_INFO("    Supported FMMUs: %i, Sync managers: %i\n",
+            slave->base_fmmu_count, slave->base_sync_count);
+
+    EC_INFO("  Slave information interface:\n");
+    EC_INFO("    Vendor-ID: 0x%08X, Product code: 0x%08X\n",
+            slave->sii_vendor_id, slave->sii_product_code);
+    EC_INFO("    Revision number: 0x%08X, Serial number: 0x%08X\n",
+            slave->sii_revision_number, slave->sii_serial_number);
 }
 
 /*****************************************************************************/
@@ -444,24 +435,22 @@
                        4);
 
     if (unlikely(ec_frame_send_receive(&frame))) {
-        printk(KERN_WARNING "EtherCAT: Reading CRC fault counters failed"
-               " on slave %i - Could not send command!\n",
-               slave->ring_position);
-        return -1;
-    }
-
-    if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_WARNING "EtherCAT: Reading CRC fault counters -"
-               " Slave %i did not respond!\n", slave->ring_position);
+        EC_WARN("Reading CRC fault counters failed on slave %i - Could not"
+                " send command!\n", slave->ring_position);
+        return -1;
+    }
+
+    if (unlikely(frame.working_counter != 1)) {
+        EC_WARN("Reading CRC fault counters - Slave %i did not respond!\n",
+                slave->ring_position);
         return -1;
     }
 
     // No CRC faults.
     if (!EC_READ_U16(frame.data) && !EC_READ_U16(frame.data + 2)) return 0;
 
-    printk(KERN_INFO "EtherCAT: CRC faults on slave %i. A: %i, B: %i\n",
-           slave->ring_position, EC_READ_U16(frame.data),
-           EC_READ_U16(frame.data + 2));
+    EC_WARN("CRC faults on slave %i. A: %i, B: %i\n", slave->ring_position,
+            EC_READ_U16(frame.data), EC_READ_U16(frame.data + 2));
 
     // Reset CRC counters
     EC_WRITE_U16(data,     0x0000);
@@ -472,8 +461,8 @@
     if (unlikely(ec_frame_send_receive(&frame))) return -1;
 
     if (unlikely(frame.working_counter != 1)) {
-        printk(KERN_ERR "EtherCAT: Resetting CRC fault counters - Slave"
-               " %i did not respond!\n", slave->ring_position);
+        EC_WARN("Resetting CRC fault counters - Slave %i did not respond!\n",
+                slave->ring_position);
         return -1;
     }