LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
Data Structures | Macros | Enumerations | Functions
CHIP: LPC18xx/43xx Real Time Clock driver

Detailed Description

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...
 

Macro Definition Documentation

#define RTC_AMR_CIIR_BITMASK   ((0xFF))

CIIR bit mask

Definition at line 147 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMDOM   ((1 << 3))

Counter Increment Interrupt bit for day of month

Definition at line 137 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMDOW   ((1 << 4))

Counter Increment Interrupt bit for day of week

Definition at line 139 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMDOY   ((1 << 5))

Counter Increment Interrupt bit for day of year

Definition at line 141 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMHOUR   ((1 << 2))

Counter Increment Interrupt bit for hour

Definition at line 135 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMMIN   ((1 << 1))

Counter Increment Interrupt bit for minute

Definition at line 133 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMMON   ((1 << 6))

Counter Increment Interrupt bit for month

Definition at line 143 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMSEC   ((1 << 0))

Counter Increment Interrupt bit for second

Definition at line 131 of file rtc_18xx_43xx.h.

#define RTC_AMR_CIIR_IMYEAR   ((1 << 7))

Counter Increment Interrupt bit for year

Definition at line 145 of file rtc_18xx_43xx.h.

#define RTC_AUX_RTC_OSCF   ((1 << 4))

RTC Oscillator Fail detect flag

Definition at line 153 of file rtc_18xx_43xx.h.

#define RTC_AUXEN_RTC_OSCFEN   ((1 << 4))

Oscillator Fail Detect interrupt enable

Definition at line 159 of file rtc_18xx_43xx.h.

#define RTC_CALIB_DIR_BACKWARD   ((uint8_t) (1))

Definition at line 224 of file rtc_18xx_43xx.h.

#define RTC_CALIB_DIR_FORWARD   ((uint8_t) (0))

Calibration definitions

Definition at line 223 of file rtc_18xx_43xx.h.

#define RTC_CALIBRATION_CALVAL_MASK   ((0x1FFFF))

Calibration value

Definition at line 217 of file rtc_18xx_43xx.h.

#define RTC_CALIBRATION_LIBDIR   ((1 << 17))

Calibration direction

Definition at line 219 of file rtc_18xx_43xx.h.

#define RTC_CALIBRATION_MAX   ((0x20000))

Calibration max value

Definition at line 221 of file rtc_18xx_43xx.h.

#define RTC_CCR_BITMASK   ((0x00000013))

CCR register mask

Definition at line 119 of file rtc_18xx_43xx.h.

#define RTC_CCR_CCALEN   ((1 << 4))

Calibration counter enable

Definition at line 125 of file rtc_18xx_43xx.h.

#define RTC_CCR_CLKEN   ((1 << 0))

Clock enable

Definition at line 121 of file rtc_18xx_43xx.h.

#define RTC_CCR_CTCRST   ((1 << 1))

Clock reset

Definition at line 123 of file rtc_18xx_43xx.h.

#define RTC_CTIME0_DOW_MASK   ((0x7000000))

Definition at line 167 of file rtc_18xx_43xx.h.

#define RTC_CTIME0_HOURS_MASK   ((0x1F0000))

Definition at line 166 of file rtc_18xx_43xx.h.

#define RTC_CTIME0_MINUTES_MASK   ((0x3F00))

Definition at line 165 of file rtc_18xx_43xx.h.

#define RTC_CTIME0_SECONDS_MASK   ((0x3F))

Definition at line 164 of file rtc_18xx_43xx.h.

#define RTC_CTIME1_DOM_MASK   ((0x1F))

Definition at line 172 of file rtc_18xx_43xx.h.

#define RTC_CTIME1_MONTH_MASK   ((0xF00))

Definition at line 173 of file rtc_18xx_43xx.h.

#define RTC_CTIME1_YEAR_MASK   ((0xFFF0000))

Definition at line 174 of file rtc_18xx_43xx.h.

#define RTC_CTIME2_DOY_MASK   ((0xFFF))

Definition at line 179 of file rtc_18xx_43xx.h.

#define RTC_DAYOFMONTH_MAX   31

Maximum value of day of month

Definition at line 207 of file rtc_18xx_43xx.h.

#define RTC_DAYOFMONTH_MIN   1

Minimum value of day of month

Definition at line 206 of file rtc_18xx_43xx.h.

#define RTC_DAYOFWEEK_MAX   6

Maximum value of day of week

