This commit is contained in:
刘可亮
2025-10-21 13:59:50 +08:00
parent 33c375efac
commit 3e10f578d3
7070 changed files with 998841 additions and 1402535 deletions

View File

@@ -140,6 +140,39 @@ enum cfgrwnx_msg_index {
CFGRWNX_SET_PS_MODE_RESP,
CFGRWNX_CH_SWITCH_EVENT,
/// Request to remain on specific channel (param: @ref cfgrwnx_remain_on_channel)
CFGRWNX_REMAIN_ON_CHANNEL_CMD,
/// Response to CFGRWNX_REMAIN_ON_CHANNEL_CMD. Only indicates if request was valid or
/// not. The actual status will be in CFGRWNX_REMAIN_ON_CHANNEL_EVENT (param: @ref
/// cfgrwnx_resp)
CFGRWNX_REMAIN_ON_CHANNEL_RESP,
/// Event sent after receiving CFGRWNX_REMAIN_ON_CHANNEL_CMD, to indicate that the
/// procedure is completed (param: @ref cfgrwnx_remain_on_channel_event)
CFGRWNX_REMAIN_ON_CHANNEL_EVENT,
/// Request to cancel remain on channel (param: @ref cfgrwnx_cancel_remain_on_channel)
CFGRWNX_CANCEL_REMAIN_ON_CHANNEL_CMD,
/// Response to CFGRWNX_CANCEL_REMAIN_ON_CHANNEL_CMD. Only indicates if request was
/// valid or not. The actual status will be in CFGRWNX_CANCEL_REMAIN_ON_CHANNEL_EVENT
/// (param: @ref cfgrwnx_resp)
CFGRWNX_CANCEL_REMAIN_ON_CHANNEL_RESP,
/// Event sent after receiving CFGRWNX_CANCEL_REMAIN_ON_CHANNEL_CMD, to indicate that
/// the procedure is completed (param: @ref cfgrwnx_remain_on_channel_event)
CFGRWNX_REMAIN_ON_CHANNEL_EXP_EVENT,
CFGRWNX_CANCEL_REMAIN_ON_CHANNEL_EVENT,
/// Request by Application to setup NOA protocol (param: @ref cfgrwnx_p2p_noa_cmd)
CFGRWNX_P2P_NOA_CMD,
/// Response to CFGRWNX_P2P_NOA_CMD (param: @ref cfgrwnx_resp)
CFGRWNX_P2P_NOA_RESP,
/// Notified by supplicant to indicate P2P Provision Discovery Request received (param: @ref cfgrwnx_p2p_prov_disc_req_note)
CFGRWNX_P2P_PROV_DISC_REQ_NOTE,
#ifdef CFG_SOFTAP
/// Sent by Supplicant to update the beacon (param: @ref cfgrwnx_bcn_update)
CFGRWNX_AP_UPDATE_BASICRATE_CMD,
/// Response to CFGRWNX_BCN_UPDATE (param: @ref cfgrwnx_resp)
CFGRWNX_AP_UPDATE_BASICRATE_RESP,
#endif
};
/// CFGRWNX status
@@ -725,6 +758,77 @@ struct cfgrwnx_set_ps_mode {
bool enabled;
};
/// structure for CFGRWNX_REMAIN_ON_CHANNEL_CMD
struct cfgrwnx_roc_cmd {
/// header
struct cfgrwnx_msg_hdr hdr;
/// freq
unsigned int freq;
/// duration
unsigned int duration;
/// Index of the FHOST vif
int fhost_vif_idx;
/// event socket
int sock;
};
/// structure for CFGRWNX_CANCEL_REMAIN_ON_CHANNEL_CMD
struct cfgrwnx_cancel_roc_cmd {
/// header
struct cfgrwnx_msg_hdr hdr;
/// Index of the FHOST
int fhost_vif_idx;
};
/// structcure for CFGRWNX_ROC_EVENT
struct cfgrwnx_roc_event {
/// header
struct cfgrwnx_msg_hdr hdr;
/// ieee80211_channel center_freq
uint32_t center_freq;
/// duration ms
unsigned int duration;
};
/// Structure for CFGRWNX_P2P_NOA_CMD
struct cfgrwnx_p2p_noa_cmd
{
/// header
struct cfgrwnx_msg_hdr hdr;
/// Vif idx
uint16_t fhost_vif_idx;
/// Count
uint8_t count;
/// Duration (in us)
uint32_t duration_us;
/// Interval (in us)
uint32_t interval_us;
/// Indicate if NoA can be paused for traffic reason
bool dyn_noa;
};
/// Structure for CFGRWNX_P2P_PROV_DISC_REQ_NOTE
struct cfgrwnx_p2p_prov_disc_req_note {
/// header
struct cfgrwnx_msg_hdr hdr;
/// Vif idx
uint16_t fhost_vif_idx;
/// Reserved
uint8_t reserved0[2];
/// mac_peer
struct mac_addr mac_peer;
};
/// Structure for CFGRWNX_AP_UPDATE_BASICRATE
struct cfgrwnx_ap_update_basicrate {
/// header
struct cfgrwnx_msg_hdr hdr;
/// Vif idx
uint16_t fhost_vif_idx;
/// Basic rates
struct mac_rateset basic_rates;
};
/**
* @}
*/

