![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
#include <io.h>#include <log.h>#include <stdarg.h>#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <sys-clk.h>#include <timer.h>#include <types.h>
Functions | |
| int | __attribute__ ((weak)) |
| Detect the current high-speed oscillator (HOSC) frequency. | |
| void | set_timer_count () |
| Set the timer count based on the detected HOSC frequency. | |
| uint64_t | get_arch_counter (void) |
| Get the architecture-specific counter value. | |
| uint32_t | time_ms (void) |
| Get the current time in milliseconds. | |
| uint64_t | time_us (void) |
| Get the current time in microseconds. | |
| void | udelay (uint32_t us) |
| Delay execution for a specified number of microseconds. | |
| void | mdelay (uint32_t ms) |
| Delay execution for a specified number of milliseconds. | |
| void | sdelay (uint32_t loops) |
| Delay execution for a specified number of loops (microseconds). | |
| uint32_t | get_init_timestamp () |
| Get the initialization timestamp. | |
Variables | |
| static uint32_t | init_timestamp |
| Timestamp for initialization. | |
| uint8_t | current_hosc_freq |
| Current frequency of the high-speed oscillator (HOSC) in MHz. | |
| int __attribute__ | ( | (weak) | ) |
Detect the current high-speed oscillator (HOSC) frequency.
This function enables the HOSC frequency detection and reads the detected frequency value. It determines if the frequency is closer to 24 MHz or 40 MHz based on the measured counter value.
| uint64_t get_arch_counter | ( | void | ) |
Get the architecture-specific counter value.
This function reads a high-resolution timer counter and ensures that the values are read consistently.
| uint32_t get_init_timestamp | ( | ) |
Get the initialization timestamp.
This function returns the timestamp that was set during initialization.
| void mdelay | ( | uint32_t | ms | ) |
Delay execution for a specified number of milliseconds.
This function converts milliseconds to microseconds and calls the udelay function to implement the delay.
| ms | Number of milliseconds to delay. |
| void sdelay | ( | uint32_t | loops | ) |
Delay execution for a specified number of loops (microseconds).
Delay execution for a specified number of loops (treated as microseconds).
This function directly calls udelay with the specified number of loops, which is treated as microseconds.
| loops | Number of microsecond loops to delay. |
| void set_timer_count | ( | ) |
Set the timer count based on the detected HOSC frequency.
Set timer count.
This function calls the frequency detection routine and initializes the timestamp based on the current time in microseconds.
| uint32_t time_ms | ( | void | ) |
Get the current time in milliseconds.
This function calculates the current time by dividing the architecture counter value by the current HOSC frequency (in MHz) scaled to milliseconds.
| uint64_t time_us | ( | void | ) |
Get the current time in microseconds.
This function calculates the current time by dividing the architecture counter value by the current HOSC frequency (in MHz).
| void udelay | ( | uint32_t | us | ) |
Delay execution for a specified number of microseconds.
This function uses a busy-wait loop to create a delay for the specified number of microseconds.
| us | Number of microseconds to delay. |
| uint8_t current_hosc_freq |
Current frequency of the high-speed oscillator (HOSC) in MHz.
Current high-speed oscillator frequency.
|
static |
Timestamp for initialization.