Definition at line 208 of file rtc_18xx_43xx.h.

#define RTC_DAYOFYEAR_MAX   366

Maximum value of day of year

Definition at line 210 of file rtc_18xx_43xx.h.

#define RTC_DAYOFYEAR_MIN   1

Minimum value of day of year

Definition at line 209 of file rtc_18xx_43xx.h.

#define RTC_DOM_MASK   (0x0000001F)

DOM register mask

Definition at line 191 of file rtc_18xx_43xx.h.

#define RTC_DOW_MASK   (0x00000007)

DOW register mask

Definition at line 193 of file rtc_18xx_43xx.h.

#define RTC_DOY_MASK   (0x000001FF)

DOY register mask

Definition at line 195 of file rtc_18xx_43xx.h.

#define RTC_ER_COUNTER (   ch,
 
)    ((uint32_t) ((n >> (8 * ch)) & 0x07))

Value of the counter for Events occurred on a specific channel

Definition at line 267 of file rtc_18xx_43xx.h.

#define RTC_ER_TIMESTAMP_DOY (   n)    ((uint32_t) ((n >> 17) & 0x1FF))

Definition at line 275 of file rtc_18xx_43xx.h.

#define RTC_ER_TIMESTAMP_HOUR (   n)    ((uint32_t) ((n >> 12) & 0x1F))

Definition at line 274 of file rtc_18xx_43xx.h.

#define RTC_ER_TIMESTAMP_MIN (   n)    ((uint32_t) ((n >> 6) & 0x3F))

Definition at line 273 of file rtc_18xx_43xx.h.

#define RTC_ER_TIMESTAMP_SEC (   n)    ((uint32_t) (n & 0x3F))

Definition at line 272 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_BITMASK   ((uint32_t) 0xC0F03C0F)

Event Monitor/Recorder Control register mask

Definition at line 231 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_CHANNEL_CONFIG (   ch,
  flag 
)    ((uint32_t) (flag << (10 * ch)))

Definition at line 243 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_CHANNEL_CONFIG_BITMASK (   ch)    ((uint32_t) (0x0F << (10 * ch)))

Configure a specific channel

Definition at line 242 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_GPCLEAR_EN   ((uint32_t) (1 << 1))

Enables automatically clearing the RTC general purpose registers when an event occurs

Definition at line 235 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_INPUT_EN   ((uint32_t) (1 << 3))

Enable event input.

Definition at line 240 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_INTWAKE_EN   ((uint32_t) (1 << 0))

Enable event interrupt and wakeup

Definition at line 233 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_MODE (   n)    (((uint32_t) n) << 30)

Definition at line 251 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_MODE_16HZ   (((uint32_t) 1) << 30)

Definition at line 248 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_MODE_1KHZ   (((uint32_t) 3) << 30)

Definition at line 250 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_MODE_64HZ   (((uint32_t) 2) << 30)

Definition at line 249 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_MODE_CLK_DISABLE   (((uint32_t) 0) << 30)

Definition at line 247 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_MODE_MASK   (((uint32_t) 3) << 30)

Enable Event Monitor/Recorder and select its operating frequency.

Definition at line 246 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_POL_NEGATIVE   (0) /* Event as positive edge */

Select polarity for a channel event on the input pin.

Definition at line 237 of file rtc_18xx_43xx.h.

#define RTC_ERCTRL_POL_POSITIVE   ((uint32_t) (1 << 2)) /* Event as negative edge */

Definition at line 238 of file rtc_18xx_43xx.h.

#define RTC_ERSTATUS_CHANNEL_EV (   ch)    ((uint32_t) (1 << ch)) /* At least 1 event has occurred on a specific channel */

Event Flag for a specific channel

Definition at line 257 of file rtc_18xx_43xx.h.

#define RTC_ERSTATUS_GPCLEARED   ((uint32_t) (1 << 3))

General purpose registers have been asynchronous cleared.

Definition at line 259 of file rtc_18xx_43xx.h.

#define RTC_ERSTATUS_WAKEUP   ((uint32_t) (((uint32_t) 1) << 31))

An interrupt/wakeup request is pending.

Definition at line 261 of file rtc_18xx_43xx.h.

#define RTC_EV_SUPPORT   1 /* Event Monitor/Recorder support */

Definition at line 44 of file rtc_18xx_43xx.h.

#define RTC_HOUR_MASK   (0x0000001F)

HOUR register mask

