Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -28,20 +28,18 @@ // ********** private definitions ********** -/// A blank alarm data record for alarms that do not include alarm data when triggered. -const ALARM_DATA_T blankAlarmData = { ALARM_DATA_TYPE_NONE, 0 }; +const ALARM_DATA_T blankAlarmData = { ALARM_DATA_TYPE_NONE, 0 }; ///< A blank alarm data record for alarms that do not include alarm data when triggered. // ********** private data ********** -/// table - current state of each alarm -DATA_ARRAY_DECL( BOOL, AlarmStates, NUM_OF_ALARM_IDS, alarmIsActive ); +DATA_ARRAY_DECL( BOOL, AlarmStates, NUM_OF_ALARM_IDS, alarmIsActive ); ///< Array of current state of each alarm // ********** private function prototypes ********** static void activateAlarm( ALARM_ID_T alarm ); static DATA_ARRAY_GET_PROTOTYPE( BOOL, getAlarmActive, alarmID ); -/************************************************************************* +/*********************************************************************//** * @brief initAlarmMgmt * The initAlarmMgmt function initializes the AlarmMgmt module. * @details @@ -62,22 +60,21 @@ alarmIsActive[ a ].override = OVERRIDE_RESET; } } - -/************************************************************************* + +/*********************************************************************//** * @brief execAlarmMgmt - * The execAlarmMgmt function executes the alarm management functions to be \n - * done periodically. + * The execAlarmMgmt function executes the alarm management module. * @details - * Inputs : - * Outputs : + * Inputs : none + * Outputs : none * @return none *************************************************************************/ void execAlarmMgmt( void ) { // TODO - any alarm audio or LED/lamp management for DG? } - -/************************************************************************* + +/*********************************************************************//** * @brief activateAlarm * The activateAlarm function activates a given alarm. * @details @@ -103,17 +100,15 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_ALARM_MGMT_INVALID_ALARM_TO_ACTIVATE, alarm ) } } - -/************************************************************************* + +/*********************************************************************//** * @brief activateAlarmNoData - * The activateAlarmNoData function activates a given alarm. Also, an alarm \n - * message is broadcast to the rest of the system. This function will \n - * include given data in the broadcast message for logging. + * The activateAlarmNoData function activates a given alarm. An alarm message + * is broadcast to the rest of the system. * @details * Inputs : none * Outputs : alarm triggered message sent, alarm activated * @param alarm ID of alarm to activate - * @param alarmData supporting data to include in alarm msg * @return none *************************************************************************/ void activateAlarmNoData( ALARM_ID_T alarm ) @@ -137,17 +132,17 @@ activateAlarm( alarm ); } - -/************************************************************************* + +/*********************************************************************//** * @brief activateAlarm1Data - * The activateAlarm1Data function activates a given alarm. Also, an alarm \n - * message is broadcast to the rest of the system. This function will \n - * include given data in the broadcast message for logging. + * The activateAlarm1Data function activates a given alarm. An alarm message + * is broadcast to the rest of the system. This function will include given + * data in the broadcast message for logging. * @details * Inputs : none * Outputs : alarm triggered message sent, alarm activated * @param alarm ID of alarm to activate - * @param alarmData supporting data to include in alarm msg + * @param alarmData supporting data to include in alarm message * @return none *************************************************************************/ void activateAlarm1Data( ALARM_ID_T alarm, ALARM_DATA_T alarmData ) @@ -171,18 +166,18 @@ activateAlarm( alarm ); } - -/************************************************************************* + +/*********************************************************************//** * @brief activateAlarm2Data - * The activateAlarm2Data function activates a given alarm. Also, an alarm \n - * message is broadcast to the rest of the system. This function will \n - * include two given data in the broadcast message for logging. + * The activateAlarm2Data function activates a given alarm. An alarm message + * is broadcast to the rest of the system. This function will include + * two given data in the broadcast message for logging. * @details * Inputs : none * Outputs : alarm triggered message sent, alarm activated * @param alarm ID of alarm to activate - * @param alarmData1 supporting data to include in alarm msg - * @param alarmData2 supporting data to include in alarm msg + * @param alarmData1 supporting data to include in alarm message + * @param alarmData2 supporting data to include in alarm message * @return none *************************************************************************/ void activateAlarm2Data( ALARM_ID_T alarm, ALARM_DATA_T alarmData1, ALARM_DATA_T alarmData2 ) @@ -206,11 +201,11 @@ activateAlarm( alarm ); } - -/************************************************************************* + +/*********************************************************************//** * @brief clearAlarm - * The clearAlarm function clears a given alarm if it is recoverable. Also \n - * an alarm message is broadcast to the rest of the system. + * The clearAlarm function clears a given alarm if it is recoverable. + * An alarm message is broadcast to the rest of the system. * @details * Inputs : none * Outputs : AlarmStatusTable[] @@ -245,11 +240,10 @@ SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_ALARM_MGMT_INVALID_ALARM_TO_CLEAR, alarm ) } } - -/************************************************************************* + +/*********************************************************************//** * @brief isAlarmActive - * The isAlarmActive function determines whether a given alarm is currently \n - * active. + * The isAlarmActive function determines whether a given alarm is currently active. * @details * Inputs : alarmIsActive[] * Outputs : none @@ -262,8 +256,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief getAlarmActive * The getAlarmActive function gets the active state of a given alarm. * @details @@ -278,13 +272,11 @@ /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ - - -/************************************************************************* + +/*********************************************************************//** * @brief - * The testSetAlarmStateOverride function overrides the state of the \n - * alarm active state for a given alarm with the alarm management with \n - * a given active state. + * The testSetAlarmStateOverride function overrides the state of the alarm active + * state for a given alarm with the alarm management with a given active state. * @details * Inputs : none * Outputs : alarm activated or cleared @@ -314,10 +306,10 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The testResetAlarmStateOverride function resets the override of the \n + * The testResetAlarmStateOverride function resets the override of the * state of the active state for a given alarm with the alarm management. * @details * Inputs : none Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r66c624837b7b915415810e67249048ce5a46c163 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 66c624837b7b915415810e67249048ce5a46c163) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -22,9 +22,8 @@ /** * @defgroup AlarmManagement AlarmManagement - * @brief Alarm Management service module. Provides general alarm management \n - * functionality including support functions for triggering and clearing \n - * specific alarms. + * @brief Alarm management service module. Provides general alarm management functionality + * including support functions for triggering and clearing specific alarms. * * @addtogroup AlarmManagement * @{ @@ -37,53 +36,53 @@ /// Alarm data types list. typedef enum Alarm_Data_Types { - ALARM_DATA_TYPE_NONE = 0, ///< No data given. - ALARM_DATA_TYPE_U32 = 1, ///< Alarm data is unsigned 32-bit integer type. - ALARM_DATA_TYPE_S32 = 2, ///< Alarm data is signed 32-bit integer type. - ALARM_DATA_TYPE_F32 = 3, ///< Alarm data is 32-bit floating point type. - ALARM_DATA_TYPE_BOOL = 4, ///< Alarm data is 32-bit boolean type. - NUM_OF_ALARM_DATA_TYPES ///< Total number of alarm data types. + ALARM_DATA_TYPE_NONE = 0, ///< No data given + ALARM_DATA_TYPE_U32 = 1, ///< Alarm data is unsigned 32-bit integer type + ALARM_DATA_TYPE_S32 = 2, ///< Alarm data is signed 32-bit integer type + ALARM_DATA_TYPE_F32 = 3, ///< Alarm data is 32-bit floating point type + ALARM_DATA_TYPE_BOOL = 4, ///< Alarm data is 32-bit boolean type + NUM_OF_ALARM_DATA_TYPES ///< Total number of alarm data types } ALARM_DATA_TYPES_T; #pragma pack(push,4) /// Record structure for unsigned integer alarm data. typedef struct { - U32 data; ///< Alarm data of unsigned integer type. + U32 data; ///< Alarm data of unsigned integer type } ALARM_DATA_U32_T; /// Record structure for signed integer alarm data. typedef struct { - S32 data; ///< Alarm data of signed integer type. + S32 data; ///< Alarm data of signed integer type } ALARM_DATA_S32_T; /// Record structure for floating point alarm data. typedef struct { - F32 data; ///< Alarm data of floating point type. + F32 data; ///< Alarm data of floating point type } ALARM_DATA_F32_T; /// Record structure for boolean alarm data. typedef struct { - BOOL data; ///< Alarm data of boolean type. + BOOL data; ///< Alarm data of boolean type } ALARM_DATA_BOOL_T; /// Record structure for alarm data of any supported type. typedef union { - ALARM_DATA_U32_T uInt; ///< Alarm data of unsigned integer type. - ALARM_DATA_S32_T sInt; ///< Alarm data of signed integer type. - ALARM_DATA_F32_T flt; ///< Alarm data of floating point type. - ALARM_DATA_BOOL_T bln; ///< Alarm data of boolean type. + ALARM_DATA_U32_T uInt; ///< Alarm data of unsigned integer type + ALARM_DATA_S32_T sInt; ///< Alarm data of signed integer type + ALARM_DATA_F32_T flt; ///< Alarm data of floating point type + ALARM_DATA_BOOL_T bln; ///< Alarm data of boolean type } ALARM_DATAS_T; /// Record structure for alarm data including the data type to aid in interpretation. typedef struct { - ALARM_DATA_TYPES_T dataType; ///< The type of alarm data provided. - ALARM_DATAS_T data; ///< The alarm data of specified type. + ALARM_DATA_TYPES_T dataType; ///< The type of alarm data provided + ALARM_DATAS_T data; ///< The alarm data of specified type } ALARM_DATA_T; #pragma pack(pop) @@ -163,7 +162,5 @@ BOOL testResetAlarmStateOverride( U32 alarmID ); /**@}*/ - -/**@}*/ #endif Index: firmware/App/Services/CommBuffers.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -21,26 +21,31 @@ #include "SystemComm.h" #include "SystemCommMessages.h" #include "Timers.h" + +/** + * @addtogroup CommBuffers + * @{ + */ // ********** private definitions ********** -#define COMM_BUFFER_LENGTH 512 // max bytes in each comm buffer (double if you count double buffers) -#define DOUBLE_BUFFERS 2 // need 2 buffers for double buffering -#define BUFFER_OVERFLOW_PERSISTENCE_MS 5000 // how many ms buffer overflows must persist before fault +#define COMM_BUFFER_LENGTH 512 ///< Comm buffer length in bytes (double if you count double buffers). +#define DOUBLE_BUFFERS 2 ///< Two buffers for double buffering. +#define BUFFER_OVERFLOW_PERSISTENCE_MS 5000 ///< Interval which buffer overflows must persist before fault. // ********** private data ********** -static volatile U32 commBufferByteCount[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ]; // for each buffer, how many bytes does it contain? (also index to next available) -static volatile U32 activeDoubleBuffer[ NUM_OF_COMM_BUFFERS ]; // for each buffer, which double buffer is being fed right now? -static U08 commBuffers[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ][ COMM_BUFFER_LENGTH ]; // each is double buffered to avoid thread contention -static U32 firstBufferOverflowTimeStamp = 0; // time stamp of a prior overflow event - allows for an overflow persistence check +static volatile U32 commBufferByteCount[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ]; ///< Comm buffer byte count. +static volatile U32 activeDoubleBuffer[ NUM_OF_COMM_BUFFERS ]; ///< Active buffer that being fed to. +static U08 commBuffers[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ][ COMM_BUFFER_LENGTH ]; ///< Double buffered comm buffer to avoid thread contention. +static U32 firstBufferOverflowTimeStamp = 0; ///< Time stamp of a prior overflow event - allows for an overflow persistence check. // ********** private function prototypes ********** static U32 switchDoubleBuffer( COMM_BUFFER_T buffer ); static void getDataFromInactiveBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ); -/************************************************************************* +/*********************************************************************//** * @brief * The initCommBuffers function initializes the CommBuffers module. * @details @@ -58,15 +63,14 @@ clearBuffer( (COMM_BUFFER_T)b ); } } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The clearBuffer function clears (empties) a given buffer. \n - * Caller should ensure buffer won't be used while this function is clearing \n - * the buffer. + * The clearBuffer function clears (empties) a given buffer. Caller should + * ensure buffer won't be used while this function is clearing the buffer. * @details * Inputs : none - * Outputs : given buffer is cleared. + * Outputs : given buffer is cleared * @param buffer the buffer to clear * @return none *************************************************************************/ @@ -90,14 +94,13 @@ _enable_IRQ(); } } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The addToCommBuffer function adds data of specified length to a specified \n - * communication buffer. S/W fault if buffer too full to add data. \n - * This function will always add to the active double buffer. \n - * This function should only be called from the background, general, or \n - * priority tasks (BG or IRQ) for thread safety. + * The addToCommBuffer function adds data of specified length to a specified + * communication buffer. S/W fault if buffer too full to add data. This function + * will always add to the active double buffer. This function should only be called + * from the background, general, or priority tasks (BG or IRQ) for thread safety. * @details * Inputs : commBufferByteCount[], activeDoubleBuffer[] * Outputs : commBuffers[], commBufferByteCount[] @@ -188,23 +191,21 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The getFromCommBuffer function fills a given byte array with a given \n - * number of bytes from a given buffer and returns the number of bytes \n - * retrieved from the buffer. This function will draw from the inactive \n - * double buffer first and, if needed, switch double buffers to draw the \n - * rest of the requested data. - * Only one function in one thread should be calling this function for a given \n - * buffer. + * The getFromCommBuffer function fills a given byte array with a given number + * of bytes from a given buffer and returns the number of bytes retrieved from + * the buffer. This function will draw from the inactive double buffer first and, + * if needed, switch double buffers to draw the rest of the requested data. Only + * one function in one thread should be calling this function for a given buffer. * @details * Inputs : commBuffers[], commBufferByteCount[], activeDoubleBuffer[] - * Outputs : commBuffers[], commBufferByteCount[], activeDoubleBuffer[], \n - * and the given data array is populated with data from the buffer. + * Outputs : commBuffers[], commBufferByteCount[], activeDoubleBuffer[], + * and the given data array is populated with data from the buffer * @param buffer which comm buffer to retrieve data from * @param data pointer to byte array to stuff data into - * @param len # of bytes to retrieve into given data array. + * @param len number of bytes to retrieve into given data array * @return the number of bytes retrieved. *************************************************************************/ U32 getFromCommBuffer( COMM_BUFFER_T buffer, U08* data, U32 len ) @@ -249,21 +250,20 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The peekFromCommBuffer function fills a given byte array with a given \n - * number of bytes from a given buffer. This function does NOT consume \n - * the bytes - it only peeks at them. A call to numberOfBytesInCommBuffer() \n - * should be made before calling this function to determine how many bytes \n - * are currently in the buffer. Do not call this function with a "len" \n - * longer than what is currently in the buffer. + * The peekFromCommBuffer function fills a given byte array with a given number of + * bytes from a given buffer. This function does NOT consume the bytes - it only + * peeks at them. A call to numberOfBytesInCommBuffer() should be made before + * calling this function to determine how many bytes are currently in the buffer. + * Do not call this function with a "len" longer than what is currently in the buffer. * @details * Inputs : commBuffers[], commBufferByteCount[], activeDoubleBuffer[] * Outputs : given array populated with requested # of bytes from the buffer. * @param buffer which comm buffer to retrieve data from * @param data pointer to byte array to stuff data into - * @param len # of bytes to retrieve into given data array. + * @param len number of bytes to retrieve into given data array. * @return the number of bytes retrieved. *************************************************************************/ U32 peekFromCommBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ) @@ -307,12 +307,11 @@ return numOfBytesPeeked; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The numberOfBytesInCommBuffer function determines how many bytes \n - * are currently contained in a given comm buffer. Both double buffers \n - * are considered for this. + * The numberOfBytesInCommBuffer function determines how many bytes are currently + * contained in a given comm buffer. Both double buffers are considered for this. * @details * Inputs : activeDoubleBuffer[], commBufferByteCount[] * Outputs : none @@ -338,13 +337,12 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The switchDoubleBuffer function switches the active and inactive buffers \n - * for the given buffer. \n - * This function should only be called when the current inactive buffer has \n - * been emptied. Any unconsumed data in inactive buffer will be lost. + * The switchDoubleBuffer function switches the active and inactive buffers for the + * given buffer. This function should only be called when the current inactive buffer + * has been emptied. Any unconsumed data in inactive buffer will be lost. * @details * Inputs : activeDoubleBuffer[] * Outputs : activeDoubleBuffer[], commBufferByteCount[] @@ -364,18 +362,18 @@ // return the new active buffer (was just inactive) return inactiveBuffer; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The getDataFromInactiveBuffer function retrieves a given number of bytes \n - * from the inactive buffer of a given buffer. This function should only be \n + * The getDataFromInactiveBuffer function retrieves a given number of bytes + * from the inactive buffer of a given buffer. This function should only be * called by getFromCommBuffer(). Params will be pre-validated there. * @details * Inputs : commBuffers[], activeDoubleBuffer[], commBufferByteCount[] * Outputs : commBuffers[], activeDoubleBuffer[], commBufferByteCount[] * @param buffer which comm buffer get data from * @param data pointer to byte array to populate with data - * @param len # of bytes to get from comm buffer + * @param len number of bytes to get from comm buffer * @return none *************************************************************************/ static void getDataFromInactiveBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ) @@ -402,4 +400,5 @@ switchDoubleBuffer( buffer ); // switch will zero count off inactive buffer } } - + +/**@}*/ Index: firmware/App/Services/CommBuffers.h =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -19,29 +19,39 @@ #define __COMM_BUFFERS_H__ #include "DGCommon.h" + +/** + * @defgroup CommBuffers CommBuffers + * @brief Communication buffers service module. Provides communication buffers functionality + * including support functions for adding and clearing communication buffer. + * + * @addtogroup CommBuffers + * @{ + */ -// ********** public definitions ********** - +// ********** public definitions ********** + +/// List of comm buffers. typedef enum Comm_Buffers { - COMM_BUFFER_NOT_USED = 0, // CAN message boxes start at 1 - COMM_BUFFER_IN_CAN_HD_ALARM, - COMM_BUFFER_OUT_CAN_DG_ALARM, - COMM_BUFFER_IN_CAN_UI_ALARM, - COMM_BUFFER_IN_CAN_HD_2_DG, - COMM_BUFFER_OUT_CAN_DG_2_HD, - COMM_BUFFER_IN_CAN_HD_BROADCAST, - COMM_BUFFER_OUT_CAN_DG_BROADCAST, - COMM_BUFFER_IN_CAN_UI_BROADCAST, - COMM_BUFFER_IN_CAN_PC, - COMM_BUFFER_OUT_CAN_PC, - COMM_BUFFER_OUT_CAN_DG_2_UI, - COMM_BUFFER_LAST_CAN_BUFFER = COMM_BUFFER_OUT_CAN_DG_2_UI, + COMM_BUFFER_NOT_USED = 0, ///< Unused buffer - CAN message boxes start at 1 + COMM_BUFFER_IN_CAN_HD_ALARM, ///< Receiving buffer for HD alarm via CAN + COMM_BUFFER_OUT_CAN_DG_ALARM, ///< Transmitting buffer for DG alarm via CAN + COMM_BUFFER_IN_CAN_UI_ALARM, ///< Receiving buffer for UI alarm via CAN + COMM_BUFFER_IN_CAN_HD_2_DG, ///< Receiving buffer for HD to DG communication via CAN + COMM_BUFFER_OUT_CAN_DG_2_HD, ///< Transmitting buffer for DG to HD communication via CAN + COMM_BUFFER_IN_CAN_HD_BROADCAST, ///< Receiving buffer for HD broadcast communication via CAN + COMM_BUFFER_OUT_CAN_DG_BROADCAST, ///< Transmitting buffer for DG broadcast communication via CAN + COMM_BUFFER_IN_CAN_UI_BROADCAST, ///< Receiving buffer for UI broadcast communication via CAN + COMM_BUFFER_IN_CAN_PC, ///< Receiving buffer for PC communication via CAN + COMM_BUFFER_OUT_CAN_PC, ///< Transmitting buffer for PC communication via CAN + COMM_BUFFER_OUT_CAN_DG_2_UI, ///< Transmitting buffer for DG to UI communication via CAN + COMM_BUFFER_LAST_CAN_BUFFER = COMM_BUFFER_OUT_CAN_DG_2_UI, ///< Last CAN communication buffer #ifdef DEBUG_ENABLED - COMM_BUFFER_IN_UART_PC, - COMM_BUFFER_OUT_UART_PC, + COMM_BUFFER_IN_UART_PC, ///< Receiving buffer for PC communication via UART + COMM_BUFFER_OUT_UART_PC, ///< Transmitting buffer for PC communication via UART #endif - NUM_OF_COMM_BUFFERS + NUM_OF_COMM_BUFFERS ///< The number of communication buffers } COMM_BUFFER_T; // ********** public function prototypes ********** @@ -52,5 +62,7 @@ U32 getFromCommBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ); U32 peekFromCommBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ); U32 numberOfBytesInCommBuffer( COMM_BUFFER_T buffer ); + +/**@}*/ #endif Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r66c624837b7b915415810e67249048ce5a46c163 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 66c624837b7b915415810e67249048ce5a46c163) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -24,132 +24,137 @@ #include "Comm.h" #include "SystemCommMessages.h" #include "Utilities.h" + +/** + * @addtogroup FPGA + * @{ + */ // ********** private definitions ********** - + +///< List of FPGA states. typedef enum FPGA_States { - FPGA_STATE_START = 0, - FPGA_STATE_READ_HEADER, - FPGA_STATE_RCV_HEADER, - FPGA_STATE_WRITE_ALL_ACTUATORS, - FPGA_STATE_RCV_ALL_SENSORS, - FPGA_STATE_FAILED, - NUM_OF_FPGA_STATES + FPGA_STATE_START = 0, ///< FPGA start state + FPGA_STATE_READ_HEADER, ///< FPGA read header state + FPGA_STATE_RCV_HEADER, ///< FPGA receive header state + FPGA_STATE_WRITE_ALL_ACTUATORS, ///< FPGA write all actuators state + FPGA_STATE_RCV_ALL_SENSORS, ///< FPGA receive all sensors state + FPGA_STATE_FAILED, ///< FPGA failed state + NUM_OF_FPGA_STATES ///< Number of FPGA states } FPGA_STATE_T; -#define FPGA_PAGE_SIZE 256 -#define FPGA_EXPECTED_ID 0x60 +#define FPGA_PAGE_SIZE 256 ///< FPGA page size. +#define FPGA_EXPECTED_ID 0x60 ///< FPGA expected ID. -#define FPGA_HEADER_START_ADDR 0x0000 -#define FPGA_BULK_READ_START_ADDR 0x0100 +#define FPGA_HEADER_START_ADDR 0x0000 ///< FPGA header start address. +#define FPGA_BULK_READ_START_ADDR 0x0100 ///< FPGA bulk read start address. +#define FPGA_BULK_WRITE_START_ADDR 0x000C ///< FPGA bulk write start address. -#define FPGA_BULK_WRITE_START_ADDR 0x000C +#define FPGA_WRITE_CMD_BUFFER_LEN ( FPGA_PAGE_SIZE + 8 ) ///< FPGA write command buffer length. +#define FPGA_READ_CMD_BUFFER_LEN 8 ///< FPGA read command buffer length. +#define FPGA_WRITE_RSP_BUFFER_LEN 8 ///< FPGA write response buffer length. +#define FPGA_READ_RSP_BUFFER_LEN ( FPGA_PAGE_SIZE + 8 ) ///< FPGA read response buffer length. -#define FPGA_WRITE_CMD_BUFFER_LEN (FPGA_PAGE_SIZE+8) -#define FPGA_READ_CMD_BUFFER_LEN 8 -#define FPGA_WRITE_RSP_BUFFER_LEN 8 -#define FPGA_READ_RSP_BUFFER_LEN (FPGA_PAGE_SIZE+8) +#define FPGA_WRITE_CMD_CODE 0x55 ///< FPGA write command code. +#define FPGA_READ_CMD_CODE 0x5A ///< FPGA read command code. +#define FPGA_WRITE_CMD_ACK 0xA5 ///< FPGA write command ack. +#define FPGA_READ_CMD_ACK 0xAA ///< FPGA read command ack. +#define FPGA_CMD_NAK 0xEE ///< FPGA command nack. -#define FPGA_WRITE_CMD_CODE 0x55 -#define FPGA_READ_CMD_CODE 0x5A -#define FPGA_WRITE_CMD_ACK 0xA5 -#define FPGA_READ_CMD_ACK 0xAA -#define FPGA_CMD_NAK 0xEE +#define FPGA_CRC_LEN 2 ///< FPGA crc length. +#define FPGA_WRITE_CMD_HDR_LEN 4 ///< FPGA write command header length. +#define FPGA_READ_CMD_HDR_LEN 4 ///< FPGA read command header length. +#define FPGA_WRITE_RSP_HDR_LEN 3 ///< FPGA write response header length. +#define FPGA_READ_RSP_HDR_LEN 3 ///< FPGA read response header length. -#define FPGA_CRC_LEN 2 -#define FPGA_WRITE_CMD_HDR_LEN 4 -#define FPGA_READ_CMD_HDR_LEN 4 -#define FPGA_WRITE_RSP_HDR_LEN 3 -#define FPGA_READ_RSP_HDR_LEN 3 +#define SCI2_RECEIVE_DMA_REQUEST 28 ///< SCI2 receive DMA request +#define SCI2_TRANSMIT_DMA_REQUEST 29 ///< SCI2 transmit DMA request -#define SCI2_RECEIVE_DMA_REQUEST 28 -#define SCI2_TRANSMIT_DMA_REQUEST 29 +#define MAX_COMM_ERROR_RETRIES 5 ///< Maximum number of communication error retries -#define MAX_COMM_ERROR_RETRIES 5 +#define DRAIN_PUMP_DAC_SHIFT_BITS 4 ///< Drain pump DAC shift bits. -#define MASK_OFF_U32_MSB 0x00FFFFFF -#define DRAIN_PUMP_DAC_SHIFT_BITS 4 - -// FPGA Sensors Record +// FPGA header struct. #pragma pack(push,1) typedef struct { - U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation. - U08 fpgaRev; ///< Reg 1. FPGA revision being reported. - U08 fpgaRevLab; ///< Reg 2. FPGA lab rev number. - U08 fpgaRevMajor; ///< Reg 3. FPGA minor rev number. + U08 fpgaId; ///< Reg 0. FPGA ID code. Checked against expected value at power up to verify basic FPGA communication and operation + U08 fpgaRev; ///< Reg 1. FPGA revision being reported + U08 fpgaRevLab; ///< Reg 2. FPGA lab rev number + U08 fpgaRevMajor; ///< Reg 3. FPGA minor rev number } FPGA_HEADER_T; // read only on FPGA - + +///< FPGA sensors' readings struct. typedef struct // TODO - add all sensor readings to this structure per FPGA register map { - U32 fpgaLCA1; ///< Reg 256. ADC1 channel 0 - load cell A1. - U32 fpgaLCB1; ///< Reg 260. ADC1 channel 1 - load cell B1. - U32 fpgaADC1Temp; ///< Reg 264. ADC1 channel 2 - internal temperature. + U32 fpgaLCA1; ///< Reg 256. ADC1 channel 0 - load cell A1 + U32 fpgaLCB1; ///< Reg 260. ADC1 channel 1 - load cell B1 + U32 fpgaADC1Temp; ///< Reg 264. ADC1 channel 2 - internal temperature - U32 fpgaLCA2; ///< Reg 268. ADC2 channel 0 - load cell A2. - U32 fpgaLCB2; ///< Reg 272. ADC2 channel 1 - load cell B2. - U32 fpgaADC2Temp; ///< Reg 276. ADC2 channel 2 - internal temperature. + U32 fpgaLCA2; ///< Reg 268. ADC2 channel 0 - load cell A2 + U32 fpgaLCB2; ///< Reg 272. ADC2 channel 1 - load cell B2 + U32 fpgaADC2Temp; ///< Reg 276. ADC2 channel 2 - internal temperature - U32 fpgaCD1Temp; ///< Reg 280. ADC RTD channel 0 - conductivity sensor 1 temperature. - U32 fpgaCD2Temp; ///< Reg 284. ADC RTD channel 1 - conductivity sensor 2 temperature. + U32 fpgaCD1Temp; ///< Reg 280. ADC RTD channel 0 - conductivity sensor 1 temperature + U32 fpgaCD2Temp; ///< Reg 284. ADC RTD channel 1 - conductivity sensor 2 temperature - U32 fpgaTPoTemp; ///< Reg 288. ADC RTD channel 2 - conductivity sensor CPo temperature. - U32 fpgaTPiTemp; ///< Reg 292. ADC RTD channel 3 - conductivity sensor CPi temperature. - U32 fpgaRTDTemp; ///< Reg 296. ADC RTD channel 4 - internal temperature. + U32 fpgaTPoTemp; ///< Reg 288. ADC RTD channel 2 - conductivity sensor CPo temperature + U32 fpgaTPiTemp; ///< Reg 292. ADC RTD channel 3 - conductivity sensor CPi temperature + U32 fpgaRTDTemp; ///< Reg 296. ADC RTD channel 4 - internal temperature - U32 fpgaTHDo; ///< Reg 300. ADC THDo channel 0 - temperature. - U32 fpgaTHDoTemp; ///< Reg 304. ADC THDo channel 1 - internal temperature. + U32 fpgaTHDo; ///< Reg 300. ADC THDo channel 0 - temperature + U32 fpgaTHDoTemp; ///< Reg 304. ADC THDo channel 1 - internal temperature - U32 fpgaTDi; ///< Reg 308. ADC TDi channel 0 - temperature. - U32 fpgaTDiTemp; ///< Reg 312. ADC TDi channel 1 - internal temperature. + U32 fpgaTDi; ///< Reg 308. ADC TDi channel 0 - temperature + U32 fpgaTDiTemp; ///< Reg 312. ADC TDi channel 1 - internal temperature - U32 fpgaCPo; ///< Reg 316. Conductivity CPo. - U32 fpgaCPi; ///< Reg 320. Conductivity CPi. + U32 fpgaCPo; ///< Reg 316. CPo conductivity sensor value + U32 fpgaCPi; ///< Reg 320. CPi conductivity sensor value - U16 fpgaPrimaryHeaterIntTemp; ///< Reg 324. Primary heater temperature. - U16 fpgaPrimaryHeaterIntJunctionTemp; ///< Reg 326. Primary heater internal temperature. - U16 fpgaTrimmerHeaterIntTemp; ///< Reg 328. Trimmer heater temperature. - U16 fpgaTrimmerHeaterIntJunctionTemp; ///< Reg 330. Trimmer heater internal temperature. + U16 fpgaPrimaryHeaterIntTemp; ///< Reg 324. Primary heater temperature + U16 fpgaPrimaryHeaterIntJunctionTemp; ///< Reg 326. Primary heater internal temperature + U16 fpgaTrimmerHeaterIntTemp; ///< Reg 328. Trimmer heater temperature + U16 fpgaTrimmerHeaterIntJunctionTemp; ///< Reg 330. Trimmer heater internal temperature - U16 fpgaDrainPumpSpeed; ///< Reg 332. Drain pump speed feedback. - U16 fpgaROFlowRate; ///< Reg 334. RO flow. + U16 fpgaDrainPumpSpeed; ///< Reg 332. Drain pump speed feedback + U16 fpgaROFlowRate; ///< Reg 334. RO flow - U16 accelX; ///< Reg 336. Accelerometer X axis data. - U16 accelY; ///< Reg 338. Accelerometer Y axis data. - U16 accelZ; ///< Reg 340. Accelerometer Z axis data. - U16 accelXMax; ///< Reg 342. Accelerometer X axis max data (since last read). - U16 accelYMax; ///< Reg 344. Accelerometer Y axis max data (since last read). - U16 accelZMax; ///< Reg 346. Accelerometer Z axis max data (since last read). - U16 accelFaultRegister; ///< Reg 348. Accelerometer fault register. - U16 accelSampleCounter; ///< Reg 350. Accelerometer sample count. + U16 accelX; ///< Reg 336. Accelerometer X axis data + U16 accelY; ///< Reg 338. Accelerometer Y axis data + U16 accelZ; ///< Reg 340. Accelerometer Z axis data + U16 accelXMax; ///< Reg 342. Accelerometer X axis max data (since last read) + U16 accelYMax; ///< Reg 344. Accelerometer Y axis max data (since last read) + U16 accelZMax; ///< Reg 346. Accelerometer Z axis max data (since last read) + U16 accelFaultRegister; ///< Reg 348. Accelerometer fault register + U16 accelSampleCounter; ///< Reg 350. Accelerometer sample count - U08 fpgaIOErrorCntProcessor; ///< Reg 352. - U08 fpgaIOErrorCntPC; ///< Reg 353. + U08 fpgaIOErrorCntProcessor; ///< Reg 352. Error count for processor communications + U08 fpgaIOErrorCntPC; ///< Reg 353. Error count for PC communications U08 fpgaADC1ReadCnt; ///< Reg 354. U08 fpgaADC1ErrorCnt; ///< Reg 355. U08 fpgaADC2ReadCnt; ///< Reg 356. U08 fpgaADC2ErrorCnt; ///< Reg 357. - U08 fpgaRTDReadCnt; ///< Reg 358. - U08 fpgaRTDErrorCnt; ///< Reg 359. - U08 fpgaTHDoReadCnt; ///< Reg 360. - U08 fpgaTHDoErrorCnt; ///< Reg 361. - U08 fpgaTDiReadCnt; ///< Reg 362. - U08 fpgaTDiErrorCnt; ///< Reg 363. - U08 fpgaPrimaryHeaterFlags; ///< Reg 364. - U08 fpgaPrimaryHeaterReadCnt; ///< Reg 365. - U08 fpgaTrimmerHeaterFlags; ///< Reg 366. - U08 fpgaTrimmerHeaterReadCnt; ///< Reg 367. - U08 fpgaCPoFault; ///< Reg 368. - U08 fpgaCPoReadCnt; ///< Reg 369. - U08 fpgaCPoErrorCnt; ///< Reg 370. - U08 fpgaCPiFault; ///< Reg 371. - U08 fpgaCPiReadCnt; ///< Reg 372. - U08 fpgaCPiErrorCnt; ///< Reg 373. - U08 fpgaCP1CP2Fault; ///< Reg 374. - U08 fpgaReserved1; ///< Reg 375. + U08 fpgaRTDReadCnt; ///< Reg 358. Temperature sensors read count + U08 fpgaRTDErrorCnt; ///< Reg 359. Temperature sensors error count + U08 fpgaTHDoReadCnt; ///< Reg 360. Redundant outlet temperature sensor read count + U08 fpgaTHDoErrorCnt; ///< Reg 361. Redundant outlet temperature sensor error count + U08 fpgaTDiReadCnt; ///< Reg 362. Dialysate inlet temperature sensor read count + U08 fpgaTDiErrorCnt; ///< Reg 363. Dialysate inlet temperature sensor error count + U08 fpgaPrimaryHeaterFlags; ///< Reg 364. Primary heater flags + U08 fpgaPrimaryHeaterReadCnt; ///< Reg 365. Primary heater read count + U08 fpgaTrimmerHeaterFlags; ///< Reg 366. Trimmer heater flags + U08 fpgaTrimmerHeaterReadCnt; ///< Reg 367. Trimmer heater read count + U08 fpgaCPoFault; ///< Reg 368. CPo conductivity sensor fault + U08 fpgaCPoReadCnt; ///< Reg 369. CPo conductivity sensor read count + U08 fpgaCPoErrorCnt; ///< Reg 370. CPo conductivity sensor error count + U08 fpgaCPiFault; ///< Reg 371. CPi conductivity sensor fault + U08 fpgaCPiReadCnt; ///< Reg 372. CPi conductivity sensor read count + U08 fpgaCPiErrorCnt; ///< Reg 373. CPi conductivity sensor error count + U08 fpgaCP1CP2Fault; ///< Reg 374. Concentrate pump fault register for CP1 and CP2 + U08 fpgaReserved1; ///< Reg 375. Reserved - U16 fpgaValveStates; ///< Reg 376. + U16 fpgaValveStates; ///< Reg 376. Valves states } DG_FPGA_SENSORS_T; typedef struct @@ -166,33 +171,33 @@ // ********** private data ********** // FPGA state -static FPGA_STATE_T fpgaState = FPGA_STATE_START; +static FPGA_STATE_T fpgaState = FPGA_STATE_START; ///< FPGA current state. -static U32 fpgaCommRetryCount = 0; -static U32 fpgaReceiptCounter = 0; -static U32 fpgaTransmitCounter = 0; -static BOOL fpgaWriteCommandInProgress = FALSE; -static BOOL fpgaReadCommandInProgress = FALSE; -static BOOL fpgaBulkWriteAndReadInProgress = FALSE; -static BOOL fpgaWriteCommandResponseReceived = FALSE; -static BOOL fpgaReadCommandResponseReceived = FALSE; +static U32 fpgaCommRetryCount = 0; ///< FPGA communication retry count. +static U32 fpgaReceiptCounter = 0; ///< FPGA receipt completed counter. +static U32 fpgaTransmitCounter = 0; ///< FPGA transmit completed counter. +static BOOL fpgaWriteCommandInProgress = FALSE; ///< Flag indicates whether a FPGA write command is in progress. +static BOOL fpgaReadCommandInProgress = FALSE; ///< Flag indicates whether a FPGA read command is in progress. +static BOOL fpgaBulkWriteAndReadInProgress = FALSE; ///< Flag indicates whether a FPGA bulk write and read is in progress. +static BOOL fpgaWriteCommandResponseReceived = FALSE; ///< Flag indicates whether a FPGA write command response has been received. +static BOOL fpgaReadCommandResponseReceived = FALSE; ///< Flag indicates whether a FPGA read command response has been received. // FPGA comm buffers -static U08 fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_BUFFER_LEN ]; -static U08 fpgaReadCmdBuffer[ FPGA_READ_CMD_BUFFER_LEN ]; -static U08 fpgaWriteResponseBuffer[ FPGA_WRITE_RSP_BUFFER_LEN ]; -static U08 fpgaReadResponseBuffer[ FPGA_READ_RSP_BUFFER_LEN ]; +static U08 fpgaWriteCmdBuffer[ FPGA_WRITE_CMD_BUFFER_LEN ]; ///< FPGA write command buffer. +static U08 fpgaReadCmdBuffer[ FPGA_READ_CMD_BUFFER_LEN ]; ///< FPGA read command buffer. +static U08 fpgaWriteResponseBuffer[ FPGA_WRITE_RSP_BUFFER_LEN ]; ///< FPGA write response buffer. +static U08 fpgaReadResponseBuffer[ FPGA_READ_RSP_BUFFER_LEN ]; ///< FPGA read response buffer. // DMA control records -static g_dmaCTRL fpgaDMAWriteControlRecord; -static g_dmaCTRL fpgaDMAWriteRespControlRecord; -static g_dmaCTRL fpgaDMAReadControlRecord; -static g_dmaCTRL fpgaDMAReadRespControlRecord; +static g_dmaCTRL fpgaDMAWriteControlRecord; ///< FPGA DMA write control record. +static g_dmaCTRL fpgaDMAWriteRespControlRecord; ///< FPGA DMA write response control record. +static g_dmaCTRL fpgaDMAReadControlRecord; ///< FPGA DMA read control record. +static g_dmaCTRL fpgaDMAReadRespControlRecord; ///< FPGA DMA read response control record. // FPGA data -static FPGA_HEADER_T fpgaHeader; -static DG_FPGA_SENSORS_T fpgaSensorReadings; -static FPGA_ACTUATORS_T fpgaActuatorSetPoints; +static FPGA_HEADER_T fpgaHeader; ///< FPGA header structure. +static DG_FPGA_SENSORS_T fpgaSensorReadings; ///< DG FPGA sensors structure. +static FPGA_ACTUATORS_T fpgaActuatorSetPoints; ///< FPGA actuator set points structure. // ********** private function prototypes ********** @@ -330,8 +335,7 @@ /*********************************************************************//** * @brief - * The resetFPGACommFlags function resets the various fpga comm flags and \n - * counters. + * The resetFPGACommFlags function resets the various fpga comm flags and counters. * @details * Inputs : none * Outputs : fpga comm flags & counters reset @@ -350,7 +354,7 @@ /*********************************************************************//** * @brief - * The signalFPGAReceiptCompleted function increments a counter to indicate \n + * The signalFPGAReceiptCompleted function increments a counter to indicate * that another DMA receipt from the FPGA has completed. * @details * Inputs : none @@ -385,7 +389,7 @@ /*********************************************************************//** * @brief - * The signalFPGATransmitCompleted function increments a counter to indicate \n + * The signalFPGATransmitCompleted function increments a counter to indicate * that another DMA transmit to the FPGA has completed. * @details * Inputs : none @@ -492,7 +496,7 @@ /*********************************************************************//** * @brief - * The handleFPGAReadHeaderState function handles the FPGA state where \n + * The handleFPGAReadHeaderState function handles the FPGA state where * the read header registers command is sent to the FPGA. * @details * Inputs : none @@ -524,7 +528,7 @@ /*********************************************************************//** * @brief - * The handleFPGAReceiveHeaderState function handles the FPGA state \n + * The handleFPGAReceiveHeaderState function handles the FPGA state * where the header registers read response should be ready to take in. * @details * Inputs : none @@ -576,7 +580,7 @@ /*********************************************************************//** * @brief - * The handleFPGAWriteAllActuatorsState function handles the FPGA state \n + * The handleFPGAWriteAllActuatorsState function handles the FPGA state * where the bulk write command is sent to the FPGA. * @details * Inputs : actuator set points @@ -627,7 +631,7 @@ /*********************************************************************//** * @brief - * The handleFPGAReceiveAllSensorsState function handles the FPGA state \n + * The handleFPGAReceiveAllSensorsState function handles the FPGA state * where the bulk read response should be ready to parse. * @details * Inputs : none @@ -685,7 +689,7 @@ /*********************************************************************//** * @brief - * The execFPGATest function executes the FPGA self-test. \n + * The execFPGATest function executes the FPGA self-test. * @details * Inputs : fpgaHeader * Outputs : none @@ -715,7 +719,7 @@ /*********************************************************************//** * @brief - * The setupDMAForWriteCmd function sets the byte count for the next DMA \n + * The setupDMAForWriteCmd function sets the byte count for the next DMA * write command to the FPGA. * @details * Inputs : none @@ -738,7 +742,7 @@ /*********************************************************************//** * @brief - * The startDMAWriteCmd function initiates the DMA transmit for the next \n + * The startDMAWriteCmd function initiates the DMA transmit for the next * DMA write command to the FPGA. * @details * Inputs : none @@ -754,11 +758,11 @@ /*********************************************************************//** * @brief - * The setupDMAForWriteResp function sets the expected byte count for the \n + * The setupDMAForWriteResp function sets the expected byte count for the * next DMA write command response from the FPGA. * @details * Inputs : none - * Outputs : # of expected bytes for next FPGA write command response is set + * Outputs : number of expected bytes for next FPGA write command response is set * @param bytes2Receive number of bytes expected to be transmitted via DMA from the FPGA. * @return none *************************************************************************/ @@ -777,7 +781,7 @@ /*********************************************************************//** * @brief - * The startDMAReceiptOfWriteResp function initiates readiness of the DMA \n + * The startDMAReceiptOfWriteResp function initiates readiness of the DMA * receiver for the next DMA write command response from the FPGA. * @details * Inputs : none @@ -793,11 +797,11 @@ /*********************************************************************//** * @brief - * The setupDMAForReadCmd function sets the byte count for the next DMA \n + * The setupDMAForReadCmd function sets the byte count for the next DMA * read command to the FPGA. * @details * Inputs : none - * Outputs : # of bytes for next FPGA read command is set + * Outputs : number of bytes for next FPGA read command is set * @param bytes2Transmit number of bytes to be transmitted via DMA to the FPGA. * @return none *************************************************************************/ @@ -816,7 +820,7 @@ /*********************************************************************//** * @brief - * The startDMAReadCmd function initiates the DMA transmit for the next \n + * The startDMAReadCmd function initiates the DMA transmit for the next * DMA read command to the FPGA. * @details * Inputs : none @@ -832,11 +836,11 @@ /*********************************************************************//** * @brief - * The setupDMAForReadResp function sets the expected byte count for the \n + * The setupDMAForReadResp function sets the expected byte count for the * next DMA read command response from the FPGA. * @details * Inputs : none - * Outputs : # of expected bytes for next FPGA read command response is set + * Outputs : number of expected bytes for next FPGA read command response is set * @param bytes2Receive number of expected bytes to be transmitted via DMA from the FPGA. * @return none *************************************************************************/ @@ -855,7 +859,7 @@ /*********************************************************************//** * @brief - * The startDMAReceiptOfReadResp function initiates readiness of the DMA \n + * The startDMAReceiptOfReadResp function initiates readiness of the DMA * receiver for the next DMA read command response from the FPGA. * @details * Inputs : none @@ -871,7 +875,7 @@ /*********************************************************************//** * @brief - * The consumeUnexpectedData function checks to see if a byte is sitting in \n + * The consumeUnexpectedData function checks to see if a byte is sitting in * the SCI2 received data register. * @details * Inputs : fpgaHeader @@ -891,9 +895,9 @@ /*********************************************************************//** * @brief - * The setFPGAValveStates function sets the DG valve states with a 16-bit \n - * set of states - one bit per valve, with a 1 meaning "energized" and a 0 \n - * meaning "de-energized". The bit positions for these bit states are as follows: \n + * The setFPGAValveStates function sets the DG valve states with a 16-bit + * set of states - one bit per valve, with a 1 meaning "energized" and a 0 + * meaning "de-energized". The bit positions for these bit states are as follows: * 0 - VRf.\n * 1 - VRi.\n * 2 - VRd.\n @@ -920,7 +924,7 @@ /*********************************************************************//** * @brief - * The setFPGADrainPumpSpeed function sets the drain pump target speed. \n + * The setFPGADrainPumpSpeed function sets the drain pump target speed. * The drain pump DAC value should be set to 1 count for each 12.94 RPM desired. * @details * Inputs : none @@ -954,7 +958,7 @@ /*********************************************************************//** * @brief - * The getFPGAId function gets the version read from the Id register \n + * The getFPGAId function gets the version read from the Id register * of the FPGA. * @details * Inputs : fpgaHeader @@ -968,7 +972,7 @@ /*********************************************************************//** * @brief - * The getFPGARev function gets the revision read from the Rev register \n + * The getFPGARev function gets the revision read from the Rev register * of the FPGA. * @details * Inputs : fpgaHeader @@ -1050,7 +1054,7 @@ /*********************************************************************//** * @brief - * The getFPGAValveStates function gets the latest sensed valve states. \n + * The getFPGAValveStates function gets the latest sensed valve states. * See setFPGAValveStates for valve state bit positions. * @details * Inputs : fpgaSensorReadings.fpgaValveStates @@ -1090,8 +1094,7 @@ /*********************************************************************//** * @brief - * The getFPGATPiTemp function gets the latest primary heater inlet \n - * temperature reading. + * The getFPGATPiTemp function gets the latest primary heater inlet temperature reading. * @details * Inputs : fpgaSensorReadings.fpgaTPiTemp * Outputs : none @@ -1104,8 +1107,7 @@ /*********************************************************************//** * @brief - * The getFPGATPoTemp function gets the latest primary heater outlet \n - * temperature reading. + * The getFPGATPoTemp function gets the latest primary heater outlet temperature reading. * @details * Inputs : fpgaSensorReadings.fpgaTPoTemp * Outputs : none @@ -1118,7 +1120,7 @@ /*********************************************************************//** * @brief - * The getFPGATD1Temp function gets the latest conductivity sensor 1 \n + * The getFPGATD1Temp function gets the latest conductivity sensor 1 * temperature reading in ADC. * @details * Inputs : fpgaSensorReadings.fpgaCD1Temp @@ -1132,7 +1134,7 @@ /*********************************************************************//** * @brief - * The getFPGATD2Temp function gets the latest conductivity sensor 2 \n + * The getFPGATD2Temp function gets the latest conductivity sensor 2 * temperature reading in ADC. * @details * Inputs : fpgaSensorReadings.fpgaCD2Temp @@ -1146,12 +1148,12 @@ /*********************************************************************//** * @brief - * The getFPGARTDErrorCount function gets error count of the RTD. It covers \n - * all the four conductivity sensors which include temperature sensors + * The getFPGARTDErrorCount function gets error count of the RTD. It covers + * all the four temperature sensors associates with conductivity sensors. * @details * Inputs : fpgaSensorReadings.fpgaRTDErrorCnt * Outputs : none - * @return Last error count of the RTD conductivity sensors + * @return Last error count of the RTD temperature sensors *************************************************************************/ U08 getFPGARTDErrorCount( void ) { @@ -1160,12 +1162,13 @@ /*********************************************************************//** * @brief - * The getFPGARTDReadCount function gets the read count of the RTD \n - * conductivity sensors. It covers all the 4 conductivity sensors + * The getFPGARTDReadCount function gets the read count of the RTD + * temperature sensors. It covers all the four temperature sensors associates + * with conductivity sensors. * @details * Inputs : fpgaSensorReadings.fpgaRTDReadCnt * Outputs : none - * @return Last read count of the RTC conductivity sensors + * @return Last read count of the RTC temperature sensors *************************************************************************/ U08 getFPGARTDReadCount( void ) { @@ -1174,7 +1177,7 @@ /*********************************************************************//** * @brief - * The getFPGATRoTemp function gets the latest redundant sensor outlet \n + * The getFPGATRoTemp function gets the latest redundant sensor outlet * temperature reading in ADC. * @details * Inputs : fpgaSensorReadings.fpgaTHDoTemp @@ -1188,8 +1191,7 @@ /*********************************************************************//** * @brief - * The getFPGATHDoErrorCount gets the error count of the THDo (redundant) \n - * temperature sensor + * The getFPGATHDoErrorCount gets the error count of the THDo (redundant) temperature sensor. * @details * Inputs : fpgaSensorReadings.fpgaTHDoErrorCnt * Outputs : none @@ -1202,7 +1204,7 @@ /*********************************************************************//** * @brief - * The getFPGATHDoReadCount gets the read count of the THDo (redundant) \n + * The getFPGATHDoReadCount gets the read count of the THDo (redundant) temperature sensor. * @details * Inputs : fpgaSensorReadings.fpgaTHDoReadCnt * Outputs : none @@ -1215,8 +1217,7 @@ /*********************************************************************//** * @brief - * The getFPGATDiTemp function gets the latest dialysate inlet \n - * temperature reading in ADC. + * The getFPGATDiTemp function gets the latest dialysate inlet temperature reading in ADC. * @details * Inputs : fpgaSensorReadings.fpgaTDiTemp * Outputs : none @@ -1229,8 +1230,7 @@ /*********************************************************************//** * @brief - * The getFPGATDiErrorCount function gets the latest dialysate inlet \n - * temperature error count. + * The getFPGATDiErrorCount function gets the latest dialysate inlet temperature error count. * @details * Inputs : fpgaSensorReadings.fpgaTDiErrorCnt * Outputs : none @@ -1243,8 +1243,7 @@ /*********************************************************************//** * @brief - * The getFPGATDiReadCount function gets the latest dialysate inlet \n - * temperature read count. + * The getFPGATDiReadCount function gets the latest dialysate inlet temperature read count. * @details * Inputs : fpgaSensorReadings.fpgaTDiReadCnt * Outputs : none @@ -1257,7 +1256,7 @@ /*********************************************************************//** * @brief - * The getFPGAPrimaryHeaterTemp function gets the latest primary heater \n + * The getFPGAPrimaryHeaterTemp function gets the latest primary heater * internal temperature reading. * @details * Inputs : fpgaSensorReadings.fpgaPrimaryHeaterIntTemp @@ -1271,8 +1270,8 @@ /*********************************************************************//** * @brief - * The getFPGAPrimaryHeaterFlags function gets the latest primary heater \n - * internal temperature sensor flags read + * The getFPGAPrimaryHeaterFlags function gets the latest primary heater + * internal temperature sensor flags read. * @details * Inputs : fpgaSensorReadings.fpgaPrimaryHeaterFlags * Outputs : none @@ -1285,8 +1284,8 @@ /*********************************************************************//** * @brief - * The geetFPGAPrimaryHeaterReadCount function gets the latest primary heater \n - * internal temperature sensor read count + * The geetFPGAPrimaryHeaterReadCount function gets the latest primary heater + * internal temperature sensor read count. * @details * Inputs : fpgaSensorReadings.fpgaPrimaryHeaterReadCnt * Outputs : none @@ -1299,7 +1298,7 @@ /*********************************************************************//** * @brief - * The getFPGATrimmerHeaterTemp function gets the latest trimmer heater \n + * The getFPGATrimmerHeaterTemp function gets the latest trimmer heater * internal temperature sensor reading. * @details * Inputs : fpgaSensorReadings.fpgaTrimmerHeaterIntTemp @@ -1313,7 +1312,7 @@ /*********************************************************************//** * @brief - * The getFPGATrimmerHeaterFlags function gets the latest trimmer heater \n + * The getFPGATrimmerHeaterFlags function gets the latest trimmer heater * internal temperature flags read. * @details * Inputs : fpgaSensorReadings.fpgaTrimmerHeaterFlags @@ -1327,7 +1326,7 @@ /*********************************************************************//** * @brief - * The getFPGATrimmerHeaterReadCount function gets the latest trimmer heater \n + * The getFPGATrimmerHeaterReadCount function gets the latest trimmer heater * internal temperature read count. * @details * Inputs : fpgaSensorReadings.fpgaTrimmerHeaterReadCnt @@ -1341,8 +1340,7 @@ /*********************************************************************//** * @brief - * The getFPGAPrimaryColdJunctionTemp function gets primary cold junction - * temperature + * The getFPGAPrimaryColdJunctionTemp function gets primary cold junction temperature. * @details * Inputs : fpgaSensorReadings.fpgaPrimaryHeaterIntJunctionTemp * Outputs : none @@ -1355,8 +1353,7 @@ /*********************************************************************//** * @brief - * The getFPGATrimmerColdJunctionTemp function gets trimmer cold junction - * temperature + * The getFPGATrimmerColdJunctionTemp function gets trimmer cold junction temperature. * @details * Inputs : fpgaSensorReadings.fpgaTrimmerHeaterIntJunctionTemp * Outputs : none @@ -1369,7 +1366,7 @@ /*********************************************************************//** * @brief - * The getFPGAAccelAxes function gets the accelerometer axis readings. \n + * The getFPGAAccelAxes function gets the accelerometer axis readings. * Axis readings are in ADC counts. 0.004 g per LSB. * @details * Inputs : fpgaSensorReadings @@ -1388,9 +1385,8 @@ /*********************************************************************//** * @brief - * The getFPGAAccelMaxes function gets the maximum accelerometer axis readings. \n - * from last FPGA read (every 10ms). \n - * Axis readings are in ADC counts. 0.004 g per LSB. + * The getFPGAAccelMaxes function gets the maximum accelerometer axis readings from + * last FPGA read (every 10ms). Axis readings are in ADC counts. 0.004 g per LSB. * @details * Inputs : fpgaSensorReadings * Outputs : none @@ -1408,7 +1404,7 @@ /*********************************************************************//** * @brief - * The getFPGAAccelStatus function gets the accelerometer reading count \n + * The getFPGAAccelStatus function gets the accelerometer reading count * and error register values. * @details * Inputs : fpgaSensorReadings @@ -1423,9 +1419,9 @@ *err = fpgaSensorReadings.accelFaultRegister; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPiFault function gets CPi conductivity sensor fault + * The getFPGACPiFault function gets CPi conductivity sensor fault. * @details * Inputs : fpgaSensorReadings.fpgaCPiFault * Outputs : none @@ -1437,9 +1433,9 @@ return fpgaSensorReadings.fpgaCPiFault; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPiReadCount function gets CPi conductivity sensor read count + * The getFPGACPiReadCount function gets CPi conductivity sensor read count. * @details * Inputs : fpgaSensorReadings.fpgaCPiReadCnt * Outputs : none @@ -1451,9 +1447,9 @@ return fpgaSensorReadings.fpgaCPiReadCnt; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPiErrorCount function gets CPi conductivity sensor error count + * The getFPGACPiErrorCount function gets CPi conductivity sensor error count. * @details * Inputs : fpgaSensorReadings.fpgaCPiErrorCnt * Outputs : none @@ -1465,9 +1461,9 @@ return fpgaSensorReadings.fpgaCPiErrorCnt; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPi function gets CPi conductivity sensor value + * The getFPGACPi function gets CPi conductivity sensor value. * @details * Inputs : fpgaSensorReadings.fpgaCPi * Outputs : none @@ -1479,9 +1475,9 @@ return fpgaSensorReadings.fpgaCPi; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPoFault function gets CPo conductivity sensor fault + * The getFPGACPoFault function gets CPo conductivity sensor fault. * @details * Inputs : fpgaSensorReadings.fpgaCPoFault * Outputs : none @@ -1493,9 +1489,9 @@ return fpgaSensorReadings.fpgaCPoFault; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPoReadCount function gets CPo conductivity sensor read count + * The getFPGACPoReadCount function gets CPo conductivity sensor read count. * @details * Inputs : fpgaSensorReadings.fpgaCPoReadCnt * Outputs : none @@ -1507,9 +1503,9 @@ return fpgaSensorReadings.fpgaCPoReadCnt; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPoErrorCount function gets outlet water conductivity sensor + * The getFPGACPoErrorCount function gets CPo conductivity sensor error count. * error count * @details * Inputs : fpgaSensorReadings.fpgaCPoErrorCnt @@ -1522,9 +1518,9 @@ return fpgaSensorReadings.fpgaCPoErrorCnt; } -/************************************************************************* +/*********************************************************************//** * @brief - * The getFPGACPo function gets outlet water conductivity value + * The getFPGACPo function gets CPo conductivity sensor value. * @details * Inputs : fpgaSensorReadings.fpgaCPo * Outputs : none @@ -1535,3 +1531,5 @@ { return fpgaSensorReadings.fpgaCPo; } + +/**@}*/ Index: firmware/App/Services/FPGA.h =================================================================== diff -u -r66c624837b7b915415810e67249048ce5a46c163 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/FPGA.h (.../FPGA.h) (revision 66c624837b7b915415810e67249048ce5a46c163) +++ firmware/App/Services/FPGA.h (.../FPGA.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -19,7 +19,15 @@ #define __FPGA_H__ #include "DGCommon.h" -#include "Interrupts.h" +#include "Interrupts.h" + +/** + * @defgroup FPGA FPGA + * @brief FPGA service module. Provides functionality to interact with DG FPGA. + * + * @addtogroup FPGA + * @{ + */ // ********** public definitions ********** @@ -92,4 +100,6 @@ void getFPGAAccelMaxes( S16 *xm, S16*ym, S16*zm ); void getFPGAAccelStatus( U16 *cnt, U16 *accelFPGAFaultReg ); +/**@}*/ + #endif Index: firmware/App/Services/Interrupts.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -49,13 +49,13 @@ static U32 sci1FrameErrorCnt = 0; static U32 sci1OverrunErrorCnt = 0; #endif -static U32 sci2FrameErrorCnt = 0; -static U32 sci2OverrunErrorCnt = 0; +static U32 sci2FrameErrorCnt = 0; ///< SCI2 frame error count. +static U32 sci2OverrunErrorCnt = 0; ///< SCI2 overrun error count. -static U32 can1PassiveCnt = 0; -static U32 can1WarningCnt = 0; -static U32 can1BusOffCnt = 0; -static U32 can1ParityCnt = 0; +static U32 can1PassiveCnt = 0; ///< CAN1 passive count. +static U32 can1WarningCnt = 0; ///< CAN1 warning count. +static U32 can1BusOffCnt = 0; ///< CAN1 bus offline count. +static U32 can1ParityCnt = 0; ///< CAN1 parity count. // ********** private function prototypes ********** @@ -64,7 +64,7 @@ * The initInterrupts function initializes the Interrupts module. * @details * Inputs : none - * Outputs : Interrupts module initialized. + * Outputs : Interrupts module initialized * @return none *************************************************************************/ void initInterrupts( void ) @@ -82,10 +82,10 @@ * The phantomInterrupt function handles phantom interrupts. * @details * Inputs : none - * Outputs : phantom interrupt handled. + * Outputs : phantom interrupt handled * @return none *************************************************************************/ -void phantomInterrupt(void) +void phantomInterrupt( void ) { // TODO - what to do with phantom interrupts? #ifdef DEBUG_ENABLED @@ -104,11 +104,11 @@ * The rtiNotification function handles real-time interrupt notifications. * @details * Inputs : none - * Outputs : RTI notification handled. + * Outputs : RTI notification handled * @param notification Which RTI timer caused this interrupt * @return none *************************************************************************/ -void rtiNotification(uint32 notification) +void rtiNotification( uint32 notification ) { switch ( notification ) { @@ -139,7 +139,7 @@ * The canMessageNotification function handles CAN message notifications. * @details * Inputs : none - * Outputs : CAN message notification handled. + * Outputs : CAN message notification handled * @param node which CAN controller * @param messageBox which message box triggered the message notification * @return none @@ -159,10 +159,11 @@ * Inputs : none * Outputs : CAN error notification handled. * @param node which CAN controller - * @param notification canLEVEL_PASSIVE (0x20) : When RX- or TX error counter are between 32 and 63 \n - * canLEVEL_WARNING (0x40) : When RX- or TX error counter are between 64 and 127 \n - * canLEVEL_BUS_OFF (0x80) : When RX- or TX error counter are between 128 and 255 \n - * canLEVEL_PARITY_ERR (0x100): When parity error detected on CAN RAM read access + * @param notification CAN error notification: + * canLEVEL_PASSIVE (0x20) : When RX- or TX error counter are between 32 and 63 \n + * canLEVEL_WARNING (0x40) : When RX- or TX error counter are between 64 and 127 \n + * canLEVEL_BUS_OFF (0x80) : When RX- or TX error counter are between 128 and 255 \n + * canLEVEL_PARITY_ERR (0x100): When parity error detected on CAN RAM read access * @return none *************************************************************************/ void canErrorNotification(canBASE_t *node, uint32 notification) @@ -230,12 +231,12 @@ /*********************************************************************//** * @brief - * The sciNotification function handles UART communication error interrupts. \n + * The sciNotification function handles UART communication error interrupts. * Frame and Over-run errors are handled. * @details * Inputs : none * Outputs : UART error interrupts handled. - * @param sci Pointer to the SCI peripheral that detected the error + * @param sci pointer to the SCI peripheral that detected the error * @param flags error flag(s) * @return none *************************************************************************/ Index: firmware/App/Services/MessagePayloads.h =================================================================== diff -u -r92ec01cb48d91fe7315baa987e1aa051dd12df75 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/MessagePayloads.h (.../MessagePayloads.h) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) +++ firmware/App/Services/MessagePayloads.h (.../MessagePayloads.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -17,109 +17,124 @@ #ifndef __MESSAGE_PAYLOADS_H__ #define __MESSAGE_PAYLOADS_H__ + +/** + * @defgroup MessagePayloads MessagePayloads + * @brief Message payloads service module defines the content for system communication message. + * + * @addtogroup MessagePayloads + * @{ + */ // ********** public definitions ********** #pragma pack(push,1) +/// Alarm status struct. typedef struct { - U32 alarmState; // 0 = no alarms, 1 = low priority, 2 = medium priority, 3 = high priority - U32 alarmTop; // ID of top active alarm - U32 escalatesIn; // seconds - U32 silenceExpiresIn; // seconds - U16 alarmsFlags; // bit flags: 1 = true, 0 = false for each bit + U32 alarmState; ///< Alarm state: 0 = no alarms, 1 = low priority, 2 = medium priority, 3 = high priority + U32 alarmTop; ///< ID of top active alarm + U32 escalatesIn; ///< Seconds before escalating alarm + U32 silenceExpiresIn; ///< Seconds before alarm silence expires + U16 alarmsFlags; ///< Alarm bit flags: 1 = true, 0 = false for each bit } ALARM_COMP_STATUS_PAYLOAD_T; +/// DG version struct. typedef struct { - U08 major; - U08 minor; - U08 micro; - U16 build; - U08 fpgaId; - U08 fpgaMajor; - U08 fpgaMinor; - U08 fpgaLab; + U08 major; ///< DG version major revision + U08 minor; ///< DG version major revision + U08 micro; ///< DG version micro revision + U16 build; ///< DG build version + U08 fpgaId; ///< DG FPGA ID + U08 fpgaMajor; ///< DG FPGA major revision + U08 fpgaMinor; ///< DG FPGA minor revision + U08 fpgaLab; ///< DG FPGA lab revision } DG_VERSIONS_T; +/// Treatment time data struct. typedef struct { - U32 treatmentTimePrescribedinSec; - U32 treatmentTimeElapsedinSec; - U32 treatmentTimeRemaininginSec; + U32 treatmentTimePrescribedinSec; ///< Treatment time in seconds + U32 treatmentTimeElapsedinSec; ///< Treatment time elapsed in seconds + U32 treatmentTimeRemaininginSec; ///< Treatment time remaining in seconds } TREATMENT_TIME_DATA_T; +/// Loadcell measurements struct. typedef struct { - F32 loadCellA1inGram; - F32 loadCellA2inGram; - F32 loadCellB1inGram; - F32 loadCellB2inGram; + F32 loadCellA1inGram; ///< Loadcell A1 measurement in gram + F32 loadCellA2inGram; ///< Loadcell A2 measurement in gram + F32 loadCellB1inGram; ///< Loadcell B1 measurement in gram + F32 loadCellB2inGram; ///< Loadcell B2 measurement in gram } LOAD_CELL_DATA_T; +/// RO pump data struct. typedef struct { - U32 setROPumpPressure; - F32 measROFlowRate; - F32 roPumpPWM; + U32 setROPumpPressure; ///< RO pump pressure set target + F32 measROFlowRate; ///< RO flow rate measurement + F32 roPumpPWM; ///< RO pump pwm } RO_PUMP_DATA_T; +/// Drain pump data struct. typedef struct { - U32 setDrainPumpSpeed; - U32 dacValue; + U32 setDrainPumpSpeed; ///< Drain pump speed set target + U32 dacValue; ///< Drain pump DAC value } DRAIN_PUMP_DATA_T; +/// Pressure data struct. typedef struct { - F32 roPumpInletPressure; - F32 roPumpOutletPressure; - F32 drainPumpInletPressure; - F32 drainPumpOutletPressure; + F32 roPumpInletPressure; ///< RO pump inlet pressure + F32 roPumpOutletPressure; ///< RO pump outlet pressure + F32 drainPumpInletPressure; ///< Drain pump inlet pressure + F32 drainPumpOutletPressure; ///< Drain pump outlet pressure } PRESSURES_DATA_T; +/// Conductivity data struct. typedef struct { - F32 roRejectionRatio; - F32 cpi; - F32 cpo; + F32 roRejectionRatio; ///< RO rejection ratio + F32 cpi; ///< CPi conductivity sensor value + F32 cpo; ///< CPo conductivity sensor value } CONDUCTIVITY_DATA_T; +/// Reservoir data struct. typedef struct { - U32 activeReservoir; - U32 fillToVolumeMl; - U32 drainToVolumeMl; + U32 activeReservoir; ///< Active reservoir ID + U32 fillToVolumeMl; ///< Volume target to fill to + U32 drainToVolumeMl; ///< Volume target to drain to } RESERVOIR_DATA_T; +/// Target temperature payload struct. typedef struct { - F32 targetPrimaryHeaterTemp; - F32 targetTrimmerHeaterTemp; + F32 targetPrimaryHeaterTemp; ///< Primary heater set temperature target + F32 targetTrimmerHeaterTemp; ///< Trimmer heater set temperature target } TARGET_TEMPS_PAYLOAD_T; +/// Heaters data struct. typedef struct { - U32 mainPrimayHeaterDC; - U32 smallPrimaryHeaterDC; - U32 trimmerHeaterDC; + U32 mainPrimayHeaterDC; ///< Main primary heater DC + U32 smallPrimaryHeaterDC; ///< Small primary heater DC + U32 trimmerHeaterDC; ///< Trimmer heater DC } HEATERS_DATA_T; +/// Accelerometer calibration data struct. typedef struct { - F32 gain; - F32 offset; -} LINEAR_F32_CAL_PAYLOAD_T; - -typedef struct -{ - F32 xOffset; - F32 yOffset; - F32 zOffset; + F32 xOffset; ///< Accelerometer calibration x-offset + F32 yOffset; ///< Accelerometer calibration y-offset + F32 zOffset; ///< Accelerometer calibration z-offset } ACCEL_CAL_PAYLOAD_T; #pragma pack(pop) + +/**@}*/ #endif - Index: firmware/App/Services/MsgQueues.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/MsgQueues.c (.../MsgQueues.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/MsgQueues.c (.../MsgQueues.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -16,6 +16,11 @@ ***************************************************************************/ #include "MsgQueues.h" + +/** + * @addtogroup MsgQueues + * @{ + */ // ********** private definitions ********** @@ -30,12 +35,12 @@ // ********** private function prototypes ********** -/************************************************************************* +/*********************************************************************//** * @brief initMsgQueues * The initMsgQueues function initializes the MsgQueues module. * @details * Inputs : none - * Outputs : none + * Outputs : MsgQueues module initialized * @return none *************************************************************************/ void initMsgQueues( void ) @@ -54,11 +59,11 @@ } } } - -/************************************************************************* + +/*********************************************************************//** * @brief addToMsgQueue - * The addToMsgQueue function adds a message to a given message queue. \n - * This function should only be called from the General Task. + * The addToMsgQueue function adds a message to a given message queue. + * This function should only be called from the general task. * @details * Inputs : none * Outputs : message added to queue @@ -95,17 +100,16 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief getFromMsgQueue - * The getFromMsgQueue function retrieves the next message from a given \n - * message queue. This function should only be called from the General Task. + * The getFromMsgQueue function retrieves the next message from a given + * message queue. This function should only be called from the general task. * @details * Inputs : queue * Outputs : message retrieved from the queue * @param queue the message queue to retrieve from - * @param msg a pointer to a message structure to populate with the retrieved \n - * message. + * @param msg a pointer to a message structure to populate with the retrieved message. * @return TRUE if a message was found to retrieve, FALSE if not *************************************************************************/ BOOL getFromMsgQueue( MSG_QUEUE_T queue, MESSAGE_WRAPPER_T *msg ) @@ -137,12 +141,12 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief isMsgQueueEmpty * The isMsgQueueEmpty function determines whether a given message queue is empty. * @details - * Inputs : none + * Inputs : msgQueueCounts[] * Outputs : none * @param queue the message queue to check * @return TRUE if a given message queue is empty, FALSE if not @@ -166,12 +170,12 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief isMsgQueueFull * The isMsgQueueFull function determines whether a given message queue is full. * @details - * Inputs : none + * Inputs : msgQueueCounts[] * Outputs : none * @param queue the message queue to check * @return TRUE if the given message queue is full, FALSE if not @@ -195,13 +199,13 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief blankMessage * The blankMessage function blanks a given message. * @details * Inputs : none - * Outputs : none + * Outputs : Zeroed out the message * @param message Pointer to the message to blank * @return none *************************************************************************/ @@ -217,14 +221,14 @@ *msgContent++ = 0x0; } } - -/************************************************************************* + +/*********************************************************************//** * @brief blankMessageInWrapper * The blankMessageInWrapper function blanks a given message in a wrapper. * @details * Inputs : none - * Outputs : none - * @param message Pointer to the message in a wrapper to blank + * Outputs : Zeroed out the message in wrapper + * @param message pointer to the message in a wrapper to blank * @return none *************************************************************************/ void blankMessageInWrapper( MESSAGE_WRAPPER_T *message ) @@ -242,3 +246,5 @@ // set msg ID out of bounds in case blank message goes somewhere message->msg.hdr.msgID = 0xFFFF; } + +/**@}*/ Index: firmware/App/Services/MsgQueues.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/MsgQueues.h (.../MsgQueues.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/MsgQueues.h (.../MsgQueues.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -19,39 +19,52 @@ #define __MSG_QUEUES_H__ #include "DGCommon.h" + +/** + * @defgroup MsgQueues MsgQueues + * @brief Message queues service module. Provides message queue functionality + * including support functions for adding and getting a message. + * + * @addtogroup MsgQueues + * @{ + */ // ********** public definitions ********** -#define MAX_MSG_PAYLOAD_SIZE 100 // bytes - +#define MAX_MSG_PAYLOAD_SIZE 100 ///< Maximum message payload size in bytes. + +/// List of message queues. typedef enum Msg_Queues { - MSG_Q_IN = 0, - NUM_OF_MSG_QUEUES + MSG_Q_IN = 0, ///< Incoming message queue + NUM_OF_MSG_QUEUES ///< Number of message queues } MSG_QUEUE_T; -#pragma pack(push,1) +#pragma pack(push,1) +/// Message header struct. typedef struct { - S16 seqNo; // sequence # (and ACK required bit) of message - U16 msgID; // ID of message - U08 payloadLen; // length of payload in bytes + S16 seqNo; ///< Sequence number (and ACK required bit) of message + U16 msgID; ///< ID of message + U08 payloadLen; ///< Length of payload in bytes } MESSAGE_HEADER_T; - + +/// Message struct. typedef struct { - MESSAGE_HEADER_T hdr; // message header - U08 payload[ MAX_MSG_PAYLOAD_SIZE ]; // message payload + MESSAGE_HEADER_T hdr; ///< Message header + U08 payload[ MAX_MSG_PAYLOAD_SIZE ]; ///< Message payload } MESSAGE_T; - + +/// Message wrapper struct. typedef struct { - MESSAGE_T msg; // message - U08 crc; // message CRC + MESSAGE_T msg; ///< Message struct + U08 crc; ///< Message's crc } MESSAGE_WRAPPER_T; #pragma pack(pop) -#define MESSAGE_OVERHEAD_SIZE (sizeof(MESSAGE_HEADER_T) + sizeof(U08)) +#define MESSAGE_OVERHEAD_SIZE (sizeof(MESSAGE_HEADER_T) + sizeof(U08)) ///< Message overhead size // ********** public function prototypes ********** @@ -62,5 +75,7 @@ BOOL isMsgQueueFull( MSG_QUEUE_T queue ); void blankMessage( MESSAGE_T *message ); void blankMessageInWrapper( MESSAGE_WRAPPER_T *message ); + +/**@}*/ #endif Index: firmware/App/Services/PIControllers.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/PIControllers.c (.../PIControllers.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -26,10 +26,8 @@ */ // ********** private definitions ********** - -#define MIN_KI NEARLY_ZERO ///< minimum integral coefficient - cannot be zero. - -/// record for PI controller. + +/// Record for PI controller. typedef struct { // -- PI's parameters -- F32 Kp; ///< Proportional Value. @@ -45,11 +43,12 @@ F32 controlSignal; ///< actual control signal. } PI_CONTROLLER_T; -#define SET_CONTROLLER( c, id ) ((c) = &piControllers[id]) ///< macro to set a local controller pointer to a given piController. +#define MIN_KI NEARLY_ZERO ///< minimum integral coefficient - cannot be zero. +#define SET_CONTROLLER( c, id ) ( (c) = &piControllers[ id ] ) ///< macro to set a local controller pointer to a given piController. // ********** private data ********** -/// PI Controllers -- initial configurations. +/// PI Controllers - initial configurations. static PI_CONTROLLER_T piControllers[ NUM_OF_PI_CONTROLLERS_IDS ] = { // Kp Ki uMax uMin ref meas err esw esum ctrl { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, // PI_CONTROLLER_ID_RO_PUMP @@ -59,16 +58,16 @@ /*********************************************************************//** * @brief - * Initialize controller before operation. Make sure to call it before - * first call to runController function. - * + * The initializePIController function initializes controller before operation. + * Make sure to call it before first call to runController function. + * Inputs : none + * Outputs : PI controllers module initialized * @param controllerID ID filter number * @param initialControlSignal Value of the output on the first iteration * @param kP Coefficient for proportional * @param kI Coefficient for integral * @param controlMin Minimum control output * @param controlMax Maximum control output - * * @return none *************************************************************************/ void initializePIController( PI_CONTROLLER_ID_T controllerID, F32 initialControlSignal, @@ -101,12 +100,12 @@ /*********************************************************************//** * @brief - * Reset controller before new set point. Make sure to call it before first - * call to runController function. - * + * The resetPIController functions resets controller before new set point. + * Make sure to call it before first call to runController function. + * Inputs : none + * Outputs : Reset a PI controller * @param controllerID ID filter number * @param initialControlSignal Value of the output on the first iteration - * * @return none *************************************************************************/ void resetPIController( PI_CONTROLLER_ID_T controllerID, F32 initialControlSignal ) @@ -131,12 +130,12 @@ /*********************************************************************//** * @brief - * Call this function whenever a new measured signal sampled is acquired. - * + * The runPIController functions executes a PI controller with a new sampled measured signal. + * Inputs : none + * Outputs : Feeds new signal to PI controller * @param controllerID ID filter number * @param referenceSignal reference signal value * @param measuredSignal latest measured sample - * * @return value of the control signal *************************************************************************/ F32 runPIController(PI_CONTROLLER_ID_T controllerID, F32 referenceSignal, F32 measuredSignal) @@ -179,11 +178,11 @@ /*********************************************************************//** * @brief - * Returns the latest requested signal sample. - * + * The getPIControllerSignals function returns the latest requested signal sample. + * Inputs : none + * Outputs : none * @param controllerID ID filter number * @param signalID signal sample ID request - * * @return latest sample requested *************************************************************************/ F32 getPIControllerSignals( PI_CONTROLLER_ID_T controllerID, PI_CONTROLLER_SIGNALS_ID signalID ) Index: firmware/App/Services/PIControllers.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/PIControllers.h (.../PIControllers.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/PIControllers.h (.../PIControllers.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -22,35 +22,35 @@ /** * @defgroup PIControllers PIControllers - * @brief PIControllers service module. Provides PI controllers for various actuators.. + * @brief PIControllers service module. Provides PI controllers for various actuators. * * @addtogroup PIControllers * @{ */ // ********** public definitions ********** -/// Enumeration of PI controllers +/// Enumeration of PI controllers. typedef enum ControllerList { - PI_CONTROLLER_ID_RO_PUMP = 0, ///< RO Pump controller. - PI_CONTROLLER_ID_PRIMARY_HEATER, ///< Primary Heater controller. - PI_CONTROLLER_ID_TRIMMER_HEATER, ///< Trimmer Heater controller. - NUM_OF_PI_CONTROLLERS_IDS ///< Number of PI controllers. + PI_CONTROLLER_ID_RO_PUMP = 0, ///< RO Pump controller + PI_CONTROLLER_ID_PRIMARY_HEATER, ///< Primary Heater controller + PI_CONTROLLER_ID_TRIMMER_HEATER, ///< Trimmer Heater controller + NUM_OF_PI_CONTROLLERS_IDS ///< Number of PI controllers } PI_CONTROLLER_ID_T; -/// Enumeration of PI controller signals +/// Enumeration of PI controller signals. typedef enum ControllerSignals { - CONTROLLER_SIGNAL_REFERENCE = 0, ///< Reference value. - CONTROLLER_SIGNAL_MEASURED, ///< Measured value. - CONTROLLER_SIGNAL_ERROR, ///< Error value. - CONTROLLER_SIGNAL_ERROR_SUM, ///< Error sum before anti-windup. - CONTROLLER_SIGNAL_ERROR_SUM_AFTER_WINDUP, ///< Error sum after anti-windup. - CONTROLLER_SIGNAL_PROPORTIONAL_OUTPUT, ///< P portion of controller output signal. - CONTROLLER_SIGNAL_INTEGRAL_OUTPUT, ///< I portion of controller output signal. - CONTROLLER_SIGNAL_CONTROL, ///< Controller output signal. - NUM_OF_CONTROLLER_SIGNAL ///< Number of PI controller signals. + CONTROLLER_SIGNAL_REFERENCE = 0, ///< Reference value + CONTROLLER_SIGNAL_MEASURED, ///< Measured value + CONTROLLER_SIGNAL_ERROR, ///< Error value + CONTROLLER_SIGNAL_ERROR_SUM, ///< Error sum before anti-windup + CONTROLLER_SIGNAL_ERROR_SUM_AFTER_WINDUP, ///< Error sum after anti-windup + CONTROLLER_SIGNAL_PROPORTIONAL_OUTPUT, ///< P portion of controller output signal + CONTROLLER_SIGNAL_INTEGRAL_OUTPUT, ///< I portion of controller output signal + CONTROLLER_SIGNAL_CONTROL, ///< Controller output signal + NUM_OF_CONTROLLER_SIGNAL ///< Number of PI controller signals } PI_CONTROLLER_SIGNALS_ID; // ********** public function prototypes ********** @@ -64,4 +64,3 @@ /**@}*/ #endif - Index: firmware/App/Services/Reservoirs.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/Reservoirs.c (.../Reservoirs.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -32,24 +32,24 @@ // ********** private definitions ********** -#define MIN_RESERVOIR_VOLUME_ML 0 ///< Minimum reservoir volume in mL. -#define MAX_RESERVOIR_VOLUME_ML 2000 ///< Maximum reservoir volume in mL. -#define DEFAULT_FILL_VOLUME_ML 1700 ///< Default fill volume for treatment in mL. -#define DISINFECT_FILL_VOLUME_ML 2400 ///> Fill volume for disinfection in mL. -#define MAX_FILL_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///> Maximum fill volume in mL. -#define DEFAULT_DRAIN_VOLUME_ML 100 ///> Default drain volume in mL. -#define MAX_DRAIN_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///> Maximum drain volume in mL. -#define MIN_DRAIN_VOLUME_ML 100 ///> Minimum drain volume in mL. +#define MIN_RESERVOIR_VOLUME_ML 0 ///< Minimum reservoir volume in mL. +#define MAX_RESERVOIR_VOLUME_ML 2000 ///< Maximum reservoir volume in mL. +#define DEFAULT_FILL_VOLUME_ML 1700 ///< Default fill volume for treatment in mL. +#define DISINFECT_FILL_VOLUME_ML 2400 ///> Fill volume for disinfection in mL. +#define MAX_FILL_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///> Maximum fill volume in mL. +#define DEFAULT_DRAIN_VOLUME_ML 100 ///> Default drain volume in mL. +#define MAX_DRAIN_VOLUME_ML MAX_RESERVOIR_VOLUME_ML ///> Maximum drain volume in mL. +#define MIN_DRAIN_VOLUME_ML 100 ///> Minimum drain volume in mL. -#define RESERVOIR_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the reservoir data is published on the CAN bus. +#define RESERVOIR_DATA_PUB_INTERVAL ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ///< interval (ms/task time) at which the reservoir data is published on the CAN bus. // ********** private data ********** -static U32 reservoirDataPublicationTimerCounter = 0; ///< used to schedule reservoir data publication to CAN bus. +static U32 reservoirDataPublicationTimerCounter = 0; ///< used to schedule reservoir data publication to CAN bus. -static OVERRIDE_U32_T activeReservoir = { 0, 0, 0, 0 }; ///< The active reservoir that the DG is filling/draining/etc. -static OVERRIDE_U32_T fillVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir fill volume (in mL). -static OVERRIDE_U32_T drainVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir drain volume (in mL). +static OVERRIDE_U32_T activeReservoir = { 0, 0, 0, 0 }; ///< The active reservoir that the DG is filling/draining/etc. +static OVERRIDE_U32_T fillVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir fill volume (in mL). +static OVERRIDE_U32_T drainVolumeTargetMl = { 0, 0, 0, 0 }; ///< The target reservoir drain volume (in mL). // ********** private function prototypes ********** @@ -58,7 +58,7 @@ * The initReservoirs function initializes the Reservoirs module. * @details * Inputs : none - * Outputs : Reservoirs module initialized. + * Outputs : Reservoirs module initialized * @return none *************************************************************************/ void initReservoirs( void ) @@ -77,7 +77,7 @@ * The execReservoirs function manages periodic tasks for the Reservoirs module. * @details * Inputs : none - * Outputs : Reservoir data broadcast on interval. + * Outputs : Reservoir data broadcast on interval * @return none *************************************************************************/ void execReservoirs( void ) @@ -95,7 +95,7 @@ /*********************************************************************//** * @brief - * The setActiveReservoir function sets the given reservoir as active \n + * The setActiveReservoir function sets the given reservoir as active * (meaning HD will be drawing from this reservoir). * @details * Inputs : none @@ -193,10 +193,10 @@ /*********************************************************************//** * @brief - * The startDrain function handles a fill command from the HD + * The startDrain function handles a drain command from the HD. * @details * Inputs : none - * Outputs : + * Outputs : Start draining in re-circulate mode * @param drainToVolMl Target volume (in mL) to drain reservoir to * @return TRUE if drain command successful, FALSE if not. *************************************************************************/ @@ -244,7 +244,7 @@ /*********************************************************************//** * @brief - * The startTrimmerHeater function handles a start trimmer heater command \n + * The startTrimmerHeater function handles a start trimmer heater command * from the HD. * @details * Inputs : none @@ -262,7 +262,7 @@ /*********************************************************************//** * @brief - * The stopTrimmerHeater function handles a stop trimmer heater command \n + * The stopTrimmerHeater function handles a stop trimmer heater command * from the HD. * @details * Inputs : none @@ -278,10 +278,6 @@ return result; } -/************************************************************************* - * GET SUPPORT FUNCTIONS - *************************************************************************/ - /*********************************************************************//** * @brief * The getActiveReservoir function gets the active reservoir. @@ -304,8 +300,7 @@ /*********************************************************************//** * @brief - * The getReservoirFillVolumeTargetMl function gets the reservoir fill \n - * volume (in mL). + * The getReservoirFillVolumeTargetMl function gets the reservoir fill volume (in mL). * @details * Inputs : fillVolumeTargetMl * Outputs : none @@ -325,8 +320,7 @@ /*********************************************************************//** * @brief - * The getReservoirDrainVolumeTargetMl function gets the reservoir drain \n - * volume (in mL). + * The getReservoirDrainVolumeTargetMl function gets the reservoir drain volume (in mL). * @details * Inputs : drainVolumeTargetMl * Outputs : none @@ -343,17 +337,15 @@ return result; } + - /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ - /*********************************************************************//** * @brief - * The testSetDGActiveReservoirOverride function overrides the active \n - * reservoir. + * The testSetDGActiveReservoirOverride function overrides the active reservoir. * @details * Inputs : activeReservoir * Outputs : activeReservoir @@ -376,8 +368,7 @@ /*********************************************************************//** * @brief - * The activeReservoir function resets the override of the active \n - * reservoir. + * The activeReservoir function resets the override of the active reservoir. * @details * Inputs : activeReservoir * Outputs : activeReservoir @@ -399,7 +390,7 @@ /*********************************************************************//** * @brief - * The testSetReservoirFillVolumeMlOverride function overrides the target \n + * The testSetReservoirFillVolumeMlOverride function overrides the target * reservoir fill volume (in mL). * @details * Inputs : fillVolumeTargetMl @@ -423,8 +414,8 @@ /*********************************************************************//** * @brief - * The testResetReservoirFillVolumeMlOverride function resets the override of the \n - * target reservoir fill volume. + * The testResetReservoirFillVolumeMlOverride function resets the override of + * the target reservoir fill volume. * @details * Inputs : fillVolumeTargetMl * Outputs : fillVolumeTargetMl @@ -446,7 +437,7 @@ /*********************************************************************//** * @brief - * The testSetReservoirDrainVolumeMlOverride function overrides the target \n + * The testSetReservoirDrainVolumeMlOverride function overrides the target * reservoir drain volume (in mL). * @details * Inputs : drainVolumeTargetMl @@ -470,8 +461,8 @@ /*********************************************************************//** * @brief - * The testResetReservoirDrainVolumeMlOverride function resets the override of the \n - * target reservoir drain volume. + * The testResetReservoirDrainVolumeMlOverride function resets the override of + * the target reservoir drain volume. * @details * Inputs : drainVolumeTargetMl * Outputs : drainVolumeTargetMl Index: firmware/App/Services/Reservoirs.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/Reservoirs.h (.../Reservoirs.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -22,8 +22,7 @@ /** * @defgroup Reservoirs Reservoirs - * @brief Reservoirs service module. - * Maintains reservoir set points and handles reservoir related commands from the HD + * @brief Reservoirs service module. Maintains reservoir set points and handles reservoir related commands from the HD. * * @addtogroup Reservoirs * @{ @@ -34,9 +33,9 @@ /// Enumeration of reservoirs. typedef enum Reservoirs { - RESERVOIR_1 = 0, ///< Reservoir #1. - RESERVOIR_2, ///< Reservoir #2. - NUM_OF_RESERVOIRS ///< Number of reservoirs. + RESERVOIR_1 = 0, ///< Reservoir number 1 + RESERVOIR_2, ///< Reservoir number 2 + NUM_OF_RESERVOIRS ///< Number of reservoirs } RESERVOIR_ID_T; // ********** public function prototypes ********** Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r66c624837b7b915415810e67249048ce5a46c163 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 66c624837b7b915415810e67249048ce5a46c163) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -35,40 +35,40 @@ // ********** private definitions ********** -#define NUM_OF_CAN_OUT_BUFFERS 5 ///< Number of CAN buffers for transmit -#define NUM_OF_CAN_IN_BUFFERS 6 ///< Number of CAN buffers for receiving +#define NUM_OF_CAN_OUT_BUFFERS 5 ///< Number of CAN buffers for transmit +#define NUM_OF_CAN_IN_BUFFERS 6 ///< Number of CAN buffers for receiving #ifndef DEBUG_ENABLED - #define NUM_OF_MSG_IN_BUFFERS 6 ///< Number of Msg buffers for receiving + #define NUM_OF_MSG_IN_BUFFERS 6 ///< Number of Msg buffers for receiving #else #define NUM_OF_MSG_IN_BUFFERS 7 #define SCI1_RECEIVE_DMA_REQUEST 30 #define SCI1_TRANSMIT_DMA_REQUEST 31 #endif -#define CAN_XMIT_PACKET_TIMEOUT_MS 200 ///< if transmitted CAN frame does not cause a transmit complete interrupt within this time, re-send or move on -#define MAX_XMIT_RETRIES 5 ///< maximum number of retries on no transmit complete interrupt timeout +#define CAN_XMIT_PACKET_TIMEOUT_MS 200 ///< if transmitted CAN frame does not cause a transmit complete interrupt within this time, re-send or move on +#define MAX_XMIT_RETRIES 5 ///< maximum number of retries on no transmit complete interrupt timeout -#define HD_COMM_TIMEOUT_IN_MS 2000 ///< HD has not sent any broadcast messages for this much time +#define HD_COMM_TIMEOUT_IN_MS 2000 ///< HD has not sent any broadcast messages for this much time -#define MAX_COMM_CRC_FAILURES 5 ///< maximum number of CRC errors within window period before alarm +#define MAX_COMM_CRC_FAILURES 5 ///< maximum number of CRC errors within window period before alarm #define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window -#define MSG_NOT_ACKED_TIMEOUT_MS ( MS_PER_SECOND * 1 ) ///< maximum time for a Denali message that requires ACK to be ACK'd -#define MSG_NOT_ACKED_MAX_RETRIES 3 ///< maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm -#define PENDING_ACK_LIST_SIZE 25 ///< maximum number of Delanli messages that can be pending ACK at any given time +#define MSG_NOT_ACKED_TIMEOUT_MS ( MS_PER_SECOND * 1 ) ///< maximum time for a Denali message that requires ACK to be ACK'd +#define MSG_NOT_ACKED_MAX_RETRIES 3 ///< maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm +#define PENDING_ACK_LIST_SIZE 25 ///< maximum number of Delanli messages that can be pending ACK at any given time #pragma pack(push, 1) /// Record for transmitted message that is pending acknowledgement from receiver. typedef struct { - BOOL used; - U16 seqNo; - U16 retries; - U32 timeStamp; - COMM_BUFFER_T channel; - U32 msgSize; - U08 msg[ MAX_ACK_MSG_SIZE ]; + BOOL used; ///< Flag indicates whether the pending ACK slot is used or not + U16 seqNo; ///< Sequence number + U16 retries; ///< Retry count + U32 timeStamp; ///< Message time stamp + COMM_BUFFER_T channel; ///< Comm buffer channel + U32 msgSize; ///< Message size + U08 msg[ MAX_ACK_MSG_SIZE ]; ///< Bytes representation of the message } PENDING_ACK_RECORD_T; #pragma pack(pop) @@ -103,12 +103,12 @@ static CAN_MESSAGE_BOX_T lastCANPacketSentChannel = (CAN_MESSAGE_BOX_T)0; ///< Keep channel last packet was sent on CAN bus in case we need to re-send. static U32 lastCANPacketSentTimeStamp = 0; ///< Keep time last packet sent on CAN bus so we can timeout on transmission attempt. -static PENDING_ACK_RECORD_T pendingAckList[ PENDING_ACK_LIST_SIZE ]; ///< list of outgoing messages that are awaiting an ACK +static PENDING_ACK_RECORD_T pendingAckList[ PENDING_ACK_LIST_SIZE ]; ///< list of outgoing messages that are awaiting an ACK -static volatile BOOL dgIsOnlyCANNode = TRUE; ///< flag indicating whether DG is alone on CAN bus. -static U32 canXmitRetryCtr = 0; ///< counter for CAN transmit retries. -static volatile BOOL hdIsCommunicating = FALSE; ///< has HD sent a message since last check -static volatile U32 timeOfLastHDCheckIn = 0; ///< last time we received an HD broadcast +static volatile BOOL dgIsOnlyCANNode = TRUE; ///< flag indicating whether DG is alone on CAN bus. +static U32 canXmitRetryCtr = 0; ///< counter for CAN transmit retries. +static volatile BOOL hdIsCommunicating = FALSE; ///< has HD sent a message since last check +static volatile U32 timeOfLastHDCheckIn = 0; ///< last time we received an HD broadcast #ifdef DEBUG_ENABLED // debug buffers @@ -172,7 +172,7 @@ /*********************************************************************//** * @brief - * The isHDCommunicating function determines whether the HD is communicating \n + * The isHDCommunicating function determines whether the HD is communicating * with the DG. * @details * Inputs : hdIsCommunicating @@ -186,7 +186,7 @@ /*********************************************************************//** * @brief - * The isDGOnlyCANNode function determines whether the DG is the only node \n + * The isDGOnlyCANNode function determines whether the DG is the only node * currently on the CAN bus. * @details * Inputs : dgIsOnlyCANNode @@ -223,8 +223,7 @@ /*********************************************************************//** * @brief - * The execSystemCommTx function manages data to be transmitted to other \n - * sub-systems. + * The execSystemCommTx function manages data to be transmitted to other sub-systems. * @details * Inputs : none * Outputs : Next outgoing frame transmitted. @@ -290,10 +289,9 @@ /*********************************************************************//** * @brief - * The handleCANMsgInterrupt function handles a CAN message interrupt. \n - * This may have occurred because a CAN packet transmission has completed \n - * or because a CAN packet has been received. The appropriate handler is \n - * called. + * 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 @@ -338,7 +336,7 @@ /*********************************************************************//** * @brief - * The handleUARTMsgRecvPacketInterrupt function handles a DMA UART receive \n + * The handleUARTMsgRecvPacketInterrupt function handles a DMA UART receive * packet completed interrupt. * @details * Inputs : none @@ -359,7 +357,7 @@ /*********************************************************************//** * @brief - * The handleUARTMsgXmitPacketInterrupt function handles a DMA UART transmit \n + * The handleUARTMsgXmitPacketInterrupt function handles a DMA UART transmit * packet completed interrupt. * @details * Inputs : none @@ -380,7 +378,7 @@ /*********************************************************************//** * @brief - * The initUARTAndDMA function initializes the SCI1 peripheral and the DMA \n + * The initUARTAndDMA function initializes the SCI1 peripheral and the DMA * to go with it for PC communication. * @details * Inputs : none @@ -445,7 +443,7 @@ /*********************************************************************//** * @brief - * The isCANBoxForXmit function determines whether a given CAN message box \n + * The isCANBoxForXmit function determines whether a given CAN message box * is configured for transmit. * @details * Inputs : CAN_OUT_BUFFERS[] @@ -472,7 +470,7 @@ /*********************************************************************//** * @brief - * The isCANBoxForRecv function determines whether a given CAN message box \n + * The isCANBoxForRecv function determines whether a given CAN message box * is configured for receiving. * @details * Inputs : MSG_IN_BUFFERS[] @@ -520,15 +518,14 @@ ********************** TRANSMIT SUPPORT FUNCTIONS ************************ *************************************************************************/ - /*********************************************************************//** * @brief - * The findNextHighestPriorityCANPacketToTransmit function gets the next \n - * 8 byte packet and initiates a CAN transmit on the appropriate CAN channel. \n + * 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 - * @return buffer with highest priority CAN packet to transmit, \n + * @return buffer with highest priority CAN packet to transmit, * COMM_BUFFER_NOT_USED if not CAN packets pending transmit found *************************************************************************/ static COMM_BUFFER_T findNextHighestPriorityCANPacketToTransmit( void ) @@ -551,7 +548,7 @@ /*********************************************************************//** * @brief - * The transmitNextCANPacket function gets the next 8 byte packet and initiates \n + * 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 @@ -601,7 +598,7 @@ /*********************************************************************//** * @brief - * The transmitNextUARTPacket function sets up and initiates a DMA transmit \n + * 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) @@ -638,14 +635,13 @@ ********************** RECEIVE SUPPORT FUNCTIONS ************************* *************************************************************************/ - /*********************************************************************//** * @brief - * The processIncomingData function parses out messages from the Input \n - * Comm Buffers and adds them to the Received Message Queue. + * 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 + * Outputs : Parsed message(s) added to received message queue * @return none *************************************************************************/ static void processIncomingData( void ) @@ -725,7 +721,7 @@ /*********************************************************************//** * @brief - * The consumeBufferPaddingBeforeSync function removes any bytes in a given \n + * The consumeBufferPaddingBeforeSync function removes any bytes in a given * buffer that lie before a sync byte. * @details * Inputs : none @@ -756,14 +752,14 @@ /*********************************************************************//** * @brief - * The parseMessageFromBuffer function looks for a complete message in a \n - * given buffer. If a message is found, its size is returned. + * 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. * @param data pointer to byte array to search for a message - * @param len # of bytes in the data to search - * @return size of message if found, zero if no complete message found, \n + * @param len number of bytes in the data to search + * @return size of message if found, zero if no complete message found, * -1 if message found but CRC fails. *************************************************************************/ static S32 parseMessageFromBuffer( U08 *data, U32 len ) @@ -808,7 +804,7 @@ /*********************************************************************//** * @brief - * The processReceivedMessages function processes any messages in the \n + * The processReceivedMessages function processes any messages in the * received message queues. * @details * Inputs : Received Message Queues @@ -854,8 +850,7 @@ /*********************************************************************//** * @brief - * The checkForCommTimeouts function checks for sub-system communication \n - * timeout errors. + * The checkForCommTimeouts function checks for sub-system communication timeout errors. * @details * Inputs : timeOfLastDGCheckIn, timeOfLastUICheckIn * Outputs : possibly a comm t/o alarm @@ -874,8 +869,8 @@ /*********************************************************************//** * @brief - * The checkTooManyBadMsgCRCs function checks for too many bad message CRCs \n - * within a set period of time. Assumed function is being called when a new \n + * 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 @@ -900,15 +895,15 @@ /*********************************************************************//** * @brief - * The addMsgToPendingACKList function adds a given message to the pending \n - * ACK list. Messages in this list will require receipt of an ACK message \n + * 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[] * @param msg pointer to msg within the message data * @param msgData pointer to message data to add to pending ACK list - * @param len # of bytes of message data + * @param len number of bytes of message data * @return TRUE if message added successfully, FALSE if not *************************************************************************/ BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ) @@ -946,13 +941,13 @@ /*********************************************************************//** * @brief - * The matchACKtoPendingACKList function searches the pending ACK list to \n - * see if the sequence # from a received ACK msg matches any. If found, \n + * 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[] - * @param seqNo sequence # to match to an entry in the list + * @param seqNo sequence number to match to an entry in the list * @return TRUE if a match was found, FALSE if not *************************************************************************/ static BOOL matchACKtoPendingACKList( S16 seqNo ) @@ -976,8 +971,8 @@ /*********************************************************************//** * @brief - * The checkPendingACKList function searches the pending ACK list to \n - * see if any have expired. Any such messages will be queued for retransmission \n + * 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[] Index: firmware/App/Services/SystemComm.h =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -24,28 +24,28 @@ /** * @defgroup SystemComm SystemComm - * @brief System communication module. Manages incoming and outgoing CAN frames. + * @brief System communication module. Manages incoming and outgoing CAN frames. * * @addtogroup SystemComm * @{ */ // ********** public definitions ********** -#define MESSAGE_SYNC_BYTE 0xA5 ///< Denali message syncronization byte. +#define MESSAGE_SYNC_BYTE 0xA5 ///< Denali message syncronization byte. -#define CAN_MESSAGE_PAYLOAD_SIZE 8 ///< CAN frame payload size (in bytes). +#define CAN_MESSAGE_PAYLOAD_SIZE 8 ///< CAN frame payload size (in bytes). #ifdef DEBUG_ENABLED #define PC_MESSAGE_PACKET_SIZE 8 #endif -#define MSG_ID_ACK 0xFFFF ///< Denali message ID for acknowledging received messages (when required). -#define MSG_ACK_BIT 0x8000 ///< ACK bit in sequence number that indicates an ACK is required. -#define MAX_MSG_SEQ_NO 0x7FFF ///< Maximum sequence number for Denali message (then wraps to 1). -#define MIN_MSG_SEQ_NO 0x0001 ///< Minimum sequence number for Denali message. -#define MAX_ACK_MSG_SIZE ( sizeof( MESSAGE_WRAPPER_T ) + 1 + CAN_MESSAGE_PAYLOAD_SIZE ) ///< Maximum size (in bytes) of Denali message including full (wrapped) message + sync + any CAN padding) +#define MSG_ID_ACK 0xFFFF ///< Denali message ID for acknowledging received messages (when required). +#define MSG_ACK_BIT 0x8000 ///< ACK bit in sequence number that indicates an ACK is required. +#define MAX_MSG_SEQ_NO 0x7FFF ///< Maximum sequence number for Denali message (then wraps to 1). +#define MIN_MSG_SEQ_NO 0x0001 ///< Minimum sequence number for Denali message. +#define MAX_ACK_MSG_SIZE ( sizeof( MESSAGE_WRAPPER_T ) + 1 + CAN_MESSAGE_PAYLOAD_SIZE ) ///< Maximum size (in bytes) of Denali message including full (wrapped) message + sync + any CAN padding) -typedef COMM_BUFFER_T CAN_MESSAGE_BOX_T; ///< the CAN comm buffers align with the active CAN message boxes +typedef COMM_BUFFER_T CAN_MESSAGE_BOX_T; ///< the CAN comm buffers align with the active CAN message boxes // ********** public function prototypes ********** Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r92ec01cb48d91fe7315baa987e1aa051dd12df75 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -40,33 +40,38 @@ #include "Utilities.h" #include "Valves.h" #include "WatchdogMgmt.h" + +/** + * @addtogroup SystemCommMessages + * @{ + */ // ********** private definitions ********** -#define ACK_REQUIRED TRUE -#define ACK_NOT_REQUIRED FALSE +#define ACK_REQUIRED TRUE ///< Require an ACK. +#define ACK_NOT_REQUIRED FALSE ///< Not require an ACK. #ifdef DEBUG_ENABLED #define DEBUG_EVENT_MAX_TEXT_LEN 40 #endif // ********** private data ********** -static BOOL testerLoggedIn = FALSE; -static volatile U16 nextSeqNo = 1; +static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether tester logged in or not. +static volatile U16 nextSeqNo = 1; ///< Next sequence number. // ********** private function prototypes ********** static U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); -/************************************************************************* - * @brief serializeMessage - * The serializeMessage function serializes a given message into a given \n - * array of bytes. A sequence # is added to the message here and the ACK \n - * bit of the sequence # is set if ACK is required per parameter. A sync byte \n - * is inserted at the beginning of the message and an 8-bit CRC is appended to \n +/*********************************************************************//** + * @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 : none @@ -143,10 +148,10 @@ return result; } - -/************************************************************************* - * @brief sendACKMsg - * The sendACKMsg function constructs and queues for transmit an ACK message \n + +/*********************************************************************//** + * @brief + * The sendACKMsg function constructs and queues for transmit an ACK message * for a given received message. * @details * Inputs : none @@ -173,12 +178,11 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief sendTestAckResponseMsg - * The sendTestAckResponseMsg function constructs a simple response \n - * message for a handled test message and queues it for transmit on the \n - * appropriate UART channel. + * 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 * Outputs : response message constructed and queued for transmit. @@ -203,14 +207,15 @@ return result; } + // *********************************************************************** // ***************** Message Sending Helper Functions ******************** // *********************************************************************** - -/************************************************************************* + +/*********************************************************************//** * @brief broadcastAlarmTriggered - * The broadcastAlarmTriggered function constructs an alarm triggered msg to \n + * 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 @@ -242,10 +247,10 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief broadcastAlarmCleared - * The broadcastAlarmCleared function constructs an alarm cleared msg to be \n + * 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 @@ -271,10 +276,10 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The broadcastAccelData function constructs an accelerometer data msg to \n + * The broadcastAccelData function constructs an accelerometer data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none @@ -319,10 +324,10 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief broadcastRTCEpoch - * The broadcastRTCEpoch function constructs an epoch msg to \n - * be broadcast and queues the msg for transmit on the appropriate CAN channel. + * The broadcastRTCEpoch function constructs an epoch msg to be broadcast + * and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none * Outputs : RTC time and date in epoch @@ -347,10 +352,10 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The broadcastDGHDOperationMode function constructs a DG operation mode \n + * The broadcastDGHDOperationMode function constructs a DG operation mode * broadcast message and queues the msg for transmit on the appropriate CAN channel. * @details * Inputs : none @@ -379,8 +384,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastLoadCellData function sends out load cell data. * @details @@ -416,8 +421,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastValvesStates function sends out DG valves states. * @details @@ -445,8 +450,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastHeatersData function sends out DG heaters data * @details @@ -480,8 +485,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastROPumpData function sends out RO pump data. * @details @@ -515,8 +520,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastDrainPumpData function sends out RO pump data. * @details @@ -548,8 +553,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastPressureSensorsData function sends out DG pressure data. * @details @@ -584,9 +589,9 @@ result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_DG_BROADCAST, ACK_NOT_REQUIRED ); return result; -} - -/************************************************************************* +} + +/*********************************************************************//** * @brief * The broadcastReservoirData function broadcasts the DG reservoir data. * @details @@ -620,14 +625,15 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief * The broadcastTemperatureSensorsData function sends out DG temperature - * sensors data - * Inputs : heaters data - * Outputs : temperatur sensors data msg constructed and queued - * @param sensorsValue sensors value array + * sensors data. + * Inputs : none + * Outputs : temperature sensors data message constructed and queued + * @param sensorsValue sensors value array + * @param byteLength payload length in bytes * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ BOOL broadcastTemperatureSensorsData ( U08 *sensorsValue, U32 byteLength ) @@ -649,13 +655,12 @@ return result; } - -/************************************************************************* +/*********************************************************************//** * @brief * The broadcastConductivityData function sends out conductivity data. * @details * Inputs : none - * Outputs : conductivity data msg constructed and queued + * Outputs : conductivity data message constructed and queued * @param roRejectionRatio RO rejection ratio * @param cpi water inlet conductivity data * @param cpo water outlet conductivity data @@ -689,10 +694,10 @@ // *********************************************************************** // **************** Message Handling Helper Functions ******************** // *********************************************************************** - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handlePowerOffWarning function handles a power off warning message \n + * The handlePowerOffWarning function handles a power off warning message * from the HD. * @details * Inputs : none @@ -707,10 +712,10 @@ signalPowerOffWarning(); } } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleSetDialysateTemperatureCmd function handles a dialysate temperature \n + * The handleSetDialysateTemperatureCmd function handles a dialysate temperature * set points message from the HD. * @details * Inputs : none @@ -733,8 +738,8 @@ } sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleFWVersionCmd function handles a FW version request message. * @details @@ -767,10 +772,10 @@ // 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 ); } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleSwitchReservoirCmd function handles a switch reservoirs command \n + * The handleSwitchReservoirCmd function handles a switch reservoirs command * from the HD. * @details * Inputs : none @@ -795,8 +800,8 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleFillCmd function handles a fill command from the HD. * @details @@ -820,8 +825,8 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleDrainCmd function handles a drain command from the HD. * @details @@ -846,10 +851,10 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleStartStopTreatmentMsg function handles a treatment start/stop \n + * The handleStartStopTreatmentMsg function handles a treatment start/stop * message from the HD. * @details * Inputs : none @@ -879,10 +884,10 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleStartStopTrimmerHeaterCmd function handles a trimmer heater start/stop \n + * The handleStartStopTrimmerHeaterCmd function handles a trimmer heater start/stop * command message from the HD. * @details * Inputs : none @@ -912,8 +917,8 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleSampleWaterCmd function handles a sample water command from the HD. * @details @@ -936,8 +941,8 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_DG_2_HD, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief handleSetRTCTimestamp * The handleSetRTCTimestamp function handles a request to write time and * date to RTC @@ -963,8 +968,8 @@ // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleStartStopPrimaryHeater function handles a request start or * stop the primary heater @@ -999,15 +1004,15 @@ return result; } + /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ - #ifdef DEBUG_ENABLED - /************************************************************************* - * @brief sendDebugData + /*********************************************************************//** + * @brief * The sendDebugData function sends debug data out to the PC port. * @details * Inputs : none @@ -1025,8 +1030,8 @@ return result; } - - /************************************************************************* + + /*********************************************************************//** * @brief * The sendDebugDataToUI function sends debug string to the UI for logging. * @details @@ -1054,10 +1059,10 @@ } } #endif - -/************************************************************************* - * @brief isTestingActivated - * The isTestingActivated function determines whether a tester has successfully \n + +/*********************************************************************//** + * @brief + * The isTestingActivated function determines whether a tester has successfully * logged in to activate testing functionality. * @details * Inputs : testerLoggedIn @@ -1068,12 +1073,11 @@ { return testerLoggedIn; } - -/************************************************************************* - * @brief sendTestAckResponseMsg - * The sendTestAckResponseMsg function constructs a simple response \n - * message for a handled test message and queues it for transmit on the \n - * appropriate UART channel. + +/*********************************************************************//** + * @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 * Outputs : response message constructed and queued for transmit. @@ -1097,11 +1101,10 @@ return result; } - -/************************************************************************* - * @brief handleTesterLogInRequest - * The handleTesterLogInRequest function handles a request to login as a \n - * tester. + +/*********************************************************************//** + * @brief + * The handleTesterLogInRequest function handles a request to login as a tester. * @details * Inputs : none * Outputs : message handled @@ -1123,10 +1126,10 @@ // respond to would be tester sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, testerLoggedIn ); } - -/************************************************************************* - * @brief handleTestWatchdogCheckInStateOverrideRequest - * The handleTestWatchdogCheckInStateOverrideRequest function handles a \n + +/*********************************************************************//** + * @brief + * The handleTestWatchdogCheckInStateOverrideRequest function handles a * request to override the check-in status of a given task. * @details * Inputs : none @@ -1135,10 +1138,10 @@ * @return none *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestWatchdogCheckInStateOverrideRequest, testSetWatchdogTaskCheckInOverride, testResetWatchdogTaskCheckInOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief handleTestAlarmStateOverrideRequest - * The handleTestAlarmStateOverrideRequest function handles a request to \n + * The handleTestAlarmStateOverrideRequest function handles a request to * override the active status of a given alarm. * @details * Inputs : none @@ -1147,10 +1150,10 @@ * @return none *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestAlarmStateOverrideRequest, testSetAlarmStateOverride, testResetAlarmStateOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestLoadCellOverrideRequest function handles a request to \n + * The handleTestLoadCellOverrideRequest function handles a request to * override the value read from the given load cell. * @details * Inputs : none @@ -1159,11 +1162,11 @@ * @return none *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestLoadCellOverrideRequest, testSetLoadCellOverride, testResetLoadCellOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief * The handleTestTemperatureSensorsOverrideRequest function handles a - * request to override a temperatures sensor's value + * request to override a temperatures sensor's value. * @details * Inputs : none * Outputs : message handled @@ -1172,11 +1175,11 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestTemperatureSensorsOverrideRequest, \ testSetMeasuredTemperatureOverride, testResetMeasuredTemperatureOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief -* The handleTestTemperatureSensorsDataPublishOverrideRequest function handles \n -* a request to override the publish interval of temperature sensors data +* The handleTestTemperatureSensorsDataPublishOverrideRequest function handles +* a request to override the publish interval of temperature sensors data. * @details * Inputs : none * Outputs : message handled @@ -1186,10 +1189,10 @@ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestTemperatureSensorsDataPublishOverrideRequest, \ testSetTemperatureSensorsPublishIntervalOverride, testResetTemperatureSensorsPublishIntervalOverride ) -/************************************************************************* +/*********************************************************************//** * @brief - * The handleTestHeatersDataPublishOverrideRequest function handles \n - * a request to override the publish interval of heaters data + * The handleTestHeatersDataPublishOverrideRequest function handles + * a request to override the publish interval of heaters data. * @details * Inputs : none * Outputs : message handled @@ -1198,10 +1201,10 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHeatersDataPublishOverrideRequest, \ testSetHeatersPublishIntervalOverride, testResetHeatersPublishIntervalOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestLoadCellDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestLoadCellDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for load cell data. * @details * Inputs : none @@ -1210,10 +1213,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestLoadCellDataBroadcastIntervalOverrideRequest, testSetLoadCellDataPublishIntervalOverride, testResetLoadCellDataPublishIntervalOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestPressureSensorOverrideRequest function handles a request to \n + * The handleTestPressureSensorOverrideRequest function handles a request to * override the value read from the given pressure sensor. * @details * Inputs : none @@ -1222,10 +1225,10 @@ * @return none *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestPressureSensorOverrideRequest, testSetDGPressureSensorOverride, testResetDGPressureSensorOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestPressureDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestPressureDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for load cell data. * @details * Inputs : none @@ -1234,10 +1237,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestPressureDataBroadcastIntervalOverrideRequest, testSetPressuresDataPublishIntervalOverride, testResetPressuresDataPublishIntervalOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestROPumpSetPointOverrideRequest function handles a request to \n + * The handleTestROPumpSetPointOverrideRequest function handles a request to * override the RO pump pressure set point (in PSI). * @details * Inputs : none @@ -1246,10 +1249,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestROPumpSetPointOverrideRequest, testSetTargetROPumpPressureOverride, testResetTargetROPumpPressureOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestROMeasuredFlowOverrideRequest function handles a request to \n + * The handleTestROMeasuredFlowOverrideRequest function handles a request to * override the RO flow rate. * @details * Inputs : none @@ -1258,10 +1261,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestROMeasuredFlowOverrideRequest, testSetMeasuredROFlowRateOverride, testResetMeasuredROFlowRateOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestROPumpDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestROPumpDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for RO pump data. * @details * Inputs : none @@ -1270,10 +1273,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestROPumpDataBroadcastIntervalOverrideRequest, testSetROPumpDataPublishIntervalOverride, testResetROPumpDataPublishIntervalOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestDrainPumpSetPointOverrideRequest function handles a request to \n + * The handleTestDrainPumpSetPointOverrideRequest function handles a request to * override the drain pump speed set point (in RPM). * @details * Inputs : none @@ -1282,10 +1285,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDrainPumpSetPointOverrideRequest, testSetTargetDrainPumpSpeedOverride, testResetTargetDrainPumpSpeedOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestDrainPumpDataBroadcastIntervalOverrideRequest function handles \n + * The handleTestDrainPumpDataBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for drain pump data. * @details * Inputs : none @@ -1294,10 +1297,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDrainPumpDataBroadcastIntervalOverrideRequest, testSetDrainPumpDataPublishIntervalOverride, testResetDrainPumpDataPublishIntervalOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestValveStateOverrideRequest function handles a request to \n + * The handleTestValveStateOverrideRequest function handles a request to * override the state value read from the given valve. * @details * Inputs : none @@ -1306,10 +1309,10 @@ * @return none *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestValveStateOverrideRequest, testSetValveStateOverride, testResetValveStateOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestValvesStatesPublishIntervalOverrideRequest function handles \n + * The handleTestValvesStatesPublishIntervalOverrideRequest function handles * a request to override the publish interval of valves states from the given valve. * @details * Inputs : none @@ -1318,10 +1321,10 @@ * @return none *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestValvesStatesPublishIntervalOverrideRequest, testSetValvesStatesPublishIntervalOverride, testResetValvesStatesPublishIntervalOverride ) - -/************************************************************************* + +/*********************************************************************//** * @brief - * The handleTestDGSafetyShutdownOverrideRequest function handles a \n + * The handleTestDGSafetyShutdownOverrideRequest function handles a * request to override the safety shutdown signal. * @details * Inputs : none @@ -1331,9 +1334,9 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDGSafetyShutdownOverrideRequest, testSetSafetyShutdownOverride, testResetSafetyShutdownOverride ) -/************************************************************************* +/*********************************************************************//** * @brief - * The handleTestDGAccelOverrideRequest function handles a request to \n + * The handleTestDGAccelOverrideRequest function handles a request to * override the measured accelerometer sensor readings. * @details * Inputs : none @@ -1343,9 +1346,9 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDGAccelOverrideRequest, testSetAccelAxisOverride, testResetAccelAxisOverride ) -/************************************************************************* +/*********************************************************************//** * @brief - * The handleTestDGAccelMaxOverrideRequest function handles a request to \n + * The handleTestDGAccelMaxOverrideRequest function handles a request to * override the measured accelerometer sensor maximum readings. * @details * Inputs : none @@ -1355,9 +1358,9 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDGAccelMaxOverrideRequest, testSetAccelMaxOverride, testResetAccelMaxOverride ) -/************************************************************************* +/*********************************************************************//** * @brief - * The handleTestDGAccelBroadcastIntervalOverrideRequest function handles a \n + * The handleTestDGAccelBroadcastIntervalOverrideRequest function handles a * request to override the broadcast interval for accelerometer data messages. * @details * Inputs : none @@ -1367,7 +1370,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDGAccelBroadcastIntervalOverrideRequest, testSetAccelDataPublishIntervalOverride, testResetAccelDataPublishIntervalOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetAccelCalibration function handles a request to set * accelerometer calibration factors. @@ -1393,7 +1396,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestSetConductivityOverrideRequest function handles a * request to override a conductivity sensor's value @@ -1405,7 +1408,7 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestSetConductivityOverrideRequest, testSetConductivityOverride, testResetConductivityOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestSetConductivityDataPublishIntervalOverrideRequest function * handles a request to override the publish interval of conductivity sensors data @@ -1417,3 +1420,5 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestSetConductivityDataPublishIntervalOverrideRequest, \ testSetConductivityDataPublishIntervalOverride, testResetConductivityDataPublishIntervalOverride ) + +/**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r92ec01cb48d91fe7315baa987e1aa051dd12df75 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -20,6 +20,14 @@ #include "DGCommon.h" #include "MsgQueues.h" + +/** + * @defgroup SystemCommMessages SystemCommMessages + * @brief System communication messages service module. Handles and broadcasts system messages. + * + * @addtogroup SystemCommMessages + * @{ + */ // ********** public definitions ********** @@ -186,4 +194,6 @@ // MSG_ID_DG_ACCEL_SET_CALIBRATION: void handleSetAccelCalibration( MESSAGE_T *message ); +/**@}*/ + #endif Index: firmware/App/Services/WatchdogMgmt.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -19,45 +19,51 @@ #include "SystemCommMessages.h" #include "Timers.h" #include "WatchdogMgmt.h" + +/** + * @addtogroup WatchdogMgmt + * @{ + */ // ********** private definitions ********** -#define MIN_WATCHDOG_PET_INTERVAL_MS 45 -#define WATCHDOG_POST_TIMEOUT_MS 100 -#define WATCHDOG_RECOVERY_TIME_MS 250 - +#define MIN_WATCHDOG_PET_INTERVAL_MS 45 ///< Minimum watchdog pet interval. +#define WATCHDOG_POST_TIMEOUT_MS 100 ///< Watchdog POST timeout in ms. +#define WATCHDOG_RECOVERY_TIME_MS 250 ///< Watchdog recovery time in ms. + +/// List of watchdog states. typedef enum Button_Self_Test_States { - WATCHDOG_SELF_TEST_STATE_START = 0, - WATCHDOG_SELF_TEST_STATE_IN_PROGRESS, - WATCHDOG_SELF_TEST_STATE_RECOVER, - WATCHDOG_SELF_TEST_STATE_COMPLETE, - NUM_OF_WATCHDOG_SELF_TEST_STATES + WATCHDOG_SELF_TEST_STATE_START = 0, ///< Watchdog self test state start + WATCHDOG_SELF_TEST_STATE_IN_PROGRESS, ///< watchdog self test state in progress + WATCHDOG_SELF_TEST_STATE_RECOVER, ///< Watchdog self test state recover + WATCHDOG_SELF_TEST_STATE_COMPLETE, ///< Watchdog self test state complete + NUM_OF_WATCHDOG_SELF_TEST_STATES ///< Number of watchdog self test states } WATCHDOG_SELF_TEST_STATE_T; // ********** private data ********** -static U32 lastWatchdogPetTime = 0; +static U32 lastWatchdogPetTime = 0; ///< Previous watchdog pet time. -DATA_ARRAY_DECL( BOOL, TaskCheckIns, NUM_OF_TASKS, watchdogTaskCheckedIn ); +DATA_ARRAY_DECL( BOOL, TaskCheckIns, NUM_OF_TASKS, watchdogTaskCheckedIn ); ///< Watchdog task check-in array. -static WATCHDOG_SELF_TEST_STATE_T watchdogSelfTestState = WATCHDOG_SELF_TEST_STATE_START; -static SELF_TEST_STATUS_T watchdogSelfTestStatus; -static U32 watchdogSelfTestTimerCount = 0; +static WATCHDOG_SELF_TEST_STATE_T watchdogSelfTestState; ///< Watchdog self test current state. +static SELF_TEST_STATUS_T watchdogSelfTestStatus; ///< Watchdog self test status. +static U32 watchdogSelfTestTimerCount = 0; ///< Watchdog self test timer count. // ********** private function prototypes ********** static void resetWDTaskCheckIns( void ); static BOOL haveAllTasksCheckedIn( void ); static void petWatchdog( void ); static DATA_ARRAY_GET_PROTOTYPE( BOOL, hasTaskGeneralCheckedIn, task ); - -/************************************************************************* + +/*********************************************************************//** * @brief initWatchdogMgmt - * The initWatchdogMgmt function initializes the watchdog mgmt. module. + * The initWatchdogMgmt function initializes the WatchdogMgmt module. * @details * Inputs : none - * Outputs : Watchdog mgmt. module initialized. + * Outputs : WatchdogMgmt module initialized. * @return none *************************************************************************/ void initWatchdogMgmt( void ) @@ -77,13 +83,13 @@ watchdogTaskCheckedIn[ i ].override = OVERRIDE_RESET; } } - -/************************************************************************* + +/*********************************************************************//** * @brief execWatchdogMgmt - * The execWatchdogMgmt function executes thewatchdog mgmt. service. + * The execWatchdogMgmt function executes the watchdog management service. * @details * Inputs : none - * Outputs : + * Outputs : Pets watchdog when all tasks checked in * @return none *************************************************************************/ void execWatchdogMgmt( void ) @@ -115,15 +121,15 @@ } } } - -/************************************************************************* + +/*********************************************************************//** * @brief checkInWithWatchdogMgmt - * The checkInWithWatchdogMgmt function checks a given task in with the \n - * watchdog mgmt. service. + * The checkInWithWatchdogMgmt function checks a given task in with the + * watchdog management service. * @details * Inputs : none - * Outputs : task is checked in with the watchdog mgmt.. - * @param task the task that is checking in with the watchdog mgmt + * Outputs : task is checked in with the watchdog management + * @param task the task that is checking in with the watchdog management * @return none *************************************************************************/ void checkInWithWatchdogMgmt( TASK_T task ) @@ -133,15 +139,14 @@ watchdogTaskCheckedIn[ task ].data = TRUE; } } - -/************************************************************************* + +/*********************************************************************//** * @brief execWatchdogTest - * The execWatchdogTest function executes the watchdog test. \n - * This function should be called periodically until a pass or fail \n - * result is returned. + * The execWatchdogTest function executes the watchdog test. This function + * should be called periodically until a pass or fail result is returned. * @details - * Inputs : - * Outputs : + * Inputs : watchdogSelfTestState + * Outputs : Executed watchdog self test * @return in progress, passed, or failed *************************************************************************/ SELF_TEST_STATUS_T execWatchdogTest( void ) @@ -195,8 +200,8 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief resetWDTaskCheckIns * The resetWDTaskCheckIns function resets the task check-ins with the watchdog. * @details @@ -214,10 +219,10 @@ watchdogTaskCheckedIn[ i ].data = FALSE; } } - -/************************************************************************* + +/*********************************************************************//** * @brief haveAllTasksCheckedIn - * The haveAllTasksCheckedIn function determines whether all tasks have /n + * The haveAllTasksCheckedIn function determines whether all tasks have * checked in with watchdog mgmt. * @details * Inputs : watchdogTaskCheckedIn[] @@ -241,23 +246,21 @@ return result; } - -/************************************************************************* + +/*********************************************************************//** * @brief hasTaskGeneralCheckedIn - * The hasTaskGeneralCheckedIn function gets the check-in state of a given /n - * task. + * The hasTaskGeneralCheckedIn function gets the check-in state of a given task. * @details * Inputs : watchdogTaskCheckedIn[] * Outputs : none * @param task ID of task to check * @return TRUE if given task has checked in, FALSE if not *************************************************************************/ static DATA_ARRAY_GET( BOOL, hasTaskGeneralCheckedIn, task, NUM_OF_TASKS-1, watchdogTaskCheckedIn, FALSE ) - -/************************************************************************* + +/*********************************************************************//** * @brief petWatchdog - * The petWatchdog function pets the watchdog by pulsing the CPLD WD pet /n - * signal. + * The petWatchdog function pets the watchdog by pulsing the CPLD WD pet signal. * @details * Inputs : none * Outputs : CPLD WD pet signal is pulsed @@ -277,12 +280,11 @@ * TEST SUPPORT FUNCTIONS *************************************************************************/ - -/************************************************************************* +/*********************************************************************//** * @brief testSetWatchdogTaskCheckInOverride and testResetWatchdogTaskCheckInOverride - * The testSetWatchdogTaskCheckInOverride function overrides the state of the \n - * task check-in with the watchdog management with a given check-in state. \n - * The testResetWatchdogTaskCheckInOverride function resets the override of the \n + * The testSetWatchdogTaskCheckInOverride function overrides the state of the + * task check-in with the watchdog management with a given check-in state. + * The testResetWatchdogTaskCheckInOverride function resets the override of the * state of the check-in with the watchdog management. * @details * Inputs : none @@ -292,3 +294,5 @@ * @return TRUE if override successful, FALSE if not *************************************************************************/ DATA_ARRAY_OVERRIDE_FUNC( BOOL, testSetWatchdogTaskCheckInOverride, testResetWatchdogTaskCheckInOverride, watchdogTaskCheckedIn, task, NUM_OF_TASKS-1 ) + +/**@}*/ Index: firmware/App/Services/WatchdogMgmt.h =================================================================== diff -u -ra7bf3ca23ea37a61000379facae628a31b3ecc59 -r5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1 --- firmware/App/Services/WatchdogMgmt.h (.../WatchdogMgmt.h) (revision a7bf3ca23ea37a61000379facae628a31b3ecc59) +++ firmware/App/Services/WatchdogMgmt.h (.../WatchdogMgmt.h) (revision 5e0cd9b5be11ff4b2acaadbdcafc4ffe05172aa1) @@ -19,16 +19,25 @@ #define __WATCHDOG_MGMT_H__ #include "DGCommon.h" + +/** + * @defgroup WatchdogMgmt WatchdogMgmt + * @brief Watchdog management service module. + * + * @addtogroup WatchdogMgmt + * @{ + */ // ********** public definitions ********** - + +/// List of tasks. typedef enum Tasks { - TASK_BG = 0, // Background - TASK_GENERAL, // General - TASK_PRIORITY, // Priority - TASK_TIMER, // Timer - NUM_OF_TASKS + TASK_BG = 0, ///< Background task + TASK_GENERAL, ///< General task + TASK_PRIORITY, ///< Priority task + TASK_TIMER, ///< Timer task + NUM_OF_TASKS ///< Number of tasks } TASK_T; // ********** public function prototypes ********** @@ -40,5 +49,7 @@ BOOL testSetWatchdogTaskCheckInOverride( U32 task, BOOL value ); BOOL testResetWatchdogTaskCheckInOverride( U32 task ); + +/**@}*/ #endif