kos_sys/arch/
cache.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Rust for KallistiOS/Dreamcast
// Copyright (C) 2024 Eric Fradella
// https://dreamcast.rs/

use crate::prelude::*;

pub const CPU_CACHE_BLOCK_SIZE: usize  = 32;

#[link(name = "kallisti")]
extern "C" {
    pub fn icache_flush_range(start: c_uintptr_t, count: c_size_t);
    pub fn dcache_inval_range(start: c_uintptr_t, count: c_size_t);
    pub fn dcache_flush_range(start: c_uintptr_t, count: c_size_t);
    pub fn dcache_flush_all();
    pub fn dcache_purge_range(start: c_uintptr_t, count: c_size_t);
    pub fn dcache_purge_all();
    pub fn dcache_purge_all_with_buffer(start: c_uintptr_t, count: c_size_t);
    #[link_name = "dcache_pref_block_wrapper"]
    pub fn dcache_pref_block(src: *const c_void);
    #[link_name = "dcache_wback_sq_wrapper"]
    pub fn dcache_wback_sq(ptr: *const c_void);
    #[link_name = "dcache_alloc_block_wrapper"]
    pub fn dcache_alloc_block(src: *mut c_void, value: u32);
}