00001
00013 #ifndef _TXL_CNTRL_H_
00014 #define _TXL_CNTRL_H_
00015
00016
00026
00027
00028
00029
00030 #include "co_int.h"
00031
00032
00033 #include "mac.h"
00034
00035 #include "co_status.h"
00036
00037 #include "co_list.h"
00038 #include "tx_swdesc.h"
00039 #include "ke_event.h"
00040 #include "hal_machw.h"
00041
00042 #include "sta_mgmt.h"
00043
00044 #if NX_AMPDU_TX
00045 #include "tx_swdesc.h"
00046 #endif
00047
00048
00049
00050
00051
00052 #if NX_MAC_HE
00054 #define TX_AC0_TIMEOUT 80000000
00055
00056 #define TX_AC1_TIMEOUT 70000000
00057 #else
00059 #define TX_AC0_TIMEOUT 5000000
00060
00061 #define TX_AC1_TIMEOUT 2000000
00062 #endif
00064 #define TX_AC2_TIMEOUT 400000
00065
00066 #define TX_AC3_TIMEOUT 200000
00067
00068 #define TX_BCN_TIMEOUT 50000
00069
00071 enum
00072 {
00074 THD_CHK_STATE,
00076 BAR_THD_CHK_STATE,
00077 #if NX_MAC_HE
00079 ATHD_CHK_STATE,
00080 #endif
00081 };
00082
00083
00084 #if NX_AMPDU_TX
00086 enum
00087 {
00089 AGG_FORMATTED = 0x01,
00091 AGG_DOWNLOADED = 0x02,
00093 AGG_ALLOC = 0x04,
00095 AGG_FIRST_DOWNLOADED = 0x08,
00097 AGG_DONE = 0x10,
00099 AGG_BA_RECEIVED = 0x20,
00101 AGG_BA_VALID = 0x40,
00104 AGG_INT = 0x80,
00106 AGG_MU = 0x100,
00108 AGG_TB = 0x200,
00109 };
00110 #endif
00111
00113 enum
00114 {
00116 SU_PACKET,
00117 #if RW_MUMIMO_TX_EN
00119 MU_PACKET,
00121 MU_PAUSED,
00123 MU_RESTART_CHECK,
00124 #endif
00125 };
00126
00127
00128
00129
00130
00132 #define TX_AC2LLI(ac) ((ac) + IPC_DMA_LLI_DATA_AC0_TX)
00133
00135 #define TX_LLI2AC(idx) ((idx) - IPC_DMA_LLI_DATA_AC0_TX)
00136
00138 #define TX_AC2TIMER(ac) ((ac) + HAL_AC0_TIMER)
00139
00141 #define TX_LLICTRL(ac, irqenable) \
00142 IPC_DMA_LLI_COUNTER_EN|(TX_AC2LLI(ac) << IPC_DMA_LLI_COUNTER_POS) | \
00143 ((irqenable)?(IPC_DMA_LLI_IRQ_EN|(TX_AC2LLI(ac) << IPC_DMA_LLI_IRQ_POS)) : 0)
00144
00146 #define AC_BCN AC_MAX
00147
00149 #define TX_NTX_2_ANTENNA_SET(ntx) ((CO_BIT((ntx) + 1) - 1) << ANTENNA_SET_PT_OFT)
00150
00151 #if RW_MUMIMO_TX_EN
00153 #define MU_USER_MASK (CO_BIT(RW_USER_MAX) - 1)
00154 #endif
00155
00156
00157
00158
00159
00160 #if NX_AMPDU_TX
00162 struct txl_agg_build_tag
00163 {
00165 struct tx_agg_desc *desc;
00167 struct txdesc *txdesc_first;
00169 struct txdesc *txdesc_last;
00171 uint32_t max_len[NX_BW_LEN_STEPS];
00173 uint16_t mmss_bytes;
00175 uint16_t nb_delims;
00177 uint8_t max_cnt;
00179 uint8_t curr_cnt;
00181 uint8_t bw;
00182 #if NX_BW_LEN_ADAPT
00184 uint8_t bw_idx;
00185 #endif
00186 };
00187 #endif
00188
00189 #if RW_MUMIMO_TX_EN
00191 struct txl_mumimo_build_info_tag
00192 {
00194 struct co_list tx[RW_USER_MAX];
00196 struct txdesc *txdesc[RW_USER_MAX];
00198 uint32_t rateinfo[RW_USER_MAX];
00200 uint32_t length[RW_USER_MAX];
00202 uint32_t phy_flags;
00204 uint8_t nb_users;
00206 uint8_t users;
00208 uint8_t open;
00210 uint8_t group_id;
00212 uint8_t first_user_pos;
00213 };
00214 #endif
00215
00217 struct txl_list
00218 {
00220 struct tx_hd *last_frame_exch;
00222 struct co_list transmitting[RW_USER_MAX];
00224 struct txdesc *first_to_download[RW_USER_MAX];
00226 uint16_t bridgedmacnt;
00228 uint8_t chk_state;
00229 #if NX_AMPDU_TX
00231 struct co_list aggregates;
00233 struct tx_agg_desc *agg_desc;
00235 struct tx_agg_desc *agg_desc_prev;
00237 struct txl_agg_build_tag agg[RW_USER_MAX];
00238 #if RW_MUMIMO_TX_EN
00240 struct txl_mumimo_build_info_tag mumimo;
00241 #endif
00243 uint8_t ppdu_cnt;
00244 #endif
00245 #if NX_AMSDU_TX
00247 struct tx_pbd *last_pbd[RW_USER_MAX];
00249 uint8_t dwnld_index[RW_USER_MAX];
00251 uint8_t tx_index[RW_USER_MAX];
00252 #endif
00253
00254 };
00255
00257 struct txl_cntrl_env_tag
00258 {
00260 struct txl_list txlist[NX_TXQ_CNT];
00261
00262 #if NX_POWERSAVE
00264 uint32_t pck_cnt;
00265 #endif
00266 #if RW_MUMIMO_TX_EN
00268 uint16_t mumimo_ppdu_cnt;
00269 #endif
00270
00272 uint16_t seqnbr;
00273 #if (NX_TX_FRAME)
00275 bool reset;
00276 #endif //(NX_TX_FRAME)
00277 };
00278
00279
00280 struct vif_info_tag;
00281
00282
00283
00284
00285
00287 extern const uint32_t txl_prep_evt_bit[NX_TXQ_CNT];
00288
00290 extern struct txl_cntrl_env_tag txl_cntrl_env;
00291
00292
00293
00294
00295
00296
00301 #if NX_POWERSAVE
00302
00313 __INLINE bool txl_sleep_check(void)
00314 {
00315 return (txl_cntrl_env.pck_cnt == 0);
00316 }
00317 #endif
00318
00328 __INLINE uint16_t txl_get_seq_ctrl(void)
00329 {
00330
00331 txl_cntrl_env.seqnbr++;
00332
00333
00334 return (txl_cntrl_env.seqnbr << MAC_SEQCTRL_NUM_OFT);
00335 }
00336
00337
00338
00347 void txl_cntrl_init(void);
00348
00357 void txl_reset(void);
00358
00359 #if (NX_TX_FRAME)
00360
00371 bool txl_cntrl_tx_check(struct vif_info_tag *vif);
00372 #endif //(NX_CHNL_CTXT || NX_P2P)
00373
00388 bool txl_cntrl_push(struct txdesc *txdesc, uint8_t access_category);
00389
00390 #if NX_TX_FRAME
00391
00402 bool txl_cntrl_push_int(struct txdesc *txdesc, uint8_t access_category);
00403 #endif
00404
00405
00417 void txl_transmit_trigger(void);
00418
00425 void txl_prot_trigger(void);
00426
00436 void txl_cntrl_dma_isr(void);
00437
00446 void txl_cntrl_halt_ac(uint8_t access_category);
00447
00457 void txl_cntrl_flush_ac(uint8_t access_category, uint32_t status);
00458
00470 void txl_current_desc_get(int access_category, struct tx_hd **thd);
00471
00472 #if NX_UMAC_PRESENT
00473
00478 void txl_cntrl_inc_pck_cnt(void);
00479 #endif // NX_UMAC_PRESENT
00480
00481 #if !NX_FULLY_HOSTED
00482
00497 bool txl_payload_alloc(struct txdesc *txdesc, uint8_t access_category, uint8_t user_idx);
00498 #endif // !NX_FULLY_HOSTED
00499
00510 void txl_cntrl_newhead(uint32_t desc,
00511 uint8_t access_category);
00512
00525 void txl_frame_exchange_chain(struct tx_hd *first_thd,
00526 struct tx_hd *last_thd,
00527 uint8_t access_category);
00528
00529 #if !NX_FULLY_HOSTED
00530
00542 void txl_free_done_mpdu(struct txdesc *txdesc, uint8_t access_category, uint8_t user_idx);
00543
00544 #if NX_AMSDU_TX
00545
00559 void txl_check_done_amsdu_subframe(struct txdesc *txdesc, uint8_t access_category,
00560 uint8_t user_idx);
00561 #endif
00562 #endif
00565
00566 #endif // _TXL_CNTRL_H_