master/canopen.c
branchstable-1.0
changeset 1623 05622513f627
parent 1621 4bbe090553f7
child 1624 9dc190591c0f
equal deleted inserted replaced
1622:fe8777a69d4a 1623:05622513f627
    52 int ec_slave_fetch_sdo_entries(ec_slave_t *, ec_command_t *,
    52 int ec_slave_fetch_sdo_entries(ec_slave_t *, ec_command_t *,
    53                                ec_sdo_t *, uint8_t);
    53                                ec_sdo_t *, uint8_t);
    54 
    54 
    55 /*****************************************************************************/
    55 /*****************************************************************************/
    56 
    56 
    57 const ec_code_msg_t sdo_abort_messages[];
       
    58 
       
    59 /*****************************************************************************/
       
    60 
       
    61 /**
    57 /**
    62    Reads 32 bit of a CANopen SDO in expedited mode.
    58    Reads 32 bit of a CANopen SDO in expedited mode.
    63    \return 0 in case of success, else < 0
    59    \return 0 in case of success, else < 0
    64 */
    60 */
    65 
    61 
   527 }
   523 }
   528 
   524 
   529 /*****************************************************************************/
   525 /*****************************************************************************/
   530 
   526 
   531 /**
   527 /**
   532    Outputs an SDO abort message.
   528    SDO abort messages.
   533 */
   529    The "abort SDO transfer request" supplies an abort code,
   534 
   530    which can be translated to clear text. This table does
   535 void ec_canopen_abort_msg(uint32_t abort_code)
   531    the mapping of the codes and messages.
   536 {
   532 */
   537     const ec_code_msg_t *abort_msg;
       
   538 
       
   539     for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) {
       
   540         if (abort_msg->code == abort_code) {
       
   541             EC_ERR("SDO abort message 0x%08X: \"%s\".\n",
       
   542                    abort_msg->code, abort_msg->message);
       
   543             return;
       
   544         }
       
   545     }
       
   546 
       
   547     EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code);
       
   548 }
       
   549 
       
   550 /*****************************************************************************/
       
   551 
   533 
   552 const ec_code_msg_t sdo_abort_messages[] = {
   534 const ec_code_msg_t sdo_abort_messages[] = {
   553     {0x05030000, "Toggle bit not changed"},
   535     {0x05030000, "Toggle bit not changed"},
   554     {0x05040000, "SDO protocol timeout"},
   536     {0x05040000, "SDO protocol timeout"},
   555     {0x05040001, "Client/Server command specifier not valid or unknown"},
   537     {0x05040001, "Client/Server command specifier not valid or unknown"},
   584     {0x08000023, "Object dictionary dynamic generation fails or no object"
   566     {0x08000023, "Object dictionary dynamic generation fails or no object"
   585      " dictionary is present"},
   567      " dictionary is present"},
   586     {}
   568     {}
   587 };
   569 };
   588 
   570 
       
   571 /*****************************************************************************/
       
   572 
       
   573 /**
       
   574    Outputs an SDO abort message.
       
   575 */
       
   576 
       
   577 void ec_canopen_abort_msg(uint32_t abort_code)
       
   578 {
       
   579     const ec_code_msg_t *abort_msg;
       
   580 
       
   581     for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) {
       
   582         if (abort_msg->code == abort_code) {
       
   583             EC_ERR("SDO abort message 0x%08X: \"%s\".\n",
       
   584                    abort_msg->code, abort_msg->message);
       
   585             return;
       
   586         }
       
   587     }
       
   588 
       
   589     EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code);
       
   590 }
       
   591 
   589 /******************************************************************************
   592 /******************************************************************************
   590  *  Realtime interface
   593  *  Realtime interface
   591  *****************************************************************************/
   594  *****************************************************************************/
   592 
   595 
   593 /**
   596 /**