Index: firmware/App/Drivers/CPLD.c =================================================================== diff -u -r9970969e3aca3c3b37a7c322f85b9ce00e9bfdef -rea42ed9f07834acc921c934a2312e7fdd572dbd9 --- firmware/App/Drivers/CPLD.c (.../CPLD.c) (revision 9970969e3aca3c3b37a7c322f85b9ce00e9bfdef) +++ firmware/App/Drivers/CPLD.c (.../CPLD.c) (revision ea42ed9f07834acc921c934a2312e7fdd572dbd9) @@ -19,11 +19,10 @@ #include "mibspi.h" #include "het.h" -#include "WatchdogMgmt.h" #include "CPLD.h" -#include "SystemComm.h" #include "SystemCommMessages.h" #include "TaskPriority.h" +#include "WatchdogMgmt.h" /** * @addtogroup CPLD Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r9970969e3aca3c3b37a7c322f85b9ce00e9bfdef -rea42ed9f07834acc921c934a2312e7fdd572dbd9 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 9970969e3aca3c3b37a7c322f85b9ce00e9bfdef) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision ea42ed9f07834acc921c934a2312e7fdd572dbd9) @@ -352,6 +352,7 @@ setCPLDFaultAudio( PIN_SIGNAL_LOW ); // Clear Fault Audio } } + /************************************************************************* * TEST SUPPORT FUNCTIONS Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -re69a109cc497124ac5f438264647666b17276bf4 -rea42ed9f07834acc921c934a2312e7fdd572dbd9 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision e69a109cc497124ac5f438264647666b17276bf4) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision ea42ed9f07834acc921c934a2312e7fdd572dbd9) @@ -1471,7 +1471,104 @@ return status; } +/*********************************************************************//** +* @brief +* The handleServiceModeRequest function handles a request to enter service +* mode. +* @details Inputs: none +* @details Outputs: message handled +* @param message a pointer to the message to handle +* @return none +*************************************************************************/ +void handleServiceModeRequest( MESSAGE_T *message ) +{ + BOOL status = FALSE; + DG_OP_MODE_T currentMode = getCurrentOperationMode(); + REQUEST_REJECT_REASON_CODE_T reject; + if ( 0 == message->hdr.payloadLen ) + { + if ( ( DG_MODE_STAN == currentMode ) || ( DG_MODE_FAUL == currentMode ) ) + { + status = TRUE; + requestNewOperationMode( DG_MODE_SERV ); + reject = REQUEST_REJECT_REASON_NONE; + } + else + { + reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; + } + } + else + { + reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); + sendServiceModeResponse( status, (U32)reject ); +} + +/*********************************************************************//** + * @brief + * The sendServiceModeResponse function sends out the DG response to a + * UI request to go to service mode. + * @details Inputs: none + * @details Outputs: Service mode request response msg constructed and queued + * @param accepted TRUE if request was accepted, FALSE if not + * @param rejCode Reject reason code explaining why request was rejected + * @return none + *************************************************************************/ +BOOL sendServiceModeResponse( BOOL accepted, U32 rejCode ) +{ + BOOL result; + MESSAGE_T msg; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_RESPONSE_SERVICE_MODE_REQUEST; + msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); + + memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); + payloadPtr += sizeof( BOOL ); + memcpy( payloadPtr, &rejCode, sizeof( U32 ) ); + + // 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_DG_2_HD, ACK_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The handleCpldStatusRequest function handles a CPLD Status request message. + * @details Inputs: none + * @details Outputs: message handled + * @param message a pointer to the message to handle + * @return none + *************************************************************************/ +void handleCpldStatusRequest( MESSAGE_T *message ) +{ + MESSAGE_T msg; + CPLD_STATUS_T payload; + U08 *payloadPtr = msg.payload; + + // populate payload + getCPLDStatus( &payload ); + // create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_DG_CPLD_STATUS; + msg.hdr.payloadLen = sizeof( CPLD_STATUS_T ); + + // fill message payload + memcpy( payloadPtr, &payload, sizeof( CPLD_STATUS_T ) ); + + // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); +} + + // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** @@ -3741,101 +3838,4 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/*********************************************************************//** -* @brief -* The handleServiceModeRequest function handles a request to enter service -* mode. -* @details Inputs: none -* @details Outputs: message handled -* @param message a pointer to the message to handle -* @return none -*************************************************************************/ -void handleServiceModeRequest( MESSAGE_T *message ) -{ - BOOL status = FALSE; - DG_OP_MODE_T currentMode = getCurrentOperationMode(); - REQUEST_REJECT_REASON_CODE_T reject; - - if ( 0 == message->hdr.payloadLen ) - { - if ( ( DG_MODE_STAN == currentMode ) || ( DG_MODE_FAUL == currentMode ) ) - { - status = TRUE; - requestNewOperationMode( DG_MODE_SERV ); - reject = REQUEST_REJECT_REASON_NONE; - } - else - { - reject = REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE; - } - } - else - { - reject = REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT; - } - - // Respond to request - sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, status ); - sendServiceModeResponse( status, (U32)reject ); -} - -/*********************************************************************//** - * @brief - * The sendServiceModeResponse function sends out the DG response to a - * UI request to go to service mode. - * @details Inputs: none - * @details Outputs: Service mode request response msg constructed and queued - * @param accepted TRUE if request was accepted, FALSE if not - * @param rejCode Reject reason code explaining why request was rejected - * @return none - *************************************************************************/ -BOOL sendServiceModeResponse( BOOL accepted, U32 rejCode ) -{ - BOOL result; - MESSAGE_T msg; - U08 *payloadPtr = msg.payload; - - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_RESPONSE_SERVICE_MODE_REQUEST; - msg.hdr.payloadLen = sizeof( BOOL ) + sizeof( U32 ); - - memcpy( payloadPtr, &accepted, sizeof( BOOL ) ); - payloadPtr += sizeof( BOOL ); - memcpy( payloadPtr, &rejCode, sizeof( U32 ) ); - - // 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_DG_2_HD, ACK_REQUIRED ); - - return result; -} - -/*********************************************************************//** - * @brief - * The handleCpldStatusRequest function handles a CPLD Status request message. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return none - *************************************************************************/ -void handleCpldStatusRequest( MESSAGE_T *message ) -{ - MESSAGE_T msg; - CPLD_STATUS_T payload; - U08 *payloadPtr = msg.payload; - - // populate payload - getCPLDStatus( &payload ); - // create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_DG_CPLD_STATUS; - msg.hdr.payloadLen = sizeof( CPLD_STATUS_T ); - - // fill message payload - memcpy( payloadPtr, &payload, sizeof( CPLD_STATUS_T ) ); - - // serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer - serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); -} - /**@}*/