ath9k_htc: Update to upstream's commit d19607454d656cb14d8c16dfbf161eebb542e8fe dated...
[linux-libre-firmware.git] / ath9k_htc / target_firmware / wlan / ah_desc.h
1 /*
2  * Copyright (c) 2013 Qualcomm Atheros, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted (subject to the limitations in the
7  * disclaimer below) provided that the following conditions are met:
8  *
9  *  * Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  *  * Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the
15  *    distribution.
16  *
17  *  * Neither the name of Qualcomm Atheros nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
22  * GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
23  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
24  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 #ifndef _DEV_ATH_DESC_H
37 #define _DEV_ATH_DESC_H
38
39 #include <asf_queue.h>
40 #include <wlan_cfg.h>
41
42 #define HAL_TXSTAT_ALTRATE  0x80
43 #define ts_rssi ts_rssi_combined
44
45 struct ath_tx_status {
46     a_uint32_t   ts_tstamp;
47     a_uint16_t   ts_seqnum;
48     a_uint8_t    ts_status;
49     a_uint8_t    ts_flags;
50     a_uint8_t    ts_rate;
51     int8_t       ts_rssi_combined;
52     int8_t       ts_rssi_ctl0;
53     int8_t       ts_rssi_ctl1;
54     int8_t       ts_rssi_ctl2;
55     int8_t       ts_rssi_ext0;
56     int8_t       ts_rssi_ext1;
57     int8_t       ts_rssi_ext2;
58     a_uint8_t    ts_shortretry;
59     a_uint8_t    ts_longretry;
60     a_uint8_t    ts_virtcol;
61     a_uint8_t    ts_antenna;
62     a_uint32_t   ba_low;
63     a_uint32_t   ba_high;
64     a_uint32_t   evm0;
65     a_uint32_t   evm1;
66     a_uint32_t   evm2;
67 };
68
69 #define HAL_TXERR_XRETRY            0x01
70 #define HAL_TXERR_FILT              0x02
71 #define HAL_TXERR_FIFO              0x04
72 #define HAL_TXERR_XTXOP             0x08
73 #define HAL_TXERR_TIMER_EXPIRED     0x10
74
75 #define HAL_TX_BA                   0x01
76 #define HAL_TX_PWRMGMT              0x02
77 #define HAL_TX_DESC_CFG_ERR         0x04
78 #define HAL_TX_DATA_UNDERRUN        0x08
79 #define HAL_TX_DELIM_UNDERRUN       0x10
80 #define HAL_TX_SW_FILTERED          0x80
81
82 struct ath_rx_status {
83     a_uint64_t   rs_tstamp;
84     a_uint16_t   rs_datalen;
85     a_uint8_t    rs_status;
86     a_uint8_t    rs_phyerr;
87     int8_t       rs_rssi_combined;
88     int8_t       rs_rssi_ctl0;
89     int8_t       rs_rssi_ctl1;
90     int8_t       rs_rssi_ctl2;
91     int8_t       rs_rssi_ext0;
92     int8_t       rs_rssi_ext1;
93     int8_t       rs_rssi_ext2;
94     a_uint8_t    rs_keyix;
95     a_uint8_t    rs_rate;
96     a_uint8_t    rs_antenna;
97     a_uint8_t    rs_more;
98     a_uint8_t    rs_isaggr;
99     a_uint8_t    rs_moreaggr;
100     a_uint8_t    rs_num_delims;
101     a_uint8_t    rs_flags;
102     a_uint8_t    rs_dummy;
103     a_uint32_t   evm0;
104     a_uint32_t   evm1;
105     a_uint32_t   evm2;
106 };
107
108 #define rs_rssi rs_rssi_combined
109
110 #define HAL_RXERR_CRC               0x01
111 #define HAL_RXERR_PHY               0x02
112 #define HAL_RXERR_FIFO              0x04
113 #define HAL_RXERR_DECRYPT           0x08
114 #define HAL_RXERR_MIC               0x10
115
116 #define HAL_RX_MORE                 0x01
117 #define HAL_RX_MORE_AGGR            0x02
118 #define HAL_RX_GI                   0x04
119 #define HAL_RX_2040                 0x08
120 #define HAL_RX_DELIM_CRC_PRE        0x10
121 #define HAL_RX_DELIM_CRC_POST       0x20
122 #define HAL_RX_DECRYPT_BUSY         0x40
123
124
125
126 #define HAL_RXKEYIX_INVALID ((a_uint8_t) -1)
127
128 #define HAL_TXKEYIX_INVALID ((a_uint8_t) -1)
129
130 /*
131  * The following definitions are passed directly
132  * the hardware and managed by the HAL.  Drivers
133  * should not touch those elements marked opaque.
134  */
135 #define ATH_GENERIC_DESC                        \
136         a_uint32_t   ds_link;                   \
137         a_uint32_t   ds_data;                   \
138         a_uint32_t   ds_ctl0;                   \
139         a_uint32_t   ds_ctl1;
140
141 struct ath_desc {
142     ATH_GENERIC_DESC
143 } adf_os_packed;
144
145 struct ath_rx_desc {
146     ATH_GENERIC_DESC
147     a_uint32_t                 ds_hw[9];
148     adf_nbuf_t                 ds_nbuf;
149     adf_os_dma_map_t           ds_dmap;
150     adf_os_dmamap_info_t       ds_dmap_info;
151     adf_os_dma_addr_t          ds_daddr;
152     asf_tailq_entry(ath_rx_desc)  ds_list;
153 } adf_os_packed;
154
155 struct ath_tx_desc {
156     ATH_GENERIC_DESC
157     a_uint32_t   ds_hw[20];
158     union {
159         struct ath_tx_status tx;
160     } ds_us;
161 } adf_os_packed;
162
163 #define ds_txstat   ds_us.tx
164
165
166 #define HAL_TXDESC_CLRDMASK     0x0001
167 #define HAL_TXDESC_NOACK        0x0002
168 #define HAL_TXDESC_RTSENA       0x0004
169 #define HAL_TXDESC_CTSENA       0x0008
170 #define HAL_TXDESC_INTREQ       0x0010
171 #define HAL_TXDESC_VEOL         0x0020
172 #define HAL_TXDESC_EXT_ONLY     0x0040
173 #define HAL_TXDESC_EXT_AND_CTL  0x0080
174 #define HAL_TXDESC_VMF          0x0100
175
176
177 #define HAL_RXDESC_INTREQ   0x0020
178
179 #endif