SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Macros | Functions
sys-rtc.h File Reference
#include <io.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include "log.h"
Include dependency graph for sys-rtc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EFEX_FLAG   (0x5AA5A55A)
 
#define RTC_FEL_INDEX   2
 
#define RTC_DRAM_PARA_ADDR   3
 
#define RTC_BOOT_INDEX   6
 

Functions

void rtc_write_data (int index, uint32_t val)
 Write data to the RTC register at the specified index.
 
uint32_t rtc_read_data (int index)
 Read data from the RTC register at the specified index.
 
void rtc_set_fel_flag (void)
 Set the FEL (Fastboot External Loader) flag in the RTC register.
 
void rtc_set_start_time_ms (void)
 Set the start time in milliseconds in the RTC register.
 
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)
 Probe the FEL (Fastboot External Loader) flag in the RTC register.
 
void rtc_clear_fel_flag (void)
 Clear the FEL (Fastboot External Loader) flag in the RTC register.
 
int rtc_set_bootmode_flag (uint8_t flag)
 Set the bootmode flag in the RTC register.
 
int rtc_get_bootmode_flag (void)
 Get the bootmode flag from the RTC register.
 

Macro Definition Documentation

◆ EFEX_FLAG

#define EFEX_FLAG   (0x5AA5A55A)

◆ RTC_BOOT_INDEX

#define RTC_BOOT_INDEX   6

◆ RTC_DRAM_PARA_ADDR

#define RTC_DRAM_PARA_ADDR   3

◆ RTC_FEL_INDEX

#define RTC_FEL_INDEX   2

Function Documentation

◆ rtc_clear_fel_flag()

void rtc_clear_fel_flag ( void  )

Clear the FEL (Fastboot External Loader) flag in the RTC register.

This function clears the FEL flag after it has been processed.

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.

◆ rtc_get_bootmode_flag()

int rtc_get_bootmode_flag ( void  )

Get the bootmode flag from the RTC register.

Returns
The value of the bootmode 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.

Returns
The value of the boot mode flag

◆ rtc_probe_fel_flag()

uint32_t rtc_probe_fel_flag ( void  )

Probe the FEL (Fastboot External Loader) flag in the RTC register.

Returns
The value of the FEL flag (0 or 1).

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.

Returns
1 if the FEL flag is set, 0 otherwise

◆ rtc_read_data()

uint32_t rtc_read_data ( int  index)

Read data from the RTC register at the specified index.

Parameters
indexThe index of the RTC register to read data from.
Returns
The value read from the 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.

Parameters
indexThe index of the RTC register to read data from
Returns
The value read from the RTC register

◆ rtc_set_bootmode_flag()

int rtc_set_bootmode_flag ( uint8_t  flag)

Set the bootmode flag in the RTC register.

Parameters
flagThe bootmode flag value to set.
Returns
0 if successful, or an error code if failed.

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.

Parameters
flagThe boot mode flag value to set
Returns
0 if successful

◆ rtc_set_dram_para()

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.

Parameters
dram_para_addrAddress for DRAM parameters to be set.
Returns
None.
Note
This function continuously attempts to set DRAM parameters until it succeeds.

◆ rtc_set_fel_flag()

void rtc_set_fel_flag ( void  )

Set the FEL (Fastboot External Loader) flag in the RTC register.

This flag indicates that the system should enter Fastboot mode.

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.

◆ rtc_set_start_time_ms()

void rtc_set_start_time_ms ( void  )

Set the start time in milliseconds in the RTC register.

This function sets the start time for a specific operation.

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.

◆ rtc_write_data()

void rtc_write_data ( int  index,
uint32_t  val 
)

Write data to the RTC register at the specified index.

Parameters
indexThe index of the RTC register to write data to.
valThe value to write to the 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.

Parameters
indexThe index of the RTC register to write data to
valThe value to write to the RTC register