ar5212desc.h revision 1.1 1 1.1 alc /*
2 1.1 alc * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 1.1 alc * Copyright (c) 2002-2008 Atheros Communications, Inc.
4 1.1 alc *
5 1.1 alc * Permission to use, copy, modify, and/or distribute this software for any
6 1.1 alc * purpose with or without fee is hereby granted, provided that the above
7 1.1 alc * copyright notice and this permission notice appear in all copies.
8 1.1 alc *
9 1.1 alc * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 1.1 alc * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 1.1 alc * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 1.1 alc * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 1.1 alc * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 1.1 alc * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 1.1 alc * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 1.1 alc *
17 1.1 alc * $Id: ar5212desc.h,v 1.1 2008/12/11 04:46:43 alc Exp $
18 1.1 alc */
19 1.1 alc #ifndef _ATH_AR5212_DESC_H_
20 1.1 alc #define _ATH_AR5212_DESC_H_
21 1.1 alc
22 1.1 alc /*
23 1.1 alc * Hardware-specific descriptor structures.
24 1.1 alc */
25 1.1 alc #include "ah_desc.h"
26 1.1 alc
27 1.1 alc /*
28 1.1 alc * AR5212-specific tx/rx descriptor definition.
29 1.1 alc */
30 1.1 alc struct ar5212_desc {
31 1.1 alc uint32_t ds_link; /* link pointer */
32 1.1 alc uint32_t ds_data; /* data buffer pointer */
33 1.1 alc uint32_t ds_ctl0; /* DMA control 0 */
34 1.1 alc uint32_t ds_ctl1; /* DMA control 1 */
35 1.1 alc union {
36 1.1 alc struct { /* xmit format */
37 1.1 alc uint32_t ctl2; /* DMA control 2 */
38 1.1 alc uint32_t ctl3; /* DMA control 3 */
39 1.1 alc uint32_t status0;/* DMA status 0 */
40 1.1 alc uint32_t status1;/* DMA status 1 */
41 1.1 alc } tx;
42 1.1 alc struct { /* recv format */
43 1.1 alc uint32_t status0;/* DMA status 0 */
44 1.1 alc uint32_t status1;/* DMA status 1 */
45 1.1 alc } rx;
46 1.1 alc } u;
47 1.1 alc } __packed;
48 1.1 alc #define AR5212DESC(_ds) ((struct ar5212_desc *)(_ds))
49 1.1 alc #define AR5212DESC_CONST(_ds) ((const struct ar5212_desc *)(_ds))
50 1.1 alc
51 1.1 alc #define ds_ctl2 u.tx.ctl2
52 1.1 alc #define ds_ctl3 u.tx.ctl3
53 1.1 alc #define ds_txstatus0 u.tx.status0
54 1.1 alc #define ds_txstatus1 u.tx.status1
55 1.1 alc #define ds_rxstatus0 u.rx.status0
56 1.1 alc #define ds_rxstatus1 u.rx.status1
57 1.1 alc
58 1.1 alc /* TX ds_ctl0 */
59 1.1 alc #define AR_FrameLen 0x00000fff /* frame length */
60 1.1 alc /* bits 12-15 are reserved */
61 1.1 alc #define AR_XmitPower 0x003f0000 /* transmit power control */
62 1.1 alc #define AR_XmitPower_S 16
63 1.1 alc #define AR_RTSCTSEnable 0x00400000 /* RTS/CTS protocol enable */
64 1.1 alc #define AR_VEOL 0x00800000 /* virtual end-of-list */
65 1.1 alc #define AR_ClearDestMask 0x01000000 /* Clear destination mask bit */
66 1.1 alc #define AR_AntModeXmit 0x1e000000 /* TX antenna seslection */
67 1.1 alc #define AR_AntModeXmit_S 25
68 1.1 alc #define AR_TxInterReq 0x20000000 /* TX interrupt request */
69 1.1 alc #define AR_DestIdxValid 0x40000000 /* destination index valid */
70 1.1 alc #define AR_CTSEnable 0x80000000 /* precede frame with CTS */
71 1.1 alc
72 1.1 alc /* TX ds_ctl1 */
73 1.1 alc #define AR_BufLen 0x00000fff /* data buffer length */
74 1.1 alc #define AR_More 0x00001000 /* more desc in this frame */
75 1.1 alc #define AR_DestIdx 0x000fe000 /* destination table index */
76 1.1 alc #define AR_DestIdx_S 13
77 1.1 alc #define AR_FrmType 0x00f00000 /* frame type indication */
78 1.1 alc #define AR_FrmType_S 20
79 1.1 alc #define AR_NoAck 0x01000000 /* No ACK flag */
80 1.1 alc #define AR_CompProc 0x06000000 /* compression processing */
81 1.1 alc #define AR_CompProc_S 25
82 1.1 alc #define AR_CompIVLen 0x18000000 /* length of frame IV */
83 1.1 alc #define AR_CompIVLen_S 27
84 1.1 alc #define AR_CompICVLen 0x60000000 /* length of frame ICV */
85 1.1 alc #define AR_CompICVLen_S 29
86 1.1 alc /* bit 31 is reserved */
87 1.1 alc
88 1.1 alc /* TX ds_ctl2 */
89 1.1 alc #define AR_RTSCTSDuration 0x00007fff /* RTS/CTS duration */
90 1.1 alc #define AR_RTSCTSDuration_S 0
91 1.1 alc #define AR_DurUpdateEna 0x00008000 /* frame duration update ctl */
92 1.1 alc #define AR_XmitDataTries0 0x000f0000 /* series 0 max attempts */
93 1.1 alc #define AR_XmitDataTries0_S 16
94 1.1 alc #define AR_XmitDataTries1 0x00f00000 /* series 1 max attempts */
95 1.1 alc #define AR_XmitDataTries1_S 20
96 1.1 alc #define AR_XmitDataTries2 0x0f000000 /* series 2 max attempts */
97 1.1 alc #define AR_XmitDataTries2_S 24
98 1.1 alc #define AR_XmitDataTries3 0xf0000000 /* series 3 max attempts */
99 1.1 alc #define AR_XmitDataTries3_S 28
100 1.1 alc
101 1.1 alc /* TX ds_ctl3 */
102 1.1 alc #define AR_XmitRate0 0x0000001f /* series 0 tx rate */
103 1.1 alc #define AR_XmitRate0_S 0
104 1.1 alc #define AR_XmitRate1 0x000003e0 /* series 1 tx rate */
105 1.1 alc #define AR_XmitRate1_S 5
106 1.1 alc #define AR_XmitRate2 0x00007c00 /* series 2 tx rate */
107 1.1 alc #define AR_XmitRate2_S 10
108 1.1 alc #define AR_XmitRate3 0x000f8000 /* series 3 tx rate */
109 1.1 alc #define AR_XmitRate3_S 15
110 1.1 alc #define AR_RTSCTSRate 0x01f00000 /* RTS or CTS rate */
111 1.1 alc #define AR_RTSCTSRate_S 20
112 1.1 alc /* bits 25-31 are reserved */
113 1.1 alc
114 1.1 alc /* RX ds_ctl1 */
115 1.1 alc /* AR_BufLen 0x00000fff data buffer length */
116 1.1 alc /* bit 12 is reserved */
117 1.1 alc #define AR_RxInterReq 0x00002000 /* RX interrupt request */
118 1.1 alc /* bits 14-31 are reserved */
119 1.1 alc
120 1.1 alc /* TX ds_txstatus0 */
121 1.1 alc #define AR_FrmXmitOK 0x00000001 /* TX success */
122 1.1 alc #define AR_ExcessiveRetries 0x00000002 /* excessive retries */
123 1.1 alc #define AR_FIFOUnderrun 0x00000004 /* TX FIFO underrun */
124 1.1 alc #define AR_Filtered 0x00000008 /* TX filter indication */
125 1.1 alc #define AR_RTSFailCnt 0x000000f0 /* RTS failure count */
126 1.1 alc #define AR_RTSFailCnt_S 4
127 1.1 alc #define AR_DataFailCnt 0x00000f00 /* Data failure count */
128 1.1 alc #define AR_DataFailCnt_S 8
129 1.1 alc #define AR_VirtCollCnt 0x0000f000 /* virtual collision count */
130 1.1 alc #define AR_VirtCollCnt_S 12
131 1.1 alc #define AR_SendTimestamp 0xffff0000 /* TX timestamp */
132 1.1 alc #define AR_SendTimestamp_S 16
133 1.1 alc
134 1.1 alc /* RX ds_rxstatus0 */
135 1.1 alc #define AR_DataLen 0x00000fff /* RX data length */
136 1.1 alc /* AR_More 0x00001000 more desc in this frame */
137 1.1 alc #define AR_DecompCRCErr 0x00002000 /* decompression CRC error */
138 1.1 alc /* bit 14 is reserved */
139 1.1 alc #define AR_RcvRate 0x000f8000 /* reception rate */
140 1.1 alc #define AR_RcvRate_S 15
141 1.1 alc #define AR_RcvSigStrength 0x0ff00000 /* receive signal strength */
142 1.1 alc #define AR_RcvSigStrength_S 20
143 1.1 alc #define AR_RcvAntenna 0xf0000000 /* receive antenaa */
144 1.1 alc #define AR_RcvAntenna_S 28
145 1.1 alc
146 1.1 alc /* TX ds_txstatus1 */
147 1.1 alc #define AR_Done 0x00000001 /* descripter complete */
148 1.1 alc #define AR_SeqNum 0x00001ffe /* TX sequence number */
149 1.1 alc #define AR_SeqNum_S 1
150 1.1 alc #define AR_AckSigStrength 0x001fe000 /* strength of ACK */
151 1.1 alc #define AR_AckSigStrength_S 13
152 1.1 alc #define AR_FinalTSIndex 0x00600000 /* final TX attempt series ix */
153 1.1 alc #define AR_FinalTSIndex_S 21
154 1.1 alc #define AR_CompSuccess 0x00800000 /* compression status */
155 1.1 alc #define AR_XmitAtenna 0x01000000 /* transmit antenna */
156 1.1 alc /* bits 25-31 are reserved */
157 1.1 alc
158 1.1 alc /* RX ds_rxstatus1 */
159 1.1 alc /* AR_Done 0x00000001 descripter complete */
160 1.1 alc #define AR_FrmRcvOK 0x00000002 /* frame reception success */
161 1.1 alc #define AR_CRCErr 0x00000004 /* CRC error */
162 1.1 alc #define AR_DecryptCRCErr 0x00000008 /* Decryption CRC fiailure */
163 1.1 alc #define AR_PHYErr 0x00000010 /* PHY error */
164 1.1 alc #define AR_MichaelErr 0x00000020 /* Michae MIC decrypt error */
165 1.1 alc /* bits 6-7 are reserved */
166 1.1 alc #define AR_KeyIdxValid 0x00000100 /* decryption key index valid */
167 1.1 alc #define AR_KeyIdx 0x0000fe00 /* Decryption key index */
168 1.1 alc #define AR_KeyIdx_S 9
169 1.1 alc #define AR_RcvTimestamp 0x7fff0000 /* timestamp */
170 1.1 alc #define AR_RcvTimestamp_S 16
171 1.1 alc #define AR_KeyCacheMiss 0x80000000 /* key cache miss indication */
172 1.1 alc
173 1.1 alc /* NB: phy error code overlays key index and valid fields */
174 1.1 alc #define AR_PHYErrCode 0x0000ff00 /* PHY error code */
175 1.1 alc #define AR_PHYErrCode_S 8
176 1.1 alc
177 1.1 alc #endif /* _ATH_AR5212_DESC_H_ */
178