- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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

Go to the documentation of this file.

    00001
    00012 #ifndef _P2P_H_
    00013 #define _P2P_H_
    00014
    00024 /*
    00025  * INCLUDE FILES
    00026  ****************************************************************************************
    00027  */
    00028
    00029 #include "rwnx_config.h"
    00030
    00031 #if (NX_P2P)
    00032
    00033 #include "mm_timer.h"
    00034 #include "hal_desc.h"
    00035 #include "compiler.h"
    00036
    00037 /*
    00038  * DEFINES
    00039  ****************************************************************************************
    00040  */
    00041
    00047 #define P2P_IE_ID_OFT       (0)
    00048 #define P2P_IE_LEN_OFT      (1)
    00049 #define P2P_IE_OUI_OFT      (2)
    00050 #define P2P_IE_OUI_TYPE_OFT (5)
    00051 #define P2P_IE_ATT_OFT      (6)
    00052
    00054 #define P2P_ELMT_ID                 (MAC_ELTID_OUI)
    00056 #define P2P_OUI_WIFI_ALL_BYTE0      (0x50)
    00057 #define P2P_OUI_WIFI_ALL_BYTE1      (0x6F)
    00058 #define P2P_OUI_WIFI_ALL_BYTE2      (0x9A)
    00060 #define P2P_OUI_TYPE_P2P            (9)
    00061
    00067 #define P2P_ATT_ID_OFT              (0)
    00068 #define P2P_ATT_LEN_OFT             (1)
    00069 #define P2P_ATT_BODY_OFT            (3)
    00070
    00076 #define P2P_NOA_ATT_INDEX_OFT        P2P_ATT_BODY_OFT
    00077 #define P2P_NOA_ATT_CTW_OPPPS_OFT    (4)
    00078 #define P2P_NOA_ATT_NOA_DESC_OFT     (5)
    00079
    00085 #define P2P_NOA_DESC_COUNT_OFT    (0)
    00086 #define P2P_NOA_DESC_DUR_OFT      (1)
    00087 #define P2P_NOA_DESC_INTV_OFT     (5)
    00088 #define P2P_NOA_DESC_START_OFT    (9)
    00089 #define P2P_NOA_DESC_LENGTH       (13)
    00090
    00091 #define P2P_IE_NOA_NO_NOA_DESC_LENGTH   (P2P_IE_ATT_OFT + P2P_NOA_ATT_NOA_DESC_OFT)
    00092 #define P2P_NOA_IE_BUFFER_LEN  ((P2P_IE_NOA_NO_NOA_DESC_LENGTH + (P2P_NOA_NB_MAX * P2P_NOA_DESC_LENGTH) + 1) / 2)
    00093
    00099 #define P2P_NOA_CONTINUOUS_COUNTER  (255)
    00101 #define P2P_INVALID_IDX             (0xFF)
    00103 #define P2P_NOA_NB_MAX              (2)
    00104
    00106 #define P2P_NOA_TIMER_MARGIN        (5000)
    00108 #define P2P_ABSENCE_DUR_MIN         (5000)
    00110 #define P2P_BCN_RX_TO_DUR           (5000)
    00111
    00113 #define P2P_OPPPS_MASK              (0x80)
    00115 #define P2P_CTWINDOW_MASK           (0x7F)
    00116
    00117 #if (NX_UMAC_PRESENT)
    00119 #define P2P_SSID_WILDCARD           ("DIRECT-")
    00121 #define P2P_SSID_WILDCARD_LEN       (7)
    00122 #endif //(NX_UMAC_PRESENT)
    00123
    00124 /*
    00125  * ENUMERATIONS
    00126  ****************************************************************************************
    00127  */
    00128
    00130 enum p2p_noa_timer_status
    00131 {
    00133     P2P_NOA_TIMER_NOT_STARTED = 0,
    00135     P2P_NOA_TIMER_WAIT_NEXT_ABS,
    00137     P2P_NOA_TIMER_WAIT_END_ABS,
    00138 };
    00139
    00141 enum p2p_oppps_timer_status
    00142 {
    00144     P2P_OPPPS_TIMER_NOT_STARTED = 0,
    00146     P2P_OPPPS_TIMER_WAIT_END_CTW,
    00148     P2P_OPPPS_TIMER_WAIT_START_CTW
    00149 };
    00150
    00156 enum p2p_attribute_id
    00157 {
    00158     P2P_ATT_ID_STATUS         = 0,
    00159     P2P_ATT_ID_MINOR_REASON_CODE,
    00160     P2P_ATT_ID_P2P_CAPABILITY,
    00161     P2P_ATT_ID_P2P_DEVICE_ID,
    00162     P2P_ATT_ID_GROUP_OWNER_INTENT,
    00163     P2P_ATT_ID_CONFIG_TIMEOUT,
    00164     P2P_ATT_ID_LISTEN_CHANNEL,
    00165     P2P_ATT_ID_P2P_GROUP_BSSID,
    00166     P2P_ATT_ID_EXT_LISTEN_TIMING,
    00167     P2P_ATT_ID_INTENDED_P2P_IF_ADDR,
    00168     P2P_ATT_ID_P2P_MANAGEABILITY,
    00169     P2P_ATT_ID_CHANNEL_LIST,
    00170     P2P_ATT_ID_NOTICE_OF_ABSENCE,
    00171     P2P_ATT_ID_P2P_DEVICE_INFO,
    00172     P2P_ATT_ID_P2P_GROUP_INFO,
    00173     P2P_ATT_ID_P2P_GROUP_ID,
    00174     P2P_ATT_ID_P2P_INTERFACE,
    00175     P2P_ATT_ID_OPERATING_CHANNEL,
    00176     P2P_ATT_ID_INVITATION_FLAGS,
    00178     P2P_ATT_ID_VENDOR_SPEC   = 221,
    00180     P2P_ATT_ID_MAX           = 255
    00181 };
    00182
    00184 enum p2p_role
    00185 {
    00187     P2P_ROLE_CLIENT = 0,
    00189     P2P_ROLE_GO,
    00190 };
    00191
    00193 enum p2p_bcn_upd_op
    00194 {
    00196     P2P_BCN_UPD_OP_NONE     = 0,
    00197
    00199     P2P_BCN_UPD_OP_NOA_ADD,
    00201     P2P_BCN_UPD_OP_NOA_RMV,
    00203     P2P_BCN_UPD_OP_NOA_UPD,
    00204 };
    00205
    00206 #if (NX_P2P_GO)
    00208 enum p2p_noa_type
    00209 {
    00211     P2P_NOA_TYPE_CONCURRENT,
    00213     P2P_NOA_TYPE_NORMAL,
    00214 };
    00215 #endif //(NX_P2P_GO)
    00216
    00217 /*
    00218  * TYPES DEFINITION
    00219  ****************************************************************************************
    00220  */
    00221
    00222 // Forward declaration
    00223 struct vif_info_tag;
    00224
    00228 struct p2p_noa_info_tag
    00229 {
    00231     struct mm_timer_tag noa_timer;
    00233     uint8_t noa_status;
    00234
    00236     uint8_t p2p_index;
    00238     uint8_t noa_inst;
    00243     uint8_t noa_counter;
    00245     uint8_t noa_init_counter;
    00247     uint32_t noa_dur_us;
    00249     uint32_t noa_intv_us;
    00250
    00251     #if (NX_P2P_GO)
    00253     uint8_t noa_type;
    00255     bool dyn_noa;
    00256     #endif //(NX_P2P_GO)
    00257
    00259     uint32_t noa_start_time;
    00261     uint32_t noa_time_upd_cnt;
    00262
    00264     uint32_t peer_next_noa_time;
    00265 };
    00266
    00270 struct p2p_info_tag
    00271 {
    00273     struct p2p_noa_info_tag noa[P2P_NOA_NB_MAX];
    00275     struct mm_timer_tag oppps_timer;
    00276
    00278     uint8_t role;
    00280     uint8_t vif_index;
    00282     uint8_t oppps_status;
    00284     uint8_t oppps_ctw;
    00286     uint32_t oppps_ctw_end;
    00288     uint8_t noa_index;
    00290     uint8_t noa_nb;
    00292     uint8_t noa_cm_nb;
    00294     uint32_t next_absent;
    00296     uint32_t next_present;
    00297
    00299     bool is_noa_bcn;
    00301     bool is_go_present;
    00303     bool is_waiting_bcn;
    00304
    00305     #if (NX_P2P_GO)
    00306
    00311     bool noa_paused;
    00316     uint8_t noa_in_bcn_nb;
    00317     #endif //(NX_P2P_GO)
    00318 };
    00319
    00320 #if (NX_P2P_GO)
    00322 struct p2p_env_tag
    00323 {
    00325     uint8_t nb_p2p_go;
    00326 };
    00327 #endif //(NX_P2P_GO)
    00328
    00329 /*
    00330  * GLOBAL VARIABLES
    00331  ****************************************************************************************
    00332  */
    00333
    00334 #if (NX_P2P_GO)
    00336 extern struct p2p_env_tag p2p_env;
    00337 #endif //(NX_P2P_GO)
    00338
    00340 extern struct p2p_info_tag p2p_info_tab[NX_P2P_VIF_MAX];
    00341
    00342 /*
    00343  * PUBLIC FUNCTIONS
    00344  ****************************************************************************************
    00345  */
    00346
    00353 void p2p_init(void);
    00354
    00355
    00366 uint8_t p2p_create(uint8_t vif_index, uint8_t role);
    00367
    00376 void p2p_cancel(uint8_t p2p_index, bool vif_del);
    00377
    00386 void p2p_set_vif_state(struct vif_info_tag *vif, bool active);
    00387
    00396 bool p2p_is_present(uint8_t p2p_index);
    00397
    00420 bool p2p_go_get_next_NOA_date(struct vif_info_tag *vif,
    00421                               uint32_t *next_p2p_present,
    00422                               uint32_t *next_p2p_absent);
    00423
    00434 uint32_t p2p_go_get_next_noa_end_date(struct vif_info_tag *vif,
    00435                                       uint8_t noa_inst);
    00436
    00449 uint32_t p2p_cli_bcn_check_noa(struct vif_info_tag *vif,
    00450                                struct rx_pbd *pyld_desc, struct rx_dmadesc *dma_hdrdesc);
    00451
    00464 void p2p_cli_handle_action(struct vif_info_tag *vif, uint32_t a_frame,
    00465                            uint16_t length, uint32_t rx_tsf);
    00466
    00475 void p2p_tbtt_handle(struct vif_info_tag *vif, uint32_t tbtt_time);
    00476
    00484 void p2p_bcn_evt_handle(struct vif_info_tag *vif);
    00485
    00486 #if (NX_P2P_GO && NX_POWERSAVE)
    00487
    00495 bool p2p_go_check_ps_mode(void);
    00496 #endif //(NX_P2P_GO && NX_POWERSAVE)
    00497
    00498 #if (NX_P2P_GO)
    00499
    00509 void p2p_go_td_evt(uint8_t vif_index, uint8_t new_status);
    00510
    00519 void p2p_go_oppps_start(struct vif_info_tag *vif, uint8_t ctw);
    00520
    00528 void p2p_go_oppps_stop(struct vif_info_tag *vif);
    00529
    00538 void p2p_go_ps_state_update(struct vif_info_tag *vif);
    00539
    00556 uint8_t p2p_go_noa_start(struct vif_info_tag *vif, bool concurrent, bool dyn_noa,
    00557                          uint8_t counter, uint32_t intv_us, uint32_t dur_us,
    00558                          uint32_t start_time);
    00559
    00571 uint8_t p2p_go_noa_stop(struct vif_info_tag *vif, uint8_t noa_inst, bool host_req);
    00572
    00573 #if (NX_CHNL_CTXT)
    00574
    00584 void p2p_go_noa_concurrent_move(struct vif_info_tag *vif, int32_t offset);
    00585 #endif //(NX_CHNL_CTXT)
    00586
    00597 uint8_t p2p_go_bcn_get_noa_len(uint8_t p2p_index);
    00598
    00606 void p2p_go_bcn_init_noa_pyld(uint32_t a_noa_ie_elt);
    00607
    00618 void p2p_go_bcn_upd_noa_pyld(uint8_t p2p_index, uint32_t a_noa_ie_elt);
    00619
    00629 void p2p_go_bcn_op_done(uint8_t p2p_index, uint8_t operation);
    00630
    00631 #if (NX_POWERSAVE)
    00632
    00641 void p2p_go_pre_tbtt(struct vif_info_tag *vif);
    00642 #endif //(NX_POWERSAVE)
    00643 #endif //(NX_P2P_GO)
    00644
    00645 #endif //(NX_P2P)
    00646
    00648
    00649 #endif // _P2P_H_