Index: firmware/App/Services/Download.c =================================================================== diff -u -r5645305f9349c5c64be5560982bdf1abd5edb0fb -rab214e8ea52d8433b7cee58f5aaff49fc759310d --- firmware/App/Services/Download.c (.../Download.c) (revision 5645305f9349c5c64be5560982bdf1abd5edb0fb) +++ firmware/App/Services/Download.c (.../Download.c) (revision ab214e8ea52d8433b7cee58f5aaff49fc759310d) @@ -78,7 +78,7 @@ 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 prepareAndSendFWResponseMessage( U16 respOfMsgID, ACK_NACK_STATUS_T ackNack ); +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 ); @@ -168,7 +168,7 @@ { SW_UPDATE_CAN_MAIL_BOX_T thisStackMailBox = RECEIVE_MSG_ID[ BL_STACK_ID ][ FW_STACKS_RCV_MAIL_BOX_INDEX ]; - prepareAndSendFWResponseMessage( SWUpdateRCVStatus.msgID, ackNackStatus ); + prepareAndSendBootLoaderResponseMessage( SWUpdateRCVStatus.msgID, ackNackStatus ); clearCommBuffer( thisStackMailBox ); } @@ -185,7 +185,15 @@ return SWUpdateLastBroadcastTimeMS; } -U08 getTempRemoveMSGID() +/*********************************************************************//** + * @brief + * The getCurrentUpdateMessageID function returns the current update message + * ID that has been received with update payload. + * @details \b Inputs: SWUpdateRCVStatus + * @details \b Outputs: none + * @return the current update message ID with update payload + *************************************************************************/ +U16 getCurrentUpdateMessageID() { return SWUpdateRCVStatus.msgID; } @@ -235,7 +243,7 @@ } // Send the result of the command received - prepareAndSendFWResponseMessage( msgID, ackStatus ); + prepareAndSendBootLoaderResponseMessage( msgID, ackStatus ); clearCommBuffer( mailBox ); } } @@ -288,10 +296,13 @@ { case UPDATE_FIRMWARE: ackStatus = handleFirmwareUpdate(); + // Send the ack/nack status immediately because the other processes are blocked + prepareAndSendBootLoaderResponseMessage( msgID, ackStatus ); break; case UPDATE_FPGA: ackStatus = handleFPGAUpdate(); + // Do not send the ack/nack immediately. FPGA takes longer to respond and it will through other functions break; default: @@ -300,7 +311,6 @@ } } - prepareAndSendFWResponseMessage( msgID, ackStatus ); clearCommBuffer( mailBox ); clearSWUpdateBuffer(); } @@ -341,15 +351,15 @@ /*********************************************************************//** * @brief - * The prepareAndSendFWResponseMessage function prepares the message body that is - * used to respond to the updater app and sends it. + * 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 prepareAndSendFWResponseMessage( U16 respOfMsgID, ACK_NACK_STATUS_T ackNack ) +static void prepareAndSendBootLoaderResponseMessage( U16 respOfMsgID, ACK_NACK_STATUS_T ackNack ) { SW_UPDATE_RESP_STATUS_T resp; U32 calcCRC = 0; @@ -427,7 +437,7 @@ } else { - prepareAndSendFWResponseMessage( SWUpdateRCVStatus.msgID, ACK ); + prepareAndSendBootLoaderResponseMessage( SWUpdateRCVStatus.msgID, ACK ); } return ackStatus;