Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / wlan / ah_desc.h
1 #ifndef _DEV_ATH_DESC_H
2 #define _DEV_ATH_DESC_H
3
4 #include <asf_queue.h>
5 #include <wlan_cfg.h>
6
7 #define HAL_TXSTAT_ALTRATE  0x80
8 #define ts_rssi ts_rssi_combined
9
10 struct ath_tx_status {
11     a_uint32_t   ts_tstamp;
12     a_uint16_t   ts_seqnum;
13     a_uint8_t    ts_status;
14     a_uint8_t    ts_flags;
15     a_uint8_t    ts_rate;
16     int8_t       ts_rssi_combined;
17     int8_t       ts_rssi_ctl0;
18     int8_t       ts_rssi_ctl1;
19     int8_t       ts_rssi_ctl2;
20     int8_t       ts_rssi_ext0;
21     int8_t       ts_rssi_ext1;
22     int8_t       ts_rssi_ext2;
23     a_uint8_t    ts_shortretry;
24     a_uint8_t    ts_longretry;
25     a_uint8_t    ts_virtcol;
26     a_uint8_t    ts_antenna;
27     a_uint32_t   ba_low;
28     a_uint32_t   ba_high;
29     a_uint32_t   evm0;
30     a_uint32_t   evm1;
31     a_uint32_t   evm2;
32 };
33
34 #define HAL_TXERR_XRETRY            0x01
35 #define HAL_TXERR_FILT              0x02
36 #define HAL_TXERR_FIFO              0x04
37 #define HAL_TXERR_XTXOP             0x08
38 #define HAL_TXERR_TIMER_EXPIRED     0x10
39
40 #define HAL_TX_BA                   0x01
41 #define HAL_TX_PWRMGMT              0x02
42 #define HAL_TX_DESC_CFG_ERR         0x04
43 #define HAL_TX_DATA_UNDERRUN        0x08
44 #define HAL_TX_DELIM_UNDERRUN       0x10
45 #define HAL_TX_SW_FILTERED          0x80
46
47 struct ath_rx_status {
48     a_uint64_t   rs_tstamp;
49     a_uint16_t   rs_datalen;
50     a_uint8_t    rs_status;
51     a_uint8_t    rs_phyerr;
52     int8_t       rs_rssi_combined;
53     int8_t       rs_rssi_ctl0;
54     int8_t       rs_rssi_ctl1;
55     int8_t       rs_rssi_ctl2;
56     int8_t       rs_rssi_ext0;
57     int8_t       rs_rssi_ext1;
58     int8_t       rs_rssi_ext2;
59     a_uint8_t    rs_keyix;
60     a_uint8_t    rs_rate;
61     a_uint8_t    rs_antenna;
62     a_uint8_t    rs_more;
63     a_uint8_t    rs_isaggr;
64     a_uint8_t    rs_moreaggr;
65     a_uint8_t    rs_num_delims;
66     a_uint8_t    rs_flags;
67     a_uint8_t    rs_dummy;
68     a_uint32_t   evm0;
69     a_uint32_t   evm1;
70     a_uint32_t   evm2;
71 };
72
73 #define rs_rssi rs_rssi_combined
74
75 #define HAL_RXERR_CRC               0x01
76 #define HAL_RXERR_PHY               0x02
77 #define HAL_RXERR_FIFO              0x04
78 #define HAL_RXERR_DECRYPT           0x08
79 #define HAL_RXERR_MIC               0x10
80
81 #define HAL_RX_MORE                 0x01
82 #define HAL_RX_MORE_AGGR            0x02
83 #define HAL_RX_GI                   0x04
84 #define HAL_RX_2040                 0x08
85 #define HAL_RX_DELIM_CRC_PRE        0x10
86 #define HAL_RX_DELIM_CRC_POST       0x20
87 #define HAL_RX_DECRYPT_BUSY         0x40
88
89
90
91 #define HAL_RXKEYIX_INVALID ((a_uint8_t) -1)
92
93 #define HAL_TXKEYIX_INVALID ((a_uint32_t) -1)
94
95 /*
96  * The following definitions are passed directly
97  * the hardware and managed by the HAL.  Drivers
98  * should not touch those elements marked opaque.
99  */
100 #define ATH_GENERIC_DESC                        \
101         a_uint32_t   ds_link;                   \
102         a_uint32_t   ds_data;                   \
103         a_uint32_t   ds_ctl0;                   \
104         a_uint32_t   ds_ctl1;
105
106 struct ath_desc {
107     ATH_GENERIC_DESC
108 } adf_os_packed;
109
110 struct ath_rx_desc {
111     ATH_GENERIC_DESC
112     a_uint32_t                 ds_hw[9];
113     adf_nbuf_t                 ds_nbuf;
114     adf_os_dma_map_t           ds_dmap;
115     adf_os_dmamap_info_t       ds_dmap_info;
116     adf_os_dma_addr_t          ds_daddr;
117     asf_tailq_entry(ath_rx_desc)  ds_list;
118 } adf_os_packed;
119
120 struct ath_tx_desc {
121     ATH_GENERIC_DESC
122     a_uint32_t   ds_hw[20];
123     union {
124         struct ath_tx_status tx;
125     } ds_us;
126 } adf_os_packed;
127
128 #define ds_txstat   ds_us.tx
129
130
131 #define HAL_TXDESC_CLRDMASK     0x0001
132 #define HAL_TXDESC_NOACK        0x0002
133 #define HAL_TXDESC_RTSENA       0x0004
134 #define HAL_TXDESC_CTSENA       0x0008
135 #define HAL_TXDESC_INTREQ       0x0010
136 #define HAL_TXDESC_VEOL         0x0020
137 #define HAL_TXDESC_EXT_ONLY     0x0040
138 #define HAL_TXDESC_EXT_AND_CTL  0x0080
139 #define HAL_TXDESC_VMF          0x0100
140
141
142 #define HAL_RXDESC_INTREQ   0x0020
143
144 #endif