master/canopen.c
changeset 164 ed85368b2b2e
parent 161 ddb7266d1c56
child 175 2e4b18203ade
equal deleted inserted replaced
163:a1eea08070e1 164:ed85368b2b2e
    21 int ec_slave_fetch_sdo_descriptions(ec_slave_t *);
    21 int ec_slave_fetch_sdo_descriptions(ec_slave_t *);
    22 int ec_slave_fetch_sdo_entries(ec_slave_t *, ec_sdo_t *, uint8_t);
    22 int ec_slave_fetch_sdo_entries(ec_slave_t *, ec_sdo_t *, uint8_t);
    23 
    23 
    24 /*****************************************************************************/
    24 /*****************************************************************************/
    25 
    25 
    26 /**
    26 const ec_code_msg_t sdo_abort_messages[];
    27    SDO Abort Code Messages
       
    28 */
       
    29 
       
    30 typedef struct
       
    31 {
       
    32     uint32_t code;
       
    33     const char *message;
       
    34 }
       
    35 ec_sdo_abort_message_t;
       
    36 
       
    37 const ec_sdo_abort_message_t sdo_abort_messages[];
       
    38 
    27 
    39 /*****************************************************************************/
    28 /*****************************************************************************/
    40 
    29 
    41 /**
    30 /**
    42    Liest 32 Bit eines CANopen-SDOs im Expedited-Modus aus einem Slave.
    31    Liest 32 Bit eines CANopen-SDOs im Expedited-Modus aus einem Slave.
   460    Gibt eine SDO-Abort-Meldung aus.
   449    Gibt eine SDO-Abort-Meldung aus.
   461 */
   450 */
   462 
   451 
   463 void ec_canopen_abort_msg(uint32_t abort_code)
   452 void ec_canopen_abort_msg(uint32_t abort_code)
   464 {
   453 {
   465     const ec_sdo_abort_message_t *abort_msg;
   454     const ec_code_msg_t *abort_msg;
   466 
   455 
   467     for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) {
   456     for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) {
   468         if (abort_msg->code == abort_code) {
   457         if (abort_msg->code == abort_code) {
   469             EC_ERR("SDO abort message 0x%08X: \"%s\".\n",
   458             EC_ERR("SDO abort message 0x%08X: \"%s\".\n",
   470                    abort_msg->code, abort_msg->message);
   459                    abort_msg->code, abort_msg->message);
   475     EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code);
   464     EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code);
   476 }
   465 }
   477 
   466 
   478 /*****************************************************************************/
   467 /*****************************************************************************/
   479 
   468 
   480 const ec_sdo_abort_message_t sdo_abort_messages[] = {
   469 const ec_code_msg_t sdo_abort_messages[] = {
   481     {0x05030000, "Toggle bit not changed"},
   470     {0x05030000, "Toggle bit not changed"},
   482     {0x05040000, "SDO protocol timeout"},
   471     {0x05040000, "SDO protocol timeout"},
   483     {0x05040001, "Client/Server command specifier not valid or unknown"},
   472     {0x05040001, "Client/Server command specifier not valid or unknown"},
   484     {0x05040005, "Out of memory"},
   473     {0x05040005, "Out of memory"},
   485     {0x06010000, "Unsupported access to an object"},
   474     {0x06010000, "Unsupported access to an object"},