Definition at line 189 of file rtc_18xx_43xx.h.

#define RTC_HOUR_MAX   23

Maximum value of hour

Definition at line 203 of file rtc_18xx_43xx.h.

#define RTC_ILR_BITMASK   ((0x00000003))

ILR register mask

Definition at line 109 of file rtc_18xx_43xx.h.

#define RTC_IRL_RTCALF   ((1 << 1))

Bit inform the source interrupt is alarm match

Definition at line 113 of file rtc_18xx_43xx.h.

#define RTC_IRL_RTCCIF   ((1 << 0))

Bit inform the source interrupt is counter increment

Definition at line 111 of file rtc_18xx_43xx.h.

#define RTC_MIN_MASK   (0x0000003F)

MIN register mask

Definition at line 187 of file rtc_18xx_43xx.h.

#define RTC_MINUTE_MAX   59

Maximum value of minute

Definition at line 202 of file rtc_18xx_43xx.h.

#define RTC_MONTH_MASK   (0x0000000F)

MONTH register mask

Definition at line 197 of file rtc_18xx_43xx.h.

#define RTC_MONTH_MAX   12

Maximum value of month

Definition at line 205 of file rtc_18xx_43xx.h.

#define RTC_MONTH_MIN   1

Minimum value of month

Definition at line 204 of file rtc_18xx_43xx.h.

#define RTC_SEC_MASK   (0x0000003F)

SEC register mask

Definition at line 185 of file rtc_18xx_43xx.h.

#define RTC_SECOND_MAX   59

Maximum value of second

Definition at line 201 of file rtc_18xx_43xx.h.

#define RTC_YEAR_MASK   (0x00000FFF)

YEAR register mask

Definition at line 199 of file rtc_18xx_43xx.h.

#define RTC_YEAR_MAX   4095

Maximum value of year

Definition at line 211 of file rtc_18xx_43xx.h.

Enumeration Type Documentation

Event Channel Identifier definitions.

Enumerator
RTC_EV_CHANNEL_1 
RTC_EV_CHANNEL_2 
RTC_EV_CHANNEL_3 
RTC_EV_CHANNEL_NUM 

Definition at line 65 of file rtc_18xx_43xx.h.

Event Monitor/Recorder Mode definition.

Enumerator
RTC_EV_MODE_DISABLE 

Event Monitor/Recoder is disabled

RTC_EV_MODE_ENABLE_16HZ 

Event Monitor/Recoder is enabled and use 16Hz sample clock for event input

RTC_EV_MODE_ENABLE_64HZ 

Event Monitor/Recoder is enabled and use 64Hz sample clock for event input

RTC_EV_MODE_ENABLE_1KHZ 

Event Monitor/Recoder is enabled and use 1kHz sample clock for event input

RTC_EV_MODE_LAST 

Definition at line 280 of file rtc_18xx_43xx.h.

RTC enumeration.

RTC interrupt source

Enumerator
RTC_INT_COUNTER_INCREASE 

Counter Increment Interrupt

RTC_INT_ALARM 

The alarm interrupt

Definition at line 305 of file rtc_18xx_43xx.h.

RTC time type option.

Enumerator
RTC_TIMETYPE_SECOND 

Second

RTC_TIMETYPE_MINUTE 

Month

RTC_TIMETYPE_HOUR 

Hour

RTC_TIMETYPE_DAYOFMONTH 

Day of month

RTC_TIMETYPE_DAYOFWEEK 

Day of week

RTC_TIMETYPE_DAYOFYEAR 

Day of year

RTC_TIMETYPE_MONTH 

Month

RTC_TIMETYPE_YEAR 

Year

RTC_TIMETYPE_LAST 

Definition at line 49 of file rtc_18xx_43xx.h.

Function Documentation

STATIC INLINE uint32_t Chip_REGFILE_Read ( LPC_REGFILE_T pRegFile,
uint8_t  index 
)

Read value from General purpose registers.

Parameters
pRegFile: RegFile peripheral selected
index: General purpose register index
Returns
Read Value
Note
These General purpose registers can be used to store important information when the main power supply is off. The value in these registers is not affected by chip reset. These registers are powered in the RTC power domain.

Definition at line 453 of file rtc_18xx_43xx.h.

STATIC INLINE void Chip_REGFILE_Write ( LPC_REGFILE_T pRegFile,
uint8_t  index,
uint32_t  value 
)

Write value to General purpose registers.

