RTEMS: bsps/arm/atsam/include/libchip/include/rtc.h File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Macros | Functions
rtc.h File Reference
`#include "chip.h"`
`#include <stdint.h>`

Go to the source code of this file.

## Macros
#define | RTC_HOUR_BIT_LEN_MASK 0x3F
#define | RTC_MIN_BIT_LEN_MASK 0x7F
#define | RTC_SEC_BIT_LEN_MASK 0x7F
#define | RTC_CENT_BIT_LEN_MASK 0x7F
#define | RTC_YEAR_BIT_LEN_MASK 0xFF
#define | RTC_MONTH_BIT_LEN_MASK 0x1F
#define | RTC_DATE_BIT_LEN_MASK 0x3F
#define | RTC_WEEK_BIT_LEN_MASK 0x07

## Functions
void | RTC_SetHourMode (Rtc *pRtc, uint32_t dwMode)
| Sets the RTC in either 12 or 24 hour mode.
uint32_t | RTC_GetHourMode (Rtc *pRtc)
| Gets the RTC mode.
void | RTC_EnableIt (Rtc *pRtc, uint32_t dwSources)
| Enables the selected interrupt sources of the RTC.
void | RTC_DisableIt (Rtc *pRtc, uint32_t dwSources)
| Disables the selected interrupt sources of the RTC.
int | RTC_SetTime (Rtc *pRtc, uint8_t ucHour, uint8_t ucMinute, uint8_t ucSecond)
| Sets the current time in the RTC.
void | RTC_GetTime (Rtc *pRtc, uint8_t *pucHour, uint8_t *pucMinute, uint8_t *pucSecond)
| Retrieves the current time as stored in the RTC in several variables.
int | RTC_SetTimeAlarm (Rtc *pRtc, uint8_t *pucHour, uint8_t *pucMinute, uint8_t *pucSecond)
| Sets a time alarm on the RTC. The match is performed only on the provided variables; Setting all pointers to 0 disables the time alarm.
void | RTC_GetDate (Rtc *pRtc, uint16_t *pwYear, uint8_t *pucMonth, uint8_t *pucDay, uint8_t *pucWeek)
| Retrieves the current year, month and day from the RTC. Month, day and week values are numbered starting at 1.
int | RTC_SetDate (Rtc *pRtc, uint16_t wYear, uint8_t ucMonth, uint8_t ucDay, uint8_t ucWeek)
| Sets the current year, month and day in the RTC. Month, day and week values must be numbered starting from 1.
int | RTC_SetDateAlarm (Rtc *pRtc, uint8_t *pucMonth, uint8_t *pucDay)
| Sets a date alarm in the RTC. The alarm will match only the provided values; Passing a null-pointer disables the corresponding field match.
void | RTC_ClearSCCR (Rtc *pRtc, uint32_t dwMask)
| Clear flag bits of status clear command register in the RTC.
uint32_t | RTC_GetSR (Rtc *pRtc, uint32_t dwMask)
| Get flag bits of status register in the RTC.

## Detailed Description

Interface for Real Time Clock (RTC) controller.

## Function Documentation

## ◆ RTC_ClearSCCR()

void RTC_ClearSCCR | ( | Rtc * | pRtc,
|  | uint32_t | dwMask
| ) |  |

Clear flag bits of status clear command register in the RTC.

Parameters

  mask | Bits mask of cleared events

## ◆ RTC_DisableIt()

void RTC_DisableIt | ( | Rtc * | pRtc,
|  | uint32_t | dwSources
| ) |  |

Disables the selected interrupt sources of the RTC.

Parameters

  sources | Interrupt sources to disable.

## ◆ RTC_EnableIt()

void RTC_EnableIt | ( | Rtc * | pRtc,
|  | uint32_t | dwSources
| ) |  |

Enables the selected interrupt sources of the RTC.

Parameters

  sources | Interrupt sources to enable.

## ◆ RTC_GetDate()

void RTC_GetDate | ( | Rtc * | pRtc,
|  | uint16_t * | pwYear,
|  | uint8_t * | pucMonth,
|  | uint8_t * | pucDay,
|  | uint8_t * | pucWeek
| ) |  |

