1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - camera - include
3   File:     transfer.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-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef TWL_CAMERA_TRANSFER_H_
19 #define TWL_CAMERA_TRANSFER_H_
20 
21 #include <twl/types.h>
22 #include <twl/mi/common/dma.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /*===========================================================================*/
29 
30 /*---------------------------------------------------------------------------*
31   Name:         CAMERA_DmaRecv
32 
33   Description:  Receives frame data from the camera buffer.
34                 Synchronous version.
35 
36   Arguments:    dmaNo: NDMA channel No. (0 - 3)
37                 dest: destination address
38                 unit: One-time transfer length (byte)(width * lines at once)
39                 length: Transfer length (byte) (frame size)
40 
41   Returns:      None.
42  *---------------------------------------------------------------------------*/
CAMERA_DmaRecv(u32 dmaNo,void * dest,u32 unit,u32 length)43 static inline void CAMERA_DmaRecv(u32 dmaNo, void *dest, u32 unit, u32 length)
44 {
45     MI_Camera_NDmaRecv( dmaNo, dest, unit/4, length, FALSE );
46 }
47 
48 /*---------------------------------------------------------------------------*
49   Name:         CAMERA_DmaRecvAsync
50 
51   Description:  Receives frame data from the camera buffer.
52                 Asynchronous version.
53 
54   Arguments:    dmaNo: NDMA channel No. (0 - 3)
55                 dest: destination address
56                 unit: One-time transfer length (bytes) (width * lines at once)
57                 length: Transfer length (bytes) (frame size)
58 
59   Returns:      None.
60  *---------------------------------------------------------------------------*/
CAMERA_DmaRecvAsync(u32 dmaNo,void * dest,u32 unit,u32 length,MINDmaCallback callback,void * arg)61 static inline void CAMERA_DmaRecvAsync(u32 dmaNo, void *dest, u32 unit, u32 length, MINDmaCallback callback, void* arg)
62 {
63     MI_Camera_NDmaRecvAsync( dmaNo, dest, unit/4, length, FALSE, callback, arg );
64 }
65 
66 /*---------------------------------------------------------------------------*
67   Name:         CAMERA_DmaPipeInfinity
68 
69   Description:  Receives data from the camera buffer.
70                 Once a DMA is started, it will transfer all unit data to the same
71                 destination address.
72                 You should call MIi_StopExDma(dmaNo) to stop this.
73 
74   Arguments:    dmaNo: NDMA channel No. (0 - 3)
75                 dest: destination address
76                 unit: One-time transfer length (bytes) (width * lines at once)
77 
78   Returns:      None.
79  *---------------------------------------------------------------------------*/
CAMERA_DmaPipeInfinity(u32 dmaNo,void * dest,u32 unit,MINDmaCallback callback,void * arg)80 static inline void CAMERA_DmaPipeInfinity(u32 dmaNo, void *dest, u32 unit, MINDmaCallback callback, void* arg)
81 {
82     // This is continuous mode, so values equal to 'size' will be ignored
83     MI_Camera_NDmaRecvAsync( dmaNo, dest, unit/4, unit, TRUE, callback, arg );
84 }
85 
86 /*===========================================================================*/
87 
88 #ifdef __cplusplus
89 } /* extern "C" */
90 #endif
91 
92 #endif /* TWL_CAMERA_TRANSFER_H_ */
93