PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
Real Time Clock (RTC)

Data Structures

struct  stc_rtc_interrupts
 Interrupt configuration structure. More...
 
struct  stc_rtc_alarm_enable
 Alarm Register En- and Disable. More...
 
struct  stc_rtc_time
 Real Time Clock Date and Time structure. More...
 
struct  stc_rtc_alarm
 Real Time Clock Alarm structure. More...
 
struct  stc_rtc_config
 Real Time Clock configuration. More...
 
struct  stc_rtc_timer_config
 Real Time Clock Timer configuration. More...
 
struct  stc_rtc_intern_data
 Datatype for holding internal data needed for RTC. More...
 

Macros

#define RTC_YEAR_1900   (1900)
 
#define RTC_YEAR_2000   (2000)
 
#define RTC_SEC_MAX   (59u)
 
#define RTC_MIN_MAX   (59u)
 
#define RTC_HOUR_MAX   (23u)
 
#define RTC_DAY_MAX   (31u)
 
#define RTC_MONTH_MAX   (12u)
 
#define RTC_DAYOFWEEK_MAX   (6u)
 
#define RTC_YEAR_MAX   (99u)
 
#define RTC_4BIT   (4u)
 
#define RTC_8BIT   (8u)
 
#define RTC_16BIT   (16u)
 
#define RTC_DIGIT_10   (10u)
 
#define RTC_2BYTES   (2u)
 
#define RTC_4BYTES   (4u)
 
#define RTC_WTCR20_PWRITE   (0x20u)
 
#define RTC_WTCR20_PREAD   (0x10u)
 
#define RTC_WTCR20_BWRITE   (0x08u)
 
#define RTC_WTCR20_BREAD   (0x04u)
 
#define RTC_WTCR20_CWRITE   (0x02u)
 
#define RTC_WTCR20_CREAD   (0x01u)
 
#define RTC_MASK_LOW4BIT   (0x0Fu)
 
#define RTC_MASK_HIGH4BIT   (0xF0u)
 
#define RTC_ERR   (-1)
 
#define RTC0   (*((volatile stc_rtcn_t *)FM4_RTC_BASE))
 Rtccallback function prototypes. More...
 
#define RTC_INTERRUPT_ENABLE_MASK   (0xFFu)
 Number of Irq bit fields, see stc_rtc_interrupts_t. More...
 
#define RTC_POLLING_TIMEOUT   (100000u)
 Timeout for WTCR2.CREAD bit polling. More...
 
#define RTC_BUSY_POLLING_TIMEOUT   (200000u)
 Timeout for BUSY bit polling. More...
 
#define RTC_TRANS_POLLING_TIMEOUT   (500000u)
 Timeout for TRANS bit polling. More...
 
#define Rtc_Year(a)   ((a) - 2000)
 Year calculation macro for adjusting RTC year format. More...
 
#define RTC_WTCR11_MIEN_FLAG_POSITION   (0x01u)
 Year calculation macro for adjusting RTC year format. More...
 
#define RTC_WTCR11_HEN_FLAG_POSITION   (0x02u)
 
#define RTC_WTCR11_DEN_FLAG_POSITION   (0x04u)
 
#define RTC_WTCR11_MOEN_FLAG_POSITION   (0x08u)
 
#define RTC_WTCR11_YEN_FLAG_POSITION   (0x10u)
 
#define RTC_WTCR11_ALL_FLAG_POSITION   (0x1Fu)
 
#define RTC_WTCR12_INTSSI_FLAG_POSITION   (0x01u)
 Bit Positions of Interrupt Flasgs in WTCR12. More...
 
#define RTC_WTCR12_INTSI_FLAG_POSITION   (0x02u)
 
#define RTC_WTCR12_INTMI_FLAG_POSITION   (0x04u)
 
#define RTC_WTCR12_INTHI_FLAG_POSITION   (0x08u)
 
#define RTC_WTCR12_INTTMI_FLAG_POSITION   (0x10u)
 
#define RTC_WTCR12_INTALI_FLAG_POSITION   (0x20u)
 
#define RTC_WTCR12_INTERI_FLAG_POSITION   (0x40u)
 
#define RTC_WTCR12_INTCRI_FLAG_POSITION   (0x80u)
 
#define RTC_MAX_FREQ_CORR_VALUE   (0x3FFu)
 Maxmimum Frequency Correction Value. More...
 
#define RTC_MAX_FREQ_CORR_CYCLE_SET_VALUE   (0x3Fu)
 Maxmimum Frequency Correction Cycle Setting Value. More...
 
#define RTC_MAX_TIMER_SET_VALUE   (0x2A2FFu)
 Maxmimum Timer Setting Value. More...
 
#define RTC_BKUP_REG_BASE   (FM4_PERIPH_BASE + 0x3B200UL) /* Backup registers */
 Backup register area. More...
 

Typedefs

typedef FM4_RTC_TypeDef stc_rtcn_t
 
typedef void(* func_ptr_rtc_arglist_t )(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)
 
typedef enum en_rtc_month en_rtc_month_t
 Month name definitions (not used in driver - to be used by user applciation) More...
 
typedef enum en_rtc_day_of_week en_rtc_day_of_week_t
 Day of week name definitions (not used in driver - to be used by user applciation) More...
 
typedef enum en_rtc_timer_status en_rtc_timer_status_t
 Rtc Timer Status. More...
 
typedef enum en_rtc_trans_status en_rtc_trans_status_t
 RTC Transmission Status. More...
 
typedef enum en_rtc_divider_ratio en_rtc_divider_ratio_t
 Rtc Divider Ratio Setting. More...
 
typedef enum en_rtc_co_div en_rtc_co_div_t
 Rtc CO Division. More...
 
typedef enum en_rtc_bkup_reg_size en_rtc_bkup_reg_size_t
 Backup register access size. More...
 
typedef enum en_rtc_bkup_reg_area en_rtc_bkup_reg_area_t
 Backup register area. More...
 
typedef struct stc_rtc_interrupts stc_rtc_interrupts_t
 Interrupt configuration structure. More...
 
typedef struct stc_rtc_alarm_enable stc_rtc_alarm_enable_t
 Alarm Register En- and Disable. More...
 
typedef struct stc_rtc_time stc_rtc_time_t
 Real Time Clock Date and Time structure. More...
 
typedef struct stc_rtc_alarm stc_rtc_alarm_t
 Real Time Clock Alarm structure. More...
 
typedef struct stc_rtc_config stc_rtc_config_t
 Real Time Clock configuration. More...
 
typedef struct stc_rtc_timer_config stc_rtc_timer_config_t
 Real Time Clock Timer configuration. More...
 
typedef struct stc_rtc_intern_data stc_rtc_intern_data_t
 Datatype for holding internal data needed for RTC. More...
 

Enumerations

