/************************************************************************** * * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file RTC.h * * @author (last) Michael Garthwaite * @date (last) 01-Feb-2023 * * @author (original) Dara Navaei * @date (original) 11-Jan-2020 * ***************************************************************************/ #ifndef _RTC_H_ #define _RTC_H_ #include "Common.h" /** * @defgroup RTC RTC * @brief Real time clock module. This module controls the clock and * the RAM of the RTC chip * * @addtogroup RTC * @{ */ // ********** public definitions ********** /// RTC RAM status enumeration. typedef enum RTC_RAM_STATUS { RTC_RAM_STATUS_IDLE = 0, ///< Status idle 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, ///< RTC RAM is ready for the next operation RTC_RAM_STATE_BUSY ///< RTC RAM is busy } RTC_RAM_STATE_T; /// Real time clock data structure typedef struct { U32 epochTime; ///< Epoch time } RTC_DATA_T; // ********** public function prototypes ********** void initRTC( void ); void execRTC( void ); BOOL setRTCTimestamp( U08 secs, U08 mins, U08 hours, U08 days, U08 months, U32 years ); BOOL setRTCEpoch( U32 epoch ); U32 getRTCTimestamp( void ); void resetRTCPOSTState( void ); #ifdef _DG_ void signalSyncToHD( void ); BOOL syncDG2HDDateTime( void ); #endif SELF_TEST_STATUS_T execRTCSelfTest( void ); RTC_RAM_STATUS_T writeToRAM( U32 address, U08* data, U32 length ); RTC_RAM_STATUS_T readFromRAM( U32 address, U32 length ); RTC_RAM_STATUS_T getRTCRAMStatus( void ); RTC_RAM_STATE_T getRTCRAMState( void ); void getDataFromRAM( U08* externalBuffer, U32 length ); BOOL testSetStopRTC( void ); BOOL testSetRTCCtlReg1Status( U32 status ); BOOL testResetRTCCtlReg1Status( void ); BOOL testSetRTCCtlReg3Status( U32 status ); BOOL testResetRTCCtlReg3Status( void ); /**@}*/ #endif