[kernel] 2.6.31: update generic config
[openwrt.git] / package / broadcom-wl / src / driver / hnddma.h
1 /*
2 * Generic Broadcom Home Networking Division (HND) DMA engine SW interface
3 * This supports the following chips: BCM42xx, 44xx, 47xx .
4 *
5 * Copyright 2007, Broadcom Corporation
6 * All Rights Reserved.
7 *
8 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
9 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
10 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
11 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
12 */
13
14 #ifndef _hnddma_h_
15 #define _hnddma_h_
16
17 typedef const struct hnddma_pub hnddma_t;
18
19 /* dma function type */
20 typedef void (*di_detach_t)(hnddma_t *dmah);
21 typedef bool (*di_txreset_t)(hnddma_t *dmah);
22 typedef bool (*di_rxreset_t)(hnddma_t *dmah);
23 typedef bool (*di_rxidle_t)(hnddma_t *dmah);
24 typedef void (*di_txinit_t)(hnddma_t *dmah);
25 typedef bool (*di_txenabled_t)(hnddma_t *dmah);
26 typedef void (*di_rxinit_t)(hnddma_t *dmah);
27 typedef void (*di_txsuspend_t)(hnddma_t *dmah);
28 typedef void (*di_txresume_t)(hnddma_t *dmah);
29 typedef bool (*di_txsuspended_t)(hnddma_t *dmah);
30 typedef bool (*di_txsuspendedidle_t)(hnddma_t *dmah);
31 typedef int (*di_txfast_t)(hnddma_t *dmah, void *p, bool commit);
32 typedef void (*di_fifoloopbackenable_t)(hnddma_t *dmah);
33 typedef bool (*di_txstopped_t)(hnddma_t *dmah);
34 typedef bool (*di_rxstopped_t)(hnddma_t *dmah);
35 typedef bool (*di_rxenable_t)(hnddma_t *dmah);
36 typedef bool (*di_rxenabled_t)(hnddma_t *dmah);
37 typedef void* (*di_rx_t)(hnddma_t *dmah);
38 typedef void (*di_rxfill_t)(hnddma_t *dmah);
39 typedef void (*di_txreclaim_t)(hnddma_t *dmah, bool forceall);
40 typedef void (*di_rxreclaim_t)(hnddma_t *dmah);
41 typedef uintptr (*di_getvar_t)(hnddma_t *dmah, const char *name);
42 typedef void* (*di_getnexttxp_t)(hnddma_t *dmah, bool forceall);
43 typedef void* (*di_getnextrxp_t)(hnddma_t *dmah, bool forceall);
44 typedef void* (*di_peeknexttxp_t)(hnddma_t *dmah);
45 typedef void (*di_txblock_t)(hnddma_t *dmah);
46 typedef void (*di_txunblock_t)(hnddma_t *dmah);
47 typedef uint (*di_txactive_t)(hnddma_t *dmah);
48 typedef void (*di_txrotate_t)(hnddma_t *dmah);
49 typedef void (*di_counterreset_t)(hnddma_t *dmah);
50 typedef char* (*di_dump_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);
51 typedef char* (*di_dumptx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);
52 typedef char* (*di_dumprx_t)(hnddma_t *dmah, struct bcmstrbuf *b, bool dumpring);
53
54 /* dma opsvec */
55 typedef struct di_fcn_s {
56 di_detach_t detach;
57 di_txinit_t txinit;
58 di_txreset_t txreset;
59 di_txenabled_t txenabled;
60 di_txsuspend_t txsuspend;
61 di_txresume_t txresume;
62 di_txsuspended_t txsuspended;
63 di_txsuspendedidle_t txsuspendedidle;
64 di_txfast_t txfast;
65 di_txstopped_t txstopped;
66 di_txreclaim_t txreclaim;
67 di_getnexttxp_t getnexttxp;
68 di_peeknexttxp_t peeknexttxp;
69 di_txblock_t txblock;
70 di_txunblock_t txunblock;
71 di_txactive_t txactive;
72 di_txrotate_t txrotate;
73
74 di_rxinit_t rxinit;
75 di_rxreset_t rxreset;
76 di_rxidle_t rxidle;
77 di_rxstopped_t rxstopped;
78 di_rxenable_t rxenable;
79 di_rxenabled_t rxenabled;
80 di_rx_t rx;
81 di_rxfill_t rxfill;
82 di_rxreclaim_t rxreclaim;
83 di_getnextrxp_t getnextrxp;
84
85 di_fifoloopbackenable_t fifoloopbackenable;
86 di_getvar_t d_getvar;
87 di_counterreset_t counterreset;
88 di_dump_t dump;
89 di_dumptx_t dumptx;
90 di_dumprx_t dumprx;
91 uint endnum;
92 } di_fcn_t;
93
94 /*
95 * Exported data structure (read-only)
96 */
97 /* export structure */
98 struct hnddma_pub {
99 di_fcn_t di_fn; /* DMA function pointers */
100 uint txavail; /* # free tx descriptors */
101
102 /* rx error counters */
103 uint rxgiants; /* rx giant frames */
104 uint rxnobuf; /* rx out of dma descriptors */
105 /* tx error counters */
106 uint txnobuf; /* tx out of dma descriptors */
107 };
108
109
110 extern hnddma_t * dma_attach(osl_t *osh, char *name, sb_t *sbh, void *dmaregstx, void *dmaregsrx,
111 uint ntxd, uint nrxd, uint rxbufsize, uint nrxpost, uint rxoffset,
112 uint *msg_level);
113 #define dma_detach(di) ((di)->di_fn.detach(di))
114 #define dma_txreset(di) ((di)->di_fn.txreset(di))
115 #define dma_rxreset(di) ((di)->di_fn.rxreset(di))
116 #define dma_rxidle(di) ((di)->di_fn.rxidle(di))
117 #define dma_txinit(di) ((di)->di_fn.txinit(di))
118 #define dma_txenabled(di) ((di)->di_fn.txenabled(di))
119 #define dma_rxinit(di) ((di)->di_fn.rxinit(di))
120 #define dma_txsuspend(di) ((di)->di_fn.txsuspend(di))
121 #define dma_txresume(di) ((di)->di_fn.txresume(di))
122 #define dma_txsuspended(di) ((di)->di_fn.txsuspended(di))
123 #define dma_txsuspendedidle(di) ((di)->di_fn.txsuspendedidle(di))
124 #define dma_txfast(di, p, commit) ((di)->di_fn.txfast(di, p, commit))
125 #define dma_fifoloopbackenable(di) ((di)->di_fn.fifoloopbackenable(di))
126 #define dma_txstopped(di) ((di)->di_fn.txstopped(di))
127 #define dma_rxstopped(di) ((di)->di_fn.rxstopped(di))
128 #define dma_rxenable(di) ((di)->di_fn.rxenable(di))
129 #define dma_rxenabled(di) ((di)->di_fn.rxenabled(di))
130 #define dma_rx(di) ((di)->di_fn.rx(di))
131 #define dma_rxfill(di) ((di)->di_fn.rxfill(di))
132 #define dma_txreclaim(di, forceall) ((di)->di_fn.txreclaim(di, forceall))
133 #define dma_rxreclaim(di) ((di)->di_fn.rxreclaim(di))
134 #define dma_getvar(di, name) ((di)->di_fn.d_getvar(di, name))
135 #define dma_getnexttxp(di, forceall) ((di)->di_fn.getnexttxp(di, forceall))
136 #define dma_getnextrxp(di, forceall) ((di)->di_fn.getnextrxp(di, forceall))
137 #define dma_peeknexttxp(di) ((di)->di_fn.peeknexttxp(di))
138 #define dma_txblock(di) ((di)->di_fn.txblock(di))
139 #define dma_txunblock(di) ((di)->di_fn.txunblock(di))
140 #define dma_txactive(di) ((di)->di_fn.txactive(di))
141 #define dma_txrotate(di) ((di)->di_fn.txrotate(di))
142 #define dma_counterreset(di) ((di)->di_fn.counterreset(di))
143 #ifdef BCMDBG
144 #define dma_dump(di, buf, dumpring) ((di)->di_fn.dump(di, buf, dumpring))
145 #define dma_dumptx(di, buf, dumpring) ((di)->di_fn.dumptx(di, buf, dumpring))
146 #define dma_dumprx(di, buf, dumpring) ((di)->di_fn.dumprx(di, buf, dumpring))
147 #endif
148
149 /* return addresswidth allowed
150 * This needs to be done after SB attach but before dma attach.
151 * SB attach provides ability to probe backplane and dma core capabilities
152 * This info is needed by DMA_ALLOC_CONSISTENT in dma attach
153 */
154 extern uint dma_addrwidth(sb_t *sbh, void *dmaregs);
155
156 /* pio helpers */
157 void dma_txpioloopback(osl_t *osh, dma32regs_t *);
158
159 #endif /* _hnddma_h_ */
This page took 0.07607 seconds and 5 git commands to generate.