Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / sys / dev / netif / ath / hal / ath_hal / ar5211 / ar5211desc.h
1 /*
2  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3  * Copyright (c) 2002-2006 Atheros Communications, Inc.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  * $Id: ar5211desc.h,v 1.5 2008/11/10 04:08:03 sam Exp $
18  * $DragonFly$
19  */
20 #ifndef _DEV_ATH_AR5211DESC_H
21 #define _DEV_ATH_AR5211DESC_H
22
23 #include "ah_desc.h"
24
25 /*
26  * Defintions for the DMA descriptors used by the Atheros
27  * AR5211 and AR5110 Wireless Lan controller parts.
28  */
29
30 /* DMA descriptors */
31 struct ar5211_desc {
32         uint32_t        ds_link;        /* link pointer */
33         uint32_t        ds_data;        /* data buffer pointer */
34         uint32_t        ds_ctl0;        /* DMA control 0 */
35         uint32_t        ds_ctl1;        /* DMA control 1 */
36         uint32_t        ds_status0;     /* DMA status 0 */
37         uint32_t        ds_status1;     /* DMA status 1 */
38 } __packed;
39 #define AR5211DESC(_ds) ((struct ar5211_desc *)(_ds))
40 #define AR5211DESC_CONST(_ds)   ((const struct ar5211_desc *)(_ds))
41
42 /* TX ds_ctl0 */
43 #define AR_FrameLen             0x00000fff      /* frame length */
44 /* bits 12-17 are reserved */
45 #define AR_XmitRate             0x003c0000      /* txrate */
46 #define AR_XmitRate_S           18
47 #define AR_RTSCTSEnable         0x00400000      /* RTS/CTS enable */
48 #define AR_VEOL                 0x00800000      /* virtual end-of-list */
49 #define AR_ClearDestMask        0x01000000      /* Clear destination mask bit */
50 #define AR_AntModeXmit          0x1e000000      /* TX antenna seslection */
51 #define AR_AntModeXmit_S        25
52 #define AR_TxInterReq           0x20000000      /* TX interrupt request */
53 #define AR_EncryptKeyValid      0x40000000      /* EncryptKeyIdx is valid */
54 /* bit 31 is reserved */
55
56 /* TX ds_ctl1 */
57 #define AR_BufLen               0x00000fff      /* data buffer length */
58 #define AR_More                 0x00001000      /* more desc in this frame */
59 #define AR_EncryptKeyIdx        0x000fe000      /* ecnrypt key table index */
60 #define AR_EncryptKeyIdx_S      13
61 #define AR_FrmType              0x00700000      /* frame type indication */
62 #define AR_FrmType_S            20
63 #define AR_Frm_Normal           0x00000000      /* normal frame */
64 #define AR_Frm_ATIM             0x00100000      /* ATIM frame */
65 #define AR_Frm_PSPOLL           0x00200000      /* PS poll frame */
66 #define AR_Frm_Beacon           0x00300000      /* Beacon frame */
67 #define AR_Frm_ProbeResp        0x00400000      /* no delay data */
68 #define AR_NoAck                0x00800000      /* No ACK flag */
69 /* bits 24-31 are reserved */
70
71 /* RX ds_ctl1 */
72 /*      AR_BufLen               0x00000fff         data buffer length */
73 /* bit 12 is reserved */
74 #define AR_RxInterReq           0x00002000      /* RX interrupt request */
75 /* bits 14-31 are reserved */
76
77 /* TX ds_status0 */
78 #define AR_FrmXmitOK            0x00000001      /* TX success */
79 #define AR_ExcessiveRetries     0x00000002      /* excessive retries */
80 #define AR_FIFOUnderrun         0x00000004      /* TX FIFO underrun */
81 #define AR_Filtered             0x00000008      /* TX filter indication */
82 /* NB: the spec has the Short+Long retry counts reversed */
83 #define AR_LongRetryCnt         0x000000f0      /* long retry count */
84 #define AR_LongRetryCnt_S       4
85 #define AR_ShortRetryCnt        0x00000f00      /* short retry count */
86 #define AR_ShortRetryCnt_S      8
87 #define AR_VirtCollCnt          0x0000f000      /* virtual collision count */
88 #define AR_VirtCollCnt_S        12
89 #define AR_SendTimestamp        0xffff0000      /* TX timestamp */
90 #define AR_SendTimestamp_S      16
91
92 /* RX ds_status0 */
93 #define AR_DataLen              0x00000fff      /* RX data length */
94 /*      AR_More                 0x00001000         more desc in this frame */
95 /* bits 13-14 are reserved */
96 #define AR_RcvRate              0x00078000      /* reception rate */
97 #define AR_RcvRate_S            15
98 #define AR_RcvSigStrength       0x07f80000      /* receive signal strength */
99 #define AR_RcvSigStrength_S     19
100 #define AR_RcvAntenna           0x38000000      /* receive antenaa */
101 #define AR_RcvAntenna_S         27
102 /* bits 30-31 are reserved */
103
104 /* TX ds_status1 */
105 #define AR_Done                 0x00000001      /* descripter complete */
106 #define AR_SeqNum               0x00001ffe      /* TX sequence number */
107 #define AR_SeqNum_S             1
108 #define AR_AckSigStrength       0x001fe000      /* strength of ACK */
109 #define AR_AckSigStrength_S     13
110 /* bits 21-31 are reserved */
111
112 /* RX ds_status1 */
113 /*      AR_Done                 0x00000001         descripter complete */
114 #define AR_FrmRcvOK             0x00000002      /* frame reception success */
115 #define AR_CRCErr               0x00000004      /* CRC error */
116 /* bit 3 reserved */
117 #define AR_DecryptCRCErr        0x00000010      /* Decryption CRC fiailure */
118 #define AR_PHYErr               0x000000e0      /* PHY error */
119 #define AR_PHYErr_S             5
120 #define AR_PHYErr_Underrun      0x00000000      /* Transmit underrun */
121 #define AR_PHYErr_Tim           0x00000020      /* Timing error */
122 #define AR_PHYErr_Par           0x00000040      /* Parity error */
123 #define AR_PHYErr_Rate          0x00000060      /* Illegal rate */
124 #define AR_PHYErr_Len           0x00000080      /* Illegal length */
125 #define AR_PHYErr_Radar         0x000000a0      /* Radar detect */
126 #define AR_PHYErr_Srv           0x000000c0      /* Illegal service */
127 #define AR_PHYErr_TOR           0x000000e0      /* Transmit override receive */
128 #define AR_KeyIdxValid          0x00000100      /* decryption key index valid */
129 #define AR_KeyIdx               0x00007e00      /* Decryption key index */
130 #define AR_KeyIdx_S             9
131 #define AR_RcvTimestamp         0x0fff8000      /* timestamp */
132 #define AR_RcvTimestamp_S       15
133 #define AR_KeyCacheMiss         0x10000000      /* key cache miss indication */
134
135 #endif /* _DEV_ATH_AR5211DESC_H_ */