Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r54f45c387430e440ab4607451fc84dea61f273f1 -r498aa2804b2babde370f74f0cf9a333655fc0410 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 54f45c387430e440ab4607451fc84dea61f273f1) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 498aa2804b2babde370f74f0cf9a333655fc0410) @@ -146,9 +146,8 @@ /*********************************************************************//** * @brief * The initSystemComm function initializes the SystemComm module. - * @details - * Inputs : none - * Outputs : SystemComm module initialized. + * @details Inputs: none + * @details Outputs: SystemComm module initialized. * @return none *************************************************************************/ void initSystemComm( void ) @@ -174,9 +173,8 @@ * @brief * The isHDCommunicating function determines whether the HD is communicating * with the DG. - * @details - * Inputs : hdIsCommunicating - * Outputs : none + * @details Inputs: hdIsCommunicating + * @details Outputs: none * @return TRUE if HD has broadcast since last call, FALSE if not *************************************************************************/ BOOL isHDCommunicating( void ) @@ -188,9 +186,8 @@ * @brief * The isDGOnlyCANNode function determines whether the DG is the only node * currently on the CAN bus. - * @details - * Inputs : dgIsOnlyCANNode - * Outputs : none + * @details Inputs: dgIsOnlyCANNode + * @details Outputs: none * @return TRUE if DG is only node on CAN bus, FALSE if not *************************************************************************/ BOOL isDGOnlyCANNode( void ) @@ -201,9 +198,8 @@ /*********************************************************************//** * @brief * The execSystemCommRx function manages received data from other sub-systems. - * @details - * Inputs : none - * Outputs : Incoming frames processed. + * @details Inputs: none + * @details Outputs: Incoming frames processed. * @return none *************************************************************************/ void execSystemCommRx( void ) @@ -224,9 +220,8 @@ /*********************************************************************//** * @brief * The execSystemCommTx function manages data to be transmitted to other sub-systems. - * @details - * Inputs : none - * Outputs : Next outgoing frame transmitted. + * @details Inputs: none + * @details Outputs: Next outgoing frame transmitted. * @return none *************************************************************************/ void execSystemCommTx( void ) @@ -292,9 +287,8 @@ * The handleCANMsgInterrupt function handles a CAN message interrupt. This * may have occurred because a CAN packet transmission has completed or * because a CAN packet has been received. The appropriate handler is called. - * @details - * Inputs : none - * Outputs : message interrupt handled + * @details Inputs: none + * @details Outputs: message interrupt handled * @param srcCANBox which CAN message box triggered this interrupt * @return none *************************************************************************/ @@ -334,16 +328,15 @@ } } +#ifdef DEBUG_ENABLED /*********************************************************************//** * @brief * The handleUARTMsgRecvPacketInterrupt function handles a DMA UART receive * packet completed interrupt. - * @details - * Inputs : none - * Outputs : none + * @details Inputs: none + * @details Outputs: none * @return none *************************************************************************/ -#ifdef DEBUG_ENABLED void handleUARTMsgRecvPacketInterrupt( void ) { // buffer received packet @@ -353,18 +346,15 @@ dmaSetChEnable( DMA_CH1, DMA_HW ); setSCI1DMAReceiveInterrupt(); } -#endif /*********************************************************************//** * @brief * The handleUARTMsgXmitPacketInterrupt function handles a DMA UART transmit * packet completed interrupt. - * @details - * Inputs : none - * Outputs : none + * @details Inputs: none + * @details Outputs: none * @return none *************************************************************************/ -#ifdef DEBUG_ENABLED void handleUARTMsgXmitPacketInterrupt( void ) { U32 bytesXmitted = transmitNextUARTPacket(); @@ -374,18 +364,15 @@ signalSCI1XmitsCompleted(); } } -#endif /*********************************************************************//** * @brief * The initUARTAndDMA function initializes the SCI1 peripheral and the DMA * to go with it for PC communication. - * @details - * Inputs : none - * Outputs : SCI1 and DMA initialized + * @details Inputs: none + * @details Outputs: SCI1 and DMA initialized * @return none *************************************************************************/ -#ifdef DEBUG_ENABLED static void initUARTAndDMA( void ) { // Enable DMA block transfer complete interrupts @@ -445,9 +432,8 @@ * @brief * The isCANBoxForXmit function determines whether a given CAN message box * is configured for transmit. - * @details - * Inputs : CAN_OUT_BUFFERS[] - * Outputs : none + * @details Inputs: CAN_OUT_BUFFERS[] + * @details Outputs: none * @param srcCANBox which CAN message box to check * @return TRUE if the given CAN message box is configured for transmit, FALSE if not. *************************************************************************/ @@ -472,9 +458,8 @@ * @brief * The isCANBoxForRecv function determines whether a given CAN message box * is configured for receiving. - * @details - * Inputs : MSG_IN_BUFFERS[] - * Outputs : none + * @details Inputs: MSG_IN_BUFFERS[] + * @details Outputs: none * @param srcCANBox which CAN message box to check * @return TRUE if the given CAN message box is configured for receiving, FALSE if not. *************************************************************************/ @@ -498,9 +483,8 @@ /*********************************************************************//** * @brief * The clearCANXmitBuffers function clears all CAN transmit buffers. - * @details - * Inputs : CAN_OUT_BUFFERS[] - * Outputs : CAN transmit buffers cleared. + * @details Inputs: CAN_OUT_BUFFERS[] + * @details Outputs: CAN transmit buffers cleared. * @return none *************************************************************************/ static void clearCANXmitBuffers( void ) @@ -522,9 +506,8 @@ * @brief * The findNextHighestPriorityCANPacketToTransmit function gets the next * 8 byte packet and initiates a CAN transmit on the appropriate CAN channel. - * @details - * Inputs : Output CAN Comm Buffer(s) - * Outputs : none + * @details Inputs: Output CAN Comm Buffer(s) + * @details Outputs: none * @return buffer with highest priority CAN packet to transmit, * COMM_BUFFER_NOT_USED if not CAN packets pending transmit found *************************************************************************/ @@ -550,9 +533,8 @@ * @brief * The transmitNextCANPacket function gets the next 8 byte packet and initiates * a CAN transmit on the appropriate CAN channel. - * @details - * Inputs : Output CAN Comm Buffers - * Outputs : CAN packet transmit initiated. + * @details Inputs: Output CAN Comm Buffers + * @details Outputs: CAN packet transmit initiated. * @return number of bytes transmitted *************************************************************************/ static U32 transmitNextCANPacket( void ) @@ -596,16 +578,15 @@ return result; } +#ifdef DEBUG_ENABLED /*********************************************************************//** * @brief * The transmitNextUARTPacket function sets up and initiates a DMA transmit * of the next packet pending transmit (if any) via UART. - * @details - * Inputs : Output UART Comm Buffer(s) - * Outputs : UART DMA transmit initiated. + * @details Inputs: Output UART Comm Buffer(s) + * @details Outputs: UART DMA transmit initiated. * @return number of bytes transmitted *************************************************************************/ -#ifdef DEBUG_ENABLED static U32 transmitNextUARTPacket( void ) { U32 result = 0; @@ -639,9 +620,8 @@ * @brief * The processIncomingData function parses out messages from the input * comm buffers and adds them to the received message queue. - * @details - * Inputs : Input Comm Buffers - * Outputs : Parsed message(s) added to received message queue + * @details Inputs: Input Comm Buffers + * @details Outputs: Parsed message(s) added to received message queue * @return none *************************************************************************/ static void processIncomingData( void ) @@ -723,9 +703,8 @@ * @brief * The consumeBufferPaddingBeforeSync function removes any bytes in a given * buffer that lie before a sync byte. - * @details - * Inputs : none - * Outputs : Any padding at front of comm buffer is consumed. + * @details Inputs: none + * @details Outputs: Any padding at front of comm buffer is consumed. * @param buffer the comm buffer to process * @return none *************************************************************************/ @@ -754,9 +733,8 @@ * @brief * The parseMessageFromBuffer function looks for a complete message in a * given buffer. If a message is found, its size is returned. - * @details - * Inputs : none - * Outputs : If a complete message can be found in buffer contents, it is parsed out. + * @details Inputs: none + * @details Outputs: If a complete message can be found in buffer contents, it is parsed out. * @param data pointer to byte array to search for a message * @param len number of bytes in the data to search * @return size of message if found, zero if no complete message found, @@ -806,9 +784,8 @@ * @brief * The processReceivedMessages function processes any messages in the * received message queues. - * @details - * Inputs : Received Message Queues - * Outputs : Message(s) processed. + * @details Inputs: Received Message Queues + * @details Outputs: Message(s) processed. * @return none *************************************************************************/ static void processReceivedMessages( void ) @@ -851,9 +828,8 @@ /*********************************************************************//** * @brief * The checkForCommTimeouts function checks for sub-system communication timeout errors. - * @details - * Inputs : timeOfLastDGCheckIn, timeOfLastUICheckIn - * Outputs : possibly a comm t/o alarm + * @details Inputs: timeOfLastDGCheckIn, timeOfLastUICheckIn + * @details Outputs: possibly a comm t/o alarm * @return none *************************************************************************/ static void checkForCommTimeouts( void ) @@ -872,9 +848,8 @@ * The checkTooManyBadMsgCRCs function checks for too many bad message CRCs * within a set period of time. Assumed function is being called when a new * bad CRC is detected so a new bad CRC will be added to the list. - * @details - * Inputs : badCRCTimeStamps[], badCRCListIdx, badCRCListCount - * Outputs : possibly a "too many bad CRCs" alarm + * @details Inputs: badCRCTimeStamps[], badCRCListIdx, badCRCListCount + * @details Outputs: possibly a "too many bad CRCs" alarm * @return none *************************************************************************/ static void checkTooManyBadMsgCRCs( void ) @@ -898,9 +873,8 @@ * The addMsgToPendingACKList function adds a given message to the pending * ACK list. Messages in this list will require receipt of an ACK message * for this particular message within a limited time. - * @details - * Inputs : pendingAckList[] - * Outputs : pendingAckList[] + * @details Inputs: pendingAckList[] + * @details Outputs: pendingAckList[] * @param msg pointer to msg within the message data * @param msgData pointer to message data to add to pending ACK list * @param len number of bytes of message data @@ -944,9 +918,8 @@ * The matchACKtoPendingACKList function searches the pending ACK list to * see if the sequence number from a received ACK msg matches any. If found, * the list entry is removed. - * @details - * Inputs : pendingAckList[] - * Outputs : pendingAckList[] + * @details Inputs: pendingAckList[] + * @details Outputs: pendingAckList[] * @param seqNo sequence number to match to an entry in the list * @return TRUE if a match was found, FALSE if not *************************************************************************/ @@ -974,9 +947,8 @@ * The checkPendingACKList function searches the pending ACK list to see if * any have expired. Any such messages will be queued for retransmission * and if max retries reached a fault is triggered. - * @details - * Inputs : pendingAckList[] - * Outputs : pendingAckList[] + * @details Inputs: pendingAckList[] + * @details Outputs: pendingAckList[] * @return none *************************************************************************/ static void checkPendingACKList( void ) @@ -1010,9 +982,8 @@ /*********************************************************************//** * @brief * The processReceivedMessage function processes a given message. - * @details - * Inputs : none - * Outputs : message processed + * @details Inputs: none + * @details Outputs: message processed * @param message pointer to message to process * @return none *************************************************************************/ @@ -1173,6 +1144,26 @@ handleSetAccelCalibration( message ); break; + case MSG_ID_DG_SOFTWARE_RESET_REQUEST: + handleDGSoftwareResetRequest( message ); + break; + + case MSG_ID_DG_CONCENTRATE_PUMP_MEASURED_SPEED_OVERRIDE: + handleConcentratePumpMeasuredSpeedOverride( message ); + break; + + case MSG_ID_CONCENTRATE_PUMP_TARGET_SPEED_OVERRIDE: + handleSetConcentratePumpTargetSpeed( message ); + break; + + case MSG_ID_CONCENTRATE_PUMP_STATE_CHANGE_REQUEST: + handleConcentratePumpStateChangeRequest( message ); + break; + + case MSG_ID_CONCENTRATE_PUMP_PUBLISH_INTERVAL_OVERRIDE: + handleConcentratePumpPublishIntervalOverride( message ); + break; + default: // TODO - unrecognized message ID received - ignore break;