1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - MI
3 File: mi_dma_card.c
4
5 Copyright 2003-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-18#$
14 $Rev: 8573 $
15 $Author: okubata_ryoma $
16 *---------------------------------------------------------------------------*/
17
18 #include <nitro.h>
19 #include "../include/mi_dma.h"
20
21
22 /*---------------------------------------------------------------------------*
23 Name: MIi_CardDmaCopy32
24
25 Description: CARD DMA copy.
26 32bit, sync version.
27 (This sets only DMA-control. CARD register must be set after)
28
29 Arguments: dmaNo: DMA channel number
30 src: Source address
31 dest: destination address
32 size: Transfer size (bytes)
33
34 Returns: None.
35 *---------------------------------------------------------------------------*/
MIi_CardDmaCopy32(u32 dmaNo,const void * src,void * dest,u32 size)36 void MIi_CardDmaCopy32(u32 dmaNo, const void *src, void *dest, u32 size)
37 {
38 vu32 *dmaCntp;
39
40 MIi_ASSERT_DMANO(dmaNo);
41 MIi_ASSERT_DEST_ALIGN4(dest);
42 /* Size is not used in this function, but specify to make determinations */
43 MIi_ASSERT_SRC_ALIGN512(size);
44 MIi_WARNING_ADDRINTCM(dest, size);
45 (void)size;
46
47 #ifdef SDK_ARM9
48 /*
49 * CARD DMA differs from other DMA in that there is no possibility of doing same types in parallel.
50 * Although there is centralized management for the CARD library on the calling side, since check functionality is available anyway, set to MIi_DMA_TIMING_ANY to also detect same types.
51 *
52 */
53 MIi_CheckAnotherAutoDMA(dmaNo, MIi_DMA_TIMING_ANY);
54 #endif
55 //---- Check DMA0 source address
56 MIi_CheckDma0SourceAddress(dmaNo, (u32)src, size, MI_DMA_SRC_FIX);
57
58 if (size == 0)
59 {
60 return;
61 }
62
63 MIi_Wait_BeforeDMA(dmaCntp, dmaNo);
64 // MIi_DmaSetParams(dmaNo, (u32)src, (u32)dest,
65 // (u32)(MI_CNT_CARDRECV32(4) | MI_DMA_CONTINUOUS_ON));
66 MIi_DmaSetParameters(dmaNo, (u32)src, (u32)dest,
67 (u32)(MI_CNT_CARDRECV32(4) | MI_DMA_CONTINUOUS_ON), 0);
68 /*
69 * Here, automatic startup was just turned on.
70 * It will start up for the first time when commands are configured in the CARD register.
71 */
72 }
73