1 /*---------------------------------------------------------------------------*
2   Project: OS - High Level Cache Operations Library
3   File:    OSCache.h
4 
5   Copyright 1998, 1999 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: OSCache.h,v $
14   Revision 1.2.40.1  2009/01/05 08:38:34  nakano_yoshinobu
15   Added LCIsEnable.
16 
17   Revision 1.2  2006/02/04 11:56:47  hashida
18   (none)
19 
20   Revision 1.1.1.1  2005/12/29 06:53:28  hiratsu
21   Initial import.
22 
23   Revision 1.1.1.1  2005/05/12 02:41:07  yasuh-to
24   Ported from dolphin sheath tree.
25 
26 
27     10    2000/02/16 3:13p Tian
28     Fixed locked cache region at 0xEnnn nnnn
29 
30     9     2000/02/15 6:14p Tian
31     Corrected LCGetBase.
32 
33     8     1999/12/23 2:41p Tian
34     Added NoSync versions of DCFlushRange and DCStoreRange
35 
36     7     1999/12/22 5:16p Tian
37     Cleanup
38 
39     6     1999/12/22 4:11p Tian
40     Changed return type of LCGetBase
41 
42     5     1999/12/22 3:17p Tian
43     Added LCGetBase and LC_BASE
44 
45     4     1999/12/07 5:55p Tian
46     Changed LCAlloc* to invalidate instead of flush
47 
48     3     1999/12/02 7:10p Tian
49     Added LCQueueWait
50 
51     2     1999/12/02 12:04p Tian
52     Updated the locked cache APIs to return transactions added.  Added
53     LCFlushQueue
54 
55     4     1999/07/27 5:27p Shiki
56     Cleanup.
57 
58     3     1999/05/11 4:43p Shiki
59     Refreshed include tree.
60 
61     1     1999/04/30 12:49p Tianli01
62 
63     4     1999/04/21 4:12p Tianli01
64     Moved ICSync to OSIC.h
65 
66     3     1999/04/12 7:45p Tianli01
67     Added ICSync
68 
69     2     1999/03/26 2:07p Tianli01
70     Included the low level cache APIs for convenience
71 
72     1     1999/03/04 2:22p Tianli01
73     Initial check-in to new tree
74 
75     2     1999/02/12 5:39p Tianli01
76     Updated argument names
77 
78     1     1999/02/04 6:02p Tianli01
79     Initial check-in.
80 
81   $NoKeywords: $
82  *---------------------------------------------------------------------------*/
83 
84 /*
85     This header file defines the most common high level cache operations.
86     For finer grain control over the caches, use OSDC.h, OSIC.h, and OSLC.h
87     for data cache, instruction cache, and locked cache routines respectively.
88  */
89 
90 #ifndef __OSCACHE_H__
91 #define __OSCACHE_H__
92 
93 #include <revolution/types.h>
94 #include <revolution/os/OSDC.h>
95 #include <revolution/os/OSIC.h>
96 #include <revolution/os/OSL2.h>
97 #include <revolution/os/OSLC.h>
98 
99 #ifdef __cplusplus
100 extern "C" {
101 #endif
102 
103 /*---------------------------------------------------------------------------*
104     L1 Data Cache Operations
105  *---------------------------------------------------------------------------*/
106 
107 void DCInvalidateRange  ( void* addr, u32 nBytes );
108 void DCFlushRange       ( void* addr, u32 nBytes );
109 void DCStoreRange       ( void* addr, u32 nBytes );
110 void DCFlushRangeNoSync ( void* addr, u32 nBytes );
111 void DCStoreRangeNoSync ( void* addr, u32 nBytes );
112 void DCZeroRange        ( void* addr, u32 nBytes );
113 void DCTouchRange       ( void* addr, u32 nBytes );
114 
115 /*---------------------------------------------------------------------------*
116     L1 Instruction Cache Operations
117  *---------------------------------------------------------------------------*/
118 
119 void ICInvalidateRange  ( void* addr, u32 nBytes );
120 
121 /*---------------------------------------------------------------------------*
122     Locked Cache Operations
123  *---------------------------------------------------------------------------*/
124 // 0xEnnn nnnn addresses will be mapped in by LCEnable (DBAT3 will be used)
125 #define LC_BASE_PREFIX  0xE000
126 #define LC_BASE         (LC_BASE_PREFIX << 16)
127 
128 void LCEnable           ( void );
129 void LCDisable          ( void );
130 void LCLoadBlocks       ( void* destTag,  void* srcAddr, u32 numBlocks );
131 void LCStoreBlocks      ( void* destAddr, void* srcTag,  u32 numBlocks );
132 u32  LCLoadData         ( void* destAddr, void* srcAddr, u32 nBytes );
133 u32  LCStoreData        ( void* destAddr, void* srcAddr, u32 nBytes );
134 u32  LCQueueLength      ( void );
135 void LCQueueWait        ( u32 len );
136 void LCFlushQueue       ( void );
137 BOOL LCIsEnable         ( void );
138 
139 #define LCGetBase()     ((void*)LC_BASE)
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif  // __OSCACHE_H__
146