| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
IP: RTC register block and driver
IP drivers: Common drivers used on multiple NXP devices

## Detailed Description

Real Time Clock

## Data Structures
struct | IP_RTC_001_T
| Real Time Clock register block structure. More...
struct | IP_RTC_TIME_T

## Macros
#define | RTC_ILR_BITMASK ((0x00000003))
| ILR register definitions.
#define | RTC_IRL_RTCCIF ((1 << 0))
#define | RTC_IRL_RTCALF ((1 << 1))
#define | RTC_CCR_BITMASK ((0x00000013))
| CCR register definitions.
#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))
| CIIR and AMR register definitions.
#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))
| RTC_AUX register definitions.
#define | RTC_AUXEN_RTC_OSCFEN ((1 << 4))
| RTC_AUXEN register definitions.
#define | RTC_CTIME0_SECONDS_MASK ((0x3F))
| Consolidated Time Register 0 definitions.
#define | RTC_CTIME0_MINUTES_MASK ((0x3F00))
#define | RTC_CTIME0_HOURS_MASK ((0x1F0000))
#define | RTC_CTIME0_DOW_MASK ((0x7000000))
#define | RTC_CTIME1_DOM_MASK ((0x1F))
| Consolidated Time Register 1 definitions.
#define | RTC_CTIME1_MONTH_MASK ((0xF00))
#define | RTC_CTIME1_YEAR_MASK ((0xFFF0000))
#define | RTC_CTIME2_DOY_MASK ((0xFFF))
| Consolidated Time Register 2 definitions.
#define | RTC_SEC_MASK (0x0000003F)
| Time Counter Group and Alarm register group.
#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))
| Calibration register.
#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))

## Enumerations
enum | IP_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 | IP_RTC_INT_OPT_T { RTC_INT_COUNTER_INCREASE = RTC_IRL_RTCCIF, RTC_INT_ALARM = RTC_IRL_RTCALF }
| RTC enumeration. More...

## Functions
void | IP_RTC_Init (IP_RTC_001_T *pRTC)
| Initialize the RTC peripheral.
STATIC INLINE void | IP_RTC_DeInit (IP_RTC_001_T *pRTC)
| De-initialize the RTC peripheral.
void | IP_RTC_ResetClockTickCounter (IP_RTC_001_T *pRTC)
| Reset clock tick counter in the RTC peripheral.
void | IP_RTC_Enable (IP_RTC_001_T *pRTC, FunctionalState NewState)
| Start/Stop RTC peripheral.
void | IP_RTC_CntIncrIntConfig (IP_RTC_001_T *pRTC, uint32_t cntrMask, FunctionalState NewState)
| Enable/Disable Counter increment interrupt for a time type in the RTC peripheral.
void | IP_RTC_AlarmIntConfig (IP_RTC_001_T *pRTC, uint32_t alarmMask, FunctionalState NewState)
| Enable/Disable Alarm interrupt for a time type in the RTC peripheral.
void | IP_RTC_SetTime (IP_RTC_001_T *pRTC, IP_RTC_TIMEINDEX_T Timetype, uint32_t TimeValue)
| Set current time value for a time type in the RTC peripheral.
uint32_t | IP_RTC_GetTime (IP_RTC_001_T *pRTC, IP_RTC_TIMEINDEX_T Timetype)
| Get current time value for a type time type.
void | IP_RTC_SetFullTime (IP_RTC_001_T *pRTC, IP_RTC_TIME_T *pFullTime)
| Set full time in the RTC peripheral.
void | IP_RTC_GetFullTime (IP_RTC_001_T *pRTC, IP_RTC_TIME_T *pFullTime)
| Get full time from the RTC peripheral.
void | IP_RTC_SetAlarmTime (IP_RTC_001_T *pRTC, IP_RTC_TIMEINDEX_T Timetype, uint32_t ALValue)
| Set alarm time value for a time type.
uint32_t | IP_RTC_GetAlarmTime (IP_RTC_001_T *pRTC, IP_RTC_TIMEINDEX_T Timetype)
| Get alarm time value for a time type.
void | IP_RTC_SetFullAlarmTime (IP_RTC_001_T *pRTC, IP_RTC_TIME_T *pFullTime)
| Set full alarm time in the RTC peripheral.
void | IP_RTC_GetFullAlarmTime (IP_RTC_001_T *pRTC, IP_RTC_TIME_T *pFullTime)
| Get full alarm time in the RTC peripheral.
void | IP_RTC_CalibCounterCmd (IP_RTC_001_T *pRTC, FunctionalState NewState)
| Enable/Disable calibration counter in the RTC peripheral.
void | IP_RTC_CalibConfig (IP_RTC_001_T *pRTC, uint32_t CalibValue, uint8_t CalibDir)
| Configures Calibration in the RTC peripheral.
STATIC INLINE void | IP_RTC_ClearIntPending (IP_RTC_001_T *pRTC, uint32_t IntType)
| Clear specified Location interrupt pending in the RTC peripheral.
STATIC INLINE IntStatus | IP_RTC_GetIntPending (IP_RTC_001_T *pRTC, uint32_t IntType)
| Check whether if specified location interrupt in the RTC peripheral is set or not.

