1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
20 #ifndef __RTL8188E_XMIT_H__
21 #define __RTL8188E_XMIT_H__
26 /* For 88e early mode */
27 #define SET_EARLYMODE_PKTNUM(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 0, 3, __Value)
28 #define SET_EARLYMODE_LEN0(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 4, 12, __Value)
29 #define SET_EARLYMODE_LEN1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 16, 12, __Value)
30 #define SET_EARLYMODE_LEN2_1(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value)
31 #define SET_EARLYMODE_LEN2_2(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value)
32 #define SET_EARLYMODE_LEN3(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value)
33 #define SET_EARLYMODE_LEN4(__pAddr, __Value) SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value)
36 * defined for TX DESC Operation
51 #define PKT_OFFSET_SZ 0
53 #define RATE_ID_SHT 16
54 #define NAVUSEHDR BIT(20)
55 #define SEC_TYPE_SHT 22
56 #define PKT_OFFSET_SHT 26
59 #define AGG_EN BIT(12)
60 #define AGG_BK BIT(16)
61 #define AMPDU_DENSITY_SHT 20
62 #define ANTSEL_A BIT(24)
63 #define ANTSEL_B BIT(25)
64 #define TX_ANT_CCK_SHT 26
65 #define TX_ANTL_SHT 28
66 #define TX_ANT_HT_SHT 30
70 #define EN_HWSEQ BIT(31)
75 #define USERATE BIT(8)
76 #define DISDATAFB BIT(10)
77 #define CTS_2_SELF BIT(11)
78 #define RTS_EN BIT(12)
79 #define HW_RTS_EN BIT(13)
80 #define DATA_SHORT BIT(24)
81 #define PWR_STATUS_SHT 15
82 #define DATA_SC_SHT 20
83 #define DATA_BW BIT(25)
86 #define RTY_LMT_EN BIT(17)
91 #define USB_TXAGG_NUM_SHT 24
93 typedef struct txdesc_88e {
118 u32 pkt_offset:5; /* unit: 8 bytes */
175 u32 data_ratefb_lmt:5;
176 u32 rts_ratefb_lmt:4;
189 u32 mcs7_sgi_max_len:4;
192 u32 checksum:16; /* TxBuffSize(PCIe)/CheckSum(USB) */
193 u32 sw0:8; /* offset 30 */
195 u32 mcs15_sgi_max_len:4;
196 } TXDESC_8188E, *PTXDESC_8188E;
198 #define txdesc_set_ccx_sw_88e(txdesc, value) \
200 ((struct txdesc_88e *)(txdesc))->sw1 = (((value)>>8) & 0x0f); \
201 ((struct txdesc_88e *)(txdesc))->sw0 = ((value) & 0xff); \
204 struct txrpt_ccx_88e {
208 u8 txdma_underflow:1;
238 #define txrpt_ccx_sw_88e(txrpt_ccx) ((txrpt_ccx)->sw0 + ((txrpt_ccx)->sw1<<8))
239 #define txrpt_ccx_qtime_88e(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8))
241 #define SET_TX_DESC_SEC_TYPE_8188E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+4, 22, 2, __Value)
243 void rtl8188e_fill_fake_txdesc(PADAPTER padapter, u8 *pDesc, u32 BufferLen,
244 u8 IsPsPoll, u8 IsBTQosNull, u8 bDataFrame);
245 void rtl8188e_cal_txdesc_chksum(struct tx_desc *ptxdesc);
246 #if defined(CONFIG_CONCURRENT_MODE)
247 void fill_txdesc_force_bmc_camid(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc);
250 #if defined(CONFIG_SDIO_HCI) || defined(CONFIG_GSPI_HCI)
251 s32 rtl8188es_init_xmit_priv(PADAPTER padapter);
252 void rtl8188es_free_xmit_priv(PADAPTER padapter);
253 s32 rtl8188es_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
254 s32 rtl8188es_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
255 s32 rtl8188es_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
256 thread_return rtl8188es_xmit_thread(thread_context context);
257 s32 rtl8188es_xmit_buf_handler(PADAPTER padapter);
259 #ifdef CONFIG_SDIO_TX_TASKLET
260 void rtl8188es_xmit_tasklet(void *priv);
264 #ifdef CONFIG_USB_HCI
265 s32 rtl8188eu_init_xmit_priv(PADAPTER padapter);
266 void rtl8188eu_free_xmit_priv(PADAPTER padapter);
267 s32 rtl8188eu_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
268 s32 rtl8188eu_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
269 s32 rtl8188eu_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
270 s32 rtl8188eu_xmit_buf_handler(PADAPTER padapter);
271 void rtl8188eu_xmit_tasklet(void *priv);
272 s32 rtl8188eu_xmitframe_complete(_adapter *padapter, struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
275 #ifdef CONFIG_PCI_HCI
276 s32 rtl8188ee_init_xmit_priv(PADAPTER padapter);
277 void rtl8188ee_free_xmit_priv(PADAPTER padapter);
278 void rtl8188ee_xmitframe_resume(_adapter *padapter);
279 s32 rtl8188ee_hal_xmit(PADAPTER padapter, struct xmit_frame *pxmitframe);
280 s32 rtl8188ee_mgnt_xmit(PADAPTER padapter, struct xmit_frame *pmgntframe);
281 s32 rtl8188ee_hal_xmitframe_enqueue(_adapter *padapter, struct xmit_frame *pxmitframe);
282 void rtl8188ee_xmit_tasklet(void *priv);
287 #ifdef CONFIG_TX_EARLY_MODE
288 void UpdateEarlyModeInfo8188E(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf);
291 #ifdef CONFIG_XMIT_ACK
292 void dump_txrpt_ccx_88e(void *buf);
293 void handle_txrpt_ccx_88e(_adapter *adapter, u8 *buf);
295 #define dump_txrpt_ccx_88e(buf) do {} while (0)
296 #define handle_txrpt_ccx_88e(adapter, buf) do {} while (0)
297 #endif /* CONFIG_XMIT_ACK */
299 void _dbg_dump_tx_info(_adapter *padapter, int frame_tag, struct tx_desc *ptxdesc);
300 #endif /* __RTL8188E_XMIT_H__ */