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

Wi-Fi Peer-to-Peer (P2P) Management. More...

`#include "rwnx_config.h"`
`#include "mm_timer.h"`
`#include "hal_desc.h"`
`#include "compiler.h"`

Go to the source code of this file.

## Data Structures
struct | p2p_noa_info_tag
| Structure containing all information linked with NoA. More...
struct | p2p_info_tag
| Information structure containing all information about a P2P link. More...
struct | p2p_env_tag
| P2P Global Environment. More...
## Defines
#define | P2P_NOA_CONTINUOUS_COUNTER (255)
| If the counter field of NOA attribute is equal to 255, the absence cycles shall repeat until cancel.
#define | P2P_INVALID_IDX (0xFF)
| Invalid P2P Information Structure Index.
#define | P2P_NOA_NB_MAX (2)
| Maximal number of concurrent NoA.
#define | P2P_NOA_TIMER_MARGIN (5000)
| Margin used to avoid to program NOA timer in the past (in us).
#define | P2P_ABSENCE_DUR_MIN (5000)
| Minimal absence duration we can consider (in us).
#define | P2P_BCN_RX_TO_DUR (5000)
| Beacon RX Timeout Duration (in us).
#define | P2P_OPPPS_MASK (0x80)
| Flag allowing to read OppPS subfield of CTWindow + OppPS field.
#define | P2P_CTWINDOW_MASK (0x7F)
| Flag allowing to read CTWindow subfield of CTWindow + OppPS field.
#define | P2P_SSID_WILDCARD ("DIRECT-")
| SSID Wildcard for a P2P Device.
#define | P2P_SSID_WILDCARD_LEN (7)
| Length of P2P SSID Wildcard.
P2P IE format
See wifi_p2p_technical_specification_v1.1.pdf: 4.1.1 - P2P IE Format Table 4
#define | P2P_IE_ID_OFT (0)
| P2P Element ID (Vendor Specific).
#define | P2P_IE_LEN_OFT (1)
| P2P Element ID (Vendor Specific).
#define | P2P_IE_OUI_OFT (2)
| P2P Element ID (Vendor Specific).
#define | P2P_IE_OUI_TYPE_OFT (5)
| P2P Element ID (Vendor Specific).
#define | P2P_IE_ATT_OFT (6)
| P2P Element ID (Vendor Specific).
#define | P2P_ELMT_ID (MAC_ELTID_OUI)
| P2P Element ID (Vendor Specific).
#define | P2P_OUI_WIFI_ALL_BYTE0 (0x50)
| OUI Value - Wi-FiAll.
#define | P2P_OUI_WIFI_ALL_BYTE1 (0x6F)
| P2P Element ID (Vendor Specific).
#define | P2P_OUI_WIFI_ALL_BYTE2 (0x9A)
| P2P Element ID (Vendor Specific).
#define | P2P_OUI_TYPE_P2P (9)
| Vendor Specific OUI Type for P2P.
P2P Attribute format
See wifi_p2p_technical_specification_v1.1.pdf. 4.1.1 - General format of P2P attribute Table 5
#define | P2P_ATT_ID_OFT (0)
#define | P2P_ATT_LEN_OFT (1)
#define | P2P_ATT_BODY_OFT (3)
Notice of Absence attribute format
See wifi_p2p_technical_specification_v1.1.pdf. 4.1.14 - Notice of Absence attribute Tables 26-27
#define | P2P_NOA_ATT_INDEX_OFT P2P_ATT_BODY_OFT
#define | P2P_NOA_ATT_CTW_OPPPS_OFT (4)
#define | P2P_NOA_ATT_NOA_DESC_OFT (5)
Notice of Absence descriptor format
See wifi_p2p_technical_specification_v1.1.pdf. 4.1.14 - Notice of Absence attribute Tables 28
#define | P2P_NOA_DESC_COUNT_OFT (0)
#define | P2P_NOA_DESC_DUR_OFT (1)
#define | P2P_NOA_DESC_INTV_OFT (5)
#define | P2P_NOA_DESC_START_OFT (9)
#define | P2P_NOA_DESC_LENGTH (13)
#define | P2P_IE_NOA_NO_NOA_DESC_LENGTH (P2P_IE_ATT_OFT + P2P_NOA_ATT_NOA_DESC_OFT)
#define | P2P_NOA_IE_BUFFER_LEN ((P2P_IE_NOA_NO_NOA_DESC_LENGTH + (P2P_NOA_NB_MAX * P2P_NOA_DESC_LENGTH) + 1) / 2)
## Enumerations
enum | p2p_noa_timer_status { P2P_NOA_TIMER_NOT_STARTED = 0, P2P_NOA_TIMER_WAIT_NEXT_ABS, P2P_NOA_TIMER_WAIT_END_ABS }
| NOA Timer (see struct p2p_info_tag) status. More...
enum | p2p_oppps_timer_status { P2P_OPPPS_TIMER_NOT_STARTED = 0, P2P_OPPPS_TIMER_WAIT_END_CTW, P2P_OPPPS_TIMER_WAIT_START_CTW }
| OppPS Timer (see struct p2p_info_tag) status. More...
enum | p2p_attribute_id { P2P_ATT_ID_STATUS = 0, P2P_ATT_ID_MINOR_REASON_CODE, P2P_ATT_ID_P2P_CAPABILITY, P2P_ATT_ID_P2P_DEVICE_ID, P2P_ATT_ID_GROUP_OWNER_INTENT, P2P_ATT_ID_CONFIG_TIMEOUT, P2P_ATT_ID_LISTEN_CHANNEL, P2P_ATT_ID_P2P_GROUP_BSSID, P2P_ATT_ID_EXT_LISTEN_TIMING, P2P_ATT_ID_INTENDED_P2P_IF_ADDR, P2P_ATT_ID_P2P_MANAGEABILITY, P2P_ATT_ID_CHANNEL_LIST, P2P_ATT_ID_NOTICE_OF_ABSENCE, P2P_ATT_ID_P2P_DEVICE_INFO, P2P_ATT_ID_P2P_GROUP_INFO, P2P_ATT_ID_P2P_GROUP_ID, P2P_ATT_ID_P2P_INTERFACE, P2P_ATT_ID_OPERATING_CHANNEL, P2P_ATT_ID_INVITATION_FLAGS, P2P_ATT_ID_VENDOR_SPEC = 221, P2P_ATT_ID_MAX = 255 }
| P2P Attribute ID definitions See wifi_p2p_technical_specification_v1.1.pdf 4.1.1 - P2P IE Format Table 6. More...
enum | p2p_role { P2P_ROLE_CLIENT = 0, P2P_ROLE_GO }
| P2P Role. More...
enum | p2p_bcn_upd_op { P2P_BCN_UPD_OP_NONE = 0, P2P_BCN_UPD_OP_NOA_ADD, P2P_BCN_UPD_OP_NOA_RMV, P2P_BCN_UPD_OP_NOA_UPD }
| Operation codes to be used in p2p_bcn_update_req structure. More...
enum | p2p_noa_type { P2P_NOA_TYPE_CONCURRENT, P2P_NOA_TYPE_NORMAL }
| Type of NoA. More...
## Functions
void | p2p_init (void)
| Initialize the p2p module.
uint8_t | p2p_create (uint8_t vif_index, uint8_t role)
| Link a VIF entry with a P2P entry.
void | p2p_cancel (uint8_t p2p_index, bool vif_del)
| Release a P2P structure.
void | p2p_set_vif_state (struct vif_info_tag *vif, bool active)
| Update the P2P entry parameters when VIF state is updated.
bool | p2p_is_present (uint8_t p2p_index)
| Check GO device presence.
bool | p2p_go_get_next_NOA_date (struct vif_info_tag *vif, uint32_t *next_p2p_present, uint32_t *next_p2p_absent)
| Get next presence/absence date for a p2p GO interface.
uint32_t | p2p_go_get_next_noa_end_date (struct vif_info_tag *vif, uint8_t noa_inst)
| Get end of the next NOA iteration.
uint32_t | p2p_cli_bcn_check_noa (struct vif_info_tag *vif, struct rx_pbd *pyld_desc, struct rx_dmadesc *dma_hdrdesc)
| Look for P2P NOA Attribute inside a received beacon.
void | p2p_cli_handle_action (struct vif_info_tag *vif, uint32_t a_frame, uint16_t length, uint32_t rx_tsf)
| Look for P2P NOA Attribute inside a received action frame.
void | p2p_tbtt_handle (struct vif_info_tag *vif, uint32_t tbtt_time)
| Handle P2P operation to be performed on STA_TBBT or AP_TBBT event.
void | p2p_bcn_evt_handle (struct vif_info_tag *vif)
| Handle P2P operation to be performed on Beacon reception.
bool | p2p_go_check_ps_mode (void)
| Check P2P PS mode.
void | p2p_go_td_evt (uint8_t vif_index, uint8_t new_status)
| Handle update of Traffic status generated by the Traffic Detection module.
void | p2p_go_oppps_start (struct vif_info_tag *vif, uint8_t ctw)
| Start Opportunistic Power Save mode on P2P GO side.
void | p2p_go_oppps_stop (struct vif_info_tag *vif)
| Stop Opportunistic Power Save mode on P2P GO side.
void | p2p_go_ps_state_update (struct vif_info_tag *vif)
| Check if GO PS state has to be updated once it is known that a peer CLI device is entered in Doze mode (used if OppPS has been enabled).
uint8_t | p2p_go_noa_start (struct vif_info_tag *vif, bool concurrent, bool dyn_noa, uint8_t counter, uint32_t intv_us, uint32_t dur_us, uint32_t start_time)
| Start NOA procedure on P2P GO side.
uint8_t | p2p_go_noa_stop (struct vif_info_tag *vif, uint8_t noa_inst, bool host_req)
| Stop NOA procedure on P2P GO side.
void | p2p_go_noa_concurrent_move (struct vif_info_tag *vif, int32_t offset)
| Shift concurrent NOA with a given offset.
uint8_t | p2p_go_bcn_get_noa_len (uint8_t p2p_index)
| Return the additional length to consider in the beacon for the NOA attribute.
void | p2p_go_bcn_init_noa_pyld (uint32_t a_noa_ie_elt)
| Initialize an NOA attribute payload buffer (attribute ID, attribute length, .
void | p2p_go_bcn_upd_noa_pyld (uint8_t p2p_index, uint32_t a_noa_ie_elt)
| Trigger an update of the provided NOA attribute payload buffer.
void | p2p_go_bcn_op_done (uint8_t p2p_index, uint8_t operation)
| Callback to be used by mm_bcn module once operation required by p2p module has been done (ADD, REMOVE, UPDATE).
void | p2p_go_pre_tbtt (struct vif_info_tag *vif)
| When HW is in doze mode, it does not trigger the TBTT interrupt anymore.
## Variables
struct p2p_env_tag | p2p_env
| Global p2p status.
struct p2p_info_tag | p2p_info_tab [NX_P2P_VIF_MAX]
| Global table with all P2P entries.

## Detailed Description

Wi-Fi Peer-to-Peer (P2P) Management.

Copyright (C) RivieraWaves 2011-2019

Definition in file p2p.h.