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

@ -7,9 +7,6 @@ ram_all:
@$(MAKE) -f sdkbuild.mk @$(MAKE) -f sdkbuild.mk
@$(MAKE) -f flasher.mk genbin1 genbin23 @$(MAKE) -f flasher.mk genbin1 genbin23
webfs:
@$(MAKE) -f webfs.mk webpages.espfs
.PHONY: ram_all_mp .PHONY: ram_all_mp
ram_all_mp: ram_all_mp:
@$(MAKE) -f sdkbuild.mk mp @$(MAKE) -f sdkbuild.mk mp
@ -30,10 +27,6 @@ flashburn:
flash_OTA: flash_OTA:
@$(MAKE) -f flasher.mk flash_OTA @$(MAKE) -f flasher.mk flash_OTA
flashwebfs:
@$(MAKE) -f webfs.mk webpages.espfs
@$(MAKE) -f flasher.mk flashwebfs
#JLinkGDB-WrWebFs.bat
runram: runram:
#JLink-RunRAM.bat #JLink-RunRAM.bat

View file

@ -12,7 +12,7 @@ RTL00 module (RTL8710AF)<br>
![SCH](https://github.com/pvvx/RTL00MP3/blob/master/RTL00_MP3_SCH.gif) ![SCH](https://github.com/pvvx/RTL00MP3/blob/master/RTL00_MP3_SCH.gif)
Толко Тест!<br> Только Тест!<br>
PWM Out GC_2 and PE_2 (2 канала по 96Bit на один исходный sample 48 кГц)<br> PWM Out GC_2 and PE_2 (2 канала по 96Bit на один исходный sample 48 кГц)<br>

View file

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

View file

@ -7,17 +7,18 @@
#define ICACHE_FLASH_ATTR #define ICACHE_FLASH_ATTR
#define ICACHE_RODATA_ATTR #define ICACHE_RODATA_ATTR
#define DATA_IRAM_ATTR #define DATA_IRAM_ATTR
#define ICACHE_RAM_ATTR
#define os_printf(...) rtl_printf(__VA_ARGS__) #define os_printf(...) rtl_printf(__VA_ARGS__)
#define os_printf_plus(...) rtl_printf(__VA_ARGS__) #define os_printf_plus(...) rtl_printf(__VA_ARGS__)
#define os_sprintf_fd(...) rtl_sprintf(__VA_ARGS__) #define os_sprintf_fd(...) rtl_sprintf(__VA_ARGS__)
#define ets_sprintf(...) rtl_sprintf(__VA_ARGS__) #define ets_sprintf(...) rtl_sprintf(__VA_ARGS__)
/* #ifndef os_malloc
#define os_malloc pvPortMalloc #define os_malloc pvPortMalloc
#define os_zalloc pvPortZalloc #define os_zalloc pvPortZalloc
#define os_calloc pvPortCalloc #define os_calloc pvPortCalloc
#define os_realloc pvPortRealloc #define os_realloc pvPortRealloc
*/ #endif
#undef os_free #undef os_free
#define os_free vPortFree #define os_free vPortFree
#define system_get_free_heap_size xPortGetFreeHeapSize #define system_get_free_heap_size xPortGetFreeHeapSize
@ -51,6 +52,7 @@
#define os_strncpy rtl_strncpy #define os_strncpy rtl_strncpy
#define os_strstr rtl_strstr #define os_strstr rtl_strstr
#define os_random Rand #define os_random Rand
//extern uint32 phy_get_rand(void); //extern uint32 phy_get_rand(void);
#define system_get_os_print() 1 #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_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 spi_flash_erase_block(blk) flash_erase_block(&flashobj, (blk)<<16);
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0]) #define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1]) #define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2]) #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" #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: /* CONFIG_DEBUG_LOG:
=0 Off all diag/debug msg, =0 Off all diag/debug msg,
=1 Only errors, =1 Only errors,
@ -135,5 +143,12 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
#else #else
#define DEBUGSOO CONFIG_DEBUG_LOG #define DEBUGSOO CONFIG_DEBUG_LOG
#endif #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_ #endif // _INCLUDE_ESP_COMP_H_

View file

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

View file

@ -212,16 +212,16 @@ struct rtw_wowlan_rx_filter {
#if defined(__IAR_SYSTEMS_ICC__) #if defined(__IAR_SYSTEMS_ICC__)
#pragma pack(1) #pragma pack(1)
#else #else
//#error "this structure needs to be packed!" #error "this structure needs to be packed!"
#endif #endif
struct rtw_wowlan { struct rtw_wowlan_status {
u32 wakeup_reasons; //record wake up reason u32 wakeup_reasons; //record wake up reason
u32 filter_id; //record which pattern is matched u32 filter_id; //record which pattern is matched
} _status __attribute__ ((__packed__)); };
#if defined(__IAR_SYSTEMS_ICC__) #if defined(__IAR_SYSTEMS_ICC__)
#pragma pack() #pragma pack()
#else #else
//#error "this structure needs to be packed!" #error "this structure needs to be packed!"
#endif #endif
/** /**

View file

@ -10,8 +10,10 @@
#include <lwip/netif.h> #include <lwip/netif.h>
#include "wifi/wifi_conf.h" #include "wifi/wifi_conf.h"
#include <platform/platform_stdlib.h> #include <platform/platform_stdlib.h>
#ifdef CONFIG_ENABLE_EAP
#include <polarssl/ssl.h> #include <polarssl/ssl.h>
#include <polarssl/memory.h> #include <polarssl/memory.h>
#endif
#define WLAN0_NAME "wlan0" #define WLAN0_NAME "wlan0"
#ifndef ENABLE #ifndef ENABLE
@ -21,6 +23,21 @@
#define DISABLE (0) #define DISABLE (0)
#endif #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_phase = 0;
u8 eap_method = 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); void eap_eapol_start_hdl(char *buf, int buf_len, int flags, void* handler_user_data);
#endif #endif
void set_eap_phase(unsigned char is_trigger_eap){
eap_phase = is_trigger_eap;
}
int get_eap_phase(void){ int get_eap_phase(void){
return eap_phase; return eap_phase;
@ -54,6 +68,10 @@ int get_eap_method(void){
return eap_method; return eap_method;
} }
void set_eap_phase(unsigned char is_trigger_eap){
eap_phase = is_trigger_eap;
}
void reset_config(void){ void reset_config(void){
eap_target_ssid = NULL; eap_target_ssid = NULL;
eap_identity = NULL; eap_identity = NULL;
@ -64,6 +82,8 @@ void reset_config(void){
eap_client_key_pwd = NULL; eap_client_key_pwd = NULL;
} }
#ifdef CONFIG_ENABLE_EAP
void judge_station_disconnect(void) void judge_station_disconnect(void)
{ {
int mode = 0; int mode = 0;
@ -82,7 +102,7 @@ void judge_station_disconnect(void)
wifi_disconnect(); wifi_disconnect();
} }
} }
#ifdef CONFIG_ENABLE_EAP
void eap_disconnected_hdl(char *buf, int buf_len, int flags, void* handler_user_data){ void eap_disconnected_hdl(char *buf, int buf_len, int flags, void* handler_user_data){
// printf("disconnected\n"); // printf("disconnected\n");
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, eap_eapol_recvd_hdl); 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) { if (target_ssid != NULL) {
while (1) { while (1) {
rtw_msleep_os(500); //wait scan complete. rtw_msleep_os(500); //wait scan complete.
ret = wifi_connect(target_ssid, ret = wifi_connect(
NULL,
0,
target_ssid,
RTW_SECURITY_OPEN, RTW_SECURITY_OPEN,
NULL, NULL,
strlen(target_ssid),
0,
0, 0,
NULL); NULL);
if (ret == RTW_SUCCESS) { if (ret == RTW_SUCCESS) {
@ -451,3 +472,5 @@ int eap_cert_setup(ssl_context *ssl)
#endif #endif
return 0; 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("ssid_len = %d\n", wifi->ssid.len);
printf("password_len = %d\n", wifi->password_len); printf("password_len = %d\n", wifi->password_len);
while (1) { while (1) {
ret = wifi_connect((char*)wifi->ssid.val, ret = wifi_connect(
NULL,
0,
(char*)wifi->ssid.val,
wifi->security_type, wifi->security_type,
(char*)wifi->password, (char*)wifi->password,
wifi->ssid.len,
wifi->password_len,
wifi->key_id, wifi->key_id,
NULL); NULL);
if (ret == RTW_SUCCESS) { if (ret == RTW_SUCCESS) {
@ -336,11 +337,11 @@ static int wps_connect_to_AP_by_open_system(char *target_ssid)
if (target_ssid != NULL) { if (target_ssid != NULL) {
rtw_msleep_os(500); //wait scan complete. rtw_msleep_os(500); //wait scan complete.
while (1) { while (1) {
ret = wifi_connect(target_ssid, ret = wifi_connect(
RTW_SECURITY_OPEN,
NULL, NULL,
strlen(target_ssid),
0, 0,
target_ssid,
RTW_SECURITY_OPEN,
0, 0,
NULL); NULL);
if (ret == RTW_SUCCESS) { if (ret == RTW_SUCCESS) {

View file

@ -9,6 +9,7 @@
#include <wifi/wifi_conf.h> #include <wifi/wifi_conf.h>
#include <wifi/wifi_util.h> #include <wifi/wifi_util.h>
#include <wifi/wifi_ind.h> #include <wifi/wifi_ind.h>
#include <wifi_api.h>
#include "tcpip.h" #include "tcpip.h"
#include <osdep_service.h> #include <osdep_service.h>
@ -22,8 +23,6 @@
extern int inic_start(void); extern int inic_start(void);
extern int inic_stop(void); extern int inic_stop(void);
#endif #endif
#include "wifi_api.h"
#include "wlan_lib.h" #include "wlan_lib.h"
#if CONFIG_DEBUG_LOG > 0 #if CONFIG_DEBUG_LOG > 0
@ -429,8 +428,18 @@ void restore_wifi_info_to_flash() {
#endif #endif
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
int wifi_connect(char *ssid, rtw_security_t security_type, char *password, int wifi_connect(
int ssid_len, int password_len, int key_id, void *semaphore) { 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; xSemaphoreHandle join_semaphore;
rtw_result_t result = RTW_SUCCESS; rtw_result_t result = RTW_SUCCESS;
u8 wep_hex = 0; u8 wep_hex = 0;
@ -441,7 +450,34 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
return RTW_ERROR; 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 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 error_flag = RTW_UNKNOWN; //clear for last connect status
if ((((password_len > RTW_MAX_PSK_LEN) || (password_len < RTW_MIN_PSK_LEN)) if ((((password_len > RTW_MAX_PSK_LEN) || (password_len < RTW_MIN_PSK_LEN))
&& ((security_type == RTW_SECURITY_WPA_TKIP_PSK) && ((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) { if (password_len == 10) {
u32 p[5] = { 0 }; u32 g[5] = { 0 };
u8 i = 0; u8 i = 0;
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &p[0], sscanf((const char*) password, "%02x%02x%02x%02x%02x", &g[0],
&p[1], &p[2], &p[3], &p[4]); &g[1], &g[2], &g[3], &g[4]);
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
wep_pwd[i] = (u8) p[i]; wep_pwd[i] = (u8) g[i];
wep_pwd[5] = '\0'; wep_pwd[5] = '\0';
password_len = 5; password_len = 5;
wep_hex = 1; wep_hex = 1;
} else if (password_len == 26) { } else if (password_len == 26) {
u32 p[13] = { 0 }; u32 g[13] = { 0 };
u8 i = 0; u8 i = 0;
sscanf((const char*) password, "%02x%02x%02x%02x%02x%02x%02x" 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], "%02x%02x%02x%02x%02x%02x", &g[0], &g[1], &g[2], &g[3],
&p[4], &p[5], &p[6], &p[7], &p[8], &p[9], &p[10], &g[4], &g[5], &g[6], &g[7], &g[8], &g[9], &g[10],
&p[11], &p[12]); &g[11], &g[12]);
for (i = 0; i < 13; i++) for (i = 0; i < 13; i++)
wep_pwd[i] = (u8) p[i]; wep_pwd[i] = (u8) g[i];
wep_pwd[13] = '\0'; wep_pwd[13] = '\0';
password_len = 13; password_len = 13;
wep_hex = 1; 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; join_result->network_info.password_len = password_len;
if (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); 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() #if DD_WIFI_CONN // дублирование с wifi_connect_bssid_local()
wifi_connect_local(&join_result->network_info); wifi_connect_local(&join_result->network_info);
#else #else
if (wifi_connect_local(&join_result->network_info) == 0) 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, wext_set_ssid(WLAN0_NAME, join_result->network_info.ssid.val,
join_result->network_info.ssid.len); join_result->network_info.ssid.len);
};
}
#endif #endif
join_user_data = join_result; 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); wifi_handshake_done_hdl);
return result; return result;
} }
/*
int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid, int wifi_connect_bssid(
rtw_security_t security_type, char *password, int bssid_len, unsigned char bssid[ETH_ALEN],
int ssid_len, int password_len, int key_id, void *semaphore) { 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; xSemaphoreHandle join_semaphore;
rtw_result_t result = RTW_SUCCESS; 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; join_result->network_info.password_len = password_len;
if (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); join_result->network_info.password = rtw_zmalloc(password_len + 1);
if (!join_result->network_info.password) { if (!join_result->network_info.password) {
return RTW_NOMEM; return RTW_NOMEM;
@ -726,6 +782,7 @@ int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid,
wifi_handshake_done_hdl); wifi_handshake_done_hdl);
return result; return result;
} }
*/
int wifi_disconnect(void) { int wifi_disconnect(void) {
int ret = 0; int ret = 0;
@ -740,7 +797,6 @@ int wifi_disconnect(void) {
} }
return ret; return ret;
} }
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
int wifi_is_connected_to_ap(void) { int wifi_is_connected_to_ap(void) {
return rltk_wlan_is_connected_to_ap(); 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) { 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) { int wifi_set_channel_plan(uint8_t channel_plan) {
const char * ifname = WLAN0_NAME; const char * ifname = WLAN0_NAME;
int ret = 0;
char buf[24]; char buf[24];
rtw_memset(buf, 0, sizeof(buf)); rtw_memset(buf, 0, sizeof(buf));
snprintf(buf, 24, "set_ch_plan %x", channel_plan); 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) { int wifi_rf_on(void) {
return rltk_wlan_rf_on(); int ret;
ret = rltk_wlan_rf_on();
return ret;
} }
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
int wifi_rf_off(void) { 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); int wpas_wps_init(const char* ifname);
#endif #endif
int wifi_start_ap_s(PSOFTAP_CONFIG p) { int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password, int channel, char ssid_hidden) {
const char *ifname = WLAN0_NAME;
int ret = 0;
if (wifi_mode == RTW_MODE_STA_AP) {
ifname = WLAN1_NAME;
}
if (is_promisc_enabled())
promisc_set(0, NULL, 0);
wifi_reg_event_handler(WIFI_EVENT_STA_ASSOC, wifi_ap_sta_assoc_hdl, NULL);
wifi_reg_event_handler(WIFI_EVENT_STA_DISASSOC, wifi_ap_sta_disassoc_hdl,
NULL);
ret = wext_set_mode(ifname, IW_MODE_MASTER);
if (ret < 0)
goto exit;
ret = wext_set_channel(ifname, p->channel); //Set channel before starting ap
if (ret < 0)
goto exit;
switch (p->security_type) {
case RTW_SECURITY_OPEN:
break;
case RTW_SECURITY_WPA2_AES_PSK:
ret = wext_set_auth_param(ifname, IW_AUTH_80211_AUTH_ALG,
IW_AUTH_ALG_OPEN_SYSTEM);
if (ret == 0)
ret = wext_set_key_ext(ifname, IW_ENCODE_ALG_CCMP, NULL, 0, 0, 0, 0,
NULL, 0);
if (ret == 0)
ret = wext_set_passphrase(ifname, (u8*) p->password, strlen(p->password));
break;
default:
ret = -1;
printf("WIFICONF: security type is not supported\n");
break;
}
if (ret < 0)
goto exit;
if(p->ssid_hidden) {
ret = set_hidden_ssid(ifname, 1);
if (ret < 0)
goto exit;
}
ret = wext_set_ap_ssid(ifname, (u8*) p->ssid, strlen(p->ssid));
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
wpas_wps_init(ifname);
#endif
exit: return ret;
}
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
int ssid_len, int password_len, int channel) {
const char *ifname = WLAN0_NAME; const char *ifname = WLAN0_NAME;
int ssid_len = 0;
int password_len = 0;
int ret = 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) { if (wifi_mode == RTW_MODE_STA_AP) {
ifname = WLAN1_NAME; 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); ret = wext_set_mode(ifname, IW_MODE_MASTER);
if (ret < 0) if (ret < 0)
goto exit; goto exit;
// if(!channel) channel = 1;
ret = wext_set_channel(ifname, channel); //Set channel before starting ap ret = wext_set_channel(ifname, channel); //Set channel before starting ap
if (ret < 0) if (ret < 0)
goto exit; goto exit;
@ -1166,13 +1191,19 @@ int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
if (ret < 0) if (ret < 0)
goto exit; 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); ret = wext_set_ap_ssid(ifname, (u8*) ssid, ssid_len);
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP #if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
wpas_wps_init(ifname); wpas_wps_init(ifname);
#endif #endif
exit: return ret; exit: return ret;
} }
/*
int wifi_start_ap_with_hidden_ssid(char *ssid, rtw_security_t security_type, int wifi_start_ap_with_hidden_ssid(char *ssid, rtw_security_t security_type,
char *password, int ssid_len, int password_len, int channel) { char *password, int ssid_len, int password_len, int channel) {
const char *ifname = WLAN0_NAME; const char *ifname = WLAN0_NAME;
@ -1226,6 +1257,7 @@ int wifi_start_ap_with_hidden_ssid(char *ssid, rtw_security_t security_type,
#endif #endif
exit: return ret; exit: return ret;
} }
*/
void wifi_scan_each_report_hdl(char* buf, int buf_len, int flags, void wifi_scan_each_report_hdl(char* buf, int buf_len, int flags,
void* userdata) { void* userdata) {
@ -1710,7 +1742,7 @@ void wifi_enter_promisc_mode() {
} }
int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type, 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; unsigned char idx = 0;
struct ip_addr ipaddr; struct ip_addr ipaddr;
struct ip_addr netmask; 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); wifi_on(RTW_MODE_AP);
} }
// start ap // start ap
if (wifi_start_ap((char*) ssid, security_type, (char*) password, ssid_len, if (wifi_start_ap((char*) ssid, security_type, (char*) password, channel, 0) < 0) {
password_len, channel) < 0) {
printf("ERROR: Operation failed!\n"); printf("ERROR: Operation failed!\n");
return -1; return -1;
} }

View file

@ -8,11 +8,13 @@
#include "wifi_util.h" #include "wifi_util.h"
#include "wifi_ind.h" #include "wifi_ind.h"
#include <platform/platform_stdlib.h> #include <platform/platform_stdlib.h>
#include "wifi_api.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/****************************************************** /******************************************************
* Macros * Macros
******************************************************/ ******************************************************/
@ -137,14 +139,14 @@ int wifi_manager_init(void);
* RTW_ERROR : if an error occurred * RTW_ERROR : if an error occurred
*/ */
int wifi_connect( int wifi_connect(
unsigned char bssid[ETH_ALEN],
char use_bssid,
char *ssid, char *ssid,
rtw_security_t security_type, rtw_security_t security_type,
char *password, char *password,
int ssid_len,
int password_len,
int key_id, int key_id,
void *semaphore); void *semaphore);
/*
int wifi_connect_bssid( int wifi_connect_bssid(
unsigned char bssid[ETH_ALEN], unsigned char bssid[ETH_ALEN],
char *ssid, char *ssid,
@ -155,7 +157,7 @@ int wifi_connect_bssid(
int password_len, int password_len,
int key_id, int key_id,
void *semaphore); void *semaphore);
*/
/** Disassociates from a Wi-Fi network. /** Disassociates from a Wi-Fi network.
* *
* @return RTW_SUCCESS : On successful disassociation from * @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 * @return RTW_SUCCESS : if successfully creates an AP
* RTW_ERROR : if an error occurred * 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( int wifi_start_ap(
char *ssid, char *ssid,
rtw_security_t security_type, rtw_security_t security_type,
@ -453,7 +457,7 @@ int wifi_start_ap(
int ssid_len, int ssid_len,
int password_len, int password_len,
int channel); int channel);
*/
/** Starts an infrastructure WiFi network with hidden SSID /** Starts an infrastructure WiFi network with hidden SSID
* *
* @warning If a STA interface is active when this function is called, the softAP will\n * @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 * @return RTW_SUCCESS : if successfully creates an AP
* RTW_ERROR : if an error occurred * RTW_ERROR : if an error occurred
*/ */
/*
int wifi_start_ap_with_hidden_ssid( int wifi_start_ap_with_hidden_ssid(
char *ssid, char *ssid,
rtw_security_t security_type, rtw_security_t security_type,
@ -485,7 +490,7 @@ int wifi_start_ap_with_hidden_ssid(
int ssid_len, int ssid_len,
int password_len, int password_len,
int channel); int channel);
*/
/** Initiates a scan to search for 802.11 networks. /** Initiates a scan to search for 802.11 networks.
* *
* The scan progressively accumulates results over time, and * The scan progressively accumulates results over time, and
@ -638,8 +643,6 @@ int wifi_restart_ap(
unsigned char *ssid, unsigned char *ssid,
rtw_security_t security_type, rtw_security_t security_type,
unsigned char *password, unsigned char *password,
int ssid_len,
int password_len,
int channel); int channel);
int wifi_config_autoreconnect(__u8 mode, __u8 retyr_times, __u16 timeout); 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; ret = SC_TARGET_CHANNEL_SCAN_FAIL;
goto sc_connect_wifi_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), ret = wifi_connect(
(char*)wifi->password, ETH_ALEN, wifi->ssid.len, wifi->password_len, 0, NULL); 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) if (ret == RTW_SUCCESS)
goto sc_connect_wifi_success; goto sc_connect_wifi_success;
} }
@ -691,8 +696,13 @@ enum sc_result SC_connect_to_AP(void)
goto wifi_connect_fail; goto wifi_connect_fail;
} }
rtw_join_status = 0;//clear simple config status rtw_join_status = 0;//clear simple config status
ret = wifi_connect_bssid(g_bssid, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, ret = wifi_connect(g_bssid,
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL); 1,
(char*)wifi.ssid.val,
wifi.security_type,
(char*)wifi.password,
wifi.key_id,
NULL);
if (ret == RTW_SUCCESS) if (ret == RTW_SUCCESS)
goto wifi_connect_success; goto wifi_connect_success;

View file

@ -68,15 +68,13 @@ struct simple_config_lib_config {
}; };
#pragma pack(1)
#pragma pack(push, 1)
struct rtk_test_sc { struct rtk_test_sc {
/* API exposed to user */ /* API exposed to user */
unsigned char ssid[32]; unsigned char ssid[32];
unsigned char password[65]; unsigned char password[65];
unsigned int ip_addr; unsigned int ip_addr;
}; };
#pragma pack(pop)
/* expose data */ /* expose data */
extern s32 is_promisc_callback_unlock; extern s32 is_promisc_callback_unlock;