enum  en_rtc_month {
  Rtc_January = 1,
  Rtc_Febuary = 2,
  Rtc_March = 3,
  Rtc_April = 4,
  Rtc_May = 5,
  Rtc_June = 6,
  Rtc_July = 7,
  Rtc_August = 8,
  Rtc_September = 9,
  Rtc_October = 10,
  Rtc_November = 11,
  Rtc_December = 12
}
 Month name definitions (not used in driver - to be used by user applciation) More...
 
enum  en_rtc_day_of_week {
  Rtc_Sunday = 0,
  Rtc_Monday = 1,
  Rtc_Tuesday = 2,
  Rtc_Wednesday = 3,
  Rtc_Thursday = 4,
  Rtc_Friday = 5,
  Rtc_Saturday = 6
}
 Day of week name definitions (not used in driver - to be used by user applciation) More...
 
enum  en_rtc_timer_status {
  RtcTimerNoOperation = 0,
  RtcTimerInOperation = 1,
  RtcTimerInvalidInstance = 2
}
 Rtc Timer Status. More...
 
enum  en_rtc_trans_status {
  RtcTransNoOperation = 0,
  RtcTransInOperation = 1,
  RtcTransInvalidInstance = 2
}
 RTC Transmission Status. More...
 
enum  en_rtc_divider_ratio {
  RtcDivRatio1 = 0x00,
  RtcDivRatio2 = 0x01,
  RtcDivRatio4 = 0x02,
  RtcDivRatio8 = 0x03,
  RtcDivRatio16 = 0x04,
  RtcDivRatio32 = 0x05,
  RtcDivRatio64 = 0x06,
  RtcDivRatio128 = 0x07,
  RtcDivRatio256 = 0x08,
  RtcDivRatio512 = 0x09,
  RtcDivRatio1024 = 0x0A,
  RtcDivRatio2048 = 0x0B,
  RtcDivRatio4096 = 0x0C,
  RtcDivRatio8192 = 0x0D,
  RtcDivRatio16384 = 0x0E,
  RtcDivRatio32768 = 0x0F
}
 Rtc Divider Ratio Setting. More...
 
enum  en_rtc_co_div {
  RtcCoDiv1 = 0,
  RtcCoDiv2 = 1
}
 Rtc CO Division. More...
 
enum  en_rtc_bkup_reg_size {
  RtcBkupRegSizeByte = 0,
  RtcBkupRegSizeHalfWord = 1,
  RtcBkupRegSizeWord = 2
}
 Backup register access size. More...
 
enum  en_rtc_bkup_reg_area {
  RtcBkupRegArea00 = 0x00,
  RtcBkupRegArea01,
  RtcBkupRegArea02,
  RtcBkupRegArea03,
  RtcBkupRegArea04,
  RtcBkupRegArea05,
  RtcBkupRegArea06,
  RtcBkupRegArea07,
  RtcBkupRegArea08,
  RtcBkupRegArea09,
  RtcBkupRegArea0A,
  RtcBkupRegArea0B,
  RtcBkupRegArea0C,
  RtcBkupRegArea0D,
  RtcBkupRegArea0E,
  RtcBkupRegArea0F,
  RtcBkupRegArea10,
  RtcBkupRegArea11,
  RtcBkupRegArea12,
  RtcBkupRegArea13,
  RtcBkupRegArea14,
  RtcBkupRegArea15,
  RtcBkupRegArea16,
  RtcBkupRegArea17,
  RtcBkupRegArea18,
  RtcBkupRegArea19,
  RtcBkupRegArea1A,
  RtcBkupRegArea1B,
  RtcBkupRegArea1C,
  RtcBkupRegArea1D,
  RtcBkupRegArea1E,
  RtcBkupRegArea1F,
  RtcBkupRegAreaMax
}
 Backup register area. More...
 

Functions

static void RtcToTm (stc_rtc_time_t *pstcRtcTime, struct tm *pstcTime)
 Convert RTC time structure to time.h tm structure. More...
 
static uint8_t RtcBinToBcd (uint8_t u8BinValue)
 Binary to BCD conversion. More...
 
static uint8_t RtcBcdToBin (uint8_t u8BcdValue)
 BCD to Binary conversion. More...
 
static void RtcInitIrq (void)
 Device dependent initialization of interrupts according CMSIS with level defined in pdl.h. More...
 
static void RtcDeInitIrq (void)
 Device dependent de-initialization of interrupts according CMSIS with level defined in pdl.h. More...
 
static en_result_t RtcWaitTransComplete (void)
 Wait to complete writing transmission. More...
 
static en_result_t RtcTransToVbat (uint8_t u8Control)
 Transfer to/from VBAT domain and wait to complete transmission. More...
 
void RtcDisableNvic (void)
 Disable RTC NVIC and save original value. More...
 
void RtcRestoreNvic (void)
 Restore RTC NVIC. More...
 
void RtcIrqHandler (void)
 RTC interrupt service routine. More...
 
en_result_t Rtc_Init (stc_rtc_config_t *pstcConfig, stc_rtc_time_t *pstcTime, stc_rtc_alarm_t *pstcAlarm, boolean_t bTouchNvic, boolean_t bResetNoReInit)
 Initialize RTC. More...
 
boolean_t Rtc_GetRunStatus (void)
 Initialize RTC. More...
 
en_result_t Rtc_SetDateTime (stc_rtc_time_t *pstcRtcTime)
 Check and Set RTC Date and RTC Time. More...
 
en_result_t Rtc_SetAlarmDateTime (stc_rtc_alarm_t *pstcRtcAlarm)
 Check and Set Alarm Date and Alarm Time. More...
 
en_result_t Rtc_EnableDisableInterrupts (stc_rtc_config_t *pstcConfig)
 Enable and/or Disable RTC (and Timer) Interrupts. More...
 
en_result_t Rtc_EnableDisableAlarmRegisters (stc_rtc_alarm_enable_t *pstcRtcAlarmEn)
 Enable and/or Disable RTC Alarm Register. More...
 
en_result_t Rtc_ReadDateTimePolling (stc_rtc_time_t *pstcRtcTime)
 Read recent Time of RTC in polling mode. More...
 
en_result_t Rtc_RequestDateTime (void)
 Request for Read recent Time of RTC. More...
 
en_result_t Rtc_TimerSet (stc_rtc_timer_config_t *pstcConfig)
 Set Timer Status of RTC. More...
 
en_result_t Rtc_TimerStart (void)
 Start Timer Status of RTC. More...
 
en_result_t Rtc_TimerStop (void)
 Stops Timer Status of RTC. More...
 
en_rtc_timer_status_t Rtc_TimerStatusRead (void)
 Read Timer Status of RTC. More...
 
en_rtc_trans_status_t Rtc_TransStatusRead (void)
 Read Transmission Status of RTC. More...
 
en_result_t Rtc_DeInit (void)
 De-Initialize RTC. More...
 