View File

@@ -74,6 +74,10 @@ enum fhost_msg_type {
* Messages received from tx cfm callback (for 802.11 frame)
*/
FHOST_MSG_TXCFM_CB,
/**
* Messages received from wifi api
*/
FHOST_MSG_WIFI_API,
};
/*
@@ -121,11 +125,6 @@ struct vif_info_tag
struct mm_timer_tag tbtt_timer;
#endif //(NX_MULTI_ROLE || NX_CHNL_CTXT || (NX_P2P_GO && NX_POWERSAVE))
#if (NX_P2P || NX_CHNL_CTXT)
/// Timer used for Beacon Reception Timeout
struct mm_timer_tag tmr_bcn_to;
#endif //(NX_P2P || NX_CHNL_CTXT)
#if (NX_MULTI_ROLE || NX_TDLS)
/// BSSID this VIF belongs to
struct mac_addr bssid;
@@ -269,6 +268,8 @@ struct fhost_vif_tag
int conn_sock;
/// Socket for AP
int ap_sock;
/// Socket for p2p
int p2p_sock;
/// Pointer to the MAC VIF structure
struct vif_info_tag *mac_vif;
/// Index of the STA being the AP peer of the device - TODO rework
@@ -390,6 +391,8 @@ net_if_t *fhost_to_net_if(uint8_t fhost_vif_idx);
*/
int fhost_vif_name(int fhost_vif_idx, char *name, int len);
struct fhost_vif_tag * fhost_vif_get_first_free_itf(void);
/**
****************************************************************************************
* @brief Get FHOST VIF index from its name.
@@ -401,6 +404,8 @@ int fhost_vif_name(int fhost_vif_idx, char *name, int len);
*/
int fhost_vif_idx_from_name(const char *name);
int fhost_vif_idx_from_vif_tag(struct fhost_vif_tag *tag);
/**
****************************************************************************************
* @brief Configure default queues enabled for U-APSD.
@@ -516,6 +521,8 @@ int fhost_sta_cfg(int fhost_vif_idx, struct fhost_vif_sta_cfg *cfg);
*/
int fhost_ap_cfg(int fhost_vif_idx, struct fhost_vif_ap_cfg *cfg);
int fhost_p2p_cfg(int fhost_vif_idx);
int fhost_p2p_go_cfg(int fhost_vif_idx, struct fhost_vif_p2p_cfg *cfg);
extern struct vif_info_tag vif_info_tab[NX_VIRT_DEV_MAX];
extern struct sta_info_tag sta_info_tab[STA_MAX + NX_VIRT_DEV_MAX];

View File

@@ -41,6 +41,7 @@
*/
#include "mac.h"
#include "rwnx_defs.h"
#include "rwnx_rx.h"
/**
* FHOST configuration item description
@@ -345,6 +346,10 @@ struct fhost_frame_info
* true. In this case all other fields are still valid.
*/
uint8_t *payload;
/**
* PHY information about the received frame
*/
struct rx_info *prinfo;
};
/**
@@ -377,6 +382,10 @@ struct fhost_vif_monitor_cfg
* Parameter for the monitor callback
*/
void *cb_arg;
/**
* RX filter setting
*/
uint32_t rx_filter;
};
/**
@@ -417,6 +426,37 @@ struct fhost_vif_sta_cfg
int timeout_ms;
};
/**
* Configuration for p2p interface
*/
struct fhost_vif_p2p_cfg
{
/**
* SSID to connect to (mandatory)
*/
struct mac_ssid ssid;
/**
* AP operating channel (tx_power and flags fields are ignored).
*/
struct mac_chan_op chan;
/**
* AP password/PSK passed as a string (i.e. MUST be terminated by a null byte)
*/
char key[64 + 1];
/**
* Enable HE
*/
uint8_t enable_he;
/**
* Enable ACS
*/
uint8_t enable_acs;
/**
* Vendor IE
*/
const char *vendor_ie;
};
/**
* Configuration for VIF_AP interface
*/

View File

@@ -256,6 +256,9 @@ int fhost_cntrl_mm_set_filter(uint32_t value);
int fhost_cntrl_me_set_lp_level(uint8_t lp_level);
void set_deepsleep_param(unsigned int listen_interval, unsigned int dont_wait_bcmc);
int fhost_cntrl_scan_cancel_req(void);
int fhost_cntrl_mm_set_monitor_channel(int fvif_idx, int chan_num, int band_width);
void fhost_cntrl_deinit(void);
/**

View File

@@ -92,6 +92,7 @@ void fhost_config_prepare(struct me_config_req *me_config, struct mm_start_req *
****************************************************************************************
*/
struct mac_chan_def *fhost_chan_get(int freq);
uint16_t fhost_chan_bw_flags_get_by_freq(uint16_t ch_freq);
void fhost_chan_clean(void);
int fhost_chan_update(const char * country_code);
int aicwf_channel_set(aicwf_config_scan_chan *config_scan_chan);

