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)
92 #define HIF_RX_HDR_SEC_MODE_MASK BITS(2, 5)
93 #define HIF_RX_HDR_SEC_MODE_OFFSET 2
96 #define HIF_RX_HDR_HEADER_LEN BITS(2,7)
97 #define HIF_RX_HDR_HEADER_LEN_OFFSET 2
98 #define HIF_RX_HDR_HEADER_OFFSET_MASK BITS(0,1)
101 #define HIF_RX_HDR_80211_HEADER_FORMAT BIT(0)
102 #define HIF_RX_HDR_DO_REORDER BIT(1)
103 #define HIF_RX_HDR_PAL BIT(2)
104 #define HIF_RX_HDR_TCL BIT(3)
105 #define HIF_RX_HDR_NETWORK_IDX_MASK BITS(4,7)
106 #define HIF_RX_HDR_NETWORK_IDX_OFFSET 4
109 #define HIF_RX_HDR_SEQ_NO_MASK BITS(0,11)
110 #define HIF_RX_HDR_TID_MASK BITS(12,14)
111 #define HIF_RX_HDR_TID_OFFSET 12
112 #define HIF_RX_HDR_BAR_FRAME BIT(15)
116 #define HIF_RX_HDR_FLAG_AMP_WDS BIT(0)
117 #define HIF_RX_HDR_FLAG_802_11_FORMAT BIT(1)
118 #define HIF_RX_HDR_FLAG_BAR_FRAME BIT(2)
119 #define HIF_RX_HDR_FLAG_DO_REORDERING BIT(3)
120 #define HIF_RX_HDR_FLAG_CTRL_WARPPER_FRAME BIT(4)
122 #define HIF_RX_HW_APPENDED_LEN 4
124 // For DW 2, Byte 3 - ucHwChannelNum
125 #define HW_CHNL_NUM_MAX_2G4 14
126 #define HW_CHNL_NUM_MAX_4G_5G (255 - HW_CHNL_NUM_MAX_2G4)
128 /*******************************************************************************
130 ********************************************************************************
133 typedef struct _HIF_RX_HEADER_T
{
135 UINT_16 u2PacketType
;
136 UINT_8 ucHerderLenOffset
;
137 UINT_8 uc80211_Reorder_PAL_TCL
;
141 UINT_8 ucHwChannelNum
;
143 } HIF_RX_HEADER_T
, *P_HIF_RX_HEADER_T
;
145 typedef enum _ENUM_HIF_RX_PKT_TYPE_T
{
146 HIF_RX_PKT_TYPE_DATA
= 0,
147 HIF_RX_PKT_TYPE_EVENT
,
148 HIF_RX_PKT_TYPE_TX_LOOPBACK
,
149 HIF_RX_PKT_TYPE_MANAGEMENT
,
151 } ENUM_HIF_RX_PKT_TYPE_T
, *P_ENUM_HIF_RX_PKT_TYPE_T
;
153 /*******************************************************************************
154 * P U B L I C D A T A
155 ********************************************************************************
158 /*******************************************************************************
159 * P R I V A T E D A T A
160 ********************************************************************************
163 /*******************************************************************************
165 ********************************************************************************
167 #define HIF_RX_HDR_SIZE sizeof(HIF_RX_HEADER_T)
169 #define HIF_RX_HDR_GET_80211_FLAG(_prHifRxHdr) \
170 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_80211_HEADER_FORMAT) ? TRUE : FALSE))
171 #define HIF_RX_HDR_GET_REORDER_FLAG(_prHifRxHdr) \
172 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_DO_REORDER) ? TRUE : FALSE))
173 #define HIF_RX_HDR_GET_PAL_FLAG(_prHifRxHdr) \
174 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_PAL) ? TRUE : FALSE))
175 #define HIF_RX_HDR_GET_TCL_FLAG(_prHifRxHdr) \
176 (((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_TCL) ? TRUE : FALSE))
177 #define HIF_RX_HDR_GET_NETWORK_IDX(_prHifRxHdr) \
178 ((((_prHifRxHdr)->uc80211_Reorder_PAL_TCL) & HIF_RX_HDR_NETWORK_IDX_MASK)\
179 >> HIF_RX_HDR_NETWORK_IDX_OFFSET)
181 #define HIF_RX_HDR_GET_SEC_MODE(_prHifRxHdr) \
182 ((((_prHifRxHdr)->u2PacketType) & HIF_RX_HDR_SEC_MODE_MASK) >> HIF_RX_HDR_SEC_MODE_OFFSET)
184 #define HIF_RX_HDR_GET_TID(_prHifRxHdr) \
185 ((((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_TID_MASK)\
186 >> HIF_RX_HDR_TID_OFFSET)
187 #define HIF_RX_HDR_GET_SN(_prHifRxHdr) \
188 (((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_SEQ_NO_MASK)
189 #define HIF_RX_HDR_GET_BAR_FLAG(_prHifRxHdr) \
190 (((((_prHifRxHdr)->u2SeqNoTid) & HIF_RX_HDR_BAR_FRAME)? TRUE: FALSE))
193 #define HIF_RX_HDR_GET_CHNL_NUM(_prHifRxHdr) \
194 ( ( ((_prHifRxHdr)->ucHwChannelNum) > HW_CHNL_NUM_MAX_4G_5G ) ? \
195 ( ((_prHifRxHdr)->ucHwChannelNum) - HW_CHNL_NUM_MAX_4G_5G ) : \
196 ((_prHifRxHdr)->ucHwChannelNum) )
198 /* To do: support more bands other than 2.4G and 5G */
199 #define HIF_RX_HDR_GET_RF_BAND(_prHifRxHdr) \
200 ( ( ((_prHifRxHdr)->ucHwChannelNum) <= HW_CHNL_NUM_MAX_2G4 ) ? \
203 /*******************************************************************************
204 * F U N C T I O N D E C L A R A T I O N S
205 ********************************************************************************
212 /*******************************************************************************
214 ********************************************************************************
217 /* Kevin: we don't have to call following function to inspect the data structure.
218 * It will check automatically while at compile time.
219 * We'll need this for porting driver to different RTOS.
226 DATA_STRUC_INSPECTING_ASSERT(sizeof(HIF_RX_HEADER_T
) == 12);