time_t Rtc_GetRawTime (stc_rtc_time_t *pstcRtcTime)
 Get raw time. More...
 
en_result_t Rtc_SetDayOfWeek (stc_rtc_time_t *pstcRtcTime)
 Set Day of the Week. More...
 
en_result_t Rtc_SetTime (stc_rtc_time_t *pstcRtcTime, time_t tRawTime)
 Sets the RTC time structure from raw time. More...
 
en_result_t Rtc_WriteBkupReg8 (uint8_t u8Data, uint8_t u8Area)
 Write the data to Backup Register (byte access) More...
 
en_result_t Rtc_WriteBkupReg16 (uint16_t u16Data, uint8_t u8Area)
 Write the data to Backup Register (half word access) More...
 
en_result_t Rtc_WriteBkupReg32 (uint32_t u32Data, uint8_t u8Area)
 Write the data to Backup Register (word access) More...
 
uint8_t Rtc_ReadBkupReg8 (uint8_t u8Area)
 Read the data from Backup Register (byte access) More...
 
uint16_t Rtc_ReadBkupReg16 (uint8_t u8Area)
 Read the data from Backup Register (half word access) More...
 
uint32_t Rtc_ReadBkupReg32 (uint8_t u8Area)
 Read the data from Backup Register (word access) More...
 

Variables

static stc_rtc_intern_data_t stcRtcInternData
 
static uint8_t u8CRead
 
static uint32_t u32NvicData
 

Detailed Description

Provided functions of RTC module:

Rtc_Init() initializes the RTC with the given time and date given in the RTC configuration. It also initialized the NVIC, if specidfied. Rtc_SetDateTime() allows to set a new date and time. Rtc_SetAlarmDateTime() allows to set a new alarm date and time Rtc_EnableDisableInterrupts() allows to change the interrupt configurations on runtime without touching the RTC work. With Rtc_EnableDisableAlarmRegisters() the comparison to the recent time can be adjusted on runtime. Rtc_ReadClockStatus() reads out the status of the RTC. Rtc_TimerSet() sets the timer value for its interval or one-shot counting. Rtc_TimerStart() starts and Rtc_TimerStop() stops the Timer. With Rtc_ReadDateTimePolling() the recent date and time can be stored in the pointered configuration structure while the Read Completion Interrupt is temporarily disabled. Rtc_TimerStatusRead() reads out the Timer status. Rtc_TransStatusRead() reads out the transmission status. And finally Rtc_DeInit() allows to de-initialize all RTC functions and possible interrupts. Also here to touch the NVIC registers can be set.

Rtc_GetRawTime() is a helper function, which calculates the 'raw' time (UNIX time) from the RTC time structure stc_rtc_time_t. Rtc_SetDayOfWeek() is a helper function, which sets the day of the week calculated from the date and time given in stc_rtc_time_t. Rtc_SetTime() is a helper function which calculates the RTC time structure from the 'raw' time.

Rtc_WriteBkupReg8(), Rtc_WriteBkupReg16() and Rtc_WriteBkupReg32() write a single byte, 16-bit or 32-bit word to a given backup register area. Rtc_ReadBkupReg8(), Rtc_ReadBkupReg16() and Rtc_ReadBkupReg32() read a single byte, 16-bit or 32-bit word from a given backup register area.

Macro Definition Documentation

#define RTC0   (*((volatile stc_rtcn_t *)FM4_RTC_BASE))

Rtccallback function prototypes.

Definition at line 144 of file rtc.h.

#define RTC_16BIT   (16u)

Definition at line 87 of file rtc.c.

Referenced by Rtc_TimerSet().

#define RTC_2BYTES   (2u)

Definition at line 89 of file rtc.c.

Referenced by Rtc_ReadBkupReg16(), and Rtc_WriteBkupReg16().

#define RTC_4BIT   (4u)

Definition at line 85 of file rtc.c.

Referenced by RtcBcdToBin(), and RtcBinToBcd().

#define RTC_4BYTES   (4u)

Definition at line 90 of file rtc.c.

Referenced by Rtc_ReadBkupReg32(), and Rtc_WriteBkupReg32().

#define RTC_8BIT   (8u)

Definition at line 86 of file rtc.c.

Referenced by Rtc_TimerSet().

#define RTC_BKUP_REG_BASE   (FM4_PERIPH_BASE + 0x3B200UL) /* Backup registers */

Backup register area.

Definition at line 208 of file rtc.h.

Referenced by Rtc_ReadBkupReg16(), Rtc_ReadBkupReg32(), Rtc_ReadBkupReg8(), Rtc_WriteBkupReg16(), Rtc_WriteBkupReg32(), and Rtc_WriteBkupReg8().

#define RTC_BUSY_POLLING_TIMEOUT   (200000u)

Timeout for BUSY bit polling.

Definition at line 148 of file rtc.h.

Referenced by Rtc_SetDateTime(), and Rtc_TimerSet().

#define RTC_DAY_MAX   (31u)

Definition at line 79 of file rtc.c.

#define RTC_DAYOFWEEK_MAX   (6u)

Definition at line 81 of file rtc.c.

#define RTC_DIGIT_10   (10u)

Definition at line 88 of file rtc.c.

Referenced by RtcBcdToBin(), and RtcBinToBcd().

#define RTC_ERR   (-1)

Definition at line 105 of file rtc.c.

Referenced by Rtc_GetRawTime(), and Rtc_SetDayOfWeek().

#define RTC_HOUR_MAX   (23u)

Definition at line 78 of file rtc.c.

#define RTC_INTERRUPT_ENABLE_MASK   (0xFFu)

Number of Irq bit fields, see stc_rtc_interrupts_t.

Definition at line 146 of file rtc.h.

Referenced by Rtc_Init().

#define RTC_MASK_HIGH4BIT   (0xF0u)

Definition at line 102 of file rtc.c.

Referenced by RtcBcdToBin().

#define RTC_MASK_LOW4BIT   (0x0Fu)

Definition at line 101 of file rtc.c.

Referenced by RtcBcdToBin().

#define RTC_MAX_FREQ_CORR_CYCLE_SET_VALUE   (0x3Fu)

Maxmimum Frequency Correction Cycle Setting Value.

Definition at line 196 of file rtc.h.

#define RTC_MAX_FREQ_CORR_VALUE   (0x3FFu)

Maxmimum Frequency Correction Value.

Definition at line 190 of file rtc.h.

Referenced by Rtc_Init().

#define RTC_MAX_TIMER_SET_VALUE   (0x2A2FFu)

Maxmimum Timer Setting Value.

Definition at line 202 of file rtc.h.

#define RTC_MIN_MAX   (59u)

Definition at line 77 of file rtc.c.

#define RTC_MONTH_MAX   (12u)

Definition at line 80 of file rtc.c.

#define RTC_POLLING_TIMEOUT   (100000u)

Timeout for WTCR2.CREAD bit polling.

Definition at line 147 of file rtc.h.

