2 ** $Id: //Department/DaVinci/BRANCHES/MT6620_WIFI_DRIVER_V2_3/include/nic/hif_rx.h#1 $
6 \brief Provide HIF RX Header Information between F/W and Driver
15 * 09 01 2010 kevin.huang
17 * Use LINK LIST operation to process SCAN result
19 * 07 16 2010 yarco.yang
21 * 1. Support BSS Absence/Presence Event
22 * 2. Support STA change PS mode Event
23 * 3. Support BMC forwarding for AP mode.
27 * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
30 * [WPD00003833][MT6620 and MT5931] Driver migration
31 * follow-ups for HIF_RX_HEADER_T update:
34 * 3) add ChannelNumber
37 * [WPD00003833][MT6620 and MT5931] Driver migration
39 * 2) add ucTxSeqNum for tracking frames which needs TX-DONE awareness
40 * 3) add configuration options for CNM_MEM and RSN modules
41 * 4) add data path for management frames
42 * 5) eliminate rPacketInfo of MSDU_INFO_T
45 * [WPD00003833][MT6620 and MT5931] Driver migration
46 * add necessary changes to driver data paths.
48 * 06 06 2010 kevin.huang
49 * [WPD00003832][MT6620 5931] Create driver base
50 * [MT6620 5931] Create driver base
51 ** \main\maintrunk.MT6620WiFiDriver_Prj\10 2009-12-10 16:44:00 GMT mtk02752
53 ** \main\maintrunk.MT6620WiFiDriver_Prj\9 2009-12-09 13:59:20 GMT MTK02468
54 ** Added HIF_RX_HDR parsing macros
55 ** \main\maintrunk.MT6620WiFiDriver_Prj\8 2009-11-24 19:54:54 GMT mtk02752
56 ** adopt HIF_RX_HEADER_T in new data path
57 ** \main\maintrunk.MT6620WiFiDriver_Prj\7 2009-10-29 19:51:19 GMT mtk01084
58 ** modify FW/ driver interface
59 ** \main\maintrunk.MT6620WiFiDriver_Prj\6 2009-04-28 10:33:58 GMT mtk01461
60 ** Add define of HW_APPENED_LEN
61 ** \main\maintrunk.MT6620WiFiDriver_Prj\5 2009-04-01 10:51:02 GMT mtk01461
62 ** Rename ENUM_HIF_RX_PKT_TYPE_T
63 ** \main\maintrunk.MT6620WiFiDriver_Prj\4 2009-03-19 12:05:03 GMT mtk01426
64 ** Remove __KAL_ATTRIB_PACKED__ and add hifDataTypeCheck()
65 ** \main\maintrunk.MT6620WiFiDriver_Prj\3 2009-03-17 20:18:52 GMT mtk01426
66 ** Add comment to HIF_RX_HEADER_T
67 ** \main\maintrunk.MT6620WiFiDriver_Prj\2 2009-03-10 20:16:23 GMT mtk01426
75 /*******************************************************************************
76 * C O M P I L E R F L A G S
77 ********************************************************************************
80 /*******************************************************************************
81 * E X T E R N A L R E F E R E N C E S
82 ********************************************************************************
85 /*******************************************************************************
87 ********************************************************************************
89 /*! HIF_RX_HEADER_T */
91 #define HIF_RX_HDR_PACKET_TYPE_MASK BITS(0,1)
94 #define HIF_RX_HDR_HEADER_LEN BITS(2,7)
95 #define HIF_RX_HDR_HEADER_LEN_OFFSET 2
96 #define HIF_RX_HDR_HEADER_OFFSET_MASK BITS(0,1)
99 #define HIF_RX_HDR_80211_HEADER_FORMAT BIT(0)
100 #define HIF_RX_HDR_DO_REORDER BIT(1)
101 #define HIF_RX_HDR_PAL BIT(2)
102 #define HIF_RX_HDR_TCL BIT(3)
103 #define HIF_RX_HDR_NETWORK_IDX_MASK BITS(4,7)
104 #define HIF_RX_HDR_NETWORK_IDX_OFFSET 4
107 #define HIF_RX_HDR_SEQ_NO_MASK BITS(0,11)
108 #define HIF_RX_HDR_TID_MASK BITS(12,14)
109 #define HIF_RX_HDR_TID_OFFSET 12
110 #define HIF_RX_HDR_BAR_FRAME BIT(15)
114 #define HIF_RX_HDR_FLAG_AMP_WDS BIT(0)
115 #define HIF_RX_HDR_FLAG_802_11_FORMAT BIT(1)
116 #define HIF_RX_HDR_FLAG_BAR_FRAME BIT(2)
117 #define HIF_RX_HDR_FLAG_DO_REORDERING BIT(3)
118 #define HIF_RX_HDR_FLAG_CTRL_WARPPER_FRAME BIT(4)
120 #define HIF_RX_HW_APPENDED_LEN 4
122 // For DW 2, Byte 3 - ucHwChannelNum
123 #define HW_CHNL_NUM_MAX_2G4 14
124 #define HW_CHNL_NUM_MAX_4G_5G (255 - HW_CHNL_NUM_MAX_2G4)
126 /*******************************************************************************
128 ********************************************************************************
131 typedef struct _HIF_RX_HEADER_T {
133 UINT_16 u2PacketType;
134 UINT_8 ucHerderLenOffset;
135 UINT_8 uc80211_Reorder_PAL_TCL;
139 UINT_8 ucHwChannelNum;
141 } HIF_RX_HEADER_T, *P_HIF_RX_HEADER_T;
143 typedef enum _ENUM_HIF_RX_PKT_TYPE_T {
144 HIF_RX_PKT_TYPE_DATA = 0,
145 HIF_RX_PKT_TYPE_EVENT,
146 HIF_RX_PKT_TYPE_TX_LOOPBACK,
147 HIF_RX_PKT_TYPE_MANAGEMENT,
149 } ENUM_HIF_RX_PKT_TYPE_T, *P_ENUM_HIF_RX_PKT_TYPE_T;
151 /*******************************************************************************
152 * P U B L I C D A T A
153 ********************************************************************************
156 /*******************************************************************************
157 * P R I V A T E D A T A
158 ********************************************************************************
161 /*******************************************************************************
163 ********************************************************************************
165 #define HIF_RX_HDR_SIZE sizeof(HIF_RX_HEADER_T)
167 #define HIF_RX_HDR_GET_80211_FLAG(_prHifRxHdr) \
168 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_80211_HEADER_FORMAT) ? TRUE : FALSE))
169 #define HIF_RX_HDR_GET_REORDER_FLAG(_prHifRxHdr) \
170 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_DO_REORDER) ? TRUE : FALSE))
171 #define HIF_RX_HDR_GET_PAL_FLAG(_prHifRxHdr) \
172 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_PAL) ? TRUE : FALSE))
173 #define HIF_RX_HDR_GET_TCL_FLAG(_prHifRxHdr) \
174 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_TCL) ? TRUE : FALSE))
175 #define HIF_RX_HDR_GET_NETWORK_IDX(_prHifRxHdr) \
176 ((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_NETWORK_IDX_MASK)\
177 >> HIF_RX_HDR_NETWORK_IDX_OFFSET)
180 #define HIF_RX_HDR_GET_TID(_prHifRxHdr) \
181 ((((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_TID_MASK)\
182 >> HIF_RX_HDR_TID_OFFSET)
183 #define HIF_RX_HDR_GET_SN(_prHifRxHdr) \
184 (((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_SEQ_NO_MASK)
185 #define HIF_RX_HDR_GET_BAR_FLAG(_prHifRxHdr) \
186 (((((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_BAR_FRAME)? TRUE: FALSE))
189 #define HIF_RX_HDR_GET_CHNL_NUM(_prHifRxHdr) \
190 ( ( ((_prHifRxHdr)->ucHwChannelNum) > HW_CHNL_NUM_MAX_4G_5G ) ? \
191 ( ((_prHifRxHdr)->ucHwChannelNum) - HW_CHNL_NUM_MAX_4G_5G ) : \
192 ((_prHifRxHdr)->ucHwChannelNum) )
194 /* To do: support more bands other than 2.4G and 5G */
195 #define HIF_RX_HDR_GET_RF_BAND(_prHifRxHdr) \
196 ( ( ((_prHifRxHdr)->ucHwChannelNum) <= HW_CHNL_NUM_MAX_2G4 ) ? \
199 /*******************************************************************************
200 * F U N C T I O N D E C L A R A T I O N S
201 ********************************************************************************
208 /*******************************************************************************
210 ********************************************************************************
213 /* Kevin: we don't have to call following function to inspect the data structure.
214 * It will check automatically while at compile time.
215 * We'll need this for porting driver to different RTOS.
222 DATA_STRUC_INSPECTING_ASSERT(sizeof(HIF_RX_HEADER_T) == 12);