Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r52ded7b22d4b413aa8182f1343e4fbb78e8c3b0a -r090cfb22a7c0b4738299c3fb411ca77aaba8d968 --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 52ded7b22d4b413aa8182f1343e4fbb78e8c3b0a) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 090cfb22a7c0b4738299c3fb411ca77aaba8d968) @@ -69,13 +69,15 @@ /// Message handling function lookup table static const U16 MSG_FUNCTION_HANDLER_LOOKUP[] = { MSG_ID_TESTER_LOGIN_REQUEST, - MSG_ID_DD_SOFTWARE_RESET_REQUEST + MSG_ID_DD_SOFTWARE_RESET_REQUEST, + MSG_ID_TD_OP_MODE_DATA }; /// Message handling function table static const MsgFuncPtr MSG_FUNCTION_HANDLERS[] = { &handleTesterLogInRequest, - &handleDDSoftwareResetRequest + &handleDDSoftwareResetRequest, + &handleSetTDOperationMode }; #define NUM_OF_FUNCTION_HANDLERS (sizeof(MSG_FUNCTION_HANDLERS) / sizeof(MsgFuncPtr)) @@ -100,8 +102,10 @@ * bit of the sequence # is set if ACK is required per parameter. A sync byte * is inserted at the beginning of the message and an 8-bit CRC is appended to * the end of the message. The message is queued for transmission in the given buffer. - * @details Inputs: none - * @details Outputs: given data array populated with serialized message data and queued for transmit. + * @details \b Inputs: none + * @details \b Outputs: given data array populated with serialized message data and + * queued for transmit. + * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when pending ACK list is full. * @param msg message to serialize * @param buffer outgoing buffer that message should be queued in * @param ackReq is an acknowledgement from receiver required? @@ -179,8 +183,8 @@ * @brief * The sendACKMsg function constructs and queues for transmit an ACK message * for a given received message. - * @details Inputs: none - * @details Outputs: ACK message queued for transmit on broadcast CAN channel. + * @details \b Inputs: none + * @details \b Outputs: ACK message queued for transmit on broadcast CAN channel. * @param message message to send an ACK for * @return TRUE if ACK message queued successfully, FALSE if not *************************************************************************/ @@ -208,8 +212,8 @@ * @brief * The sendTestAckResponseMsg function constructs a simple response message for * a handled test message and queues it for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: response message constructed and queued for transmit. + * @details \b Inputs: none + * @details \b Outputs: response message constructed and queued for transmit. * @param msgID ID of handled message that we are responding to * @param buffer outgoing buffer that message should be queued in * @param ack TRUE if test message was handled successfully, FALSE if not @@ -236,8 +240,8 @@ * @brief * The getMsgHandler function finds the appropriate handler function * for the given message. - * @details Inputs: MSG_FUNCTION_HANDLER_LOOKUP[], MSG_FUNCTION_HANDLERS[] - * @details Outputs: none + * @details \b Inputs: MSG_FUNCTION_HANDLER_LOOKUP[], MSG_FUNCTION_HANDLERS[] + * @details \b Outputs: none * @param msgID ID of message to find handler function for * @return pointer to appropriate function to handle given message *************************************************************************/ @@ -262,8 +266,8 @@ * @brief * The handleIncomingMessage function calls the appropriate handler function * for the given message. - * @details Inputs: none - * @details Outputs: Appropriate message handler function called + * @details \b Inputs: none + * @details \b Outputs: Appropriate message handler function called * @param message Incoming message to handle * @return none *************************************************************************/ @@ -308,8 +312,8 @@ * @brief * The sendEvent function constructs an DG event message to the UI and * queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: DG event msg constructed and queued. + * @details \b Inputs: none + * @details \b Outputs: DG event msg constructed and queued. * @param event Enumeration of event type that occurred * @param dat1 First data associated with event * @param dat2 Second data associated with event @@ -345,8 +349,8 @@ * @brief * The broadcastAlarmTriggered function constructs an alarm triggered msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: alarm triggered msg constructed and queued. + * @details \b Inputs: none + * @details \b Outputs: alarm triggered msg constructed and queued. * @param alarm ID of alarm triggered * @param almData1 1st data associated with alarm * @param almData2 2nd data associated with alarm @@ -391,8 +395,8 @@ * @brief * The broadcastAlarmCleared function constructs an alarm cleared msg to be * broadcast and queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: alarm cleared msg constructed and queued. + * @details \b Inputs: none + * @details \b Outputs: alarm cleared msg constructed and queued. * @param alarm ID of alarm cleared * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -420,8 +424,8 @@ * The broadcastAlarmConditionCleared function constructs an alarm condition * cleared msg to be broadcast and queues the msg for transmit on the * appropriate CAN channel. - * @details Inputs: none - * @details Outputs: alarm condition cleared msg constructed and queued. + * @details \b Inputs: none + * @details \b Outputs: alarm condition cleared msg constructed and queued. * @param alarm ID of alarm which alarm condition is cleared * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ @@ -444,6 +448,41 @@ return result; } +// *********************************************************************** +// **************** Message Handling Helper Functions ******************** +// *********************************************************************** + +/*********************************************************************//** + * @brief + * The handleSetTDOperationMode function receives the TD operation modes data + * publish message. + * @details \b Inputs: none + * @details \b Outputs: none + * @param message a pointer to the message to handle + * @return TRUE if msg successfully queued for transmit, FALSE if not + *************************************************************************/ +BOOL handleSetTDOperationMode( MESSAGE_T *message ) +{ + BOOL status = FALSE; + U08* payloadPtr = message->payload; + + // HD mode broadcast is operations mode and submode so 8 bytes + if ( message->hdr.payloadLen == sizeof( U32 ) + sizeof( U32 ) ) + { + U32 mode = 0; + U32 subMode = 0; + + memcpy( &mode, payloadPtr, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( &subMode, payloadPtr, sizeof( U32 ) ); + + setTDOperationMode( mode, subMode ); + status = TRUE; + } + + return status; +} + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -453,8 +492,8 @@ * @brief * The isTestingActivated function determines whether a tester has successfully * logged in to activate testing functionality. - * @details Inputs: testerLoggedIn - * @details Outputs: none + * @details \b Inputs: testerLoggedIn + * @details \b Outputs: none * @return TRUE if a tester has logged in to activate testing, FALSE if not *************************************************************************/ BOOL isTestingActivated( void ) @@ -466,8 +505,8 @@ * @brief * The setTesterStatusToLoggedOut function sets the status of the tester to * logged out. - * @details Inputs: none - * @details Outputs: testerLoggedIn + * @details \b Inputs: none + * @details \b Outputs: testerLoggedIn * @return none *************************************************************************/ void setTesterStatusToLoggedOut( void ) @@ -479,8 +518,8 @@ * @brief * The sendTestAckResponseMsg function constructs a simple response message for * a handled test message and queues it for transmit on the appropriate UART channel. - * @details Inputs: none - * @details Outputs: response message constructed and queued for transmit. + * @details \b Inputs: none + * @details \b Outputs: response message constructed and queued for transmit. * @param msgID ID of handled message that we are responding to * @param ack TRUE if test message was handled successfully, FALSE if not * @return TRUE if response message successfully queued for transmit, FALSE if not @@ -505,8 +544,8 @@ /*********************************************************************//** * @brief * The handleTesterLogInRequest function handles a request to login as a tester. - * @details Inputs: none - * @details Outputs: message handled + * @details \b Inputs: none + * @details \b Outputs: message handled * @param message a pointer to the message to handle * @return none *************************************************************************/ @@ -534,8 +573,8 @@ * @brief * The handleTDSoftwareResetRequest function handles a request to reset the * TD firmware processor. - * @details Inputs: none - * @details Outputs: message handled + * @details \b Inputs: none + * @details \b Outputs: message handled * @param message a pointer to the message to handle * @return FALSE if reset command rejected (won't return if reset successful) *************************************************************************/