#define RTC_SEC_MAX   (59u)

Definition at line 76 of file rtc.c.

#define RTC_TRANS_POLLING_TIMEOUT   (500000u)

Timeout for TRANS bit polling.

Definition at line 149 of file rtc.h.

Referenced by RtcWaitTransComplete().

#define RTC_WTCR11_ALL_FLAG_POSITION   (0x1Fu)

Definition at line 171 of file rtc.h.

#define RTC_WTCR11_DEN_FLAG_POSITION   (0x04u)

Definition at line 168 of file rtc.h.

#define RTC_WTCR11_HEN_FLAG_POSITION   (0x02u)

Definition at line 167 of file rtc.h.

#define RTC_WTCR11_MIEN_FLAG_POSITION   (0x01u)

Year calculation macro for adjusting RTC year format.

Bit Positions of Enable ALARM Flasgs in WTCR11

Definition at line 166 of file rtc.h.

#define RTC_WTCR11_MOEN_FLAG_POSITION   (0x08u)

Definition at line 169 of file rtc.h.

#define RTC_WTCR11_YEN_FLAG_POSITION   (0x10u)

Definition at line 170 of file rtc.h.

#define RTC_WTCR12_INTALI_FLAG_POSITION   (0x20u)

Definition at line 182 of file rtc.h.

#define RTC_WTCR12_INTCRI_FLAG_POSITION   (0x80u)

Definition at line 184 of file rtc.h.

Referenced by Rtc_ReadDateTimePolling().

#define RTC_WTCR12_INTERI_FLAG_POSITION   (0x40u)

Definition at line 183 of file rtc.h.

#define RTC_WTCR12_INTHI_FLAG_POSITION   (0x08u)

Definition at line 180 of file rtc.h.

#define RTC_WTCR12_INTMI_FLAG_POSITION   (0x04u)

Definition at line 179 of file rtc.h.

#define RTC_WTCR12_INTSI_FLAG_POSITION   (0x02u)

Definition at line 178 of file rtc.h.

#define RTC_WTCR12_INTSSI_FLAG_POSITION   (0x01u)

Bit Positions of Interrupt Flasgs in WTCR12.

Definition at line 177 of file rtc.h.

#define RTC_WTCR12_INTTMI_FLAG_POSITION   (0x10u)

Definition at line 181 of file rtc.h.

#define RTC_WTCR20_BREAD   (0x04u)

Definition at line 96 of file rtc.c.

Referenced by Rtc_ReadBkupReg16(), Rtc_ReadBkupReg32(), and Rtc_ReadBkupReg8().

#define RTC_WTCR20_BWRITE   (0x08u)

Definition at line 95 of file rtc.c.

Referenced by Rtc_WriteBkupReg16(), Rtc_WriteBkupReg32(), and Rtc_WriteBkupReg8().

#define RTC_WTCR20_CREAD   (0x01u)

Definition at line 98 of file rtc.c.

Referenced by Rtc_ReadDateTimePolling(), Rtc_RequestDateTime(), and Rtc_SetAlarmDateTime().

#define RTC_WTCR20_CWRITE   (0x02u)
#define RTC_WTCR20_PREAD   (0x10u)

Definition at line 94 of file rtc.c.

#define RTC_WTCR20_PWRITE   (0x20u)

Definition at line 93 of file rtc.c.

Referenced by Rtc_DeInit(), and Rtc_Init().

#define Rtc_Year (   a)    ((a) - 2000)

Year calculation macro for adjusting RTC year format.

Definition at line 155 of file rtc.h.

#define RTC_YEAR_1900   (1900)

Definition at line 74 of file rtc.c.

Referenced by Rtc_SetTime(), and RtcToTm().

#define RTC_YEAR_2000   (2000)

Definition at line 75 of file rtc.c.

Referenced by Rtc_SetTime(), and RtcToTm().

#define RTC_YEAR_MAX   (99u)

Definition at line 82 of file rtc.c.

Typedef Documentation

Backup register area.

Backup register access size.

Rtc CO Division.

Day of week name definitions (not used in driver - to be used by user applciation)

Rtc Divider Ratio Setting.

Divider Ration Settings for WTC. The enumarted values do not correspond to the bit patterns of WTDIV!

Month name definitions (not used in driver - to be used by user applciation)

Rtc Timer Status.

Read-out Status of RTC Timer Status (WTCR21.TMRUN Register Bit)

RTC Transmission Status.

Read-out Status of RTC Transmission Status (WTCR10.TRANS Register Bit)

typedef void(* func_ptr_rtc_arglist_t)(uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t,uint8_t)

function pointer type to void/uint8_t... function

Definition at line 216 of file rtc.h.

Alarm Register En- and Disable.

The RTC Alarm register configuration structure

Real Time Clock Alarm structure.

Real Time Clock configuration.

The RTC configuration settings

Datatype for holding internal data needed for RTC.

Interrupt configuration structure.

The RTC interrupt configuration structure

typedef struct stc_rtc_time stc_rtc_time_t

Real Time Clock Date and Time structure.

Real Time Clock Timer configuration.

The RTC Timer configuration settings

typedef FM4_RTC_TypeDef stc_rtcn_t

Definition at line 213 of file rtc.h.

Enumeration Type Documentation

Backup register area.

Enumerator
RtcBkupRegArea00 
RtcBkupRegArea01 
RtcBkupRegArea02 
RtcBkupRegArea03 
RtcBkupRegArea04 
RtcBkupRegArea05 
RtcBkupRegArea06 
RtcBkupRegArea07 
RtcBkupRegArea08 
RtcBkupRegArea09 
RtcBkupRegArea0A 
RtcBkupRegArea0B 
RtcBkupRegArea0C 
RtcBkupRegArea0D 
RtcBkupRegArea0E 
RtcBkupRegArea0F 
RtcBkupRegArea10 
RtcBkupRegArea11 
RtcBkupRegArea12 
RtcBkupRegArea13 
RtcBkupRegArea14 
RtcBkupRegArea15 
RtcBkupRegArea16 
RtcBkupRegArea17 
RtcBkupRegArea18 
RtcBkupRegArea19 
RtcBkupRegArea1A 
RtcBkupRegArea1B 
RtcBkupRegArea1C 
RtcBkupRegArea1D 
RtcBkupRegArea1E 
RtcBkupRegArea1F 
RtcBkupRegAreaMax 

Definition at line 339 of file rtc.h.

Backup register access size.

Enumerator
RtcBkupRegSizeByte 

byte size (8bit)

RtcBkupRegSizeHalfWord 

half word size (16bit)

RtcBkupRegSizeWord 

word size (32bit)

Definition at line 328 of file rtc.h.

Rtc CO Division.

Enumerator
RtcCoDiv1 

CO signal of RTC count part is output.

RtcCoDiv2 

CO signal of RTC count divided by 2 is output.

