mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
update
This commit is contained in:
parent
52c964be3f
commit
a590693719
37 changed files with 1008 additions and 841 deletions
|
@ -1,7 +1,7 @@
|
|||
#include <PinNames.h>
|
||||
#include <pinmap.h>
|
||||
#include <gpio_api.h>
|
||||
#include <wifi_wowlan.h>
|
||||
#include <rtw_wowlan/wifi_wowlan.h>
|
||||
#include <freertos_pmu.h>
|
||||
#include <wifi_conf.h>
|
||||
|
||||
|
|
|
@ -212,16 +212,16 @@ struct rtw_wowlan_rx_filter {
|
|||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#error "this structure needs to be packed!"
|
||||
//#error "this structure needs to be packed!"
|
||||
#endif
|
||||
struct rtw_wowlan_status {
|
||||
struct rtw_wowlan {
|
||||
u32 wakeup_reasons; //record wake up reason
|
||||
u32 filter_id; //record which pattern is matched
|
||||
};
|
||||
} _status __attribute__ ((__packed__));
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#error "this structure needs to be packed!"
|
||||
//#error "this structure needs to be packed!"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
extern int inic_start(void);
|
||||
extern int inic_stop(void);
|
||||
#endif
|
||||
#include "wifi_api.h"
|
||||
|
||||
#include "wlan_lib.h"
|
||||
|
||||
#if CONFIG_DEBUG_LOG > 0
|
||||
|
@ -872,23 +874,17 @@ int wifi_get_drv_ability(uint32_t *ability) {
|
|||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_country(rtw_country_code_t country_code) {
|
||||
int ret;
|
||||
|
||||
ret = wext_set_country(WLAN0_NAME, country_code);
|
||||
|
||||
return ret;
|
||||
return wext_set_country(WLAN0_NAME, country_code);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_channel_plan(uint8_t channel_plan) {
|
||||
const char * ifname = WLAN0_NAME;
|
||||
int ret = 0;
|
||||
char buf[24];
|
||||
|
||||
rtw_memset(buf, 0, sizeof(buf));
|
||||
snprintf(buf, 24, "set_ch_plan %x", channel_plan);
|
||||
ret = wext_private_command(ifname, buf, SHOW_PRIVATE_OUT);
|
||||
return ret;
|
||||
return wext_private_command(ifname, buf, SHOW_PRIVATE_OUT);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
@ -922,16 +918,12 @@ void wifi_set_mib(void) {
|
|||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_rf_on(void) {
|
||||
int ret;
|
||||
ret = rltk_wlan_rf_on();
|
||||
return ret;
|
||||
return rltk_wlan_rf_on();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_rf_off(void) {
|
||||
int ret;
|
||||
ret = rltk_wlan_rf_off();
|
||||
return ret;
|
||||
return rltk_wlan_rf_off();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
@ -1078,6 +1070,59 @@ int wifi_get_last_error(void) {
|
|||
int wpas_wps_init(const char* ifname);
|
||||
#endif
|
||||
|
||||
int wifi_start_ap_s(PSOFTAP_CONFIG p) {
|
||||
const char *ifname = WLAN0_NAME;
|
||||
int ret = 0;
|
||||
|
||||
if (wifi_mode == RTW_MODE_STA_AP) {
|
||||
ifname = WLAN1_NAME;
|
||||
}
|
||||
|
||||
if (is_promisc_enabled())
|
||||
promisc_set(0, NULL, 0);
|
||||
|
||||
wifi_reg_event_handler(WIFI_EVENT_STA_ASSOC, wifi_ap_sta_assoc_hdl, NULL);
|
||||
wifi_reg_event_handler(WIFI_EVENT_STA_DISASSOC, wifi_ap_sta_disassoc_hdl,
|
||||
NULL);
|
||||
|
||||
ret = wext_set_mode(ifname, IW_MODE_MASTER);
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
ret = wext_set_channel(ifname, p->channel); //Set channel before starting ap
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
|
||||
switch (p->security_type) {
|
||||
case RTW_SECURITY_OPEN:
|
||||
break;
|
||||
case RTW_SECURITY_WPA2_AES_PSK:
|
||||
ret = wext_set_auth_param(ifname, IW_AUTH_80211_AUTH_ALG,
|
||||
IW_AUTH_ALG_OPEN_SYSTEM);
|
||||
if (ret == 0)
|
||||
ret = wext_set_key_ext(ifname, IW_ENCODE_ALG_CCMP, NULL, 0, 0, 0, 0,
|
||||
NULL, 0);
|
||||
if (ret == 0)
|
||||
ret = wext_set_passphrase(ifname, (u8*) p->password, strlen(p->password));
|
||||
break;
|
||||
default:
|
||||
ret = -1;
|
||||
printf("WIFICONF: security type is not supported\n");
|
||||
break;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
if(p->ssid_hidden) {
|
||||
ret = set_hidden_ssid(ifname, 1);
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
}
|
||||
ret = wext_set_ap_ssid(ifname, (u8*) p->ssid, strlen(p->ssid));
|
||||
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||
wpas_wps_init(ifname);
|
||||
#endif
|
||||
exit: return ret;
|
||||
}
|
||||
|
||||
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
|
||||
int ssid_len, int password_len, int channel) {
|
||||
const char *ifname = WLAN0_NAME;
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
#define __WIFI_CONF_API_H
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "wifi_constants.h"
|
||||
#include "wifi_constants.h"
|
||||
#include "wifi_structures.h"
|
||||
#include "wifi_util.h"
|
||||
#include "wifi_ind.h"
|
||||
#include "wifi_ind.h"
|
||||
#include <platform/platform_stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -68,13 +68,15 @@ struct simple_config_lib_config {
|
|||
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct rtk_test_sc {
|
||||
/* API exposed to user */
|
||||
unsigned char ssid[32];
|
||||
unsigned char password[65];
|
||||
unsigned int ip_addr;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/* expose data */
|
||||
extern s32 is_promisc_callback_unlock;
|
||||
|
|
|
@ -173,6 +173,8 @@ uint8 chk_ap_netif_num(void)
|
|||
return wlan_ap_netifn;
|
||||
}
|
||||
|
||||
extern int wifi_start_ap_s(PSOFTAP_CONFIG p);
|
||||
|
||||
rtw_result_t wifi_run_ap(void) {
|
||||
chk_ap_netif_num();
|
||||
|
||||
|
@ -184,12 +186,7 @@ rtw_result_t wifi_run_ap(void) {
|
|||
if(wext_set_sta_num(wifi_ap_cfg.max_sta) != 0) { // Max number of STAs, should be 1..3, default is 3
|
||||
error_printf("AP not set max connections %d!\n", wifi_ap_cfg.max_sta);
|
||||
};
|
||||
ret = wifi_start_ap(wifi_ap_cfg.ssid, //char *ssid,
|
||||
wifi_ap_cfg.security_type, //rtw_security_t ecurity_type,
|
||||
wifi_ap_cfg.password, //char *password,
|
||||
strlen(wifi_ap_cfg.ssid), //int ssid_len,
|
||||
strlen(wifi_ap_cfg.password), //int password_len,
|
||||
wifi_ap_cfg.channel); //int channel
|
||||
ret = wifi_start_ap_s(&wifi_ap_cfg);
|
||||
wifi_run_mode |= RTW_MODE_AP;
|
||||
if (ret != RTW_SUCCESS) {
|
||||
error_printf("Error(%d): Start AP failed!\n\n", ret);;
|
||||
|
@ -438,12 +435,16 @@ int wifi_run(rtw_mode_t mode) {
|
|||
if(wifi_set_country(wifi_cfg.country_code) != RTW_SUCCESS) {
|
||||
error_printf("Error set tx country_code (%d)!", wifi_cfg.country_code);
|
||||
};
|
||||
// extern uint8_t rtw_power_percentage_idx;
|
||||
// extern uint8_t rtw_power_percentage_idx; // rtw_tx_pwr_percentage_t
|
||||
#if 1 // rltk_set_tx_power_percentage() return all = 0 !
|
||||
rltk_set_tx_power_percentage(wifi_cfg.tx_pwr);
|
||||
#else
|
||||
if(rtw_power_percentage_idx != wifi_cfg.tx_pwr) {
|
||||
if(rltk_set_tx_power_percentage(wifi_cfg.tx_pwr) != RTW_SUCCESS) {
|
||||
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
debug_printf("mode == wifi_mode? (%d == %d?)\n", mode, wifi_mode);
|
||||
// if(mode == wifi_mode)
|
||||
{
|
||||
|
|
|
@ -64,12 +64,12 @@ typedef struct _wifi_config {
|
|||
typedef struct _softap_config {
|
||||
unsigned char ssid[NDIS_802_11_LENGTH_SSID];
|
||||
unsigned char password[IW_PASSPHRASE_MAX_SIZE];
|
||||
rtw_security_t security_type;
|
||||
uint16 beacon_interval; // Note: support 100 ~ 60000 ms, default 100
|
||||
rtw_security_t security_type; // Only: RTW_SECURITY_OPEN, RTW_SECURITY_WPA2_AES_PSK
|
||||
unsigned short beacon_interval; // default 100
|
||||
unsigned char channel; // 1..14
|
||||
unsigned char ssid_hidden; // Note: default 0
|
||||
unsigned char max_sta; // 1..3
|
||||
} SOFTAP_CONFIG, *PSOFTAP_CONFIG;
|
||||
} SOFTAP_CONFIG, * PSOFTAP_CONFIG;
|
||||
//---- Interface 1 - wlan1 - ST - struct -
|
||||
typedef struct _station_config {
|
||||
unsigned char ssid[NDIS_802_11_LENGTH_SSID];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue