FreeRTOS port on GAP8/RISC-V
|
Data Structures | |
struct | pi_rtc_bcd_datetime_t |
Macros | |
#define | PI_RTC_YEAR_RANGE_START |
#define | PI_RTC_YEAR_RANGE_END |
#define | PI_RTC_IFR_ALARM_FLAG |
#define | PI_RTC_IFR_TIMER_FLAG |
#define | PI_RTC_IFR_CAL_FLAG |
#define | PI_RTC_CLK_DIV_DEFAULT |
Functions | |
static int8_t | __pi_rtc_datetime_check (struct tm *time) |
static void | __pi_rtc_apb_handler (void *arg) |
static void | __pi_rtc_handler (void *arg) |
static void | __pi_rtc_irq_type_handler (void *arg) |
static void | __pi_rtc_apb_reg_wait (struct rtc_data_s *driver_data) |
static uint32_t | __pi_rtc_apb_reg_read (struct rtc_data_s *driver_data, uint8_t addr) |
static void | __pi_rtc_apb_reg_write (struct rtc_data_s *driver_data, uint8_t addr, uint32_t data) |
static uint32_t | __pi_rtc_status_get (struct rtc_data_s *driver_data) |
static void | __pi_rtc_irq_mask_set (struct rtc_data_s *driver_data, uint32_t mask) |
static uint32_t | __pi_rtc_irq_mask_get (struct rtc_data_s *driver_data) |
static void | __pi_rtc_irq_mask_clear (struct rtc_data_s *driver_data, uint32_t mask) |
static uint32_t | __pi_rtc_irq_flag_get (struct rtc_data_s *driver_data) |
static void | __pi_rtc_irq_flag_clear (struct rtc_data_s *driver_data, uint32_t mask) |
static void | __pi_rtc_enable (struct rtc_data_s *driver_data) |
static void | __pi_rtc_disable (struct rtc_data_s *driver_data) |
static void | __pi_rtc_soft_reset (struct rtc_data_s *driver_data) |
static void | __pi_rtc_clock_div_set (struct rtc_data_s *driver_data, uint16_t clk_div) |
static void | __pi_rtc_calendar_start (struct rtc_data_s *driver_data) |
static void | __pi_rtc_calendar_stop (struct rtc_data_s *driver_data) |
static void | __pi_rtc_alarm_start (struct rtc_data_s *driver_data, pi_rtc_alarm_repeat_e mode) |
static void | __pi_rtc_alarm_stop (struct rtc_data_s *driver_data) |
static void | __pi_rtc_timer_start (struct rtc_data_s *driver_data, uint8_t repeat) |
static void | __pi_rtc_timer_stop (struct rtc_data_s *driver_data) |
static void | __pi_rtc_cb_attach (struct rtc_data_s *driver_data, uint32_t event, pi_task_t *task) |
static void | __pi_rtc_datetime_to_bcd (struct tm *time, pi_rtc_bcd_datetime_t *datetime) |
static void | __pi_rtc_bcd_to_datetime (pi_rtc_bcd_datetime_t *datetime, struct tm *time) |
void | __pi_rtc_conf_init (struct pi_rtc_conf *conf) |
int32_t | __pi_rtc_open (struct rtc_data_s **device_data, struct pi_rtc_conf *conf) |
void | __pi_rtc_close (struct rtc_data_s *device_data) |
int32_t | __pi_rtc_datetime_set (struct rtc_data_s *device_data, struct tm *time) |
int32_t | __pi_rtc_datetime_get (struct rtc_data_s *device_data, struct tm *time) |
int32_t | __pi_rtc_alarm_set (struct rtc_data_s *device_data, struct tm *alarm) |
int32_t | __pi_rtc_alarm_get (struct rtc_data_s *device_data, struct tm *alarm) |
int32_t | __pi_rtc_timer_set (struct rtc_data_s *device_data, uint32_t countdown) |
uint32_t | __pi_rtc_timer_get (struct rtc_data_s *device_data) |
int32_t | __pi_rtc_ioctl (struct rtc_data_s *device_data, uint32_t cmd, void *arg) |
Variables | |
static pi_task_t | g_irq_task [3] |
static volatile uint8_t | g_rtc_pending |
static struct rtc_data_s * | g_rtc_data |
#define PI_RTC_CLK_DIV_DEFAULT |
Referenced by __pi_rtc_open().
#define PI_RTC_IFR_ALARM_FLAG |
Referenced by __pi_rtc_alarm_start(), and __pi_rtc_irq_type_handler().
#define PI_RTC_IFR_CAL_FLAG |
Referenced by __pi_rtc_irq_type_handler().
#define PI_RTC_IFR_TIMER_FLAG |
Referenced by __pi_rtc_irq_type_handler(), and __pi_rtc_timer_start().
#define PI_RTC_YEAR_RANGE_END |
Referenced by __pi_rtc_datetime_check().
#define PI_RTC_YEAR_RANGE_START |
Referenced by __pi_rtc_bcd_to_datetime(), __pi_rtc_datetime_check(), and __pi_rtc_datetime_to_bcd().
int32_t __pi_rtc_alarm_get | ( | struct rtc_data_s * | device_data, |
struct tm * | alarm | ||
) |
int32_t __pi_rtc_alarm_set | ( | struct rtc_data_s * | device_data, |
struct tm * | alarm | ||
) |
|
static |
Start alarm.
References __pi_rtc_apb_reg_write(), __pi_rtc_irq_flag_clear(), __pi_rtc_irq_mask_set(), ALARM_CONTROL_OFFSET, PI_RTC_IFR_ALARM_FLAG, Catch::Generators::repeat(), RTC_ALARM_CONTROL_CFG, RTC_ALARM_CONTROL_MODE, and RTC_ALARM_CONTROL_SB.
Referenced by __pi_rtc_ioctl().
|
static |
Stop alarm.
References __pi_rtc_apb_reg_write(), ALARM_CONTROL_OFFSET, and RTC_ALARM_CONTROL_SB.
Referenced by __pi_rtc_ioctl().
|
static |
|
static |
Read from RTC internal registers.
References __pi_rtc_apb_reg_wait(), rtc_data_s::device_id, hal_rtc_data_get(), hal_rtc_irq_flag_read_reset(), hal_rtc_request_set(), and rtc_data_s::pending_irq.
Referenced by __pi_rtc_alarm_get(), __pi_rtc_datetime_get(), __pi_rtc_disable(), __pi_rtc_enable(), __pi_rtc_irq_flag_clear(), __pi_rtc_irq_flag_get(), __pi_rtc_irq_mask_clear(), __pi_rtc_irq_mask_get(), __pi_rtc_irq_mask_set(), __pi_rtc_soft_reset(), __pi_rtc_status_get(), and __pi_rtc_timer_get().
|
static |
Wait for APB IRQ. Used to read/write RTC internal registers.
References FC_SOC_EVENT_NOTIFY_IRQ, hal_eu_evt_mask_wait_and_clr(), and rtc_data_s::pending_irq.
Referenced by __pi_rtc_apb_reg_read(), and __pi_rtc_apb_reg_write().
|
static |
Write to RTC internal regisers.
References __pi_rtc_apb_reg_wait(), rtc_data_s::device_id, hal_rtc_data_set(), hal_rtc_irq_flag_write_reset(), hal_rtc_request_set(), and rtc_data_s::pending_irq.
Referenced by __pi_rtc_alarm_set(), __pi_rtc_alarm_start(), __pi_rtc_alarm_stop(), __pi_rtc_calendar_start(), __pi_rtc_calendar_stop(), __pi_rtc_clock_div_set(), __pi_rtc_datetime_set(), __pi_rtc_disable(), __pi_rtc_enable(), __pi_rtc_irq_flag_clear(), __pi_rtc_irq_mask_clear(), __pi_rtc_irq_mask_set(), __pi_rtc_soft_reset(), __pi_rtc_timer_set(), __pi_rtc_timer_start(), and __pi_rtc_timer_stop().
|
static |
References pi_rtc_bcd_datetime_t::date, rtc_calendar_date_t::day0, rtc_calendar_date_t::day1, rtc_calendar_time_t::field, rtc_calendar_date_t::field, rtc_calendar_time_t::hou0, rtc_calendar_time_t::hou1, rtc_calendar_time_t::min0, rtc_calendar_time_t::min1, rtc_calendar_date_t::mon0, rtc_calendar_date_t::mon1, PI_RTC_YEAR_RANGE_START, rtc_calendar_time_t::sec0, rtc_calendar_time_t::sec1, pi_rtc_bcd_datetime_t::time, rtc_calendar_time_t::word, rtc_calendar_date_t::word, rtc_calendar_date_t::yea0, and rtc_calendar_date_t::yea1.
Referenced by __pi_rtc_alarm_get(), and __pi_rtc_datetime_get().
|
static |
Start calendar.
References __pi_rtc_apb_reg_write(), CALENDAR_CONTROL_OFFSET, and RTC_CALENDAR_CONTROL_SB.
Referenced by __pi_rtc_ioctl().
|
static |
Stop calendar.
References __pi_rtc_apb_reg_write(), CALENDAR_CONTROL_OFFSET, and RTC_CALENDAR_CONTROL_SB.
Referenced by __pi_rtc_ioctl().
|
static |
Attach an event task to an event.
References rtc_data_s::event_task, PI_RTC_EVENT_ALARM, PI_RTC_EVENT_CALIB, and PI_RTC_EVENT_TIMER.
Referenced by __pi_rtc_ioctl().
|
static |
Set up clock divider. Used when RTC should output a signal.
References __pi_rtc_apb_reg_write(), __pi_rtc_disable(), __pi_rtc_enable(), and CKIN_DIV1_OFFSET.
Referenced by __pi_rtc_open().
void __pi_rtc_close | ( | struct rtc_data_s * | device_data | ) |
void __pi_rtc_conf_init | ( | struct pi_rtc_conf * | conf | ) |
References memset().
|
static |
References PI_RTC_YEAR_RANGE_END, PI_RTC_YEAR_RANGE_START, and printf.
Referenced by __pi_rtc_alarm_set(), and __pi_rtc_datetime_set().
int32_t __pi_rtc_datetime_get | ( | struct rtc_data_s * | device_data, |
struct tm * | time | ||
) |
int32_t __pi_rtc_datetime_set | ( | struct rtc_data_s * | device_data, |
struct tm * | time | ||
) |
|
static |
References pi_rtc_bcd_datetime_t::date, rtc_calendar_date_t::day0, rtc_calendar_date_t::day1, rtc_calendar_time_t::field, rtc_calendar_date_t::field, rtc_calendar_time_t::hou0, rtc_calendar_time_t::hou1, rtc_calendar_time_t::min0, rtc_calendar_time_t::min1, rtc_calendar_date_t::mon0, rtc_calendar_date_t::mon1, PI_RTC_YEAR_RANGE_START, rtc_calendar_time_t::sec0, rtc_calendar_time_t::sec1, pi_rtc_bcd_datetime_t::time, rtc_calendar_time_t::word, rtc_calendar_date_t::word, rtc_calendar_date_t::yea0, and rtc_calendar_date_t::yea1.
Referenced by __pi_rtc_alarm_set(), and __pi_rtc_datetime_set().
|
static |
Enable RTC standby mode.
References __pi_rtc_apb_reg_read(), __pi_rtc_apb_reg_write(), RTC_CR_OFFSET, and RTC_RTC_CR_SB.
Referenced by __pi_rtc_clock_div_set(), and __pi_rtc_close().
|
static |
Disable RTC standby mode.
References __pi_rtc_apb_reg_read(), __pi_rtc_apb_reg_write(), RTC_CR_OFFSET, and RTC_RTC_CR_SB_MASK.
Referenced by __pi_rtc_clock_div_set().
|
static |
RTC IRQ handler. IRQ triggered when alarm/timer/calibration ends.
References __pi_rtc_irq_type_handler(), pi_l2_malloc(), pi_task_callback(), pi_task_push(), and RTC_TRACE_ERR.
Referenced by __pi_rtc_open().
int32_t __pi_rtc_ioctl | ( | struct rtc_data_s * | device_data, |
uint32_t | cmd, | ||
void * | arg | ||
) |
|
static |
Acknowledge received IRQ, need to be cleared to get other IRQ. Clear IRQ flags. IRQ flags need to be cleared before in order to receive next ones.
References __pi_rtc_apb_reg_read(), __pi_rtc_apb_reg_write(), and RTC_IFR_OFFSET.
Referenced by __pi_rtc_alarm_start(), __pi_rtc_irq_type_handler(), and __pi_rtc_timer_start().
|
static |
Read IRQ flags.
References __pi_rtc_apb_reg_read(), and RTC_IFR_OFFSET.
Referenced by __pi_rtc_irq_type_handler().
|
static |
Disable IRQ for alarm/timer/calibration.
References __pi_rtc_apb_reg_read(), __pi_rtc_apb_reg_write(), and RTC_IMR_OFFSET.
|
static |
Get current IRQ.
References __pi_rtc_apb_reg_read(), and RTC_IMR_OFFSET.
|
static |
Enable IRQ for alarm/timer/calibration.
References __pi_rtc_apb_reg_read(), __pi_rtc_apb_reg_write(), and RTC_IMR_OFFSET.
Referenced by __pi_rtc_alarm_start(), and __pi_rtc_timer_start().
|
static |
Function called by the handler to clear IRQ flags.
References __pi_rtc_irq_flag_clear(), __pi_rtc_irq_flag_get(), rtc_data_s::event_task, pi_l2_free(), PI_RTC_EVENT_ALARM, PI_RTC_EVENT_CALIB, PI_RTC_EVENT_TIMER, PI_RTC_IFR_ALARM_FLAG, PI_RTC_IFR_CAL_FLAG, and PI_RTC_IFR_TIMER_FLAG.
Referenced by __pi_rtc_handler().
int32_t __pi_rtc_open | ( | struct rtc_data_s ** | device_data, |
struct pi_rtc_conf * | conf | ||
) |
References __pi_rtc_alarm_set(), __pi_rtc_apb_handler(), __pi_rtc_clock_div_set(), __pi_rtc_datetime_set(), __pi_rtc_handler(), __pi_rtc_soft_reset(), __pi_rtc_timer_set(), rtc_data_s::device_id, rtc_data_s::event_task, g_rtc_data, hal_soc_eu_set_fc_mask(), rtc_data_s::nb_open, rtc_data_s::pending_irq, pi_fc_event_handler_set(), pi_fc_l1_malloc(), PI_RTC_CLK_DIV_DEFAULT, PI_RTC_EVENT_ALARM, PI_RTC_EVENT_TIMER, RTC_TRACE, RTC_TRACE_ERR, SOC_EVENT_RTC, and SOC_EVENT_RTC_APB.
|
static |
Reset RTC device after configs.
References __pi_rtc_apb_reg_read(), __pi_rtc_apb_reg_write(), RTC_CR_OFFSET, and RTC_RTC_CR_SOFT_RST.
Referenced by __pi_rtc_open().
|
static |
Read RTC IRQ status.
References __pi_rtc_apb_reg_read(), and RTC_SR_OFFSET.
uint32_t __pi_rtc_timer_get | ( | struct rtc_data_s * | device_data | ) |
References __pi_rtc_apb_reg_read(), and COUNTDOWN1_TIMER_OFFSET.
int32_t __pi_rtc_timer_set | ( | struct rtc_data_s * | device_data, |
uint32_t | countdown | ||
) |
References __pi_rtc_apb_reg_write(), COUNTDOWN1_INIT_OFFSET, and RTC_TRACE_ERR.
|
static |
Start timer.
References __pi_rtc_apb_reg_write(), __pi_rtc_irq_flag_clear(), __pi_rtc_irq_mask_set(), COUNTDOWN_CONTROL_OFFSET, PI_RTC_IFR_TIMER_FLAG, RTC_COUNTDOWN_CONTROL_MODE, and RTC_COUNTDOWN_CONTROL_SB.
Referenced by __pi_rtc_ioctl().
|
static |
Stop timer.
References __pi_rtc_apb_reg_write(), COUNTDOWN_CONTROL_OFFSET, and RTC_COUNTDOWN_CONTROL_SB.
Referenced by __pi_rtc_ioctl().
|
static |
|
static |
Referenced by __pi_rtc_open().
|
static |