Definition at line 318 of file rtc.h.

Day of week name definitions (not used in driver - to be used by user applciation)

Enumerator
Rtc_Sunday 
Rtc_Monday 
Rtc_Tuesday 
Rtc_Wednesday 
Rtc_Thursday 
Rtc_Friday 
Rtc_Saturday 

Definition at line 250 of file rtc.h.

Rtc Divider Ratio Setting.

Divider Ration Settings for WTC. The enumarted values do not correspond to the bit patterns of WTDIV!

Enumerator
RtcDivRatio1 

RIN clock is not divided.

RtcDivRatio2 

RIN clock is divided by 2.

RtcDivRatio4 

RIN clock is divided by 4.

RtcDivRatio8 

RIN clock is divided by 8.

RtcDivRatio16 

RIN clock is divided by 16.

RtcDivRatio32 

RIN clock is divided by 32.

RtcDivRatio64 

RIN clock is divided by 64.

RtcDivRatio128 

RIN clock is divided by 128.

RtcDivRatio256 

RIN clock is divided by 256.

RtcDivRatio512 

RIN clock is divided by 512.

RtcDivRatio1024 

RIN clock is divided by 1024.

RtcDivRatio2048 

RIN clock is divided by 2048.

RtcDivRatio4096 

RIN clock is divided by 4096.

RtcDivRatio8192 

RIN clock is divided by 8192.

RtcDivRatio16384 

RIN clock is divided by 16384.

RtcDivRatio32768 

RIN clock is divided by 32768.

Definition at line 294 of file rtc.h.

Month name definitions (not used in driver - to be used by user applciation)

Enumerator
Rtc_January 
Rtc_Febuary 
Rtc_March 
Rtc_April 
Rtc_May 
Rtc_June 
Rtc_July 
Rtc_August 
Rtc_September 
Rtc_October 
Rtc_November 
Rtc_December 

Definition at line 229 of file rtc.h.

Rtc Timer Status.

Read-out Status of RTC Timer Status (WTCR21.TMRUN Register Bit)

Enumerator
RtcTimerNoOperation 

Timer Counter is not operating.

RtcTimerInOperation 

Timer Counter is operationg.

RtcTimerInvalidInstance 

Error: RTC instance pointer == NULL.

Definition at line 267 of file rtc.h.

RTC Transmission Status.

Read-out Status of RTC Transmission Status (WTCR10.TRANS Register Bit)

Enumerator
RtcTransNoOperation 

Transmission is not operating.

RtcTransInOperation 

Transmission is operationg.

RtcTransInvalidInstance 

Error: RTC instance pointer == NULL.

Definition at line 280 of file rtc.h.

Function Documentation

en_result_t Rtc_DeInit ( void  )

De-Initialize RTC.

This function stops and resets the RTC module and its interrupts.

Return values
OkInternal data has been setup
ErrorTimeoutTimeout to complete transmission

Definition at line 1505 of file rtc.c.

References Ok, RTC_WTCR20_CWRITE, RTC_WTCR20_PWRITE, RtcDeInitIrq(), RtcTransToVbat(), and RtcWaitTransComplete().

Here is the call graph for this function:

en_result_t Rtc_EnableDisableAlarmRegisters ( stc_rtc_alarm_enable_t *  pstcRtcAlarmEn)

Enable and/or Disable RTC Alarm Register.

With this function the Alarm registers can be en- or disabled according the configuration

Parameters
[in]pstcRtcAlarmEnPointer to settings of alarm enable
Return values
OkAlarm Register set
ErrorInvalidParameterpstcRtcAlarmEn == NULL
ErrorTimeoutTimeout to complete transmission

Definition at line 1086 of file rtc.c.

References stc_rtc_alarm_enable::AlarmDayEnable, stc_rtc_alarm_enable::AlarmHourEnable, stc_rtc_alarm_enable::AlarmMinuteEnable, stc_rtc_alarm_enable::AlarmMonthEnable, stc_rtc_alarm_enable::AlarmYearEnable, ErrorInvalidParameter, RTC_WTCR20_CWRITE, RtcTransToVbat(), and TRUE.

Referenced by Rtc_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

en_result_t Rtc_EnableDisableInterrupts ( stc_rtc_config_t *  pstcConfig)

Enable and/or Disable RTC (and Timer) Interrupts.

With this function the interrupts enabled and disabled by the RTC configuration can be changed.

Parameters
[in]pstcConfigRTC configuration structure
Return values
OkInterrupt settings done
ErrorInvalidParameterpstcConfig == NULL

Definition at line 1006 of file rtc.c.

References stc_rtc_interrupts::AlarmIrqEn, ErrorInvalidParameter, stc_rtc_interrupts::HalfSecondIrqEn, Ok, stc_rtc_interrupts::OneHourIrqEn, stc_rtc_interrupts::OneMinuteIrqEn, stc_rtc_interrupts::OneSecondIrqEn, stc_rtc_interrupts::ReadCompletionIrqEn, stc_rtc_config::stcRtcInterruptEnable, stc_rtc_interrupts::TimeRewriteErrorIrqEn, stc_rtc_interrupts::TimerIrqEn, and TRUE.

Referenced by Rtc_Init().

Here is the caller graph for this function:

time_t Rtc_GetRawTime ( stc_rtc_time_t *  pstcRtcTime)

Get raw time.

This function calculates the "raw" time ('UNIX time').

Parameters
[in]pstcRtcTimePointer to RTC Time structure
Returns
Calculated time or '-1' on error

Definition at line 1565 of file rtc.c.

References RTC_ERR, and RtcToTm().

Here is the call graph for this function:

boolean_t Rtc_GetRunStatus ( void  )

Initialize RTC.

This function reads the RTC run status

Return values
TRUERTC is running
FALSERTC stops

Definition at line 708 of file rtc.c.

en_result_t Rtc_Init ( stc_rtc_config_t *  pstcConfig,
stc_rtc_time_t *  pstcTime,
stc_rtc_alarm_t *  pstcAlarm,
boolean_t  bTouchNvic,
boolean_t  bResetNoReInit 
)

Initialize RTC.

This function initializes the RTC module and sets up the internal data structures. If the sub clock (VBAT domain) was not enabled before, the sub clock enable and stablilization is done in this function.

Parameters
[in]pstcConfigPointer to RTC configuration structure
[in]pstcTimePointer to RTC Date and Time structure
[in]pstcAlarmPointer to RTC Alarm (Data and Time) structure
[in]bTouchNvicTRUE = touch shared NVIC registers FALSE = do not touch
[in]bResetNoReInitTRUE = don't initialize RTC if RTC is running FALSE = Initialize RTC regardness of RTC status
Return values
OkInternal data has been setup
ErrorInvalidParameterIf one of following conditions are met:
  • pstcConfig == NULL
  • pstcTime == NULL
  • Invalid value of a pstcConfig's element
  • Invalid value of a pstcTime's element
  • Invalid value of a pstcAlarm's element pstcAlarm can set NULL

