Index: firmware/App/Services/Messaging.c =================================================================== diff -u -r01892698468068bb97a80a84c96a6d7c5d6fde9b -r3518e8a088c32e75c0c8960d5e629a7401095feb --- firmware/App/Services/Messaging.c (.../Messaging.c) (revision 01892698468068bb97a80a84c96a6d7c5d6fde9b) +++ firmware/App/Services/Messaging.c (.../Messaging.c) (revision 3518e8a088c32e75c0c8960d5e629a7401095feb) @@ -34,11 +34,13 @@ #define MAX_MSGS_BLOCKED_FOR_XMIT 8 ///< Maximum number of messages to block transmission for. #pragma pack(push,1) + /// Payload record structure for block message transmission request. typedef struct { U16 blockedMessages[ MAX_MSGS_BLOCKED_FOR_XMIT ]; ///< Blocked messages. } BLOCKED_MSGS_DATA_T; + #pragma pack(pop) /// Array of CAN communication buffers to respond on (aligned with enum Comm_Buffers). @@ -93,17 +95,21 @@ /*********************************************************************//** * @brief - * The serializeMessage function serializes a given message into a given - * array of bytes. A sequence # is added to the message here and the ACK - * 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: blockedMessagesForXmit - * @details Outputs: given data array populated with serialized message data and queued for transmit. + * The serializeMessage function serializes a given message into an array + * of bytes that conform to our CAN message format. A sequence number is added + * and the ACK bit of the sequence number is set if ACK is required per parameter. + * A sync byte is inserted at the beginning and an 8-bit CRC is appended to + * the end. The serialized message data is queued for transmission in the given + * buffer. + * @details Alarm: ALARM_ID_TD_SOFTWARE_FAULT on failure to add a message to the + * pending ACK list (list is full). + * @details \b Inputs: blockedMessagesForXmit + * @details \b Outputs: given buffer is populated with serialized message data and + * queued for transmit. * @param msg message to serialize - * @param buffer outgoing buffer that message should be queued in - * @param ackReq is an acknowledgement from receiver required? - * @return size (in bytes) of serialized message populated in given data array. + * @param buffer outgoing buffer where serialized message should be queued + * @param ackReq Flag indicates whether an acknowledgement from receiver is required? + * @return Number of bytes of serialized message data added to the given buffer. *************************************************************************/ U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ) { @@ -200,10 +206,11 @@ * @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. - * @param message message to send an ACK for - * @return TRUE if ACK message queued successfully, FALSE if not + * @details \b Inputs: none + * @details \b Outputs: ACK message constructed and queued for transmit on broadcast + * CAN channel. + * @param message Pointer to message that is being ACKed + * @return TRUE if ACK message queued for transmit successfully, FALSE if not *************************************************************************/ BOOL sendACKMsg( MESSAGE_T *message ) { @@ -227,14 +234,13 @@ /*********************************************************************//** * @brief - * The sendAckResponseMsg function constructs a simple response - * message for a handled message and queues it for transmit on the - * appropriate CAN channel. - * @details Inputs: none - * @details Outputs: response message constructed and queued for transmit. + * The sendAckResponseMsg function constructs a simple response message for + * a handled message and queues it for transmit on the appropriate CAN channel. + * @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 + * @param buffer outgoing buffer that message should be queued to + * @param ack TRUE to ACK, FALSE to NAK * @return TRUE if response message successfully queued for transmit, FALSE if not *************************************************************************/ static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ) @@ -259,12 +265,12 @@ /*********************************************************************//** * @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 + * The getMsgHandler function finds the appropriate handler function for + * a given message. + * @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 + * @return pointer to appropriate function to handle the given message *************************************************************************/ static MsgFuncPtr getMsgHandler( U16 msgID ) { @@ -286,9 +292,9 @@ /*********************************************************************//** * @brief * The handleIncomingMessage function calls the appropriate handler function - * for the given message. - * @details Inputs: none - * @details Outputs: Appropriate message handler function called + * for a given message and sends appropriate ACK/NAK response. + * @details \b Inputs: none + * @details \b Outputs: Appropriate message handler function called * @param message Incoming message to handle * @return none *************************************************************************/ @@ -332,17 +338,20 @@ + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** + + /*********************************************************************//** * @brief - * The sendEvent function constructs an TD event message to the UI and - * queues the msg for transmit on the appropriate CAN channel. - * @details Inputs: none - * @details Outputs: TD event msg constructed and queued. + * The sendEvent function constructs a TD event message and queues the msg + * for transmit on the TD=>UI CAN channel. + * @details \b Inputs: none + * @details \b Outputs: TD event msg constructed and queued for transmit. * @param event Enumeration of event type that occurred * @param dat1 First data associated with event * @param dat2 Second data associated with event @@ -383,10 +392,10 @@ /*********************************************************************//** * @brief * The isTestingActivated function determines whether a tester has successfully - * logged in to activate testing functionality. - * @details Inputs: testerLoggedIn - * @details Outputs: none - * @return TRUE if a tester has logged in to activate testing, FALSE if not + * logged in to authorize testing functionality. + * @details \b Inputs: testerLoggedIn + * @details \b Outputs: none + * @return TRUE if a tester has logged in from Dialin, FALSE if not *************************************************************************/ BOOL isTestingActivated( void ) { @@ -395,10 +404,10 @@ /*********************************************************************//** * @brief - * The setTesterStatusToLoggedOut function sets the status of the tester to - * logged out. - * @details Inputs: none - * @details Outputs: testerLoggedIn + * The setTesterStatusToLoggedOut function logs Dialin out due to too much + * time since Dialin last checked in. + * @details \b Inputs: none + * @details \b Outputs: testerLoggedIn * @return none *************************************************************************/ void setTesterStatusToLoggedOut( void ) @@ -408,13 +417,13 @@ /*********************************************************************//** * @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. + * The sendTestAckResponseMsg function constructs a simple response message + * for a handled test message and queues it for transmit on the TD=>PC CAN + * channel. + * @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 + * @param ack TRUE to ACK, FALSE to NAK * @return TRUE if response message successfully queued for transmit, FALSE if not *************************************************************************/ static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ) @@ -436,12 +445,11 @@ /*********************************************************************//** * @brief - * The handleTesterLogInRequest function handles a request to login as a - * tester. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return TRUE if log in successful, FALSE if not + * The handleTesterLogInRequest function handles a Dialin request to login. + * @details \b Inputs: none + * @details \b Outputs: Dialin logged in if request is authenticated. + * @param message Pointer to the Dialin login message + * @return TRUE if login successful, FALSE if not *************************************************************************/ BOOL handleTesterLogInRequest( MESSAGE_T *message ) { @@ -468,10 +476,11 @@ * @brief * The handleTDSoftwareResetRequest function handles a request to reset the * TD firmware processor. - * @details Inputs: none - * @details Outputs: message handled - * @param message a pointer to the message to handle - * @return FALSE if reset command rejected (won't return if reset successful) + * @note If reset is successful, this function will not return. + * @details \b Inputs: none + * @details \b Outputs: TD processor soft reset if request is valid + * @param message Pointer to the reset request message + * @return FALSE if reset command rejected *************************************************************************/ BOOL handleTDSoftwareResetRequest( MESSAGE_T *message ) {