Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r6042952abe8c5b39b4d64c3f13f832713bcfb79a -r549fea9aba0bc5bc03d195d1a5659261e3ace9d0 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 6042952abe8c5b39b4d64c3f13f832713bcfb79a) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 549fea9aba0bc5bc03d195d1a5659261e3ace9d0) @@ -53,7 +53,6 @@ // ********** private definitions ********** #define MAX_MSGS_BLOCKED_FOR_XMIT 8 ///< Maximum number of messages to block transmission for. -#define NUM_CONFIRM_REQUESTS 4 ///< Number of available confirmation requests. #pragma pack(push,1) /// Payload record structure for block message transmission request. @@ -69,11 +68,6 @@ static volatile U16 nextSeqNo = 1; ///< Value of sequence number to use for next transmitted message. /// List of message IDs that are requested not to be transmitted. static BLOCKED_MSGS_DATA_T blockedMessagesForXmit = { 0, 0, 0, 0, 0, 0, 0, 0 }; -static CONFIRMATION_REQUEST_T confirmRequests[NUM_CONFIRM_REQUESTS] = - { 0, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0, CONFIRMATION_REQUEST_STATUS_UNUSED, - 0, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0, CONFIRMATION_REQUEST_STATUS_UNUSED, - 0, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0, CONFIRMATION_REQUEST_STATUS_UNUSED, - 0, GENERIC_CONFIRM_CMD_REQUEST_OPEN, 0, CONFIRMATION_REQUEST_STATUS_UNUSED, }; // ********** private function prototypes ********** @@ -7348,8 +7342,7 @@ if ( message->hdr.payloadLen == 2 * sizeof(U32) ) { U32 request_id; - CONFIRMATION_REQUEST_STATUS_T status; - U08 i; + U32 status; memcpy( &request_id, payloadPtr, sizeof(U32) ); payloadPtr += sizeof(U32); @@ -7358,14 +7351,7 @@ if ( ( CONFIRMATION_REQUEST_STATUS_REJECTED == status ) || ( CONFIRMATION_REQUEST_STATUS_ACCEPTED == status ) ) { - for ( i = 0; i < NUM_CONFIRM_REQUESTS; i++ ) - { - if ( confirmRequests[ i ].requestID == request_id ) - { - confirmRequests[ i ].status = status; - break; - } - } + setConfirmationRequestStatus( (GENERIC_CONFIRM_ID_T) request_id, (CONFIRMATION_REQUEST_STATUS_T) status ); } else { @@ -7379,93 +7365,36 @@ /*********************************************************************//** * @brief - * The checkConfrimRequestStatus function checks the status of a confirmation request - * @details Inputs: confirmRequests[] - * @details Outputs: confirmRequests[] cleared if read. - * @param request ID - * @return CONFIRMATION_REQUEST_STATUS_T - *************************************************************************/ -CONFIRMATION_REQUEST_STATUS_T checkConfirmationRequestStatus( GENERIC_CONFIRM_ID_T request_id ) -{ - U08 i; - CONFIRMATION_REQUEST_STATUS_T status = CONFIRMATION_REQUEST_STATUS_PENDING; - - for ( i = 0; i < NUM_CONFIRM_REQUESTS; i++ ) - { - if ( confirmRequests[ i ].requestID == request_id ) - { - if ( TRUE == didTimeout( confirmRequests[ i ].timeStamp, CONFIRMATION_REQUEST_TIMEOUT_MS ) ) - { - status = CONFIRMATION_REQUEST_STATUS_TIMEOUT; - } - else - { - status = confirmRequests[ i ].status; - } - if ( CONFIRMATION_REQUEST_STATUS_PENDING != status) - { - // Clear the confirmation request - confirmRequests[ i ].requestID = 0; - confirmRequests[ i ].requestType = GENERIC_CONFIRM_CMD_REQUEST_OPEN; - confirmRequests[ i ].timeStamp = 0; - confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_UNUSED; - } - break; - } - } - - return status; -} - -/*********************************************************************//** - * @brief * The sendConfirmationRequest function sends a confirmation request to UI - * @details Inputs: - * @details Outputs: confirmRequests[]. - * @param + * @details Inputs: none + * @details Outputs: none + * @param request ID + * @param request type + * @param reject reason * @return request ID - will be non-zero if sent *************************************************************************/ -GENERIC_CONFIRM_ID_T sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) +void sendConfirmationRequest( GENERIC_CONFIRM_ID_T request_id, GENERIC_CONFIRM_COMMAND_T request_type, U32 reject_reason ) { MESSAGE_T msg; U08 *payloadPtr = msg.payload; - U08 i; - GENERIC_CONFIRM_ID_T new_id = GENERIC_CONFIRM_ID_NONE; U32 temp_request; - for ( i = 0; i < NUM_CONFIRM_REQUESTS; i++ ) - { - if ( confirmRequests[ i ].status == CONFIRMATION_REQUEST_STATUS_UNUSED ) - { - // Save the confirmation request info - confirmRequests[ i ].requestID = request_id; - confirmRequests[ i ].requestType = request_type; - confirmRequests[ i ].timeStamp = getMSTimerCount(); - confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_PENDING; - new_id = request_id; + // Create a message record + blankMessage( &msg ); + msg.hdr.msgID = MSG_ID_HD_REQUEST_UI_CONFIRMATION; + // The payload length is U32 Request ID, U32 Type, U32 Reject Reason + msg.hdr.payloadLen = 3 * sizeof( U32 ); - // Create a message record - blankMessage( &msg ); - msg.hdr.msgID = MSG_ID_HD_REQUEST_UI_CONFIRMATION; - // The payload length is U32 Request ID, U32 Type, U32 Reject Reason - msg.hdr.payloadLen = 3 * sizeof( U32 ); + temp_request = request_id; + memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + temp_request = request_type; + memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + memcpy( payloadPtr, &reject_reason, sizeof( U32 ) ); - temp_request = request_id; - memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - temp_request = request_type; - memcpy( payloadPtr, &temp_request, sizeof( U32 ) ); - payloadPtr += sizeof( U32 ); - memcpy( payloadPtr, &reject_reason, sizeof( U32 ) ); - - // 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_HD_2_UI, ACK_NOT_REQUIRED ); - - break; - } - } - - return new_id; + // 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_HD_2_UI, ACK_NOT_REQUIRED ); } /**@}*/