Index: firmware/App/Services/CommBuffers.c =================================================================== diff -u -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd -r5645305f9349c5c64be5560982bdf1abd5edb0fb --- firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) +++ firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 5645305f9349c5c64be5560982bdf1abd5edb0fb) @@ -11,19 +11,19 @@ // ********** private definitions ********** -#define UPDATE_PACKET_SIZE_BYTES ( SW_UPDATE_FLASH_BUFFER_SIZE + CAN_MESSAGE_FRAME_SIZE ) ///< Software update packet size in bytes. +#define UPDATE_PACKET_SIZE_BYTES ( SW_UPDATE_FLASH_BUFFER_SIZE + CAN_MESSAGE_FRAME_SIZE_BYTES ) ///< Software update packet size in bytes. /// Software update buffer structure typedef struct { - U32 SWUpdateNumOfFramesCount; ///< Software update number of frame count. - U32 SWUpdateFrameCount; ///< Software update frame count. - U08 SWUpdateBuffer[ UPDATE_PACKET_SIZE_BYTES ]; ///< Software update buffer. + U32 SWUpdateNumOfFramesCount; ///< Software update number of frame count. + U32 SWUpdateFrameCount; ///< Software update frame count. + U08 SWUpdateBuffer[ UPDATE_PACKET_SIZE_BYTES ]; ///< Software update buffer. } SW_UPDATE_BUFFER_T; // ********** private data ********** -static SW_UPDATE_BUFFER_T SWUpdateBuffer[ NUM_OF_SW_UPDATE_MBOXES ]; ///< Software update buffer array. +static SW_UPDATE_BUFFER_T SWUpdateBuffer[ NUM_OF_SW_UPDATE_MBOXES ]; ///< Software update buffer array. // ********** private function prototypes ******** @@ -67,7 +67,7 @@ U32 currentFrameCount = SWUpdateBuffer[ mailBox ].SWUpdateFrameCount; // Check if the number of bytes is less than the allowed bytes in the mailbox buffer. - if ( ( currentFrameCount * CAN_MESSAGE_FRAME_SIZE ) <= UPDATE_PACKET_SIZE_BYTES ) + if ( ( currentFrameCount * CAN_MESSAGE_FRAME_SIZE_BYTES ) <= UPDATE_PACKET_SIZE_BYTES ) { U32 currentBufferIndex = currentFrameCount * len; @@ -77,6 +77,7 @@ switch ( mailBox ) { case SW_UPDATE_COMMAD: + case SW_UPDATE_FFU_BROADCAST: // A command is only 1 frame of 8 bytes. SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount = NUM_OF_CMD_CAN_FRAMES; break; @@ -93,7 +94,7 @@ // Per the payload length, calculate the number of frames of 8 bytes that are needed to receive the entire update message. // Round up the number of frames with (payload length + 1 can frame (8 bytes) - 1) / 1 can frame (8 bytes) // After calculating the number of frames needed to receive the entire update payload add one more frame for the overhead frame. - SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount = ( updatePayloadLength + CAN_MESSAGE_FRAME_SIZE - 1 ) / CAN_MESSAGE_FRAME_SIZE; + SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount = ( updatePayloadLength + CAN_MESSAGE_FRAME_SIZE_BYTES - 1 ) / CAN_MESSAGE_FRAME_SIZE_BYTES; SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount += 1; } break; @@ -161,6 +162,7 @@ switch ( mailBox ) { case SW_UPDATE_COMMAD: + case SW_UPDATE_FFU_BROADCAST: frameCnt = SWUpdateBuffer[ mailBox ].SWUpdateFrameCount; numOfFramesCnt = SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount; break;