mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2026-07-05 02:45:38 +00:00
update -Wall
This commit is contained in:
parent
af72faa906
commit
c98cbe6e00
86 changed files with 523 additions and 352 deletions
|
|
@ -9,22 +9,30 @@
|
|||
#define DATA_IRAM_ATTR
|
||||
#define ICACHE_RAM_ATTR
|
||||
|
||||
#define os_printf(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_printf_plus(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_sprintf_fd(...) rtl_sprintf(__VA_ARGS__)
|
||||
#define ets_sprintf(...) rtl_sprintf(__VA_ARGS__)
|
||||
#ifndef os_malloc
|
||||
#define os_malloc pvPortMalloc
|
||||
#define os_zalloc pvPortZalloc
|
||||
#define os_calloc pvPortCalloc
|
||||
#define os_realloc pvPortRealloc
|
||||
#endif
|
||||
#undef os_free
|
||||
#define os_free vPortFree
|
||||
#define system_get_free_heap_size xPortGetFreeHeapSize
|
||||
#undef os_realloc
|
||||
#define os_realloc pvPortReAlloc
|
||||
|
||||
#define os_printf rtl_printf
|
||||
#define os_printf_plus rtl_printf
|
||||
#define os_sprintf_fd rtl_sprintf
|
||||
#define ets_sprintf rtl_sprintf
|
||||
|
||||
//#ifndef os_malloc
|
||||
#undef os_malloc
|
||||
extern void *pvPortMalloc(size_t xWantedSize);
|
||||
#define os_malloc pvPortMalloc
|
||||
#undef os_zalloc
|
||||
extern void *pvPortZalloc(size_t xWantedSize);
|
||||
#define os_zalloc pvPortZalloc
|
||||
//#undef os_calloc
|
||||
//#define os_calloc pvPortCalloc
|
||||
#undef os_realloc
|
||||
extern void *pvPortReAlloc(void *pv, size_t xWantedSize);
|
||||
#define os_realloc pvPortReAlloc
|
||||
#undef os_free
|
||||
extern void vPortFree(void *pv);
|
||||
#define os_free vPortFree
|
||||
//#endif
|
||||
extern size_t xPortGetFreeHeapSize(void);
|
||||
#define system_get_free_heap_size xPortGetFreeHeapSize
|
||||
|
||||
#define os_bzero rtl_bzero
|
||||
#define os_delay_us wait_us // HalDelayUs
|
||||
|
|
@ -104,22 +112,28 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
|
|||
#define spi_flash_read(faddr, pbuf, size) flash_stream_read(&flashobj, faddr, size, (uint8_t *)pbuf)
|
||||
#define spi_flash_erase_block(blk) flash_erase_block(&flashobj, (blk)<<16);
|
||||
|
||||
#ifndef ip4_addr1
|
||||
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
|
||||
#endif
|
||||
/* These are cast to u16_t, with the intent that they are often arguments
|
||||
* to printf using the U16_F format from cc.h. */
|
||||
#ifndef ip4_addr1_16
|
||||
#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
|
||||
#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
|
||||
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
||||
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
||||
#endif
|
||||
|
||||
#undef IP2STR
|
||||
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
||||
ip4_addr2_16(ipaddr), \
|
||||
ip4_addr3_16(ipaddr), \
|
||||
ip4_addr4_16(ipaddr)
|
||||
|
||||
#undef IPSTR
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
#ifndef MAC2STR
|
||||
|
|
|
|||
|
|
@ -157,6 +157,9 @@ extern unsigned char dhcp_mode_sta;
|
|||
#include "freertos/wrapper.h"
|
||||
#include "skbuff.h"
|
||||
|
||||
extern unsigned char is_promisc_enabled(void);
|
||||
extern int promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char*, unsigned int, void*), unsigned char len_used);
|
||||
|
||||
//------------------------------------------------------------------------end-patch//
|
||||
static int wifi_connect_local(rtw_network_info_t *pWifi) {
|
||||
int ret = 0;
|
||||
|
|
@ -278,8 +281,8 @@ static void wifi_disconn_hdl(char* buf, int buf_len, int flags, void* userdata)
|
|||
else if (rtw_join_status == 0)
|
||||
error_flag = RTW_CONNECT_FAIL;
|
||||
|
||||
else if (rtw_join_status == JOIN_COMPLETE | JOIN_SECURITY_COMPLETE
|
||||
| JOIN_ASSOCIATED | JOIN_AUTHENTICATED | JOIN_LINK_READY)
|
||||
else if (rtw_join_status == (JOIN_COMPLETE | JOIN_SECURITY_COMPLETE
|
||||
| JOIN_ASSOCIATED | JOIN_AUTHENTICATED | JOIN_LINK_READY))
|
||||
error_flag = RTW_WRONG_PASSWORD;
|
||||
}
|
||||
|
||||
|
|
@ -368,6 +371,7 @@ void restore_wifi_info_to_flash() {
|
|||
|
||||
#endif
|
||||
|
||||
int wext_set_bssid(const char *ifname, const __u8 *bssid);
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_connect(
|
||||
unsigned char bssid[ETH_ALEN],
|
||||
|
|
@ -380,7 +384,7 @@ int wifi_connect(
|
|||
|
||||
int ssid_len = 0;
|
||||
int password_len = 0;
|
||||
int bssid_len = 6;
|
||||
// int bssid_len = 6;
|
||||
xSemaphoreHandle join_semaphore;
|
||||
rtw_result_t result = RTW_SUCCESS;
|
||||
u8 wep_hex = 0;
|
||||
|
|
@ -440,7 +444,7 @@ int wifi_connect(
|
|||
|
||||
if (password_len == 10) {
|
||||
|
||||
u32 g[5] = { 0 };
|
||||
unsigned int g[5] = { 0 };
|
||||
u8 i = 0;
|
||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &g[0],
|
||||
&g[1], &g[2], &g[3], &g[4]);
|
||||
|
|
@ -450,7 +454,7 @@ int wifi_connect(
|
|||
password_len = 5;
|
||||
wep_hex = 1;
|
||||
} else if (password_len == 26) {
|
||||
u32 g[13] = { 0 };
|
||||
unsigned int g[13] = { 0 };
|
||||
u8 i = 0;
|
||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x%02x%02x", &g[0], &g[1], &g[2], &g[3],
|
||||
|
|
@ -731,8 +735,10 @@ int wifi_get_ap_info(rtw_bss_info_t * ap_info, rtw_security_t* security) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern int wext_get_drv_ability(const char *ifname, __u32 *ability);
|
||||
|
||||
int wifi_get_drv_ability(uint32_t *ability) {
|
||||
return wext_get_drv_ability(WLAN0_NAME, ability);
|
||||
return wext_get_drv_ability(WLAN0_NAME, (__u32 *)ability);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
|
@ -861,6 +867,9 @@ int wifi_on(rtw_mode_t mode) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern void dhcps_deinit(void); //#include "dhcps.h"
|
||||
|
||||
|
||||
int wifi_off(void) {
|
||||
// int ret = 0;
|
||||
|
||||
|
|
@ -948,6 +957,8 @@ int wifi_get_last_error(void) {
|
|||
int wpas_wps_init(const char* ifname);
|
||||
#endif
|
||||
|
||||
extern int set_hidden_ssid(const char *ifname, uint8_t value);
|
||||
|
||||
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password, int channel, char ssid_hidden) {
|
||||
const char *ifname = WLAN0_NAME;
|
||||
int ssid_len = 0;
|
||||
|
|
@ -1489,6 +1500,8 @@ void wifi_enter_promisc_mode() {
|
|||
}
|
||||
}
|
||||
|
||||
extern void dhcps_init(struct netif * pnetif);
|
||||
|
||||
int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
||||
unsigned char *password, int channel) {
|
||||
unsigned char idx = 0;
|
||||
|
|
@ -1543,10 +1556,8 @@ int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
|||
printf("AP: security_type=%d\n", setting.security_type);
|
||||
printf("AP: password=%s\n", (char* )setting.password);
|
||||
printf("AP: key_idx =%d\n", setting.key_idx);
|
||||
ret = wifi_connect((char*) setting.ssid, setting.security_type,
|
||||
(char*) setting.password, strlen((char* )setting.ssid),
|
||||
strlen((char* )setting.password), setting.key_idx,
|
||||
NULL);
|
||||
ret = wifi_connect(NULL, 0 , (char*) setting.ssid, setting.security_type,
|
||||
(char*) setting.password, setting.key_idx, NULL);
|
||||
if (ret == RTW_SUCCESS) {
|
||||
#if CONFIG_DHCP_CLIENT
|
||||
/* Start DHCPClient */
|
||||
|
|
@ -1723,25 +1734,32 @@ int wifi_disable_packet_filter(unsigned char filter_id) {
|
|||
int wifi_remove_packet_filter(unsigned char filter_id) {
|
||||
return promisc_remove_packet_filter(filter_id);
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_PROMISC
|
||||
|
||||
#ifdef CONFIG_AP_MODE
|
||||
|
||||
extern int wext_enable_forwarding(const char *ifname);
|
||||
int wifi_enable_forwarding(void) {
|
||||
return wext_enable_forwarding(WLAN0_NAME);
|
||||
}
|
||||
|
||||
extern int wext_disable_forwarding(const char *ifname);
|
||||
int wifi_disable_forwarding(void) {
|
||||
return wext_disable_forwarding(WLAN0_NAME);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_AP_MODE
|
||||
|
||||
/* API to set flag for concurrent mode wlan1 issue_deauth when channel switched by wlan0
|
||||
* usage: wifi_set_ch_deauth(0) -> wlan0 wifi_connect -> wifi_set_ch_deauth(1)
|
||||
*/
|
||||
#ifdef CONFIG_CONCURRENT_MODE
|
||||
|
||||
extern int wext_set_ch_deauth(const char *ifname, __u8 enable);
|
||||
int wifi_set_ch_deauth(__u8 enable) {
|
||||
return wext_set_ch_deauth(WLAN1_NAME, enable);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
|
|
|||
|
|
@ -102,103 +102,103 @@ void wifi_indication(WIFI_EVENT_INDICATE event, unsigned char *buf, int buf_len,
|
|||
// , and tries not to share the same stack with wlan driver if remaining stack space is
|
||||
// not available for the following operations.
|
||||
// ex: using semaphore to notice another thread.
|
||||
switch (event) {
|
||||
switch ((u32)event) {
|
||||
case WIFI_EVENT_DISCONNECT:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): Disconnection indication received\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_CONNECT:
|
||||
// For WPA/WPA2 mode, indication of connection does not mean data can be
|
||||
// correctly transmitted or received. Data can be correctly transmitted or
|
||||
// received only when 4-way handshake is done.
|
||||
// Please check WIFI_EVENT_FOURWAY_HANDSHAKE_DONE event
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
// Sample: return mac address
|
||||
if (buf != NULL && buf_len == 6) {
|
||||
info_printf(
|
||||
"%s(%d): Connect indication received: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
__func__, event, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case WIFI_EVENT_FOURWAY_HANDSHAKE_DONE:
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_FOURWAY_HANDSHAKE_DONE:
|
||||
if (buf != NULL)
|
||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_SCAN_RESULT_REPORT:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): WIFI_EVENT_SCAN_RESULT_REPORT\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
case WIFI_EVENT_SCAN_DONE:
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_SCAN_DONE:
|
||||
info_printf("%s(%d): WIFI_EVENT_SCAN_DONE\n", __func__, event);
|
||||
//#if CONFIG_DEBUG_LOG > 3
|
||||
// debug_printf("Time at start %d ms.\n", xTaskGetTickCount());
|
||||
//#endif
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_RECONNECTION_FAIL:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_NO_NETWORK:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if CONFIG_ENABLE_P2P
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_SEND_ACTION_DONE:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_RX_MGNT:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): WIFI_EVENT_RX_MGNT\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#endif //CONFIG_ENABLE_P2P
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_STA_ASSOC:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): WIFI_EVENT_STA_ASSOC\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_STA_DISASSOC:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): WIFI_EVENT_STA_DISASSOC\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_WPS
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_STA_WPS_START:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): WIFI_EVENT_STA_WPS_START\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_WPS_FINISH:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): WIFI_EVENT_WPS_FINISH\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
case WIFI_EVENT_EAPOL_RECVD:
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
case WIFI_EVENT_EAPOL_RECVD:
|
||||
info_printf("%s(%d): WIFI_EVENT_EAPOL_RECVD\n", __func__, event);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
case WIFI_EVENT_BEACON_AFTER_DHCP:
|
||||
#if(WIFI_INDICATE_MSG>1)
|
||||
info_printf("%s(%d): WIFI_EVENT_BEACON_AFTER_DHCP\n", __func__, event);
|
||||
#endif
|
||||
#if(WIFI_INDICATE_MSG>1)
|
||||
case WIFI_EVENT_BEACON_AFTER_DHCP:
|
||||
info_printf("%s(%d): WIFI_EVENT_BEACON_AFTER_DHCP\n", __func__, event);
|
||||
#if 0 // test beacon
|
||||
gpio_write(&gpio_led, 1);
|
||||
gpio_write(&gpio_led, 0);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_INIC_EN
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ int promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char*, unsign
|
|||
unsigned char is_promisc_enabled(void)
|
||||
{
|
||||
#ifdef CONFIG_PROMISC
|
||||
extern unsigned char _is_promisc_enabled(void);
|
||||
return _is_promisc_enabled();
|
||||
#else
|
||||
return 0;
|
||||
|
|
@ -64,6 +65,7 @@ unsigned char is_promisc_enabled(void)
|
|||
int promisc_get_fixed_channel(void *fixed_bssid, u8 *ssid, int *ssid_length)
|
||||
{
|
||||
#ifdef CONFIG_PROMISC
|
||||
extern int _promisc_get_fixed_channel(void *fixed_bssid, u8 *ssid, int *ssid_length);
|
||||
return _promisc_get_fixed_channel(fixed_bssid, ssid, ssid_length);
|
||||
#else
|
||||
return 0;
|
||||
|
|
@ -111,7 +113,7 @@ static struct eth_buffer eth_buffer;
|
|||
#ifdef CONFIG_PROMISC
|
||||
#define MAX_PACKET_FILTER_INFO 5
|
||||
#define FILTER_ID_INIT_VALUE 10
|
||||
rtw_packet_filter_info_t paff_array[MAX_PACKET_FILTER_INFO]={0, 0, 0, 0, 0};
|
||||
rtw_packet_filter_info_t paff_array[MAX_PACKET_FILTER_INFO]; //={0, 0, 0, 0, 0};
|
||||
static u8 packet_filter_enable_num = 0;
|
||||
|
||||
void promisc_init_packet_filter()
|
||||
|
|
|
|||
|
|
@ -321,7 +321,6 @@ int wext_set_tdma_param(const char *ifname, __u8 slot_period,
|
|||
return ret;
|
||||
#else
|
||||
struct iwreq iwr;
|
||||
int ret = -1;
|
||||
__u16 pindex = 7;
|
||||
__u8 para[16]; // 7+(1+1+4)
|
||||
int cmd_len = sizeof("pm_set");
|
||||
|
|
@ -409,7 +408,6 @@ int wext_get_lps_dtim(const char *ifname, __u8 *lps_dtim) {
|
|||
|
||||
int wext_set_tos_value(const char *ifname, __u8 *tos_value) {
|
||||
struct iwreq iwr;
|
||||
int ret = -1;
|
||||
__u8 para[sizeof("set_tos_value") + 4];
|
||||
int cmd_len = sizeof("set_tos_value");
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
|
|
@ -753,7 +751,7 @@ int wext_private_command_with_retval(const char *ifname, char *cmd,
|
|||
iwr.u.data.length = buf_size;
|
||||
iwr.u.data.flags = 0;
|
||||
ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr);
|
||||
if (ret >= 0 & ret_buf != NULL) {
|
||||
if (ret >= 0 && ret_buf != NULL) {
|
||||
if (ret_len > iwr.u.data.length)
|
||||
ret_len = iwr.u.data.length;
|
||||
memcpy(ret_buf, (char *) iwr.u.data.pointer, ret_len);
|
||||
|
|
@ -925,7 +923,6 @@ int wext_set_gen_ie(const char *ifname, char *buf, __u16 buf_len, __u16 flags) {
|
|||
int wext_set_autoreconnect(const char *ifname, __u8 mode, __u8 retyr_times,
|
||||
__u16 timeout) {
|
||||
struct iwreq iwr;
|
||||
int ret = 0;
|
||||
__u8 para[sizeof("SetAutoRecnt") + 4];
|
||||
int cmd_len = sizeof("SetAutoRecnt");
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
|
|
@ -1019,7 +1016,7 @@ int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index) {
|
|||
#endif
|
||||
} else {
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
cmd_len = para = pvPortMalloc((4) * 2 + cmd_len); //size:addr len+cmd_len
|
||||
para = pvPortMalloc((4) * 2 + cmd_len); //size:addr len+cmd_len
|
||||
if (para != NULL) {
|
||||
//Cmd
|
||||
snprintf(para, cmd_len, "UpdateIE");
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ WIFI_CONFIG wifi_cfg = {
|
|||
SOFTAP_CONFIG wifi_ap_cfg = {
|
||||
.ssid = DEF_AP_SSID,
|
||||
.password = DEF_AP_PASSWORD,
|
||||
.security = DEF_AP_SECURITY, // RTW_SECURITY_WPA2_AES_PSK or RTW_SECURITY_OPEN
|
||||
.security = (unsigned char)DEF_AP_SECURITY, // RTW_SECURITY_WPA2_AES_PSK or RTW_SECURITY_OPEN
|
||||
.beacon_interval = DEF_AP_BEACON,
|
||||
.channel = DEF_AP_CHANNEL,
|
||||
.ssid_hidden = 0,
|
||||
|
|
@ -91,7 +91,7 @@ STATION_CONFIG wifi_st_cfg = {
|
|||
.ssid = DEF_ST_SSID,
|
||||
.password = DEF_ST_PASSWORD,
|
||||
.bssid = DEF_ST_BSSID,
|
||||
.flg = DEF_ST_BSSID,
|
||||
.flg = DEF_ST_USE_BSSID,
|
||||
.security = DEF_ST_SECURITY,
|
||||
.autoreconnect = DEF_ST_AUTORECONNECT,
|
||||
.reconnect_pause = DEF_ST_RECONNECT_PAUSE,
|
||||
|
|
@ -204,8 +204,8 @@ LOCAL int wlan_init_done_callback(void) {
|
|||
//char wlan_st_name[] = WLAN0_NAME;
|
||||
char wlan_st_name[] = WLAN0_NAME;
|
||||
char wlan_ap_name[] = WLAN1_NAME;
|
||||
char wlan_st_netifn = 0;
|
||||
char wlan_ap_netifn = 1;
|
||||
unsigned char wlan_st_netifn = 0;
|
||||
unsigned char wlan_ap_netifn = 1;
|
||||
|
||||
|
||||
uint32 get_new_ip(void)
|
||||
|
|
@ -283,7 +283,7 @@ rtw_result_t _wext_enable_powersave(int adapter_num, uint8 ips_mode, uint8 lps_m
|
|||
return ret;
|
||||
}
|
||||
|
||||
LOCAL int _wext_cmp_ssid(int adapter_num, uint8 *ssid)
|
||||
LOCAL int _wext_cmp_ssid(int adapter_num, unsigned char *ssid)
|
||||
{
|
||||
_adapter * pad = get_padaptern(adapter_num);
|
||||
int ret = 0;
|
||||
|
|
@ -362,7 +362,7 @@ LOCAL rtw_result_t wifi_run_ap(void) {
|
|||
int timeout = wifi_test_timeout_ms / wifi_test_timeout_step_ms;
|
||||
while (1) {
|
||||
#if 1
|
||||
if (_wext_cmp_ssid(WLAN_AP_NETIF_NUM, &wifi_ap_cfg.ssid )) {
|
||||
if (_wext_cmp_ssid(WLAN_AP_NETIF_NUM, wifi_ap_cfg.ssid )) {
|
||||
#else
|
||||
char essid[33];
|
||||
if ((wext_get_ssid(wlan_ap_name, (unsigned char *) essid) > 0)
|
||||
|
|
@ -409,7 +409,7 @@ LOCAL rtw_result_t StartStDHCPClient(void)
|
|||
debug_printf("Start DHCPClient...\n");
|
||||
int ret = RTW_SUCCESS;
|
||||
struct netif * pnetif = &xnetif[WLAN_ST_NETIF_NUM];
|
||||
DHCP_CONFIG *p = (dhcp_cfg *)&wifi_st_dhcp;
|
||||
DHCP_CONFIG *p = (DHCP_CONFIG *)&wifi_st_dhcp;
|
||||
unsigned char mode = p->mode;
|
||||
if(mode == 2 && p->ip != IP4ADDR(255,255,255,255) && p->ip != IP4ADDR(0,0,0,0)) { // fixed ip
|
||||
netif_set_addr(pnetif, (ip_addr_t *)&p->ip, (ip_addr_t *)&p->mask, (ip_addr_t *)&p->gw);
|
||||
|
|
@ -602,8 +602,8 @@ LOCAL void _LwIP_Init(void)
|
|||
xnetif[idx].name[0] = 'r';
|
||||
xnetif[idx].name[1] = '0' + idx;
|
||||
}
|
||||
netif_add(&xnetif[WLAN_ST_NETIF_NUM], (struct netif *)&wifi_st_dhcp.ip, (struct netif *)&wifi_st_dhcp.mask, (struct netif *)&wifi_st_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
||||
netif_add(&xnetif[WLAN_AP_NETIF_NUM], (struct netif *)&wifi_ap_dhcp.ip, (struct netif *)&wifi_ap_dhcp.mask, (struct netif *)&wifi_ap_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
||||
netif_add(&xnetif[WLAN_ST_NETIF_NUM], (ip_addr_t *)&wifi_st_dhcp.ip, (ip_addr_t *)&wifi_st_dhcp.mask, (ip_addr_t *)&wifi_st_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
||||
netif_add(&xnetif[WLAN_AP_NETIF_NUM], (ip_addr_t *)&wifi_ap_dhcp.ip, (ip_addr_t *)&wifi_ap_dhcp.mask, (ip_addr_t *)&wifi_ap_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
||||
#if CONFIG_ETHERNET // && NET_IF_NUM > 2
|
||||
{
|
||||
struct ip_addr ipaddr;
|
||||
|
|
@ -628,6 +628,8 @@ LOCAL void _LwIP_Init(void)
|
|||
}
|
||||
}
|
||||
|
||||
extern int rltk_set_tx_power_percentage(rtw_tx_pwr_percentage_t power_percentage_idx);
|
||||
|
||||
int wifi_run(rtw_mode_t mode) {
|
||||
int ret = 0;
|
||||
#if CONFIG_DEBUG_LOG > 4
|
||||
|
|
@ -668,8 +670,8 @@ int wifi_run(rtw_mode_t mode) {
|
|||
netbios_set_name(WLAN_ST_NETIF_NUM, lwip_host_name[0]);
|
||||
#endif
|
||||
#endif
|
||||
netif_set_addr(&xnetif[WLAN_ST_NETIF_NUM], &wifi_st_dhcp.ip,
|
||||
&wifi_st_dhcp.mask, &wifi_st_dhcp.gw);
|
||||
netif_set_addr(&xnetif[WLAN_ST_NETIF_NUM], (ip_addr_t *) &wifi_st_dhcp.ip,
|
||||
(ip_addr_t *) &wifi_st_dhcp.mask, (ip_addr_t *) &wifi_st_dhcp.gw);
|
||||
pnif = &xnetif[WLAN_AP_NETIF_NUM];
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
// @todo ethernetif_init()...
|
||||
|
|
@ -678,8 +680,8 @@ int wifi_run(rtw_mode_t mode) {
|
|||
netbios_set_name(WLAN_AP_NETIF_NUM, lwip_host_name[1]);
|
||||
#endif
|
||||
#endif
|
||||
netif_set_addr(&xnetif[WLAN_AP_NETIF_NUM], &wifi_ap_dhcp.ip,
|
||||
&wifi_ap_dhcp.mask, &wifi_ap_dhcp.gw);
|
||||
netif_set_addr(&xnetif[WLAN_AP_NETIF_NUM], (ip_addr_t *) &wifi_ap_dhcp.ip,
|
||||
(ip_addr_t *) &wifi_ap_dhcp.mask, (ip_addr_t *) &wifi_ap_dhcp.gw);
|
||||
|
||||
}
|
||||
switch(mode) {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@
|
|||
#include "wifi_constants.h"
|
||||
#include "queue.h"
|
||||
|
||||
#ifndef ip4_addr1
|
||||
#define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((uint8_t*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((uint8_t*)(ipaddr))[3])
|
||||
#endif
|
||||
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
|
|
@ -118,8 +120,8 @@ extern unsigned char wifi_mode; // rtw_mode_t
|
|||
extern unsigned char wifi_st_status; // WIFI_STA_ENUM
|
||||
extern char wlan_st_name[];
|
||||
extern char wlan_ap_name[];
|
||||
extern char wlan_st_netifn;
|
||||
extern char wlan_ap_netifn;
|
||||
extern unsigned char wlan_st_netifn;
|
||||
extern unsigned char wlan_ap_netifn;
|
||||
|
||||
/* WiFi Station & scan security */
|
||||
typedef enum {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ LOCAL void _wifi_scan_done_hdl(char* buf, int buf_len, int flags, void* userdata
|
|||
web_scan_handler_t * pwscn_rec = &web_scan_handler_ptr;
|
||||
if(pscan_rec->gscan_result_handler) {
|
||||
// сторонний вывод
|
||||
(*pscan_rec->gscan_result_handler)(pscan_rec);
|
||||
(*pscan_rec->gscan_result_handler)((rtw_scan_handler_result_t *) pscan_rec);
|
||||
}
|
||||
else {
|
||||
// оставить структуру pscan_rec->pap_details[i] для вывода в web scan на 5 сек
|
||||
|
|
@ -136,6 +136,7 @@ LOCAL int _wifi_scan_networks(rtw_scan_result_handler_t results_handler) {
|
|||
}
|
||||
|
||||
/* -------- wext_set_pscan_channels ----------------- */
|
||||
extern int iw_ioctl(const char * ifname, unsigned long request, struct iwreq * pwrq);
|
||||
|
||||
LOCAL int wext_set_pscan_channels(void) {
|
||||
struct iwreq iwr;
|
||||
|
|
@ -183,7 +184,7 @@ rtw_result_t api_wifi_scan(api_scan_result_handler_t scan_result_cb)
|
|||
// error_printf("Error xTimerStart\n");
|
||||
} else if(wext_set_pscan_channels() < 0) {
|
||||
// error_printf("ERROR: wifi set partial scan channel fail\n");
|
||||
} else if(_wifi_scan_networks(scan_result_cb) != RTW_SUCCESS) {
|
||||
} else if(_wifi_scan_networks((rtw_scan_result_handler_t) scan_result_cb) != RTW_SUCCESS) {
|
||||
// error_printf("ERROR: wifi scan failed\n");
|
||||
} else if(scan_result_cb) {
|
||||
int i = 300;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue