linux/drivers/staging/rtl8723bs/include/rtl8723b_xmit.h

/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
 *
 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
 *
 ******************************************************************************/
#ifndef __RTL8723B_XMIT_H__
#define __RTL8723B_XMIT_H__

/*  */
/*  Queue Select Value in TxDesc */
/*  */
#define QSLT_BK
#define QSLT_BE
#define QSLT_VI
#define QSLT_VO
#define QSLT_BEACON
#define QSLT_HIGH
#define QSLT_MGNT
#define QSLT_CMD

#define MAX_TID

/* OFFSET 0 */
#define OFFSET_SZ
#define OFFSET_SHT
#define BMC
#define LSG
#define FSG
#define OWN


/* OFFSET 4 */
#define PKT_OFFSET_SZ
#define BK
#define QSEL_SHT
#define Rate_ID_SHT
#define NAVUSEHDR
#define PKT_OFFSET_SHT
#define HWPC

/* OFFSET 8 */
#define AGG_EN

/* OFFSET 12 */
#define SEQ_SHT

/* OFFSET 16 */
#define QoS
#define HW_SEQ_EN
#define USERATE
#define DISDATAFB
#define DATA_SHORT
#define DATA_BW

/* OFFSET 20 */
#define SGI

/*  */
/* defined for TX DESC Operation */
/*  */
struct txdesc_8723b {};

#ifndef __INC_HAL8723BDESC_H
#define __INC_HAL8723BDESC_H

#define RX_STATUS_DESC_SIZE_8723B
#define RX_DRV_INFO_SIZE_UNIT_8723B


/* DWORD 0 */
#define SET_RX_STATUS_DESC_PKT_LEN_8723B(__pRxStatusDesc, __Value)
#define SET_RX_STATUS_DESC_EOR_8723B(__pRxStatusDesc, __Value)
#define SET_RX_STATUS_DESC_OWN_8723B(__pRxStatusDesc, __Value)

#define GET_RX_STATUS_DESC_PKT_LEN_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_CRC32_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_ICV_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_DRVINFO_SIZE_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_SECURITY_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_QOS_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_SHIFT_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_PHY_STATUS_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_SWDEC_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_LAST_SEG_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_FIRST_SEG_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_EOR_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_OWN_8723B(__pRxStatusDesc)

/* DWORD 1 */
#define GET_RX_STATUS_DESC_MACID_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_TID_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_AMSDU_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_RXID_MATCH_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_PAGGR_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_A1_FIT_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_CHKERR_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_IPVER_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_IS_TCPUDP__8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_CHK_VLD_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_PAM_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_PWR_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_MORE_DATA_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_MORE_FRAG_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_TYPE_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_MC_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_BC_8723B(__pRxDesc)

/* DWORD 2 */
#define GET_RX_STATUS_DESC_SEQ_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_FRAG_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_RX_IS_QOS_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_WLANHD_IV_LEN_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_RPT_SEL_8723B(__pRxStatusDesc)

/* DWORD 3 */
#define GET_RX_STATUS_DESC_RX_RATE_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_HTC_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_EOSP_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_BSSID_FIT_8723B(__pRxStatusDesc)
#define GET_RX_STATUS_DESC_PATTERN_MATCH_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_UNICAST_MATCH_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_MAGIC_MATCH_8723B(__pRxDesc)

/* DWORD 6 */
#define GET_RX_STATUS_DESC_SPLCP_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_LDPC_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_STBC_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_BW_8723B(__pRxDesc)

/* DWORD 5 */
#define GET_RX_STATUS_DESC_TSFL_8723B(__pRxStatusDesc)

#define GET_RX_STATUS_DESC_BUFF_ADDR_8723B(__pRxDesc)
#define GET_RX_STATUS_DESC_BUFF_ADDR64_8723B(__pRxDesc)

#define SET_RX_STATUS_DESC_BUFF_ADDR_8723B(__pRxDesc, __Value)


/*  Dword 0 */
#define GET_TX_DESC_OWN_8723B(__pTxDesc)

#define SET_TX_DESC_PKT_SIZE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_OFFSET_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_BMC_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_HTC_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_LAST_SEG_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_FIRST_SEG_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_LINIP_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_NO_ACM_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_GF_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_OWN_8723B(__pTxDesc, __Value)

/*  Dword 1 */
#define SET_TX_DESC_MACID_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_QUEUE_SEL_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RDG_NAV_EXT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_LSIG_TXOP_EN_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_PIFS_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RATE_ID_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_EN_DESC_ID_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_SEC_TYPE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_PKT_OFFSET_8723B(__pTxDesc, __Value)


