master/datagram.c
changeset 816 d02761e14eb0
parent 815 002fe9ec778f
child 986 a486591ba86b
equal deleted inserted replaced
815:002fe9ec778f 816:d02761e14eb0
    59     memset(datagram->data, 0x00, data_size); \
    59     memset(datagram->data, 0x00, data_size); \
    60     return 0;
    60     return 0;
    61 
    61 
    62 /** \endcond */
    62 /** \endcond */
    63 
    63 
       
    64 /*****************************************************************************/
       
    65 
       
    66 /** Array of datagram type strings used in ec_datagram_type_string().
       
    67  *
       
    68  * \attention This is indexed by ec_datagram_type_t.
       
    69  */
       
    70 static const char *type_strings[] = {
       
    71     "?",
       
    72     "APRD",
       
    73     "APWR",
       
    74     "APRW",
       
    75     "FPRD",
       
    76     "FPWR",
       
    77     "FPRW",
       
    78     "BRD",
       
    79     "BWR",
       
    80     "BRW",
       
    81     "LRD",
       
    82     "LWR",
       
    83     "LRW",
       
    84     "ARMW",
       
    85     "FRMW"
       
    86 };
       
    87     
    64 /*****************************************************************************/
    88 /*****************************************************************************/
    65 
    89 
    66 /** Constructor.
    90 /** Constructor.
    67  */
    91  */
    68 void ec_datagram_init(ec_datagram_t *datagram /**< EtherCAT datagram. */)
    92 void ec_datagram_init(ec_datagram_t *datagram /**< EtherCAT datagram. */)
   471         }
   495         }
   472     }
   496     }
   473 }
   497 }
   474 
   498 
   475 /*****************************************************************************/
   499 /*****************************************************************************/
       
   500 
       
   501 /** Returns a string describing the datagram type.
       
   502  */
       
   503 const char *ec_datagram_type_string(
       
   504         const ec_datagram_t *datagram /**< EtherCAT datagram. */
       
   505         )
       
   506 {
       
   507     return type_strings[datagram->type];
       
   508 }
       
   509 
       
   510 /*****************************************************************************/