summaryrefslogtreecommitdiff
path: root/include/rvl/OSCache.h
blob: 09571398a3bf3f3dd4a65c09001c4b3b4eba7a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
    This header file defines the most common high level cache operations.
    For finer grain control over the caches, use OSDC.h, OSIC.h, and OSLC.h
    for data cache, instruction cache, and locked cache routines respectively.
 */

#ifndef __OSCACHE_H__
#define __OSCACHE_H__

/*#include <revolution/types.h>
#include <revolution/os/OSDC.h>
#include <revolution/os/OSIC.h>
#include <revolution/os/OSL2.h>
#include <revolution/os/OSLC.h>*/

#ifdef __cplusplus
extern "C" {
#endif

/*---------------------------------------------------------------------------*
    L1 Data Cache Operations
 *---------------------------------------------------------------------------*/

void DCInvalidateRange  ( void* addr, u32 nBytes );
void DCFlushRange       ( void* addr, u32 nBytes );
void DCStoreRange       ( void* addr, u32 nBytes );
void DCFlushRangeNoSync ( void* addr, u32 nBytes );
void DCStoreRangeNoSync ( void* addr, u32 nBytes );
void DCZeroRange        ( void* addr, u32 nBytes );
void DCTouchRange       ( void* addr, u32 nBytes );

/*---------------------------------------------------------------------------*
    L1 Instruction Cache Operations
 *---------------------------------------------------------------------------*/

void ICInvalidateRange  ( void* addr, u32 nBytes );

/*---------------------------------------------------------------------------*
    Locked Cache Operations
 *---------------------------------------------------------------------------*/
// 0xEnnn nnnn addresses will be mapped in by LCEnable (DBAT3 will be used)
#define LC_BASE_PREFIX  0xE000
#define LC_BASE         (LC_BASE_PREFIX << 16)

void LCEnable           ( void );
void LCDisable          ( void );
void LCLoadBlocks       ( void* destTag,  void* srcAddr, u32 numBlocks );
void LCStoreBlocks      ( void* destAddr, void* srcTag,  u32 numBlocks );
u32  LCLoadData         ( void* destAddr, void* srcAddr, u32 nBytes );
u32  LCStoreData        ( void* destAddr, void* srcAddr, u32 nBytes );
u32  LCQueueLength      ( void );
void LCQueueWait        ( u32 len );
void LCFlushQueue       ( void );

#define LCGetBase()     ((void*)LC_BASE)
    
#ifdef __cplusplus
}
#endif

#endif  // __OSCACHE_H__