Index: firmware/App/Services/Download.c =================================================================== diff -u -r5acce83ec629eff9621c0193fae57b7b63ad8de8 -r1541f5c438744fffa0dc3157935da528342f01e7 --- firmware/App/Services/Download.c (.../Download.c) (revision 5acce83ec629eff9621c0193fae57b7b63ad8de8) +++ firmware/App/Services/Download.c (.../Download.c) (revision 1541f5c438744fffa0dc3157935da528342f01e7) @@ -83,7 +83,6 @@ static void handleIncomingCmdMessage( SW_UPDATE_CAN_MAIL_BOX_T mailBox ); static void handleIncomingUpdateMessage( SW_UPDATE_CAN_MAIL_BOX_T mailBox ); static void handleIncomingBroadcastMessage( SW_UPDATE_CAN_MAIL_BOX_T mailBox ); -static void prepareAndSendBootLoaderResponseMessage( U16 respOfMsgID, ACK_NACK_STATUS_T ackNack ); static void clearSWUpdateBuffer( void ); static ACK_NACK_STATUS_T handleFirmwareUpdate( void ); static ACK_NACK_STATUS_T handleFPGAUpdate( void ); @@ -216,6 +215,29 @@ return SWUpdateCmdStatus.msgID; } +/*********************************************************************//** + * @brief + * The prepareAndSendBootLoaderResponseMessage function prepares the message + * body that is used to respond to the updater app and sends it. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message ID that is being responded for + * @param ack nack status + * @return none + *************************************************************************/ +void prepareAndSendBootLoaderResponseMessage( U16 respOfMsgID, ACK_NACK_STATUS_T ackNack ) +{ + SW_UPDATE_RESP_STATUS_T resp; + U32 calcCRC = 0; + + resp.msgID = respOfMsgID; + resp.msgAckNackStatus = ackNack; + resp.spareSpace = 0; + resp.msgCRC = crc32( calcCRC, (U08*)&resp, sizeof( SW_UPDATE_RESP_STATUS_T ) - sizeof( U32 ) ); + + sendAckNackStatusFromBootloader( (U08*)&resp ); // TODO do we have to retry if send failed? +} + // ********** private functions ********** /*********************************************************************//** @@ -386,29 +408,6 @@ /*********************************************************************//** * @brief - * The prepareAndSendBootLoaderResponseMessage function prepares the message - * body that is used to respond to the updater app and sends it. - * @details \b Inputs: none - * @details \b Outputs: none - * @param message ID that is being responded for - * @param ack nack status - * @return none - *************************************************************************/ -static void prepareAndSendBootLoaderResponseMessage( U16 respOfMsgID, ACK_NACK_STATUS_T ackNack ) -{ - SW_UPDATE_RESP_STATUS_T resp; - U32 calcCRC = 0; - - resp.msgID = respOfMsgID; - resp.msgAckNackStatus = ackNack; - resp.spareSpace = 0; - resp.msgCRC = crc32( calcCRC, (U08*)&resp, sizeof( SW_UPDATE_RESP_STATUS_T ) - sizeof( U32 ) ); - - sendAckNackStatusFromBootloader( (U08*)&resp ); // TODO do we have to retry if send failed? -} - -/*********************************************************************//** - * @brief * The clearSWUpdateBuffer function clears the software update buffer. * @details \b Inputs: none * @details \b Outputs: SWUpdateRCVStatus