Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rac2c218b9e310a14d2872c9b4c32a6f69615088e -rbd5622b94bc751fd9e7ccb7d34afdf69b60240ec --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ac2c218b9e310a14d2872c9b4c32a6f69615088e) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision bd5622b94bc751fd9e7ccb7d34afdf69b60240ec) @@ -1328,16 +1328,82 @@ return result; } -// MSG_ID_HD_SEND_SYSTEM_RECORD +/*********************************************************************//** + * @brief + * The sendHDSystemRecord function sends out the HD system record. + * @details Inputs: none + * @details Outputs: HD system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param sysRcrdAddress: start address of the system record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ BOOL sendHDSystemRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* sysRcrdAddress ) { + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_SEND_SYSTEM_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, sysRcrdAddress, 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; } -// MSG_ID_Hd_SEND_SERVICE_RECORD +/*********************************************************************//** + * @brief + * The sendHDServiceRecord function sends out the HD service record. + * @details Inputs: none + * @details Outputs: HD system record msg constructed and queued + * @param msgCurrNum: current payload number + * @param msgTotalNum: total number of payloads + * @param length: buffer length to be written + * @param srvcRcrdAddress: start address of the service record + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ BOOL sendHDServiceRecord( U32 payloadCurrNum, U32 payloadTotalNum, U32 length, U08* srvcRcrdAddress ) { + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_Hd_SEND_SERVICE_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, srvcRcrdAddress, 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; } #ifdef EMC_TEST_BUILD @@ -4231,28 +4297,122 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -// MSG_ID_HD_SET_SYSTEM_RECORD +/*********************************************************************//** +* @brief +* The handleSetHDSystemRecord function handles a request to set the HD +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ void handleSetHDSystemRecord( MESSAGE_T *message ) { + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 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 = setSystemRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } -// MSG_ID_HD_GET_SYSTEM_RECORD +/*********************************************************************//** +* @brief +* The handleGetHDSystemRecord function handles a request to get the HD +* system data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ void handleGetHDSystemRecord( MESSAGE_T *message ) { + BOOL result = FALSE; + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getSystemRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -// MSG_ID_HD_GET_SERVICE_RECORD +/*********************************************************************//** +* @brief +* The handleGetHDServiceRecord function handles a request to get the HD +* service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ void handleGetHDServiceRecord( MESSAGE_T *message ) { + BOOL result = FALSE; + // verify payload length + if ( 0 == message->hdr.payloadLen ) + { + // Tester must be logged in + if ( TRUE == isTestingActivated() ) + { + result = getServiceRecord(); + } + } + + // respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -// MSG_ID_HD_SET_SERVICE_RECORD +/*********************************************************************//** +* @brief +* The handleSetHDServiceRecord function handles a request to set the HD +* service data record. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ void handleSetHDServiceRecord( MESSAGE_T *message ) { + BOOL status = FALSE; + U08* payloadPtr = message->payload; + U32 currentMessage; + U32 totalMessages; + U32 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 = setServiceRecord( currentMessage, totalMessages, payloadLength, payloadPtr ); + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); } /**@}*/ Index: firmware/App/Tasks/TaskGeneral.c =================================================================== diff -u -rac2c218b9e310a14d2872c9b4c32a6f69615088e -rbd5622b94bc751fd9e7ccb7d34afdf69b60240ec --- firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision ac2c218b9e310a14d2872c9b4c32a6f69615088e) +++ firmware/App/Tasks/TaskGeneral.c (.../TaskGeneral.c) (revision bd5622b94bc751fd9e7ccb7d34afdf69b60240ec) @@ -21,7 +21,8 @@ #include "CPLD.h" #include "DGInterface.h" #include "DialInFlow.h" -#include "DialOutFlow.h" +#include "DialOutFlow.h" +#include "NVDataMgmt.h" #include "OperationModes.h" #include "PresOccl.h" #include "SystemComm.h" @@ -92,7 +93,7 @@ execNVDataMgmtProcessRecord(); // Manage alarm state - //execAlarmMgmt(); + //execAlarmMgmt(); // Manage data to be transmitted to other sub-systems execSystemCommTx();