Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rd4c8e0246e5bc34d1ef6a2e1709647716c84a378 -rf5690caf1912afbf34596055bb8fd2a62e9a32f5 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision d4c8e0246e5bc34d1ef6a2e1709647716c84a378) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision f5690caf1912afbf34596055bb8fd2a62e9a32f5) @@ -1981,105 +1981,7 @@ } } -/*********************************************************************//** - * @brief - * The sendHDSWConfigRecord function sends out the HD software configuration record. - * @details Inputs: none - * @details Outputs: HD software configuration record msg constructed and queued - * @param msgCurrNum: current payload number - * @param msgTotalNum: total number of payloads - * @param length: buffer length to be written - * @param swRcrdAddress: start address of the software configuration record - * @return TRUE if msg successfully queued for transmit, FALSE if not - *************************************************************************/ -BOOL sendHDSWConfigRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* swRcrdAddress ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_SEND_SW_CONFIG_RECORD; - msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; - - memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, &length, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - - memcpy( payloadPtr, swRcrdAddress, length ); - - // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); - - return result; -} - -/*********************************************************************//** -* @brief -* The handleGetHDSoftwareConfigRecord function handles a request to get the HD -* software configuration record. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleGetHDSoftwareConfigRecord( MESSAGE_T *message ) -{ - BOOL result = FALSE; - - // verify payload length - if ( 0 == message->hdr.payloadLen ) - { - // Tester must be logged in - if ( TRUE == isTestingActivated() ) - { - result = sendRecordToDialin( NVDATAMGMT_SW_CONFIG_RECORD ); - } - } - - // respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); -} - -/*********************************************************************//** -* @brief -* The handleSetHDSoftwareConfigRecord function handles a request to set the HD -* software configuration record. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleSetHDSoftwareConfigRecord( MESSAGE_T *message ) -{ - U32 currentMessage; - U32 totalMessages; - U32 payloadLength; - - BOOL status = FALSE; - U08* payloadPtr = message->payload; - - memcpy(¤tMessage, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&totalMessages, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - memcpy(&payloadLength, payloadPtr, sizeof(U32)); - payloadPtr += sizeof(U32); - - status = receiveRecordFromDialin( NVDATAMGMT_SW_CONFIG_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); -} - #ifdef EMC_TEST_BUILD BOOL broadcastCANErrorCount( U32 count ) { @@ -6999,4 +6901,106 @@ return serializeMessage(msg, COMM_BUFFER_OUT_CAN_PC, ACK_REQUIRED ); } +/*********************************************************************//** + * @brief + * The sendHDSWConfigRecord function sends out the HD software configuration record. + * @details Inputs: none + * @details Outputs: HD software configuration record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param swRcrdAddress: start address of the software configuration record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL sendHDSWConfigRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* swRcrdAddress ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_SW_CONFIG_RECORD; + msg.hdr.payloadLen = sizeof( U32 ) + sizeof( U32 ) + sizeof( U32 ) + length; + + memcpy( payloadPtr, &payloadCurrNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &payloadTotalNum, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, &length, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + + memcpy( payloadPtr, swRcrdAddress, length ); + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** +* @brief +* The handleGetHDSoftwareConfigRecord function handles a request to get the HD +* software configuration record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleGetHDSoftwareConfigRecord( MESSAGE_T *message ) +{ + BOOL result = FALSE; + + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = sendRecordToDialin( NVDATAMGMT_SW_CONFIG_RECORD ); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + +/*********************************************************************//** +* @brief +* The handleSetHDSoftwareConfigRecord function handles a request to set the HD +* software configuration record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleSetHDSoftwareConfigRecord( MESSAGE_T *message ) +{ + U32 currentMessage; + U32 totalMessages; + U32 payloadLength; + + BOOL status = FALSE; + U08* payloadPtr = message->payload; + + if ( message->hdr.payloadLen >= ( sizeof(currentMessage) + sizeof(totalMessages) + sizeof(payloadLength) ) ) + { + memcpy(¤tMessage, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&totalMessages, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + memcpy(&payloadLength, payloadPtr, sizeof(U32)); + payloadPtr += sizeof(U32); + + status = receiveRecordFromDialin( NVDATAMGMT_SW_CONFIG_RECORD, currentMessage, totalMessages, payloadLength, payloadPtr ); + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); +} + /**@}*/