- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/lmac/src/chan/chan.h

Go to the documentation of this file.

    00001
    00012 #ifndef _CHAN_H_
    00013 #define _CHAN_H_
    00014
    00024 /*
    00025  * INCLUDE FILES
    00026  ****************************************************************************************
    00027  */
    00028
    00029 #include "co_int.h"
    00030 #include "co_bool.h"
    00031 #include "co_utils.h"
    00032 #include "mm_task.h"
    00033 #include "mm_timer.h"
    00034
    00035 #if (NX_CHNL_CTXT)
    00036
    00037 /*
    00038  * DEFINES
    00039  ****************************************************************************************
    00040  */
    00041
    00043 #define CHAN_TRAF_CTXT_CNT (NX_CHAN_CTXT_CNT)
    00045 #define CHAN_CHAN_CTXT_CNT     (CHAN_TRAF_CTXT_CNT + 1 + 1)
    00047 #define CHAN_SCAN_CTXT_IDX     (CHAN_TRAF_CTXT_CNT)
    00049 #define CHAN_ROC_CTXT_IDX      (CHAN_SCAN_CTXT_IDX + 1)
    00051 #define CHAN_CTXT_UNUSED       (0xFF)
    00052
    00053
    00056 #define CHAN_SWITCH_DELAY   (4000 + phy_get_channel_switch_dur())
    00057
    00058 /*
    00059  * ENUMERATIONS
    00060  ****************************************************************************************
    00061  */
    00062
    00064 enum chan_ctxt_status
    00065 {
    00067     CHAN_NOT_SCHEDULED = 0,
    00069     CHAN_NOT_PROG,
    00071     CHAN_GOTO_IDLE,
    00073     CHAN_WAIT_NOA_CFM,
    00075     CHAN_WAITING_END,
    00077     CHAN_PRESENT,
    00079     CHAN_SENDING_NOA,
    00080 };
    00081
    00083 enum chan_tbtt_status
    00084 {
    00086     CHAN_TBTT_PROG = CO_BIT(0),
    00088     CHAN_TBTT_WAIT_TO = CO_BIT(1),
    00090     CHAN_TBTT_SKIPPED = CO_BIT(2),
    00092     // end of the TBTT period
    00093     CHAN_TBTT_ALREADY_ADDED = CO_BIT(3),
    00095     CHAN_TBTT_SCHEDULE_P2P_NOA = CO_BIT(4),
    00097     CHAN_TBTT_P2P_NOA_TSF_UPDATE = CO_BIT(5),
    00099     CHAN_TBTT_P2P_NOA_RESYNC = CO_BIT(6),
    00100 };
    00101
    00103 enum chan_env_status_bit
    00104 {
    00106     CHAN_ENV_ROC_WAIT_BIT = 0,
    00108     CHAN_ENV_SCAN_WAIT_BIT,
    00110     CHAN_ENV_ROC_BIT,
    00112     CHAN_ENV_SCAN_BIT,
    00114     CHAN_ENV_DELAY_PROG_BIT,
    00116     CHAN_ENV_BCN_DETECT_BIT,
    00118     CHAN_ENV_FIX_CTXT_PENDING_BIT,
    00119 };
    00120
    00121 /*
    00122  * STRUCTURES/TYPES DEFINITION
    00123  ****************************************************************************************
    00124  */
    00125
    00127 struct chan_tbtt_tag
    00128 {
    00130     struct co_list_hdr list_hdr;
    00131
    00133     uint32_t time;
    00135     uint8_t vif_index;
    00137     uint8_t status;
    00138
    00139     #if (NX_P2P)
    00142     uint8_t p2p_noa_vif_index;
    00143
    00145     uint8_t p2p_noa_index;
    00146
    00149     int32_t p2p_noa_tsf_update;
    00150
    00154     int32_t p2p_noa_tbtt_to_end;
    00155
    00158     int16_t p2p_noa_drift;
    00159
    00160     #endif //(NX_P2P)
    00161 };
    00162
    00164 struct chan_switch_tag
    00165 {
    00167     struct co_list_hdr list_hdr;
    00168
    00170     uint32_t time;
    00171
    00173     struct chan_ctxt_tag *ctxt;
    00174
    00176     struct chan_tbtt_tag *tbtt;
    00177 };
    00178
    00180 struct chan_ctxt_tag
    00181 {
    00183     struct co_list_hdr list_hdr;
    00184
    00186     struct mac_chan_op channel;
    00187
    00189     ke_task_id_t taskid;
    00190
    00192     uint8_t status;
    00193
    00195     uint32_t duration_us;
    00196
    00198     uint8_t idx;
    00200     uint8_t nb_linked_vif;
    00202     uint8_t vif_index;
    00203
    00204     #if (NX_P2P)
    00206     uint8_t p2pgo_vif_index;
    00207     #endif //(NX_P2P_GO)
    00208
    00209     #if (NX_TDLS)
    00211     bool roc_tdls;
    00212     #endif
    00213 };
    00214
    00216 struct chan_env_tag
    00217 {
    00219     struct co_list list_free_ctxt;
    00221     struct co_list list_sched_ctxt;
    00222
    00224     struct co_list list_tbtt;
    00225
    00227     struct co_list list_free_switch;
    00229     struct co_list list_switch;
    00230
    00232     struct chan_ctxt_tag *current_ctxt;
    00234     struct chan_ctxt_tag *switch_ctxt;
    00235
    00237     struct mm_timer_tag tmr_conn_less;
    00239     struct mm_timer_tag tmr_switch;
    00240
    00242     struct chan_ctxt_tag *fix_ctxt;
    00244     uint32_t fix_until;
    00245
    00247     uint8_t status;
    00249     uint8_t cfm_cnt;
    00250
    00252     uint8_t nb_sched_ctxt;
    00253
    00255     uint8_t nb_active_tbtt;
    00256
    00257     #if (NX_POWERSAVE)
    00259     uint8_t pm;
    00260     #endif //(NX_POWERSAVE)
    00261 };
    00262
    00263 // Forward declaration
    00264 struct vif_info_tag;
    00265
    00266
    00267 /*
    00268  * GLOBAL VARIABLES
    00269  ****************************************************************************************
    00270  */
    00271
    00272 extern struct chan_env_tag chan_env;
    00273
    00274 /*
    00275  * FUNCTION PROTOTYPES
    00276  ****************************************************************************************
    00277  */
    00278
    00285 void chan_init(void);
    00286
    00287 #if (NX_HW_SCAN)
    00288
    00303 void chan_scan_req(uint8_t band, uint16_t freq, int8_t pwr, uint32_t duration_us,
    00304                    uint8_t flags, uint8_t vif_index);
    00305
    00306 #endif //(NX_HW_SCAN)
    00307
    00313 uint8_t chan_roc_req(struct mm_remain_on_channel_req const *req, ke_task_id_t taskid);
    00314
    00325 uint8_t chan_ctxt_add(struct mac_chan_op const *chan_req, uint8_t *idx);
    00326
    00334 void chan_ctxt_del(uint8_t idx);
    00335
    00344 void chan_ctxt_link(uint8_t vif_idx, uint8_t chan_idx);
    00345
    00353 void chan_ctxt_unlink(uint8_t vif_idx);
    00354
    00362 void chan_ctxt_update(struct mm_chan_ctxt_update_req const *update);
    00363
    00372 void chan_ctxt_sched(struct mm_chan_ctxt_sched_req const *sched_req, ke_task_id_t taskid);
    00373
    00385 void chan_ctxt_link_monitor(uint8_t chan_idx);
    00386
    00405 int chan_tbtt_start(struct vif_info_tag *vif, uint32_t tbtt_time, uint32_t next_tbtt_time);
    00406
    00419 void chan_bcn_to_evt(struct vif_info_tag *vif);
    00420
    00434 void chan_tbtt_updated(struct vif_info_tag *vif);
    00435
    00444 void chan_bcn_detect_start(struct vif_info_tag *vif);
    00445
    00446 #if (NX_P2P)
    00447
    00456 void chan_p2p_absence_update(struct chan_ctxt_tag *ctxt, bool absence);
    00457 #endif //(NX_P2P)
    00458
    00468 bool chan_is_on_channel(struct vif_info_tag *vif);
    00469
    00479 bool chan_is_on_operational_channel(struct vif_info_tag *vif);
    00480
    00495 bool chan_is_tx_allowed(struct vif_info_tag *vif);
    00496
    00507 void chan_update_tx_power(struct chan_ctxt_tag *ctxt);
    00508
    00509 #endif //(NX_CHNL_CTXT)
    00510
    00512
    00513 #endif //_CHAN_H_