1 2 /*---------------------------------------------------------------------------* 3 Project: OS - High Level Cache Operations 4 File: OSCache.h 5 6 Copyright 1998-2011 Nintendo. All rights reserved. 7 8 These coded instructions, statements, and computer programs contain 9 proprietary information of Nintendo of America Inc. and/or Nintendo 10 Company Ltd., and are protected by Federal copyright law. They may 11 not be disclosed to third parties or copied or duplicated in any form, 12 in whole or in part, without the prior written consent of Nintendo. 13 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef __OSCACHE_H__ 17 #define __OSCACHE_H__ 18 19 #include <types.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /*---------------------------------------------------------------------------* 26 L1 Data Cache Operations 27 *---------------------------------------------------------------------------*/ 28 29 void DCInvalidateRange ( void* addr, u32 nBytes ); 30 void DCFlushRange ( const void* addr, u32 nBytes ); 31 void DCStoreRange ( const void* addr, u32 nBytes ); 32 void DCFlushRangeNoSync ( const void* addr, u32 nBytes ); 33 void DCStoreRangeNoSync ( const void* addr, u32 nBytes ); 34 void DCZeroRange ( void* addr, u32 nBytes ); 35 void DCTouchRange ( const void* addr, u32 nBytes ); 36 37 38 /*---------------------------------------------------------------------------* 39 Locked Cache Operations 40 *---------------------------------------------------------------------------*/ 41 42 // maximum size of a single DMA transaction 43 #define LC_MAX_DMA_BLOCKS (128) 44 #define LC_MAX_DMA_BYTES (LC_MAX_DMA_BLOCKS * 32) 45 46 #define LC_MAX_BYTES 0x4000 // 16KB LC 47 #define LC_MIN_ALLOC 512 // in bytes 48 49 u32 LCGetMaxSize (void); 50 u32 LCGetUnallocated (void); 51 u32 LCGetAllocatableSize(void); 52 void* LCAlloc (u32 nBytes); 53 void LCDealloc (void *lcAddr); 54 BOOL LCEnableDMA (void); 55 void LCDisableDMA (void); 56 BOOL LCIsDMAEnabled (void); 57 void LCLoadDMABlocks (void* lcDestAddr, const void* memSrcAddr, u32 numBlocks); 58 void LCStoreDMABlocks (void* memDestAddr, const void* lcSrcAddr, u32 numBlocks); 59 u32 LCGetDMAQueueLength (void); 60 void LCWaitDMAQueue (u32 len); 61 62 63 BOOL OSIsAddressRangeDCValid(const void *addr, u32 nBytes); 64 65 BOOL DCCoreFlushAll(void *flush_buf, u32 size); 66 67 #ifdef __cplusplus 68 } 69 #endif 70 71 #endif // __OSCACHE_H__ 72