1:
12:
13:
17:
18:
#ifndef _DMACMGR_H_
19:
#define _DMACMGR_H_
20:
21:
22:
#ifdef __cplusplus
23:
extern "C" {
24:
#endif
25:
26:
27:
#define AG903_DMAC_DESC_LINK_MAX (16)
28:
29:
30:
#define AG903_DMAC_LDD_ENTRY_NUM (32)
31:
32:
33:
#define AG903_DMAC_RDD_ENTRY_NUM (16)
34:
35:
36:
#define AG903_DMAC_DESC_SIZE (32)
37:
38:
39:
#define AG903_DMAC_INTSTS_TERM (1<<0)
40:
41:
42:
#define AG903_DMAC_INTSTS_ABORT (1<<1)
43:
44:
45:
#define AG903_DMAC_INTSTS_WDT (1<<2)
46:
47:
48:
#define AG903_DMAC_INTSTS_ERROR (1<<3)
49:
50:
51:
typedef uint32_t
AG903_DMACMgrHandle;
52:
53:
54:
typedef struct _AG903_DMACMgrStatus
55: {
56: uint8_t enable;
57: uint8_t reserve[3];
58: }
AG903_DMACMgrStatus;
59:
60:
61:
typedef struct _AG903_DMACMgrDesc
62: {
63: uint32_t SrcAddr;
64: uint32_t DstAddr;
65:
66:
void *next;
67:
68:
69:
union
70: {
71:
72:
struct {
73:
unsigned int ChWEvent : 8;
74:
unsigned int WSync : 1;
75:
unsigned int ChSEvent : 3;
76:
unsigned int SEventEn : 1;
77:
unsigned int WEventEn : 1;
78:
unsigned int SDEn : 1;
79:
unsigned int ExpEn : 1;
80:
unsigned int ChEn : 1;
81:
unsigned int WDTEn : 1;
82:
unsigned int DstCtrl : 2;
83:
unsigned int SrcCtrl : 2;
84:
unsigned int DstWidth : 3;
85:
unsigned int SrcWidth : 3;
86:
unsigned int TCMsk : 1;
87:
unsigned int SrcTcnt : 3;
88: } st;
89:
90: uint32_t val;
91: } Ctrl;
92:
93:
94:
union
95: {
96:
97:
struct {
98:
unsigned int TCnt : 22;
99:
unsigned int : 10;
100: } d1;
101:
102:
103:
struct {
104:
unsigned int XTCnt : 16;
105:
unsigned int YTCnt : 16;
106: } d2;
107:
108: uint32_t val;
109: } Trns;
110:
111:
112:
union
113: {
114:
115:
struct {
116:
unsigned int SrcStride : 16;
117:
unsigned int DstStride : 16;
118: } st;
119:
120: uint32_t val;
121: } Stride;
122:
123: }
AG903_DMACMgrDesc;
124:
125:
126:
typedef union _AG903_DMACMgrConfig
127: {
128:
129:
struct {
130:
unsigned int TCIntMsk : 1;
131:
unsigned int ErrIntMsk : 1;
132:
unsigned int AbtIntMsk : 1;
133:
unsigned int SrcRS : 4;
134:
unsigned int SrcHEn : 1;
135:
unsigned int : 1;
136:
unsigned int DstRS : 4;
137:
unsigned int DstHEn : 1;
138:
unsigned int : 2;
139:
unsigned int LLPCnt : 4;
140:
unsigned int ChGntWin : 8;
141:
unsigned int ChPri : 1;
142:
unsigned int : 1;
143:
unsigned int WOMode : 1;
144:
unsigned int UnalignMode : 1;
145: } st;
146: uint32_t val;
147:
148: }
AG903_DMACMgrConfig;
149:
150:
151:
152: int32_t
AG903_DMACMgrGetHandle(
int ch,
AG903_DMACMgrHandle **handle);
153: int32_t
AG903_DMACMgrReleaseHandle(
AG903_DMACMgrHandle *handle);
154: int32_t
AG903_DMACMgrGetIntStatus(
AG903_DMACMgrHandle *handle, uint32_t *status);
155: int32_t
AG903_DMACMgrClearInt(
AG903_DMACMgrHandle *handle, uint32_t clrbit);
156: int32_t
AG903_DMACMgrSetIntCallback(
AG903_DMACMgrHandle *handle,
157:
void (*cb_term)(
AG903_DMACMgrHandle*,
AG903_DMACMgrDesc**, uint8_t*),
158:
void (*cb_abt)(
AG903_DMACMgrHandle*),
159:
void (*cb_error)(
AG903_DMACMgrHandle*));
160: int32_t
AG903_DMACMgrUnsetIntCallback(
AG903_DMACMgrHandle *handle);
161: int32_t
AG903_DMACMgrEnable(
AG903_DMACMgrHandle *handle);
162: int32_t
AG903_DMACMgrAbort(
AG903_DMACMgrHandle *handle);
163: int32_t
AG903_DMACMgrSetSyncPeripheral(
int port,
int val);
164: int32_t
AG903_DMACMgrSetWatchdog(
int val);
165: int32_t
AG903_DMACMgrSetConstantValue(uint32_t val);
166: int32_t
AG903_DMACMgrSetEvent(
int id);
167: int32_t
AG903_DMACMgrClearEvent(
int id);
168: int32_t
AG903_DMACMgrGetEvent(
int id, uint8_t *val);
169: int32_t
AG903_DMACMgrSetSimpleTrnsDesc(
AG903_DMACMgrHandle *handle,
void *from, uint32_t from_size,
void *to);
170: int32_t
AG903_DMACMgrSetDescList(
AG903_DMACMgrHandle *handle,
AG903_DMACMgrConfig *config,
AG903_DMACMgrDesc *desc_list,
int list_num);
171: int32_t
AG903_DMACMgrRemoveDescList(
AG903_DMACMgrHandle *handle);
172: int32_t
AG903_DMACMgrSetRemoteDescAddr(
void *addr);
173: int32_t
AG903_DMACMgrClearRemoteDescAddr(
void);
174: int32_t
AG903_DMACMgrGetStatus(
AG903_DMACMgrHandle *handle,
AG903_DMACMgrStatus *status);
175:
176:
#ifdef __cplusplus
177: }
178:
#endif
179:
#endif