Parameters
pRegFile: RegFile peripheral selected
index: General purpose register index
value: Value to write
Returns
None
Note
These General purpose registers can be used to store important information when the main power supply is off. The value in these registers is not affected by chip reset. These registers are powered in the RTC power domain.

Definition at line 438 of file rtc_18xx_43xx.h.

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.

Parameters
pRTC: RTC peripheral selected
alarmMask: Or'ed bit values for ALARM types (RTC_AMR_CIIR_IM*)
NewState: ENABLE or DISABLE
Returns
None

Definition at line 120 of file rtc_18xx_43xx.c.

STATIC INLINE void Chip_RTC_CalibConfig ( LPC_RTC_T pRTC,
uint32_t  CalibValue,
uint8_t  CalibDir 
)

Configures Calibration in the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
CalibValue: Calibration value, should be in range from 0 to 131,072
CalibDir: Calibration Direction, should be:
  • RTC_CALIB_DIR_FORWARD :Forward calibration
  • RTC_CALIB_DIR_BACKWARD :Backward calibration
Returns
None

Definition at line 477 of file rtc_18xx_43xx.h.

void Chip_RTC_CalibCounterCmd ( LPC_RTC_T pRTC,
FunctionalState  NewState 
)

Enable/Disable calibration counter in the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
NewState: New State of this function, should be:
  • ENABLE :The calibration counter is enabled and counting
  • DISABLE :The calibration counter is disabled and reset to zero
Returns
None

Definition at line 188 of file rtc_18xx_43xx.c.

STATIC INLINE void Chip_RTC_ClearIntPending ( LPC_RTC_T pRTC,
uint32_t  IntType 
)

Clear specified Location interrupt pending in the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
IntType: Interrupt location type, should be:
  • RTC_INT_COUNTER_INCREASE :Clear Counter Increment Interrupt pending.
  • RTC_INT_ALARM :Clear alarm interrupt pending
Returns
None

Definition at line 491 of file rtc_18xx_43xx.h.

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.

Parameters
pRTC: RTC peripheral selected
cntrMask: Or'ed bit values for time types (RTC_AMR_CIIR_IM*)
NewState: ENABLE or DISABLE
Returns
None

Definition at line 107 of file rtc_18xx_43xx.c.

void Chip_RTC_DeInit ( LPC_RTC_T pRTC)

De-initialize the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
Returns
None

Definition at line 79 of file rtc_18xx_43xx.c.

void Chip_RTC_Enable ( LPC_RTC_T pRTC,
FunctionalState  NewState 
)

Start/Stop RTC peripheral.

Parameters
pRTC: RTC peripheral selected
NewState: New State of this function, should be:
  • ENABLE :The time counters are enabled
  • DISABLE :The time counters are disabled
Returns
None

Definition at line 97 of file rtc_18xx_43xx.c.

STATIC INLINE void Chip_RTC_EV_ClearChannelStatus ( LPC_RTC_T pRTC,
RTC_EV_CHANNEL_T  ch 
)

Clear status of a specific event channel.

Parameters
pRTC: RTC peripheral selected
ch: Channel number
Returns
Nothing.

Definition at line 580 of file rtc_18xx_43xx.h.

STATIC INLINE void Chip_RTC_EV_ClearStatus ( LPC_RTC_T pRTC,
uint32_t  flag 
)

Clear Event Monitor/Recorder Status.

Parameters
pRTC: RTC peripheral selected
flag: Or-ed bit value of RTC_ERSTATUS_GPCLEARED and RTC_ERSTATUS_WAKEUP
Returns
Nothing

Definition at line 558 of file rtc_18xx_43xx.h.

STATIC INLINE void Chip_RTC_EV_Config ( LPC_RTC_T pRTC,
RTC_EV_CHANNEL_T  ch,
uint32_t  flag 
)

Configure a specific event channel.

Parameters
pRTC: RTC peripheral selected
ch: Channel number
flag: Configuration flag
Returns
None
Note
flag is or-ed bit value of RTC_ERCTRL_INTWAKE_EN,RTC_ERCTRL_GPCLEAR_EN, RTC_ERCTRL_POL_POSITIVE and RTC_ERCTRL_INPUT_EN.

Definition at line 520 of file rtc_18xx_43xx.h.

STATIC INLINE FlagStatus Chip_RTC_EV_GetChannelStatus ( LPC_RTC_T pRTC,
RTC_EV_CHANNEL_T  ch 
)