## Macro Definition Documentation

#define RTC_AMR_CIIR_BITMASK ((0xFF))

CIIR bit mask

Definition at line 151 of file rtc_001.h.

#define RTC_AMR_CIIR_IMDOM ((1 << 3))

Counter Increment Interrupt bit for day of month

Definition at line 141 of file rtc_001.h.

#define RTC_AMR_CIIR_IMDOW ((1 << 4))

Counter Increment Interrupt bit for day of week

Definition at line 143 of file rtc_001.h.

#define RTC_AMR_CIIR_IMDOY ((1 << 5))

Counter Increment Interrupt bit for day of year

Definition at line 145 of file rtc_001.h.

#define RTC_AMR_CIIR_IMHOUR ((1 << 2))

Counter Increment Interrupt bit for hour

Definition at line 139 of file rtc_001.h.

#define RTC_AMR_CIIR_IMMIN ((1 << 1))

Counter Increment Interrupt bit for minute

Definition at line 137 of file rtc_001.h.

#define RTC_AMR_CIIR_IMMON ((1 << 6))

Counter Increment Interrupt bit for month

Definition at line 147 of file rtc_001.h.

#define RTC_AMR_CIIR_IMSEC ((1 << 0))

CIIR and AMR register definitions.

Counter Increment Interrupt bit for second

Definition at line 135 of file rtc_001.h.

#define RTC_AMR_CIIR_IMYEAR ((1 << 7))

Counter Increment Interrupt bit for year

Definition at line 149 of file rtc_001.h.

#define RTC_AUX_RTC_OSCF ((1 << 4))

RTC_AUX register definitions.

RTC Oscillator Fail detect flag

Definition at line 157 of file rtc_001.h.

#define RTC_AUXEN_RTC_OSCFEN ((1 << 4))

RTC_AUXEN register definitions.

Oscillator Fail Detect interrupt enable

Definition at line 167 of file rtc_001.h.

#define RTC_CALIB_DIR_BACKWARD ((uint8_t) (1))

Definition at line 232 of file rtc_001.h.

#define RTC_CALIB_DIR_FORWARD ((uint8_t) (0))

Calibration definitions

Definition at line 231 of file rtc_001.h.

#define RTC_CALIBRATION_CALVAL_MASK ((0x1FFFF))

Calibration register.

Calibration value

Definition at line 225 of file rtc_001.h.

#define RTC_CALIBRATION_LIBDIR ((1 << 17))

Calibration direction

Definition at line 227 of file rtc_001.h.

#define RTC_CALIBRATION_MAX ((0x20000))

Calibration max value

Definition at line 229 of file rtc_001.h.

#define RTC_CCR_BITMASK ((0x00000013))

CCR register definitions.

CCR register mask

Definition at line 123 of file rtc_001.h.

#define RTC_CCR_CCALEN ((1 << 4))

Calibration counter enable

Definition at line 129 of file rtc_001.h.

#define RTC_CCR_CLKEN ((1 << 0))

Clock enable

Definition at line 125 of file rtc_001.h.

#define RTC_CCR_CTCRST ((1 << 1))

Clock reset

Definition at line 127 of file rtc_001.h.

#define RTC_CTIME0_DOW_MASK ((0x7000000))

Definition at line 175 of file rtc_001.h.

#define RTC_CTIME0_HOURS_MASK ((0x1F0000))

Definition at line 174 of file rtc_001.h.

#define RTC_CTIME0_MINUTES_MASK ((0x3F00))

Definition at line 173 of file rtc_001.h.

#define RTC_CTIME0_SECONDS_MASK ((0x3F))

Consolidated Time Register 0 definitions.

Definition at line 172 of file rtc_001.h.

#define RTC_CTIME1_DOM_MASK ((0x1F))

Consolidated Time Register 1 definitions.