Definition at line 477 of file rtc.c.

References stc_rtc_config::bUseDivider, stc_rtc_config::bUseFreqCorr, ErrorInvalidParameter, ErrorTimeout, FALSE, Ok, stc_rtc_config::pfnAlarmCallback, stc_rtc_intern_data::pfnAlarmCallback, stc_rtc_config::pfnHalfSecondCallback, stc_rtc_intern_data::pfnHalfSecondCallback, stc_rtc_config::pfnOneHourCallback, stc_rtc_intern_data::pfnOneHourCallback, stc_rtc_config::pfnOneMinuteCallback, stc_rtc_intern_data::pfnOneMinuteCallback, stc_rtc_config::pfnOneSecondCallback, stc_rtc_intern_data::pfnOneSecondCallback, stc_rtc_config::pfnReadCallback, stc_rtc_intern_data::pfnReadCallback, stc_rtc_config::pfnTimerCallback, stc_rtc_intern_data::pfnTimerCallback, stc_rtc_config::pfnTimeWrtErrCallback, stc_rtc_intern_data::pfnTimeWrtErrCallback, Rtc_EnableDisableAlarmRegisters(), Rtc_EnableDisableInterrupts(), RTC_INTERRUPT_ENABLE_MASK, RTC_MAX_FREQ_CORR_VALUE, Rtc_SetAlarmDateTime(), Rtc_SetDateTime(), RTC_WTCR20_CWRITE, RTC_WTCR20_PWRITE, RtcCoDiv1, RtcCoDiv2, RtcDivRatio1, RtcDivRatio1024, RtcDivRatio128, RtcDivRatio16, RtcDivRatio16384, RtcDivRatio2, RtcDivRatio2048, RtcDivRatio256, RtcDivRatio32, RtcDivRatio32768, RtcDivRatio4, RtcDivRatio4096, RtcDivRatio512, RtcDivRatio64, RtcDivRatio8, RtcDivRatio8192, RtcInitIrq(), RtcTransToVbat(), RtcWaitTransComplete(), stc_rtc_config::stcAlarmRegisterEnable, TRUE, stc_rtc_config::u16FreqCorrValue, stc_rtc_config::u8AllInterrupts, stc_rtc_config::u8CoSignalDiv, u8CRead, stc_rtc_config::u8DividerRatio, stc_rtc_config::u8FreqCorrCycle, stc_rtc_config::u8FreqCorrValue0, and stc_rtc_config::u8FreqCorrValue1.

Here is the call graph for this function:

uint16_t Rtc_ReadBkupReg16 ( uint8_t  u8Area)

Read the data from Backup Register (half word access)

Parameters
[in]u8AreaBackup register area This parameter should be set RtcBkupRegAreaXX (XX is 00 to 1F for Unicorn)
Return values
Backupregister value (half word size) (If u8Area is invalid, this function returns 0.)

Definition at line 1859 of file rtc.c.

References Ok, RTC_2BYTES, RTC_BKUP_REG_BASE, RTC_WTCR20_BREAD, RtcBkupRegAreaMax, RtcTransToVbat(), and RtcWaitTransComplete().

Here is the call graph for this function:

uint32_t Rtc_ReadBkupReg32 ( uint8_t  u8Area)

Read the data from Backup Register (word access)

Parameters
[in]u8AreaBackup register area This parameter should be set RtcBkupRegAreaXX (XX is 00 to 1F for Unicorn)
Return values
Backupregister value (word size) (If u8Area is invalid, this function returns 0.)

Definition at line 1897 of file rtc.c.

References Ok, RTC_4BYTES, RTC_BKUP_REG_BASE, RTC_WTCR20_BREAD, RtcBkupRegAreaMax, RtcTransToVbat(), and RtcWaitTransComplete().

Here is the call graph for this function:

uint8_t Rtc_ReadBkupReg8 ( uint8_t  u8Area)

Read the data from Backup Register (byte access)

Parameters
[in]u8AreaBackup register area This parameter should be set RtcBkupRegAreaXX (XX is 00 to 1F for Unicorn)
Return values
Backupregister value (byte size) (If u8Area is invalid, this function returns 0.)

Definition at line 1824 of file rtc.c.

References Ok, RTC_BKUP_REG_BASE, RTC_WTCR20_BREAD, RtcBkupRegAreaMax, RtcTransToVbat(), and RtcWaitTransComplete().

Here is the call graph for this function:

en_result_t Rtc_ReadDateTimePolling ( stc_rtc_time_t *  pstcRtcTime)

Read recent Time of RTC in polling mode.

This function requests a copy of the recent time to the RTC registers and waits until finish. The recent time is transfered to the configuration pointer structure.

Note
In this function a possible enabled Read Completion Interrupt (INTCRI) is temporarily disabled.
Parameters
[in,out]pstcRtcTimeRTC Date and Time structure
Return values
OkDate and time sucessfully transfered
ErrorInvalidParameterpstcRtcTime == NULL
ErrorTimeoutPolling loop timed out

Definition at line 1154 of file rtc.c.

References ErrorInvalidParameter, FALSE, Ok, RTC_WTCR12_INTCRI_FLAG_POSITION, RTC_WTCR20_CREAD, RtcBcdToBin(), RtcTransToVbat(), RtcWaitTransComplete(), stc_rtc_time::u8Day, stc_rtc_time::u8DayOfWeek, stc_rtc_time::u8Hour, stc_rtc_time::u8Minute, stc_rtc_time::u8Month, stc_rtc_time::u8Second, and stc_rtc_time::u8Year.

Here is the call graph for this function:

en_result_t Rtc_RequestDateTime ( void  )

Request for Read recent Time of RTC.

This function requests a copy of the recent time to the RTC registers. In the RTC ISR the callback function stc_rtc_config_t::pfnReadCallback with all its 7 arguments for date and time is called.

Note
This function needs the INTCRIE bit (Read Completion Interrupt Enable) set to '1' by Rtc_Init() or Rtc_EnableDisableInterrupts()
Return values
OkDate and time sucessfully transfered
ErrorNotReadyA previously request was not finished

Definition at line 1225 of file rtc.c.

References ErrorNotReady, Ok, RTC_WTCR20_CREAD, TRUE, and u8CRead.

en_result_t Rtc_SetAlarmDateTime ( stc_rtc_alarm_t *  pstcRtcAlarm)

Check and Set Alarm Date and Alarm Time.

Parameters
[in]pstcRtcAlarmPointer to RTC Alarm (Date and Time) structure
Return values
OkSuccessful initialization
ErrorInvalidParameterIf one of following conditions are met:
  • pstcRtcAlarm == NULL
  • Invalid value of a pstcRtcAlarm's element
ErrorTimeoutTimeout to complete transmission

Definition at line 868 of file rtc.c.

