![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
System RTC (Real-Time Clock) driver for Allwinner (sunxi) platforms. More...
#include <io.h>#include <log.h>#include <mmu.h>#include <cache.h>#include <stdarg.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <timer.h>#include <types.h>#include <reg-ncat.h>#include <sys-rtc.h>
Functions | |
| void | rtc_write_data (int index, uint32_t val) |
| Write data to an RTC register. | |
| uint32_t | rtc_read_data (int index) |
| Read data from an RTC register. | |
| void | rtc_set_fel_flag (void) |
| Set the FEL (Fastboot External Loader) flag. | |
| void | rtc_set_start_time_ms (void) |
| Set the initialization timestamp. | |
| void | rtc_set_dram_para (uint32_t dram_para_addr) |
| Sets the parameters for Dynamic Random Access Memory (DRAM). | |
| uint32_t | rtc_probe_fel_flag (void) |
| Check if the FEL flag is set. | |
| void | rtc_clear_fel_flag (void) |
| Clear the FEL (Fastboot External Loader) flag. | |
| int | rtc_set_bootmode_flag (uint8_t flag) |
| Set the boot mode flag. | |
| int | rtc_get_bootmode_flag (void) |
| Get the boot mode flag. | |
System RTC (Real-Time Clock) driver for Allwinner (sunxi) platforms.
This file implements RTC functionality for Allwinner SoCs, providing interface functions to read from and write to RTC registers. The RTC is used to store various persistent flags and parameters, including FEL (Fastboot External Loader) mode flag, boot mode information, DRAM parameters, and initialization timestamp. These values are retained even when the system is powered off, as long as there is backup battery power.
| void rtc_clear_fel_flag | ( | void | ) |
Clear the FEL (Fastboot External Loader) flag.
Clear the FEL (Fastboot External Loader) flag in the RTC register.
Clears the FEL flag in the RTC register after it has been processed. The function verifies the write operation was successful by reading back the value.
| int rtc_get_bootmode_flag | ( | void | ) |
Get the boot mode flag.
Get the bootmode flag from the RTC register.
Reads the boot mode flag from the RTC register. This is used to determine how the system should boot. The operation is designed to be compatible with how the kernel reads this value.
| uint32_t rtc_probe_fel_flag | ( | void | ) |
Check if the FEL flag is set.
Probe the FEL (Fastboot External Loader) flag in the RTC register.
Reads the FEL flag from the RTC register and returns whether it is set.
| uint32_t rtc_read_data | ( | int | index | ) |
Read data from an RTC register.
Read data from the RTC register at the specified index.
Reads a 32-bit value from the RTC register at the specified index.
| index | The index of the RTC register to read data from |
| int rtc_set_bootmode_flag | ( | uint8_t | flag | ) |
Set the boot mode flag.
Set the bootmode flag in the RTC register.
Sets the boot mode flag in the RTC register, which determines how the system will boot. The function verifies the write operation was successful.
| flag | The boot mode flag value to set |
| void rtc_set_dram_para | ( | uint32_t | dram_para_addr | ) |
Sets the parameters for Dynamic Random Access Memory (DRAM).
This function is used to set the parameters for DRAM and ensures the success of parameter setting through a loop.
| dram_para_addr | Address for DRAM parameters to be set. |
| void rtc_set_fel_flag | ( | void | ) |
Set the FEL (Fastboot External Loader) flag.
Set the FEL (Fastboot External Loader) flag in the RTC register.
Sets the FEL flag in the RTC register, which indicates that the system should enter Fastboot mode. The function verifies the write operation was successful by reading back the value.
| void rtc_set_start_time_ms | ( | void | ) |
Set the initialization timestamp.
Set the start time in milliseconds in the RTC register.
Stores the initialization timestamp (in milliseconds) in the RTC register. This value can be used for timing operations or to determine the system uptime. The function verifies the write operation was successful.
| void rtc_write_data | ( | int | index, |
| uint32_t | val | ||
| ) |
Write data to an RTC register.
Write data to the RTC register at the specified index.
Writes a 32-bit value to the RTC register at the specified index.
| index | The index of the RTC register to write data to |
| val | The value to write to the RTC register |