This commit is contained in:
pvvx 2017-03-10 05:09:27 +03:00
parent b976c62423
commit 255332ad03
12 changed files with 2318 additions and 2299 deletions

View file

@ -859,6 +859,7 @@ int wext_set_forwarding(const char *ifname, char flg) {
iwr.u.essid.length = cmd_len + 1; iwr.u.essid.length = cmd_len + 1;
return iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr); return iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr);
} }
int wext_enable_forwarding(const char *ifname) { int wext_enable_forwarding(const char *ifname) {
return wext_set_forwarding(ifname, '1'); return wext_set_forwarding(ifname, '1');
} }

View file

@ -187,6 +187,11 @@ 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 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); error_printf("AP not set max connections %d!\n", wifi_ap_cfg.max_sta);
}; };
/*
if( wext_set_txpower(wlan_ap_name, wifi_cfg.tx_pwr) != RTW_SUCCESS){
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
};
*/
ret = wifi_start_ap(wifi_ap_cfg.ssid, //char *ssid, ret = wifi_start_ap(wifi_ap_cfg.ssid, //char *ssid,
wifi_ap_cfg.security_type, //rtw_security_t ecurity_type, wifi_ap_cfg.security_type, //rtw_security_t ecurity_type,
wifi_ap_cfg.password, //char *password, wifi_ap_cfg.password, //char *password,
@ -288,6 +293,11 @@ rtw_result_t wifi_run_st(void) {
} }
#endif #endif
info_printf("Connected to AP (%s, netif%d)...\n", wlan_st_name, wlan_st_netifn); info_printf("Connected to AP (%s, netif%d)...\n", wlan_st_name, wlan_st_netifn);
/*
if( wext_set_txpower(wlan_st_name, wifi_cfg.tx_pwr) != RTW_SUCCESS){
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
}
*/
ret = wifi_connect(wifi_st_cfg.ssid, wifi_st_cfg.security_type, ret = wifi_connect(wifi_st_cfg.ssid, wifi_st_cfg.security_type,
wifi_st_cfg.password, strlen(wifi_st_cfg.ssid), wifi_st_cfg.password, strlen(wifi_st_cfg.ssid),
strlen(wifi_st_cfg.password), -1, NULL); strlen(wifi_st_cfg.password), -1, NULL);
@ -327,10 +337,12 @@ int _wifi_on(rtw_mode_t mode) {
event_init = 1; event_init = 1;
} }
wifi_mode = mode; wifi_mode = mode;
info_printf("Initializing WIFI...\n");
// set wifi mib // set wifi mib
// adaptivity // adaptivity
wext_set_adaptivity(RTW_ADAPTIVITY_DISABLE); wext_set_adaptivity(RTW_ADAPTIVITY_DISABLE);
info_printf("Initializing WIFI...\n"); // 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);
@ -428,28 +440,33 @@ int wifi_run(rtw_mode_t mode) {
if (_wifi_on(mode) < 0) { if (_wifi_on(mode) < 0) {
error_printf("Wifi On failed!\n"); error_printf("Wifi On failed!\n");
goto error_end; goto error_end;
} };
wifi_mode = mode; wifi_mode = mode;
}; };
if(wifi_set_country(wifi_cfg.country_code) != RTW_SUCCESS) {
error_printf("Error set tx country_code (%d)!", wifi_cfg.country_code);
};
if(wifi_set_txpower(wifi_cfg.tx_pwr) != RTW_SUCCESS) {
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
};
debug_printf("mode == wifi_mode? (%d == %d?)\n", mode, wifi_mode); debug_printf("mode == wifi_mode? (%d == %d?)\n", mode, wifi_mode);
// if(mode == wifi_mode) { // if(mode == wifi_mode)
// wifi_set_country(wifi_cfg.country_code); {
if((wifi_mode == RTW_MODE_AP) || (wifi_mode == RTW_MODE_STA_AP)) { if((wifi_mode == RTW_MODE_AP) || (wifi_mode == RTW_MODE_STA_AP)) {
wifi_run_ap(); wifi_run_ap();
} };
if((wifi_mode == RTW_MODE_STA) || (wifi_mode == RTW_MODE_STA_AP)) { if((wifi_mode == RTW_MODE_STA) || (wifi_mode == RTW_MODE_STA_AP)) {
wifi_run_st(); wifi_run_st();
} };
// wifi_config_autoreconnect(1,1,1);
#if CONFIG_INTERACTIVE_MODE #if CONFIG_INTERACTIVE_MODE
/* Initial uart rx swmaphore*/ /* Initial uart rx swmaphore*/
vSemaphoreCreateBinary(uart_rx_interrupt_sema); vSemaphoreCreateBinary(uart_rx_interrupt_sema);
xSemaphoreTake(uart_rx_interrupt_sema, 1/portTICK_RATE_MS); xSemaphoreTake(uart_rx_interrupt_sema, 1/portTICK_RATE_MS);
start_interactive_mode(); start_interactive_mode();
#endif #endif
// if(wifi_run_mode == wifi_cfg.mode) // if(wifi_run_mode == wifi_cfg.mode)
ret = 1; ret = 1;
// } };
} else { } else {
ret = 1; ret = 1;
error_end: error_end:
@ -481,8 +498,6 @@ void wifi_init_thrd(void) {
wifi_manager_init(); wifi_manager_init();
#endif #endif
wifi_run(wifi_cfg.mode); wifi_run(wifi_cfg.mode);
// if(wifi_run())
} }
/* Initilaize the console stack */ /* Initilaize the console stack */
console_init(); console_init();
@ -492,12 +507,12 @@ void wifi_init_thrd(void) {
rtw_security_t translate_rtw_security(u8 security_type) rtw_security_t translate_rtw_security(u8 security_type)
{ {
rtw_security_t security_mode = RTW_SECURITY_UNKNOWN; rtw_security_t security_mode = RTW_SECURITY_OPEN;
switch (security_type) { switch (security_type) {
case RTW_ENCRYPTION_OPEN: // case RTW_ENCRYPTION_OPEN:
security_mode = RTW_SECURITY_OPEN; // security_mode = RTW_SECURITY_OPEN;
break; // break;
case RTW_ENCRYPTION_WEP40: case RTW_ENCRYPTION_WEP40:
case RTW_ENCRYPTION_WEP104: case RTW_ENCRYPTION_WEP104:
security_mode = RTW_SECURITY_WEP_PSK; security_mode = RTW_SECURITY_WEP_PSK;
@ -614,7 +629,7 @@ void fATPA(int argc, char *argv[]){
if(i > 7) { if(i > 7) {
wifi_ap_cfg.security_type = RTW_SECURITY_WPA2_AES_PSK; wifi_ap_cfg.security_type = RTW_SECURITY_WPA2_AES_PSK;
} }
else if(!i) { else if(i == 0) {
wifi_ap_cfg.security_type = RTW_SECURITY_OPEN; wifi_ap_cfg.security_type = RTW_SECURITY_OPEN;
} }
else { else {
@ -632,7 +647,7 @@ void fATPA(int argc, char *argv[]){
if(argc > 4) { if(argc > 4) {
wifi_ap_cfg.channel = atoi(argv[4]); wifi_ap_cfg.channel = atoi(argv[4]);
} }
// else wifi_ap_cfg.channel = 1; else wifi_ap_cfg.channel = 1;
if(argc > 5) { if(argc > 5) {
wifi_ap_cfg.ssid_hidden = atoi(argv[5]); wifi_ap_cfg.ssid_hidden = atoi(argv[5]);
} }
@ -652,7 +667,7 @@ void fATPA(int argc, char *argv[]){
// WIFI Connect, Disconnect // WIFI Connect, Disconnect
void fATWR(int argc, char *argv[]){ void fATWR(int argc, char *argv[]){
rtw_mode_t mode = RTW_MODE_NONE; rtw_mode_t mode = RTW_MODE_NONE;
if(argc) mode = atoi(argv[1]); if(argc > 1) mode = atoi(argv[1]);
wifi_run(mode); wifi_run(mode);
} }

View file

@ -21,7 +21,7 @@
ip4_addr3(ipaddr), \ ip4_addr3(ipaddr), \
ip4_addr4(ipaddr) ip4_addr4(ipaddr)
extern char str_rom_57ch3Dch0A[]; // "=========================================================\n" 57 <20><> extern char str_rom_57ch3Dch0A[]; // "=========================================================\n" 57
#define BID_WIFI_AP_CFG (1 << 0) #define BID_WIFI_AP_CFG (1 << 0)
#define BID_WIFI_ST_CFG (1 << 1) #define BID_WIFI_ST_CFG (1 << 1)

View file

@ -199,7 +199,7 @@
#define REG_BKQ_DESA 0x0338 /* TX BK Queue Descriptor Address */ #define REG_BKQ_DESA 0x0338 /* TX BK Queue Descriptor Address */
#define REG_RX_DESA 0x0340 /* RX Queue Descriptor Address */ #define REG_RX_DESA 0x0340 /* RX Queue Descriptor Address */
//sherry added for DBI Read/Write 20091126 //sherry added for DBI Read/Write 20091126
#define REG_DBI_WDATA 0x0348 /* Backdoor REG for Access Configuration */ #define REG_DBI_WDATA 0x0348 /* Backdoor REG for Access Configuration */
#define REG_DBI_RDATA 0x034C /* Backdoor REG for Access Configuration */ #define REG_DBI_RDATA 0x034C /* Backdoor REG for Access Configuration */
#define REG_DBI_CTRL 0x0350 /* Backdoor REG for Access Configuration */ #define REG_DBI_CTRL 0x0350 /* Backdoor REG for Access Configuration */
#define REG_DBI_FLAG 0x0352 /* Backdoor REG for Access Configuration */ #define REG_DBI_FLAG 0x0352 /* Backdoor REG for Access Configuration */
@ -535,7 +535,7 @@
#define MSR (REG_CR + 2) // Media Status register #define MSR (REG_CR + 2) // Media Status register
//#define ISR REG_HISR //#define ISR REG_HISR
#define TSFR REG_TSFTR // Timing Sync Function Timer Register. #define TSFR REG_TSFTR // Timing Sync Function Timer Register.
#define TSFR1 REG_TSFTR1 // HW Port 1 TSF Register #define TSFR1 REG_TSFTR1 // HW Port 1 TSF Register
#define PBP REG_PBP #define PBP REG_PBP
@ -747,11 +747,11 @@
// ALL CCK Rate // ALL CCK Rate
#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M #define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M
#define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M|\ #define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M|\
RATR_36M|RATR_48M|RATR_54M RATR_36M|RATR_48M|RATR_54M
#define RATE_ALL_OFDM_1SS RATR_MCS0|RATR_MCS1|RATR_MCS2|RATR_MCS3 |\ #define RATE_ALL_OFDM_1SS RATR_MCS0|RATR_MCS1|RATR_MCS2|RATR_MCS3 |\
RATR_MCS4|RATR_MCS5|RATR_MCS6 |RATR_MCS7 RATR_MCS4|RATR_MCS5|RATR_MCS6 |RATR_MCS7
#define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11|\ #define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11|\
RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15 RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15
#define RATE_BITMAP_ALL 0xFFFFF #define RATE_BITMAP_ALL 0xFFFFF

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -13,10 +13,10 @@
#define DEF_WIFI_MODE RTW_MODE_STA // RTW_MODE_STA_AP, RTW_MODE_AP, RTW_MODE_STA #define DEF_WIFI_MODE RTW_MODE_STA // RTW_MODE_STA_AP, RTW_MODE_AP, RTW_MODE_STA
#define DEF_WIFI_AP_STATIONS 3 // Max number of STAs, should be 1..3, default is 3 #define DEF_WIFI_AP_STATIONS 3 // Max number of STAs, should be 1..3, default is 3
#define DEF_WIFI_COUNTRY RTW_COUNTRY_RU #define DEF_WIFI_COUNTRY RTW_COUNTRY_RU
#define DEF_WIFI_TX_PWR RTW_TX_PWR_PERCENTAGE_100 #define DEF_WIFI_TX_PWR RTW_TX_PWR_PERCENTAGE_50 // RTW_TX_PWR_PERCENTAGE_75 // RTW_TX_PWR_PERCENTAGE_100
#define DEF_WIFI_BGN RTW_NETWORK_BGN // rtw_network_mode_t #define DEF_WIFI_BGN RTW_NETWORK_BGN // rtw_network_mode_t
#define DEF_WIFI_ST_SLEEP 0 // 0 - none, 1 - on #define DEF_WIFI_ST_SLEEP 0 // 0 - none, 1 - on
#define USE_NETBIOS 3 // 0 - off, 1 - ST, 2 - AP, 3 - AP+ST //#define USE_NETBIOS 3 // 0 - off, 1 - ST, 2 - AP, 3 - AP+ST
#define DEF_LOAD_CFG ( 0 \ #define DEF_LOAD_CFG ( 0 \
| BID_WIFI_AP_CFG \ | BID_WIFI_AP_CFG \
| BID_WIFI_ST_CFG \ | BID_WIFI_ST_CFG \
@ -34,7 +34,7 @@
//==== Interface 0 - wlan0 = AP =========== //==== Interface 0 - wlan0 = AP ===========
#define DEF_AP_SSID "RTL871X" #define DEF_AP_SSID "RTL871X"
#define DEF_AP_PASSWORD "0123456789" #define DEF_AP_PASSWORD "0123456789"
#define DEF_AP_SECURITY RTW_SECURITY_OPEN #define DEF_AP_SECURITY RTW_SECURITY_WPA2_AES_PSK // RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK
#define DEF_AP_BEACON 100 // 100...6000 ms #define DEF_AP_BEACON 100 // 100...6000 ms
#define DEF_AP_CHANNEL 1 // 1..14 #define DEF_AP_CHANNEL 1 // 1..14
#define DEF_AP_CHANNEL 1 // 1..14 #define DEF_AP_CHANNEL 1 // 1..14

View file

@ -19,7 +19,7 @@
#include "lwip/tcp_impl.h" #include "lwip/tcp_impl.h"
extern void wifi_run(void); extern char str_rom_57ch3Dch0A[]; // "=========================================================\n" 57
#define printf rtl_printf // DiagPrintf #define printf rtl_printf // DiagPrintf
@ -38,7 +38,7 @@ void fATST(int argc, char *argv[]) {
#if 0 //CONFIG_DEBUG_LOG > 1 #if 0 //CONFIG_DEBUG_LOG > 1
dump_mem_block_list(); dump_mem_block_list();
tcm_heap_dump(); tcm_heap_dump();
#endif; #endif
printf("\n"); printf("\n");
#if (configGENERATE_RUN_TIME_STATS == 1) #if (configGENERATE_RUN_TIME_STATS == 1)
char *cBuffer = pvPortMalloc(512); char *cBuffer = pvPortMalloc(512);
@ -54,7 +54,7 @@ void fATST(int argc, char *argv[]) {
if(pcWriteBuffer) { if(pcWriteBuffer) {
vTaskList((char*)pcWriteBuffer); vTaskList((char*)pcWriteBuffer);
printf("\nTask List:\n"); printf("\nTask List:\n");
printf("==============================\n"); printf(&str_rom_57ch3Dch0A[7]); // "==========================================\n"
printf("Name\t Status Priority HighWaterMark TaskNumber\n%s\n", pcWriteBuffer); printf("Name\t Status Priority HighWaterMark TaskNumber\n%s\n", pcWriteBuffer);
free(pcWriteBuffer); free(pcWriteBuffer);
} }