References ErrorInvalidParameter, ErrorTimeout, FALSE, Ok, RTC_WTCR20_CREAD, RTC_WTCR20_CWRITE, RtcBinToBcd(), RtcDisableNvic(), RtcIrqHandler(), RtcRestoreNvic(), RtcTransToVbat(), RtcWaitTransComplete(), TRUE, stc_rtc_alarm::u8AlarmDay, stc_rtc_alarm::u8AlarmHour, stc_rtc_alarm::u8AlarmMinute, stc_rtc_alarm::u8AlarmMonth, and stc_rtc_alarm::u8AlarmYear.

Referenced by Rtc_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

en_result_t Rtc_SetDateTime ( stc_rtc_time_t *  pstcRtcTime)

Check and Set RTC Date and RTC Time.

This function builds two 32-bit words for minimum write access to the RTC's date and time registers.

Note
During update interrupts are globally disabled!
Parameters
[in]pstcRtcTimePointer to RTC Date and Time structure
Return values
OkSuccessful initialization
ErrorInvalidParameterIf one of following conditions are met:
  • pstcRtcTime == NULL
  • Invalid value of a pstcRtcTime's element
ErrorTimeoutPolling loop timed out

Definition at line 731 of file rtc.c.

References ErrorInvalidParameter, ErrorTimeout, FALSE, Ok, PDL_WAIT_LOOP_HOOK(), RTC_BUSY_POLLING_TIMEOUT, RTC_WTCR20_CWRITE, RtcBinToBcd(), RtcDisableNvic(), RtcRestoreNvic(), RtcTransToVbat(), RtcWaitTransComplete(), TRUE, stc_rtc_time::u8Day, stc_rtc_time::u8DayOfWeek, stc_rtc_time::u8Hour, stc_rtc_time::u8Minute, stc_rtc_time::u8Month, stc_rtc_time::u8Second, and stc_rtc_time::u8Year.

Referenced by Rtc_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

en_result_t Rtc_SetDayOfWeek ( stc_rtc_time_t *  pstcRtcTime)

Set Day of the Week.

This function calculates the day of the week from YY-MM-DD in the Time structure. It uses mktime of time.h library.

Parameters
[in,out]pstcRtcTimeRTC Time structure
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcRtcTime == NULL or mktime failed

Definition at line 1599 of file rtc.c.

References ErrorInvalidParameter, Ok, RTC_ERR, RtcToTm(), and stc_rtc_time::u8DayOfWeek.

Here is the call graph for this function:

en_result_t Rtc_SetTime ( stc_rtc_time_t *  pstcRtcTime,
time_t  tRawTime 
)

Sets the RTC time structure from raw time.

This function calculates from the RTC time structure "raw" time ('UNIX time').

Parameters
[out]pstcRtcTimeRTC Time structure
[in]tRawTime"Raw" time
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcRtcTime == NULL or localtime failed

Definition at line 1643 of file rtc.c.

References ErrorInvalidParameter, Ok, RTC_YEAR_1900, RTC_YEAR_2000, stc_rtc_time::u8Day, stc_rtc_time::u8DayOfWeek, stc_rtc_time::u8Hour, stc_rtc_time::u8Minute, stc_rtc_time::u8Month, stc_rtc_time::u8Second, and stc_rtc_time::u8Year.

en_result_t Rtc_TimerSet ( stc_rtc_timer_config_t *  pstcConfig)

Set Timer Status of RTC.

This function sets the mode and Timer value of the RTC Timer.

Precondition
The RTC has to be initialized before to use this function properly. Also use the Timer Interrupt enable by Rtc_Init()
Parameters
[in]pstcConfigTimer Configuration
Return values
OkTimer sucessfully set
ErrorInvalidParameterIf one of following conditions are met:
  • pstcConfig == NULL
  • Invalid value of a timer for setting
ErrorTimeoutTimeout to complete transmission

Definition at line 1263 of file rtc.c.

References stc_rtc_timer_config::bTimerIntervalEnable, ErrorInvalidParameter, ErrorTimeout, FALSE, Ok, PDL_WAIT_LOOP_HOOK(), RTC_16BIT, RTC_8BIT, RTC_BUSY_POLLING_TIMEOUT, RTC_WTCR20_CWRITE, RtcDisableNvic(), RtcRestoreNvic(), RtcTransToVbat(), RtcWaitTransComplete(), TRUE, and stc_rtc_timer_config::u32TimerValue.

Here is the call graph for this function:

en_result_t Rtc_TimerStart ( void  )

Start Timer Status of RTC.

This function starts the Timer of the RTC Timer.

Precondition
The RTC has to be initialized before to use this function properly. Also use the Timer Interrupt enable by Rtc_Init()
Return values
OkTimer sucessfully start
ErrorTimeoutTimeout to complete transmission

Definition at line 1383 of file rtc.c.

References Ok, RTC_WTCR20_CWRITE, RtcTransToVbat(), and TRUE.

Here is the call graph for this function:

en_rtc_timer_status_t Rtc_TimerStatusRead ( void  )

Read Timer Status of RTC.

This function provides the status of the TMRUN bit of the WTCR21 register.

Return values
RtcTimerNoOperationTimer Counter is not operating
RtcTimerInOperationTimer Counter is operationg

Definition at line 1450 of file rtc.c.

References FALSE, RtcTimerInOperation, and RtcTimerNoOperation.

en_result_t Rtc_TimerStop ( void  )

Stops Timer Status of RTC.

This function stops the Timer of the RTC Timer.

Precondition
The RTC has to be initialized before to use this function properly. Also use the Timer Interrupt enable by Rtc_Init()
Return values
OkTimer sucessfully stop
ErrorTimeoutTimeout to complete transmission

Definition at line 1418 of file rtc.c.

References FALSE, Ok, RTC_WTCR20_CWRITE, and RtcTransToVbat().

Here is the call graph for this function:

en_rtc_trans_status_t Rtc_TransStatusRead ( void  )

Read Transmission Status of RTC.

This function provides the status of the TRANS bit of the WTCR10 register.

Return values
RtcTransNoOperationTransmission is not operating
RtcTransInOperationTransmission is operationg

Definition at line 1479 of file rtc.c.

References FALSE, RtcTransInOperation, and RtcTransNoOperation.

en_result_t Rtc_WriteBkupReg16 ( uint16_t  u16Data,
uint8_t  u8Area 
)

Write the data to Backup Register (half word access)

Parameters
[in]u16DataData for backup
[in]u8AreaBackup register area This parameter should be set RtcBkupRegAreaXX (XX is 00 to 1F for Unicorn)
Return values
OkInternal data has been setup
ErrorInvalidParameterBackup register area is out of range or not 2byte alignment
ErrorTimeoutTimeout to complete transmission

Definition at line 1735 of file rtc.c.

