1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - CARD - libraries 3 File: card_utility.h 4 5 Copyright 2007-2008 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 $Date:: 2008-09-17#$ 14 $Rev: 8556 $ 15 $Author: okubata_ryoma $ 16 17 *---------------------------------------------------------------------------*/ 18 #ifndef NITRO_LIBRARIES_CARD_UTILITY_H__ 19 #define NITRO_LIBRARIES_CARD_UTILITY_H__ 20 21 22 #include <nitro/types.h> 23 24 25 #ifdef __cplusplus 26 extern "C" 27 { 28 #endif 29 30 31 /*---------------------------------------------------------------------------*/ 32 /* Declarations */ 33 34 // Command interface for switching between the old and new DMA. 35 typedef struct CARDDmaInterface 36 { 37 void (*Recv)(u32 channel, const void *src, void *dst, u32 len); 38 void (*Stop)(u32 channel); 39 } 40 CARDDmaInterface; 41 42 43 /*---------------------------------------------------------------------------*/ 44 /* functions */ 45 46 /*---------------------------------------------------------------------------* 47 Name: CARDi_GetDmaInterface 48 49 Description: Gets either the new or old DMA command interface from a DMA channel after determining which is appropriate. 50 51 52 Arguments: channel DMA channel. 53 The range starts at 0 and ends at MI_DMA_MAX_NUM. If MI_DMA_USING_NEW is enabled, it indicates the new DMA. 54 55 56 Returns: The appropriate DMA interface (either old or new). 57 *---------------------------------------------------------------------------*/ 58 const CARDDmaInterface* CARDi_GetDmaInterface(u32 channel); 59 60 /*---------------------------------------------------------------------------* 61 Name: CARDi_ICInvalidateSmart 62 63 Description: Chooses the IC_InvalidateAll or IC_InvalidateRange function based on a threshold value. 64 65 Arguments: buffer The buffer that should be invalidated 66 length The size that should be invalidated 67 threshold The threshold value to switch processing 68 69 Returns: None. 70 *---------------------------------------------------------------------------*/ 71 void CARDi_ICInvalidateSmart(void *buffer, u32 length, u32 threshold); 72 73 /*---------------------------------------------------------------------------* 74 Name: CARDi_DCInvalidateSmart 75 76 Description: Chooses the DC_FlushAll or DC_InvalidateRange function based on a threshold value. 77 If the buffer is not aligned to a cache line, a Store operation will also be performed automatically at only the beginning and end. 78 79 80 Arguments: buffer The buffer that should be invalidated 81 length The size that should be invalidated 82 threshold The threshold value to switch processing 83 84 Returns: None. 85 *---------------------------------------------------------------------------*/ 86 void CARDi_DCInvalidateSmart(void *buffer, u32 length, u32 threshold); 87 88 89 #ifdef __cplusplus 90 } // extern "C" 91 #endif 92 93 94 95 #endif // NITRO_LIBRARIES_CARD_UTILITY_H__ 96