- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/umac/src/bam/bam.h

Go to the documentation of this file.

    00001
    00013 #ifndef _BAM_H_
    00014 #define _BAM_H_
    00015
    00022 /*
    00023  * INCLUDE FILES
    00024  ****************************************************************************************
    00025  */
    00026
    00027 #include "co_status.h"
    00028 #include "mac.h"
    00029 #include "mac_frame.h"
    00030 #include "ke_task.h"
    00031
    00032 /*
    00033  * DEFINES
    00034  ****************************************************************************************
    00035  */
    00036
    00038 #if NX_AMPDU_TX || NX_REORD
    00039 #define BAM_IDX_MAX           (NX_MAX_BA_TX + NX_REORD)
    00040 #else
    00041 #define BAM_IDX_MAX            1
    00042 #endif
    00044 #define BAM_FIRST_RX_IDX       0
    00046 #define BAM_NB_RX_IDX          NX_REORD
    00048 #define BAM_FIRST_TX_IDX       BAM_NB_RX_IDX
    00050 #define BAM_NB_TX_IDX          NX_MAX_BA_TX
    00052 #define BAM_INVALID_TASK_IDX   (BAM_IDX_MAX + 1)
    00053
    00055 #define BAM_BA_AGG_TX_CNT_THRES    2
    00057 #define BAM_RESPONSE_TO_DURATION   500
    00059 #define BAM_INACTIVITY_TO_DURATION 2000
    00061 #define BAM_ADDBA_REQ_INTERVAL     1000000
    00062
    00064
    00066 #define BAM_ADDBAREQ_BA_PARAM_OFFSET       (3)
    00067 #define BAM_ADDBAREQ_BA_TIMEOUT_OFFSET     (5)
    00068 #define BAM_ADDBAREQ_BA_SSC_OFFSET         (7)
    00069
    00071
    00073 #define BAM_ADDBARSP_STATUS_OFFSET         (3)
    00074 #define BAM_ADDBARSP_BA_PARAM_OFFSET       (5)
    00075 #define BAM_ADDBARSP_BA_TIMEOUT_OFFSET     (7)
    00076
    00078
    00080 #define BAM_DELBA_PARAM_OFFSET             (2)
    00081 #define BAM_DELBA_REASON_OFFSET            (4)
    00082
    00084
    00086 #define BAM_ADDBAREQ_LENGTH     (9)
    00087 #define BAM_ADDBARSP_LENGTH     (9)
    00088 #define BAM_DELBA_LENGTH        (6)
    00089
    00091
    00093 #define BAM_BA_PARAM_AMSDU_SUP_OFFSET   (0)
    00094 #define BAM_BA_PARAM_AMSDU_SUP_MASK     (0x0001)
    00095 #define BAM_BA_PARAM_BA_POL_OFFSET      (1)
    00096 #define BAM_BA_PARAM_BA_POL_MASK        (0x0002)
    00097 #define BAM_BA_PARAM_TID_OFFSET         (2)
    00098 #define BAM_BA_PARAM_TID_MASK           (0x003C)
    00099 #define BAM_BA_PARAM_BUFF_SIZE_OFFSET   (6)
    00100 #define BAM_BA_PARAM_BUFF_SIZE_MASK     (0xFFC0)
    00101
    00103
    00105 #define BAM_DELBA_PARAM_INITIATOR_OFFSET     (11)
    00106 #define BAM_DELBA_PARAM_INITIATOR_MASK       (0x0800)
    00107 #define BAM_DELBA_PARAM_TID_OFFSET           (12)
    00108 #define BAM_DELBA_PARAM_TID_MASK             (0xF000)
    00109
    00111
    00113 #define BAM_BA_CTRL_POLICY_OFFSET       (0)
    00114 #define BAM_BA_CTRL_POLICY_MASK         (0x0001)
    00115 #define BAM_BA_CTRL_MULTI_TID_OFFSET    (1)
    00116 #define BAM_BA_CTRL_MULTI_TID_MASK      (0x0002)
    00117 #define BAM_BA_CTRL_COMP_BITMAP_OFFSET  (2)
    00118 #define BAM_BA_CTRL_COMP_BITMAP_MASK    (0x0004)
    00119 #define BAM_BA_CTRL_COMP_BITMAP_OFFSET  (2)
    00120 #define BAM_BA_CTRL_COMP_BITMAP_MASK    (0x0004)
    00121 #define BAM_BA_CTRL_TID_INFO_OFFSET     (11)
    00122 #define BAM_BA_CTRL_TID_INFO_MASK       (0xF000)
    00123
    00125
    00127 #define BAM_BASIC_SSC_FN_OFFSET         (0)
    00128 #define BAM_BASIC_SSC_FN_MASK           (0x000F)
    00129 #define BAM_BASIC_SSC_SSN_OFFSET        (4)
    00130 #define BAM_BASIC_SSC_SSN_MASK          (0xFFF0)
    00132
    00134 #define BAM_MAX_TX_WIN_SIZE             64
    00135
    00137 #define BAM_DELBA_MAX_TRY 3
    00138
    00139 /*
    00140  * ENUMERATIONS
    00141  ****************************************************************************************
    00142  */
    00143
    00145 enum bam_ba_type
    00146 {
    00148     BA_RESPONDER = 0,
    00150     BA_ORIGINATOR ,
    00151     BA_DEV_NONE
    00152 };
    00153
    00155 enum bam_ba_policy
    00156 {
    00158     BAM_BA_POL_IMMEDIATE = 1,
    00160     BAM_BA_POL_DELAYED,
    00161 };
    00162
    00164 enum bam_pkt_policy
    00165 {
    00166     // Send packet as a singleton, BA Agg no yet established
    00167     BAM_PKT_POL_SINGLETON = 0,
    00168     // Send packet as part of an A-MPDU
    00169     BAM_PKT_POL_AMPDU
    00170 };
    00171
    00173 enum bam_baw_state
    00174 {
    00176     BAW_FREE,
    00178     BAW_PENDING,
    00180     BAW_CONFIRMED,
    00181 };
    00182
    00183 /*
    00184  * MACROS
    00185  ****************************************************************************************
    00186  */
    00187
    00189 #define BAM_BA_PARAM_GET(ba_param, field)                            \
    00190             ((ba_param & BAM_BA_PARAM_ ## field ## _MASK)            \
    00191                             >> BAM_BA_PARAM_ ## field ## _OFFSET)
    00192
    00194 #define BAM_DELBA_PARAM_GET(delba_param, field)                      \
    00195             ((delba_param & BAM_DELBA_PARAM_ ## field ## _MASK)       \
    00196                             >> BAM_DELBA_PARAM_ ## field ## _OFFSET)
    00197
    00198 /*
    00199  * TYPE DEFINITIONS
    00200  ****************************************************************************************
    00201  */
    00202 // Forward declarations
    00203 struct txdesc;
    00204 struct bam_baw;
    00205
    00207 typedef unsigned int (*bam_baw_index_func_ptr)(struct bam_baw *, unsigned int);
    00208
    00210 struct bam_addba_req
    00211 {
    00213     uint8_t category;
    00215     uint8_t action;
    00217     uint8_t dialog_token;
    00225     uint16_t ba_param_set;
    00227     uint16_t ba_timeout;
    00235     uint16_t ba_start_sc;
    00236 };
    00237
    00239 struct bam_addba_rsp
    00240 {
    00242     uint8_t category;
    00244     uint8_t action;
    00246     uint8_t dialog_token;
    00248     uint16_t status_code;
    00256     uint16_t ba_param_set;
    00258     uint16_t ba_timeout;
    00259 };
    00260
    00262 struct bam_delba
    00263 {
    00265     uint8_t category;
    00267     uint8_t action;
    00275     uint16_t delba_param;
    00277     uint16_t reason_code;
    00278 };
    00279
    00280 /*
    00281  * GLOBAL STRUCTURES
    00282  ****************************************************************************************
    00283  */
    00287 struct bam_baw {
    00289     bam_baw_index_func_ptr idx_compute;
    00291     uint16_t fsn;
    00293     uint8_t states[BAM_MAX_TX_WIN_SIZE];
    00295     uint8_t fsn_idx;
    00297     uint8_t buf_size;
    00299     uint8_t mask;
    00300 };
    00301
    00303 struct bam_env_tag
    00304 {
    00306     uint32_t pkt_cnt;
    00308     uint32_t last_activity_time;
    00310     uint16_t ssn;
    00312     uint16_t ba_timeout;
    00314     uint8_t  sta_idx;
    00316     uint8_t  dev_type;
    00318     uint8_t  ba_policy;
    00320     uint8_t  buffer_size;
    00322     uint8_t  tid;
    00324     uint8_t  dialog_token;
    00326     uint8_t amsdu;
    00328     uint8_t delba_count;
    00330     struct bam_baw *baw;
    00331 };
    00332
    00333 /*
    00334  * GLOBAL VARIABLES DEFINITION
    00335  ****************************************************************************************
    00336  */
    00338 extern struct bam_env_tag bam_env[BAM_IDX_MAX];
    00339
    00340 /*
    00341  * FUNCTION PROTOTYPES
    00342  ****************************************************************************************
    00343  */
    00344
    00345 // Used to build the BA parameters
    00356 __INLINE uint16_t bam_build_baparamset(struct bam_env_tag *bam_env)
    00357 {
    00358     uint16_t value = 0;
    00359
    00360     /* The Block Ack Parameter Set field
    00361      *
    00362      *******************************************************************
    00363      *  B0              *  B1               * (B2 -> B5)*  (B6->B15)   *
    00364      *  A-MSD Supported *  Block Ack Policy * TID       *  Buffer Size *
    00365      *******************************************************************
    00366      *
    00367      */
    00368     #if !NX_FULLY_HOSTED
    00369     // Fill the A-MSDU Supported bit
    00370     value |= MAC_BA_PARAMSET_AMSDU_MASK;
    00371     #endif
    00372     // Fill the Block Ack Policy bit
    00373     value |= (bam_env->ba_policy << MAC_BA_PARAMSET_POLICY_OFT);
    00374     // Fill the TID bits
    00375     value |= (bam_env->tid << MAC_BA_PARAMSET_TID_OFT);
    00376     // Fill the Buffer Size bits
    00377     value |= (bam_env->buffer_size << MAC_BA_PARAMSET_BUFFER_OFT);
    00378
    00379     return (value);
    00380 }
    00381
    00387 void bam_init(void);
    00388
    00389 #if NX_AMPDU_TX || NX_REORD
    00390
    00397 void bam_param_sta_info_tab_reset(uint16_t bam_idx);
    00398
    00410 uint16_t bam_alloc_new_task(bool tx);
    00411
    00419 void bam_delete_ba_agg(uint8_t bam_idx);
    00420
    00428 void bam_delete_all_ba_agg(uint8_t sta_idx);
    00429
    00437 void bam_start_inactivity_timer(uint16_t  bam_task_idx);
    00438
    00448 void bam_send_mm_ba_add_req(uint16_t sta_idx, uint16_t bam_idx);
    00458 void bam_send_mm_ba_del_req(uint16_t sta_idx, uint16_t bam_idx);
    00459 #endif
    00460
    00477 void bam_send_air_action_frame(uint8_t sta_idx,
    00478                                struct bam_env_tag *bam_env,
    00479                                uint8_t action,
    00480                                uint8_t dialog_token,
    00481                                uint16_t param,
    00482                                uint16_t status_code,
    00483                                void (*cfm_func)(void *, uint32_t));
    00484
    00485 #if NX_AMPDU_TX
    00486
    00501 void bam_check_ba_agg(struct txdesc *txdesc);
    00502
    00518 int8_t bam_tx_cfm(struct txdesc *txdesc, bool success);
    00519
    00529 void bam_baw_init(struct bam_env_tag *bam_env);
    00530
    00543 int8_t bam_flush_baw(struct bam_baw *baw);
    00544 #endif
    00545
    00546 #if NX_REORD
    00547
    00557 void bam_rx_active(uint8_t sta_idx, uint8_t tid);
    00558
    00569 void bam_send_del_ba_agg(uint8_t sta_idx, uint8_t tid);
    00570 #endif
    00571
    00572
    00573
    00575
    00576 #endif // _BAM_H_