This commit is contained in:
pvvx 2017-04-22 16:44:33 +03:00
parent cf7a2d9683
commit f7b901aa27
76 changed files with 3753 additions and 3990 deletions

View file

@ -948,13 +948,16 @@ void fATWC(void *arg){
if(assoc_by_bssid){
printf("Joining BSS by BSSID "MAC_FMT" ...\n", MAC_ARG(wifi.bssid.octet));
ret = wifi_connect_bssid(wifi.bssid.octet, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password,
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL);
} else {
printf("Joining BSS by SSID %s...\n", (char*)wifi.ssid.val);
ret = wifi_connect((char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, wifi.ssid.len,
wifi.password_len, wifi.key_id, NULL);
}
ret = wifi_connect(wifi.bssid.octet,
assoc_by_bssid,
(char*)wifi.ssid.val,
wifi.security_type,
(char*)wifi.password,
wifi.key_id,
NULL);
if(ret!= RTW_SUCCESS){
printf("ERROR: Can't connect to AP\n");
@ -1652,19 +1655,10 @@ void fATPA(void *arg)
goto exit;
}
if(hidden_ssid){
if(wifi_start_ap_with_hidden_ssid((char*)ap.ssid.val, ap.security_type, (char*)ap.password, ap.ssid.len, ap.password_len, ap.channel) < 0) {
if(wifi_start_ap((char*)ap.ssid.val, ap.security_type, (char*)ap.password, ap.channel, hidden_ssid) < 0) {
//at_printf("\r\n[ATPA] ERROR : Start AP failed");
error_no = 4;
goto exit;
}
}
else{
if(wifi_start_ap((char*)ap.ssid.val, ap.security_type, (char*)ap.password, ap.ssid.len, ap.password_len, ap.channel) < 0) {
//at_printf("\r\n[ATPA] ERROR : Start AP failed");
error_no = 4;
goto exit;
}
}
while(1) {
@ -1906,13 +1900,14 @@ void fATPN(void *arg)
wifi_set_pscan_chan(&connect_channel, &pscan_config, 1);
#endif
if(assoc_by_bssid){
ret = wifi_connect_bssid(wifi.bssid.octet, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password,
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL);
} else {
ret = wifi_connect((char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, wifi.ssid.len,
wifi.password_len, wifi.key_id, NULL);
}
ret = wifi_connect(
wifi.bssid.octet,
assoc_by_bssid,
(char*)wifi.ssid.val,
wifi.security_type,
(char*)wifi.password,
wifi.key_id,
NULL);
if(ret!= RTW_SUCCESS){
//at_printf("\r\n[ATPN] ERROR: Can't connect to AP");
@ -2345,8 +2340,14 @@ int atcmd_wifi_restore_from_flash(void)
break;
}
ret = wifi_connect((char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, wifi.ssid.len,
wifi.password_len, wifi.key_id, NULL);
ret = wifi_connect(
NULL,
0,
(char*)wifi.ssid.val,
wifi.security_type,
(char*)wifi.password,
wifi.key_id,
NULL);
if(ret == RTW_SUCCESS){
LwIP_DHCP(0, DHCP_START);
ret = 0;

View file

@ -7,17 +7,18 @@
#define ICACHE_FLASH_ATTR
#define ICACHE_RODATA_ATTR
#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
@ -51,6 +52,7 @@
#define os_strncpy rtl_strncpy
#define os_strstr rtl_strstr
#define os_random Rand
//extern uint32 phy_get_rand(void);
#define system_get_os_print() 1
@ -102,7 +104,6 @@ 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);
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
@ -121,6 +122,13 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
#define IPSTR "%d.%d.%d.%d"
#ifndef MAC2STR
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
#endif
#ifndef DEBUGSOO
/* CONFIG_DEBUG_LOG:
=0 Off all diag/debug msg,
=1 Only errors,
@ -135,5 +143,12 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
#else
#define DEBUGSOO CONFIG_DEBUG_LOG
#endif
#endif //#ifndef DEBUGSOO
//#define system_get_sdk_version() "3.5.3"
//#define system_get_time xTaskGetTickCount
//#define ets_get_cpu_frequency HalGetCpuClk
#endif // _INCLUDE_ESP_COMP_H_

View file

@ -1,7 +1,7 @@
#include <PinNames.h>
#include <pinmap.h>
#include <gpio_api.h>
#include <rtw_wowlan/wifi_wowlan.h>
#include <wifi_wowlan.h>
#include <freertos_pmu.h>
#include <wifi_conf.h>

View file

@ -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 {
struct rtw_wowlan_status {
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
/**

View file

@ -10,8 +10,10 @@
#include <lwip/netif.h>
#include "wifi/wifi_conf.h"
#include <platform/platform_stdlib.h>
#ifdef CONFIG_ENABLE_EAP
#include <polarssl/ssl.h>
#include <polarssl/memory.h>
#endif
#define WLAN0_NAME "wlan0"
#ifndef ENABLE
@ -21,6 +23,21 @@
#define DISABLE (0)
#endif
#ifndef CONFIG_ENABLE_EAP
int get_eap_phase(void){
return 0;
}
int get_eap_method(void){
return 0;
}
void eap_autoreconnect_hdl(u8 method_id)
{
(void) method_id;
}
#else
u8 eap_phase = 0;
u8 eap_method = 0;
@ -42,9 +59,6 @@ void eap_eapol_recvd_hdl(char *buf, int buf_len, int flags, void* handler_user_d
void eap_eapol_start_hdl(char *buf, int buf_len, int flags, void* handler_user_data);
#endif
void set_eap_phase(unsigned char is_trigger_eap){
eap_phase = is_trigger_eap;
}
int get_eap_phase(void){
return eap_phase;
@ -54,6 +68,10 @@ int get_eap_method(void){
return eap_method;
}
void set_eap_phase(unsigned char is_trigger_eap){
eap_phase = is_trigger_eap;
}
void reset_config(void){
eap_target_ssid = NULL;
eap_identity = NULL;
@ -64,6 +82,8 @@ void reset_config(void){
eap_client_key_pwd = NULL;
}
#ifdef CONFIG_ENABLE_EAP
void judge_station_disconnect(void)
{
int mode = 0;
@ -82,7 +102,7 @@ void judge_station_disconnect(void)
wifi_disconnect();
}
}
#ifdef CONFIG_ENABLE_EAP
void eap_disconnected_hdl(char *buf, int buf_len, int flags, void* handler_user_data){
// printf("disconnected\n");
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, eap_eapol_recvd_hdl);
@ -258,11 +278,12 @@ static int connect_by_open_system(char *target_ssid)
if (target_ssid != NULL) {
while (1) {
rtw_msleep_os(500); //wait scan complete.
ret = wifi_connect(target_ssid,
ret = wifi_connect(
NULL,
0,
target_ssid,
RTW_SECURITY_OPEN,
NULL,
strlen(target_ssid),
0,
0,
NULL);
if (ret == RTW_SUCCESS) {
@ -451,3 +472,5 @@ int eap_cert_setup(ssl_context *ssl)
#endif
return 0;
}
#endif //#ifdef CONFIG_ENABLE_EAP

View file

@ -303,11 +303,12 @@ static int wps_connect_to_AP_by_certificate(rtw_network_info_t *wifi)
printf("ssid_len = %d\n", wifi->ssid.len);
printf("password_len = %d\n", wifi->password_len);
while (1) {
ret = wifi_connect((char*)wifi->ssid.val,
ret = wifi_connect(
NULL,
0,
(char*)wifi->ssid.val,
wifi->security_type,
(char*)wifi->password,
wifi->ssid.len,
wifi->password_len,
wifi->key_id,
NULL);
if (ret == RTW_SUCCESS) {
@ -336,11 +337,11 @@ static int wps_connect_to_AP_by_open_system(char *target_ssid)
if (target_ssid != NULL) {
rtw_msleep_os(500); //wait scan complete.
while (1) {
ret = wifi_connect(target_ssid,
RTW_SECURITY_OPEN,
ret = wifi_connect(
NULL,
strlen(target_ssid),
0,
target_ssid,
RTW_SECURITY_OPEN,
0,
NULL);
if (ret == RTW_SUCCESS) {

View file

@ -9,6 +9,7 @@
#include <wifi/wifi_conf.h>
#include <wifi/wifi_util.h>
#include <wifi/wifi_ind.h>
#include <wifi_api.h>
#include "tcpip.h"
#include <osdep_service.h>
@ -22,8 +23,6 @@
extern int inic_start(void);
extern int inic_stop(void);
#endif
#include "wifi_api.h"
#include "wlan_lib.h"
#if CONFIG_DEBUG_LOG > 0
@ -429,8 +428,18 @@ void restore_wifi_info_to_flash() {
#endif
//----------------------------------------------------------------------------//
int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
int ssid_len, int password_len, int key_id, void *semaphore) {
int wifi_connect(
unsigned char bssid[ETH_ALEN],
char use_bssid, // flag
char *ssid,
rtw_security_t security_type,
char *password,
int key_id,
void *semaphore) {
int ssid_len = 0;
int password_len = 0;
int bssid_len = 6;
xSemaphoreHandle join_semaphore;
rtw_result_t result = RTW_SUCCESS;
u8 wep_hex = 0;
@ -441,7 +450,34 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
return RTW_ERROR;
}
if(ssid) {
ssid_len = rtl_strlen(ssid);
if(ssid_len > NDIS_802_11_LENGTH_SSID)
ssid_len = NDIS_802_11_LENGTH_SSID;
}
if(password) {
password_len = rtl_strlen(password);
if(password_len > IW_PASSPHRASE_MAX_SIZE)
password_len = IW_PASSPHRASE_MAX_SIZE;
}
rtw_join_status = 0; //clear for last connect status
error_flag = RTW_UNKNOWN; //clear for last connect status
internal_join_result_t *join_result =
(internal_join_result_t *) rtw_zmalloc(
sizeof(internal_join_result_t));
if (!join_result) {
#if CONFIG_DEBUG_LOG > 3
error_printf("%s: Can't malloc memory!\n", __func__);
#endif
return RTW_NOMEM;
}
if (ssid_len && ssid) {
join_result->network_info.ssid.len = ssid_len > 32 ? 32 : ssid_len;
rtw_memcpy(join_result->network_info.ssid.val, ssid, ssid_len);
}
if(bssid) rtw_memcpy(join_result->network_info.bssid.octet, bssid, ETH_ALEN);
error_flag = RTW_UNKNOWN; //clear for last connect status
if ((((password_len > RTW_MAX_PSK_LEN) || (password_len < RTW_MIN_PSK_LEN))
&& ((security_type == RTW_SECURITY_WPA_TKIP_PSK)
@ -463,24 +499,24 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
if (password_len == 10) {
u32 p[5] = { 0 };
u32 g[5] = { 0 };
u8 i = 0;
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &p[0],
&p[1], &p[2], &p[3], &p[4]);
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &g[0],
&g[1], &g[2], &g[3], &g[4]);
for (i = 0; i < 5; i++)
wep_pwd[i] = (u8) p[i];
wep_pwd[i] = (u8) g[i];
wep_pwd[5] = '\0';
password_len = 5;
wep_hex = 1;
} else if (password_len == 26) {
u32 p[13] = { 0 };
u32 g[13] = { 0 };
u8 i = 0;
sscanf((const char*) password, "%02x%02x%02x%02x%02x%02x%02x"
"%02x%02x%02x%02x%02x%02x", &p[0], &p[1], &p[2], &p[3],
&p[4], &p[5], &p[6], &p[7], &p[8], &p[9], &p[10],
&p[11], &p[12]);
"%02x%02x%02x%02x%02x%02x", &g[0], &g[1], &g[2], &g[3],
&g[4], &g[5], &g[6], &g[7], &g[8], &g[9], &g[10],
&g[11], &g[12]);
for (i = 0; i < 13; i++)
wep_pwd[i] = (u8) p[i];
wep_pwd[i] = (u8) g[i];
wep_pwd[13] = '\0';
password_len = 13;
wep_hex = 1;
@ -488,20 +524,8 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
}
}
internal_join_result_t *join_result =
(internal_join_result_t *) rtw_zmalloc(
sizeof(internal_join_result_t));
if (!join_result) {
#if CONFIG_DEBUG_LOG > 3
error_printf("%s: Can't malloc memory!\n", __func__);
#endif
return RTW_NOMEM;
}
join_result->network_info.ssid.len = ssid_len > 32 ? 32 : ssid_len;
rtw_memcpy(join_result->network_info.ssid.val, ssid, ssid_len);
join_result->network_info.password_len = password_len;
if (password_len) {
/* add \0 to the end */
join_result->network_info.password = rtw_zmalloc(password_len + 1);
@ -542,9 +566,33 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
#if DD_WIFI_CONN // дублирование с wifi_connect_bssid_local()
wifi_connect_local(&join_result->network_info);
#else
if (wifi_connect_local(&join_result->network_info) == 0)
wext_set_ssid(WLAN0_NAME, join_result->network_info.ssid.val,
join_result->network_info.ssid.len);
rtw_network_info_t *pWifi = &join_result->network_info;
if (wifi_connect_local(pWifi) == 0) {
uint16 flg = 0;
if(use_bssid) {
struct {
u8 bssid[ETH_ALEN + 2];
void * p;
} bs = { 0 };
memcpy(bs.bssid, pWifi->bssid.octet, ETH_ALEN);
for(int i = 0; i < ETH_ALEN; i++) {
flg += bs.bssid[i];
}
if(flg == 0x5FA || flg == 0) { // 0x5FA = 6*0xff
use_bssid = 0;
flg = 0;
}
else {
use_bssid = 1;
wext_set_bssid(WLAN0_NAME, bs.bssid);
}
}
if(!use_bssid) {
wext_set_ssid(WLAN0_NAME, join_result->network_info.ssid.val,
join_result->network_info.ssid.len);
};
}
#endif
join_user_data = join_result;
@ -604,10 +652,18 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
wifi_handshake_done_hdl);
return result;
}
/*
int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid,
rtw_security_t security_type, char *password, int bssid_len,
int ssid_len, int password_len, int key_id, void *semaphore) {
int wifi_connect_bssid(
unsigned char bssid[ETH_ALEN],
char *ssid,
rtw_security_t security_type,
char *password,
int bssid_len,
int ssid_len,
int password_len,
int key_id,
void *semaphore) {
xSemaphoreHandle join_semaphore;
rtw_result_t result = RTW_SUCCESS;
@ -643,7 +699,7 @@ int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid,
}
join_result->network_info.password_len = password_len;
if (password_len) {
/* add \0 to the end */
// add \0 to the end
join_result->network_info.password = rtw_zmalloc(password_len + 1);
if (!join_result->network_info.password) {
return RTW_NOMEM;
@ -726,6 +782,7 @@ int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid,
wifi_handshake_done_hdl);
return result;
}
*/
int wifi_disconnect(void) {
int ret = 0;
@ -740,7 +797,6 @@ int wifi_disconnect(void) {
}
return ret;
}
//----------------------------------------------------------------------------//
int wifi_is_connected_to_ap(void) {
return rltk_wlan_is_connected_to_ap();
@ -874,17 +930,23 @@ int wifi_get_drv_ability(uint32_t *ability) {
//----------------------------------------------------------------------------//
int wifi_set_country(rtw_country_code_t country_code) {
return wext_set_country(WLAN0_NAME, country_code);
int ret;
ret = wext_set_country(WLAN0_NAME, country_code);
return ret;
}
//----------------------------------------------------------------------------//
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);
return wext_private_command(ifname, buf, SHOW_PRIVATE_OUT);
ret = wext_private_command(ifname, buf, SHOW_PRIVATE_OUT);
return ret;
}
//----------------------------------------------------------------------------//
@ -918,12 +980,16 @@ void wifi_set_mib(void) {
//----------------------------------------------------------------------------//
int wifi_rf_on(void) {
return rltk_wlan_rf_on();
int ret;
ret = rltk_wlan_rf_on();
return ret;
}
//----------------------------------------------------------------------------//
int wifi_rf_off(void) {
return rltk_wlan_rf_off();
int ret;
ret = rltk_wlan_rf_off();
return ret;
}
//----------------------------------------------------------------------------//
@ -1070,63 +1136,21 @@ 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) {
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;
int password_len = 0;
int ret = 0;
if(ssid) {
ssid_len = rtl_strlen(ssid);
if(ssid_len > NDIS_802_11_LENGTH_SSID)
ssid_len = NDIS_802_11_LENGTH_SSID;
}
if(password) {
password_len = rtl_strlen(password);
if(password_len > IW_PASSPHRASE_MAX_SIZE)
password_len = IW_PASSPHRASE_MAX_SIZE;
}
if (wifi_mode == RTW_MODE_STA_AP) {
ifname = WLAN1_NAME;
@ -1142,6 +1166,7 @@ int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
ret = wext_set_mode(ifname, IW_MODE_MASTER);
if (ret < 0)
goto exit;
// if(!channel) channel = 1;
ret = wext_set_channel(ifname, channel); //Set channel before starting ap
if (ret < 0)
goto exit;
@ -1166,13 +1191,19 @@ int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
if (ret < 0)
goto exit;
if(ssid_hidden) {
ret = set_hidden_ssid(ifname, 1);
if (ret < 0)
goto exit;
}
ret = wext_set_ap_ssid(ifname, (u8*) ssid, ssid_len);
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
wpas_wps_init(ifname);
#endif
exit: return ret;
}
/*
int wifi_start_ap_with_hidden_ssid(char *ssid, rtw_security_t security_type,
char *password, int ssid_len, int password_len, int channel) {
const char *ifname = WLAN0_NAME;
@ -1226,6 +1257,7 @@ int wifi_start_ap_with_hidden_ssid(char *ssid, rtw_security_t security_type,
#endif
exit: return ret;
}
*/
void wifi_scan_each_report_hdl(char* buf, int buf_len, int flags,
void* userdata) {
@ -1710,7 +1742,7 @@ void wifi_enter_promisc_mode() {
}
int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
unsigned char *password, int ssid_len, int password_len, int channel) {
unsigned char *password, int channel) {
unsigned char idx = 0;
struct ip_addr ipaddr;
struct ip_addr netmask;
@ -1747,8 +1779,7 @@ int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
wifi_on(RTW_MODE_AP);
}
// start ap
if (wifi_start_ap((char*) ssid, security_type, (char*) password, ssid_len,
password_len, channel) < 0) {
if (wifi_start_ap((char*) ssid, security_type, (char*) password, channel, 0) < 0) {
printf("ERROR: Operation failed!\n");
return -1;
}

View file

@ -3,16 +3,18 @@
#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>
#include "wifi_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************
* Macros
******************************************************/
@ -137,14 +139,14 @@ int wifi_manager_init(void);
* RTW_ERROR : if an error occurred
*/
int wifi_connect(
unsigned char bssid[ETH_ALEN],
char use_bssid,
char *ssid,
rtw_security_t security_type,
char *password,
int ssid_len,
int password_len,
int key_id,
void *semaphore);
/*
int wifi_connect_bssid(
unsigned char bssid[ETH_ALEN],
char *ssid,
@ -155,7 +157,7 @@ int wifi_connect_bssid(
int password_len,
int key_id,
void *semaphore);
*/
/** Disassociates from a Wi-Fi network.
*
* @return RTW_SUCCESS : On successful disassociation from
@ -446,6 +448,8 @@ int wifi_get_lps_dtim(unsigned char *dtim);
* @return RTW_SUCCESS : if successfully creates an AP
* RTW_ERROR : if an error occurred
*/
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password, int channel, char ssid_hidden);
/*
int wifi_start_ap(
char *ssid,
rtw_security_t security_type,
@ -453,7 +457,7 @@ int wifi_start_ap(
int ssid_len,
int password_len,
int channel);
*/
/** Starts an infrastructure WiFi network with hidden SSID
*
* @warning If a STA interface is active when this function is called, the softAP will\n
@ -478,6 +482,7 @@ int wifi_start_ap(
* @return RTW_SUCCESS : if successfully creates an AP
* RTW_ERROR : if an error occurred
*/
/*
int wifi_start_ap_with_hidden_ssid(
char *ssid,
rtw_security_t security_type,
@ -485,7 +490,7 @@ int wifi_start_ap_with_hidden_ssid(
int ssid_len,
int password_len,
int channel);
*/
/** Initiates a scan to search for 802.11 networks.
*
* The scan progressively accumulates results over time, and
@ -638,8 +643,6 @@ int wifi_restart_ap(
unsigned char *ssid,
rtw_security_t security_type,
unsigned char *password,
int ssid_len,
int password_len,
int channel);
int wifi_config_autoreconnect(__u8 mode, __u8 retyr_times, __u16 timeout);

View file

@ -530,8 +530,13 @@ enum sc_result SC_parse_scan_result_and_connect(scan_buf_arg* scan_buf, rtw_netw
ret = SC_TARGET_CHANNEL_SCAN_FAIL;
goto sc_connect_wifi_fail;
}
ret = wifi_connect_bssid(scan_result.mac, (char*)wifi->ssid.val, SC_translate_iw_security_mode(scan_result.sec_mode),
(char*)wifi->password, ETH_ALEN, wifi->ssid.len, wifi->password_len, 0, NULL);
ret = wifi_connect(
scan_result.mac,
1,
(char*)wifi->ssid.val,
SC_translate_iw_security_mode(scan_result.sec_mode),
(char*)wifi->password,
0, NULL);
if (ret == RTW_SUCCESS)
goto sc_connect_wifi_success;
}
@ -691,8 +696,13 @@ enum sc_result SC_connect_to_AP(void)
goto wifi_connect_fail;
}
rtw_join_status = 0;//clear simple config status
ret = wifi_connect_bssid(g_bssid, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password,
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL);
ret = wifi_connect(g_bssid,
1,
(char*)wifi.ssid.val,
wifi.security_type,
(char*)wifi.password,
wifi.key_id,
NULL);
if (ret == RTW_SUCCESS)
goto wifi_connect_success;

View file

@ -68,15 +68,13 @@ struct simple_config_lib_config {
};
#pragma pack(push, 1)
#pragma pack(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;

View file

@ -36,6 +36,11 @@
#include "wifi_api.h"
#include "wifi_user_set.h"
#ifdef CONFIG_ENABLE_WPS
extern void cmd_ap_wps(int argc, char **argv);
extern int wpas_wps_dev_config(u8 *dev_addr, u8 bregistrar);
#endif //CONFIG_WPS_AP
//=========================================
//--- Wlan Config Init-------------------
WIFI_CONFIG wifi_cfg = {
@ -68,6 +73,7 @@ STATION_CONFIG wifi_st_cfg = {
.ssid = DEF_ST_SSID,
.password = DEF_ST_PASSWORD,
.bssid = DEF_ST_BSSID,
.flg = DEF_ST_BSSID,
.security_type = DEF_ST_SECURITY,
.autoreconnect = DEF_ST_AUTORECONNECT,
.reconnect_pause = DEF_ST_RECONNECT_PAUSE
@ -115,9 +121,10 @@ uint32 write_wifi_cfg(uint32 flg)
uint32 ret = 0;
PFEEP_ELEMENT p = feep_tab;
for(int m = 1; m && p->id != 0; m <<= 1, p++) {
if((flg & m)
&& flash_write_cfg(p->obj, p->id, p->size) < p->size) {
ret |= m;
if(flg & m) {
if(!flash_write_cfg(p->obj, p->id, p->size)) {
ret |= m;
};
};
};
return ret;
@ -173,8 +180,6 @@ 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();
@ -186,7 +191,18 @@ 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_s(&wifi_ap_cfg);
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
// todo: ветка не доделана
wpas_wps_dev_config(xnetif[WLAN_AP_NETIF_NUM].hwaddr, 1);
#endif //CONFIG_WPS_AP
if(wifi_ap_cfg.channel == 0 || wifi_ap_cfg.channel > 14) {
wifi_ap_cfg.channel = 1;
}
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,
wifi_ap_cfg.channel, //int channel
wifi_ap_cfg.ssid_hidden); //
wifi_run_mode |= RTW_MODE_AP;
if (ret != RTW_SUCCESS) {
error_printf("Error(%d): Start AP failed!\n\n", ret);;
@ -233,13 +249,13 @@ rtw_result_t StartStDHCPClient(void)
struct netif * pnetif = &xnetif[WLAN_ST_NETIF_NUM];
DHCP_CONFIG *p = (dhcp_cfg *)&wifi_st_dhcp;
unsigned char mode = p->mode;
if((mode == 3)
&& (p->ip == IP4ADDR(255,255,255,255)
|| p->ip == IP4ADDR(0,0,0,0))) {
mode = 2;
if((mode == 3) // Auto fix
&& p->ip != IP4ADDR(255,255,255,255)
&& p->ip != IP4ADDR(0,0,0,0)) {
// mode = 2; // fixed ip
}
else mode = 1;
if(mode == 2) {
else mode = 1; // DHCP On
if(mode == 2) { // fixed ip
netif_set_addr(pnetif, (ip_addr_t *)&p->ip, (ip_addr_t *)&p->mask, (ip_addr_t *)&p->gw);
// dhcps_init(pnetif);
}
@ -254,8 +270,8 @@ rtw_result_t StartStDHCPClient(void)
p->ip = pnetif->ip_addr.addr;
p->gw = pnetif->gw.addr;
p->mask = pnetif->netmask.addr;
if(p->mode == 3) {
p->mode = 2;
if(p->mode == 3) { // Auto fix
p->mode = 2; // fixed ip
write_wifi_cfg(BID_ST_DHCP_CFG);
}
ret = RTW_SUCCESS;
@ -282,9 +298,14 @@ rtw_result_t wifi_run_st(void) {
}
#endif
info_printf("Connected to AP (%s, netif%d)...\n", wlan_st_name, wlan_st_netifn);
ret = wifi_connect(wifi_st_cfg.ssid, wifi_st_cfg.security_type,
wifi_st_cfg.password, strlen(wifi_st_cfg.ssid),
strlen(wifi_st_cfg.password), -1, NULL);
ret = wifi_connect(
wifi_st_cfg.bssid,
wifi_st_cfg.flg,
wifi_st_cfg.ssid,
wifi_st_cfg.security_type,
wifi_st_cfg.password,
-1,
NULL);
wifi_run_mode |= RTW_MODE_STA;
if (ret != RTW_SUCCESS) {
error_printf("%s: Operation failed! Error(%d)\n", __func__, ret);
@ -328,7 +349,7 @@ int _wifi_on(rtw_mode_t mode) {
// wext_set_adaptivity(RTW_ADAPTIVITY_NORMAL);
// wext_set_adaptivity(RTW_ADAPTIVITY_CARRIER_SENSE);
devnum = (mode == RTW_MODE_STA_AP);
devnum = (mode == RTW_MODE_STA_AP); // flag use 2 netif
ret = rltk_wlan_init(0, mode);
if (ret < 0) return ret;
@ -390,8 +411,9 @@ void _LwIP_Init(void)
netif_set_up(&xnetif[idx]);
}
info_printf("interface %d is initialized\n", idx);
wifi_mode = 0;
lwip_init_done = 1;
// для отслеживания первого старта ?
// wifi_mode = RTW_MODE_NONE;
}
}
@ -400,9 +422,6 @@ int wifi_run(rtw_mode_t mode) {
#if CONFIG_DEBUG_LOG > 4
debug_printf("\n%s(%d), %d\n", __func__, mode, wifi_run_mode);
#endif
if(mode != RTW_MODE_NONE) {
_LwIP_Init();
};
if(wifi_run_mode & RTW_MODE_AP) {
info_printf("Deinit old AP...\n");
LwIP_DHCP(WLAN_AP_NETIF_NUM, DHCP_STOP);
@ -435,25 +454,37 @@ 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; // 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
// extern uint8_t rtw_power_percentage_idx;
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)
{
if((wifi_mode == RTW_MODE_AP) || (wifi_mode == RTW_MODE_STA_AP)) {
wifi_run_ap();
};
if((wifi_mode == RTW_MODE_STA) || (wifi_mode == RTW_MODE_STA_AP)) {
wifi_run_st();
};
switch(wifi_mode) {
case RTW_MODE_STA_AP:
wifi_run_ap();
wifi_run_st();
break;
case RTW_MODE_STA:
wifi_run_st();
break;
case RTW_MODE_AP:
wifi_run_ap();
break;
#if 0// CONFIG_ENABLE_??
case RTW_MODE_PROMISC:
break;
#endif
#if CONFIG_ENABLE_P2P
case RTW_MODE_P2P:
break;
#endif
default:
error_printf("Error WiFi mode(%d)\n", wifi_mode);
}
#if CONFIG_INTERACTIVE_MODE
/* Initial uart rx swmaphore*/
vSemaphoreCreateBinary(uart_rx_interrupt_sema);
@ -475,6 +506,7 @@ error_end:
return ret;
}
/* Load cfg, init WiFi + LwIP init, WiFi start if wifi_cfg.mode != RTW_MODE_NONE */
void wifi_init(void) {
debug_printf("\nLoad Config\n");
read_wifi_cfg(wifi_cfg.load_flg); // DEF_LOAD_CFG
@ -483,13 +515,12 @@ void wifi_init(void) {
// Call back from application layer after wifi_connection success
// p_write_reconnect_ptr = wlan_write_reconnect_data_to_flash;
p_wlan_autoreconnect_hdl = NULL;
if (wifi_cfg.mode != RTW_MODE_NONE) {
wifi_mode = wifi_cfg.mode;
_LwIP_Init();
#if CONFIG_WIFI_IND_USE_THREAD
wifi_manager_init();
wifi_manager_init();
#endif
wifi_run(wifi_cfg.mode);
}
// wifi_cfg.mode = RTW_MODE_PROMISC; //RTW_MODE_P2P;
wifi_run(wifi_cfg.mode);
}
rtw_security_t translate_rtw_security(u8 security_type)
@ -519,6 +550,7 @@ rtw_security_t translate_rtw_security(u8 security_type)
return security_mode;
}
void show_wifi_ap_ip(void) {
printf("SoftAP ip: " IPSTR "\n", IP2STR(&xnetif[WLAN_AP_NETIF_NUM].ip_addr));
}

View file

@ -8,7 +8,6 @@
#ifndef _WIFI_API_H_
#define _WIFI_API_H_
#include "wifi_constants.h"
#include "wifi_conf.h"
#define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0])
#define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1])
@ -64,21 +63,21 @@ 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; // Only: RTW_SECURITY_OPEN, RTW_SECURITY_WPA2_AES_PSK
unsigned short beacon_interval; // default 100
rtw_security_t security_type; // RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK
uint16 beacon_interval; // Note: support 100 ~ 60000 ms, 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];
unsigned char password[IW_PASSPHRASE_MAX_SIZE];
rtw_security_t security_type;
unsigned char bssid[6]; // Note: If bssid set is not ff.ff.ff.ff.ff.ff,
// station will connect to the router with both ssid[] and bssid[] matched.
unsigned char bssid[6]; // Note: If bssid set is not ff.ff.ff.ff.ff.ff || 00:00:00:00:00:00
unsigned char autoreconnect; // 0 - none, 1..254 - count, 255 - all
unsigned char reconnect_pause; // in sec
unsigned char reconnect_pause; // in sec
unsigned char flg; // station will connect to the router with both ssid[], else if set flg - bssid[] matched.
// rtw_adaptivity_mode_t
} STATION_CONFIG, *PSTATION_CONFIG;
//--- LwIP Config -------------------------
@ -106,6 +105,7 @@ extern DHCP_CONFIG wifi_ap_dhcp;
extern STATION_CONFIG wifi_st_cfg;
extern DHCP_CONFIG wifi_st_dhcp;
extern rtw_mode_t wifi_run_mode;
extern rtw_mode_t wifi_mode;
extern char wlan_st_name[];
extern char wlan_ap_name[];
extern char wlan_st_netifn;

View file

@ -124,9 +124,9 @@ extern void cmd_googlenest(int argc, char **argv);
extern void cmd_jd_smart(int argc, char **argv);
#endif
#if CONFIG_WLAN
static void cmd_wifi_on(int argc, char **argv);
static void cmd_wifi_off(int argc, char **argv);
static void cmd_wifi_disconnect(int argc, char **argv);
void cmd_wifi_on(int argc, char **argv);
void cmd_wifi_off(int argc, char **argv);
void cmd_wifi_disconnect(int argc, char **argv);
extern void cmd_promisc(int argc, char **argv);
extern void cmd_simple_config(int argc, char **argv);
@ -222,9 +222,8 @@ static void cmd_wifi_sta_and_ap(int argc, char **argv)
if(wifi_start_ap(argv[1],
RTW_SECURITY_WPA2_AES_PSK,
argv[3],
strlen((const char *)argv[1]),
strlen((const char *)argv[3]),
channel
channel,
0
) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n\n");
return;
@ -234,9 +233,8 @@ static void cmd_wifi_sta_and_ap(int argc, char **argv)
if(wifi_start_ap(argv[1],
RTW_SECURITY_OPEN,
NULL,
strlen((const char *)argv[1]),
0,
channel
channel,
0
) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n");
return;
@ -332,9 +330,8 @@ static void cmd_wifi_ap(int argc, char **argv)
if(wifi_start_ap(argv[1],
RTW_SECURITY_WPA2_AES_PSK,
argv[3],
strlen((const char *)argv[1]),
strlen((const char *)argv[3]),
channel
channel,
0
) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n");
return;
@ -344,9 +341,8 @@ static void cmd_wifi_ap(int argc, char **argv)
if(wifi_start_ap(argv[1],
RTW_SECURITY_OPEN,
NULL,
strlen((const char *)argv[1]),
0,
channel
channel,
0
) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n");
return;
@ -443,11 +439,12 @@ static void cmd_wifi_connect(int argc, char **argv)
semaphore = NULL;
}
ret = wifi_connect(ssid,
security_type,
password,
ssid_len,
password_len,
ret = wifi_connect(
NULL,
0,
ssid,
security_type,
password,
key_id,
semaphore);
@ -480,7 +477,6 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
char *ssid = NULL;
rtw_security_t security_type;
char *password;
int bssid_len;
int ssid_len = 0;
int password_len;
int key_id;
@ -525,21 +521,18 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
if(argc == 3 + index){
security_type = RTW_SECURITY_OPEN;
password = NULL;
bssid_len = ETH_ALEN;
password_len = 0;
key_id = 0;
semaphore = NULL;
}else if(argc ==4 + index){
security_type = RTW_SECURITY_WPA2_AES_PSK;
password = argv[3 + index];
bssid_len = ETH_ALEN;
password_len = strlen((const char *)argv[3 + index]);
key_id = 0;
semaphore = NULL;
}else{
security_type = RTW_SECURITY_WEP_PSK;
password = argv[3 + index];
bssid_len = ETH_ALEN;
password_len = strlen((const char *)argv[3 + index]);
key_id = atoi(argv[4 + index]);
if(( password_len != 5) && (password_len != 13)) {
@ -553,13 +546,12 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
semaphore = NULL;
}
ret = wifi_connect_bssid(bssid,
ret = wifi_connect(
bssid,
1,
ssid,
security_type,
password,
bssid_len,
ssid_len,
password_len,
security_type,
password,
key_id,
semaphore);
@ -578,7 +570,7 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
printf("Got IP after %dms.\n", (tick3-tick1));
}
static void cmd_wifi_disconnect(int argc, char **argv)
void cmd_wifi_disconnect(int argc, char **argv)
{
int timeout = 20;
char essid[33];
@ -714,14 +706,14 @@ static void cmd_wifi_info(int argc, char **argv)
#endif
}
static void cmd_wifi_on(int argc, char **argv)
void cmd_wifi_on(int argc, char **argv)
{
if(wifi_on(RTW_MODE_STA)<0){
printf("ERROR: Wifi on failed!\n");
}
}
static void cmd_wifi_off(int argc, char **argv)
void cmd_wifi_off(int argc, char **argv)
{
#if CONFIG_WEBSERVER
stop_web_server();
@ -1059,7 +1051,7 @@ static const cmd_entry cmd_table[] = {
{"wifi_wps", cmd_wps},
#endif
#ifdef CONFIG_WPS_AP
//pvvx {"wifi_ap_wps", cmd_ap_wps},
{"wifi_ap_wps", cmd_ap_wps},
#endif
#if CONFIG_ENABLE_P2P
{"wifi_p2p_start", cmd_wifi_p2p_start},

View file

@ -333,10 +333,14 @@ int joinlink_finish(unsigned char security_type)
//printf("ap_bssid: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", ap_bssid[0],ap_bssid[1],ap_bssid[2],ap_bssid[3],ap_bssid[4],ap_bssid[5]);
ret = wifi_connect((unsigned char *)result.ssid, security_mode,
(unsigned char *)result.pwd, result.ssid_length,
result.pwd_length,
0,NULL);
ret = wifi_connect(
NULL,
0,
(unsigned char *)result.ssid,
security_mode,
(unsigned char *)result.pwd,
0,
NULL);
if(ret == RTW_SUCCESS){
printf("Connect ok!\n");

View file

@ -1694,11 +1694,12 @@ int uartadapter_connect_wifi(rtw_network_info_t *p_wifi, uint32_t channel, uint8
return ret;
}
ret = wifi_connect((char*)p_wifi->ssid.val,
ret = wifi_connect(
NULL,
0,
(char*)p_wifi->ssid.val,
p_wifi->security_type,
(char*)p_wifi->password,
p_wifi->ssid.len,
p_wifi->password_len,
p_wifi->key_id,
NULL);

View file

@ -108,7 +108,7 @@ SD_RESULT SD_GetCapacity(uint32_t *sector_count) {
//----- SD_ReadBlocks
SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
int rd_count = 0;
int rd_count;
unsigned char * buf;
if ((u32) data & 3) {
@ -144,7 +144,7 @@ SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
//----- SD_WriteBlocks
SD_RESULT SD_WriteBlocks(u32 sector, const u8 *data, u32 count) {
int wr_count = 0;
int wr_count;
unsigned char * buf;
if ((u32) data & 3) {

View file

@ -612,20 +612,20 @@ struct _ADAPTER{
u16 interface_type;//USB,SDIO,SPI,PCI
u32 work_mode; //STA, AP, STA+AP, PROMISC, P2P
struct dvobj_priv *dvobj; //+8
struct mlme_priv mlmepriv; //+12 [1244]
struct mlme_ext_priv mlmeextpriv; //+1256 [912]
struct cmd_priv cmdpriv; //+2168
struct dvobj_priv *dvobj;
struct mlme_priv mlmepriv;
struct mlme_ext_priv mlmeextpriv;
struct cmd_priv cmdpriv;
struct evt_priv evtpriv;
//struct io_queue *pio_queue;
struct io_priv iopriv;
struct xmit_priv xmitpriv; //+2248
struct recv_priv recvpriv; //+2752
struct sta_priv stapriv; //+3024 [164]
struct xmit_priv xmitpriv;
struct recv_priv recvpriv;
struct sta_priv stapriv;
struct security_priv securitypriv;
struct registry_priv registrypriv; // registrypriv.power_percentage_idx +4929
struct pwrctrl_priv pwrctrlpriv; // pwrctrlpriv.bInternalAutoSuspend //+5061
struct eeprom_priv eeprompriv; //+5128?
struct registry_priv registrypriv;
struct pwrctrl_priv pwrctrlpriv;
struct eeprom_priv eeprompriv;
//TODO
// struct led_priv ledpriv;
@ -666,20 +666,20 @@ struct _ADAPTER{
struct wifi_display_info wfd_info;
#endif //CONFIG_WFD
PVOID HalData; //+5656
u32 hal_data_sz; //+5660
struct hal_ops HalFunc; //+5664
PVOID HalData;
u32 hal_data_sz;
struct hal_ops HalFunc;
s32 bDriverStopped; //+5880
s32 bSurpriseRemoved; //+5884
s32 bCardDisableWOHSM; //+5888
u8 RxStop; //Used to stop rx thread as early as possible //+5892
s32 bDriverStopped;
s32 bSurpriseRemoved;
s32 bCardDisableWOHSM;
u8 RxStop; //Used to stop rx thread as early as possible
u32 IsrContent;
u32 ImrContent;
u8 EepromAddressSize;
u8 hw_init_completed; //+5905
u8 hw_init_completed;
u8 bDriverIsGoingToUnload;
u8 init_adpt_in_progress;
u8 bMpDriver;
@ -692,9 +692,9 @@ struct _ADAPTER{
_thread_hdl_ evtThread;
#endif
#if defined(CONFIG_ISR_THREAD_MODE_POLLING) || defined(CONFIG_ISR_THREAD_MODE_INTERRUPT)
struct task_struct isrThread; //+5888?
struct task_struct isrThread;
#endif
struct task_struct cmdThread; //+5920
struct task_struct cmdThread;
#ifdef CONFIG_XMIT_THREAD_MODE
struct task_struct xmitThread;
#endif
@ -702,13 +702,13 @@ struct _ADAPTER{
struct task_struct recvThread;
#endif
#ifdef CONFIG_RECV_TASKLET_THREAD
struct task_struct recvtasklet_thread; //+5952
struct task_struct recvtasklet_thread;
#endif
#ifdef CONFIG_XMIT_TASKLET_THREAD
#ifdef PLATFORM_LINUX
struct tasklet_struct xmit_tasklet;
#else
struct task_struct xmittasklet_thread; //+5984
struct task_struct xmittasklet_thread;
#endif
#endif
#ifdef CONFIG_SDIO_XMIT_THREAD
@ -721,8 +721,8 @@ struct _ADAPTER{
void (*dvobj_deinit)(struct dvobj_priv *dvobj);
#endif
void (*intf_start)(_adapter * adapter); //+6008
void (*intf_stop)(_adapter * adapter); //+6012
void (*intf_start)(_adapter * adapter);
void (*intf_stop)(_adapter * adapter);
#ifdef PLATFORM_WINDOWS
_nic_hdl hndis_adapter;//hNdisAdapter(NDISMiniportAdapterHandle);
@ -741,9 +741,9 @@ struct _ADAPTER{
#endif //#ifdef PLATFORM_ECOS
#if defined(PLATFORM_FREERTOS) || defined (PLATFORM_CMSIS_RTOS)
_nic_hdl pnetdev; //+6016
int bup; //+6020
struct net_device_stats stats; //+6024
_nic_hdl pnetdev;
int bup;
struct net_device_stats stats;
#endif //#ifdef PLATFORM_FREERTOS
#ifdef PLATFORM_LINUX
@ -773,7 +773,7 @@ struct _ADAPTER{
int bup;
_lock glock;
#endif //PLATFORM_FREEBSD
u8 net_closed; //+6052
u8 net_closed;
u8 bFWReady;
//u8 bBTFWReady;
@ -785,20 +785,20 @@ struct _ADAPTER{
u8 bDisableAutosuspend;
#endif
_adapter *pbuddy_adapter; //+6056
_adapter *pbuddy_adapter;
_mutex *hw_init_mutex; //+6060
_mutex *hw_init_mutex;
#if defined(CONFIG_CONCURRENT_MODE)
u8 isprimary; //is primary adapter or not //+6064
u8 adapter_type; //+6065
u8 iface_type; //interface port type //+6056
u8 isprimary; //is primary adapter or not
u8 adapter_type;
u8 iface_type; //interface port type
//for global synchronization
_mutex *ph2c_fwcmd_mutex; //+6068
_mutex *psetch_mutex; //+6072
_mutex *psetbw_mutex; //+6076
_mutex *ph2c_fwcmd_mutex;
_mutex *psetch_mutex;
_mutex *psetbw_mutex;
struct co_data_priv *pcodatapriv;//data buffer shared among interfaces //+6080
struct co_data_priv *pcodatapriv;//data buffer shared among interfaces
#endif
#ifdef CONFIG_BR_EXT
@ -827,7 +827,7 @@ struct _ADAPTER{
PLOOPBACKDATA ploopback;
#endif
u8 fix_rate; //+6084
u8 fix_rate;
#ifdef CONFIG_CAC_TEST
unsigned char in_cta_test;
#endif
@ -837,7 +837,7 @@ struct _ADAPTER{
u8 debug_level;
#endif
}; // [6088] (!)
};
#define adapter_to_dvobj(adapter) (adapter->dvobj)
#define adapter_to_pwrctl(adapter) (&adapter->pwrctrlpriv)

View file

@ -234,7 +234,7 @@ struct hal_ops {
void (*disable_interrupt)(_adapter *padapter);
s32 (*interrupt_handler)(_adapter *padapter);
// void (*clear_interrupt)(_adapter *padapter); // None SDK3.5a
void (*clear_interrupt)(_adapter *padapter);
#ifdef CONFIG_WOWLAN
void (*disable_interrupt_but_cpwm2)(_adapter *padapter);

View file

@ -925,11 +925,11 @@ Result:
#define H2C_RSP_OFFSET 512
#define H2C_SUCCESS 0x00
#define H2C_SUCCESS 0x00
#define H2C_SUCCESS_RSP 0x01
#define H2C_DUPLICATED 0x02
#define H2C_DROPPED 0x03
#define H2C_PARAMETERS_ERROR 0x04
#define H2C_DROPPED 0x03
#define H2C_PARAMETERS_ERROR 0x04
#define H2C_REJECTED 0x05
#define H2C_CMD_OVERFLOW 0x06
#define H2C_RESERVED 0x07

View file

@ -68,7 +68,7 @@ u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid);
u16 rtw_get_cur_max_rate(_adapter *adapter);
//int rtw_set_scan_mode(_adapter *adapter, RT_SCAN_TYPE scan_mode);
int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan);
//int rtw_set_country(_adapter *adapter, const char *country_code);
int rtw_set_country(_adapter *adapter, const char *country_code);
//int rtw_set_band(_adapter *adapter, enum _BAND band);
#endif

View file

@ -481,13 +481,13 @@ typedef struct _RT_CHANNEL_INFO
extern int rtw_is_channel_set_contains_channel(RT_CHANNEL_INFO *channel_set, const u32 channel_num, int *pchannel_idx);
#ifdef CONFIG_CUSTOM_IE
#ifndef __CUS_IE_
#define __CUS_IE_
typedef struct __cus_ie
#ifndef _CUS_IE_
#define _CUS_IE_
typedef struct _cus_ie
{
u8 *ie;
u8 type;
} rtw_custom_ie_t, *p_rtw_custom_ie_t;
}rtw_custom_ie_t, *p_rtw_custom_ie_t;
#endif /* _CUS_IE_ */
#endif

View file

@ -491,7 +491,7 @@ typedef enum {
RTW_TX_PWR_PERCENTAGE_75 = 1, /* 75% */
RTW_TX_PWR_PERCENTAGE_50 = 2, /* 50% */
RTW_TX_PWR_PERCENTAGE_25 = 3, /* 25% */
RTW_TX_PWR_PERCENTAGE_12_5 = 4, /* 12.5% */
RTW_TX_PWR_PERCENTAGE_12_5 = 4 /* 12.5% */
}rtw_tx_pwr_percentage_t;
/**

View file

@ -7,13 +7,7 @@
#include "osdep_service.h"
#include "freertos/wrapper.h"
//#include "wlan_bssdef.h"
//#include "wifi_simple_config_parser.h"
//#include "rtw_rf.h"
#include "rtl_bios_data.h"
#include "drv_types.h"
#include "wlan/realtek/src/hal/hal_data.h"
//#include "phydm.h"
#define _atr_aligned2_ __attribute__((aligned(2)))
#define _atr_aligned4_ __attribute__((aligned(4)))
@ -60,16 +54,16 @@ typedef uint8_t BOOLEAN;
typedef uint8_t u1Byte;
typedef uint16_t u2Byte;
//typedef uint32_t u4Byte;
typedef uint32_t u4Byte;
typedef uint64_t u8Byte;
typedef uint64_t __attribute__((aligned(4))) _u8Byte;
//typedef sint8_t s1Byte;
typedef sint8_t s1Byte;
typedef sint16_t s2Byte;
//typedef sint32_t s4Byte;
//typedef sint8_t *ps1Byte;
typedef sint32_t s4Byte;
typedef sint8_t *ps1Byte;
typedef uint8_t *pu1Byte;
typedef uint16_t *pu2Byte;
//typedef uint32_t *pu4Byte;
typedef uint32_t *pu4Byte;
typedef uint32_t sizetype;
typedef struct _ADAPTER _adapter;
@ -81,7 +75,6 @@ typedef void *_mutex;
typedef int (*init_done_ptr)(void);
/* rtw_efuse.h
enum _EFUSE_DEF_TYPE // : sint32_t
{
TYPE_EFUSE_MAX_SECTION = 0x0,
@ -97,9 +90,7 @@ enum _IFACE_TYPE //: sint32_t
{
IFACE_PORT0 = 0x0, IFACE_PORT1 = 0x1, MAX_IFACE_PORT = 0x2,
};
*/
/* rtl8195a_pmu_task.h
enum _FW_ERR0_STATUS_ //: sint32_t
{
FES0_H2C_CMDID = 0x1,
@ -363,7 +354,7 @@ struct atomic_t {
_lock lock;
};
*/
/* osdep_intf.h
struct iw_request_info {
uint16_t cmd;
uint16_t flags;
@ -371,9 +362,7 @@ struct iw_request_info {
typedef int (*iw_handler)(struct net_device *, struct iw_request_info *,
union iwreq_data *, char *);
*/
/* wlan_bssdef.h
struct _NDIS_802_11_SSID {
uint32_t SsidLength;
uint8_t Ssid[36];
@ -466,7 +455,6 @@ struct wlan_network {
WLAN_BSSID_EX network;
WLAN_BCN_INFO BcnInfo;
};
*/
/* osdep_service.h
typedef void *_timerHandle;
@ -479,13 +467,12 @@ struct wlan_network {
};
typedef struct timer_list _timer;
*/
/* rtw_qos.h
*/
struct qos_priv {
uint32_t qos_option;
};
*/
/* wifi.h
struct __attribute__((packed)) _atr_aligned2_ rtw_ieee80211_ht_cap {
uint16_t cap_info;
uint8_t ampdu_params_info;
@ -494,9 +481,7 @@ struct __attribute__((packed)) _atr_aligned2_ rtw_ieee80211_ht_cap {
uint32_t tx_BF_cap_info;
uint8_t antenna_selection_info;
};
*/
/* rtw_ht.h
struct ht_priv {
uint32_t ht_option;
uint32_t ampdu_enable;
@ -508,8 +493,7 @@ struct ht_priv {
uint8_t stbc_cap;
struct rtw_ieee80211_ht_cap ht_cap;
};
*/
/* rtw_mlme.h
struct _atr_aligned4_ _RT_LINK_DETECT_T {
uint32_t NumTxOkInPeriod;
uint32_t NumRxOkInPeriod;
@ -522,6 +506,7 @@ struct _atr_aligned4_ _RT_LINK_DETECT_T {
BOOLEAN bHigherBusyTxTraffic;
};
typedef struct _RT_LINK_DETECT_T RT_LINK_DETECT_T;
enum _RT_SCAN_TYPE //: sint32_t
{
SCAN_PASSIVE = 0x0, SCAN_ACTIVE = 0x1, SCAN_MIX = 0x2
@ -584,8 +569,7 @@ struct mlme_priv {
uint8_t scanning_via_buddy_intf;
struct recv_frame *p_copy_recv_frame;
};
*/
/* rtw_mlme_ext.h
struct _atr_aligned4_ _RT_CHANNEL_INFO {
uint8_t ChannelNum;
RT_SCAN_TYPE ScanType; // uint8_t ScanType; // byte/dword?
@ -600,8 +584,7 @@ struct ss_res {
int scan_mode;
NDIS_802_11_SSID ssid[1];
};
*/
/* wifi.h
struct __attribute__((packed)) __attribute__((aligned(1))) ADDBA_request {
uint8_t dialog_token;
uint16_t BA_para_set;
@ -640,8 +623,7 @@ struct HT_info_element {
uint8_t infos[5];
uint8_t MCS_rate[16];
};
*/
/* rtw_mlme_ext.h
struct FW_Sta_Info {
struct sta_info *psta;
uint32_t status;
@ -690,17 +672,16 @@ struct mlme_ext_info {
struct HT_info_element HT_info;
struct FW_Sta_Info FW_sta_info[5];
};
*/
/*
#ifndef _CUS_IE_
#define _CUS_IE_
typedef struct _cus_ie{
__u8 *ie;
__u8 type;
} cus_ie, *p_cus_ie;
#endif */
#endif /* _CUS_IE_ */
// typedef struct _cus_ie *p_cus_ie;
/* rtw_mlme_ext.h
struct mlme_ext_priv { //__attribute__((packed))?
_adapter *padapter; //+0 padapter+1256 [912]
uint8_t mlmeext_init;
@ -744,9 +725,7 @@ struct mlme_ext_priv { //__attribute__((packed))?
uint8_t bChDeauthDisabled;
uint8_t bConcurrentFlushingSTA;
};
*/
/* rtw_cmd.h
struct cmd_priv {
_queue cmd_queue;
uint8_t cmdthd_running;
@ -759,27 +738,6 @@ struct evt_priv {
uint8_t *evt_allocated_buf;
uint32_t evt_done_cnt;
};
*/
/* drv_types.h
struct dvobj_priv
{
void *if1;
void *if2;
void *padapters[2];
uint8_t iface_nums;
uint8_t RtOutPipe[3];
uint8_t Queue2Pipe[8];
uint8_t irq_alloc;
uint8_t irq_enabled;
_lock irq_th_lock;
};
*/
/* trw_io.h
struct fifo_more_data {
uint32_t more_data;
uint32_t len;
};
struct _io_ops {
int (*init_io_priv)(struct dvobj_priv *);
@ -798,8 +756,7 @@ struct _io_ops {
struct io_priv {
struct _io_ops io_ops;
};
*/
/* rtw_xmit.h
struct rtw_tx_ring {
struct tx_buf_desc *desc;
dma_addr_t dma;
@ -845,8 +802,7 @@ struct _atr_aligned8_ xmit_priv {
uint32_t free_xmit_extbuf_cnt;
uint16_t nqos_ssn;
};
*/
/* trw_recv.h
struct rtw_rx_ring {
struct recv_buf_stat *desc;
dma_addr_t dma;
@ -909,8 +865,7 @@ struct _atr_aligned8_ recv_priv {
uint16_t promisc_bk_rxfltmap2;
uint8_t promisc_mgntframe_enabled;
};
*/
/* sta_info.h
struct _atr_aligned4_ sta_priv {
uint8_t *pallocated_stainfo_buf;
uint32_t allocated_stainfo_size;
@ -934,13 +889,14 @@ struct _atr_aligned4_ sta_priv {
uint16_t tim_bitmap;
uint16_t max_num_sta;
};
*/
/* trw_security.h
union Keytype {
uint8_t skey[16];
uint32_t lkey[4];
};
union pn48 {
u8Byte val;
struct {
@ -954,9 +910,7 @@ union pn48 {
uint8_t TSC7;
}_byte_;
};
*/
/* wlan_bssdef.h
struct _NDIS_802_11_WEP {
uint32_t Length;
uint32_t KeyIndex;
@ -964,9 +918,7 @@ struct _NDIS_802_11_WEP {
uint8_t KeyMaterial[16];
};
typedef struct _NDIS_802_11_WEP NDIS_802_11_WEP;
*/
/* rtw_psk.h
struct $D75518714447A990003EBC933C23F70E {
uint32_t HighPart;
uint32_t LowPart;
@ -1027,9 +979,7 @@ struct _wpa_global_info {
typedef struct _wpa_global_info WPA_GLOBAL_INFO;
typedef struct _wpa_sta_info WPA_STA_INFO;
*/
/* rtw_security.h
struct _atr_aligned4_ security_priv {
uint32_t dot11AuthAlgrthm;
uint32_t dot11PrivacyAlgrthm;
@ -1073,8 +1023,7 @@ struct _atr_aligned4_ security_priv {
uint8_t wpa_passphrase[65];
uint8_t wps_phase;
};
*/
/* derv_types.h
struct _atr_aligned4_ registry_priv {
uint8_t chip_version;
uint8_t hci;
@ -1118,8 +1067,7 @@ struct _atr_aligned4_ registry_priv {
uint8_t adaptivity_dc_backoff;
int8_t adaptivity_th_l2h_ini;
};
*/
/* trw_powerctrl.h
typedef void *_sema;
typedef _sema _pwrlock;
@ -1190,8 +1138,7 @@ struct _atr_aligned4_ pwrctrl_priv {
uint8_t tdma_rfon_period_len_3;
uint8_t lps_dtim;
};
*/
/* rtw_eeprom.h
struct _atr_aligned2_ eeprom_priv { // __attribute__((packed))!?
uint8_t bautoload_fail_flag;
uint8_t mac_addr[6];
@ -1201,8 +1148,7 @@ struct _atr_aligned2_ eeprom_priv { // __attribute__((packed))!?
uint8_t EEPROMRFGainOffset;
uint8_t EEPROMRFGainVal;
};
*/
/* rtw_rf.h
enum _CHANNEL_WIDTH // : sint32_t
{
CHANNEL_WIDTH_20 = 0x0,
@ -1213,9 +1159,7 @@ enum _CHANNEL_WIDTH // : sint32_t
CHANNEL_WIDTH_MAX = 0x5,
};
typedef enum _CHANNEL_WIDTH CHANNEL_WIDTH;
*/
/* hal_intf.h
enum _HAL_DEF_VARIABLE // : sint32_t
{
HAL_DEF_UNDERCORATEDSMOOTHEDPWDB = 0x0,
@ -1252,11 +1196,11 @@ enum _HAL_ODM_VARIABLE // : sint32_t
HAL_ODM_REGULATION = 0x4,
};
typedef enum _HAL_ODM_VARIABLE HAL_ODM_VARIABLE;
*/
/* freertos_service.h
typedef void *_thread_hdl_;
*/
/* osdep_service.h
/*
// osdep_service.h
struct task_struct
{
const char *task_name;
@ -1282,7 +1226,19 @@ typedef struct net_device *_nic_hdl;
uint32_t rx_overflow;
};
*/
/* rtw_recv.h
struct dvobj_priv {
void *if1;
void *if2;
void *padapters[2];
uint8_t iface_nums;
uint8_t RtOutPipe[3];
uint8_t Queue2Pipe[8];
uint8_t irq_alloc;
uint8_t irq_enabled;
_lock irq_th_lock;
};
struct phy_info {
uint8_t RxPWDBAll;
uint8_t SignalQuality;
@ -1358,7 +1314,7 @@ union {
uint32_t mem[32];
};
};
/*
union $AB04817EA6EB89125E28056B7464A4D7 {
_list list;
struct recv_frame_hdr hdr;
@ -1369,7 +1325,8 @@ union recv_frame {
union $AB04817EA6EB89125E28056B7464A4D7 u;
};
*/
/* skbuff.h
/*
// skbuff.h
struct sk_buff
{
struct sk_buff *next;
@ -1390,7 +1347,7 @@ union recv_frame {
uint32_t qlen;
};
*/
/* rtw_xmit.h
struct tx_servq {
_list tx_pending;
_queue sta_pending;
@ -1409,12 +1366,6 @@ struct sta_xmit_priv {
_list apsd;
uint16_t txseq_tid[16];
};
*/
/* rtw_recv.h
struct recv_buf_stat {
uint32_t rxdw0;
uint32_t rxdw1;
};
struct stainfo_rxcache {
uint16_t tid_rxseq[16];
@ -1426,9 +1377,8 @@ struct sta_recv_priv {
_queue defrag_q;
struct stainfo_rxcache rxcache;
};
*/
/* sta_info.h
struct stainfo_stats {
struct stainfo_stats {
u8Byte rx_mgnt_pkts;
u8Byte rx_ctrl_pkts;
u8Byte rx_data_pkts;
@ -1525,15 +1475,20 @@ struct sta_info {
uint8_t RXEVM[4];
uint8_t RXSNR[4];
};
*/
/* wifi_conf.h
/*
// wifi_conf.h
struct _atr_aligned4_ _cus_ie
{
uint8_t *ie;
uint8_t type;
};
*/
/* rtw_xmit.h
struct fifo_more_data {
uint32_t more_data;
uint32_t len;
};
struct hw_xmit {
_queue *sta_queue;
int accnt;
@ -1549,8 +1504,12 @@ struct tx_buf_desc {
uint32_t txdw6;
uint32_t txdw7;
};
*/
/* rtw_psk.h
struct recv_buf_stat {
uint32_t rxdw0;
uint32_t rxdw1;
};
struct _wpa_sta_info {
int state;
int gstate;
@ -1577,8 +1536,7 @@ struct _wpa_sta_info {
int clientGkeyUpdate;
LARGE_INTEGER clientMICReportReplayCounter;
};
*/
/* rtw_xmit.h
struct pkt_attrib {
uint8_t type;
uint8_t subtype;
@ -1669,7 +1627,6 @@ struct submit_ctx {
uint32_t timeout_ms;
int status;
};
*/
/*
// wrapper.h
struct net_device
@ -1755,15 +1712,12 @@ struct submit_ctx {
union iwreq_data u;
};
*/
/* drv_types.h
struct co_data_priv {
uint8_t co_ch;
uint8_t co_bw;
uint8_t co_ch_offset;
uint8_t rsvd;
};
*/
/* hal_intf.h
enum _HARDWARE_TYPE // : sint32_t
{
@ -1805,8 +1759,7 @@ enum _HARDWARE_TYPE // : sint32_t
HARDWARE_TYPE_RTL8188FS = 0x23,
HARDWARE_TYPE_MAX = 0x24,
};
*/
/* hal_phy.h
struct RF_Shadow_Compare_Map {
uint32_t Value;
uint8_t Compare;
@ -1815,8 +1768,7 @@ struct RF_Shadow_Compare_Map {
uint8_t Driver_Write;
};
typedef struct RF_Shadow_Compare_Map RF_SHADOW_T;
*/
/* rtw_powerctrl.h
enum _PS_BBRegBackup_ // : sint32_t
{
PSBBREG_RF0 = 0x0,
@ -1825,8 +1777,9 @@ enum _PS_BBRegBackup_ // : sint32_t
PSBBREG_AFE0 = 0x3,
PSBBREG_TOTALCNT = 0x4,
};
*/
/* hal_irqn.h
/*
// hal_irqn.h
enum _IRQn_Type_ // : sint32_t
{
NonMaskableInt_IRQn = 0xFFFFFFF2,
@ -1899,8 +1852,9 @@ enum _PS_BBRegBackup_ // : sint32_t
uint32_t Priority;
};
typedef struct _IRQ_HANDLE_ IRQ_HANDLE;
*/
/* hal_soc_ps_monitor.h
*/
/*
// hal_soc_ps_monitor.h
struct _power_state_
{
uint8_t FuncIdx;
@ -1922,9 +1876,9 @@ enum _PS_BBRegBackup_ // : sint32_t
BOOL SleepFlag;
};
typedef struct _power_mgn_ Power_Mgn;
*/
/* hal_gpio.h
/*
// hal_gpio.h
enum $E1AD70AB12E7AA6E98B8D89D9B965EB5 //: sint32_t
{
_PORT_A = 0x0,
@ -1959,7 +1913,7 @@ enum _PS_BBRegBackup_ // : sint32_t
};
typedef struct _HAL_GPIO_ADAPTER_ *PHAL_GPIO_ADAPTER;
*/
/* hal_intf.h
struct hal_ops {
uint32_t (*hal_power_on)(_adapter *);
uint32_t (*hal_init)(_adapter *);
@ -2022,8 +1976,66 @@ struct hal_ops {
uint8_t);
uint8_t (*hal_get_tx_buff_rsvd_page_num)(_adapter *, bool);
};
*/
/* HalVerDef.h
struct _atr_aligned4_ _ADAPTER {
uint16_t HardwareType;
uint16_t interface_type; //+2
uint32_t work_mode;
struct dvobj_priv *dvobj; //+8
struct mlme_priv mlmepriv; //+12 [1244]
struct mlme_ext_priv mlmeextpriv; //+1256 [912]
struct cmd_priv cmdpriv; //+2168
struct evt_priv evtpriv; //+
struct io_priv iopriv;
struct xmit_priv xmitpriv; //+2248
struct recv_priv recvpriv; //+2752
struct sta_priv stapriv; //+3024 [164]
struct security_priv securitypriv;
struct registry_priv registrypriv;
struct pwrctrl_priv pwrctrlpriv; // pwrctrlpriv.bInternalAutoSuspend //+5061
struct eeprom_priv eeprompriv;
PVOID HalData;
uint32_t hal_data_sz;
struct hal_ops HalFunc;
int32_t bDriverStopped; //+5880
int32_t bSurpriseRemoved; //+5884
int32_t bCardDisableWOHSM; //+5888
uint8_t RxStop; //+5892
uint32_t IsrContent;
uint32_t ImrContent;
uint8_t EepromAddressSize;
uint8_t hw_init_completed; //+5905
uint8_t bDriverIsGoingToUnload;
uint8_t init_adpt_in_progress;
uint8_t bMpDriver;
uint8_t bForwardingDisabled;
struct task_struct isrThread; //+5888
struct task_struct cmdThread; //+5920
struct task_struct recvtasklet_thread; //+5952
struct task_struct xmittasklet_thread; //+5984
void (*intf_start)(_adapter *); //+6008
void (*intf_stop)(_adapter *); //+6012
_nic_hdl pnetdev; //+6016
int bup; //+6020
struct net_device_stats stats;
uint8_t net_closed; //+6052
uint8_t bFWReady;
uint8_t bLinkInfoDump;
uint8_t bRxRSSIDisplay;
_adapter *pbuddy_adapter; //+6056
_mutex *hw_init_mutex; //+6060
uint8_t isprimary; //+6064
uint8_t adapter_type; //+6065
uint8_t iface_type; //+6056
_mutex *ph2c_fwcmd_mutex; //+6068
_mutex *psetch_mutex; //+6072
_mutex *psetbw_mutex; //+6076
struct co_data_priv *pcodatapriv; //+6080
uint8_t fix_rate; //+6084
}; // [6088] (!)
typedef struct _ADAPTER *PADAPTER;
// if sizeof(struct _ADAPTER) != 6088 #error "Check aligned struct!" !
enum tag_HAL_IC_Type_Definition // : sint32_t
{
CHIP_8192S = 0x0,
@ -2092,8 +2104,7 @@ struct _atr_aligned4_ tag_HAL_VERSION {
uint8_t ROMVer;
};
typedef struct tag_HAL_VERSION HAL_VERSION;
*/
/* hal_intf.h
enum _HW_VARIABLES //: sint32_t
{
HW_VAR_MEDIA_STATUS = 0x0,
@ -2178,15 +2189,13 @@ enum _HW_VARIABLES //: sint32_t
HW_VAR_ASIX_IOT = 0x4F,
HW_VAR_PROMISC = 0x50,
};
*/
/* hal_phy.h
enum _BAND_TYPE // : sint32_t
{
BAND_ON_2_4G = 0x0, BAND_ON_5G = 0x1, BAND_ON_BOTH = 0x2, BANDMAX = 0x3,
};
typedef enum _BAND_TYPE BAND_TYPE;
*/
/* hal_com_phycfg.h
struct _BB_REGISTER_DEFINITION {
uint32_t rfintfs;
uint32_t rfintfo;
@ -2197,8 +2206,7 @@ struct _BB_REGISTER_DEFINITION {
uint32_t rfLSSIReadBackPi;
};
typedef struct _BB_REGISTER_DEFINITION BB_REGISTER_DEFINITION_T;
*/
/* rtw_mlme.h
enum dot11AuthAlgrthmNum //: sint32_t
{
dot11AuthAlgrthm_Open = 0x0,
@ -2208,8 +2216,7 @@ enum dot11AuthAlgrthmNum //: sint32_t
dot11AuthAlgrthm_WAPI = 0x4,
dot11AuthAlgrthm_MaxNum = 0x5,
};
*/
/* rtw_mlme_ext.h
enum _RT_CHANNEL_DOMAIN //: sint32_t
{
RT_CHANNEL_DOMAIN_FCC = 0x0,
@ -2276,8 +2283,7 @@ enum _RT_CHANNEL_DOMAIN //: sint32_t
RT_CHANNEL_DOMAIN_MAX = 0x59,
RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
};
*/
/* freertos_intfs.h
struct _driver_priv {
int drv_registered;
_mutex hw_init_mutex;
@ -2286,9 +2292,7 @@ struct _driver_priv {
_mutex setbw_mutex;
};
typedef struct _driver_priv drv_priv;
*/
/* PhyDM_Adaptivity.h
struct _ADAPTIVITY_STATISTICS {
s1Byte TH_L2H_ini_mode2;
s1Byte TH_EDCCA_HL_diff_mode2;
@ -2305,14 +2309,12 @@ struct _ADAPTIVITY_STATISTICS {
u1Byte AdajustIGILevel;
};
typedef struct _ADAPTIVITY_STATISTICS ADAPTIVITY_STATISTICS;
*/
/* phydm_NoiseMonitor.h
struct _ODM_NOISE_MONITOR_ {
s1Byte noise[1];
s2Byte noise_all;
};
typedef struct _ODM_NOISE_MONITOR_ ODM_NOISE_MONITOR;
*/
/* in rtl_bios_data.h
struct _FALSE_ALARM_STATISTICS {
u4Byte Cnt_Parity_Fail;
@ -2333,13 +2335,13 @@ struct _FALSE_ALARM_STATISTICS {
};
typedef struct _FALSE_ALARM_STATISTICS FALSE_ALARM_STATISTICS;
*/
/* phydm.h
enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE //: sint32_t
{
PHY_REG_PG_RELATIVE_VALUE = 0x0, PHY_REG_PG_EXACT_VALUE = 0x1,
};
typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE PHY_REG_PG_TYPE;
*/
/* in rtl_bios_data.h
struct _atr_aligned4_ _CFO_TRACKING_ {
BOOLEAN bATCStatus;
@ -2368,13 +2370,11 @@ struct _atr_aligned8_ _ROM_INFO {
};
typedef struct _ROM_INFO ROM_INFO;
*/
/* ROM_RTL8195A_PHYDM.h
typedef struct _ROM_INFO *PROM_INFO;
*/
/* phydm_types.h
typedef struct sta_info *PSTA_INFO_T;
*/
/* phydm.h
struct _ODM_Phy_Dbg_Info_ {
s1Byte RxSNRdB[4];
u4Byte NumQryPhyStatus;
@ -2717,73 +2717,7 @@ struct _atr_aligned8_ ODM_RF_Calibration_Structure {
u4Byte DpkThermal[4];
};
typedef struct ODM_RF_Calibration_Structure ODM_RF_CAL_T;
*/
/* drv_types.h
#include "ieee80211.h"
#include "rtw_cmd.h"
struct _atr_aligned4_ _ADAPTER {
uint16_t HardwareType;
uint16_t interface_type; //+2
uint32_t work_mode;
struct dvobj_priv *dvobj; //+8
struct mlme_priv mlmepriv; //+12 [1244]
struct mlme_ext_priv mlmeextpriv; //+1256 [912]
struct cmd_priv cmdpriv; //+2168
struct evt_priv evtpriv; //+
struct io_priv iopriv;
struct xmit_priv xmitpriv; //+2248
struct recv_priv recvpriv; //+2752
struct sta_priv stapriv; //+3024 [164]
struct security_priv securitypriv;
struct registry_priv registrypriv;
struct pwrctrl_priv pwrctrlpriv; // pwrctrlpriv.bInternalAutoSuspend //+5061
struct eeprom_priv eeprompriv;
PVOID HalData;
uint32_t hal_data_sz;
struct hal_ops HalFunc;
int32_t bDriverStopped; //+5880
int32_t bSurpriseRemoved; //+5884
int32_t bCardDisableWOHSM; //+5888
uint8_t RxStop; //+5892
uint32_t IsrContent;
uint32_t ImrContent;
uint8_t EepromAddressSize;
uint8_t hw_init_completed; //+5905
uint8_t bDriverIsGoingToUnload;
uint8_t init_adpt_in_progress;
uint8_t bMpDriver;
uint8_t bForwardingDisabled;
struct task_struct isrThread; //+5888
struct task_struct cmdThread; //+5920
struct task_struct recvtasklet_thread; //+5952
struct task_struct xmittasklet_thread; //+5984
void (*intf_start)(_adapter *); //+6008
void (*intf_stop)(_adapter *); //+6012
_nic_hdl pnetdev; //+6016
int bup; //+6020
struct net_device_stats stats;
uint8_t net_closed; //+6052
uint8_t bFWReady;
uint8_t bLinkInfoDump;
uint8_t bRxRSSIDisplay;
_adapter *pbuddy_adapter; //+6056
_mutex *hw_init_mutex; //+6060
uint8_t isprimary; //+6064
uint8_t adapter_type; //+6065
uint8_t iface_type; //+6056
_mutex *ph2c_fwcmd_mutex; //+6068
_mutex *psetch_mutex; //+6072
_mutex *psetbw_mutex; //+6076
struct co_data_priv *pcodatapriv; //+6080
uint8_t fix_rate; //+6084
}; // [6088] (!)
typedef struct _ADAPTER *PADAPTER;
// if sizeof(struct _ADAPTER) != 6088 #error "Check aligned struct!" !
*/
/* phydm.h
struct _atr_aligned8_ DM_Out_Source_Dynamic_Mechanism_Structure {
PADAPTER Adapter;
BOOLEAN odm_ready;
@ -2953,8 +2887,7 @@ struct _atr_aligned8_ DM_Out_Source_Dynamic_Mechanism_Structure {
};
typedef struct DM_Out_Source_Dynamic_Mechanism_Structure DM_ODM_T;
typedef struct DM_Out_Source_Dynamic_Mechanism_Structure *PDM_ODM_T;
*/
/* halphy
enum _PWRTRACK_CONTROL_METHOD //: sint32_t
{
BBSWING = 0x0, TXAGC = 0x1, MIX_MODE = 0x2,
@ -3006,9 +2939,7 @@ struct _H2CParam_RsvdPage_ {
};
typedef struct _H2CParam_RsvdPage_ H2CParam_RsvdPage;
typedef struct _H2CParam_RsvdPage_ *PH2CParam_RsvdPage;
*/
/* wlan_bssdef.h
struct _NDIS_802_11_VARIABLE_IEs {
uint8_t ElementID;
uint8_t Length;
@ -3046,7 +2977,6 @@ enum _NDIS_802_11_WEP_STATUS //: sint32_t
Ndis802_11_EncrypteionWAPI = 0x8,
};
typedef enum _NDIS_802_11_WEP_STATUS NDIS_802_11_WEP_STATUS;
*/
struct __attribute__((packed)) __attribute__((aligned(1))) rtk_sc {
u8 pattern_type;
@ -3093,7 +3023,7 @@ struct pattern_ops {
sc_decode_profile_call_back decode_profile;
sc_get_tlv_info_call_back get_tlv_info;
};
/* halpower
struct _atr_aligned2_ _WL_PWR_CFG_ { // __attribute__((packed))!?
uint16_t offset;
uint8_t cut_msk;
@ -3105,21 +3035,17 @@ struct _atr_aligned2_ _WL_PWR_CFG_ { // __attribute__((packed))!?
uint8_t value;
};
typedef struct _WL_PWR_CFG_ WLAN_PWR_CFG;
*/
/* rtw_mlme.h
struct cmd_hdl {
uint32_t parmsize;
uint8_t (*h2cfuns)(struct _ADAPTER *, uint8_t *);
};
*/
/* rtw_cmd.h
struct _cmd_callback {
uint32_t cmd_code;
void (*callback)(_adapter *, struct cmd_obj *);
};
*/
/* phydm.h
enum _ODM_Common_Info_Definition //: sint32_t
{
ODM_CMNINFO_PLATFORM = 0x0,
@ -3225,15 +3151,13 @@ enum _ODM_Support_Ability_Definition // : sint32_t
ODM_RF_RX_GAIN_TRACK = 0x2000000,
ODM_RF_CALIBRATION = 0x4000000,
};
*/
/* hal_phy.h
enum _RF_PATH //: sint32_t
{
RF_PATH_A = 0x0, RF_PATH_B = 0x1, RF_PATH_C = 0x2, RF_PATH_D = 0x3,
};
typedef enum _RF_PATH RF_PATH;
*/
/* rtw_cmd.h
enum _EXTCHNL_OFFSET //: sint32_t
{
EXTCHNL_OFFSET_NO_EXT = 0x0,
@ -3332,8 +3256,7 @@ enum MGN_RATE //: sint32_t
MGN_VHT4SS_MCS9 = 0xC7,
MGN_UNKNOWN = 0xC8,
};
*/
/* rtw_mlme.h rtw_mlme_ext.h
struct _RT_CHANNEL_PLAN_2G {
uint8_t Channel[14];
uint8_t Len;
@ -3353,14 +3276,12 @@ struct mlme_handler {
uint32_t num;
uint32_t (*func)(_adapter *, struct recv_frame *);
};
*/
/* rtw_event.h
struct fwevent {
uint32_t parmsize;
void (*event_callback)(_adapter *, uint8_t *);
};
*/
/* rtw_recv.h
struct recv_buf {
_list list;
PADAPTER adapter;
@ -3381,8 +3302,7 @@ struct recv_reorder_ctrl {
_queue pending_recvframe_queue;
_timer reordering_ctrl_timer;
};
*/
/* phydm.h
enum _ODM_RF_RADIO_PATH // : sint32_t
{
ODM_RF_PATH_A = 0x0,
@ -3483,8 +3403,7 @@ enum _ODM_FW_Config_Type //: sint32_t
CONFIG_FW_BT = 0x7,
};
typedef enum _ODM_FW_Config_Type ODM_FW_Config_Type;
*/
/* hal_com_phycfg.h
enum _RATE_SECTION //: sint32_t
{
CCK = 0x0,
@ -3499,8 +3418,12 @@ enum _RATE_SECTION //: sint32_t
VHT_4SSMCS0_4SSMCS9 = 0x9,
};
typedef enum _RATE_SECTION RATE_SECTION;
*/
/* hal_pg.h
struct map_mask_s {
uint16_t mask_start;
uint16_t mask_end;
};
struct _TxPowerInfo24G {
uint8_t IndexCCK_Base[1][6];
uint8_t IndexBW40_Base[1][6];
@ -3509,69 +3432,6 @@ struct _TxPowerInfo24G {
};
typedef struct _TxPowerInfo24G TxPowerInfo24G;
typedef struct _TxPowerInfo24G *PTxPowerInfo24G;
*/
/* wifi_constants.h
enum rtw_bss_type_t // __int32
{
RTW_BSS_TYPE_INFRASTRUCTURE = 0x0,
RTW_BSS_TYPE_ADHOC = 0x1,
RTW_BSS_TYPE_ANY = 0x2,
RTW_BSS_TYPE_UNKNOWN = 0xFFFFFFFF,
};
enum rtw_security_t // __int32
{
RTW_SECURITY_OPEN = 0x0,
RTW_SECURITY_WEP_PSK = 0x1,
RTW_SECURITY_WEP_SHARED = 0x8001,
RTW_SECURITY_WPA_TKIP_PSK = 0x200002,
RTW_SECURITY_WPA_AES_PSK = 0x200004,
RTW_SECURITY_WPA2_AES_PSK = 0x400004,
RTW_SECURITY_WPA2_TKIP_PSK = 0x400002,
RTW_SECURITY_WPA2_MIXED_PSK = 0x400006,
RTW_SECURITY_WPA_WPA2_MIXED = 0x600000,
RTW_SECURITY_WPS_OPEN = 0x10000000,
RTW_SECURITY_WPS_SECURE = 0x10000004,
RTW_SECURITY_UNKNOWN = 0xFFFFFFFF,
RTW_SECURITY_FORCE_32_BIT = 0x7FFFFFFF,
};
enum rtw_802_11_band_t // __int32
{
RTW_802_11_BAND_5GHZ = 0x0,
RTW_802_11_BAND_2_4GHZ = 0x1,
};
*/
/* wifi_structures.h
struct rtw_ssid
{
unsigned int8_t len;
unsigned int8_t val[33];
};
typedef rtw_ssid rtw_ssid_t;
struct rtw_mac
{
unsigned int8_t octet[6];
};
typedef rtw_mac rtw_mac_t;
struct rtw_scan_result
{
rtw_ssid_t SSID;
rtw_mac_t BSSID;
sint16_t signal_strength;
enum rtw_bss_type_t bss_type;
enum rtw_security_t security;
enum rtw_wps_type_t wps_type;
unsigned int channel;
enum rtw_802_11_band_t band;
};
*/
#endif // _WLAN_LIB_H

View file

@ -31,7 +31,7 @@ extern "C" {
#endif
#if defined(__IAR_SYSTEMS_ICC__)
//#pragma pack(1)
#pragma pack(1)
#endif
/**
@ -86,7 +86,7 @@ typedef struct rtw_network_info {
int key_id;
}rtw_network_info_t;
#if defined(__IAR_SYSTEMS_ICC__)// || defined(__GNUC__)
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack(1)
#endif
@ -96,14 +96,14 @@ typedef struct rtw_network_info {
typedef struct rtw_scan_result {
rtw_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */
rtw_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
rtw_bss_type_t bss_type; /**< Network type */
rtw_security_t security; /**< Security type */
rtw_wps_type_t wps_type; /**< WPS type */
unsigned int channel; /**< Radio channel that the AP beacon was received on */
unsigned int channel; /**< Radio channel that the AP beacon was received on */
rtw_802_11_band_t band; /**< Radio band */
} rtw_scan_result_t;
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__)
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack()
#endif
@ -117,7 +117,7 @@ typedef struct rtw_scan_handler_result {
} rtw_scan_handler_result_t;
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__)
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack(1)
#endif
@ -125,14 +125,14 @@ typedef struct rtw_scan_handler_result {
* @brief The structure is used to store the WIFI setting gotten from WIFI driver.
*/
typedef struct rtw_wifi_setting {
rtw_mode_t mode;
rtw_mode_t mode;
unsigned char ssid[33];
unsigned char channel;
rtw_security_t security_type;
unsigned char password[65];
unsigned char key_idx;
}rtw_wifi_setting_t;
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__)
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack()
#endif
@ -167,7 +167,7 @@ typedef struct {
unsigned int version; /**< version field */
unsigned int length; /**< byte length of data in this record, */
/* starting at version and including IEs */
rtw_mac_t BSSID;
rtw_mac_t BSSID;
unsigned short beacon_period; /**< units are Kusec */
unsigned short capability; /**< Capability information */
unsigned char SSID_len;

View file

@ -1277,7 +1277,7 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
//-----------HOOK BEFORE REG INIT-----------//
// ODM Platform info AP/ADSL/CE/MP = 1/2/3/4
u1Byte SupportPlatform;
// ODM Support Ability DIG/RATR/TX_PWR_TRACK/ <EFBFBD>K<EFBFBD>K = 1/2/3/<2F>K
// ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ¡K¡K = 1/2/3/¡K
u4Byte SupportAbility;
// ODM PCIE/USB/SDIO = 1/2/3
u1Byte SupportInterface;
@ -1491,7 +1491,7 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
PROM_INFO pROMInfo;
FALSE_ALARM_STATISTICS FalseAlmCnt;
CFO_TRACKING DM_CfoTrack;
CFO_TRACKING DM_CfoTrack;
FALSE_ALARM_STATISTICS FlaseAlmCntBuddyAdapter;
//#ifdef CONFIG_ANTENNA_DIVERSITY

View file

@ -375,10 +375,10 @@ typedef enum _RT_SPINLOCK_TYPE{
typedef unsigned short u2Byte,*pu2Byte;
typedef unsigned int u4Byte,*pu4Byte;
typedef unsigned long long u8Byte,*pu8Byte;
typedef signed char s1Byte,*ps1Byte; /* GCC ROM char = unsigned char */
typedef signed char s1Byte,*ps1Byte; /* GCC ROM char = unsigned char */
typedef signed short s2Byte,*ps2Byte;
typedef signed long s4Byte,*ps4Byte;
typedef long long s8Byte,*ps8Byte;
typedef signed long s4Byte,*ps4Byte;
typedef long long s8Byte,*ps8Byte;
typedef struct sta_info STA_INFO_T,*PSTA_INFO_T;

View file

@ -20,7 +20,6 @@
#ifndef __ROM_RTL8195A_PHYDM_H__
#define __ROM_RTL8195A_PHYDM_H__
#ifndef _RTL_BIOS_DATA_H_
typedef struct _FALSE_ALARM_STATISTICS{
u4Byte Cnt_Parity_Fail;
u4Byte Cnt_Rate_Illegal;
@ -57,19 +56,16 @@ typedef struct _CFO_TRACKING_
u1Byte CFO_TH_ATC;
}CFO_TRACKING, *PCFO_TRACKING;
extern FALSE_ALARM_STATISTICS FalseAlmCnt;
extern CFO_TRACKING DM_CfoTrack;
typedef struct _ROM_INFO{
u1Byte EEPROMVersion;
u1Byte CrystalCap;
u8Byte DebugComponents;
u4Byte DebugLevel;
} ROM_INFO, *PROM_INFO;
}ROM_INFO, *PROM_INFO;
extern FALSE_ALARM_STATISTICS FalseAlmCnt;
extern CFO_TRACKING DM_CfoTrack;
extern ROM_INFO ROMInfo;
#endif
u1Byte
ROM_odm_QueryRxPwrPercentage(

View file

@ -414,7 +414,7 @@ struct net_device_stats {
struct net_device {
char name[16];
void *priv; /* pointer to private data */
unsigned char dev_addr[6]; /* set during bootup */
unsigned char dev_addr[6]; /* set during bootup */
int (*init)(void);
int (*open)(struct net_device *dev);
int (*stop)(struct net_device *dev);
@ -444,13 +444,11 @@ int dev_alloc_name(struct net_device *net_dev, const char *ifname);
//----- ------------------------------------------------------------------
void init_timer(struct timer_list *timer);
void mod_timer(struct timer_list *timer, u32 delay_time_ms);
void cancel_timer_ex(struct timer_list * timer);
void cancel_timer_ex(struct timer_list * timer);
void del_timer_sync(struct timer_list * timer);
void init_timer_wrapper(void);
void deinit_timer_wrapper(void);
typedef void (*TIMER_FUN)(void *context);
void rtw_init_timer(_timer *ptimer, void *adapter, TIMER_FUN pfunc,void* cntx, const char *name);
void rtw_set_timer(_timer *ptimer,u32 delay_time);
u8 rtw_cancel_timer(_timer *ptimer);

View file

@ -165,7 +165,7 @@ int read_uart_atcmd_setting_from_system_data(UART_LOG_CONF* uartconf)
if(load_default == _TRUE){
// load default setting
uartconf->BaudRate = UART_BAUD_RATE_38400;
uartconf->BaudRate = DEFAULT_BAUDRATE;
uartconf->DataBits = 8;
uartconf->Parity = ParityNone;
uartconf->StopBits = 1;

View file

@ -107,7 +107,14 @@ int wlan_init_done_callback()
// rtw_network_info_t *wifi;
// SC_connect_to_candidate_AP
// SC_parse_scan_result_and_connect();
if (wifi_connect(data->psk_essid, data->security_type, data->psk_passphrase, strlen(data->psk_essid), strlen(data->psk_passphrase), RTW_SECURITY_OPEN, NULL) == RTW_SUCCESS) {
if (wifi_connect(
NULL,
0,
data->psk_essid,
data->security_type,
data->psk_passphrase,
RTW_SECURITY_OPEN,
NULL) == RTW_SUCCESS) {
#else
//set partial scan for entering to listen beacon quickly
channel = data->channel & 0xFF;
@ -124,7 +131,14 @@ int wlan_init_done_callback()
u8 bssid[ETH_ALEN] = { 0xbc,0xae,0xc5,0xeb,0x09,0x90 };
// if (wifi_connect(data->psk_essid, data->security_type, data->psk_passphrase, strlen(data->psk_essid), strlen(data->psk_passphrase), RTW_SECURITY_OPEN, NULL) == RTW_SUCCESS) {
if (wifi_connect_bssid(bssid, data->psk_essid, data->security_type, data->psk_passphrase, ETH_ALEN, strlen(data->psk_essid), strlen(data->psk_passphrase), data->channel>>28, NULL) == RTW_SUCCESS) {
if (wifi_connect(
bssid,
1,
data->psk_essid,
data->security_type,
data->psk_passphrase,
data->channel>>28,
NULL) == RTW_SUCCESS) {
#endif
// DBG_8195A("WiFi connected at start %dms\n", xTaskGetTickCount());
#if CONFIG_LWIP_LAYER

View file

@ -24,7 +24,7 @@
extern "C" {
#endif
typedef struct analogin_s analogin_t;
typedef struct analogin_s analogin_t; // 444 bytes!
void analogin_init (analogin_t *obj, PinName pin);
float analogin_read (analogin_t *obj);

View file

@ -26,19 +26,19 @@ extern "C" {
typedef struct pwmout_s pwmout_t;
void pwmout_init (pwmout_t* obj, PinName pin);
int pwmout_init (pwmout_t* obj, PinName pin); // != 0 - error
void pwmout_free (pwmout_t* obj);
void pwmout_write (pwmout_t* obj, float percent);
float pwmout_read (pwmout_t* obj);
//void pwmout_write (pwmout_t* obj, float percent);
//float pwmout_read (pwmout_t* obj);
void pwmout_period (pwmout_t* obj, float seconds);
void pwmout_period_ms (pwmout_t* obj, int ms);
void pwmout_period_us (pwmout_t* obj, int us);
//void pwmout_period (pwmout_t* obj, float seconds);
//void pwmout_period_ms (pwmout_t* obj, int ms);
void pwmout_period_us (pwmout_t* obj, uint32_t us);
void pwmout_pulsewidth (pwmout_t* obj, float seconds);
void pwmout_pulsewidth_ms(pwmout_t* obj, int ms);
void pwmout_pulsewidth_us(pwmout_t* obj, int us);
//void pwmout_pulsewidth (pwmout_t* obj, float seconds);
//void pwmout_pulsewidth_ms(pwmout_t* obj, uint32_t ms);
void pwmout_pulsewidth_us(pwmout_t* obj, uint32_t us);
#ifdef __cplusplus
}

View file

@ -119,6 +119,14 @@ void analogin_init (analogin_t *obj, PinName pin){
float analogin_read(analogin_t *obj){
float value;
union {
unsigned int ui[2];
unsigned short us[4];
} adata;
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
RtkADCReceiveBuf(p, &adata.ui);
return (float)(adata.us[p->DevNum]) / (float)(0xCE80);
/*
uint32_t AnaloginTmp[2] = {0,0};
uint32_t AnaloginDatMsk = 0xFFFF;
uint8_t AnaloginIdx = 0;
@ -144,9 +152,18 @@ float analogin_read(analogin_t *obj){
value = (float)(AnalogDat) / (float)(AnalogDatFull);
return (float)value;
*/
}
uint16_t analogin_read_u16(analogin_t *obj){
union {
unsigned int ui[2];
unsigned short us[4];
} adata;
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
RtkADCRxManualRotate(p, &adata.ui);
return adata.us[p->DevNum];
/*
uint32_t AnaloginTmp[2] = {0,0};
uint32_t AnaloginDatMsk = 0xFFFF;
uint8_t AnaloginIdx = 0;
@ -166,20 +183,23 @@ uint16_t analogin_read_u16(analogin_t *obj){
AnalogDat = AnaloginTmp[(AnaloginIdx/2)];
AnalogDat = (AnalogDat & AnaloginDatMsk);
AnalogDat = (AnalogDat>>((u32)(16*(AnaloginIdx&0x01))));
return (uint16_t)AnalogDat;
*/
}
void analogin_deinit(analogin_t *obj){
PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL;
/*
PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL;
PSAL_ADC_HND pSalADCHND = NULL;
pSalADCMngtAdpt = &(obj->SalADCMngtAdpt);
pSalADCHND = &(pSalADCMngtAdpt->pSalHndPriv->SalADCHndPriv);
p = &(pSalADCMngtAdpt->pSalHndPriv->SalADCHndPriv); */
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
/* To deinit analogin */
RtkADCDeInit(pSalADCHND);
RtkADCDeInit(p);
}
#endif

View file

@ -119,7 +119,7 @@ void log_uart_free(log_uart_t *obj)
ACTCK_LOG_UART_CCTRL(ON);
//4 Inital Log uart
UartAdapter.BaudRate = UART_BAUD_RATE_38400;
UartAdapter.BaudRate = DEFAULT_BAUDRATE;
UartAdapter.DataLength = UART_DATA_LEN_8BIT;
UartAdapter.FIFOControl = 0xC1;
UartAdapter.IntEnReg = 0x00;

View file

@ -3,9 +3,8 @@
* Copyright (c) 2014, Realtek Semiconductor Corp.
* All rights reserved.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*******************************************************************************
* bug fixing: pvvx
*/
#include "device.h"
@ -18,8 +17,10 @@
#ifdef CONFIG_PWM_EN
#include "pwmout_api.h"
#include "objects.h"
extern u32 gTimerRecord;
static const PinMap PinMap_PWM[] = {
const PinMap PinMap_PWM[] = {
{PB_4, RTL_PIN_PERI(PWM0, 0, S0), RTL_PIN_FUNC(PWM0, S0)},
{PB_5, RTL_PIN_PERI(PWM1, 1, S0), RTL_PIN_FUNC(PWM1, S0)},
{PB_6, RTL_PIN_PERI(PWM2, 2, S0), RTL_PIN_FUNC(PWM2, S0)},
@ -43,7 +44,7 @@ static const PinMap PinMap_PWM[] = {
{NC, NC, 0}
};
void pwmout_init(pwmout_t* obj, PinName pin)
int pwmout_init(pwmout_t* obj, PinName pin)
{
uint32_t peripheral;
u32 pwm_idx;
@ -56,7 +57,7 @@ void pwmout_init(pwmout_t* obj, PinName pin)
if (unlikely(peripheral == NC)) {
DBG_PWM_ERR("%s: Cannot find matched pwm for this pin(0x%x)\n", __FUNCTION__, pin);
return;
return -1;
}
pwm_idx = RTL_GET_PERI_IDX(peripheral);
@ -66,75 +67,33 @@ void pwmout_init(pwmout_t* obj, PinName pin)
obj->pin_sel = pin_sel;
obj->period = 0;
obj->pulse = 0;
_memset((void *)&obj->pwm_hal_adp, 0, sizeof(HAL_PWM_ADAPTER));
rtl_memset((void *)&obj->pwm_hal_adp, 0, sizeof(HAL_PWM_ADAPTER));
if (HAL_OK != HAL_Pwm_Init(&obj->pwm_hal_adp, pwm_idx, pin_sel)) {
DBG_PWM_ERR("pwmout_init Err!\n");
return;
return -1;
}
pwmout_period_us(obj, 20000); // 20 ms per default
HAL_Pwm_Enable(&obj->pwm_hal_adp);
// pwmout_period_us(obj, 20000); // 20 ms per default
// HAL_Pwm_Enable(&obj->pwm_hal_adp);
return 0;
}
void pwmout_free(pwmout_t* obj)
{
HAL_Pwm_Disable(&obj->pwm_hal_adp);
gTimerRecord &= ~(1 << obj->pwm_hal_adp.gtimer_id);
}
void pwmout_write(pwmout_t* obj, float value)
void pwmout_period_us(pwmout_t* obj, uint32_t us)
{
if (value < (float)0.0) {
value = 0.0;
}
else if (value > (float)1.0) {
value = 1.0;
}
obj->pulse = (uint32_t)((float)obj->period * value);
HAL_Pwm_SetDuty(&obj->pwm_hal_adp, obj->period, obj->pulse);
obj->period = us;
HAL_Pwm_SetDuty(&obj->pwm_hal_adp, us, obj->pulse);
}
float pwmout_read(pwmout_t* obj)
void pwmout_pulsewidth_us(pwmout_t* obj, uint32_t us)
{
float value = 0;
if (obj->period > 0) {
value = (float)(obj->pulse) / (float)(obj->period);
}
return ((value > (float)1.0) ? (float)(1.0) : (value));
}
void pwmout_period(pwmout_t* obj, float seconds)
{
pwmout_period_us(obj, (int)(seconds * 1000000.0f));
}
void pwmout_period_ms(pwmout_t* obj, int ms)
{
pwmout_period_us(obj, (int)(ms * 1000));
}
void pwmout_period_us(pwmout_t* obj, int us)
{
float dc = pwmout_read(obj);
obj->period = us;
// Set duty cycle again
pwmout_write(obj, dc);
}
void pwmout_pulsewidth(pwmout_t* obj, float seconds)
{
pwmout_pulsewidth_us(obj, (int)(seconds * 1000000.0f));
}
void pwmout_pulsewidth_ms(pwmout_t* obj, int ms)
{
pwmout_pulsewidth_us(obj, ms * 1000);
}
void pwmout_pulsewidth_us(pwmout_t* obj, int us)
{
float value = (float)us / (float)obj->period;
pwmout_write(obj, value);
obj->pulse = us;
if(us > obj->period) obj->period = us;
HAL_Pwm_SetDuty(&obj->pwm_hal_adp, obj->period, us);
}
#endif // #ifdef CONFIG_PWM_EN

View file

@ -158,12 +158,10 @@ void sys_log_uart_off(void)
void sys_adc_calibration(u8 write, u16 *offset, u16 *gain)
{
flash_t flash;
u8* pbuf;
extern flash_t flash;
if(write){
// backup
pbuf = RtlMalloc(FLASH_SECTOR_SIZE);
u8 *pbuf = RtlMalloc(FLASH_SECTOR_SIZE);
if(!pbuf) return;
device_mutex_lock(RT_DEV_LOCK_FLASH);
flash_stream_read(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf);
@ -172,7 +170,7 @@ void sys_adc_calibration(u8 write, u16 *offset, u16 *gain)
flash_erase_sector(&flash, FLASH_RESERVED_DATA_BASE);
flash_stream_write(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf);
// Write
flash_stream_read(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf);
// flash_stream_read(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf);
flash_erase_sector(&flash, FLASH_SYSTEM_DATA_ADDR);
flash_stream_write(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf);
device_mutex_unlock(RT_DEV_LOCK_FLASH);

View file

@ -41,22 +41,22 @@
#ifdef LWIP_DEBUG
static const char *err_strerr[] = {
"Ok.", /* ERR_OK 0 */
"Out of memory error.", /* ERR_MEM -1 */
"Buffer error.", /* ERR_BUF -2 */
"Timeout.", /* ERR_TIMEOUT -3 */
"Routing problem.", /* ERR_RTE -4 */
"Operation in progress.", /* ERR_INPROGRESS -5 */
"Illegal value.", /* ERR_VAL -6 */
"Operation would block.", /* ERR_WOULDBLOCK -7 */
"Address in use.", /* ERR_USE -8 */
"Already connected.", /* ERR_ISCONN -9 */
"Connection aborted.", /* ERR_ABRT -10 */
"Connection reset.", /* ERR_RST -11 */
"Connection closed.", /* ERR_CLSD -12 */
"Not connected.", /* ERR_CONN -13 */
"Illegal argument.", /* ERR_ARG -14 */
"Low-level netif error.", /* ERR_IF -15 */
"Ok", /* ERR_OK 0 */
"Out of memory error", /* ERR_MEM -1 */
"Buffer error", /* ERR_BUF -2 */
"Timeout", /* ERR_TIMEOUT -3 */
"Routing problem", /* ERR_RTE -4 */
"Operation in progress", /* ERR_INPROGRESS -5 */
"Illegal value", /* ERR_VAL -6 */
"Operation would block", /* ERR_WOULDBLOCK -7 */
"Address in use", /* ERR_USE -8 */
"Already connected", /* ERR_ISCONN -9 */
"Connection aborted", /* ERR_ABRT -10 */
"Connection reset", /* ERR_RST -11 */
"Connection closed", /* ERR_CLSD -12 */
"Not connected", /* ERR_CONN -13 */
"Illegal argument", /* ERR_ARG -14 */
"Low-level netif error", /* ERR_IF -15 */
};
/**

View file

@ -184,7 +184,6 @@ void
lwip_socket_init(void)
{
}
/**
* Map a externally used socket index to the internal socket representation.
*
@ -213,6 +212,14 @@ get_socket(int s)
return sock;
}
/*
* pvvx: errno
*/
int lwip_last_err_socket(int s) {
struct lwip_sock * sc = get_socket(s);
if(sc) return sc->err;
else return EBADF;
}
/**
* Same as get_socket but doesn't set errno
*

View file

@ -342,6 +342,8 @@ int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptse
int lwip_ioctl(int s, long cmd, void *argp);
int lwip_fcntl(int s, int cmd, int val);
int lwip_last_err_socket(int s); // errno
#if LWIP_COMPAT_SOCKETS
#define accept(a,b,c) lwip_accept(a,b,c)
#define bind(a,b,c) lwip_bind(a,b,c)
@ -361,6 +363,7 @@ int lwip_fcntl(int s, int cmd, int val);
#define select(a,b,c,d,e) lwip_select(a,b,c,d,e)
#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c)
#if LWIP_POSIX_SOCKETS_IO_NAMES
#define read(a,b,c) lwip_read(a,b,c)
#define write(a,b,c) lwip_write(a,b,c)

View file

@ -163,13 +163,12 @@ PACK_STRUCT_END
# include "arch/epstruct.h"
#endif
LOCAL char toupper(char ch) {
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
}
//#define toupper(CH) \
// (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
/** NetBIOS decoding name */
LOCAL int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
static int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
{
uint8_t i, j;
char c;
@ -218,7 +217,7 @@ static void NBNS_encode(char *dst, char *src, uint8_t type)
#endif
/** NetBIOS Name service recv callback */
LOCAL void NETBIOS_CODE_ATTR
static void NETBIOS_CODE_ATTR
netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
u16_t port) {
LWIP_UNUSED_ARG(arg);
@ -227,7 +226,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
if (current_netif != NULL && current_netif->num < NET_IF_NUM) {
uint32 ip = current_netif->ip_addr.addr;
char *curbiosname = netbios_name[current_netif->num];
if (curbiosname[0] != '\0' && ip != 0
if (curbiosname[0] != '\0' && ip != NULL
/* we only answer if we got a default interface */
&& (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети
#if DEBUGSOO > 3
@ -309,7 +308,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
}
}
LOCAL struct udp_pcb * NETBIOS_CODE_ATTR netbios_pcb(void) {
struct udp_pcb * NETBIOS_CODE_ATTR netbios_pcb(void) {
struct udp_pcb *pcb;
for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
if (pcb->local_port == NETBIOS_PORT)

View file

@ -8,7 +8,6 @@
/****************Define if using the polarssl*******************/
#define USING_SSL
/******************Define the function used*********************/
#ifdef USING_SSL
int wss_set_fun_ops(wsclient_context *wsclient);
@ -19,9 +18,6 @@ int ws_set_fun_ops(wsclient_context *wsclient);
#endif
/***************************************************************/
/*************************************************************************************************
** Function Name : create_wsclient
** Description : Creating the websocket client context structure
@ -31,7 +27,7 @@ int ws_set_fun_ops(wsclient_context *wsclient);
** Return : Created: websocket client context structure
** Failed: NULL
**************************************************************************************************/
wsclient_context *create_wsclient(char *url, int port,char *path, char* origin);
wsclient_context *create_wsclient(char *url, int port, char *path, char* origin);
/*************************************************************************************************
** Function Name : ws_connect_url
@ -105,4 +101,4 @@ readyStateValues ws_getReadyState(wsclient_context *wsclient);
**************************************************************************************************/
void ws_close(wsclient_context *wsclient);
#endif
#endif

View file

@ -740,8 +740,8 @@ static void RestartSoftAP()
wifi_restart_ap(wifi_setting.ssid,
wifi_setting.security_type,
wifi_setting.password,
strlen((char*)wifi_setting.ssid),
strlen((char*)wifi_setting.password),
// strlen((char*)wifi_setting.ssid),
// strlen((char*)wifi_setting.password),
wifi_setting.channel);
}