CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/wl/include/hnddma.h
Views: 3959
1
/*
2
* Generic Broadcom Home Networking Division (HND) DMA engine SW interface
3
* This supports the following chips: BCM42xx, 44xx, 47xx .
4
*
5
* $Copyright Open Broadcom Corporation$
6
*
7
* $Id: hnddma.h 365056 2012-10-26 12:00:34Z maheshd $
8
*/
9
10
#ifndef _hnddma_h_
11
#define _hnddma_h_
12
13
#ifndef _hnddma_pub_
14
#define _hnddma_pub_
15
typedef const struct hnddma_pub hnddma_t;
16
#endif /* _hnddma_pub_ */
17
18
/* range param for dma_getnexttxp() and dma_txreclaim */
19
typedef enum txd_range {
20
HNDDMA_RANGE_ALL = 1,
21
HNDDMA_RANGE_TRANSMITTED,
22
HNDDMA_RANGE_TRANSFERED
23
} txd_range_t;
24
25
/* dma function type */
26
typedef void (*di_detach_t)(hnddma_t *dmah);
27
typedef bool (*di_txreset_t)(hnddma_t *dmah);
28
typedef bool (*di_rxreset_t)(hnddma_t *dmah);
29
typedef bool (*di_rxidle_t)(hnddma_t *dmah);
30
typedef void (*di_txinit_t)(hnddma_t *dmah);
31
typedef bool (*di_txenabled_t)(hnddma_t *dmah);
32
typedef void (*di_rxinit_t)(hnddma_t *dmah);
33
typedef void (*di_txsuspend_t)(hnddma_t *dmah);
34
typedef void (*di_txresume_t)(hnddma_t *dmah);
35
typedef bool (*di_txsuspended_t)(hnddma_t *dmah);
36
typedef bool (*di_txsuspendedidle_t)(hnddma_t *dmah);
37
#ifdef WL_MULTIQUEUE
38
typedef void (*di_txflush_t)(hnddma_t *dmah);
39
typedef void (*di_txflush_clear_t)(hnddma_t *dmah);
40
#endif /* WL_MULTIQUEUE */
41
typedef int (*di_txfast_t)(hnddma_t *dmah, void *p, bool commit);
42
typedef int (*di_txunframed_t)(hnddma_t *dmah, void *p, uint len, bool commit);
43
typedef void* (*di_getpos_t)(hnddma_t *di, bool direction);
44
typedef void (*di_fifoloopbackenable_t)(hnddma_t *dmah);
45
typedef bool (*di_txstopped_t)(hnddma_t *dmah);
46
typedef bool (*di_rxstopped_t)(hnddma_t *dmah);
47
typedef bool (*di_rxenable_t)(hnddma_t *dmah);
48
typedef bool (*di_rxenabled_t)(hnddma_t *dmah);
49
typedef void* (*di_rx_t)(hnddma_t *dmah);
50
typedef bool (*di_rxfill_t)(hnddma_t *dmah);
51
typedef void (*di_txreclaim_t)(hnddma_t *dmah, txd_range_t range);
52
typedef void (*di_rxreclaim_t)(hnddma_t *dmah);
53
typedef uintptr (*di_getvar_t)(hnddma_t *dmah, const char *name);
54
typedef void* (*di_getnexttxp_t)(hnddma_t *dmah, txd_range_t range);
55
typedef void* (*di_getnextrxp_t)(hnddma_t *dmah, bool forceall);
56
typedef void* (*di_peeknexttxp_t)(hnddma_t *dmah);
57
typedef void* (*di_peekntxp_t)(hnddma_t *dmah, int *len, void *txps[], txd_range_t range);
58
typedef void* (*di_peeknextrxp_t)(hnddma_t *dmah);
59
typedef void (*di_rxparam_get_t)(hnddma_t *dmah, uint16 *rxoffset, uint16 *rxbufsize);
60
typedef void (*di_txblock_t)(hnddma_t *dmah);
61
typedef void (*di_txunblock_t)(hnddma_t *dmah);
62
typedef uint (*di_txactive_t)(hnddma_t *dmah);
63
typedef void (*di_txrotate_t)(hnddma_t *dmah);
64
typedef void (*di_counterreset_t)(hnddma_t *dmah);
65
typedef uint (*di_ctrlflags_t)(hnddma_t *dmah, uint mask, uint flags);
66
typedef char* (*di_dump_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);
67
typedef char* (*di_dumptx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);
68
typedef char* (*di_dumprx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);
69
typedef uint (*di_rxactive_t)(hnddma_t *dmah);
70
typedef uint (*di_txpending_t)(hnddma_t *dmah);
71
typedef uint (*di_txcommitted_t)(hnddma_t *dmah);
72
typedef int (*di_pktpool_set_t)(hnddma_t *dmah, pktpool_t *pool);
73
typedef bool (*di_rxtxerror_t)(hnddma_t *dmah, bool istx);
74
typedef void (*di_burstlen_set_t)(hnddma_t *dmah, uint8 rxburstlen, uint8 txburstlen);
75
typedef uint (*di_avoidancecnt_t)(hnddma_t *dmah);
76
typedef uint (*dma_active_rxbuf_t) (hnddma_t *dmah);
77
78
/* dma opsvec */
79
typedef struct di_fcn_s {
80
di_detach_t detach;
81
di_txinit_t txinit;
82
di_txreset_t txreset;
83
di_txenabled_t txenabled;
84
di_txsuspend_t txsuspend;
85
di_txresume_t txresume;
86
di_txsuspended_t txsuspended;
87
di_txsuspendedidle_t txsuspendedidle;
88
#ifdef WL_MULTIQUEUE
89
di_txflush_t txflush;
90
di_txflush_clear_t txflush_clear;
91
#endif /* WL_MULTIQUEUE */
92
di_txfast_t txfast;
93
di_txunframed_t txunframed;
94
di_getpos_t getpos;
95
di_txstopped_t txstopped;
96
di_txreclaim_t txreclaim;
97
di_getnexttxp_t getnexttxp;
98
di_peeknexttxp_t peeknexttxp;
99
di_peekntxp_t peekntxp;
100
di_txblock_t txblock;
101
di_txunblock_t txunblock;
102
di_txactive_t txactive;
103
di_txrotate_t txrotate;
104
105
di_rxinit_t rxinit;
106
di_rxreset_t rxreset;
107
di_rxidle_t rxidle;
108
di_rxstopped_t rxstopped;
109
di_rxenable_t rxenable;
110
di_rxenabled_t rxenabled;
111
di_rx_t rx;
112
di_rxfill_t rxfill;
113
di_rxreclaim_t rxreclaim;
114
di_getnextrxp_t getnextrxp;
115
di_peeknextrxp_t peeknextrxp;
116
di_rxparam_get_t rxparam_get;
117
118
di_fifoloopbackenable_t fifoloopbackenable;
119
di_getvar_t d_getvar;
120
di_counterreset_t counterreset;
121
di_ctrlflags_t ctrlflags;
122
di_dump_t dump;
123
di_dumptx_t dumptx;
124
di_dumprx_t dumprx;
125
di_rxactive_t rxactive;
126
di_txpending_t txpending;
127
di_txcommitted_t txcommitted;
128
di_pktpool_set_t pktpool_set;
129
di_rxtxerror_t rxtxerror;
130
di_burstlen_set_t burstlen_set;
131
di_avoidancecnt_t avoidancecnt;
132
#ifdef WL_RXBUFF_EARLY_RC
133
dma_active_rxbuf_t dma_activerxbuf;
134
#endif
135
uint endnum;
136
} di_fcn_t;
137
138
/*
139
* Exported data structure (read-only)
140
*/
141
/* export structure */
142
struct hnddma_pub {
143
const di_fcn_t *di_fn; /* DMA function pointers */
144
uint txavail; /* # free tx descriptors */
145
uint dmactrlflags; /* dma control flags */
146
147
/* rx error counters */
148
uint rxgiants; /* rx giant frames */
149
uint rxnobuf; /* rx out of dma descriptors */
150
/* tx error counters */
151
uint txnobuf; /* tx out of dma descriptors */
152
uint txnodesc; /* tx out of dma descriptors running count */
153
};
154
155
156
extern hnddma_t * dma_attach(osl_t *osh, const char *name, si_t *sih,
157
volatile void *dmaregstx, volatile void *dmaregsrx,
158
uint ntxd, uint nrxd, uint rxbufsize, int rxextheadroom, uint nrxpost,
159
uint rxoffset, uint *msg_level);
160
#ifdef BCMDMA32
161
162
#define dma_detach(di) ((di)->di_fn->detach(di))
163
#define dma_txreset(di) ((di)->di_fn->txreset(di))
164
#define dma_rxreset(di) ((di)->di_fn->rxreset(di))
165
#define dma_rxidle(di) ((di)->di_fn->rxidle(di))
166
#define dma_txinit(di) ((di)->di_fn->txinit(di))
167
#define dma_txenabled(di) ((di)->di_fn->txenabled(di))
168
#define dma_rxinit(di) ((di)->di_fn->rxinit(di))
169
#define dma_txsuspend(di) ((di)->di_fn->txsuspend(di))
170
#define dma_txresume(di) ((di)->di_fn->txresume(di))
171
#define dma_txsuspended(di) ((di)->di_fn->txsuspended(di))
172
#define dma_txsuspendedidle(di) ((di)->di_fn->txsuspendedidle(di))
173
#ifdef WL_MULTIQUEUE
174
#define dma_txflush(di) ((di)->di_fn->txflush(di))
175
#define dma_txflush_clear(di) ((di)->di_fn->txflush_clear(di))
176
#endif /* WL_MULTIQUEUE */
177
#define dma_txfast(di, p, commit) ((di)->di_fn->txfast(di, p, commit))
178
#define dma_fifoloopbackenable(di) ((di)->di_fn->fifoloopbackenable(di))
179
#define dma_txstopped(di) ((di)->di_fn->txstopped(di))
180
#define dma_rxstopped(di) ((di)->di_fn->rxstopped(di))
181
#define dma_rxenable(di) ((di)->di_fn->rxenable(di))
182
#define dma_rxenabled(di) ((di)->di_fn->rxenabled(di))
183
#define dma_rx(di) ((di)->di_fn->rx(di))
184
#define dma_rxfill(di) ((di)->di_fn->rxfill(di))
185
#define dma_txreclaim(di, range) ((di)->di_fn->txreclaim(di, range))
186
#define dma_rxreclaim(di) ((di)->di_fn->rxreclaim(di))
187
#define dma_getvar(di, name) ((di)->di_fn->d_getvar(di, name))
188
#define dma_getnexttxp(di, range) ((di)->di_fn->getnexttxp(di, range))
189
#define dma_getnextrxp(di, forceall) ((di)->di_fn->getnextrxp(di, forceall))
190
#define dma_peeknexttxp(di) ((di)->di_fn->peeknexttxp(di))
191
#define dma_peekntxp(di, l, t, r) ((di)->di_fn->peekntxp(di, l, t, r))
192
#define dma_peeknextrxp(di) ((di)->di_fn->peeknextrxp(di))
193
#define dma_rxparam_get(di, off, bufs) ((di)->di_fn->rxparam_get(di, off, bufs))
194
195
#define dma_txblock(di) ((di)->di_fn->txblock(di))
196
#define dma_txunblock(di) ((di)->di_fn->txunblock(di))
197
#define dma_txactive(di) ((di)->di_fn->txactive(di))
198
#define dma_rxactive(di) ((di)->di_fn->rxactive(di))
199
#define dma_txrotate(di) ((di)->di_fn->txrotate(di))
200
#define dma_counterreset(di) ((di)->di_fn->counterreset(di))
201
#define dma_ctrlflags(di, mask, flags) ((di)->di_fn->ctrlflags((di), (mask), (flags)))
202
#define dma_txpending(di) ((di)->di_fn->txpending(di))
203
#define dma_txcommitted(di) ((di)->di_fn->txcommitted(di))
204
#define dma_pktpool_set(di, pool) ((di)->di_fn->pktpool_set((di), (pool)))
205
#if defined(BCMDBG) || defined(BCMDBG_DUMP)
206
#define dma_dump(di, buf, dumpring) ((di)->di_fn->dump(di, buf, dumpring))
207
#define dma_dumptx(di, buf, dumpring) ((di)->di_fn->dumptx(di, buf, dumpring))
208
#define dma_dumprx(di, buf, dumpring) ((di)->di_fn->dumprx(di, buf, dumpring))
209
#endif /* defined(BCMDBG) || defined(BCMDBG_DUMP) */
210
#define dma_rxtxerror(di, istx) ((di)->di_fn->rxtxerror(di, istx))
211
#define dma_burstlen_set(di, rxlen, txlen) ((di)->di_fn->burstlen_set(di, rxlen, txlen))
212
#define dma_avoidance_cnt(di) ((di)->di_fn->avoidancecnt(di))
213
214
#else /* BCMDMA32 */
215
extern const di_fcn_t dma64proc;
216
217
#define dma_detach(di) (dma64proc.detach(di))
218
#define dma_txreset(di) (dma64proc.txreset(di))
219
#define dma_rxreset(di) (dma64proc.rxreset(di))
220
#define dma_rxidle(di) (dma64proc.rxidle(di))
221
#define dma_txinit(di) (dma64proc.txinit(di))
222
#define dma_txenabled(di) (dma64proc.txenabled(di))
223
#define dma_rxinit(di) (dma64proc.rxinit(di))
224
#define dma_txsuspend(di) (dma64proc.txsuspend(di))
225
#define dma_txresume(di) (dma64proc.txresume(di))
226
#define dma_txsuspended(di) (dma64proc.txsuspended(di))
227
#define dma_txsuspendedidle(di) (dma64proc.txsuspendedidle(di))
228
#ifdef WL_MULTIQUEUE
229
#define dma_txflush(di) (dma64proc.txflush(di))
230
#define dma_txflush_clear(di) (dma64proc.txflush_clear(di))
231
#endif /* WL_MULTIQUEUE */
232
#define dma_txfast(di, p, commit) (dma64proc.txfast(di, p, commit))
233
#define dma_txunframed(di, p, l, commit)(dma64proc.txunframed(di, p, l, commit))
234
#define dma_getpos(di, dir) (dma64proc.getpos(di, dir))
235
#define dma_fifoloopbackenable(di) (dma64proc.fifoloopbackenable(di))
236
#define dma_txstopped(di) (dma64proc.txstopped(di))
237
#define dma_rxstopped(di) (dma64proc.rxstopped(di))
238
#define dma_rxenable(di) (dma64proc.rxenable(di))
239
#define dma_rxenabled(di) (dma64proc.rxenabled(di))
240
#define dma_rx(di) (dma64proc.rx(di))
241
#define dma_rxfill(di) (dma64proc.rxfill(di))
242
#define dma_txreclaim(di, range) (dma64proc.txreclaim(di, range))
243
#define dma_rxreclaim(di) (dma64proc.rxreclaim(di))
244
#define dma_getvar(di, name) (dma64proc.d_getvar(di, name))
245
#define dma_getnexttxp(di, range) (dma64proc.getnexttxp(di, range))
246
#define dma_getnextrxp(di, forceall) (dma64proc.getnextrxp(di, forceall))
247
#define dma_peeknexttxp(di) (dma64proc.peeknexttxp(di))
248
#define dma_peekntxp(di, l, t, r) (dma64proc.peekntxp(di, l, t, r))
249
#define dma_peeknextrxp(di) (dma64proc.peeknextrxp(di))
250
#define dma_rxparam_get(di, off, bufs) (dma64proc.rxparam_get(di, off, bufs))
251
252
#define dma_txblock(di) (dma64proc.txblock(di))
253
#define dma_txunblock(di) (dma64proc.txunblock(di))
254
#define dma_txactive(di) (dma64proc.txactive(di))
255
#define dma_rxactive(di) (dma64proc.rxactive(di))
256
#define dma_txrotate(di) (dma64proc.txrotate(di))
257
#define dma_counterreset(di) (dma64proc.counterreset(di))
258
#define dma_ctrlflags(di, mask, flags) (dma64proc.ctrlflags((di), (mask), (flags)))
259
#define dma_txpending(di) (dma64proc.txpending(di))
260
#define dma_txcommitted(di) (dma64proc.txcommitted(di))
261
#define dma_pktpool_set(di, pool) (dma64proc.pktpool_set((di), (pool)))
262
#if defined(BCMDBG) || defined(BCMDBG_DUMP)
263
#define dma_dump(di, buf, dumpring) (dma64proc.dump(di, buf, dumpring))
264
#define dma_dumptx(di, buf, dumpring) (dma64proc.dumptx(di, buf, dumpring))
265
#define dma_dumprx(di, buf, dumpring) (dma64proc.dumprx(di, buf, dumpring))
266
#endif
267
#define dma_rxtxerror(di, istx) (dma64proc.rxtxerror(di, istx))
268
#define dma_burstlen_set(di, rxlen, txlen) (dma64proc.burstlen_set(di, rxlen, txlen))
269
#define dma_avoidance_cnt(di) (dma64proc.avoidancecnt(di))
270
#define dma_activerxbuf(di) (dma64proc.dma_activerxbuf(di))
271
272
#endif /* BCMDMA32 */
273
274
/* return addresswidth allowed
275
* This needs to be done after SB attach but before dma attach.
276
* SB attach provides ability to probe backplane and dma core capabilities
277
* This info is needed by DMA_ALLOC_CONSISTENT in dma attach
278
*/
279
extern uint dma_addrwidth(si_t *sih, void *dmaregs);
280
281
/* pio helpers */
282
extern void dma_txpioloopback(osl_t *osh, dma32regs_t *);
283
284
#endif /* _hnddma_h_ */
285
286