#include "can.h" #include "CommBuffers.h" #include "SystemComm.h" /** * @addtogroup SystemComm * @{ */ // ********** private definitions ********** /*********************************************************************//** * @brief * The initSystemComm function initializes the SystemComm unit. * @details \b Inputs: none * @details \b Outputs: SystemComm unit variables initialized. * @return none *************************************************************************/ void initSystemComm( void ) { } /*********************************************************************//** * @brief * The handleCANMsgInterrupt function handles a CAN frame interrupt from * a given CAN mail box. * This may have occurred because a CAN frame transmission has completed * or because a CAN frame has been received. The appropriate handler is * called. * @details \b Inputs: none * @details \b Outputs: message interrupt handled * @param mailbox which CAN mail box triggered this interrupt * @return none *************************************************************************/ void handleCANMsgInterrupt( SW_UPDATE_CAN_MAIL_BOX_T mailBox ) { // TODO do we need check the range of the messages? // TODO retry? U08 data[ CAN_MESSAGE_PAYLOAD_SIZE ]; if ( SW_UPDATE_COMMAD == mailBox ) { if ( FALSE != canIsRxMessageArrived( canREG1, mailBox ) ) { U32 result = canGetData( canREG1, mailBox, data ); if ( result != 0 ) { addToCommBuffer( mailBox, data, CAN_MESSAGE_PAYLOAD_SIZE ); } } } else { if ( RECEIVE_MSG_ID[ BL_STACK_ID ] == mailBox ) { if ( FALSE != canIsRxMessageArrived( canREG1, mailBox ) ) { U32 result = canGetData( canREG1, mailBox, data ); if ( result != 0 ) { addToCommBuffer( mailBox, data, CAN_MESSAGE_PAYLOAD_SIZE ); } } } } } /*********************************************************************//** * @brief * The sendAckNackStatusFromFirmware function sends the ack or nack status * of a received message. * @details \b Inputs: none * @details \b Outputs: none * @param data pointer to the data to be sent * @return TRUE if the CAN transmit was successful otherwise, FALSE *************************************************************************/ BOOL sendAckNackStatusFromFirmware( U08* data ) { BOOL status = FALSE; if ( 0 != canTransmit( canREG1, (U32)SW_UPDATE_RESP, data ) ) { status = TRUE; } return status; } BOOL broadcastDataTestRemove( U08* data ) // TODO remove { canTransmit( canREG1, (U32)SW_TEST, data ); return TRUE; } /**@}*/