Definition at line 180 of file rtc_001.h.

#define RTC_CTIME1_MONTH_MASK ((0xF00))

Definition at line 181 of file rtc_001.h.

#define RTC_CTIME1_YEAR_MASK ((0xFFF0000))

Definition at line 182 of file rtc_001.h.

#define RTC_CTIME2_DOY_MASK ((0xFFF))

Consolidated Time Register 2 definitions.

Definition at line 187 of file rtc_001.h.

#define RTC_DAYOFMONTH_MAX 31

Maximum value of day of month

Definition at line 215 of file rtc_001.h.

#define RTC_DAYOFMONTH_MIN 1

Minimum value of day of month

Definition at line 214 of file rtc_001.h.

#define RTC_DAYOFWEEK_MAX 6

Maximum value of day of week

Definition at line 216 of file rtc_001.h.

#define RTC_DAYOFYEAR_MAX 366

Maximum value of day of year

Definition at line 218 of file rtc_001.h.

#define RTC_DAYOFYEAR_MIN 1

Minimum value of day of year

Definition at line 217 of file rtc_001.h.

#define RTC_DOM_MASK (0x0000001F)

DOM register mask

Definition at line 199 of file rtc_001.h.

#define RTC_DOW_MASK (0x00000007)

DOW register mask

Definition at line 201 of file rtc_001.h.

#define RTC_DOY_MASK (0x000001FF)

DOY register mask

Definition at line 203 of file rtc_001.h.

#define RTC_HOUR_MASK (0x0000001F)

HOUR register mask

Definition at line 197 of file rtc_001.h.

#define RTC_HOUR_MAX 23

Maximum value of hour

Definition at line 211 of file rtc_001.h.

#define RTC_ILR_BITMASK ((0x00000003))

ILR register definitions.

ILR register mask

Definition at line 113 of file rtc_001.h.

#define RTC_IRL_RTCALF ((1 << 1))

Bit inform the source interrupt is alarm match

Definition at line 117 of file rtc_001.h.

#define RTC_IRL_RTCCIF ((1 << 0))

Bit inform the source interrupt is counter increment

Definition at line 115 of file rtc_001.h.

#define RTC_MIN_MASK (0x0000003F)

MIN register mask

Definition at line 195 of file rtc_001.h.

#define RTC_MINUTE_MAX 59

Maximum value of minute

Definition at line 210 of file rtc_001.h.

#define RTC_MONTH_MASK (0x0000000F)

MONTH register mask

Definition at line 205 of file rtc_001.h.

#define RTC_MONTH_MAX 12

Maximum value of month

Definition at line 213 of file rtc_001.h.

#define RTC_MONTH_MIN 1

Minimum value of month

Definition at line 212 of file rtc_001.h.

#define RTC_SEC_MASK (0x0000003F)

Time Counter Group and Alarm register group.

SEC register mask

Definition at line 193 of file rtc_001.h.

#define RTC_SECOND_MAX 59

Maximum value of second

Definition at line 209 of file rtc_001.h.

#define RTC_YEAR_MASK (0x00000FFF)

YEAR register mask

Definition at line 207 of file rtc_001.h.

#define RTC_YEAR_MAX 4095

Maximum value of year

Definition at line 219 of file rtc_001.h.

## Enumeration Type Documentation

enum IP_RTC_INT_OPT_T

RTC enumeration.

RTC interrupt source

Enumerator:

  RTC_INT_COUNTER_INCREASE | Counter Increment Interrupt
  RTC_INT_ALARM | The alarm interrupt

Definition at line 313 of file rtc_001.h.

enum IP_RTC_TIMEINDEX_T

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 54 of file rtc_001.h.

## Function Documentation

void IP_RTC_AlarmIntConfig | ( | IP_RTC_001_T * | pRTC,
|  | uint32_t | alarmMask,
|  | FunctionalState | NewState
| ) |  |

Enable/Disable Alarm interrupt for a time type in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  alarmMask | : Or'ed bit values for ALARM types (RTC_AMR_CIIR_IM*)
  NewState | : ENABLE or DISABLE

Returns
  None

Definition at line 114 of file rtc_001.c.

void IP_RTC_CalibConfig | ( | IP_RTC_001_T * | pRTC,
|  | uint32_t | CalibValue,
|  | uint8_t | CalibDir
| ) |  |

Configures Calibration in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  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 220 of file rtc_001.c.

void IP_RTC_CalibCounterCmd | ( | IP_RTC_001_T * | pRTC,
|  | FunctionalState | NewState
| ) |  |

