1 /******************************************************************************\
2 * Copyright (C) 1999-2000 Texas Instruments Incorporated.
3 * All Rights Reserved
4 *------------------------------------------------------------------------------
5 * FILENAME...... csl_dat.h
6 * DATE CREATED.. 11/11/1999
7 * LAST MODIFIED. 10/03/2000
8 \******************************************************************************/
9 #ifndef _CSL_DAT_H_
10 #define _CSL_DAT_H_
12 #define EDMA_SUPPORT 1
13 #define DAT_SUPPORT 1
15 #include <xdc/std.h>
17 #if (DAT_SUPPORT)
18 /******************************************************************************\
19 * scope and inline control macros
20 \******************************************************************************/
21 #ifdef __cplusplus
22 #define CSLAPI extern "C" far
23 #else
24 #define CSLAPI extern far
25 #endif
27 #undef USEDEFS
28 #undef IDECL
29 #undef IDEF
31 #ifdef _DAT_MOD_
32 #define IDECL CSLAPI
33 #define USEDEFS
34 #define IDEF
35 #else
36 #ifdef _INLINE
37 #define IDECL static inline
38 #define USEDEFS
39 #define IDEF static inline
40 #else
41 #define IDECL CSLAPI
42 #endif
43 #endif
46 /******************************************************************************\
47 * global macro declarations
48 \******************************************************************************/
49 #if (DMA_SUPPORT)
50 #define DAT_CHAANY DMA_CHAANY
51 #define DAT_CHA0 DMA_CHA0
52 #define DAT_CHA1 DMA_CHA1
53 #define DAT_CHA2 DMA_CHA2
54 #define DAT_CHA3 DMA_CHA3
55 #define DAT_PRI_LOW DMA_PRICTL_PRI_CPU
56 #define DAT_PRI_HIGH DMA_PRICTL_PRI_DMA
58 #define DAT_1D2D 0x000000D0
59 #define DAT_2D1D 0x00000070
60 #define DAT_2D2D 0x000000F0
62 #elif (EDMA_SUPPORT)
63 #define DAT_CHAANY 0
64 #define DAT_CHA0 0
65 #define DAT_CHA1 0
66 #define DAT_CHA2 0
67 #define DAT_CHA3 0
68 #define DAT_PRI_LOW EDMA_OPT_PRI_LOW
69 #define DAT_PRI_HIGH EDMA_OPT_PRI_HIGH
71 #define DAT_1D2D 0x01A00001
72 #define DAT_2D1D 0x05200001
73 #define DAT_2D2D 0x05A00001
74 #endif
76 /* open flags */
77 #define DAT_OPEN_2D 1
79 /* special magic transfer IDs */
80 #define DAT_XFRID_WAITALL 0xFFFFFFFF
81 #define DAT_XFRID_WAITNONE 0xFFFF0010
84 /******************************************************************************\
85 * global typedef declarations
86 \******************************************************************************/
87 #if (DMA_SUPPORT)
88 typedef struct {
89 Uint32 useMask;
90 Uint32 baseAddr;
91 Uint32 gblcntAddr;
92 Uint32 gblidxAddr;
93 Uint32 initPrictl;
94 } _DAT_StateStruct;
95 #endif
97 #if (EDMA_SUPPORT)
98 typedef struct {
99 Uint32 useMask;
100 Uint32 baseAddr;
101 Uint32 initOpt;
102 } _DAT_StateStruct;
103 #endif
106 /******************************************************************************\
107 * global variable declarations
108 \******************************************************************************/
109 extern far _DAT_StateStruct _DAT_stateStruct;
112 /******************************************************************************\
113 * global function declarations
114 \******************************************************************************/
115 CSLAPI int DAT_open(int chaNum, int priority, Uint32 flags);
116 CSLAPI void DAT_close();
118 CSLAPI Uint32 DAT_copy(void *src , void *dst , Uint16 byteCnt);
119 CSLAPI Uint32 DAT_fill(void *dst , Uint16 byteCnt, Uint32 *value);
120 CSLAPI void DAT_wait(Uint32 id);
121 CSLAPI int DAT_busy(Uint32 id);
123 CSLAPI Uint32 DAT_copy2d(Uint32 type, void *src, void *dst, Uint16 lineLen, Uint16 lineCnt, Uint16 linePitch);
126 /******************************************************************************\
127 * inline function declarations
128 \******************************************************************************/
129 IDECL void DAT_setPriority(int priority);
132 /******************************************************************************\
133 * inline function definitions
134 \******************************************************************************/
135 #ifdef USEDEFS
136 /*----------------------------------------------------------------------------*/
137 IDEF void DAT_setPriority(int priority) {
138 #if (DMA_SUPPORT)
139 DMA_FSETA(&(_DAT_stateStruct.initPrictl), PRICTL, PRI, priority);
140 #endif
142 #if 0
143 #if (EDMA_SUPPORT)
144 EDMA_FSETA(&(_DAT_stateStruct.initOpt), OPT, PRI, priority);
145 #endif
146 #endif
147 }
148 /*----------------------------------------------------------------------------*/
149 #endif /* USEDEFS */
152 #endif /* DAT_SUPPORT */
153 #endif /* _CSL_DAT_H_ */
154 /******************************************************************************\
155 * End of csl_dat.h
156 \******************************************************************************/