include/can_driver.h
changeset 391 7802a7d5584f
parent 384 83793fc7ce48
child 528 0a30e161d63c
equal deleted inserted replaced
390:31dc4ec8710c 391:7802a7d5584f
    51 UNS8 DLL_CALL(canChangeBaudRate)(CAN_HANDLE, char *)FCT_PTR_INIT;
    51 UNS8 DLL_CALL(canChangeBaudRate)(CAN_HANDLE, char *)FCT_PTR_INIT;
    52 
    52 
    53 #if defined DEBUG_MSG_CONSOLE_ON || defined NEED_PRINT_MESSAGE
    53 #if defined DEBUG_MSG_CONSOLE_ON || defined NEED_PRINT_MESSAGE
    54 #include "def.h"
    54 #include "def.h"
    55 
    55 
    56 #define _P(fc) case fc: printf(#fc" ");break;
    56 #define _P(fc) case fc: MSG(#fc" ");break;
    57 
    57 
    58 static inline void print_message(Message *m)
    58 static inline void print_message(Message *m)
    59 {
    59 {
    60     int i;
    60     int i;
    61     UNS8 fc;
    61     UNS8 fc;
    62     printf("id:%02x ", m->cob_id & 0x7F);
    62     MSG("id:%02x ", m->cob_id & 0x7F);
    63     fc = m->cob_id >> 7;
    63     fc = m->cob_id >> 7;
    64     switch(fc)
    64     switch(fc)
    65     {
    65     {
    66         case SYNC: 
    66         case SYNC: 
    67             if(m->cob_id == 0x080)
    67             if(m->cob_id == 0x080)
    68                 printf("SYNC ");
    68                 MSG("SYNC ");
    69             else
    69             else
    70                 printf("EMCY ");
    70                 MSG("EMCY ");
    71         break;
    71         break;
    72 #ifdef CO_ENABLE_LSS
    72 #ifdef CO_ENABLE_LSS
    73         case LSS:
    73         case LSS:
    74         	if(m->cob_id == 0x7E5)
    74         	if(m->cob_id == 0x7E5)
    75                 printf("MLSS ");
    75                 MSG("MLSS ");
    76             else
    76             else
    77                 printf("SLSS ");
    77                 MSG("SLSS ");
    78         break;
    78         break;
    79 #endif
    79 #endif
    80         _P(TIME_STAMP)
    80         _P(TIME_STAMP)
    81         _P(PDO1tx)
    81         _P(PDO1tx)
    82         _P(PDO1rx)
    82         _P(PDO1rx)
   112             _P(INITIATE_UPLOAD_REQUEST)
   112             _P(INITIATE_UPLOAD_REQUEST)
   113             _P(UPLOAD_SEGMENT_REQUEST)
   113             _P(UPLOAD_SEGMENT_REQUEST)
   114             _P(ABORT_TRANSFER_REQUEST)
   114             _P(ABORT_TRANSFER_REQUEST)
   115         }
   115         }
   116     }
   116     }
   117     printf(" rtr:%d", m->rtr);
   117     MSG(" rtr:%d", m->rtr);
   118     printf(" len:%d", m->len);
   118     MSG(" len:%d", m->len);
   119     for (i = 0 ; i < m->len ; i++)
   119     for (i = 0 ; i < m->len ; i++)
   120         printf(" %02x", m->data[i]);
   120         MSG(" %02x", m->data[i]);
   121     printf("\n");
   121     MSG("\n");
   122 }
   122 }
   123 
   123 
   124 #endif
   124 #endif
   125 
   125 
   126 #endif
   126 #endif