LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
Data Structures | Macros | Enumerations | Functions
rtc_18xx_43xx.h File Reference

Go to the source code of this file.

Data Structures

struct  LPC_RTC_T
 Real Time Clock register block structure. More...
 
struct  LPC_REGFILE_T
 Register File register block structure. More...
 
struct  RTC_EV_TIMESTAMP_T
 Event Monitor/Recorder Timestamp structure. More...
 
struct  RTC_TIME_T
 

Macros

#define RTC_EV_SUPPORT   1 /* Event Monitor/Recorder support */
 
#define RTC_ILR_BITMASK   ((0x00000003))
 
#define RTC_IRL_RTCCIF   ((1 << 0))
 
#define RTC_IRL_RTCALF   ((1 << 1))
 
#define RTC_CCR_BITMASK   ((0x00000013))
 
#define RTC_CCR_CLKEN   ((1 << 0))
 
#define RTC_CCR_CTCRST   ((1 << 1))
 
#define RTC_CCR_CCALEN   ((1 << 4))
 
#define RTC_AMR_CIIR_IMSEC   ((1 << 0))
 
#define RTC_AMR_CIIR_IMMIN   ((1 << 1))
 
#define RTC_AMR_CIIR_IMHOUR   ((1 << 2))
 
#define RTC_AMR_CIIR_IMDOM   ((1 << 3))
 
#define RTC_AMR_CIIR_IMDOW   ((1 << 4))
 
#define RTC_AMR_CIIR_IMDOY   ((1 << 5))
 
#define RTC_AMR_CIIR_IMMON   ((1 << 6))
 
#define RTC_AMR_CIIR_IMYEAR   ((1 << 7))
 
#define RTC_AMR_CIIR_BITMASK   ((0xFF))
 
#define RTC_AUX_RTC_OSCF   ((1 << 4))
 
#define RTC_AUXEN_RTC_OSCFEN   ((1 << 4))
 
#define RTC_CTIME0_SECONDS_MASK   ((0x3F))
 
#define RTC_CTIME0_MINUTES_MASK   ((0x3F00))
 
#define RTC_CTIME0_HOURS_MASK   ((0x1F0000))
 
#define RTC_CTIME0_DOW_MASK   ((0x7000000))
 
#define RTC_CTIME1_DOM_MASK   ((0x1F))
 
#define RTC_CTIME1_MONTH_MASK   ((0xF00))
 
#define RTC_CTIME1_YEAR_MASK   ((0xFFF0000))
 
#define RTC_CTIME2_DOY_MASK   ((0xFFF))
 
#define RTC_SEC_MASK   (0x0000003F)
 
#define RTC_MIN_MASK   (0x0000003F)
 
#define RTC_HOUR_MASK   (0x0000001F)
 
#define RTC_DOM_MASK   (0x0000001F)
 
#define RTC_DOW_MASK   (0x00000007)
 
#define RTC_DOY_MASK   (0x000001FF)
 
#define RTC_MONTH_MASK   (0x0000000F)
 
#define RTC_YEAR_MASK   (0x00000FFF)
 
#define RTC_SECOND_MAX   59
 
#define RTC_MINUTE_MAX   59
 
#define RTC_HOUR_MAX   23
 
#define RTC_MONTH_MIN   1
 
#define RTC_MONTH_MAX   12
 
#define RTC_DAYOFMONTH_MIN   1
 
#define RTC_DAYOFMONTH_MAX   31
 
#define RTC_DAYOFWEEK_MAX   6
 
#define RTC_DAYOFYEAR_MIN   1
 
#define RTC_DAYOFYEAR_MAX   366
 
#define RTC_YEAR_MAX   4095
 
#define RTC_CALIBRATION_CALVAL_MASK   ((0x1FFFF))
 
#define RTC_CALIBRATION_LIBDIR   ((1 << 17))
 
#define RTC_CALIBRATION_MAX   ((0x20000))
 
#define RTC_CALIB_DIR_FORWARD   ((uint8_t) (0))
 
#define RTC_CALIB_DIR_BACKWARD   ((uint8_t) (1))
 
#define RTC_ERCTRL_BITMASK   ((uint32_t) 0xC0F03C0F)
 
#define RTC_ERCTRL_INTWAKE_EN   ((uint32_t) (1 << 0))
 
#define RTC_ERCTRL_GPCLEAR_EN   ((uint32_t) (1 << 1))
 
#define RTC_ERCTRL_POL_NEGATIVE   (0) /* Event as positive edge */
 
