PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
rtc.h File Reference
#include "pdl.h"
#include "time.h"
Include dependency graph for rtc.h:

Go to the source code of this file.

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

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

Detailed Description

Headerfile for RTC functions

History:

  • 2013-04-04 1.0 NT First version.
  • 2013-11-22 1.1 EZ Correct the definition value of "RTC_INTERRUPT_ENABLE_MASK" from 0x0F to 0xFF
  • 2014-01-15 1.2 EZ Add Rtc_GetRunStatus() function.

Definition in file rtc.h.