Retrieves the current year, month and day from the RTC. Month, day and week values are numbered starting at 1.

Parameters

  pYwear | Current year (optional).
  pucMonth | Current month (optional).
  pucDay | Current day (optional).
  pucWeek | Current day in current week (optional).

## ◆ RTC_GetHourMode()

uint32_t RTC_GetHourMode | ( | Rtc * | pRtc | ) |

Gets the RTC mode.

Returns
  Hour mode.

## ◆ RTC_GetSR()

uint32_t RTC_GetSR | ( | Rtc * | pRtc,
|  | uint32_t | dwMask
| ) |  |

Get flag bits of status register in the RTC.

Parameters

  mask | Bits mask of Status Register

Returns
  Status register & mask

## ◆ RTC_GetTime()

void RTC_GetTime | ( | Rtc * | pRtc,
|  | uint8_t * | pucHour,
|  | uint8_t * | pucMinute,
|  | uint8_t * | pucSecond
| ) |  |

Retrieves the current time as stored in the RTC in several variables.

Parameters

  pucHour | If not null, current hour is stored in this variable.
  pucMinute | If not null, current minute is stored in this variable.
  pucSecond | If not null, current second is stored in this variable.

## ◆ RTC_SetDate()

int RTC_SetDate | ( | Rtc * | pRtc,
|  | uint16_t | wYear,
|  | uint8_t | ucMonth,
|  | uint8_t | ucDay,
|  | uint8_t | ucWeek
| ) |  |

Sets the current year, month and day in the RTC. Month, day and week values must be numbered starting from 1.

Note
  In successive update operations, the user must wait at least one second after resetting the UPDTIM/UPDCAL bit in the RTC_CR before setting these bits again. Please look at the RTC section of the datasheet for detail.

Parameters

  wYear | Current year.
  ucMonth | Current month.
  ucDay | Current day.
  ucWeek | Day number in current week.

Returns
  0 success, 1 fail to set

## ◆ RTC_SetDateAlarm()

int RTC_SetDateAlarm | ( | Rtc * | pRtc,
|  | uint8_t * | pucMonth,
|  | uint8_t * | pucDay
| ) |  |

Sets a date alarm in the RTC. The alarm will match only the provided values; Passing a null-pointer disables the corresponding field match.

Parameters

  pucMonth | If not null, the RTC alarm will month-match this value.
  pucDay | If not null, the RTC alarm will day-match this value.

Returns
  0 success, 1 fail to set

## ◆ RTC_SetHourMode()

void RTC_SetHourMode | ( | Rtc * | pRtc,
|  | uint32_t | dwMode
| ) |  |

Sets the RTC in either 12 or 24 hour mode.

Parameters

  mode | Hour mode.

## ◆ RTC_SetTime()

int RTC_SetTime | ( | Rtc * | pRtc,
|  | uint8_t | ucHour,
|  | uint8_t | ucMinute,
|  | uint8_t | ucSecond
| ) |  |

Sets the current time in the RTC.

Note
  In successive update operations, the user must wait at least one second after resetting the UPDTIM/UPDCAL bit in the RTC_CR before setting these bits again. Please look at the RTC section of the datasheet for detail.

Parameters

  ucHour | Current hour in 12 or 24 hour mode.
  ucMinute | Current minute.
  ucSecond | Current second.

Returns
  0 success, 1 fail to set

## ◆ RTC_SetTimeAlarm()

int RTC_SetTimeAlarm | ( | Rtc * | pRtc,
|  | uint8_t * | pucHour,
|  | uint8_t * | pucMinute,
|  | uint8_t * | pucSecond
| ) |  |

Sets a time alarm on the RTC. The match is performed only on the provided variables; Setting all pointers to 0 disables the time alarm.

Note
  In AM/PM mode, the hour value must have bit #7 set for PM, cleared for AM (as expected in the time registers).

Parameters

  pucHour | If not null, the time alarm will hour-match this value.
  pucMinute | If not null, the time alarm will minute-match this value.
  pucSecond | If not null, the time alarm will second-match this value.

Returns
  0 success, 1 fail to set