/*  Dword 2 */
#define SET_TX_DESC_PAID_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_CCA_RTS_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_AGG_ENABLE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RDG_ENABLE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_AGG_BREAK_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_MORE_FRAG_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RAW_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_SPE_RPT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_AMPDU_DENSITY_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_BT_INT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_GID_8723B(__pTxDesc, __Value)


/*  Dword 3 */
#define SET_TX_DESC_WHEADER_LEN_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_CHK_EN_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_EARLY_MODE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_HWSEQ_SEL_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_USE_RATE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DISABLE_RTS_FB_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DISABLE_FB_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_CTS2SELF_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RTS_ENABLE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_HW_RTS_ENABLE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_NAV_USE_HDR_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_USE_MAX_LEN_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_MAX_AGG_NUM_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_NDPA_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_AMPDU_MAX_TIME_8723B(__pTxDesc, __Value)

/*  Dword 4 */
#define SET_TX_DESC_TX_RATE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DATA_RATE_FB_LIMIT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RTS_RATE_FB_LIMIT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RETRY_LIMIT_ENABLE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DATA_RETRY_LIMIT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RTS_RATE_8723B(__pTxDesc, __Value)


/*  Dword 5 */
#define SET_TX_DESC_DATA_SC_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DATA_SHORT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DATA_BW_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DATA_LDPC_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_DATA_STBC_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_CTROL_STBC_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RTS_SHORT_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_RTS_SC_8723B(__pTxDesc, __Value)


/*  Dword 6 */
#define SET_TX_DESC_SW_DEFINE_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_ANTSEL_A_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_ANTSEL_B_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_ANTSEL_C_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_ANTSEL_D_8723B(__pTxDesc, __Value)

/*  Dword 7 */
#define SET_TX_DESC_TX_DESC_CHECKSUM_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_USB_TXAGG_NUM_8723B(__pTxDesc, __Value)
#define SET_TX_DESC_SDIO_TXSEQ_8723B(__pTxDesc, __Value)

/*  Dword 8 */
#define SET_TX_DESC_HWSEQ_EN_8723B(__pTxDesc, __Value)

/*  Dword 9 */
#define SET_TX_DESC_SEQ_8723B(__pTxDesc, __Value)

/*  Dword 10 */
#define SET_TX_DESC_TX_BUFFER_ADDRESS_8723B(__pTxDesc, __Value)
#define GET_TX_DESC_TX_BUFFER_ADDRESS_8723B(__pTxDesc)

/*  Dword 11 */
#define SET_TX_DESC_NEXT_DESC_ADDRESS_8723B(__pTxDesc, __Value)


#define SET_EARLYMODE_PKTNUM_8723B(__pAddr, __Value)
#define SET_EARLYMODE_LEN0_8723B(__pAddr, __Value)
#define SET_EARLYMODE_LEN1_1_8723B(__pAddr, __Value)
#define SET_EARLYMODE_LEN1_2_8723B(__pAddr, __Value)
#define SET_EARLYMODE_LEN2_8723B(__pAddr, __Value)
#define SET_EARLYMODE_LEN3_8723B(__pAddr, __Value)

#endif
/*  */
/*  */
/* 	Rate */
/*  */
/*  */
/*  CCK Rates, TxHT = 0 */
#define DESC8723B_RATE1M
#define DESC8723B_RATE2M
#define DESC8723B_RATE5_5M
#define DESC8723B_RATE11M

/*  OFDM Rates, TxHT = 0 */
#define DESC8723B_RATE6M
#define DESC8723B_RATE9M
#define DESC8723B_RATE12M
#define DESC8723B_RATE18M
#define DESC8723B_RATE24M
#define DESC8723B_RATE36M
#define DESC8723B_RATE48M
#define DESC8723B_RATE54M

/*  MCS Rates, TxHT = 1 */
#define DESC8723B_RATEMCS0
#define DESC8723B_RATEMCS1
#define DESC8723B_RATEMCS2
#define DESC8723B_RATEMCS3
#define DESC8723B_RATEMCS4
#define DESC8723B_RATEMCS5
#define DESC8723B_RATEMCS6
#define DESC8723B_RATEMCS7

#define RX_HAL_IS_CCK_RATE_8723B(pDesc)


void rtl8723b_update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem);
void rtl8723b_fill_fake_txdesc(struct adapter *padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull, u8 bDataFrame);

s32 rtl8723bs_init_xmit_priv(struct adapter *padapter);
void rtl8723bs_free_xmit_priv(struct adapter *padapter);
s32 rtl8723bs_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe);
s32 rtl8723bs_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe);
s32	rtl8723bs_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe);
s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter);
int rtl8723bs_xmit_thread(void *context);
#define hal_xmit_handler

u8 BWMapping_8723B(struct adapter *Adapter, struct pkt_attrib *pattrib);
u8 SCMapping_8723B(struct adapter *Adapter, struct pkt_attrib *pattrib);

#endif