Enable/Disable calibration counter in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  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 207 of file rtc_001.c.

STATIC INLINE void IP_RTC_ClearIntPending | ( | IP_RTC_001_T * | pRTC,
|  | uint32_t | IntType
| ) |  |

Clear specified Location interrupt pending in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  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 467 of file rtc_001.h.

void IP_RTC_CntIncrIntConfig | ( | IP_RTC_001_T * | pRTC,
|  | uint32_t | cntrMask,
|  | FunctionalState | NewState
| ) |  |

Enable/Disable Counter increment interrupt for a time type in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  cntrMask | : Or'ed bit values for time types (RTC_AMR_CIIR_IM*)
  NewState | : ENABLE or DISABLE

Returns
  None

Definition at line 100 of file rtc_001.c.

STATIC INLINE void IP_RTC_DeInit | ( | IP_RTC_001_T * | pRTC | ) |

De-initialize the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block

Returns
  None

Definition at line 334 of file rtc_001.h.

void IP_RTC_Enable | ( | IP_RTC_001_T * | pRTC,
|  | FunctionalState | NewState
| ) |  |

Start/Stop RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  NewState | : ENABLE or DISABLE

Returns
  None

Definition at line 87 of file rtc_001.c.

uint32_t IP_RTC_GetAlarmTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIMEINDEX_T | Timetype
| ) |  |

Get alarm time value for a time type.

Parameters

  pRTC | : pointer to RTC peripheral block
  Timetype | : Time index field to get

Returns
  Value of Alarm time according to specified time type

Definition at line 181 of file rtc_001.c.

void IP_RTC_GetFullAlarmTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIME_T * | pFullTime
| ) |  |

Get full alarm time in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  pFullTime | : Pointer to full time record to fill

Returns
  None

Definition at line 197 of file rtc_001.c.

void IP_RTC_GetFullTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIME_T * | pFullTime
| ) |  |

Get full time from the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  pFullTime | : Pointer to full time record to fill

Returns
  None

Definition at line 159 of file rtc_001.c.

STATIC INLINE IntStatus IP_RTC_GetIntPending | ( | IP_RTC_001_T * | pRTC,
|  | uint32_t | IntType
| ) |  |

Check whether if specified location interrupt in the RTC peripheral is set or not.

Parameters

  pRTC | : pointer to RTC peripheral block
  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
  Current state of specified interrupt in RTC peripheral, SET or RESET

Definition at line 481 of file rtc_001.h.

uint32_t IP_RTC_GetTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIMEINDEX_T | Timetype
| ) |  |

Get current time value for a type time type.

Parameters

  pRTC | : pointer to RTC peripheral block
  Timetype | : Time field index type to get

Returns
  Value of time field according to specified time type

Definition at line 133 of file rtc_001.c.

void IP_RTC_Init | ( | IP_RTC_001_T * | pRTC | ) |

Initialize the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block

Returns
  None

Definition at line 51 of file rtc_001.c.

void IP_RTC_ResetClockTickCounter | ( | IP_RTC_001_T * | pRTC | ) |

Reset clock tick counter in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block

Returns
  None

Definition at line 73 of file rtc_001.c.

void IP_RTC_SetAlarmTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIMEINDEX_T | Timetype,
|  | uint32_t | ALValue
| ) |  |

Set alarm time value for a time type.

Parameters

  pRTC | : pointer to RTC peripheral block
  Timetype | : Time index field to set
  ALValue | : Alarm time value to set

Returns
  None

Definition at line 175 of file rtc_001.c.

void IP_RTC_SetFullAlarmTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIME_T * | pFullTime
| ) |  |

Set full alarm time in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  pFullTime | : Pointer to full time record to set alarm

Returns
  None

Definition at line 187 of file rtc_001.c.

void IP_RTC_SetFullTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIME_T * | pFullTime
| ) |  |

Set full time in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  pFullTime | : Pointer to full time data

Returns
  None

Definition at line 139 of file rtc_001.c.

void IP_RTC_SetTime | ( | IP_RTC_001_T * | pRTC,
|  | IP_RTC_TIMEINDEX_T | Timetype,
|  | uint32_t | TimeValue
| ) |  |

Set current time value for a time type in the RTC peripheral.

Parameters

  pRTC | : pointer to RTC peripheral block
  Timetype | : time field index type to set
  TimeValue | : Value to palce in time field

Returns
  None

Definition at line 127 of file rtc_001.c.