Get status of a specific event channel.

Parameters
pRTC: RTC peripheral selected
ch: Channel number
Returns
SET (At least 1 event occurred on the channel), RESET: no event occured.

Definition at line 569 of file rtc_18xx_43xx.h.

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.

Parameters
pRTC: RTC peripheral selected
ch: Channel number
Returns
counter value

Definition at line 591 of file rtc_18xx_43xx.h.

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.

Parameters
pRTC: RTC peripheral selected
ch: Channel number
pTimeStamp: pointer to Timestamp buffer
Returns
Nothing.
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.

Parameters
pRTC: RTC peripheral selected
ch: Channel number
pTimeStamp: pointer to Timestamp buffer
Returns
Nothing.
STATIC INLINE uint8_t Chip_RTC_EV_GetStatus ( LPC_RTC_T pRTC)

Get Event Monitor/Recorder Status.

Parameters
pRTC: RTC peripheral selected
Returns
Or-ed bit value of RTC_ERSTATUS_GPCLEARED and RTC_ERSTATUS_WAKEUP

Definition at line 547 of file rtc_18xx_43xx.h.

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.

Parameters
pRTC: RTC peripheral selected
mode: selected mode
Returns
None

Definition at line 534 of file rtc_18xx_43xx.h.

STATIC INLINE uint32_t Chip_RTC_GetAlarmTime ( LPC_RTC_T pRTC,
RTC_TIMEINDEX_T  Timetype 
)

Get alarm time value for a time type.

Parameters
pRTC: RTC peripheral selected
Timetype: Time index field to get
Returns
Value of Alarm time according to specified time type

Definition at line 406 of file rtc_18xx_43xx.h.

void Chip_RTC_GetFullAlarmTime ( LPC_RTC_T pRTC,
RTC_TIME_T pFullTime 
)

Get full alarm time in the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
pFullTime: Pointer to full time record to fill
Returns
None

Definition at line 178 of file rtc_18xx_43xx.c.

void Chip_RTC_GetFullTime ( LPC_RTC_T pRTC,
RTC_TIME_T pFullTime 
)

Get full time from the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
pFullTime: Pointer to full time record to fill
Returns
None

Definition at line 152 of file rtc_18xx_43xx.c.

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.

Parameters
pRTC: RTC peripheral selected
IntType: Interrupt location type, should be:
  • RTC_INT_COUNTER_INCREASE: Counter Increment Interrupt block generated an interrupt.
  • RTC_INT_ALARM: Alarm generated an interrupt.
Returns
New state of specified Location interrupt in RTC peripheral, SET OR RESET

Definition at line 504 of file rtc_18xx_43xx.h.

STATIC INLINE uint32_t Chip_RTC_GetTime ( LPC_RTC_T pRTC,
RTC_TIMEINDEX_T  Timetype 
)

Get current time value for a type time type.

Parameters
pRTC: RTC peripheral selected
Timetype: Time field index type to get
Returns
Value of time field according to specified time type

Definition at line 367 of file rtc_18xx_43xx.h.

void Chip_RTC_Init ( LPC_RTC_T pRTC)

Initialize the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
Returns
None

Definition at line 51 of file rtc_18xx_43xx.c.

void Chip_RTC_ResetClockTickCounter ( LPC_RTC_T pRTC)

Reset clock tick counter in the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
Returns
None

Definition at line 85 of file rtc_18xx_43xx.c.

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.

Parameters
pRTC: RTC peripheral selected
Timetype: Time index field to set
ALValue: Alarm time value to set
Returns
None

Definition at line 395 of file rtc_18xx_43xx.h.

void Chip_RTC_SetFullAlarmTime ( LPC_RTC_T pRTC,
RTC_TIME_T pFullTime 
)

Set full alarm time in the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
pFullTime: Pointer to full time record to set alarm
Returns
None

Definition at line 168 of file rtc_18xx_43xx.c.

void Chip_RTC_SetFullTime ( LPC_RTC_T pRTC,
RTC_TIME_T pFullTime 
)

Set full time in the RTC peripheral.

Parameters
pRTC: RTC peripheral selected
pFullTime: Pointer to full time data
Returns
None

Definition at line 132 of file rtc_18xx_43xx.c.

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.

Parameters
pRTC: RTC peripheral selected
Timetype: time field index type to set
TimeValue: Value to palce in time field
Returns
None

Definition at line 356 of file rtc_18xx_43xx.h.