![]() |
SyterKit 0.4.0.x
SyterKit is a bare-metal framework
|
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <stdlib.h>#include <types.h>#include <barrier.h>#include <mmu.h>#include <timer.h>#include <csr.h>#include <common.h>#include <log.h>#include <e907/sysmap.h>
Macros | |
| #define | L1_CACHE_BYTES (32) |
| Size of L1 cache line in bytes. | |
Enumerations | |
| enum | sysmap_ret_code { SYSMAP_RET_OK = 0 , SYSMAP_RET_INVALID_MEM_ADDR = -100 , SYSMAP_RET_INVALID_MEM_LEN , SYSMAP_RET_INVALID_MEM_ATTR , SYSMAP_RET_REGION_IS_FULL , SYSMAP_RET_REGION_NOT_ENOUGH } |
Variables | |
| static uint32_t | region_index = 0 |
| #define L1_CACHE_BYTES (32) |
Size of L1 cache line in bytes.
| enum sysmap_ret_code |
| void cache_init | ( | void | ) |
Initialize the cache configuration.
This function configures the cache settings by writing specific values to the control and status registers.
| void data_sync_barrier | ( | void | ) |
Insert a data synchronization barrier.
This function ensures that all previous instructions are completed before any subsequent instructions are executed, particularly useful for ensuring memory consistency.
| void dcache_enable | ( | void | ) |
Enable the data cache.
This function enables the data cache by writing to the machine cache control register.
| void flush_dcache_all | ( | ) |
Flushes the entire data cache.
This function flushes all data cache lines, ensuring that any modified or "dirty" cache lines are written back to the main memory. It ensures that the data in the cache is coherent with the memory.
Flush a range of the data cache.
This function flushes the data cache for a specified range, ensuring that any dirty cache lines are written back to memory.
| start | The starting address of the range to flush. |
| end | The ending address of the range to flush. |
| void icache_enable | ( | void | ) |
Enable the instruction cache.
This function enables the instruction cache by setting the appropriate control bits in the machine cache control register.
| void invalidate_dcache_all | ( | ) |
Invalidates the entire data cache.
This function invalidates all data cache lines, ensuring that no stale or outdated data remains in the cache. This operation discards the cache contents and ensures that the next access will fetch fresh data from memory.
Invalidate a range of the data cache.
This function invalidates the data cache for a specified range, ensuring that no stale data remains in the cache for the given addresses.
| start | The starting address of the range to invalidate. |
| end | The ending address of the range to invalidate. |
| void mmu_enable | ( | void | ) |
Enable the SV39 MMU with cache initialization.
This function initializes the cache and enables both data and instruction caches for the SV39 memory management unit.
|
inlinestatic |
|
inlinestatic |
Adds a memory region to the system memory map.
This function registers a new memory region with the given starting address, length, and memory attributes to the system's memory map. The region can be used for various purposes, such as memory allocation or defining regions for specific hardware access.
| start_addr | Starting address of the memory region. This address should be aligned to the appropriate boundary for the memory type. |
| len | Length of the memory region in bytes. The length should be a positive value and should not exceed the system's available memory range. |
| mem_attr | Memory attributes for the region (e.g., read/write, cacheable, non-cacheable, etc.). The exact attributes depend on the platform and memory type. |
| void sysmap_dump_region_info | ( | void | ) |
|
static |
|
inlinestatic |
|
static |