master/slave.h
changeset 1989 6aa393418fb3
parent 1921 d9cf40facbc4
child 2037 ea0319750e13
child 2374 e898451c054a
equal deleted inserted replaced
1988:ea38efeeb7b3 1989:6aa393418fb3
    44 #include "datagram.h"
    44 #include "datagram.h"
    45 #include "pdo.h"
    45 #include "pdo.h"
    46 #include "sync.h"
    46 #include "sync.h"
    47 #include "sdo.h"
    47 #include "sdo.h"
    48 #include "fsm_slave.h"
    48 #include "fsm_slave.h"
       
    49 
       
    50 /*****************************************************************************/
       
    51 
       
    52 /** Convenience macro for printing slave-specific information to syslog.
       
    53  *
       
    54  * This will print the message in \a fmt with a prefixed
       
    55  * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
       
    56  * POSITION is the slave's ring position.
       
    57  *
       
    58  * \param slave EtherCAT slave
       
    59  * \param fmt format string (like in printf())
       
    60  * \param args arguments (optional)
       
    61  */
       
    62 #define EC_SLAVE_INFO(slave, fmt, args...) \
       
    63     printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \
       
    64             slave->ring_position, ##args)
       
    65 
       
    66 /** Convenience macro for printing slave-specific errors to syslog.
       
    67  *
       
    68  * This will print the message in \a fmt with a prefixed
       
    69  * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
       
    70  * POSITION is the slave's ring position.
       
    71  *
       
    72  * \param slave EtherCAT slave
       
    73  * \param fmt format string (like in printf())
       
    74  * \param args arguments (optional)
       
    75  */
       
    76 #define EC_SLAVE_ERR(slave, fmt, args...) \
       
    77     printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \
       
    78             slave->ring_position, ##args)
       
    79 
       
    80 /** Convenience macro for printing slave-specific warnings to syslog.
       
    81  *
       
    82  * This will print the message in \a fmt with a prefixed
       
    83  * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
       
    84  * POSITION is the slave's ring position.
       
    85  *
       
    86  * \param slave EtherCAT slave
       
    87  * \param fmt format string (like in printf())
       
    88  * \param args arguments (optional)
       
    89  */
       
    90 #define EC_SLAVE_WARN(slave, fmt, args...) \
       
    91     printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \
       
    92             slave->master->index, slave->ring_position, ##args)
       
    93 
       
    94 /** Convenience macro for printing slave-specific debug messages to syslog.
       
    95  *
       
    96  * This will print the message in \a fmt with a prefixed
       
    97  * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
       
    98  * POSITION is the slave's ring position.
       
    99  *
       
   100  * \param slave EtherCAT slave
       
   101  * \param fmt format string (like in printf())
       
   102  * \param args arguments (optional)
       
   103  */
       
   104 #define EC_SLAVE_DBG(slave, level, fmt, args...) \
       
   105     do { \
       
   106         if (slave->master->debug_level >= level) { \
       
   107             printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \
       
   108                     slave->master->index, slave->ring_position, ##args); \
       
   109         } \
       
   110     } while (0)
    49 
   111 
    50 /*****************************************************************************/
   112 /*****************************************************************************/
    51 
   113 
    52 /** Slave port.
   114 /** Slave port.
    53  */
   115  */