Index: NVDataMgmt.c =================================================================== diff -u -r409e885c34d148bf23f9d6928befa0523202f547 -r2da9d757cef985b4ad1e8adee3e19fa3430cc4fb --- NVDataMgmt.c (.../NVDataMgmt.c) (revision 409e885c34d148bf23f9d6928befa0523202f547) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision 2da9d757cef985b4ad1e8adee3e19fa3430cc4fb) @@ -269,7 +269,7 @@ /*********************************************************************//** * @brief - * The initNVDataMgmt initializes the module. + * The initNVDataMgmt function initializes the module. * @details * Inputs: NVDataMgmtSelfTestState, NVDataMgmtExecState, NVDataMgmtSelfTestResult, * queueRearIndex, queueFrontIndex, queueCount Index: RTC.c =================================================================== diff -u -r409e885c34d148bf23f9d6928befa0523202f547 -r2da9d757cef985b4ad1e8adee3e19fa3430cc4fb --- RTC.c (.../RTC.c) (revision 409e885c34d148bf23f9d6928befa0523202f547) +++ RTC.c (.../RTC.c) (revision 2da9d757cef985b4ad1e8adee3e19fa3430cc4fb) @@ -127,7 +127,7 @@ RTC_SELF_TEST_STATE_CHECK_CTRL_REGS, ///< Self test check control registers RTC_SELF_TEST_STATE_WAIT_FOR_FIRST_SECOND, ///< Self test wait for first second RTC_SELF_TEST_STATE_WAIT_FOR_SECOND_SECOND, ///< Self test wait for second second - RTC_SELF_TEST_STATE_CHECK_ACCURACY, ///< Self test check time accuracy + RTC_SELF_TEST_STATE_CHECK_ACCURACY, ///< Self test check time accuracy (compare 1st to 2nd second vs. timer counter) RTC_SELF_TEST_STATE_COMPLETE, ///< Self test complete NUM_OF_RTC_SELF_TEST_STATES ///< Total number of self-test states } RTC_SELF_TEST_STATE_T; @@ -170,35 +170,35 @@ // ********** private data ********** -static RTC_SELF_TEST_STATE_T RTCSelfTestState = RTC_SELF_TEST_STATE_START; ///< Self test variable -static RTC_GET_DATA_STATE_T RTCServiceState = RTC_SEND_COMMAND; ///< RTC get data variable -static RTC_EXEC_STATE_T RTCExecState = RTC_EXEC_STATE_WAIT_FOR_POST; ///< RTC exec state variable -static SELF_TEST_STATUS_T RTCSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< RTC self-test status variable -static RTC_RAM_STATUS_T RTCRAMStatus = RTC_RAM_STATUS_IDLE; ///< RTC RAM status variable -static RTC_RAM_STATE_T RTCRAMState = RTC_RAM_STATE_READY; ///< RTC RAM state -static RTC_TIMESTAMP_T RTCTimestampStruct; ///< Timestamp struct -static RTC_TIMESTAMP_T RTCNewTimestampStruct; ///< New timestamp struct +static RTC_SELF_TEST_STATE_T RTCSelfTestState = RTC_SELF_TEST_STATE_START; ///< Self test variable. +static RTC_GET_DATA_STATE_T RTCServiceState = RTC_SEND_COMMAND; ///< RTC get data variable. +static RTC_EXEC_STATE_T RTCExecState = RTC_EXEC_STATE_WAIT_FOR_POST; ///< RTC exec state variable. +static SELF_TEST_STATUS_T RTCSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< RTC self-test status variable. +static RTC_RAM_STATUS_T RTCRAMStatus = RTC_RAM_STATUS_IDLE; ///< RTC RAM status variable. +static RTC_RAM_STATE_T RTCRAMState = RTC_RAM_STATE_READY; ///< RTC RAM state. +static RTC_TIMESTAMP_T RTCTimestampStruct; ///< Timestamp record - last read from RTC. +static RTC_TIMESTAMP_T RTCNewTimestampStruct; ///< New timestamp record that will hold the new time to be written to RTC. -static U32 RTCSelfTestTimer = 0; ///< Self test timer -static U32 RTCPreviousSecond = 0; ///< Previous second -static U32 RAMBufferLength = 0; ///< RAM buffer length -static U32 lastEpochTime = 0; ///< last epoch time -static U32 previousTransferLength = 0; ///< Previous transfer length +static U32 RTCSelfTestTimer = 0; ///< Self test timer. +static U32 RTCPreviousSecond = 0; ///< Previous second for self-test comparison. +static U32 RAMBufferLength = 0; ///< RAM buffer length for RAM operations. +static U32 lastEpochTime = 0; ///< last epoch time. +static U32 previousTransferLength = 0; ///< Previous transfer length. -static U32 timeCounter = 1; ///< Initial time counter (1) -static U32 numberOfFailedRTCTransfers = 1; ///< Initial number of failed RTC transactions (1) +static U32 timeCounter = 1; ///< Initial time counter (1). +static U32 numberOfFailedRTCTransfers = 1; ///< Initial number of failed RTC transactions (1). -static BOOL hasWriteToRTCRequested = FALSE; ///< Flag to request RTC write -static BOOL hasWriteToRAMRequested = FALSE; ///< Flag to write to RTC RAM -static BOOL hasReadFromRAMRequested = FALSE; ///< Flag to read from RTC RAM -static BOOL isRTCServiceOnEntry = FALSE; ///< Flag to check if service is on entry -static BOOL isTimestampBufferReady = FALSE; ///< Flag to check if the timestamp buffer is ready +static BOOL hasWriteToRTCRequested = FALSE; ///< Flag to request RTC write. +static BOOL hasWriteToRAMRequested = FALSE; ///< Flag to write to RTC RAM. +static BOOL hasReadFromRAMRequested = FALSE; ///< Flag to read from RTC RAM. +static BOOL isRTCServiceOnEntry = FALSE; ///< Flag to check if service is on entry. +static BOOL isTimestampBufferReady = FALSE; ///< Flag to check if the timestamp buffer is ready. -static U16 rxBuffer[ MIBSPI_MAX_BUFFER_LENGTH + 1 ]; ///< Buffer to receive data from RTC -static U16 txBuffer[ MIBSPI_MAX_BUFFER_LENGTH + 1 ]; ///< Buffer to transmit data to RTC +static U16 rxBuffer[ MIBSPI_MAX_BUFFER_LENGTH + 1 ]; ///< Buffer to receive data from RTC. +static U16 txBuffer[ MIBSPI_MAX_BUFFER_LENGTH + 1 ]; ///< Buffer to transmit data to RTC. -static U16 prepRAMBuffer[ RTC_RAM_PREP_BUFFER_LENGTH ]; ///< Buffer to send prep commands to RTC RAM -static U16 RAMBuffer[ MIBSPI_MAX_BUFFER_LENGTH ]; ///< Buffer to read RTC RAM data +static U16 prepRAMBuffer[ RTC_RAM_PREP_BUFFER_LENGTH ]; ///< Buffer to send prep read/write commands to RTC RAM. +static U16 RAMBuffer[ MIBSPI_MAX_BUFFER_LENGTH ]; ///< Buffer to read RTC RAM data. // ********** Private function prototypes ********* @@ -229,7 +229,7 @@ /*********************************************************************//** * @brief - * The initRTC initializes the RTC. + * The initRTC initializes the RTC module. * @details * Inputs: RTCSelfTestState, RTCSelfTestState * Outputs: RTCSelfTestState, RTCSelfTestState @@ -243,8 +243,8 @@ /*********************************************************************//** * @brief - * The setRTCTimestamp gets the timestamp values, converts them into BCD - * and inserts them into the txBuffer to be written into the RTC. + * The setRTCTimestamp gets the timestamp values from caller, converts them + * into BCD format and inserts them into the txBuffer to be written into the RTC. * @details * Inputs: RTCNewTimestampStruct, hasWriteToRTCRequested, isTimestampBufferReady * Outputs: RTCNewTimestampStruct, hasWriteToRTCRequested, isTimestampBufferReady @@ -358,7 +358,7 @@ /*********************************************************************//** * @brief - * The execRTC runs the RTC during normal operations. + * The execRTC function executes a signle pass of the RTC monitor state machine. * @details * Inputs: RTCExecState * Outputs: RTCExecState, alarm if invalid state was called @@ -417,7 +417,7 @@ /*********************************************************************//** * @brief - * The getRTCTimestamp returns the current time in epoch. + * The getRTCTimestamp returns the current time in epoch format. * @details * Inputs: lastEpochTime * Outputs: none @@ -547,7 +547,7 @@ /*********************************************************************//** * @brief - * The getRTCRAMStatus returns the RAM state. If the RAM status is complete + * The getRTCRAMStatus returns the RAM status. If the RAM status is complete * it will set the RAM status to Idle and the RAM state to Ready. * @details * Inputs: RTCRAMStatus, RTCRAMState @@ -568,7 +568,7 @@ /*********************************************************************//** * @brief * The getDataFromRAM populates the provided external buffer with the data - * in the specified address in the RAM. + * in the specified address in the RTC RAM. * @details * Inputs: RAMBuffer * Outputs: none @@ -585,8 +585,6 @@ } } -// ********** Private functions ********* - //TODO fill up the functions /*void mibspiNotification(mibspiBASE_t *mibspi, uint32 flags) { Index: RTC.h =================================================================== diff -u -r6c500be6ac0c5adffc0d91b666862e35ba27e2db -r2da9d757cef985b4ad1e8adee3e19fa3430cc4fb --- RTC.h (.../RTC.h) (revision 6c500be6ac0c5adffc0d91b666862e35ba27e2db) +++ RTC.h (.../RTC.h) (revision 2da9d757cef985b4ad1e8adee3e19fa3430cc4fb) @@ -33,19 +33,19 @@ typedef enum RTC_RAM_STATUS { RTC_RAM_STATUS_IDLE = 0, ///< Status idle - RTC_RAM_STATUS_IN_PROGRESS, ///< Status in progress - RTC_RAM_STATUS_BYTES_EXCEEDED, ///< Status bytes exceeded - RTC_RAM_STATUS_ILLEGAL_ADDRESS, ///< Status illegal address - RTC_RAM_STATUS_FAILED, ///< Status failed - RTC_RAM_STATUS_COMPLETE ///< Status complete + RTC_RAM_STATUS_IN_PROGRESS, ///< Status RAM operations are in progress + RTC_RAM_STATUS_BYTES_EXCEEDED, ///< Status number of bytes for last operation exceeded maximum + RTC_RAM_STATUS_ILLEGAL_ADDRESS, ///< Status address given for last operation invalid + RTC_RAM_STATUS_FAILED, ///< Status last operation failed + RTC_RAM_STATUS_COMPLETE ///< Status last operation completed } RTC_RAM_STATUS_T; /// RTC RAM states enumeration. typedef enum RTC_RAM_STATE { - RTC_RAM_STATE_READY = 0, ///< RAM ready - RTC_RAM_STATE_BUSY ///< RAM busy + RTC_RAM_STATE_READY = 0, ///< RTC RAM is ready for the next operation + RTC_RAM_STATE_BUSY ///< RTC RAM is busy } RTC_RAM_STATE_T;