mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-06 20:01:44 +08:00
Introduced ec_datagram_type_string().
This commit is contained in:
@@ -63,6 +63,30 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Array of datagram type strings used in ec_datagram_type_string().
|
||||
*
|
||||
* \attention This is indexed by ec_datagram_type_t.
|
||||
*/
|
||||
static const char *type_strings[] = {
|
||||
"?",
|
||||
"APRD",
|
||||
"APWR",
|
||||
"APRW",
|
||||
"FPRD",
|
||||
"FPWR",
|
||||
"FPRW",
|
||||
"BRD",
|
||||
"BWR",
|
||||
"BRW",
|
||||
"LRD",
|
||||
"LWR",
|
||||
"LRW",
|
||||
"ARMW",
|
||||
"FRMW"
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Constructor.
|
||||
*/
|
||||
void ec_datagram_init(ec_datagram_t *datagram /**< EtherCAT datagram. */)
|
||||
@@ -473,3 +497,14 @@ void ec_datagram_output_stats(
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Returns a string describing the datagram type.
|
||||
*/
|
||||
const char *ec_datagram_type_string(
|
||||
const ec_datagram_t *datagram /**< EtherCAT datagram. */
|
||||
)
|
||||
{
|
||||
return type_strings[datagram->type];
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -138,7 +138,8 @@ int ec_datagram_lwr(ec_datagram_t *, uint32_t, size_t, uint8_t *);
|
||||
int ec_datagram_lrw(ec_datagram_t *, uint32_t, size_t, uint8_t *);
|
||||
|
||||
void ec_datagram_print_wc_error(const ec_datagram_t *);
|
||||
void ec_datagram_output_stats(ec_datagram_t *datagram);
|
||||
void ec_datagram_output_stats(ec_datagram_t *);
|
||||
const char *ec_datagram_type_string(const ec_datagram_t *);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user