View file

@ -36,6 +36,11 @@
#include "wifi_api.h" #include "wifi_api.h"
#include "wifi_user_set.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------------------- //--- Wlan Config Init-------------------
WIFI_CONFIG wifi_cfg = { WIFI_CONFIG wifi_cfg = {
@ -68,6 +73,7 @@ STATION_CONFIG wifi_st_cfg = {
.ssid = DEF_ST_SSID, .ssid = DEF_ST_SSID,
.password = DEF_ST_PASSWORD, .password = DEF_ST_PASSWORD,
.bssid = DEF_ST_BSSID, .bssid = DEF_ST_BSSID,
.flg = DEF_ST_BSSID,
.security_type = DEF_ST_SECURITY, .security_type = DEF_ST_SECURITY,
.autoreconnect = DEF_ST_AUTORECONNECT, .autoreconnect = DEF_ST_AUTORECONNECT,
.reconnect_pause = DEF_ST_RECONNECT_PAUSE .reconnect_pause = DEF_ST_RECONNECT_PAUSE
@ -115,11 +121,12 @@ uint32 write_wifi_cfg(uint32 flg)
uint32 ret = 0; uint32 ret = 0;
PFEEP_ELEMENT p = feep_tab; PFEEP_ELEMENT p = feep_tab;
for(int m = 1; m && p->id != 0; m <<= 1, p++) { for(int m = 1; m && p->id != 0; m <<= 1, p++) {
if((flg & m) if(flg & m) {
&& flash_write_cfg(p->obj, p->id, p->size) < p->size) { if(!flash_write_cfg(p->obj, p->id, p->size)) {
ret |= m; ret |= m;
}; };
}; };
};
return ret; return ret;
} }
@ -173,8 +180,6 @@ uint8 chk_ap_netif_num(void)
return wlan_ap_netifn; return wlan_ap_netifn;
} }
extern int wifi_start_ap_s(PSOFTAP_CONFIG p);
rtw_result_t wifi_run_ap(void) { rtw_result_t wifi_run_ap(void) {
chk_ap_netif_num(); 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 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);
}; };
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; wifi_run_mode |= RTW_MODE_AP;
if (ret != RTW_SUCCESS) { if (ret != RTW_SUCCESS) {
error_printf("Error(%d): Start AP failed!\n\n", ret);; 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]; struct netif * pnetif = &xnetif[WLAN_ST_NETIF_NUM];
DHCP_CONFIG *p = (dhcp_cfg *)&wifi_st_dhcp; DHCP_CONFIG *p = (dhcp_cfg *)&wifi_st_dhcp;
unsigned char mode = p->mode; unsigned char mode = p->mode;
if((mode == 3) if((mode == 3) // Auto fix
&& (p->ip == IP4ADDR(255,255,255,255) && p->ip != IP4ADDR(255,255,255,255)
|| p->ip == IP4ADDR(0,0,0,0))) { && p->ip != IP4ADDR(0,0,0,0)) {
mode = 2; // mode = 2; // fixed ip
} }
else mode = 1; else mode = 1; // DHCP On
if(mode == 2) { if(mode == 2) { // fixed ip
netif_set_addr(pnetif, (ip_addr_t *)&p->ip, (ip_addr_t *)&p->mask, (ip_addr_t *)&p->gw); netif_set_addr(pnetif, (ip_addr_t *)&p->ip, (ip_addr_t *)&p->mask, (ip_addr_t *)&p->gw);
// dhcps_init(pnetif); // dhcps_init(pnetif);
} }
@ -254,8 +270,8 @@ rtw_result_t StartStDHCPClient(void)
p->ip = pnetif->ip_addr.addr; p->ip = pnetif->ip_addr.addr;
p->gw = pnetif->gw.addr; p->gw = pnetif->gw.addr;
p->mask = pnetif->netmask.addr; p->mask = pnetif->netmask.addr;
if(p->mode == 3) { if(p->mode == 3) { // Auto fix
p->mode = 2; p->mode = 2; // fixed ip
write_wifi_cfg(BID_ST_DHCP_CFG); write_wifi_cfg(BID_ST_DHCP_CFG);
} }
ret = RTW_SUCCESS; ret = RTW_SUCCESS;
@ -282,9 +298,14 @@ 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);
ret = wifi_connect(wifi_st_cfg.ssid, wifi_st_cfg.security_type, ret = wifi_connect(
wifi_st_cfg.password, strlen(wifi_st_cfg.ssid), wifi_st_cfg.bssid,
strlen(wifi_st_cfg.password), -1, NULL); 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; wifi_run_mode |= RTW_MODE_STA;
if (ret != RTW_SUCCESS) { if (ret != RTW_SUCCESS) {
error_printf("%s: Operation failed! Error(%d)\n", __func__, ret); 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_NORMAL);
// wext_set_adaptivity(RTW_ADAPTIVITY_CARRIER_SENSE); // 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); ret = rltk_wlan_init(0, mode);
if (ret < 0) return ret; if (ret < 0) return ret;
@ -390,8 +411,9 @@ void _LwIP_Init(void)
netif_set_up(&xnetif[idx]); netif_set_up(&xnetif[idx]);
} }
info_printf("interface %d is initialized\n", idx); info_printf("interface %d is initialized\n", idx);
wifi_mode = 0;
lwip_init_done = 1; 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 #if CONFIG_DEBUG_LOG > 4
debug_printf("\n%s(%d), %d\n", __func__, mode, wifi_run_mode); debug_printf("\n%s(%d), %d\n", __func__, mode, wifi_run_mode);
#endif #endif
if(mode != RTW_MODE_NONE) {
_LwIP_Init();
};
if(wifi_run_mode & RTW_MODE_AP) { if(wifi_run_mode & RTW_MODE_AP) {
info_printf("Deinit old AP...\n"); info_printf("Deinit old AP...\n");
LwIP_DHCP(WLAN_AP_NETIF_NUM, DHCP_STOP); 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) { if(wifi_set_country(wifi_cfg.country_code) != RTW_SUCCESS) {
error_printf("Error set tx country_code (%d)!", wifi_cfg.country_code); error_printf("Error set tx country_code (%d)!", wifi_cfg.country_code);
}; };
// extern uint8_t rtw_power_percentage_idx; // rtw_tx_pwr_percentage_t // extern uint8_t rtw_power_percentage_idx;
#if 1 // rltk_set_tx_power_percentage() return all = 0 !
rltk_set_tx_power_percentage(wifi_cfg.tx_pwr);
#else
if(rtw_power_percentage_idx != wifi_cfg.tx_pwr) { if(rtw_power_percentage_idx != wifi_cfg.tx_pwr) {
if(rltk_set_tx_power_percentage(wifi_cfg.tx_pwr) != RTW_SUCCESS) { if(rltk_set_tx_power_percentage(wifi_cfg.tx_pwr) != RTW_SUCCESS) {
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr); error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
}; };
} }
#endif
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)
{ {
if((wifi_mode == RTW_MODE_AP) || (wifi_mode == RTW_MODE_STA_AP)) { switch(wifi_mode) {
case RTW_MODE_STA_AP:
wifi_run_ap(); wifi_run_ap();
};
if((wifi_mode == RTW_MODE_STA) || (wifi_mode == RTW_MODE_STA_AP)) {
wifi_run_st(); 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 #if CONFIG_INTERACTIVE_MODE
/* Initial uart rx swmaphore*/ /* Initial uart rx swmaphore*/
vSemaphoreCreateBinary(uart_rx_interrupt_sema); vSemaphoreCreateBinary(uart_rx_interrupt_sema);
@ -475,6 +506,7 @@ error_end:
return ret; return ret;
} }
/* Load cfg, init WiFi + LwIP init, WiFi start if wifi_cfg.mode != RTW_MODE_NONE */
void wifi_init(void) { void wifi_init(void) {
debug_printf("\nLoad Config\n"); debug_printf("\nLoad Config\n");
read_wifi_cfg(wifi_cfg.load_flg); // DEF_LOAD_CFG read_wifi_cfg(wifi_cfg.load_flg); // DEF_LOAD_CFG
@ -483,14 +515,13 @@ void wifi_init(void) {
// Call back from application layer after wifi_connection success // Call back from application layer after wifi_connection success
// p_write_reconnect_ptr = wlan_write_reconnect_data_to_flash; // p_write_reconnect_ptr = wlan_write_reconnect_data_to_flash;
p_wlan_autoreconnect_hdl = NULL; p_wlan_autoreconnect_hdl = NULL;
if (wifi_cfg.mode != RTW_MODE_NONE) { _LwIP_Init();
wifi_mode = wifi_cfg.mode;
#if CONFIG_WIFI_IND_USE_THREAD #if CONFIG_WIFI_IND_USE_THREAD
wifi_manager_init(); wifi_manager_init();
#endif #endif
// wifi_cfg.mode = RTW_MODE_PROMISC; //RTW_MODE_P2P;
wifi_run(wifi_cfg.mode); wifi_run(wifi_cfg.mode);
} }
}
rtw_security_t translate_rtw_security(u8 security_type) 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; return security_mode;
} }
void show_wifi_ap_ip(void) { void show_wifi_ap_ip(void) {
printf("SoftAP ip: " IPSTR "\n", IP2STR(&xnetif[WLAN_AP_NETIF_NUM].ip_addr)); printf("SoftAP ip: " IPSTR "\n", IP2STR(&xnetif[WLAN_AP_NETIF_NUM].ip_addr));
} }

View file

@ -8,7 +8,6 @@
#ifndef _WIFI_API_H_ #ifndef _WIFI_API_H_
#define _WIFI_API_H_ #define _WIFI_API_H_
#include "wifi_constants.h" #include "wifi_constants.h"
#include "wifi_conf.h"
#define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0]) #define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0])
#define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1]) #define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1])
@ -64,8 +63,8 @@ typedef struct _wifi_config {
typedef struct _softap_config { typedef struct _softap_config {
unsigned char ssid[NDIS_802_11_LENGTH_SSID]; unsigned char ssid[NDIS_802_11_LENGTH_SSID];
unsigned char password[IW_PASSPHRASE_MAX_SIZE]; unsigned char password[IW_PASSPHRASE_MAX_SIZE];
rtw_security_t security_type; // Only: RTW_SECURITY_OPEN, RTW_SECURITY_WPA2_AES_PSK rtw_security_t security_type; // RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK
unsigned short beacon_interval; // default 100 uint16 beacon_interval; // Note: support 100 ~ 60000 ms, default 100
unsigned char channel; // 1..14 unsigned char channel; // 1..14
unsigned char ssid_hidden; // Note: default 0 unsigned char ssid_hidden; // Note: default 0
unsigned char max_sta; // 1..3 unsigned char max_sta; // 1..3
@ -75,10 +74,10 @@ typedef struct _station_config {
unsigned char ssid[NDIS_802_11_LENGTH_SSID]; unsigned char ssid[NDIS_802_11_LENGTH_SSID];
unsigned char password[IW_PASSPHRASE_MAX_SIZE]; unsigned char password[IW_PASSPHRASE_MAX_SIZE];
rtw_security_t security_type; rtw_security_t security_type;
unsigned char bssid[6]; // Note: If bssid set is not ff.ff.ff.ff.ff.ff, unsigned char bssid[6]; // Note: If bssid set is not ff.ff.ff.ff.ff.ff || 00:00:00:00:00:00
// station will connect to the router with both ssid[] and bssid[] matched.
unsigned char autoreconnect; // 0 - none, 1..254 - count, 255 - all 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 // rtw_adaptivity_mode_t
} STATION_CONFIG, *PSTATION_CONFIG; } STATION_CONFIG, *PSTATION_CONFIG;
//--- LwIP Config ------------------------- //--- LwIP Config -------------------------
@ -106,6 +105,7 @@ extern DHCP_CONFIG wifi_ap_dhcp;
extern STATION_CONFIG wifi_st_cfg; extern STATION_CONFIG wifi_st_cfg;
extern DHCP_CONFIG wifi_st_dhcp; extern DHCP_CONFIG wifi_st_dhcp;
extern rtw_mode_t wifi_run_mode; extern rtw_mode_t wifi_run_mode;
extern rtw_mode_t wifi_mode;
extern char wlan_st_name[]; extern char wlan_st_name[];
extern char wlan_ap_name[]; extern char wlan_ap_name[];
extern char wlan_st_netifn; 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); extern void cmd_jd_smart(int argc, char **argv);
#endif #endif
#if CONFIG_WLAN #if CONFIG_WLAN
static void cmd_wifi_on(int argc, char **argv); void cmd_wifi_on(int argc, char **argv);
static void cmd_wifi_off(int argc, char **argv); void cmd_wifi_off(int argc, char **argv);
static void cmd_wifi_disconnect(int argc, char **argv); void cmd_wifi_disconnect(int argc, char **argv);
extern void cmd_promisc(int argc, char **argv); extern void cmd_promisc(int argc, char **argv);
extern void cmd_simple_config(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], if(wifi_start_ap(argv[1],
RTW_SECURITY_WPA2_AES_PSK, RTW_SECURITY_WPA2_AES_PSK,
argv[3], argv[3],
strlen((const char *)argv[1]), channel,
strlen((const char *)argv[3]), 0
channel
) != RTW_SUCCESS) { ) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n\n"); printf("ERROR: Operation failed!\n\n");
return; return;
@ -234,9 +233,8 @@ static void cmd_wifi_sta_and_ap(int argc, char **argv)
if(wifi_start_ap(argv[1], if(wifi_start_ap(argv[1],
RTW_SECURITY_OPEN, RTW_SECURITY_OPEN,
NULL, NULL,
strlen((const char *)argv[1]), channel,
0, 0
channel
) != RTW_SUCCESS) { ) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n"); printf("ERROR: Operation failed!\n");
return; return;
@ -332,9 +330,8 @@ static void cmd_wifi_ap(int argc, char **argv)
if(wifi_start_ap(argv[1], if(wifi_start_ap(argv[1],
RTW_SECURITY_WPA2_AES_PSK, RTW_SECURITY_WPA2_AES_PSK,
argv[3], argv[3],
strlen((const char *)argv[1]), channel,
strlen((const char *)argv[3]), 0
channel
) != RTW_SUCCESS) { ) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n"); printf("ERROR: Operation failed!\n");
return; return;
@ -344,9 +341,8 @@ static void cmd_wifi_ap(int argc, char **argv)
if(wifi_start_ap(argv[1], if(wifi_start_ap(argv[1],
RTW_SECURITY_OPEN, RTW_SECURITY_OPEN,
NULL, NULL,
strlen((const char *)argv[1]), channel,
0, 0
channel
) != RTW_SUCCESS) { ) != RTW_SUCCESS) {
printf("ERROR: Operation failed!\n"); printf("ERROR: Operation failed!\n");
return; return;
@ -443,11 +439,12 @@ static void cmd_wifi_connect(int argc, char **argv)
semaphore = NULL; semaphore = NULL;
} }
ret = wifi_connect(ssid, ret = wifi_connect(
NULL,
0,
ssid,
security_type, security_type,
password, password,
ssid_len,
password_len,
key_id, key_id,
semaphore); semaphore);
@ -480,7 +477,6 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
char *ssid = NULL; char *ssid = NULL;
rtw_security_t security_type; rtw_security_t security_type;
char *password; char *password;
int bssid_len;
int ssid_len = 0; int ssid_len = 0;
int password_len; int password_len;
int key_id; int key_id;
@ -525,21 +521,18 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
if(argc == 3 + index){ if(argc == 3 + index){
security_type = RTW_SECURITY_OPEN; security_type = RTW_SECURITY_OPEN;
password = NULL; password = NULL;
bssid_len = ETH_ALEN;
password_len = 0; password_len = 0;
key_id = 0; key_id = 0;
semaphore = NULL; semaphore = NULL;
}else if(argc ==4 + index){ }else if(argc ==4 + index){
security_type = RTW_SECURITY_WPA2_AES_PSK; security_type = RTW_SECURITY_WPA2_AES_PSK;
password = argv[3 + index]; password = argv[3 + index];
bssid_len = ETH_ALEN;
password_len = strlen((const char *)argv[3 + index]); password_len = strlen((const char *)argv[3 + index]);
key_id = 0; key_id = 0;
semaphore = NULL; semaphore = NULL;
}else{ }else{
security_type = RTW_SECURITY_WEP_PSK; security_type = RTW_SECURITY_WEP_PSK;
password = argv[3 + index]; password = argv[3 + index];
bssid_len = ETH_ALEN;
password_len = strlen((const char *)argv[3 + index]); password_len = strlen((const char *)argv[3 + index]);
key_id = atoi(argv[4 + index]); key_id = atoi(argv[4 + index]);
if(( password_len != 5) && (password_len != 13)) { if(( password_len != 5) && (password_len != 13)) {
@ -553,13 +546,12 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
semaphore = NULL; semaphore = NULL;
} }
ret = wifi_connect_bssid(bssid, ret = wifi_connect(
bssid,
1,
ssid, ssid,
security_type, security_type,
password, password,
bssid_len,
ssid_len,
password_len,
key_id, key_id,
semaphore); semaphore);
@ -578,7 +570,7 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
printf("Got IP after %dms.\n", (tick3-tick1)); 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; int timeout = 20;
char essid[33]; char essid[33];
@ -714,14 +706,14 @@ static void cmd_wifi_info(int argc, char **argv)
#endif #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){ if(wifi_on(RTW_MODE_STA)<0){
printf("ERROR: Wifi on failed!\n"); 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 #if CONFIG_WEBSERVER
stop_web_server(); stop_web_server();
@ -1059,7 +1051,7 @@ static const cmd_entry cmd_table[] = {
{"wifi_wps", cmd_wps}, {"wifi_wps", cmd_wps},
#endif #endif
#ifdef CONFIG_WPS_AP #ifdef CONFIG_WPS_AP
//pvvx {"wifi_ap_wps", cmd_ap_wps}, {"wifi_ap_wps", cmd_ap_wps},
#endif #endif
#if CONFIG_ENABLE_P2P #if CONFIG_ENABLE_P2P
{"wifi_p2p_start", cmd_wifi_p2p_start}, {"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]); //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, ret = wifi_connect(
(unsigned char *)result.pwd, result.ssid_length, NULL,
result.pwd_length, 0,
0,NULL); (unsigned char *)result.ssid,
security_mode,
(unsigned char *)result.pwd,
0,
NULL);
if(ret == RTW_SUCCESS){ if(ret == RTW_SUCCESS){
printf("Connect ok!\n"); 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; return ret;
} }
ret = wifi_connect((char*)p_wifi->ssid.val, ret = wifi_connect(
NULL,
0,
(char*)p_wifi->ssid.val,
p_wifi->security_type, p_wifi->security_type,
(char*)p_wifi->password, (char*)p_wifi->password,
p_wifi->ssid.len,
p_wifi->password_len,
p_wifi->key_id, p_wifi->key_id,
NULL); NULL);

View file

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

View file

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

View file

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

View file

@ -68,7 +68,7 @@ u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid);
u16 rtw_get_cur_max_rate(_adapter *adapter); u16 rtw_get_cur_max_rate(_adapter *adapter);
//int rtw_set_scan_mode(_adapter *adapter, RT_SCAN_TYPE scan_mode); //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_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); //int rtw_set_band(_adapter *adapter, enum _BAND band);
#endif #endif

View file

@ -481,9 +481,9 @@ 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); extern int rtw_is_channel_set_contains_channel(RT_CHANNEL_INFO *channel_set, const u32 channel_num, int *pchannel_idx);
#ifdef CONFIG_CUSTOM_IE #ifdef CONFIG_CUSTOM_IE
#ifndef __CUS_IE_ #ifndef _CUS_IE_
#define __CUS_IE_ #define _CUS_IE_
typedef struct __cus_ie typedef struct _cus_ie
{ {
u8 *ie; u8 *ie;
u8 type; u8 type;

View file

@ -491,7 +491,7 @@ typedef enum {
RTW_TX_PWR_PERCENTAGE_75 = 1, /* 75% */ RTW_TX_PWR_PERCENTAGE_75 = 1, /* 75% */
RTW_TX_PWR_PERCENTAGE_50 = 2, /* 50% */ RTW_TX_PWR_PERCENTAGE_50 = 2, /* 50% */
RTW_TX_PWR_PERCENTAGE_25 = 3, /* 25% */ 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; }rtw_tx_pwr_percentage_t;
/** /**

View file

@ -7,13 +7,7 @@
#include "osdep_service.h" #include "osdep_service.h"
#include "freertos/wrapper.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 "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_aligned2_ __attribute__((aligned(2)))
#define _atr_aligned4_ __attribute__((aligned(4))) #define _atr_aligned4_ __attribute__((aligned(4)))
@ -60,16 +54,16 @@ typedef uint8_t BOOLEAN;
typedef uint8_t u1Byte; typedef uint8_t u1Byte;
typedef uint16_t u2Byte; typedef uint16_t u2Byte;
//typedef uint32_t u4Byte; typedef uint32_t u4Byte;
typedef uint64_t u8Byte; typedef uint64_t u8Byte;
typedef uint64_t __attribute__((aligned(4))) _u8Byte; typedef uint64_t __attribute__((aligned(4))) _u8Byte;
//typedef sint8_t s1Byte; typedef sint8_t s1Byte;
typedef sint16_t s2Byte; typedef sint16_t s2Byte;
//typedef sint32_t s4Byte; typedef sint32_t s4Byte;
//typedef sint8_t *ps1Byte; typedef sint8_t *ps1Byte;
typedef uint8_t *pu1Byte; typedef uint8_t *pu1Byte;
typedef uint16_t *pu2Byte; typedef uint16_t *pu2Byte;
//typedef uint32_t *pu4Byte; typedef uint32_t *pu4Byte;
typedef uint32_t sizetype; typedef uint32_t sizetype;
typedef struct _ADAPTER _adapter; typedef struct _ADAPTER _adapter;
@ -81,7 +75,6 @@ typedef void *_mutex;
typedef int (*init_done_ptr)(void); typedef int (*init_done_ptr)(void);
/* rtw_efuse.h
enum _EFUSE_DEF_TYPE // : sint32_t enum _EFUSE_DEF_TYPE // : sint32_t
{ {
TYPE_EFUSE_MAX_SECTION = 0x0, TYPE_EFUSE_MAX_SECTION = 0x0,
@ -97,9 +90,7 @@ enum _IFACE_TYPE //: sint32_t
{ {
IFACE_PORT0 = 0x0, IFACE_PORT1 = 0x1, MAX_IFACE_PORT = 0x2, IFACE_PORT0 = 0x0, IFACE_PORT1 = 0x1, MAX_IFACE_PORT = 0x2,
}; };
*/
/* rtl8195a_pmu_task.h
enum _FW_ERR0_STATUS_ //: sint32_t enum _FW_ERR0_STATUS_ //: sint32_t
{ {
FES0_H2C_CMDID = 0x1, FES0_H2C_CMDID = 0x1,
@ -363,7 +354,7 @@ struct atomic_t {
_lock lock; _lock lock;
}; };
*/ */
/* osdep_intf.h
struct iw_request_info { struct iw_request_info {
uint16_t cmd; uint16_t cmd;
uint16_t flags; uint16_t flags;
@ -371,9 +362,7 @@ struct iw_request_info {
typedef int (*iw_handler)(struct net_device *, struct iw_request_info *, typedef int (*iw_handler)(struct net_device *, struct iw_request_info *,
union iwreq_data *, char *); union iwreq_data *, char *);
*/
/* wlan_bssdef.h
struct _NDIS_802_11_SSID { struct _NDIS_802_11_SSID {
uint32_t SsidLength; uint32_t SsidLength;
uint8_t Ssid[36]; uint8_t Ssid[36];
@ -466,7 +455,6 @@ struct wlan_network {
WLAN_BSSID_EX network; WLAN_BSSID_EX network;
WLAN_BCN_INFO BcnInfo; WLAN_BCN_INFO BcnInfo;
}; };
*/
/* osdep_service.h /* osdep_service.h
typedef void *_timerHandle; typedef void *_timerHandle;
@ -480,12 +468,11 @@ struct wlan_network {
typedef struct timer_list _timer; typedef struct timer_list _timer;
*/ */
/* rtw_qos.h
struct qos_priv { struct qos_priv {
uint32_t qos_option; uint32_t qos_option;
}; };
*/
/* wifi.h
struct __attribute__((packed)) _atr_aligned2_ rtw_ieee80211_ht_cap { struct __attribute__((packed)) _atr_aligned2_ rtw_ieee80211_ht_cap {
uint16_t cap_info; uint16_t cap_info;
uint8_t ampdu_params_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; uint32_t tx_BF_cap_info;
uint8_t antenna_selection_info; uint8_t antenna_selection_info;
}; };
*/
/* rtw_ht.h
struct ht_priv { struct ht_priv {
uint32_t ht_option; uint32_t ht_option;
uint32_t ampdu_enable; uint32_t ampdu_enable;
@ -508,8 +493,7 @@ struct ht_priv {
uint8_t stbc_cap; uint8_t stbc_cap;
struct rtw_ieee80211_ht_cap ht_cap; struct rtw_ieee80211_ht_cap ht_cap;
}; };
*/
/* rtw_mlme.h
struct _atr_aligned4_ _RT_LINK_DETECT_T { struct _atr_aligned4_ _RT_LINK_DETECT_T {
uint32_t NumTxOkInPeriod; uint32_t NumTxOkInPeriod;
uint32_t NumRxOkInPeriod; uint32_t NumRxOkInPeriod;
@ -522,6 +506,7 @@ struct _atr_aligned4_ _RT_LINK_DETECT_T {
BOOLEAN bHigherBusyTxTraffic; BOOLEAN bHigherBusyTxTraffic;
}; };
typedef struct _RT_LINK_DETECT_T RT_LINK_DETECT_T; typedef struct _RT_LINK_DETECT_T RT_LINK_DETECT_T;
enum _RT_SCAN_TYPE //: sint32_t enum _RT_SCAN_TYPE //: sint32_t
{ {
SCAN_PASSIVE = 0x0, SCAN_ACTIVE = 0x1, SCAN_MIX = 0x2 SCAN_PASSIVE = 0x0, SCAN_ACTIVE = 0x1, SCAN_MIX = 0x2
@ -584,8 +569,7 @@ struct mlme_priv {
uint8_t scanning_via_buddy_intf; uint8_t scanning_via_buddy_intf;
struct recv_frame *p_copy_recv_frame; struct recv_frame *p_copy_recv_frame;
}; };
*/
/* rtw_mlme_ext.h
struct _atr_aligned4_ _RT_CHANNEL_INFO { struct _atr_aligned4_ _RT_CHANNEL_INFO {
uint8_t ChannelNum; uint8_t ChannelNum;
RT_SCAN_TYPE ScanType; // uint8_t ScanType; // byte/dword? RT_SCAN_TYPE ScanType; // uint8_t ScanType; // byte/dword?
@ -600,8 +584,7 @@ struct ss_res {
int scan_mode; int scan_mode;
NDIS_802_11_SSID ssid[1]; NDIS_802_11_SSID ssid[1];
}; };
*/
/* wifi.h
struct __attribute__((packed)) __attribute__((aligned(1))) ADDBA_request { struct __attribute__((packed)) __attribute__((aligned(1))) ADDBA_request {
uint8_t dialog_token; uint8_t dialog_token;
uint16_t BA_para_set; uint16_t BA_para_set;
@ -640,8 +623,7 @@ struct HT_info_element {
uint8_t infos[5]; uint8_t infos[5];
uint8_t MCS_rate[16]; uint8_t MCS_rate[16];
}; };
*/
/* rtw_mlme_ext.h
struct FW_Sta_Info { struct FW_Sta_Info {
struct sta_info *psta; struct sta_info *psta;
uint32_t status; uint32_t status;
@ -690,17 +672,16 @@ struct mlme_ext_info {
struct HT_info_element HT_info; struct HT_info_element HT_info;
struct FW_Sta_Info FW_sta_info[5]; struct FW_Sta_Info FW_sta_info[5];
}; };
*/
/*
#ifndef _CUS_IE_ #ifndef _CUS_IE_
#define _CUS_IE_ #define _CUS_IE_
typedef struct _cus_ie{ typedef struct _cus_ie{
__u8 *ie; __u8 *ie;
__u8 type; __u8 type;
} cus_ie, *p_cus_ie; } cus_ie, *p_cus_ie;
#endif */ #endif /* _CUS_IE_ */
// typedef struct _cus_ie *p_cus_ie; // typedef struct _cus_ie *p_cus_ie;
/* rtw_mlme_ext.h
struct mlme_ext_priv { //__attribute__((packed))? struct mlme_ext_priv { //__attribute__((packed))?
_adapter *padapter; //+0 padapter+1256 [912] _adapter *padapter; //+0 padapter+1256 [912]
uint8_t mlmeext_init; uint8_t mlmeext_init;
@ -744,9 +725,7 @@ struct mlme_ext_priv { //__attribute__((packed))?
uint8_t bChDeauthDisabled; uint8_t bChDeauthDisabled;
uint8_t bConcurrentFlushingSTA; uint8_t bConcurrentFlushingSTA;
}; };
*/
/* rtw_cmd.h
struct cmd_priv { struct cmd_priv {
_queue cmd_queue; _queue cmd_queue;
uint8_t cmdthd_running; uint8_t cmdthd_running;
@ -759,27 +738,6 @@ struct evt_priv {
uint8_t *evt_allocated_buf; uint8_t *evt_allocated_buf;
uint32_t evt_done_cnt; 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 { struct _io_ops {
int (*init_io_priv)(struct dvobj_priv *); int (*init_io_priv)(struct dvobj_priv *);
@ -798,8 +756,7 @@ struct _io_ops {
struct io_priv { struct io_priv {
struct _io_ops io_ops; struct _io_ops io_ops;
}; };
*/
/* rtw_xmit.h
struct rtw_tx_ring { struct rtw_tx_ring {
struct tx_buf_desc *desc; struct tx_buf_desc *desc;
dma_addr_t dma; dma_addr_t dma;
@ -845,8 +802,7 @@ struct _atr_aligned8_ xmit_priv {
uint32_t free_xmit_extbuf_cnt; uint32_t free_xmit_extbuf_cnt;
uint16_t nqos_ssn; uint16_t nqos_ssn;
}; };
*/
/* trw_recv.h
struct rtw_rx_ring { struct rtw_rx_ring {
struct recv_buf_stat *desc; struct recv_buf_stat *desc;
dma_addr_t dma; dma_addr_t dma;
@ -909,8 +865,7 @@ struct _atr_aligned8_ recv_priv {
uint16_t promisc_bk_rxfltmap2; uint16_t promisc_bk_rxfltmap2;
uint8_t promisc_mgntframe_enabled; uint8_t promisc_mgntframe_enabled;
}; };
*/
/* sta_info.h
struct _atr_aligned4_ sta_priv { struct _atr_aligned4_ sta_priv {
uint8_t *pallocated_stainfo_buf; uint8_t *pallocated_stainfo_buf;
uint32_t allocated_stainfo_size; uint32_t allocated_stainfo_size;
@ -934,13 +889,14 @@ struct _atr_aligned4_ sta_priv {
uint16_t tim_bitmap; uint16_t tim_bitmap;
uint16_t max_num_sta; uint16_t max_num_sta;
}; };
*/
/* trw_security.h
union Keytype { union Keytype {
uint8_t skey[16]; uint8_t skey[16];
uint32_t lkey[4]; uint32_t lkey[4];
}; };
union pn48 { union pn48 {
u8Byte val; u8Byte val;
struct { struct {
@ -954,9 +910,7 @@ union pn48 {
uint8_t TSC7; uint8_t TSC7;
}_byte_; }_byte_;
}; };
*/
/* wlan_bssdef.h
struct _NDIS_802_11_WEP { struct _NDIS_802_11_WEP {
uint32_t Length; uint32_t Length;
uint32_t KeyIndex; uint32_t KeyIndex;
@ -964,9 +918,7 @@ struct _NDIS_802_11_WEP {
uint8_t KeyMaterial[16]; uint8_t KeyMaterial[16];
}; };
typedef struct _NDIS_802_11_WEP NDIS_802_11_WEP; typedef struct _NDIS_802_11_WEP NDIS_802_11_WEP;
*/
/* rtw_psk.h
struct $D75518714447A990003EBC933C23F70E { struct $D75518714447A990003EBC933C23F70E {
uint32_t HighPart; uint32_t HighPart;
uint32_t LowPart; uint32_t LowPart;
@ -1027,9 +979,7 @@ struct _wpa_global_info {
typedef struct _wpa_global_info WPA_GLOBAL_INFO; typedef struct _wpa_global_info WPA_GLOBAL_INFO;
typedef struct _wpa_sta_info WPA_STA_INFO; typedef struct _wpa_sta_info WPA_STA_INFO;
*/
/* rtw_security.h
struct _atr_aligned4_ security_priv { struct _atr_aligned4_ security_priv {
uint32_t dot11AuthAlgrthm; uint32_t dot11AuthAlgrthm;
uint32_t dot11PrivacyAlgrthm; uint32_t dot11PrivacyAlgrthm;
@ -1073,8 +1023,7 @@ struct _atr_aligned4_ security_priv {
uint8_t wpa_passphrase[65]; uint8_t wpa_passphrase[65];
uint8_t wps_phase; uint8_t wps_phase;
}; };
*/
/* derv_types.h
struct _atr_aligned4_ registry_priv { struct _atr_aligned4_ registry_priv {
uint8_t chip_version; uint8_t chip_version;
uint8_t hci; uint8_t hci;
@ -1118,8 +1067,7 @@ struct _atr_aligned4_ registry_priv {
uint8_t adaptivity_dc_backoff; uint8_t adaptivity_dc_backoff;
int8_t adaptivity_th_l2h_ini; int8_t adaptivity_th_l2h_ini;
}; };
*/
/* trw_powerctrl.h
typedef void *_sema; typedef void *_sema;
typedef _sema _pwrlock; typedef _sema _pwrlock;
@ -1190,8 +1138,7 @@ struct _atr_aligned4_ pwrctrl_priv {
uint8_t tdma_rfon_period_len_3; uint8_t tdma_rfon_period_len_3;
uint8_t lps_dtim; uint8_t lps_dtim;
}; };
*/
/* rtw_eeprom.h
struct _atr_aligned2_ eeprom_priv { // __attribute__((packed))!? struct _atr_aligned2_ eeprom_priv { // __attribute__((packed))!?
uint8_t bautoload_fail_flag; uint8_t bautoload_fail_flag;
uint8_t mac_addr[6]; uint8_t mac_addr[6];
@ -1201,8 +1148,7 @@ struct _atr_aligned2_ eeprom_priv { // __attribute__((packed))!?
uint8_t EEPROMRFGainOffset; uint8_t EEPROMRFGainOffset;
uint8_t EEPROMRFGainVal; uint8_t EEPROMRFGainVal;
}; };
*/
/* rtw_rf.h
enum _CHANNEL_WIDTH // : sint32_t enum _CHANNEL_WIDTH // : sint32_t
{ {
CHANNEL_WIDTH_20 = 0x0, CHANNEL_WIDTH_20 = 0x0,
@ -1213,9 +1159,7 @@ enum _CHANNEL_WIDTH // : sint32_t
CHANNEL_WIDTH_MAX = 0x5, CHANNEL_WIDTH_MAX = 0x5,
}; };
typedef enum _CHANNEL_WIDTH CHANNEL_WIDTH; typedef enum _CHANNEL_WIDTH CHANNEL_WIDTH;
*/
/* hal_intf.h
enum _HAL_DEF_VARIABLE // : sint32_t enum _HAL_DEF_VARIABLE // : sint32_t
{ {
HAL_DEF_UNDERCORATEDSMOOTHEDPWDB = 0x0, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB = 0x0,
@ -1252,11 +1196,11 @@ enum _HAL_ODM_VARIABLE // : sint32_t
HAL_ODM_REGULATION = 0x4, HAL_ODM_REGULATION = 0x4,
}; };
typedef enum _HAL_ODM_VARIABLE HAL_ODM_VARIABLE; typedef enum _HAL_ODM_VARIABLE HAL_ODM_VARIABLE;
*/
/* freertos_service.h
typedef void *_thread_hdl_; typedef void *_thread_hdl_;
*/
/* osdep_service.h /*
// osdep_service.h
struct task_struct struct task_struct
{ {
const char *task_name; const char *task_name;
@ -1282,7 +1226,19 @@ typedef struct net_device *_nic_hdl;
uint32_t rx_overflow; 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 { struct phy_info {
uint8_t RxPWDBAll; uint8_t RxPWDBAll;
uint8_t SignalQuality; uint8_t SignalQuality;
@ -1358,7 +1314,7 @@ union {
uint32_t mem[32]; uint32_t mem[32];
}; };
}; };
/*
union $AB04817EA6EB89125E28056B7464A4D7 { union $AB04817EA6EB89125E28056B7464A4D7 {
_list list; _list list;
struct recv_frame_hdr hdr; struct recv_frame_hdr hdr;
@ -1369,7 +1325,8 @@ union recv_frame {
union $AB04817EA6EB89125E28056B7464A4D7 u; union $AB04817EA6EB89125E28056B7464A4D7 u;
}; };
*/ */
/* skbuff.h /*
// skbuff.h
struct sk_buff struct sk_buff
{ {
struct sk_buff *next; struct sk_buff *next;
@ -1390,7 +1347,7 @@ union recv_frame {
uint32_t qlen; uint32_t qlen;
}; };
*/ */
/* rtw_xmit.h
struct tx_servq { struct tx_servq {
_list tx_pending; _list tx_pending;
_queue sta_pending; _queue sta_pending;
@ -1409,12 +1366,6 @@ struct sta_xmit_priv {
_list apsd; _list apsd;
uint16_t txseq_tid[16]; uint16_t txseq_tid[16];
}; };
*/
/* rtw_recv.h
struct recv_buf_stat {
uint32_t rxdw0;
uint32_t rxdw1;
};
struct stainfo_rxcache { struct stainfo_rxcache {
uint16_t tid_rxseq[16]; uint16_t tid_rxseq[16];
@ -1426,8 +1377,7 @@ struct sta_recv_priv {
_queue defrag_q; _queue defrag_q;
struct stainfo_rxcache rxcache; struct stainfo_rxcache rxcache;
}; };
*/
/* sta_info.h
struct stainfo_stats { struct stainfo_stats {
u8Byte rx_mgnt_pkts; u8Byte rx_mgnt_pkts;
u8Byte rx_ctrl_pkts; u8Byte rx_ctrl_pkts;
@ -1525,15 +1475,20 @@ struct sta_info {
uint8_t RXEVM[4]; uint8_t RXEVM[4];
uint8_t RXSNR[4]; uint8_t RXSNR[4];
}; };
*/ /*
/* wifi_conf.h // wifi_conf.h
struct _atr_aligned4_ _cus_ie struct _atr_aligned4_ _cus_ie
{ {
uint8_t *ie; uint8_t *ie;
uint8_t type; uint8_t type;
}; };
*/ */
/* rtw_xmit.h
struct fifo_more_data {
uint32_t more_data;
uint32_t len;
};
struct hw_xmit { struct hw_xmit {
_queue *sta_queue; _queue *sta_queue;
int accnt; int accnt;
@ -1549,8 +1504,12 @@ struct tx_buf_desc {
uint32_t txdw6; uint32_t txdw6;
uint32_t txdw7; uint32_t txdw7;
}; };
*/
/* rtw_psk.h struct recv_buf_stat {
uint32_t rxdw0;
uint32_t rxdw1;
};
struct _wpa_sta_info { struct _wpa_sta_info {
int state; int state;
int gstate; int gstate;
@ -1577,8 +1536,7 @@ struct _wpa_sta_info {
int clientGkeyUpdate; int clientGkeyUpdate;
LARGE_INTEGER clientMICReportReplayCounter; LARGE_INTEGER clientMICReportReplayCounter;
}; };
*/
/* rtw_xmit.h
struct pkt_attrib { struct pkt_attrib {
uint8_t type; uint8_t type;
uint8_t subtype; uint8_t subtype;
@ -1669,7 +1627,6 @@ struct submit_ctx {
uint32_t timeout_ms; uint32_t timeout_ms;
int status; int status;
}; };
*/
/* /*
// wrapper.h // wrapper.h
struct net_device struct net_device
@ -1755,15 +1712,12 @@ struct submit_ctx {
union iwreq_data u; union iwreq_data u;
}; };
*/ */
/* drv_types.h
struct co_data_priv { struct co_data_priv {
uint8_t co_ch; uint8_t co_ch;
uint8_t co_bw; uint8_t co_bw;
uint8_t co_ch_offset; uint8_t co_ch_offset;
uint8_t rsvd; uint8_t rsvd;
}; };
*/
/* hal_intf.h
enum _HARDWARE_TYPE // : sint32_t enum _HARDWARE_TYPE // : sint32_t
{ {
@ -1805,8 +1759,7 @@ enum _HARDWARE_TYPE // : sint32_t
HARDWARE_TYPE_RTL8188FS = 0x23, HARDWARE_TYPE_RTL8188FS = 0x23,
HARDWARE_TYPE_MAX = 0x24, HARDWARE_TYPE_MAX = 0x24,
}; };
*/
/* hal_phy.h
struct RF_Shadow_Compare_Map { struct RF_Shadow_Compare_Map {
uint32_t Value; uint32_t Value;
uint8_t Compare; uint8_t Compare;
@ -1815,8 +1768,7 @@ struct RF_Shadow_Compare_Map {
uint8_t Driver_Write; uint8_t Driver_Write;
}; };
typedef struct RF_Shadow_Compare_Map RF_SHADOW_T; typedef struct RF_Shadow_Compare_Map RF_SHADOW_T;
*/
/* rtw_powerctrl.h
enum _PS_BBRegBackup_ // : sint32_t enum _PS_BBRegBackup_ // : sint32_t
{ {
PSBBREG_RF0 = 0x0, PSBBREG_RF0 = 0x0,
@ -1825,8 +1777,9 @@ enum _PS_BBRegBackup_ // : sint32_t
PSBBREG_AFE0 = 0x3, PSBBREG_AFE0 = 0x3,
PSBBREG_TOTALCNT = 0x4, PSBBREG_TOTALCNT = 0x4,
}; };
*/
/* hal_irqn.h /*
// hal_irqn.h
enum _IRQn_Type_ // : sint32_t enum _IRQn_Type_ // : sint32_t
{ {
NonMaskableInt_IRQn = 0xFFFFFFF2, NonMaskableInt_IRQn = 0xFFFFFFF2,
@ -1900,7 +1853,8 @@ enum _PS_BBRegBackup_ // : sint32_t
}; };
typedef struct _IRQ_HANDLE_ IRQ_HANDLE; typedef struct _IRQ_HANDLE_ IRQ_HANDLE;
*/ */
/* hal_soc_ps_monitor.h /*
// hal_soc_ps_monitor.h
struct _power_state_ struct _power_state_
{ {
uint8_t FuncIdx; uint8_t FuncIdx;
@ -1922,9 +1876,9 @@ enum _PS_BBRegBackup_ // : sint32_t
BOOL SleepFlag; BOOL SleepFlag;
}; };
typedef struct _power_mgn_ Power_Mgn; typedef struct _power_mgn_ Power_Mgn;
*/
/* hal_gpio.h /*
// hal_gpio.h
enum $E1AD70AB12E7AA6E98B8D89D9B965EB5 //: sint32_t enum $E1AD70AB12E7AA6E98B8D89D9B965EB5 //: sint32_t
{ {
_PORT_A = 0x0, _PORT_A = 0x0,
@ -1959,7 +1913,7 @@ enum _PS_BBRegBackup_ // : sint32_t
}; };
typedef struct _HAL_GPIO_ADAPTER_ *PHAL_GPIO_ADAPTER; typedef struct _HAL_GPIO_ADAPTER_ *PHAL_GPIO_ADAPTER;
*/ */
/* hal_intf.h
struct hal_ops { struct hal_ops {
uint32_t (*hal_power_on)(_adapter *); uint32_t (*hal_power_on)(_adapter *);
uint32_t (*hal_init)(_adapter *); uint32_t (*hal_init)(_adapter *);
@ -2022,8 +1976,66 @@ struct hal_ops {
uint8_t); uint8_t);
uint8_t (*hal_get_tx_buff_rsvd_page_num)(_adapter *, bool); 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 enum tag_HAL_IC_Type_Definition // : sint32_t
{ {
CHIP_8192S = 0x0, CHIP_8192S = 0x0,
@ -2092,8 +2104,7 @@ struct _atr_aligned4_ tag_HAL_VERSION {
uint8_t ROMVer; uint8_t ROMVer;
}; };
typedef struct tag_HAL_VERSION HAL_VERSION; typedef struct tag_HAL_VERSION HAL_VERSION;
*/
/* hal_intf.h
enum _HW_VARIABLES //: sint32_t enum _HW_VARIABLES //: sint32_t
{ {
HW_VAR_MEDIA_STATUS = 0x0, HW_VAR_MEDIA_STATUS = 0x0,
@ -2178,15 +2189,13 @@ enum _HW_VARIABLES //: sint32_t
HW_VAR_ASIX_IOT = 0x4F, HW_VAR_ASIX_IOT = 0x4F,
HW_VAR_PROMISC = 0x50, HW_VAR_PROMISC = 0x50,
}; };
*/
/* hal_phy.h
enum _BAND_TYPE // : sint32_t enum _BAND_TYPE // : sint32_t
{ {
BAND_ON_2_4G = 0x0, BAND_ON_5G = 0x1, BAND_ON_BOTH = 0x2, BANDMAX = 0x3, BAND_ON_2_4G = 0x0, BAND_ON_5G = 0x1, BAND_ON_BOTH = 0x2, BANDMAX = 0x3,
}; };
typedef enum _BAND_TYPE BAND_TYPE; typedef enum _BAND_TYPE BAND_TYPE;
*/
/* hal_com_phycfg.h
struct _BB_REGISTER_DEFINITION { struct _BB_REGISTER_DEFINITION {
uint32_t rfintfs; uint32_t rfintfs;
uint32_t rfintfo; uint32_t rfintfo;
@ -2197,8 +2206,7 @@ struct _BB_REGISTER_DEFINITION {
uint32_t rfLSSIReadBackPi; uint32_t rfLSSIReadBackPi;
}; };
typedef struct _BB_REGISTER_DEFINITION BB_REGISTER_DEFINITION_T; typedef struct _BB_REGISTER_DEFINITION BB_REGISTER_DEFINITION_T;
*/
/* rtw_mlme.h
enum dot11AuthAlgrthmNum //: sint32_t enum dot11AuthAlgrthmNum //: sint32_t
{ {
dot11AuthAlgrthm_Open = 0x0, dot11AuthAlgrthm_Open = 0x0,
@ -2208,8 +2216,7 @@ enum dot11AuthAlgrthmNum //: sint32_t
dot11AuthAlgrthm_WAPI = 0x4, dot11AuthAlgrthm_WAPI = 0x4,
dot11AuthAlgrthm_MaxNum = 0x5, dot11AuthAlgrthm_MaxNum = 0x5,
}; };
*/
/* rtw_mlme_ext.h
enum _RT_CHANNEL_DOMAIN //: sint32_t enum _RT_CHANNEL_DOMAIN //: sint32_t
{ {
RT_CHANNEL_DOMAIN_FCC = 0x0, RT_CHANNEL_DOMAIN_FCC = 0x0,
@ -2276,8 +2283,7 @@ enum _RT_CHANNEL_DOMAIN //: sint32_t
RT_CHANNEL_DOMAIN_MAX = 0x59, RT_CHANNEL_DOMAIN_MAX = 0x59,
RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F, RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
}; };
*/
/* freertos_intfs.h
struct _driver_priv { struct _driver_priv {
int drv_registered; int drv_registered;
_mutex hw_init_mutex; _mutex hw_init_mutex;
@ -2286,9 +2292,7 @@ struct _driver_priv {
_mutex setbw_mutex; _mutex setbw_mutex;
}; };
typedef struct _driver_priv drv_priv; typedef struct _driver_priv drv_priv;
*/
/* PhyDM_Adaptivity.h
struct _ADAPTIVITY_STATISTICS { struct _ADAPTIVITY_STATISTICS {
s1Byte TH_L2H_ini_mode2; s1Byte TH_L2H_ini_mode2;
s1Byte TH_EDCCA_HL_diff_mode2; s1Byte TH_EDCCA_HL_diff_mode2;
@ -2305,14 +2309,12 @@ struct _ADAPTIVITY_STATISTICS {
u1Byte AdajustIGILevel; u1Byte AdajustIGILevel;
}; };
typedef struct _ADAPTIVITY_STATISTICS ADAPTIVITY_STATISTICS; typedef struct _ADAPTIVITY_STATISTICS ADAPTIVITY_STATISTICS;
*/
/* phydm_NoiseMonitor.h
struct _ODM_NOISE_MONITOR_ { struct _ODM_NOISE_MONITOR_ {
s1Byte noise[1]; s1Byte noise[1];
s2Byte noise_all; s2Byte noise_all;
}; };
typedef struct _ODM_NOISE_MONITOR_ ODM_NOISE_MONITOR; typedef struct _ODM_NOISE_MONITOR_ ODM_NOISE_MONITOR;
*/
/* in rtl_bios_data.h /* in rtl_bios_data.h
struct _FALSE_ALARM_STATISTICS { struct _FALSE_ALARM_STATISTICS {
u4Byte Cnt_Parity_Fail; u4Byte Cnt_Parity_Fail;
@ -2333,13 +2335,13 @@ struct _FALSE_ALARM_STATISTICS {
}; };
typedef struct _FALSE_ALARM_STATISTICS FALSE_ALARM_STATISTICS; typedef struct _FALSE_ALARM_STATISTICS FALSE_ALARM_STATISTICS;
*/ */
/* phydm.h
enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE //: sint32_t enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE //: sint32_t
{ {
PHY_REG_PG_RELATIVE_VALUE = 0x0, PHY_REG_PG_EXACT_VALUE = 0x1, 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; typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE PHY_REG_PG_TYPE;
*/
/* in rtl_bios_data.h /* in rtl_bios_data.h
struct _atr_aligned4_ _CFO_TRACKING_ { struct _atr_aligned4_ _CFO_TRACKING_ {
BOOLEAN bATCStatus; BOOLEAN bATCStatus;
@ -2368,13 +2370,11 @@ struct _atr_aligned8_ _ROM_INFO {
}; };
typedef struct _ROM_INFO ROM_INFO; typedef struct _ROM_INFO ROM_INFO;
*/ */
/* ROM_RTL8195A_PHYDM.h
typedef struct _ROM_INFO *PROM_INFO; typedef struct _ROM_INFO *PROM_INFO;
*/
/* phydm_types.h
typedef struct sta_info *PSTA_INFO_T; typedef struct sta_info *PSTA_INFO_T;
*/
/* phydm.h
struct _ODM_Phy_Dbg_Info_ { struct _ODM_Phy_Dbg_Info_ {
s1Byte RxSNRdB[4]; s1Byte RxSNRdB[4];
u4Byte NumQryPhyStatus; u4Byte NumQryPhyStatus;
@ -2717,73 +2717,7 @@ struct _atr_aligned8_ ODM_RF_Calibration_Structure {
u4Byte DpkThermal[4]; u4Byte DpkThermal[4];
}; };
typedef struct ODM_RF_Calibration_Structure ODM_RF_CAL_T; 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 { struct _atr_aligned8_ DM_Out_Source_Dynamic_Mechanism_Structure {
PADAPTER Adapter; PADAPTER Adapter;
BOOLEAN odm_ready; 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 DM_ODM_T;
typedef struct DM_Out_Source_Dynamic_Mechanism_Structure *PDM_ODM_T; typedef struct DM_Out_Source_Dynamic_Mechanism_Structure *PDM_ODM_T;
*/
/* halphy
enum _PWRTRACK_CONTROL_METHOD //: sint32_t enum _PWRTRACK_CONTROL_METHOD //: sint32_t
{ {
BBSWING = 0x0, TXAGC = 0x1, MIX_MODE = 0x2, BBSWING = 0x0, TXAGC = 0x1, MIX_MODE = 0x2,
@ -3006,9 +2939,7 @@ struct _H2CParam_RsvdPage_ {
}; };
typedef struct _H2CParam_RsvdPage_ H2CParam_RsvdPage; typedef struct _H2CParam_RsvdPage_ H2CParam_RsvdPage;
typedef struct _H2CParam_RsvdPage_ *PH2CParam_RsvdPage; typedef struct _H2CParam_RsvdPage_ *PH2CParam_RsvdPage;
*/
/* wlan_bssdef.h
struct _NDIS_802_11_VARIABLE_IEs { struct _NDIS_802_11_VARIABLE_IEs {
uint8_t ElementID; uint8_t ElementID;
uint8_t Length; uint8_t Length;
@ -3046,7 +2977,6 @@ enum _NDIS_802_11_WEP_STATUS //: sint32_t
Ndis802_11_EncrypteionWAPI = 0x8, Ndis802_11_EncrypteionWAPI = 0x8,
}; };
typedef enum _NDIS_802_11_WEP_STATUS NDIS_802_11_WEP_STATUS; typedef enum _NDIS_802_11_WEP_STATUS NDIS_802_11_WEP_STATUS;
*/
struct __attribute__((packed)) __attribute__((aligned(1))) rtk_sc { struct __attribute__((packed)) __attribute__((aligned(1))) rtk_sc {
u8 pattern_type; u8 pattern_type;
@ -3093,7 +3023,7 @@ struct pattern_ops {
sc_decode_profile_call_back decode_profile; sc_decode_profile_call_back decode_profile;
sc_get_tlv_info_call_back get_tlv_info; sc_get_tlv_info_call_back get_tlv_info;
}; };
/* halpower
struct _atr_aligned2_ _WL_PWR_CFG_ { // __attribute__((packed))!? struct _atr_aligned2_ _WL_PWR_CFG_ { // __attribute__((packed))!?
uint16_t offset; uint16_t offset;
uint8_t cut_msk; uint8_t cut_msk;
@ -3105,21 +3035,17 @@ struct _atr_aligned2_ _WL_PWR_CFG_ { // __attribute__((packed))!?
uint8_t value; uint8_t value;
}; };
typedef struct _WL_PWR_CFG_ WLAN_PWR_CFG; typedef struct _WL_PWR_CFG_ WLAN_PWR_CFG;
*/
/* rtw_mlme.h
struct cmd_hdl { struct cmd_hdl {
uint32_t parmsize; uint32_t parmsize;
uint8_t (*h2cfuns)(struct _ADAPTER *, uint8_t *); uint8_t (*h2cfuns)(struct _ADAPTER *, uint8_t *);
}; };
*/
/* rtw_cmd.h
struct _cmd_callback { struct _cmd_callback {
uint32_t cmd_code; uint32_t cmd_code;
void (*callback)(_adapter *, struct cmd_obj *); void (*callback)(_adapter *, struct cmd_obj *);
}; };
*/
/* phydm.h
enum _ODM_Common_Info_Definition //: sint32_t enum _ODM_Common_Info_Definition //: sint32_t
{ {
ODM_CMNINFO_PLATFORM = 0x0, ODM_CMNINFO_PLATFORM = 0x0,
@ -3225,15 +3151,13 @@ enum _ODM_Support_Ability_Definition // : sint32_t
ODM_RF_RX_GAIN_TRACK = 0x2000000, ODM_RF_RX_GAIN_TRACK = 0x2000000,
ODM_RF_CALIBRATION = 0x4000000, ODM_RF_CALIBRATION = 0x4000000,
}; };
*/
/* hal_phy.h
enum _RF_PATH //: sint32_t enum _RF_PATH //: sint32_t
{ {
RF_PATH_A = 0x0, RF_PATH_B = 0x1, RF_PATH_C = 0x2, RF_PATH_D = 0x3, RF_PATH_A = 0x0, RF_PATH_B = 0x1, RF_PATH_C = 0x2, RF_PATH_D = 0x3,
}; };
typedef enum _RF_PATH RF_PATH; typedef enum _RF_PATH RF_PATH;
*/
/* rtw_cmd.h
enum _EXTCHNL_OFFSET //: sint32_t enum _EXTCHNL_OFFSET //: sint32_t
{ {
EXTCHNL_OFFSET_NO_EXT = 0x0, EXTCHNL_OFFSET_NO_EXT = 0x0,
@ -3332,8 +3256,7 @@ enum MGN_RATE //: sint32_t
MGN_VHT4SS_MCS9 = 0xC7, MGN_VHT4SS_MCS9 = 0xC7,
MGN_UNKNOWN = 0xC8, MGN_UNKNOWN = 0xC8,
}; };
*/
/* rtw_mlme.h rtw_mlme_ext.h
struct _RT_CHANNEL_PLAN_2G { struct _RT_CHANNEL_PLAN_2G {
uint8_t Channel[14]; uint8_t Channel[14];
uint8_t Len; uint8_t Len;
@ -3353,14 +3276,12 @@ struct mlme_handler {
uint32_t num; uint32_t num;
uint32_t (*func)(_adapter *, struct recv_frame *); uint32_t (*func)(_adapter *, struct recv_frame *);
}; };
*/
/* rtw_event.h
struct fwevent { struct fwevent {
uint32_t parmsize; uint32_t parmsize;
void (*event_callback)(_adapter *, uint8_t *); void (*event_callback)(_adapter *, uint8_t *);
}; };
*/
/* rtw_recv.h
struct recv_buf { struct recv_buf {
_list list; _list list;
PADAPTER adapter; PADAPTER adapter;
@ -3381,8 +3302,7 @@ struct recv_reorder_ctrl {
_queue pending_recvframe_queue; _queue pending_recvframe_queue;
_timer reordering_ctrl_timer; _timer reordering_ctrl_timer;
}; };
*/
/* phydm.h
enum _ODM_RF_RADIO_PATH // : sint32_t enum _ODM_RF_RADIO_PATH // : sint32_t
{ {
ODM_RF_PATH_A = 0x0, ODM_RF_PATH_A = 0x0,
@ -3483,8 +3403,7 @@ enum _ODM_FW_Config_Type //: sint32_t
CONFIG_FW_BT = 0x7, CONFIG_FW_BT = 0x7,
}; };
typedef enum _ODM_FW_Config_Type ODM_FW_Config_Type; typedef enum _ODM_FW_Config_Type ODM_FW_Config_Type;
*/
/* hal_com_phycfg.h
enum _RATE_SECTION //: sint32_t enum _RATE_SECTION //: sint32_t
{ {
CCK = 0x0, CCK = 0x0,
@ -3499,8 +3418,12 @@ enum _RATE_SECTION //: sint32_t
VHT_4SSMCS0_4SSMCS9 = 0x9, VHT_4SSMCS0_4SSMCS9 = 0x9,
}; };
typedef enum _RATE_SECTION RATE_SECTION; typedef enum _RATE_SECTION RATE_SECTION;
*/
/* hal_pg.h struct map_mask_s {
uint16_t mask_start;
uint16_t mask_end;
};
struct _TxPowerInfo24G { struct _TxPowerInfo24G {
uint8_t IndexCCK_Base[1][6]; uint8_t IndexCCK_Base[1][6];
uint8_t IndexBW40_Base[1][6]; uint8_t IndexBW40_Base[1][6];
@ -3509,69 +3432,6 @@ struct _TxPowerInfo24G {
}; };
typedef struct _TxPowerInfo24G TxPowerInfo24G; typedef struct _TxPowerInfo24G TxPowerInfo24G;
typedef struct _TxPowerInfo24G *PTxPowerInfo24G; 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 #endif // _WLAN_LIB_H

View file

@ -31,7 +31,7 @@ extern "C" {
#endif #endif
#if defined(__IAR_SYSTEMS_ICC__) #if defined(__IAR_SYSTEMS_ICC__)
//#pragma pack(1) #pragma pack(1)
#endif #endif
/** /**
@ -86,7 +86,7 @@ typedef struct rtw_network_info {
int key_id; int key_id;
}rtw_network_info_t; }rtw_network_info_t;
#if defined(__IAR_SYSTEMS_ICC__)// || defined(__GNUC__) #if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack(1) #pragma pack(1)
#endif #endif
@ -103,7 +103,7 @@ typedef struct rtw_scan_result {
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_802_11_band_t band; /**< Radio band */
} rtw_scan_result_t; } rtw_scan_result_t;
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__) #if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack() #pragma pack()
#endif #endif
@ -117,7 +117,7 @@ typedef struct rtw_scan_handler_result {
} rtw_scan_handler_result_t; } rtw_scan_handler_result_t;
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__) #if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack(1) #pragma pack(1)
#endif #endif
@ -132,7 +132,7 @@ typedef struct rtw_wifi_setting {
unsigned char password[65]; unsigned char password[65];
unsigned char key_idx; unsigned char key_idx;
}rtw_wifi_setting_t; }rtw_wifi_setting_t;
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__) #if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
#pragma pack() #pragma pack()
#endif #endif

View file

@ -1277,7 +1277,7 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
//-----------HOOK BEFORE REG INIT-----------// //-----------HOOK BEFORE REG INIT-----------//
// ODM Platform info AP/ADSL/CE/MP = 1/2/3/4 // ODM Platform info AP/ADSL/CE/MP = 1/2/3/4
u1Byte SupportPlatform; 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; u4Byte SupportAbility;
// ODM PCIE/USB/SDIO = 1/2/3 // ODM PCIE/USB/SDIO = 1/2/3
u1Byte SupportInterface; u1Byte SupportInterface;

View file

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

View file

@ -449,8 +449,6 @@ void del_timer_sync(struct timer_list * timer);
void init_timer_wrapper(void); void init_timer_wrapper(void);
void deinit_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_init_timer(_timer *ptimer, void *adapter, TIMER_FUN pfunc,void* cntx, const char *name);
void rtw_set_timer(_timer *ptimer,u32 delay_time); void rtw_set_timer(_timer *ptimer,u32 delay_time);
u8 rtw_cancel_timer(_timer *ptimer); 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){ if(load_default == _TRUE){
// load default setting // load default setting
uartconf->BaudRate = UART_BAUD_RATE_38400; uartconf->BaudRate = DEFAULT_BAUDRATE;
uartconf->DataBits = 8; uartconf->DataBits = 8;
uartconf->Parity = ParityNone; uartconf->Parity = ParityNone;
uartconf->StopBits = 1; uartconf->StopBits = 1;

View file

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

View file

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

View file

@ -26,19 +26,19 @@ extern "C" {
typedef struct pwmout_s pwmout_t; 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_free (pwmout_t* obj);
void pwmout_write (pwmout_t* obj, float percent); //void pwmout_write (pwmout_t* obj, float percent);
float pwmout_read (pwmout_t* obj); //float pwmout_read (pwmout_t* obj);
void pwmout_period (pwmout_t* obj, float seconds); //void pwmout_period (pwmout_t* obj, float seconds);
void pwmout_period_ms (pwmout_t* obj, int ms); //void pwmout_period_ms (pwmout_t* obj, int ms);
void pwmout_period_us (pwmout_t* obj, int us); void pwmout_period_us (pwmout_t* obj, uint32_t us);
void pwmout_pulsewidth (pwmout_t* obj, float seconds); //void pwmout_pulsewidth (pwmout_t* obj, float seconds);
void pwmout_pulsewidth_ms(pwmout_t* obj, int ms); //void pwmout_pulsewidth_ms(pwmout_t* obj, uint32_t ms);
void pwmout_pulsewidth_us(pwmout_t* obj, int us); void pwmout_pulsewidth_us(pwmout_t* obj, uint32_t us);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -119,6 +119,14 @@ void analogin_init (analogin_t *obj, PinName pin){
float analogin_read(analogin_t *obj){ float analogin_read(analogin_t *obj){
float value; 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 AnaloginTmp[2] = {0,0};
uint32_t AnaloginDatMsk = 0xFFFF; uint32_t AnaloginDatMsk = 0xFFFF;
uint8_t AnaloginIdx = 0; uint8_t AnaloginIdx = 0;
@ -144,9 +152,18 @@ float analogin_read(analogin_t *obj){
value = (float)(AnalogDat) / (float)(AnalogDatFull); value = (float)(AnalogDat) / (float)(AnalogDatFull);
return (float)value; return (float)value;
*/
} }
uint16_t analogin_read_u16(analogin_t *obj){ 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 AnaloginTmp[2] = {0,0};
uint32_t AnaloginDatMsk = 0xFFFF; uint32_t AnaloginDatMsk = 0xFFFF;
uint8_t AnaloginIdx = 0; uint8_t AnaloginIdx = 0;
@ -166,20 +183,23 @@ uint16_t analogin_read_u16(analogin_t *obj){
AnalogDat = AnaloginTmp[(AnaloginIdx/2)]; AnalogDat = AnaloginTmp[(AnaloginIdx/2)];
AnalogDat = (AnalogDat & AnaloginDatMsk); AnalogDat = (AnalogDat & AnaloginDatMsk);
AnalogDat = (AnalogDat>>((u32)(16*(AnaloginIdx&0x01)))); AnalogDat = (AnalogDat>>((u32)(16*(AnaloginIdx&0x01))));
return (uint16_t)AnalogDat; return (uint16_t)AnalogDat;
*/
} }
void analogin_deinit(analogin_t *obj){ void analogin_deinit(analogin_t *obj){
/*
PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL; PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL;
PSAL_ADC_HND pSalADCHND = NULL; PSAL_ADC_HND pSalADCHND = NULL;
pSalADCMngtAdpt = &(obj->SalADCMngtAdpt); pSalADCMngtAdpt = &(obj->SalADCMngtAdpt);
pSalADCHND = &(pSalADCMngtAdpt->pSalHndPriv->SalADCHndPriv); p = &(pSalADCMngtAdpt->pSalHndPriv->SalADCHndPriv); */
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
/* To deinit analogin */ /* To deinit analogin */
RtkADCDeInit(pSalADCHND); RtkADCDeInit(p);
} }
#endif #endif

View file

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

View file

@ -3,9 +3,8 @@
* Copyright (c) 2014, Realtek Semiconductor Corp. * Copyright (c) 2014, Realtek Semiconductor Corp.
* All rights reserved. * 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" #include "device.h"
@ -19,7 +18,9 @@
#include "pwmout_api.h" #include "pwmout_api.h"
#include "objects.h" #include "objects.h"
static const PinMap PinMap_PWM[] = { extern u32 gTimerRecord;
const PinMap PinMap_PWM[] = {
{PB_4, RTL_PIN_PERI(PWM0, 0, S0), RTL_PIN_FUNC(PWM0, S0)}, {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_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)}, {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} {NC, NC, 0}
}; };
void pwmout_init(pwmout_t* obj, PinName pin) int pwmout_init(pwmout_t* obj, PinName pin)
{ {
uint32_t peripheral; uint32_t peripheral;
u32 pwm_idx; u32 pwm_idx;
@ -56,7 +57,7 @@ void pwmout_init(pwmout_t* obj, PinName pin)
if (unlikely(peripheral == NC)) { if (unlikely(peripheral == NC)) {
DBG_PWM_ERR("%s: Cannot find matched pwm for this pin(0x%x)\n", __FUNCTION__, pin); 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); 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->pin_sel = pin_sel;
obj->period = 0; obj->period = 0;
obj->pulse = 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)) { if (HAL_OK != HAL_Pwm_Init(&obj->pwm_hal_adp, pwm_idx, pin_sel)) {
DBG_PWM_ERR("pwmout_init Err!\n"); DBG_PWM_ERR("pwmout_init Err!\n");
return; return -1;
} }
pwmout_period_us(obj, 20000); // 20 ms per default // pwmout_period_us(obj, 20000); // 20 ms per default
HAL_Pwm_Enable(&obj->pwm_hal_adp); // HAL_Pwm_Enable(&obj->pwm_hal_adp);
return 0;
} }
void pwmout_free(pwmout_t* obj) void pwmout_free(pwmout_t* obj)
{ {
HAL_Pwm_Disable(&obj->pwm_hal_adp); 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);
}
float pwmout_read(pwmout_t* obj)
{
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; obj->period = us;
// Set duty cycle again HAL_Pwm_SetDuty(&obj->pwm_hal_adp, us, obj->pulse);
pwmout_write(obj, dc);
} }
void pwmout_pulsewidth(pwmout_t* obj, float seconds) void pwmout_pulsewidth_us(pwmout_t* obj, uint32_t us)
{ {
pwmout_pulsewidth_us(obj, (int)(seconds * 1000000.0f)); obj->pulse = us;
} if(us > obj->period) obj->period = us;
HAL_Pwm_SetDuty(&obj->pwm_hal_adp, obj->period, us);
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);
} }
#endif // #ifdef CONFIG_PWM_EN #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) void sys_adc_calibration(u8 write, u16 *offset, u16 *gain)
{ {
flash_t flash; extern flash_t flash;
u8* pbuf;
if(write){ if(write){
// backup // backup
pbuf = RtlMalloc(FLASH_SECTOR_SIZE); u8 *pbuf = RtlMalloc(FLASH_SECTOR_SIZE);
if(!pbuf) return; if(!pbuf) return;
device_mutex_lock(RT_DEV_LOCK_FLASH); device_mutex_lock(RT_DEV_LOCK_FLASH);
flash_stream_read(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf); 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_erase_sector(&flash, FLASH_RESERVED_DATA_BASE);
flash_stream_write(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf); flash_stream_write(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf);
// Write // 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_erase_sector(&flash, FLASH_SYSTEM_DATA_ADDR);
flash_stream_write(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf); flash_stream_write(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf);
device_mutex_unlock(RT_DEV_LOCK_FLASH); device_mutex_unlock(RT_DEV_LOCK_FLASH);

View file

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

View file

@ -184,7 +184,6 @@ void
lwip_socket_init(void) lwip_socket_init(void)
{ {
} }
/** /**
* Map a externally used socket index to the internal socket representation. * Map a externally used socket index to the internal socket representation.
* *
@ -213,6 +212,14 @@ get_socket(int s)
return sock; 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 * 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_ioctl(int s, long cmd, void *argp);
int lwip_fcntl(int s, int cmd, int val); int lwip_fcntl(int s, int cmd, int val);
int lwip_last_err_socket(int s); // errno
#if LWIP_COMPAT_SOCKETS #if LWIP_COMPAT_SOCKETS
#define accept(a,b,c) lwip_accept(a,b,c) #define accept(a,b,c) lwip_accept(a,b,c)
#define bind(a,b,c) lwip_bind(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 select(a,b,c,d,e) lwip_select(a,b,c,d,e)
#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c) #define ioctlsocket(a,b,c) lwip_ioctl(a,b,c)
#if LWIP_POSIX_SOCKETS_IO_NAMES #if LWIP_POSIX_SOCKETS_IO_NAMES
#define read(a,b,c) lwip_read(a,b,c) #define read(a,b,c) lwip_read(a,b,c)
#define write(a,b,c) lwip_write(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" # include "arch/epstruct.h"
#endif #endif
LOCAL char toupper(char ch) { //#define toupper(CH) \
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch); // (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
}
/** NetBIOS decoding name */ /** 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; uint8_t i, j;
char c; char c;
@ -218,7 +217,7 @@ static void NBNS_encode(char *dst, char *src, uint8_t type)
#endif #endif
/** NetBIOS Name service recv callback */ /** 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, netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
u16_t port) { u16_t port) {
LWIP_UNUSED_ARG(arg); 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) { if (current_netif != NULL && current_netif->num < NET_IF_NUM) {
uint32 ip = current_netif->ip_addr.addr; uint32 ip = current_netif->ip_addr.addr;
char *curbiosname = netbios_name[current_netif->num]; 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 */ /* we only answer if we got a default interface */
&& (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети && (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети
#if DEBUGSOO > 3 #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; struct udp_pcb *pcb;
for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) { for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
if (pcb->local_port == NETBIOS_PORT) if (pcb->local_port == NETBIOS_PORT)

View file

@ -8,7 +8,6 @@
/****************Define if using the polarssl*******************/ /****************Define if using the polarssl*******************/
#define USING_SSL #define USING_SSL
/******************Define the function used*********************/ /******************Define the function used*********************/
#ifdef USING_SSL #ifdef USING_SSL
int wss_set_fun_ops(wsclient_context *wsclient); int wss_set_fun_ops(wsclient_context *wsclient);
@ -19,9 +18,6 @@ int ws_set_fun_ops(wsclient_context *wsclient);
#endif #endif
/***************************************************************/ /***************************************************************/
/************************************************************************************************* /*************************************************************************************************
** Function Name : create_wsclient ** Function Name : create_wsclient
** Description : Creating the websocket client context structure ** Description : Creating the websocket client context structure

View file

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

View file

@ -74,7 +74,7 @@ static int inHandlerMode (void)
#if configSignalManagementSupport // the older FreeRTOS version didn't support Signal Management functions #if configSignalManagementSupport // the older FreeRTOS version didn't support Signal Management functions
static void add_thread_signal_map (osThreadId thread_id, EventGroupHandle_t signals) static void add_thread_signal_map (osThreadId thread_id, EventGroupHandle_t signals)
{ {
uint32_t dummy; int dummy;
// uint32_t i; // uint32_t i;
ThreadSignalRec *prec_entity; ThreadSignalRec *prec_entity;
@ -135,7 +135,7 @@ static EventGroupHandle_t find_signal_by_thread (osThreadId thread_id)
{ {
EventGroupHandle_t signals_hdl=NULL; EventGroupHandle_t signals_hdl=NULL;
// uint32_t i; // uint32_t i;
uint32_t dummy; int dummy;
ThreadSignalRec *prec_entity; ThreadSignalRec *prec_entity;
if (inHandlerMode()) { if (inHandlerMode()) {
@ -185,7 +185,7 @@ static EventGroupHandle_t remove_thread_signal_map (osThreadId thread_id)
{ {
EventGroupHandle_t signals_hdl=NULL; EventGroupHandle_t signals_hdl=NULL;
// uint32_t i; // uint32_t i;
uint32_t dummy; int dummy;
ThreadSignalRec *prec_entity; ThreadSignalRec *prec_entity;
ThreadSignalRec *pprev_entity; ThreadSignalRec *pprev_entity;
@ -989,7 +989,7 @@ osPoolId osPoolCreate (const osPoolDef_t *pool_def)
/// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS. /// \note MUST REMAIN UNCHANGED: \b osPoolAlloc shall be consistent in every CMSIS-RTOS.
void *osPoolAlloc (osPoolId pool_id) void *osPoolAlloc (osPoolId pool_id)
{ {
uint32_t dummy; int dummy;
void *p = NULL; void *p = NULL;
uint32_t i; uint32_t i;
uint32_t index; uint32_t index;
@ -1047,7 +1047,7 @@ void *osPoolCAlloc (osPoolId pool_id)
/// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS. /// \note MUST REMAIN UNCHANGED: \b osPoolFree shall be consistent in every CMSIS-RTOS.
osStatus osPoolFree (osPoolId pool_id, void *block) osStatus osPoolFree (osPoolId pool_id, void *block)
{ {
uint32_t dummy; int dummy;
uint32_t index; uint32_t index;
if (pool_id == NULL) { if (pool_id == NULL) {

View file

@ -111,7 +111,6 @@
#include "platform_autoconf.h" #include "platform_autoconf.h"
#include "hal_misc.h" #include "hal_misc.h"
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
all the API functions to use the MPU wrappers. That should only be done when all the API functions to use the MPU wrappers. That should only be done when
task.h is included from an application file. */ task.h is included from an application file. */
@ -130,8 +129,7 @@ task.h is included from an application file. */
/* Define the linked list structure. This is used to link free blocks in order /* Define the linked list structure. This is used to link free blocks in order
of their memory address. */ of their memory address. */
typedef struct A_BLOCK_LINK typedef struct A_BLOCK_LINK {
{
struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */ struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */
size_t xBlockSize; /*<< The size of the free block. */ size_t xBlockSize; /*<< The size of the free block. */
} BlockLink_t; } BlockLink_t;
@ -150,7 +148,8 @@ static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert );
/* The size of the structure placed at the beginning of each allocated memory /* The size of the structure placed at the beginning of each allocated memory
block must by correctly byte aligned. */ block must by correctly byte aligned. */
static const uint32_t uxHeapStructSize = ( ( sizeof ( BlockLink_t ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK ); static const uint32_t uxHeapStructSize = ((sizeof(BlockLink_t)
+ ( portBYTE_ALIGNMENT - 1)) & ~portBYTE_ALIGNMENT_MASK);
/* Create a couple of list links to mark the start and end of the list. */ /* Create a couple of list links to mark the start and end of the list. */
static BlockLink_t xStart, *pxEnd = NULL; static BlockLink_t xStart, *pxEnd = NULL;
@ -169,6 +168,7 @@ space. */
#define xBlockAllocatedBit (( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 )) #define xBlockAllocatedBit (( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 ))
/* Realtek test code start */ /* Realtek test code start */
//TODO: remove section when combine BD and BF
#if (defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)) #if (defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B))
#include "section_config.h" #include "section_config.h"
SRAM_HEAP_SECTION SRAM_HEAP_SECTION
@ -206,27 +206,28 @@ HeapRegion_t xHeapRegions[] =
/* /*
Dump xBlock list Dump xBlock list
*/ */
void dump_mem_block_list(void) void dump_mem_block_list(void) {
{ if (pxEnd == NULL)
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions ); vPortDefineHeapRegions(xHeapRegions);
#if CONFIG_DEBUG_LOG > 1 #if CONFIG_DEBUG_LOG > 1
// if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions ); // test code start // if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions ); // test code start
BlockLink_t *pxBlock = &xStart; BlockLink_t *pxBlock = &xStart;
int count = 0; int count = 0;
DBG_8195A("RAM Free Heap Memory List:\n"); DBG_8195A("RAM Free Heap Memory List:\n");
for(pxBlock = pxBlock->pxNextFreeBlock; pxBlock->pxNextFreeBlock != NULL; pxBlock = pxBlock->pxNextFreeBlock) { for (pxBlock = pxBlock->pxNextFreeBlock; pxBlock->pxNextFreeBlock != NULL;
pxBlock = pxBlock->pxNextFreeBlock) {
DBG_8195A(" [%d]=%p, %d\n", ++count, pxBlock, pxBlock->xBlockSize); DBG_8195A(" [%d]=%p, %d\n", ++count, pxBlock, pxBlock->xBlockSize);
} }
#endif #endif
} }
void *pvPortMalloc( size_t xWantedSize ) void *pvPortMalloc(size_t xWantedSize) {
{
BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink; BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
void *pvReturn = NULL; void *pvReturn = NULL;
/* Realtek test code start */ /* Realtek test code start */
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions ); if (pxEnd == NULL)
vPortDefineHeapRegions(xHeapRegions);
/* Realtek test code end */ /* Realtek test code end */
/* The heap must be initialised before the first call to /* The heap must be initialised before the first call to
@ -239,50 +240,44 @@ void *pvReturn = NULL;
set. The top bit of the block size member of the BlockLink_t structure set. The top bit of the block size member of the BlockLink_t structure
is used to determine who owns the block - the application or the is used to determine who owns the block - the application or the
kernel, so it must be free. */ kernel, so it must be free. */
if( ( xWantedSize & xBlockAllocatedBit ) == 0 ) if ((xWantedSize & xBlockAllocatedBit) == 0) {
{
/* The wanted size is increased so it can contain a BlockLink_t /* The wanted size is increased so it can contain a BlockLink_t
structure in addition to the requested amount of bytes. */ structure in addition to the requested amount of bytes. */
if( xWantedSize > 0 ) if (xWantedSize > 0) {
{
xWantedSize += uxHeapStructSize; xWantedSize += uxHeapStructSize;
/* Ensure that blocks are always aligned to the required number /* Ensure that blocks are always aligned to the required number
of bytes. */ of bytes. */
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 ) if ((xWantedSize & portBYTE_ALIGNMENT_MASK) != 0x00) {
{
/* Byte alignment required. */ /* Byte alignment required. */
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); xWantedSize += ( portBYTE_ALIGNMENT
} - (xWantedSize & portBYTE_ALIGNMENT_MASK));
else } else {
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) ) if ((xWantedSize > 0) && (xWantedSize <= xFreeBytesRemaining)) {
{
/* Traverse the list from the start (lowest address) block until /* Traverse the list from the start (lowest address) block until
one of adequate size is found. */ one of adequate size is found. */
pxPreviousBlock = &xStart; pxPreviousBlock = &xStart;
pxBlock = xStart.pxNextFreeBlock; pxBlock = xStart.pxNextFreeBlock;
while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) ) while ((pxBlock->xBlockSize < xWantedSize)
{ && (pxBlock->pxNextFreeBlock != NULL)) {
pxPreviousBlock = pxBlock; pxPreviousBlock = pxBlock;
pxBlock = pxBlock->pxNextFreeBlock; pxBlock = pxBlock->pxNextFreeBlock;
} }
/* If the end marker was reached then a block of adequate size /* If the end marker was reached then a block of adequate size
was not found. */ was not found. */
if( pxBlock != pxEnd ) if (pxBlock != pxEnd) {
{
/* Return the memory space pointed to - jumping over the /* Return the memory space pointed to - jumping over the
BlockLink_t structure at its start. */ BlockLink_t structure at its start. */
pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + uxHeapStructSize ); pvReturn =
(void *) (((uint8_t *) pxPreviousBlock->pxNextFreeBlock)
+ uxHeapStructSize);
/* This block is being returned for use so must be taken out /* This block is being returned for use so must be taken out
of the list of free blocks. */ of the list of free blocks. */
@ -290,35 +285,32 @@ void *pvReturn = NULL;
/* If the block is larger than required it can be split into /* If the block is larger than required it can be split into
two. */ two. */
if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE ) if ((pxBlock->xBlockSize - xWantedSize)
{ > heapMINIMUM_BLOCK_SIZE) {
/* This block is to be split into two. Create a new /* This block is to be split into two. Create a new
block following the number of bytes requested. The void block following the number of bytes requested. The void
cast is used to prevent byte alignment warnings from the cast is used to prevent byte alignment warnings from the
compiler. */ compiler. */
pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize ); pxNewBlockLink = (void *) (((uint8_t *) pxBlock)
+ xWantedSize);
/* Calculate the sizes of two blocks split from the /* Calculate the sizes of two blocks split from the
single block. */ single block. */
pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize; pxNewBlockLink->xBlockSize = pxBlock->xBlockSize
- xWantedSize;
pxBlock->xBlockSize = xWantedSize; pxBlock->xBlockSize = xWantedSize;
/* Insert the new block into the list of free blocks. */ /* Insert the new block into the list of free blocks. */
prvInsertBlockIntoFreeList((pxNewBlockLink)); prvInsertBlockIntoFreeList((pxNewBlockLink));
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
xFreeBytesRemaining -= pxBlock->xBlockSize; xFreeBytesRemaining -= pxBlock->xBlockSize;
if( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining ) if (xFreeBytesRemaining < xMinimumEverFreeBytesRemaining) {
{
xMinimumEverFreeBytesRemaining = xFreeBytesRemaining; xMinimumEverFreeBytesRemaining = xFreeBytesRemaining;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
@ -326,26 +318,20 @@ void *pvReturn = NULL;
by the application and has no "next" block. */ by the application and has no "next" block. */
pxBlock->xBlockSize |= xBlockAllocatedBit; pxBlock->xBlockSize |= xBlockAllocatedBit;
pxBlock->pxNextFreeBlock = NULL; pxBlock->pxNextFreeBlock = NULL;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} } traceMALLOC( pvReturn, xWantedSize );
traceMALLOC( pvReturn, xWantedSize );
} }
(void) xTaskResumeAll(); (void) xTaskResumeAll();
if (pvReturn == NULL) { if (pvReturn == NULL) {
DBG_RAM_HEAP_WARN("ram_alloc(%d): freeSpace(%d)!\n", xWantedSize, xFreeBytesRemaining); DBG_RAM_HEAP_WARN("ram_alloc(%d): freeSpace(%d)!\n", xWantedSize,
xFreeBytesRemaining);
} else { } else {
// DBG_RAM_HEAP_INFO("ram_alloc:%p[%d]\n", pvReturn , xWantedSize); // DBG_RAM_HEAP_INFO("ram_alloc:%p[%d]\n", pvReturn , xWantedSize);
} }
@ -367,13 +353,11 @@ void *pvReturn = NULL;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void __vPortFree( void *pv ) void __vPortFree(void *pv) {
{
uint8_t *puc = (uint8_t *) pv; uint8_t *puc = (uint8_t *) pv;
BlockLink_t *pxLink; BlockLink_t *pxLink;
if( pv != NULL ) if (pv != NULL) {
{
/* The memory being freed will have an BlockLink_t structure immediately /* The memory being freed will have an BlockLink_t structure immediately
before it. */ before it. */
puc -= uxHeapStructSize; puc -= uxHeapStructSize;
@ -382,13 +366,10 @@ BlockLink_t *pxLink;
pxLink = (void *) puc; pxLink = (void *) puc;
/* Check the block is actually allocated. */ /* Check the block is actually allocated. */
configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ); configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ); configASSERT( pxLink->pxNextFreeBlock == NULL );
configASSERT( pxLink->pxNextFreeBlock == NULL );
if( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ) if ((pxLink->xBlockSize & xBlockAllocatedBit) != 0) {
{ if (pxLink->pxNextFreeBlock == NULL) {
if( pxLink->pxNextFreeBlock == NULL )
{
/* The block is being returned to the heap - it is no longer /* The block is being returned to the heap - it is no longer
allocated. */ allocated. */
pxLink->xBlockSize &= ~xBlockAllocatedBit; pxLink->xBlockSize &= ~xBlockAllocatedBit;
@ -401,14 +382,10 @@ BlockLink_t *pxLink;
prvInsertBlockIntoFreeList(((BlockLink_t *) pxLink)); prvInsertBlockIntoFreeList(((BlockLink_t *) pxLink));
} }
(void) xTaskResumeAll(); (void) xTaskResumeAll();
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
// DBG_RAM_HEAP_INFO("ram_free:%p[%d]\n", pv , pxLink->xBlockSize); // DBG_RAM_HEAP_INFO("ram_free:%p[%d]\n", pv , pxLink->xBlockSize);
@ -422,79 +399,69 @@ static void (*ext_free)( void *p ) = NULL;
uint32_t ext_upper = 0; uint32_t ext_upper = 0;
//static //static
uint32_t ext_lower = 0; uint32_t ext_lower = 0;
void vPortSetExtFree( void (*free)( void *p ), uint32_t upper, uint32_t lower ) void vPortSetExtFree(void (*free)(void *p), uint32_t upper, uint32_t lower) {
{
ext_free = free; ext_free = free;
ext_upper = upper; ext_upper = upper;
ext_lower = lower; ext_lower = lower;
} }
void vPortFree( void *pv ) void vPortFree(void *pv) {
{
if (((uint32_t) pv >= ext_lower) && ((uint32_t) pv < ext_upper)) { if (((uint32_t) pv >= ext_lower) && ((uint32_t) pv < ext_upper)) {
// use external free function // use external free function
if( ext_free ) ext_free( pv ); if (ext_free)
ext_free(pv);
} else } else
__vPortFree(pv); __vPortFree(pv);
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
size_t xPortGetFreeHeapSize( void ) size_t xPortGetFreeHeapSize(void) {
{
return xFreeBytesRemaining; return xFreeBytesRemaining;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
size_t xPortGetMinimumEverFreeHeapSize( void ) size_t xPortGetMinimumEverFreeHeapSize(void) {
{
return xMinimumEverFreeBytesRemaining; return xMinimumEverFreeBytesRemaining;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert ) static void prvInsertBlockIntoFreeList(BlockLink_t *pxBlockToInsert) {
{
BlockLink_t *pxIterator; BlockLink_t *pxIterator;
uint8_t *puc; uint8_t *puc;
/* Iterate through the list until a block is found that has a higher address /* Iterate through the list until a block is found that has a higher address
than the block being inserted. */ than the block being inserted. */
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock ) for (pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert;
{ pxIterator = pxIterator->pxNextFreeBlock) {
/* Nothing to do here, just iterate to the right position. */ /* Nothing to do here, just iterate to the right position. */
} }
/* Do the block being inserted, and the block it is being inserted after /* Do the block being inserted, and the block it is being inserted after
make a contiguous block of memory? */ make a contiguous block of memory? */
puc = (uint8_t *) pxIterator; puc = (uint8_t *) pxIterator;
if( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert ) if ((puc + pxIterator->xBlockSize) == (uint8_t *) pxBlockToInsert) {
{
pxIterator->xBlockSize += pxBlockToInsert->xBlockSize; pxIterator->xBlockSize += pxBlockToInsert->xBlockSize;
pxBlockToInsert = pxIterator; pxBlockToInsert = pxIterator;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
/* Do the block being inserted, and the block it is being inserted before /* Do the block being inserted, and the block it is being inserted before
make a contiguous block of memory? */ make a contiguous block of memory? */
puc = (uint8_t *) pxBlockToInsert; puc = (uint8_t *) pxBlockToInsert;
if( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock ) if ((puc + pxBlockToInsert->xBlockSize)
{ == (uint8_t *) pxIterator->pxNextFreeBlock) {
if( pxIterator->pxNextFreeBlock != pxEnd ) if (pxIterator->pxNextFreeBlock != pxEnd) {
{
/* Form one big block from the two blocks. */ /* Form one big block from the two blocks. */
pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize; pxBlockToInsert->xBlockSize +=
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock; pxIterator->pxNextFreeBlock->xBlockSize;
} pxBlockToInsert->pxNextFreeBlock =
else pxIterator->pxNextFreeBlock->pxNextFreeBlock;
{ } else {
pxBlockToInsert->pxNextFreeBlock = pxEnd; pxBlockToInsert->pxNextFreeBlock = pxEnd;
} }
} } else {
else
{
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock; pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
} }
@ -502,19 +469,15 @@ uint8_t *puc;
before and the block after, then it's pxNextFreeBlock pointer will have before and the block after, then it's pxNextFreeBlock pointer will have
already been set, and should not be set here as that would make it point already been set, and should not be set here as that would make it point
to itself. */ to itself. */
if( pxIterator != pxBlockToInsert ) if (pxIterator != pxBlockToInsert) {
{
pxIterator->pxNextFreeBlock = pxBlockToInsert; pxIterator->pxNextFreeBlock = pxBlockToInsert;
} } else {
else
{
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) static void vPortDefineHeapRegions(const HeapRegion_t * const pxHeapRegions) {
{
BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock; BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock;
uint8_t *pucAlignedHeap; uint8_t *pucAlignedHeap;
size_t xTotalRegionSize, xTotalHeapSize = 0; size_t xTotalRegionSize, xTotalHeapSize = 0;
@ -538,15 +501,13 @@ const HeapRegion_t *pxHeapRegion;
pxHeapRegion = &(pxHeapRegions[xDefinedRegions]); pxHeapRegion = &(pxHeapRegions[xDefinedRegions]);
uint8 chip_id = HalGetChipId(); uint8 chip_id = HalGetChipId();
while( pxHeapRegion->xSizeInBytes > 0 ) while (pxHeapRegion->xSizeInBytes > 0) {
{ if (pxHeapRegion->pucStartAddress
if(pxHeapRegion->pucStartAddress > (uint8_t *)0x20000000 > 0x20000000 && chip_id >= CHIP_ID_8711AN && chip_id <= CHIP_ID_8711AF) {
&& chip_id >= CHIP_ID_8711AN && chip_id <= CHIP_ID_8711AF) {
// pxHeapRegion->pucStartAddress = 0; // pxHeapRegion->pucStartAddress = 0;
// pxHeapRegion->xSizeInBytes = 0; // pxHeapRegion->xSizeInBytes = 0;
// DBG_8195A("ChipID: %p !\n", chip_id); // DBG_8195A("ChipID: %p !\n", chip_id);
} } else {
else {
#if CONFIG_DEBUG_LOG > 2 #if CONFIG_DEBUG_LOG > 2
DBG_8195A("Init Heap Region: %p[%d]\n", pxHeapRegion->pucStartAddress, pxHeapRegion->xSizeInBytes); DBG_8195A("Init Heap Region: %p[%d]\n", pxHeapRegion->pucStartAddress, pxHeapRegion->xSizeInBytes);
#endif #endif
@ -556,27 +517,24 @@ const HeapRegion_t *pxHeapRegion;
xTotalRegionSize = pxHeapRegion->xSizeInBytes; xTotalRegionSize = pxHeapRegion->xSizeInBytes;
/* Ensure the heap region starts on a correctly aligned boundary. */ /* Ensure the heap region starts on a correctly aligned boundary. */
ulAddress = (uint32_t) pxHeapRegion->pucStartAddress; ulAddress = (uint32_t) pxHeapRegion->pucStartAddress;
if( ( ulAddress & portBYTE_ALIGNMENT_MASK ) != 0 ) if ((ulAddress & portBYTE_ALIGNMENT_MASK) != 0) {
{
ulAddress += ( portBYTE_ALIGNMENT - 1); ulAddress += ( portBYTE_ALIGNMENT - 1);
ulAddress &= ~portBYTE_ALIGNMENT_MASK; ulAddress &= ~portBYTE_ALIGNMENT_MASK;
/* Adjust the size for the bytes lost to alignment. */ /* Adjust the size for the bytes lost to alignment. */
xTotalRegionSize -= ulAddress - ( uint32_t ) pxHeapRegion->pucStartAddress; xTotalRegionSize -= ulAddress
- (uint32_t) pxHeapRegion->pucStartAddress;
} }
pucAlignedHeap = (uint8_t *) ulAddress; pucAlignedHeap = (uint8_t *) ulAddress;
/* Set xStart if it has not already been set. */ /* Set xStart if it has not already been set. */
if( xDefinedRegions == 0 ) if (xDefinedRegions == 0) {
{
/* xStart is used to hold a pointer to the first item in the list of /* xStart is used to hold a pointer to the first item in the list of
free blocks. The void cast is used to prevent compiler warnings. */ free blocks. The void cast is used to prevent compiler warnings. */
xStart.pxNextFreeBlock = (BlockLink_t *) pucAlignedHeap; xStart.pxNextFreeBlock = (BlockLink_t *) pucAlignedHeap;
xStart.xBlockSize = (size_t) 0; xStart.xBlockSize = (size_t) 0;
} } else {
else
{
/* Should only get here if one region has already been added to the /* Should only get here if one region has already been added to the
heap. */ heap. */
configASSERT( pxEnd != NULL ); configASSERT( pxEnd != NULL );
@ -602,13 +560,13 @@ const HeapRegion_t *pxHeapRegion;
sized to take up the entire heap region minus the space taken by the sized to take up the entire heap region minus the space taken by the
free block structure. */ free block structure. */
pxFirstFreeBlockInRegion = (BlockLink_t *) pucAlignedHeap; pxFirstFreeBlockInRegion = (BlockLink_t *) pucAlignedHeap;
pxFirstFreeBlockInRegion->xBlockSize = ulAddress - ( uint32_t ) pxFirstFreeBlockInRegion; pxFirstFreeBlockInRegion->xBlockSize = ulAddress
- (uint32_t) pxFirstFreeBlockInRegion;
pxFirstFreeBlockInRegion->pxNextFreeBlock = pxEnd; pxFirstFreeBlockInRegion->pxNextFreeBlock = pxEnd;
/* If this is not the first region that makes up the entire heap space /* If this is not the first region that makes up the entire heap space
then link the previous region to this region. */ then link the previous region to this region. */
if( pxPreviousFreeBlock != NULL ) if (pxPreviousFreeBlock != NULL) {
{
pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion; pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion;
} }
@ -627,28 +585,25 @@ const HeapRegion_t *pxHeapRegion;
} }
void* pvPortReAlloc( void *pv, size_t xWantedSize ) void* pvPortReAlloc(void *pv, size_t xWantedSize) {
{
BlockLink_t *pxLink; BlockLink_t *pxLink;
if (((uint32_t) pv >= ext_lower) && ((uint32_t) pv < ext_upper)) { if (((uint32_t) pv >= ext_lower) && ((uint32_t) pv < ext_upper)) {
if( ext_free ) ext_free( pv ); if (ext_free)
ext_free(pv);
pv = NULL; pv = NULL;
} }
unsigned char *puc = (unsigned char *) pv; unsigned char *puc = (unsigned char *) pv;
if( pv ) if (pv) {
{ if (!xWantedSize) {
if( !xWantedSize )
{
vPortFree(pv); vPortFree(pv);
return NULL; return NULL;
} }
void *newArea = pvPortMalloc(xWantedSize); void *newArea = pvPortMalloc(xWantedSize);
if( newArea ) if (newArea) {
{
/* The memory being freed will have an xBlockLink structure immediately /* The memory being freed will have an xBlockLink structure immediately
before it. */ before it. */
puc -= uxHeapStructSize; puc -= uxHeapStructSize;
@ -658,7 +613,7 @@ void* pvPortReAlloc( void *pv, size_t xWantedSize )
int oldSize = (pxLink->xBlockSize & ~xBlockAllocatedBit) - uxHeapStructSize; int oldSize = (pxLink->xBlockSize & ~xBlockAllocatedBit) - uxHeapStructSize;
int copySize = (oldSize < xWantedSize) ? oldSize : xWantedSize; int copySize = (oldSize < xWantedSize) ? oldSize : xWantedSize;
memcpy( newArea, pv, copySize ); rtl_memcpy(newArea, pv, copySize);
vTaskSuspendAll(); vTaskSuspendAll();
{ {
@ -670,8 +625,7 @@ void* pvPortReAlloc( void *pv, size_t xWantedSize )
xTaskResumeAll(); xTaskResumeAll();
return newArea; return newArea;
} }
} } else if (xWantedSize)
else if( xWantedSize )
return pvPortMalloc(xWantedSize); return pvPortMalloc(xWantedSize);
else else
return NULL; return NULL;
@ -681,10 +635,10 @@ void* pvPortReAlloc( void *pv, size_t xWantedSize )
extern _LONG_CALL_ROM_ void *_memset(void *s, int c, SIZE_T n); extern _LONG_CALL_ROM_ void *_memset(void *s, int c, SIZE_T n);
void *pvPortZalloc( size_t xWantedSize ) void *pvPortZalloc(size_t xWantedSize) {
{
void * prt = pvPortMalloc(xWantedSize); void * prt = pvPortMalloc(xWantedSize);
if(prt) _memset(prt, 0, xWantedSize); if (prt)
_memset(prt, 0, xWantedSize);
return prt; return prt;
} }

View file

@ -79,7 +79,7 @@ typedef struct _RTL_TIMER{
u32 msPeriod; // The period of this timer u32 msPeriod; // The period of this timer
void *Context; // Timer specific context. void *Context; // Timer specific context.
u8 isPeriodical; // is a periodical timer u8 isPeriodical; // is a periodical timer
u8 TimerName[35]; // the Name of timer u8 TimerName[15]; // the Name of timer
}RTL_TIMER, *PRTL_TIMER; }RTL_TIMER, *PRTL_TIMER;
__inline static VOID __inline static VOID

View file

@ -22,7 +22,6 @@
#define _OSDEP_API_C_ #define _OSDEP_API_C_
#include <osdep_api.h> #include <osdep_api.h>
#include <task.h>
extern _LONG_CALL_ char *_strcpy(char *dest, const char *src); extern _LONG_CALL_ char *_strcpy(char *dest, const char *src);
extern _LONG_CALL_ VOID *_memset(void *dst0, int Val,SIZE_T length); extern _LONG_CALL_ VOID *_memset(void *dst0, int Val,SIZE_T length);

View file

@ -1082,12 +1082,12 @@ int rtw_create_worker_thread( rtw_worker_thread_t* worker_thread, u8 priority, u
memset( worker_thread, 0, sizeof( *worker_thread ) ); memset( worker_thread, 0, sizeof( *worker_thread ) );
if ( rtw_init_xqueue( &worker_thread->event_queue, "worker queue", sizeof(rtw_event_message_t), event_queue_size ) != SUCCESS ) if ( rtw_init_xqueue( &worker_thread->event_queue, "worker", sizeof(rtw_event_message_t), event_queue_size ) != SUCCESS )
{ {
return FAIL; return FAIL;
} }
if ( !rtw_create_task( &worker_thread->thread, "worker thread", stack_size, priority, worker_thread_main, (void*) worker_thread ) ) if ( !rtw_create_task( &worker_thread->thread, "worker", stack_size, priority, worker_thread_main, (void*) worker_thread ) )
{ {
rtw_deinit_xqueue( &worker_thread->event_queue ); rtw_deinit_xqueue( &worker_thread->event_queue );
return FAIL; return FAIL;

View file

@ -89,6 +89,8 @@ prvDiagSPrintf(
IN const char *fmt, ... IN const char *fmt, ...
); );
extern char print_off;
#if CONFIG_DEBUG_LOG > 3 #if CONFIG_DEBUG_LOG > 3
#define debug_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__) #define debug_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
#define info_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__) #define info_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)

View file

@ -51,6 +51,9 @@
#define UART_STOP_1BIT 0x0 #define UART_STOP_1BIT 0x0
#define UART_STOP_2BIT 0x4 #define UART_STOP_2BIT 0x4
#ifndef DEFAULT_BAUDRATE
#define DEFAULT_BAUDRATE UART_BAUD_RATE_38400
#endif
#define HAL_UART_READ32(addr) HAL_READ32(LOG_UART_REG_BASE, addr) #define HAL_UART_READ32(addr) HAL_READ32(LOG_UART_REG_BASE, addr)
#define HAL_UART_WRITE32(addr, value) HAL_WRITE32(LOG_UART_REG_BASE, addr, value) #define HAL_UART_WRITE32(addr, value) HAL_WRITE32(LOG_UART_REG_BASE, addr, value)

View file

@ -336,7 +336,7 @@ PatchHalInitPlatformLogUart(
UartIrqHandle.Priority = 0; UartIrqHandle.Priority = 0;
//4 Inital Log uart //4 Inital Log uart
UartAdapter.BaudRate = UART_BAUD_RATE_38400; UartAdapter.BaudRate = DEFAULT_BAUDRATE;
UartAdapter.DataLength = UART_DATA_LEN_8BIT; UartAdapter.DataLength = UART_DATA_LEN_8BIT;
UartAdapter.FIFOControl = 0xC1; UartAdapter.FIFOControl = 0xC1;
UartAdapter.IntEnReg = 0x00; UartAdapter.IntEnReg = 0x00;

View file

@ -13,8 +13,9 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Data declarations // Data declarations
#ifndef DEFAULT_BAUDRATE
#define DEFAULT_BAUDRATE UART_BAUD_RATE_38400 #define DEFAULT_BAUDRATE 38400
#endif
/* 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000? Hz, /* 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000? Hz,
6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000? Hz */ 6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000? Hz */

View file

@ -616,6 +616,7 @@
#define BIT_MASK_XTAL_DRV_RF_LATCH 0xffffffffL #define BIT_MASK_XTAL_DRV_RF_LATCH 0xffffffffL
#define BIT_XTAL_DRV_RF_LATCH(x) (((x) & BIT_MASK_XTAL_DRV_RF_LATCH) << BIT_SHIFT_XTAL_DRV_RF_LATCH) #define BIT_XTAL_DRV_RF_LATCH(x) (((x) & BIT_MASK_XTAL_DRV_RF_LATCH) << BIT_SHIFT_XTAL_DRV_RF_LATCH)
// BIT25 - To release DAC delta sigma clock gating
//2 REG_RSVD //2 REG_RSVD

View file

@ -3,8 +3,8 @@
* *
* Copyright (c) 2013 Realtek Semiconductor Corp. * Copyright (c) 2013 Realtek Semiconductor Corp.
* *
* 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
*/ */
@ -15,9 +15,10 @@
#include "rtl8195a_pwm.h" #include "rtl8195a_pwm.h"
#include "hal_pwm.h" #include "hal_pwm.h"
extern HAL_PWM_ADAPTER PWMPin[]; //extern HAL_PWM_ADAPTER PWMPin[];
extern HAL_TIMER_OP HalTimerOp; //extern HAL_TIMER_OP HalTimerOp;
extern u32 gTimerRecord;
/** /**
* @brief Configure a G-Timer to generate a tick with certain time. * @brief Configure a G-Timer to generate a tick with certain time.
@ -33,18 +34,18 @@ Pwm_SetTimerTick_8195a(
u32 tick_time u32 tick_time
) )
{ {
TIMER_ADAPTER TimerAdapter;
if (tick_time <= MIN_GTIMER_TIMEOUT) { if (tick_time <= MIN_GTIMER_TIMEOUT) {
tick_time = MIN_GTIMER_TIMEOUT; tick_time = MIN_GTIMER_TIMEOUT;
} }
else {
tick_time = (((tick_time-1)/TIMER_TICK_US)+1) * TIMER_TICK_US;
}
// Initial a G-Timer for the PWM pin // Initial a G-Timer for the PWM pin
if (pPwmAdapt->tick_time != tick_time) { if (pPwmAdapt->tick_time != tick_time) {
pPwmAdapt->tick_time = tick_time;
DBG_PWM_INFO("%s: Timer_Id=%d Count=%d\n", __FUNCTION__, pPwmAdapt->gtimer_id, tick_time);
// if timer is running ?
if(gTimerRecord & (1 << pPwmAdapt->gtimer_id)) {
HalTimerReLoadRtl8195a_Patch(pPwmAdapt->gtimer_id, tick_time);
} else {
TIMER_ADAPTER TimerAdapter;
TimerAdapter.IrqDis = 1; // Disable Irq TimerAdapter.IrqDis = 1; // Disable Irq
TimerAdapter.IrqHandle.IrqFun = (IRQ_FUN) NULL; TimerAdapter.IrqHandle.IrqFun = (IRQ_FUN) NULL;
TimerAdapter.IrqHandle.IrqNum = TIMER2_7_IRQ; TimerAdapter.IrqHandle.IrqNum = TIMER2_7_IRQ;
@ -54,12 +55,9 @@ Pwm_SetTimerTick_8195a(
TimerAdapter.TimerIrqPriority = 0; TimerAdapter.TimerIrqPriority = 0;
TimerAdapter.TimerLoadValueUs = tick_time-1; TimerAdapter.TimerLoadValueUs = tick_time-1;
TimerAdapter.TimerMode = 1; // auto-reload with user defined value TimerAdapter.TimerMode = 1; // auto-reload with user defined value
HalTimerInitRtl8195a_Patch((VOID*) &TimerAdapter);
HalTimerOp.HalTimerInit((VOID*) &TimerAdapter); }
pPwmAdapt->tick_time = tick_time;
DBG_PWM_INFO("%s: Timer_Id=%d Count=%d\n", __FUNCTION__, pPwmAdapt->gtimer_id, tick_time);
} }
} }
@ -95,7 +93,7 @@ HAL_Pwm_SetDuty_8195a(
period = MIN_GTIMER_TIMEOUT*2; period = MIN_GTIMER_TIMEOUT*2;
} }
else { else {
tick_time = period / 0x3fc; // a duty cycle be devided into 1020 ticks tick_time = period / 1020; // 0x3fc; // a duty cycle be devided into 1020 ticks
if (tick_time < MIN_GTIMER_TIMEOUT) { if (tick_time < MIN_GTIMER_TIMEOUT) {
tick_time = MIN_GTIMER_TIMEOUT; tick_time = MIN_GTIMER_TIMEOUT;
} }
@ -103,36 +101,24 @@ HAL_Pwm_SetDuty_8195a(
Pwm_SetTimerTick_8195a(pPwmAdapt, tick_time); Pwm_SetTimerTick_8195a(pPwmAdapt, tick_time);
tick_time = pPwmAdapt->tick_time; tick_time = pPwmAdapt->tick_time;
#if 0
// Check if current tick time needs adjustment
if ((pPwmAdapt->tick_time << 12) <= period) {
// need a longger tick time
}
else if ((pPwmAdapt->tick_time >> 2) >= period) {
// need a shorter tick time
}
#endif
period_tick = period/tick_time; period_tick = period/tick_time;
if (period_tick == 0) { if (period_tick == 0) {
period_tick = 1; period_tick = 1;
} }
if (pulse_width >= period) { if (pulse_width >= period) {
// pulse_width = period-1;
pulse_width = period; pulse_width = period;
} }
pulsewidth_tick = pulse_width/tick_time; pulsewidth_tick = pulse_width/tick_time;
if (pulsewidth_tick == 0) {
// pulsewidth_tick = 1;
}
timer_id = pPwmAdapt->gtimer_id; timer_id = pPwmAdapt->gtimer_id;
pPwmAdapt->period = period_tick & 0x3ff; pPwmAdapt->period = period_tick & BIT_MASK_PERI_PWM0_PERIOD;
pPwmAdapt->pulsewidth = pulsewidth_tick & 0x3ff; pPwmAdapt->pulsewidth = pulsewidth_tick & BIT_MASK_PERI_PWM0_DUTY;
RegAddr = REG_PERI_PWM0_CTRL + (pwm_id*4); RegAddr = REG_PERI_PWM0_CTRL + (pwm_id*4);
RegValue = BIT31 | (timer_id<<24) | (pulsewidth_tick<<12) | period_tick; RegValue = BIT_PERI_PWM0_EN | BIT_PERI_PWM0_GT_SEL(timer_id) | BIT_PERI_PWM0_DUTY(pulsewidth_tick) | BIT_PERI_PWM0_PERIOD(period_tick);
HAL_WRITE32(PERI_ON_BASE, RegAddr, RegValue); HAL_WRITE32(PERI_ON_BASE, RegAddr, RegValue);
} }
@ -157,10 +143,10 @@ HAL_Pwm_Init_8195a(
pwm_id = pPwmAdapt->pwm_id; pwm_id = pPwmAdapt->pwm_id;
pin_sel = pPwmAdapt->sel; pin_sel = pPwmAdapt->sel;
// Initial a G-Timer for the PWM pin // Initial a G-Timer for the PWM pin
Pwm_SetTimerTick_8195a(pPwmAdapt, MIN_GTIMER_TIMEOUT); //p/ Pwm_SetTimerTick_8195a(pPwmAdapt, MIN_GTIMER_TIMEOUT);
// Set default duty ration // Set default duty ration
HAL_Pwm_SetDuty_8195a(pPwmAdapt, 20000, 10000); //p/ HAL_Pwm_SetDuty_8195a(pPwmAdapt, 20000, 10000);
// Configure the Pin Mux // Configure the Pin Mux
PinCtrl((PWM0+pwm_id), pin_sel, 1); PinCtrl((PWM0+pwm_id), pin_sel, 1);
@ -187,7 +173,7 @@ HAL_Pwm_Enable_8195a(
// Configure the Pin Mux // Configure the Pin Mux
if (!pPwmAdapt->enable) { if (!pPwmAdapt->enable) {
PinCtrl((PWM0+pwm_id), pPwmAdapt->sel, 1); PinCtrl((PWM0+pwm_id), pPwmAdapt->sel, 1);
HalTimerOp.HalTimerEn(pPwmAdapt->gtimer_id); HalTimerEnRtl8195a_Patch(pPwmAdapt->gtimer_id);
pPwmAdapt->enable = 1; pPwmAdapt->enable = 1;
} }
} }
@ -211,7 +197,7 @@ HAL_Pwm_Disable_8195a(
// Configure the Pin Mux // Configure the Pin Mux
if (pPwmAdapt->enable) { if (pPwmAdapt->enable) {
PinCtrl((PWM0+pwm_id), pPwmAdapt->sel, 0); PinCtrl((PWM0+pwm_id), pPwmAdapt->sel, 0);
HalTimerOp.HalTimerDis(pPwmAdapt->gtimer_id); HalTimerDisRtl8195a(pPwmAdapt->gtimer_id);
pPwmAdapt->enable = 0; pPwmAdapt->enable = 0;
} }
} }

View file

@ -142,8 +142,6 @@ HalRuartResetTRxFifoRtl8195a(
return HAL_OK; return HAL_OK;
} }
extern u64 div_u64(u64 dividend, u32 divisor);
HAL_Status HAL_Status
HalRuartGenBaudRateRtl8195a( HalRuartGenBaudRateRtl8195a(
IN RUART_SPEED_SETTING *pBaudSetting IN RUART_SPEED_SETTING *pBaudSetting
@ -154,7 +152,7 @@ HalRuartGenBaudRateRtl8195a(
u32 min_err=0xffffffff; u32 min_err=0xffffffff;
u32 uart_ovsr; u32 uart_ovsr;
u32 uart_ovsr_mod; u32 uart_ovsr_mod;
u32 min_uart_ovsr =0; // ovsr with mini err u32 min_uart_ovsr; // ovsr with mini err
u32 min_uart_ovsr_mod; u32 min_uart_ovsr_mod;
u64 uart_clock; u64 uart_clock;
u32 divisor_temp; u32 divisor_temp;

View file

@ -1267,12 +1267,14 @@ RtkADCReceive(
pHALADCGdmaAdpt->MuliBlockCunt = 0; pHALADCGdmaAdpt->MuliBlockCunt = 0;
pHALADCGdmaOp->HalGdmaChSeting(pHALADCGdmaAdpt); pHALADCGdmaOp->HalGdmaChSeting(pHALADCGdmaAdpt);
pHALADCGdmaOp->HalGdmaChEn(pHALADCGdmaAdpt);
pSalADCHND->DevSts = ADC_STS_RX_ING;
AdcTempDat = HAL_ADC_READ32(REG_ADC_POWER); AdcTempDat = HAL_ADC_READ32(REG_ADC_POWER);
AdcTempDat |= BIT_ADC_PWR_AUTO; AdcTempDat |= BIT_ADC_PWR_AUTO;
HAL_ADC_WRITE32(REG_ADC_POWER, AdcTempDat); HAL_ADC_WRITE32(REG_ADC_POWER, AdcTempDat);
pHALADCGdmaOp->HalGdmaChEn(pHALADCGdmaAdpt);
pSalADCHND->DevSts = ADC_STS_RX_ING;
return _EXIT_SUCCESS; return _EXIT_SUCCESS;
} }
return _EXIT_FAILURE; return _EXIT_FAILURE;
@ -1288,9 +1290,6 @@ RtkADCReceiveBuf(
PSAL_ADC_HND pSalADCHND = (PSAL_ADC_HND) Data; PSAL_ADC_HND pSalADCHND = (PSAL_ADC_HND) Data;
PSAL_ADC_HND_PRIV pSalADCHNDPriv = NULL; PSAL_ADC_HND_PRIV pSalADCHNDPriv = NULL;
PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL; PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL;
PHAL_ADC_OP pHalADCOP = NULL; PHAL_ADC_OP pHalADCOP = NULL;
//PIRQ_HANDLE pIrqHandleADCGdma = NULL; //PIRQ_HANDLE pIrqHandleADCGdma = NULL;
@ -1300,13 +1299,8 @@ RtkADCReceiveBuf(
pSalADCHNDPriv = CONTAINER_OF(pSalADCHND, SAL_ADC_HND_PRIV, SalADCHndPriv); pSalADCHNDPriv = CONTAINER_OF(pSalADCHND, SAL_ADC_HND_PRIV, SalADCHndPriv);
pSalADCMngtAdpt = CONTAINER_OF(pSalADCHNDPriv->ppSalADCHnd, SAL_ADC_MNGT_ADPT, pSalHndPriv); pSalADCMngtAdpt = CONTAINER_OF(pSalADCHNDPriv->ppSalADCHnd, SAL_ADC_MNGT_ADPT, pSalHndPriv);
pHalADCOP = pSalADCMngtAdpt->pHalOp; pHalADCOP = pSalADCMngtAdpt->pHalOp;
/* Clear ADC Status */ /* Clear ADC Status */
//HAL_ADC_READ32(REG_ADC_INTR_STS); //HAL_ADC_READ32(REG_ADC_INTR_STS);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_INTR_STS); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_INTR_STS);
@ -1315,11 +1309,12 @@ RtkADCReceiveBuf(
//DBG_8195A(">>INTR:%x\n",AdcTempDat); //DBG_8195A(">>INTR:%x\n",AdcTempDat);
ADCFullStsFlag = 0; ADCFullStsFlag = 0;
HalDelayUs(2000); /// HalDelayUs(2000); ?
HalDelayUs(20);
DBG_ADC_INFO("RtkADCReceiveBuf, Check to enable ADC manully or not\n"); DBG_ADC_INFO("RtkADCReceiveBuf, Check to enable ADC manully or not\n");
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER);
if (unlikely((AdcTempDat & 0x00000008) == 0)) { if (unlikely((AdcTempDat & BIT_ADC_ISO_MANUAL) == 0)) {
; ;
} }
else { else {
@ -1329,23 +1324,22 @@ RtkADCReceiveBuf(
//AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER); //AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER);
} }
pSalADCHND->pInitDat->ADCIntrMSK = (BIT_ADC_FIFO_FULL_EN); pSalADCHND->pInitDat->ADCIntrMSK = (BIT_ADC_FIFO_FULL_EN);
pHalADCOP->HalADCIntrCtrl(pSalADCHND->pInitDat); pHalADCOP->HalADCIntrCtrl(pSalADCHND->pInitDat);
pSalADCHND->DevSts = ADC_STS_IDLE; pSalADCHND->DevSts = ADC_STS_IDLE;
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
if ((AdcTempDat & 0x00000001) == 0){ if ((AdcTempDat & BIT_ADC_EN_MANUAL) == 0){
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
DBG_ADC_INFO("RtkADCReceiveBuf, Before set, Reg AD1:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, Before set, Reg AD1:%x\n", AdcTempDat);
AdcTempDat |= (0x01); AdcTempDat |= BIT_ADC_EN_MANUAL;
HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD1, AdcTempDat); HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD1, AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
DBG_ADC_INFO("RtkADCReceiveBuf, After set, Reg AD1:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, After set, Reg AD1:%x\n", AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCReceiveBuf, Before set, Reg AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, Before set, Reg AD0:%x\n", AdcTempDat);
AdcTempDat |= (0x01); AdcTempDat |= BIT_ADC_EN_MANUAL;
HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat); HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCReceiveBuf, After set, Reg AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, After set, Reg AD0:%x\n", AdcTempDat);
@ -1359,14 +1353,14 @@ RtkADCReceiveBuf(
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, Before set, AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, Before set, AD0:%x\n", AdcTempDat);
AdcTempDat &= (~0x01); AdcTempDat &= (~BIT_ADC_EN_MANUAL);
HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat); HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, After set, AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, After set, AD0:%x\n", AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, Before set, AD1:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, Before set, AD1:%x\n", AdcTempDat);
AdcTempDat &= (~0x01); AdcTempDat &= (~BIT_ADC_EN_MANUAL);
HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD1, AdcTempDat); HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD1, AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, After set, AD1:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, After set, AD1:%x\n", AdcTempDat);
@ -1410,7 +1404,7 @@ RtkADCRxManualRotate(
DBG_ADC_INFO("RtkADCRxManualRotate, Check to enable ADC manully or not\n"); DBG_ADC_INFO("RtkADCRxManualRotate, Check to enable ADC manully or not\n");
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER);
if (unlikely((AdcTempDat & 0x00000008) == 0)) { if (unlikely((AdcTempDat & BIT_ADC_ISO_MANUAL) == 0)) {
; ;
} }
else { else {
@ -1426,7 +1420,7 @@ RtkADCRxManualRotate(
pSalADCHND->DevSts = ADC_STS_IDLE; pSalADCHND->DevSts = ADC_STS_IDLE;
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
if ((AdcTempDat & 0x00000001) == 0){ if ((AdcTempDat & BIT_ADC_EN_MANUAL) == 0){
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
DBG_ADC_INFO("RtkADCRxManualRotate, Before set, Reg AD1:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCRxManualRotate, Before set, Reg AD1:%x\n", AdcTempDat);
/* Clear for manual rotrate first*/ /* Clear for manual rotrate first*/
@ -1435,7 +1429,7 @@ RtkADCRxManualRotate(
AdcTempDat |= (BIT0); AdcTempDat |= (BIT0);
/* Enable manual mode, this is to turn cali. off */ /* Enable manual mode, this is to turn cali. off */
AdcTempDat &= ~(BIT11); // AdcTempDat &= ~(BIT11);
AdcTempDat |= (BIT11); AdcTempDat |= (BIT11);
/* Set rotation to default state /* Set rotation to default state
@ -1507,7 +1501,7 @@ RtkADCRxManualRotate(
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCRxManualRotate, Before set, Reg AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCRxManualRotate, Before set, Reg AD0:%x\n", AdcTempDat);
AdcTempDat |= (0x01); AdcTempDat |= BIT_ADC_EN_MANUAL;
HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat); HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCRxManualRotate, After set, Reg AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCRxManualRotate, After set, Reg AD0:%x\n", AdcTempDat);
@ -1537,14 +1531,14 @@ RtkADCRxManualRotate(
/* Close ADC */ /* Close ADC */
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, Before set, AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, Before set, AD0:%x\n", AdcTempDat);
AdcTempDat &= (~0x01); AdcTempDat &= (~BIT_ADC_EN_MANUAL);
HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat); HAL_ADC_WRITE32(REG_ADC_ANAPAR_AD0, AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, After set, AD0:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, After set, AD0:%x\n", AdcTempDat);
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1); AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, Before set, AD1:%x\n", AdcTempDat); DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, Before set, AD1:%x\n", AdcTempDat);
AdcTempDat &= (~0x01); AdcTempDat &= (~BIT0);
/* Disable manual mode */ /* Disable manual mode */
AdcTempDat &= (~BIT11); AdcTempDat &= (~BIT11);

View file

@ -161,7 +161,7 @@ void HalLogUartIrqHandle(VOID * Data) {
void HalLogUartSetBaudRate(HAL_LOG_UART_ADAPTER *pUartAdapter) { void HalLogUartSetBaudRate(HAL_LOG_UART_ADAPTER *pUartAdapter) {
u32 clk4 = HalGetCpuClk() >> 2; // PLATFORM_CLOCK/2; // (unsigned int) HalGetCpuClk() >> 2; // div 4 u32 clk4 = HalGetCpuClk() >> 2; // PLATFORM_CLOCK/2; // (unsigned int) HalGetCpuClk() >> 2; // div 4
if (pUartAdapter->BaudRate == 0) if (pUartAdapter->BaudRate == 0)
pUartAdapter->BaudRate = UART_BAUD_RATE_38400; pUartAdapter->BaudRate = DEFAULT_BAUDRATE;
u32 br16 = pUartAdapter->BaudRate << 4; // * 16 u32 br16 = pUartAdapter->BaudRate << 4; // * 16
if ((br16 != 0) && (br16 <= clk4)) { if ((br16 != 0) && (br16 <= clk4)) {
unsigned int dll = clk4 / br16; unsigned int dll = clk4 / br16;
@ -200,7 +200,7 @@ u32 HalLogUartInitSetting(HAL_LOG_UART_ADAPTER *pUartAdapter) {
// HalPinCtrlRtl8195A(LOG_UART, 0, 1); ???? // HalPinCtrlRtl8195A(LOG_UART, 0, 1); ????
u32 clk4 = HalGetCpuClk() >> 2; // PLATFORM_CLOCK/2; // (unsigned int) HalGetCpuClk() >> 2; // div 4 u32 clk4 = HalGetCpuClk() >> 2; // PLATFORM_CLOCK/2; // (unsigned int) HalGetCpuClk() >> 2; // div 4
if (pUartAdapter->BaudRate == 0) if (pUartAdapter->BaudRate == 0)
pUartAdapter->BaudRate = UART_BAUD_RATE_38400; pUartAdapter->BaudRate = DEFAULT_BAUDRATE;
u32 br16 = pUartAdapter->BaudRate << 4; // * 16 u32 br16 = pUartAdapter->BaudRate << 4; // * 16
HAL_UART_WRITE32(UART_INTERRUPT_EN_REG_OFF, 0); // 40003004 = 0; HAL_UART_WRITE32(UART_INTERRUPT_EN_REG_OFF, 0); // 40003004 = 0;
if (br16 <= clk4) { if (br16 <= clk4) {
@ -418,7 +418,7 @@ void HalInitLogUart(void) {
HAL_PERI_ON_WRITE32(REG_PESOC_CLK_CTRL, HAL_PERI_ON_WRITE32(REG_PESOC_CLK_CTRL,
HAL_PERI_ON_READ32(REG_PESOC_CLK_CTRL) | BIT_SOC_ACTCK_LOG_UART_EN); // 40000230 |= 0x1000u; HAL_PERI_ON_READ32(REG_PESOC_CLK_CTRL) | BIT_SOC_ACTCK_LOG_UART_EN); // 40000230 |= 0x1000u;
HalPinCtrlRtl8195A(LOG_UART, 0, 1); HalPinCtrlRtl8195A(LOG_UART, 0, 1);
UartAdapter.BaudRate = UART_BAUD_RATE_38400; UartAdapter.BaudRate = DEFAULT_BAUDRATE;
UartAdapter.DataLength = UART_DATA_LEN_8BIT; UartAdapter.DataLength = UART_DATA_LEN_8BIT;
UartAdapter.FIFOControl = FCR_RX_TRIG_MASK | FCR_FIFO_EN; // 0xC1; UartAdapter.FIFOControl = FCR_RX_TRIG_MASK | FCR_FIFO_EN; // 0xC1;
UartAdapter.IntEnReg = IER_ERBFI | IER_ELSI; // 5 UartAdapter.IntEnReg = IER_ERBFI | IER_ELSI; // 5

View file

@ -3,8 +3,8 @@
* *
* Copyright (c) 2013 Realtek Semiconductor Corp. * Copyright (c) 2013 Realtek Semiconductor Corp.
* *
* 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
*/ */

View file

@ -46,7 +46,6 @@ PatchHalLogUartInit(
u32 Divisor; u32 Divisor;
u32 Dlh; u32 Dlh;
u32 Dll; u32 Dll;
u32 SysClock;
/* /*
Interrupt enable Register Interrupt enable Register
@ -71,21 +70,11 @@ PatchHalLogUartInit(
// set up buad rate division // set up buad rate division
#ifdef CONFIG_FPGA #ifdef CONFIG_FPGA
SysClock = SYSTEM_CLK; Divisor = (SYSTEM_CLK / (16 * (UartAdapter.BaudRate)));
Divisor = (SysClock / (16 * (UartAdapter.BaudRate)));
#else #else
{ {
u32 SampleRate, Remaind; Divisor = HalGetCpuClk()/(32 * UartAdapter.BaudRate);
Divisor = (Divisor & 1) + (Divisor >> 1);
SysClock = HalGetCpuClk() >> 2;
SampleRate = (16 * (UartAdapter.BaudRate));
Divisor= SysClock/SampleRate;
Remaind = ((SysClock*10)/SampleRate) - (Divisor*10);
if (Remaind > 4) Divisor++;
} }
#endif #endif
@ -98,7 +87,7 @@ PatchHalLogUartInit(
HAL_UART_WRITE32(UART_DLL_OFF, Dll); HAL_UART_WRITE32(UART_DLL_OFF, Dll);
HAL_UART_WRITE32(UART_DLH_OFF, Dlh); HAL_UART_WRITE32(UART_DLH_OFF, Dlh);
// clear DLAB bit // clear DLAB bit
HAL_UART_WRITE32(UART_LINE_CTL_REG_OFF, 0); // HAL_UART_WRITE32(UART_LINE_CTL_REG_OFF, 0); // есть далее
// set data format // set data format
SetData = UartAdapter.Parity | UartAdapter.Stop | UartAdapter.DataLength; SetData = UartAdapter.Parity | UartAdapter.Stop | UartAdapter.DataLength;
@ -160,7 +149,7 @@ PSHalInitPlatformLogUart(
UartIrqHandle.Priority = 0; UartIrqHandle.Priority = 0;
//4 Inital Log uart //4 Inital Log uart
UartAdapter.BaudRate = UART_BAUD_RATE_38400; UartAdapter.BaudRate = DEFAULT_BAUDRATE;
UartAdapter.DataLength = UART_DATA_LEN_8BIT; UartAdapter.DataLength = UART_DATA_LEN_8BIT;
UartAdapter.FIFOControl = 0xC1; UartAdapter.FIFOControl = 0xC1;
UartAdapter.IntEnReg = 0x00; UartAdapter.IntEnReg = 0x00;

View file

@ -547,13 +547,13 @@ HalSsiInit(VOID *Data)
DBG_SSI_ERR("Invalid SPI Index.\n"); DBG_SSI_ERR("Invalid SPI Index.\n");
break; break;
} }
/*
ret = FunctionChk(Function, (u32)PinmuxSelect); ret = FunctionChk(Function, (u32)PinmuxSelect);
if(ret == _FALSE){ if(ret == _FALSE){
DBG_SSI_ERR("Invalid Pinmux Setting.\n"); DBG_SSI_ERR("Invalid Pinmux Setting.\n");
return HAL_ERR_PARA; return HAL_ERR_PARA;
} }
*/
#ifdef CONFIG_SOC_PS_MODULE #ifdef CONFIG_SOC_PS_MODULE
REG_POWER_STATE SsiPwrState; REG_POWER_STATE SsiPwrState;
#endif #endif

View file

@ -6,11 +6,9 @@
*/ */
//====================================================== //======================================================
#ifndef LOGUART_STACK_SIZE #ifndef LOGUART_STACK_SIZE
#define LOGUART_STACK_SIZE 400 // USE_MIN_STACK_SIZE to 128 #define LOGUART_STACK_SIZE 400 // USE_MIN_STACK_SIZE modify from 512 to 128
#endif #endif
#ifndef CONSOLE_PRIORITY
#define CONSOLE_PRIORITY 0 #define CONSOLE_PRIORITY 0
#endif
//====================================================== //======================================================
#include "rtl8195a.h" #include "rtl8195a.h"
#include "rtl_bios_data.h" #include "rtl_bios_data.h"
@ -43,7 +41,7 @@ _LONG_CALL_ extern void UartLogHistoryCmd(
IN u8 RevData, IN UART_LOG_CTL *prvUartLogCtl, IN u8 RevData, IN UART_LOG_CTL *prvUartLogCtl,
IN u8 EchoFlag); IN u8 EchoFlag);
_LONG_CALL_ extern void UartLogCmdExecute(IN PUART_LOG_CTL pUartLogCtlExe); //_LONG_CALL_ extern void UartLogCmdExecute(IN PUART_LOG_CTL pUartLogCtlExe);
//====================================================== //======================================================
extern PCOMMAND_TABLE UartLogRamCmdTable[]; extern PCOMMAND_TABLE UartLogRamCmdTable[];
extern UartLogRamCmdTableSize; extern UartLogRamCmdTableSize;
@ -128,9 +126,9 @@ void UartLogIrqHandleRam(void * Data) {
// для передачи ' ' или ','. // для передачи ' ' или ','.
// Начальные пробелы cmd или arg удаляются. // Начальные пробелы cmd или arg удаляются.
//====================================================== //======================================================
int GetArgvRam(IN u8 *pstr) { int GetArgvRam(IN u8 *pstr, u8** argv) {
int arvc = 0; int arvc = 0;
u8** argv = ArgvArray; // u8** argv = ArgvArray;
u8* p = pstr; u8* p = pstr;
u8 t, n = ' '; u8 t, n = ' ';
int m = 0; int m = 0;
@ -213,7 +211,7 @@ MON_RAM_TEXT_SECTION void RtlConsolTaskRam(void *Data) {
RtlDownSema(&p->Sema); RtlDownSema(&p->Sema);
if (p->ExecuteCmd) { if (p->ExecuteCmd) {
// UartLogCmdExecute(pUartLogCtl); // UartLogCmdExecute(pUartLogCtl);
int argc = GetArgvRam(p->pTmpLogBuf->UARTLogBuf); int argc = GetArgvRam(p->pTmpLogBuf->UARTLogBuf, ArgvArray);
if(argc) { if(argc) {
StrUpr(ArgvArray[0]); StrUpr(ArgvArray[0]);
PCOMMAND_TABLE pcmd = p->pCmdTbl; PCOMMAND_TABLE pcmd = p->pCmdTbl;
@ -329,8 +327,13 @@ _WEAK void console_help(int argc, char *argv[]) { // Help
} }
DiagPrintf(&str_rom_57ch3Dch0A[25]); // DiagPrintf("==============================\n"); DiagPrintf(&str_rom_57ch3Dch0A[25]); // DiagPrintf("==============================\n");
} }
LOCAL void print_on(int argc, char *argv[])
{
print_off = argv[1][0]!='1';
}
// (!) размещается в специальном сегменте '.mon.tab*' (см. *.ld файл) // (!) размещается в специальном сегменте '.mon.tab*' (см. *.ld файл)
MON_RAM_TAB_SECTION COMMAND_TABLE console_commands[] = { MON_RAM_TAB_SECTION COMMAND_TABLE console_commands[] = {
{"PR", 1, print_on, "<1/0>: Printf on/off"}, // Help
{"?", 0, console_help, ": This Help"} // Help {"?", 0, console_help, ": This Help"} // Help
// {"HELP", 0, console_help, ": Help"} // Help // {"HELP", 0, console_help, ": Help"} // Help
}; };

View file

@ -92,7 +92,7 @@ typedef struct _FALSE_ALARM_STATISTICS {
u32 Cnt_CCA_all; u32 Cnt_CCA_all;
u32 Cnt_BW_USC; u32 Cnt_BW_USC;
u32 Cnt_BW_LSC; u32 Cnt_BW_LSC;
} FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS; } FALSE_ALARM_STATISTICS;
extern FALSE_ALARM_STATISTICS FalseAlmCnt; // 100006E0 extern FALSE_ALARM_STATISTICS FalseAlmCnt; // 100006E0
typedef struct _rom_info { typedef struct _rom_info {
@ -100,7 +100,7 @@ typedef struct _rom_info {
u8 CrystalCap; u8 CrystalCap;
u64 DebugComponents; u64 DebugComponents;
u32 DebugLevel; u32 DebugLevel;
} ROM_INFO, *PROM_INFO; } ROM_INFO;
extern ROM_INFO ROMInfo; // 10000720 extern ROM_INFO ROMInfo; // 10000720
typedef struct _CFO_TRACKING_ { typedef struct _CFO_TRACKING_ {
@ -118,7 +118,7 @@ typedef struct _CFO_TRACKING_ {
u8 CFO_TH_XTAL_HIGH; u8 CFO_TH_XTAL_HIGH;
u8 CFO_TH_XTAL_LOW; u8 CFO_TH_XTAL_LOW;
u8 CFO_TH_ATC; u8 CFO_TH_ATC;
} CFO_TRACKING, *PCFO_TRACKING;; }CFO_TRACKING;
extern CFO_TRACKING DM_CfoTrack; // 10000738 extern CFO_TRACKING DM_CfoTrack; // 10000738
/* in rom_libgloss_retarget.h /* in rom_libgloss_retarget.h

View file

@ -4,7 +4,6 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include "libc/rom/string/rom_libc_string.h" #include "libc/rom/string/rom_libc_string.h"
#include "strproc.h"
#define memchr __rtl_memchr_v1_00 #define memchr __rtl_memchr_v1_00
#define memcmp __rtl_memcmp_v1_00 #define memcmp __rtl_memcmp_v1_00
@ -23,6 +22,10 @@
#define strsep __rtl_strsep_v1_00 #define strsep __rtl_strsep_v1_00
#define strtok __rtl_strtok_v1_00 #define strtok __rtl_strtok_v1_00
static char toupper(char ch) {
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
};
#define NEWFP 1 #define NEWFP 1
#define ENDIAN_LITTLE 1234 #define ENDIAN_LITTLE 1234
#define ENDIAN_BIG 4321 #define ENDIAN_BIG 4321
@ -188,13 +191,6 @@ str_fmt(char *p, int size, int fmt)
/* /*
* strtoupper() * strtoupper()
*/ */
#define strtoupper StrUpr
/*
LOCAL char toupper(char ch) {
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
};
void void
strtoupper(char *p) strtoupper(char *p)
{ {
@ -203,7 +199,7 @@ strtoupper(char *p)
for (; *p; p++) for (; *p; p++)
*p = toupper (*p); *p = toupper (*p);
} }
*/
/* $Id: atob.c,v 1.1.1.1 2006/08/23 17:03:06 pefo Exp $ */ /* $Id: atob.c,v 1.1.1.1 2006/08/23 17:03:06 pefo Exp $ */
/* /*
@ -637,7 +633,7 @@ c_vsprintf (char *d, const char *s, va_list ap)
} }
else if (*s == 'o') else if (*s == 'o')
base = 8; base = 8;
else //if (*s == 'b') else if (*s == 'b')
base = 2; base = 2;
if (longlong) if (longlong)
llbtoa(d, va_arg (ap, quad_t), llbtoa(d, va_arg (ap, quad_t),
@ -1078,12 +1074,9 @@ int c_printf(const char *fmt, ...)
int puts (const char *s) int puts (const char *s)
{ {
int i = 0;
while(*s) { while(*s) {
HalSerialPutcRtl8195a(*s++); HalSerialPutcRtl8195a(*s++);
i++;
} }
return i;
} }
void vTaskDelete(void *); void vTaskDelete(void *);

View file

@ -62,7 +62,8 @@ char * rtl_strtok(char *s, const char *delim);
extern struct _reent * _rtl_impure_ptr; extern struct _reent * _rtl_impure_ptr;
int libc_has_init; char libc_has_init;
char print_off;
// extern rtl_impure_ptr // extern rtl_impure_ptr
// extern impure_ptr // extern impure_ptr
@ -140,6 +141,7 @@ int rtl_printf(const char *fmt, ...) {
rtl_libc_init(); rtl_libc_init();
} }
#endif #endif
if(!print_off) {
va_list args; va_list args;
va_start (args, fmt); va_start (args, fmt);
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr, int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
@ -148,6 +150,8 @@ int rtl_printf(const char *fmt, ...) {
// va_end (args); // va_end (args);
return result; return result;
} }
else return 0;
}
//----- rtl_vprintf() //----- rtl_vprintf()
int rtl_vprintf(const char *fmt, va_list param) { int rtl_vprintf(const char *fmt, va_list param) {

View file

@ -6,8 +6,6 @@
#include "rtl_bios_data.h" #include "rtl_bios_data.h"
#include "va_list.h" #include "va_list.h"
#include "strproc.h"
#include "rt_lib_rom.h"
#define CHECK_LIBC_INIT 0 #define CHECK_LIBC_INIT 0
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -69,10 +67,8 @@ unsigned long long __aeabi_llsr(unsigned long long val, unsigned int shift);
extern struct _reent * _rtl_impure_ptr; extern struct _reent * _rtl_impure_ptr;
#if CHECK_LIBC_INIT extern char libc_has_init;
extern int libc_has_init; extern char print_off;
#endif
// extern impure_ptr
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Function // Function
@ -142,6 +138,8 @@ int printf(const char *fmt, ...) {
rtl_libc_init(); rtl_libc_init();
} }
#endif #endif
if(!print_off) {
va_list args; va_list args;
va_start (args, fmt); va_start (args, fmt);
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr, int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
@ -150,6 +148,8 @@ int printf(const char *fmt, ...) {
// va_end (args); // va_end (args);
return result; return result;
} }
else return 0;
}
//----- vprintf() //----- vprintf()
int vprintf(const char * fmt, __VALIST param) { int vprintf(const char * fmt, __VALIST param) {
@ -169,6 +169,7 @@ int vprintf(const char * fmt, __VALIST param) {
int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) { int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) {
int result; int result;
int w; int w;
int v11;
FILE f; FILE f;
#if CHECK_LIBC_INIT #if CHECK_LIBC_INIT
if (!libc_has_init) { if (!libc_has_init) {
@ -299,9 +300,9 @@ int sscanf(const char *buf, const char *fmt, ...) {
return i; return i;
} }
LOCAL char toupper(char ch) { char toupper(char ch) {
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch); return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
} };
int _stricmp (const char *s1, const char *s2) int _stricmp (const char *s1, const char *s2)
{ {
@ -378,15 +379,12 @@ int __aeabi_dtoi(double d)
return __rtl_dtoi_v1_00(d); return __rtl_dtoi_v1_00(d);
} }
extern _LONG_CALL_ int __rtl_dtoui_v1_00(double d);
//----- __aeabi_dtoui() //----- __aeabi_dtoui()
int __aeabi_dtoui(double d) int __aeabi_dtoui(double d)
{ {
return __rtl_dtoui_v1_00(d); return __rtl_dtoui_v1_00(d);
} }
extern _LONG_CALL_ float __rtl_itof_v1_00(int val);
//----- __aeabi_i2f() //----- __aeabi_i2f()
float __aeabi_i2f(int val) float __aeabi_i2f(int val)
{ {
@ -411,7 +409,6 @@ int __aeabi_ui2d(unsigned int val)
return __rtl_uitod_v1_00(val); return __rtl_uitod_v1_00(val);
} }
extern _LONG_CALL_ char * __rtl_ltoa_v1_00(int value, char *string, int radix);
//----- __aeabi_itoa() //----- __aeabi_itoa()
char * __aeabi_itoa(int value, char *string, int radix) char * __aeabi_itoa(int value, char *string, int radix)
{ {
@ -424,7 +421,6 @@ char * __aeabi_ltoa(int value, char *string, int radix)
return (char *)__rtl_ltoa_v1_00(value, string, radix); return (char *)__rtl_ltoa_v1_00(value, string, radix);
} }
extern _LONG_CALL_ char * __rtl_ultoa_v1_00(unsigned int value, char *string, int radix);
//----- __aeabi_utoa() //----- __aeabi_utoa()
char * __aeabi_utoa(unsigned int value, char *string, int radix) char * __aeabi_utoa(unsigned int value, char *string, int radix)
{ {
@ -437,49 +433,42 @@ char * __aeabi_ultoa(unsigned int value, char *string, int radix)
return (char *)__rtl_ultoa_v1_00(value, string, radix); return (char *)__rtl_ultoa_v1_00(value, string, radix);
} }
extern _LONG_CALL_ long long __rtl_ftol_v1_00(float f);
//----- __aeabi_ftol() //----- __aeabi_ftol()
long long __aeabi_ftol(float f) int __aeabi_ftol(float f)
{ {
return __rtl_ftol_v1_00(f); return __rtl_ftol_v1_00(f);
} }
extern _LONG_CALL_ double __rtl_ftod_v1_00(float f);
//----- __aeabi_ftod() //----- __aeabi_ftod()
double __aeabi_ftod(float f) int __aeabi_ftod(float f)
{ {
return __rtl_ftod_v1_00(f); return __rtl_ftod_v1_00(f);
} }
extern _LONG_CALL_ float __rtl_dtof_v1_00(double d);
//----- __aeabi_dtof() //----- __aeabi_dtof()
float __aeabi_dtof(double d) float __aeabi_dtof(double d)
{ {
return __rtl_dtof_v1_00(d); return __rtl_dtof_v1_00(d);
} }
extern _LONG_CALL_ float __rtl_fadd_v1_00(float a, float b);
//----- __aeabi_fadd() //----- __aeabi_fadd()
float __aeabi_fadd(float a, float b) float __aeabi_fadd(float a, float b)
{ {
return __rtl_fadd_v1_00(a, b); return __rtl_fadd_v1_00(a, b);
} }
extern _LONG_CALL_ float __rtl_fsub_v1_00(float a, float b);
//----- __aeabi_fsub() //----- __aeabi_fsub()
float __aeabi_fsub(float a, float b) float __aeabi_fsub(float a, float b)
{ {
return __rtl_fsub_v1_00(a, b); return __rtl_fsub_v1_00(a, b);
} }
extern _LONG_CALL_ float __rtl_fmul_v1_00(float a, float b);
//----- __aeabi_fmul() //----- __aeabi_fmul()
float __aeabi_fmul(float a, float b) float __aeabi_fmul(float a, float b)
{ {
return __rtl_fmul_v1_00(a, b); return __rtl_fmul_v1_00(a, b);
} }
extern _LONG_CALL_ float __rtl_fdiv_v1_00(float a, float b);
//----- __aeabi_fdiv() //----- __aeabi_fdiv()
float __aeabi_fdiv(float a, float b) float __aeabi_fdiv(float a, float b)
{ {
@ -487,25 +476,25 @@ float __aeabi_fdiv(float a, float b)
} }
//----- __aeabi_dadd() //----- __aeabi_dadd()
double __aeabi_dadd(double a, double b) int __aeabi_dadd(double a, double b)
{ {
return __rtl_dadd_v1_00(a, b); return __rtl_dadd_v1_00(a, b);
} }
//----- __aeabi_dsub() //----- __aeabi_dsub()
double __aeabi_dsub(double a, double b) int __aeabi_dsub(double a, double b)
{ {
return __rtl_dsub_v1_00(a, b); return __rtl_dsub_v1_00(a, b);
} }
//----- __aeabi_dmul() //----- __aeabi_dmul()
double __aeabi_dmul(double a, double b) int __aeabi_dmul(double a, double b)
{ {
return __rtl_dmul_v1_00(a, b); return __rtl_dmul_v1_00(a, b);
} }
//----- __aeabi_ddiv() //----- __aeabi_ddiv()
double __aeabi_ddiv(double a, double b) int __aeabi_ddiv(double a, double b)
{ {
return __rtl_ddiv_v1_00(a, b); return __rtl_ddiv_v1_00(a, b);
} }
@ -522,7 +511,6 @@ int __aeabi_dcmplt(double a, double b)
return __rtl_dcmplt_v1_00(a, b); return __rtl_dcmplt_v1_00(a, b);
} }
extern _LONG_CALL_ int __rtl_dcmple_v1_00(double a, double b);
//----- __aeabi_dcmple() //----- __aeabi_dcmple()
int __aeabi_dcmple(double a, double b) int __aeabi_dcmple(double a, double b)
{ {
@ -535,13 +523,12 @@ int __aeabi_dcmpgt(double a, double b)
return __rtl_dcmpgt_v1_00(a, b); return __rtl_dcmpgt_v1_00(a, b);
} }
extern _LONG_CALL_ int __rtl_fcmplt_v1_00(float a, float b);
//----- __aeabi_fcmplt() //----- __aeabi_fcmplt()
int __aeabi_fcmplt(float a, float b) int __aeabi_fcmplt(float a, float b)
{ {
return __rtl_fcmplt_v1_00(a, b); return __rtl_fcmplt_v1_00(a, b);
} }
extern _LONG_CALL_ int __rtl_fcmpgt_v1_00(float a, float b);
//----- __aeabi_fcmpgt() //----- __aeabi_fcmpgt()
int __aeabi_fcmpgt(float a, float b) int __aeabi_fcmpgt(float a, float b)
{ {

View file

@ -4,7 +4,6 @@
*/ */
#include "basic_types.h" #include "basic_types.h"
#include "rt_lib_rom.h"
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Function declarations // Function declarations
@ -72,15 +71,12 @@ int rtl_dtoi(double d)
return __rtl_dtoi_v1_00(d); return __rtl_dtoi_v1_00(d);
} }
extern _LONG_CALL_ int __rtl_dtoui_v1_00(double d);
//----- rtl_dtoui() //----- rtl_dtoui()
int rtl_dtoui(double d) int rtl_dtoui(double d)
{ {
return __rtl_dtoui_v1_00(d); return __rtl_dtoui_v1_00(d);
} }
extern _LONG_CALL_ float __rtl_itof_v1_00(int val);
//----- rtl_i2f() //----- rtl_i2f()
float rtl_i2f(int val) float rtl_i2f(int val)
{ {
@ -105,7 +101,6 @@ int rtl_ui2d(unsigned int val)
return __rtl_uitod_v1_00(val); return __rtl_uitod_v1_00(val);
} }
extern _LONG_CALL_ char * __rtl_ltoa_v1_00(int value, char *string, int radix);
//----- rtl_itoa() //----- rtl_itoa()
char *rtl_itoa(int value, char *string, int radix) char *rtl_itoa(int value, char *string, int radix)
{ {
@ -118,7 +113,6 @@ char *rtl_ltoa(int value, char *string, int radix)
return (char *)__rtl_ltoa_v1_00(value, string, radix); return (char *)__rtl_ltoa_v1_00(value, string, radix);
} }
extern _LONG_CALL_ char * __rtl_ultoa_v1_00(unsigned int value, char *string, int radix);
//----- rtl_utoa() //----- rtl_utoa()
char *rtl_utoa(unsigned int value, char *string, int radix) char *rtl_utoa(unsigned int value, char *string, int radix)
{ {
@ -131,7 +125,6 @@ char *rtl_ultoa(unsigned int value, char *string, int radix)
return (char *)__rtl_ultoa_v1_00(value, string, radix); return (char *)__rtl_ultoa_v1_00(value, string, radix);
} }
extern _LONG_CALL_ double __rtl_ftod_v1_00(float f);
//----- rtl_ftol() //----- rtl_ftol()
int rtl_ftol(float f) int rtl_ftol(float f)
{ {
@ -144,7 +137,6 @@ int rtl_ftod(float f)
return __rtl_ftod_v1_00(f); return __rtl_ftod_v1_00(f);
} }
extern _LONG_CALL_ float __rtl_fsub_v1_00(float a, float b);
//----- rtl_dtof() //----- rtl_dtof()
float rtl_dtof(double d) float rtl_dtof(double d)
{ {
@ -163,14 +155,12 @@ float rtl_fsub(float a, float b)
return __rtl_fsub_v1_00(a, b); return __rtl_fsub_v1_00(a, b);
} }
extern _LONG_CALL_ float __rtl_fmul_v1_00(float a, float b);
//----- rtl_fmul() //----- rtl_fmul()
float rtl_fmul(float a, float b) float rtl_fmul(float a, float b)
{ {
return __rtl_fmul_v1_00(a, b); return __rtl_fmul_v1_00(a, b);
} }
extern _LONG_CALL_ float __rtl_fdiv_v1_00(float a, float b);
//----- rtl_fdiv() //----- rtl_fdiv()
float rtl_fdiv(float a, float b) float rtl_fdiv(float a, float b)
{ {
@ -213,7 +203,6 @@ int rtl_dcmplt(double a, double b)
return __rtl_dcmplt_v1_00(a, b); return __rtl_dcmplt_v1_00(a, b);
} }
extern _LONG_CALL_ int __rtl_dcmple_v1_00(double a, double b);
//----- rtl_dcmple() //----- rtl_dcmple()
int rtl_dcmple(double a, double b) int rtl_dcmple(double a, double b)
{ {
@ -225,13 +214,13 @@ int rtl_dcmpgt(double a, double b)
{ {
return __rtl_dcmpgt_v1_00(a, b); return __rtl_dcmpgt_v1_00(a, b);
} }
extern _LONG_CALL_ int __rtl_fcmplt_v1_00(float a, float b);
//----- rtl_fcmplt() //----- rtl_fcmplt()
int rtl_fcmplt(float a, float b) int rtl_fcmplt(float a, float b)
{ {
return __rtl_fcmplt_v1_00(a, b); return __rtl_fcmplt_v1_00(a, b);
} }
extern _LONG_CALL_ int __rtl_fcmpgt_v1_00(float a, float b);
//----- rtl_fcmpgt() //----- rtl_fcmpgt()
int rtl_fcmpgt(float a, float b) int rtl_fcmpgt(float a, float b)
{ {

View file

@ -20,28 +20,25 @@ float rtl_sin_f32(float a);
// int __rtl_cos_f32_v1_00(); // int __rtl_cos_f32_v1_00();
// int __rtl_sin_f32_v1_00(); // int __rtl_sin_f32_v1_00();
extern _LONG_CALL_ float __rtl_fabsf_v1_00(float a);
//----- rtl_fabsf() //----- rtl_fabsf()
float rtl_fabsf(float a) float rtl_fabsf(float a)
{ {
return __rtl_fabsf_v1_00(a); return __rtl_fabsf_v1_00(a);
} }
extern _LONG_CALL_ double __rtl_fabs_v1_00(double number);
//----- rtl_fabs() //----- rtl_fabs()
int rtl_fabs(double a) int rtl_fabs(double a)
{ {
return __rtl_fabs_v1_00(a); return __rtl_fabs_v1_00(a);
} }
extern _LONG_CALL_ float __rtl_cos_f32_v1_00(float a);
//----- rtl_cos_f32() //----- rtl_cos_f32()
float rtl_cos_f32(float a) float rtl_cos_f32(float a)
{ {
return __rtl_cos_f32_v1_00(a); return __rtl_cos_f32_v1_00(a);
} }
extern _LONG_CALL_ float __rtl_sin_f32_v1_00(float a);
//----- rtl_sin_f32() //----- rtl_sin_f32()
float rtl_sin_f32(float a) float rtl_sin_f32(float a)
{ {

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

@ -9,6 +9,7 @@
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "diag.h" #include "diag.h"
#include "wifi_api.h" #include "wifi_api.h"
#include "wifi_conf.h"
#include "rtl8195a/rtl_libc.h" #include "rtl8195a/rtl_libc.h"
#include "hal_platform.h" #include "hal_platform.h"
@ -290,8 +291,8 @@ MON_RAM_TAB_SECTION COMMAND_TABLE console_cmd_wifi_api[] = {
{"ATPN", 1, fATPN, "=<SSID>[,password[,encryption[,auto-reconnect[,reconnect pause]]]: WIFI Connect to AP"}, {"ATPN", 1, fATPN, "=<SSID>[,password[,encryption[,auto-reconnect[,reconnect pause]]]: WIFI Connect to AP"},
{"ATPA", 1, fATPA, "=<SSID>[,password[,encryption[,channel[,hidden[,max connections]]]]]: Start WIFI AP"}, {"ATPA", 1, fATPA, "=<SSID>[,password[,encryption[,channel[,hidden[,max connections]]]]]: Start WIFI AP"},
{"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"}, {"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"},
// {"ATON", 0, fATON, ": Open connections"}, {"ATON", 0, fATON, ": Open connections"},
// {"ATOF", 0, fATOF, ": Close connections"}, {"ATOF", 0, fATOF, ": Close connections"},
{"ATWI", 0, fATWI, ": WiFi Info"}, {"ATWI", 0, fATWI, ": WiFi Info"},
#if CONFIG_DEBUG_LOG > 3 #if CONFIG_DEBUG_LOG > 3
{"ATWT", 1, fATWT, "=<tx_power>: WiFi tx power: 0 - 100%, 1 - 75%, 2 - 50%, 3 - 25%, 4 - 12.5%"}, {"ATWT", 1, fATWT, "=<tx_power>: WiFi tx power: 0 - 100%, 1 - 75%, 2 - 50%, 3 - 25%, 4 - 12.5%"},