master/master.h
changeset 2037 ea0319750e13
parent 2028 55854f070c4a
child 2045 ff2a13a4603c
equal deleted inserted replaced
2036:7fbc7bb7b95a 2037:ea0319750e13
    59  *
    59  *
    60  * \param master EtherCAT master
    60  * \param master EtherCAT master
    61  * \param fmt format string (like in printf())
    61  * \param fmt format string (like in printf())
    62  * \param args arguments (optional)
    62  * \param args arguments (optional)
    63  */
    63  */
       
    64 #ifdef USE_TRACE_PRINTK
       
    65 #define EC_MASTER_INFO(master, fmt, args...) \
       
    66     do { \
       
    67         __trace_printk(_THIS_IP_,"EtherCAT %u: " fmt, master->index, ##args); \
       
    68         printk(KERN_INFO "EtherCAT %u: " fmt, master->index, ##args);   \
       
    69     } while (0)
       
    70 #else
    64 #define EC_MASTER_INFO(master, fmt, args...) \
    71 #define EC_MASTER_INFO(master, fmt, args...) \
    65     printk(KERN_INFO "EtherCAT %u: " fmt, master->index, ##args)
    72     printk(KERN_INFO "EtherCAT %u: " fmt, master->index, ##args)
       
    73 #endif
    66 
    74 
    67 /** Convenience macro for printing master-specific errors to syslog.
    75 /** Convenience macro for printing master-specific errors to syslog.
    68  *
    76  *
    69  * This will print the message in \a fmt with a prefixed "EtherCAT <INDEX>: ",
    77  * This will print the message in \a fmt with a prefixed "EtherCAT <INDEX>: ",
    70  * where INDEX is the master index.
    78  * where INDEX is the master index.
    71  *
    79  *
    72  * \param master EtherCAT master
    80  * \param master EtherCAT master
    73  * \param fmt format string (like in printf())
    81  * \param fmt format string (like in printf())
    74  * \param args arguments (optional)
    82  * \param args arguments (optional)
    75  */
    83  */
       
    84 #ifdef USE_TRACE_PRINTK
       
    85 #define EC_MASTER_ERR(master, fmt, args...) \
       
    86     do { \
       
    87         __trace_printk(_THIS_IP_,"EtherCAT ERROR %u: " fmt, master->index, ##args); \
       
    88         printk(KERN_ERR "EtherCAT ERROR %u: " fmt, master->index, ##args); \
       
    89     } while (0)
       
    90 #else
    76 #define EC_MASTER_ERR(master, fmt, args...) \
    91 #define EC_MASTER_ERR(master, fmt, args...) \
    77     printk(KERN_ERR "EtherCAT ERROR %u: " fmt, master->index, ##args)
    92     printk(KERN_ERR "EtherCAT ERROR %u: " fmt, master->index, ##args)
       
    93 #endif
    78 
    94 
    79 /** Convenience macro for printing master-specific warnings to syslog.
    95 /** Convenience macro for printing master-specific warnings to syslog.
    80  *
    96  *
    81  * This will print the message in \a fmt with a prefixed "EtherCAT <INDEX>: ",
    97  * This will print the message in \a fmt with a prefixed "EtherCAT <INDEX>: ",
    82  * where INDEX is the master index.
    98  * where INDEX is the master index.
    83  *
    99  *
    84  * \param master EtherCAT master
   100  * \param master EtherCAT master
    85  * \param fmt format string (like in printf())
   101  * \param fmt format string (like in printf())
    86  * \param args arguments (optional)
   102  * \param args arguments (optional)
    87  */
   103  */
       
   104 #ifdef USE_TRACE_PRINTK
       
   105 #define EC_MASTER_WARN(master, fmt, args...) \
       
   106     do { \
       
   107         __trace_printk(_THIS_IP_,"EtherCAT WARNING %u: " fmt, master->index, ##args); \
       
   108         printk(KERN_WARNING "EtherCAT WARNING %u: " fmt, master->index, ##args);    \
       
   109     } while (0)
       
   110 #else
    88 #define EC_MASTER_WARN(master, fmt, args...) \
   111 #define EC_MASTER_WARN(master, fmt, args...) \
    89     printk(KERN_WARNING "EtherCAT WARNING %u: " fmt, master->index, ##args)
   112     printk(KERN_WARNING "EtherCAT WARNING %u: " fmt, master->index, ##args)
       
   113 #endif
    90 
   114 
    91 /** Convenience macro for printing master-specific debug messages to syslog.
   115 /** Convenience macro for printing master-specific debug messages to syslog.
    92  *
   116  *
    93  * This will print the message in \a fmt with a prefixed "EtherCAT <INDEX>: ",
   117  * This will print the message in \a fmt with a prefixed "EtherCAT <INDEX>: ",
    94  * where INDEX is the master index.
   118  * where INDEX is the master index.
    95  *
   119  *
    96  * \param master EtherCAT master
   120  * \param master EtherCAT master
    97  * \param fmt format string (like in printf())
   121  * \param fmt format string (like in printf())
    98  * \param args arguments (optional)
   122  * \param args arguments (optional)
    99  */
   123  */
       
   124 #ifdef USE_TRACE_PRINTK
   100 #define EC_MASTER_DBG(master, level, fmt, args...) \
   125 #define EC_MASTER_DBG(master, level, fmt, args...) \
   101     do { \
   126     do { \
       
   127         __trace_printk(_THIS_IP_,"EtherCAT DEBUG%u %u: " fmt, \
       
   128             level,master->index, ##args); \
   102         if (master->debug_level >= level) { \
   129         if (master->debug_level >= level) { \
   103             printk(KERN_DEBUG "EtherCAT DEBUG %u: " fmt, \
   130             printk(KERN_DEBUG "EtherCAT DEBUG %u: " fmt, \
   104                     master->index, ##args); \
   131                     master->index, ##args); \
   105         } \
   132         } \
   106     } while (0)
   133     } while (0)
       
   134 #else
       
   135 #define EC_MASTER_DBG(master, level, fmt, args...) \
       
   136     do { \
       
   137         if (master->debug_level >= level) { \
       
   138             printk(KERN_DEBUG "EtherCAT DEBUG %u: " fmt, \
       
   139                     master->index, ##args); \
       
   140         } \
       
   141     } while (0)
       
   142 #endif
   107 
   143 
   108 /*****************************************************************************/
   144 /*****************************************************************************/
   109 
   145 
   110 /** EtherCAT master phase.
   146 /** EtherCAT master phase.
   111  */
   147  */