View File

@@ -228,7 +228,12 @@ struct fhost_tx_sta_traffic
* - One TXQ for unknown STA for each VIF (Only enabled for AP and Monitor interface)
* TXQ id is @verbatim (NX_REMOTE_STA_MAX * TID_MAX) + <vif_idx> @endverbatim
*/
#if NX_P2P
#define FHOST_TXQ_CNT ((STA_MAX * TID_MAX) + NX_VIRT_DEV_MAX + 1)
#define FHOST_OFF_CHAN_TXQ_IDX ((STA_MAX * TID_MAX) + NX_VIRT_DEV_MAX)
#else
#define FHOST_TXQ_CNT ((STA_MAX * TID_MAX) + NX_VIRT_DEV_MAX)
#endif
/// FHOST RX environment structure
struct fhost_tx_env_tag
@@ -398,6 +403,10 @@ void fhost_tx_do_vif_disable(uint8_t vif_idx);
void fhost_tx_vif_txq_enable(struct fhost_vif_tag *fhost_vif);
void fhost_txq_vif_stop(uint8_t sta_id, uint16_t reason);
void fhost_txq_vif_start(uint8_t sta_id, uint16_t reason);
#if NX_P2P
struct fhost_tx_queue_tag* fhost_txq_offchan_init(void);
void fhost_txq_offchan_deinit(struct fhost_tx_queue_tag* txq);
#endif
int fhost_tx_cntrl_by_timer(uint32_t timeout_ms, uint8_t num);
int fhost_stop_tx_cntrl_by_timer(void);

View File

@@ -339,6 +339,9 @@ int fhost_wpa_stop_ap(int fhost_vif_idx);
int fhost_wpa_disassociate_sta(int fhost_vif_idx, struct mac_addr *macaddr);
int fhost_wpa_wps(int fhost_vif_idx, bool enable, int timeout_ms);
int fhost_wpa_switch_channel(int fhost_vif_idx, uint32_t frequency);
#if NX_P2P
int fhost_wpa_set_wps_pbc(int fhost_vif_idx);
#endif
int fhost_ap_add_blacklist(int fhost_vif_idx, struct mac_addr *macaddr);
int fhost_ap_del_blacklist(int fhost_vif_idx, struct mac_addr *macaddr);
int fhost_ap_add_whitelist(int fhost_vif_idx, struct mac_addr *macaddr);

View File

@@ -8,12 +8,67 @@
#define _WIFI_IF_H_
#include "wifi_al.h"
#include "fhost_api.h"
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
/// WIFI_API index message
enum wifi_api_msg_index {
WIFI_API_SCAN_START,
WIFI_API_SCAN_CANCEL,
WIFI_API_STA_CONNECT,
WIFI_API_STA_DISCONNECT,
WIFI_API_AP_START,
WIFI_API_AP_STOP,
WIFI_API_AP_DEAUTH,
WIFI_API_P2P_GO_START,
WIFI_API_P2P_GO_STOP,
WIFI_API_P2P_GO_DEAUTH,
WIFI_API_WPS_PBC_SET,
WIFI_API_MONITOR_START,
WIFI_API_MONITOR_STOP,
};
/// WIFI_API handler description
struct wifi_api_handler {
/// message index
int index;
/// handler function
void (*func) (void *msg);
};
/// WIFI_API message header
struct wifi_api_msg_hdr {
/// Length, in bytes, of the message (including this header)
uint16_t len;
/// ID of the message.
uint16_t id;
};
struct wifi_api_set_wps_pbc_tag {
struct wifi_api_msg_hdr hdr;
/// Vif idx
int fhost_vif_idx;
};
struct wifi_api_monitor_start_tag {
struct wifi_api_msg_hdr hdr;
/// Vif idx
int fhost_vif_idx;
/// Interface configuration
struct fhost_vif_monitor_cfg cfg;
};
struct wifi_api_monitor_stop_tag {
struct wifi_api_msg_hdr hdr;
/// Vif idx
int fhost_vif_idx;
};
extern aic_wifi_event_cb g_aic_wifi_event_cb;
int wifi_api_msg_send(struct wifi_api_msg_hdr *cmd);
int aicwf_is_5g_enable(void);
int aic_wifi_init_mac(void);
int aic_wifi_open(int mode, void *param, u16 chip_id);

View File

@@ -63,13 +63,13 @@ int wlan_sta_connect(uint8_t *ssid, uint8_t *pw, int timeout_ms);
int wlan_start_ap(struct aic_ap_cfg *user_cfg);
int wlan_start_p2p(struct aic_p2p_cfg *user_cfg);
int wlan_start_p2p(int fvif_idx, struct fhost_vif_p2p_cfg *p2p_cfg_in);
int wlan_disconnect_sta(uint8_t idx);
int wlan_stop_ap(void);
int wlan_stop_p2p(void);
int wlan_stop_p2p(int fvif_idx);
int wlan_start_wps(void);