References ErrorInvalidParameter, Ok, RTC_2BYTES, RTC_BKUP_REG_BASE, RTC_WTCR20_BWRITE, RtcBkupRegAreaMax, RtcTransToVbat(), and RtcWaitTransComplete().

Here is the call graph for this function:

en_result_t Rtc_WriteBkupReg32 ( uint32_t  u32Data,
uint8_t  u8Area 
)

Write the data to Backup Register (word access)

Parameters
[in]u32DataData for backup
[in]u8AreaBackup register area This parameter should be set RtcBkupRegAreaXX (XX is 00 to 1F for Unicorn)
Return values
OkInternal data has been setup
ErrorInvalidParameterBackup register area is out of range or not 4byte alignment
ErrorTimeoutTimeout to complete transmission

Definition at line 1781 of file rtc.c.

References ErrorInvalidParameter, Ok, RTC_4BYTES, RTC_BKUP_REG_BASE, RTC_WTCR20_BWRITE, RtcBkupRegAreaMax, RtcTransToVbat(), and RtcWaitTransComplete().

Here is the call graph for this function:

en_result_t Rtc_WriteBkupReg8 ( uint8_t  u8Data,
uint8_t  u8Area 
)

Write the data to Backup Register (byte access)

Parameters
[in]u8DataData for backup
[in]u8AreaBackup register area This parameter should be set RtcBkupRegAreaXX (XX is 00 to 1F for Unicorn)
Return values
OkInternal data has been setup
ErrorInvalidParameterBackup register area is out of range
ErrorTimeoutTimeout to complete transmission

Definition at line 1693 of file rtc.c.

References ErrorInvalidParameter, Ok, RTC_BKUP_REG_BASE, RTC_WTCR20_BWRITE, RtcBkupRegAreaMax, RtcTransToVbat(), and RtcWaitTransComplete().

Here is the call graph for this function:

static uint8_t RtcBcdToBin ( uint8_t  u8BcdValue)
static

BCD to Binary conversion.

Parameters
[in]u8BcdValueBCD Value
Returns
8-Bit Bin Value

Definition at line 209 of file rtc.c.

References RTC_4BIT, RTC_DIGIT_10, RTC_MASK_HIGH4BIT, and RTC_MASK_LOW4BIT.

Referenced by Rtc_ReadDateTimePolling(), and RtcIrqHandler().

Here is the caller graph for this function:

static uint8_t RtcBinToBcd ( uint8_t  u8BinValue)
static

Binary to BCD conversion.

Parameters
[in]u8BinValueBinary Value
Returns
8-Bit BCD Value

Definition at line 187 of file rtc.c.

References RTC_4BIT, and RTC_DIGIT_10.

Referenced by Rtc_SetAlarmDateTime(), and Rtc_SetDateTime().

Here is the caller graph for this function:

static void RtcDeInitIrq ( void  )
static

Device dependent de-initialization of interrupts according CMSIS with level defined in pdl.h.

Definition at line 243 of file rtc.c.

References PDL_DEFAULT_INTERRUPT_LEVEL.

Referenced by Rtc_DeInit().

Here is the caller graph for this function:

void RtcDisableNvic ( void  )

Disable RTC NVIC and save original value.

Definition at line 142 of file rtc.c.

References u32NvicData.

Referenced by Rtc_SetAlarmDateTime(), Rtc_SetDateTime(), and Rtc_TimerSet().

Here is the caller graph for this function:

static void RtcInitIrq ( void  )
static

Device dependent initialization of interrupts according CMSIS with level defined in pdl.h.

Definition at line 228 of file rtc.c.

References PDL_IRQ_LEVEL_RTC0.

Referenced by Rtc_Init().

Here is the caller graph for this function:

void RtcRestoreNvic ( void  )

Restore RTC NVIC.

Definition at line 152 of file rtc.c.

References u32NvicData.

Referenced by Rtc_SetAlarmDateTime(), Rtc_SetDateTime(), and Rtc_TimerSet().

Here is the caller graph for this function:

static void RtcToTm ( stc_rtc_time_t *  pstcRtcTime,
struct tm *  pstcTime 
)
static

Convert RTC time structure to time.h tm structure.

Parameters
[in]pstcRtcTimeRTC Time structure
[out]pstcTimetm Time structure

Definition at line 166 of file rtc.c.

References RTC_YEAR_1900, RTC_YEAR_2000, stc_rtc_time::u8Day, stc_rtc_time::u8Hour, stc_rtc_time::u8Minute, stc_rtc_time::u8Month, stc_rtc_time::u8Second, and stc_rtc_time::u8Year.

Referenced by Rtc_GetRawTime(), and Rtc_SetDayOfWeek().

Here is the caller graph for this function:

static en_result_t RtcTransToVbat ( uint8_t  u8Control)
static

Transfer to/from VBAT domain and wait to complete transmission.

Parameters
[in]u8ControlControl to transmission
Return values
OkSuccess to complete transmission
ErrorTimeoutTimeout to complete transmission

Definition at line 292 of file rtc.c.

References RtcWaitTransComplete().

Referenced by Rtc_DeInit(), Rtc_EnableDisableAlarmRegisters(), Rtc_Init(), Rtc_ReadBkupReg16(), Rtc_ReadBkupReg32(), Rtc_ReadBkupReg8(), Rtc_ReadDateTimePolling(), Rtc_SetAlarmDateTime(), Rtc_SetDateTime(), Rtc_TimerSet(), Rtc_TimerStart(), Rtc_TimerStop(), Rtc_WriteBkupReg16(), Rtc_WriteBkupReg32(), and Rtc_WriteBkupReg8().

Here is the call graph for this function:

Here is the caller graph for this function:

static en_result_t RtcWaitTransComplete ( void  )
static

Wait to complete writing transmission.

Return values
OkSuccess to complete transmission
ErrorTimeoutTimeout to complete transmission

Definition at line 260 of file rtc.c.

References ErrorTimeout, Ok, PDL_WAIT_LOOP_HOOK(), RTC_TRANS_POLLING_TIMEOUT, and TRUE.

Referenced by Rtc_DeInit(), Rtc_Init(), Rtc_ReadBkupReg16(), Rtc_ReadBkupReg32(), Rtc_ReadBkupReg8(), Rtc_ReadDateTimePolling(), Rtc_SetAlarmDateTime(), Rtc_SetDateTime(), Rtc_TimerSet(), Rtc_WriteBkupReg16(), Rtc_WriteBkupReg32(), Rtc_WriteBkupReg8(), and RtcTransToVbat().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

stc_rtc_intern_data_t stcRtcInternData
static

Definition at line 130 of file rtc.c.

uint32_t u32NvicData
static

Definition at line 132 of file rtc.c.

Referenced by RtcDisableNvic(), and RtcRestoreNvic().

uint8_t u8CRead
static

Definition at line 131 of file rtc.c.

Referenced by Rtc_Init(), Rtc_RequestDateTime(), and RtcIrqHandler().