SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Functions
mmu.h File Reference

Memory Management Unit (MMU) interface for RISC-V architecture. More...

#include <stdint.h>
#include "csr.h"
#include "timer.h"
#include "barrier.h"
#include "cache.h"
#include "interrupt.h"
Include dependency graph for mmu.h:

Go to the source code of this file.

Functions

void mmu_enable (void)
 Enable the SV39 MMU with cache initialization.
 
int sysmap_add_mem_region (uint32_t start_addr, uint32_t len, uint32_t mem_attr)
 Adds a memory region to the system memory map.
 

Detailed Description

Memory Management Unit (MMU) interface for RISC-V architecture.

This header file provides functions and definitions for initializing and managing the memory management unit (MMU) on RISC-V architecture.

Function Documentation

◆ mmu_enable()

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.

◆ sysmap_add_mem_region()

int sysmap_add_mem_region ( uint32_t  start_addr,
uint32_t  len,
uint32_t  mem_attr 
)

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.

Parameters
start_addrStarting address of the memory region. This address should be aligned to the appropriate boundary for the memory type.
lenLength of the memory region in bytes. The length should be a positive value and should not exceed the system's available memory range.
mem_attrMemory attributes for the region (e.g., read/write, cacheable, non-cacheable, etc.). The exact attributes depend on the platform and memory type.
Returns
0 if the memory region was successfully added. A non-zero value if the addition failed (e.g., invalid address or conflicting region).
Note
This function assumes that the provided address and length are valid. Any conflicts with existing memory regions will result in failure.