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