#define RTC_ERCTRL_POL_POSITIVE   ((uint32_t) (1 << 2)) /* Event as negative edge */
 
#define RTC_ERCTRL_INPUT_EN   ((uint32_t) (1 << 3))
 
#define RTC_ERCTRL_CHANNEL_CONFIG_BITMASK(ch)   ((uint32_t) (0x0F << (10 * ch)))
 
#define RTC_ERCTRL_CHANNEL_CONFIG(ch, flag)   ((uint32_t) (flag << (10 * ch)))
 
#define RTC_ERCTRL_MODE_MASK   (((uint32_t) 3) << 30)
 
#define RTC_ERCTRL_MODE_CLK_DISABLE   (((uint32_t) 0) << 30)
 
#define RTC_ERCTRL_MODE_16HZ   (((uint32_t) 1) << 30)
 
#define RTC_ERCTRL_MODE_64HZ   (((uint32_t) 2) << 30)
 
#define RTC_ERCTRL_MODE_1KHZ   (((uint32_t) 3) << 30)
 
#define RTC_ERCTRL_MODE(n)   (((uint32_t) n) << 30)
 
#define RTC_ERSTATUS_CHANNEL_EV(ch)   ((uint32_t) (1 << ch)) /* At least 1 event has occurred on a specific channel */
 
#define RTC_ERSTATUS_GPCLEARED   ((uint32_t) (1 << 3))
 
#define RTC_ERSTATUS_WAKEUP   ((uint32_t) (((uint32_t) 1) << 31))
 
#define RTC_ER_COUNTER(ch, n)   ((uint32_t) ((n >> (8 * ch)) & 0x07))
 
#define RTC_ER_TIMESTAMP_SEC(n)   ((uint32_t) (n & 0x3F))
 
#define RTC_ER_TIMESTAMP_MIN(n)   ((uint32_t) ((n >> 6) & 0x3F))
 
#define RTC_ER_TIMESTAMP_HOUR(n)   ((uint32_t) ((n >> 12) & 0x1F))
 
#define RTC_ER_TIMESTAMP_DOY(n)   ((uint32_t) ((n >> 17) & 0x1FF))
 

Enumerations

enum  RTC_TIMEINDEX_T {
  RTC_TIMETYPE_SECOND, RTC_TIMETYPE_MINUTE, RTC_TIMETYPE_HOUR, RTC_TIMETYPE_DAYOFMONTH,
  RTC_TIMETYPE_DAYOFWEEK, RTC_TIMETYPE_DAYOFYEAR, RTC_TIMETYPE_MONTH, RTC_TIMETYPE_YEAR,
  RTC_TIMETYPE_LAST
}
 RTC time type option. More...
 
enum  RTC_EV_CHANNEL_T { RTC_EV_CHANNEL_1 = 0, RTC_EV_CHANNEL_2, RTC_EV_CHANNEL_3, RTC_EV_CHANNEL_NUM }
 Event Channel Identifier definitions. More...
 
enum  RTC_EV_MODE_T {
  RTC_EV_MODE_DISABLE = 0, RTC_EV_MODE_ENABLE_16HZ = 1, RTC_EV_MODE_ENABLE_64HZ = 2, RTC_EV_MODE_ENABLE_1KHZ = 3,
  RTC_EV_MODE_LAST
}
 Event Monitor/Recorder Mode definition. More...
 
enum  RTC_INT_OPT_T { RTC_INT_COUNTER_INCREASE = RTC_IRL_RTCCIF, RTC_INT_ALARM = RTC_IRL_RTCALF }
 RTC enumeration. More...
 

Functions

void Chip_RTC_ResetClockTickCounter (LPC_RTC_T *pRTC)
 Reset clock tick counter in the RTC peripheral. More...
 
void Chip_RTC_Enable (LPC_RTC_T *pRTC, FunctionalState NewState)
 Start/Stop RTC peripheral. More...
 
void Chip_RTC_CntIncrIntConfig (LPC_RTC_T *pRTC, uint32_t cntrMask, FunctionalState NewState)
 Enable/Disable Counter increment interrupt for a time type in the RTC peripheral. More...
 
void Chip_RTC_AlarmIntConfig (LPC_RTC_T *pRTC, uint32_t alarmMask, FunctionalState NewState)
 Enable/Disable Alarm interrupt for a time type in the RTC peripheral. More...
 
STATIC INLINE void Chip_RTC_SetTime (LPC_RTC_T *pRTC, RTC_TIMEINDEX_T Timetype, uint32_t TimeValue)
 Set current time value for a time type in the RTC peripheral. More...
 
STATIC INLINE uint32_t Chip_RTC_GetTime (LPC_RTC_T *pRTC, RTC_TIMEINDEX_T Timetype)
 Get current time value for a type time type. More...
 
void Chip_RTC_SetFullTime (LPC_RTC_T *pRTC, RTC_TIME_T *pFullTime)
 Set full time in the RTC peripheral. More...
 
void Chip_RTC_GetFullTime (LPC_RTC_T *pRTC, RTC_TIME_T *pFullTime)
 Get full time from the RTC peripheral. More...
 
STATIC INLINE void Chip_RTC_SetAlarmTime (LPC_RTC_T *pRTC, RTC_TIMEINDEX_T Timetype, uint32_t ALValue)
 Set alarm time value for a time type. More...
 
STATIC INLINE uint32_t Chip_RTC_GetAlarmTime (LPC_RTC_T *pRTC, RTC_TIMEINDEX_T Timetype)
 Get alarm time value for a time type. More...
 
void Chip_RTC_SetFullAlarmTime (LPC_RTC_T *pRTC, RTC_TIME_T *pFullTime)
 Set full alarm time in the RTC peripheral. More...
 
void Chip_RTC_GetFullAlarmTime (LPC_RTC_T *pRTC, RTC_TIME_T *pFullTime)
 Get full alarm time in the RTC peripheral. More...
 
STATIC INLINE void Chip_REGFILE_Write (LPC_REGFILE_T *pRegFile, uint8_t index, uint32_t value)
 Write value to General purpose registers. More...
 
STATIC INLINE uint32_t Chip_REGFILE_Read (LPC_REGFILE_T *pRegFile, uint8_t index)
 Read value from General purpose registers. More...
 
void Chip_RTC_CalibCounterCmd (LPC_RTC_T *pRTC, FunctionalState NewState)
 Enable/Disable calibration counter in the RTC peripheral. More...
 
STATIC INLINE void Chip_RTC_CalibConfig (LPC_RTC_T *pRTC, uint32_t CalibValue, uint8_t CalibDir)
 Configures Calibration in the RTC peripheral. More...
 
STATIC INLINE void Chip_RTC_ClearIntPending (LPC_RTC_T *pRTC, uint32_t IntType)
 Clear specified Location interrupt pending in the RTC peripheral. More...
 
STATIC INLINE IntStatus Chip_RTC_GetIntPending (LPC_RTC_T *pRTC, uint32_t IntType)
 Check whether if specified location interrupt in the RTC peripheral is set or not. More...
 
STATIC INLINE void Chip_RTC_EV_Config (LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch, uint32_t flag)
 Configure a specific event channel. More...
 
STATIC INLINE void Chip_RTC_EV_SetMode (LPC_RTC_T *pRTC, RTC_EV_MODE_T mode)
 Enable/Disable and select clock frequency for Event Monitor/Recorder. More...
 
STATIC INLINE uint8_t Chip_RTC_EV_GetStatus (LPC_RTC_T *pRTC)
 Get Event Monitor/Recorder Status. More...
 
STATIC INLINE void Chip_RTC_EV_ClearStatus (LPC_RTC_T *pRTC, uint32_t flag)
 Clear Event Monitor/Recorder Status. More...
 
STATIC INLINE FlagStatus Chip_RTC_EV_GetChannelStatus (LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch)
 Get status of a specific event channel. More...
 
STATIC INLINE void Chip_RTC_EV_ClearChannelStatus (LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch)
 Clear status of a specific event channel. More...
 
STATIC INLINE uint8_t Chip_RTC_EV_GetCounter (LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch)
 Get counter value of a specific event channel. More...
 
void Chip_RTC_EV_GetFirstTimeStamp (LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch, RTC_EV_TIMESTAMP_T *pTimeStamp)
 Get first time stamp of a specific event channel. More...
 
void Chip_RTC_EV_GetLastTimeStamp (LPC_RTC_T *pRTC, RTC_EV_CHANNEL_T ch, RTC_EV_TIMESTAMP_T *pTimeStamp)
 Get last time stamp of a specific event channel. More...
 
void Chip_RTC_Init (LPC_RTC_T *pRTC)
 Initialize the RTC peripheral. More...
 
void Chip_RTC_DeInit (LPC_RTC_T *pRTC)
 De-initialize the RTC peripheral. More...