mirror of
https://github.com/drasko/open-ameba.git
synced 2024-12-24 23:25:19 +00:00
update
This commit is contained in:
parent
cf7a2d9683
commit
f7b901aa27
76 changed files with 3753 additions and 3990 deletions
9
Makefile
9
Makefile
|
@ -7,9 +7,6 @@ ram_all:
|
|||
@$(MAKE) -f sdkbuild.mk
|
||||
@$(MAKE) -f flasher.mk genbin1 genbin23
|
||||
|
||||
webfs:
|
||||
@$(MAKE) -f webfs.mk webpages.espfs
|
||||
|
||||
.PHONY: ram_all_mp
|
||||
ram_all_mp:
|
||||
@$(MAKE) -f sdkbuild.mk mp
|
||||
|
@ -29,11 +26,7 @@ flashburn:
|
|||
|
||||
flash_OTA:
|
||||
@$(MAKE) -f flasher.mk flash_OTA
|
||||
|
||||
flashwebfs:
|
||||
@$(MAKE) -f webfs.mk webpages.espfs
|
||||
@$(MAKE) -f flasher.mk flashwebfs
|
||||
#JLinkGDB-WrWebFs.bat
|
||||
|
||||
|
||||
runram:
|
||||
#JLink-RunRAM.bat
|
||||
|
|
|
@ -12,7 +12,7 @@ RTL00 module (RTL8710AF)<br>
|
|||
|
||||
![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>
|
||||
|
||||
|
|
|
@ -948,13 +948,16 @@ void fATWC(void *arg){
|
|||
|
||||
if(assoc_by_bssid){
|
||||
printf("Joining BSS by BSSID "MAC_FMT" ...\n", MAC_ARG(wifi.bssid.octet));
|
||||
ret = wifi_connect_bssid(wifi.bssid.octet, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password,
|
||||
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL);
|
||||
} else {
|
||||
printf("Joining BSS by SSID %s...\n", (char*)wifi.ssid.val);
|
||||
ret = wifi_connect((char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, wifi.ssid.len,
|
||||
wifi.password_len, wifi.key_id, NULL);
|
||||
}
|
||||
ret = wifi_connect(wifi.bssid.octet,
|
||||
assoc_by_bssid,
|
||||
(char*)wifi.ssid.val,
|
||||
wifi.security_type,
|
||||
(char*)wifi.password,
|
||||
wifi.key_id,
|
||||
NULL);
|
||||
|
||||
if(ret!= RTW_SUCCESS){
|
||||
printf("ERROR: Can't connect to AP\n");
|
||||
|
@ -1652,19 +1655,10 @@ void fATPA(void *arg)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if(hidden_ssid){
|
||||
if(wifi_start_ap_with_hidden_ssid((char*)ap.ssid.val, ap.security_type, (char*)ap.password, ap.ssid.len, ap.password_len, ap.channel) < 0) {
|
||||
if(wifi_start_ap((char*)ap.ssid.val, ap.security_type, (char*)ap.password, ap.channel, hidden_ssid) < 0) {
|
||||
//at_printf("\r\n[ATPA] ERROR : Start AP failed");
|
||||
error_no = 4;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(wifi_start_ap((char*)ap.ssid.val, ap.security_type, (char*)ap.password, ap.ssid.len, ap.password_len, ap.channel) < 0) {
|
||||
//at_printf("\r\n[ATPA] ERROR : Start AP failed");
|
||||
error_no = 4;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
while(1) {
|
||||
|
@ -1906,13 +1900,14 @@ void fATPN(void *arg)
|
|||
wifi_set_pscan_chan(&connect_channel, &pscan_config, 1);
|
||||
#endif
|
||||
|
||||
if(assoc_by_bssid){
|
||||
ret = wifi_connect_bssid(wifi.bssid.octet, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password,
|
||||
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL);
|
||||
} else {
|
||||
ret = wifi_connect((char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, wifi.ssid.len,
|
||||
wifi.password_len, wifi.key_id, NULL);
|
||||
}
|
||||
ret = wifi_connect(
|
||||
wifi.bssid.octet,
|
||||
assoc_by_bssid,
|
||||
(char*)wifi.ssid.val,
|
||||
wifi.security_type,
|
||||
(char*)wifi.password,
|
||||
wifi.key_id,
|
||||
NULL);
|
||||
|
||||
if(ret!= RTW_SUCCESS){
|
||||
//at_printf("\r\n[ATPN] ERROR: Can't connect to AP");
|
||||
|
@ -2345,8 +2340,14 @@ int atcmd_wifi_restore_from_flash(void)
|
|||
break;
|
||||
}
|
||||
|
||||
ret = wifi_connect((char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, wifi.ssid.len,
|
||||
wifi.password_len, wifi.key_id, NULL);
|
||||
ret = wifi_connect(
|
||||
NULL,
|
||||
0,
|
||||
(char*)wifi.ssid.val,
|
||||
wifi.security_type,
|
||||
(char*)wifi.password,
|
||||
wifi.key_id,
|
||||
NULL);
|
||||
if(ret == RTW_SUCCESS){
|
||||
LwIP_DHCP(0, DHCP_START);
|
||||
ret = 0;
|
||||
|
|
|
@ -7,17 +7,18 @@
|
|||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#define DATA_IRAM_ATTR
|
||||
#define ICACHE_RAM_ATTR
|
||||
|
||||
#define os_printf(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_printf_plus(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_sprintf_fd(...) rtl_sprintf(__VA_ARGS__)
|
||||
#define ets_sprintf(...) rtl_sprintf(__VA_ARGS__)
|
||||
/*
|
||||
#ifndef os_malloc
|
||||
#define os_malloc pvPortMalloc
|
||||
#define os_zalloc pvPortZalloc
|
||||
#define os_calloc pvPortCalloc
|
||||
#define os_realloc pvPortRealloc
|
||||
*/
|
||||
#endif
|
||||
#undef os_free
|
||||
#define os_free vPortFree
|
||||
#define system_get_free_heap_size xPortGetFreeHeapSize
|
||||
|
@ -51,6 +52,7 @@
|
|||
#define os_strncpy rtl_strncpy
|
||||
#define os_strstr rtl_strstr
|
||||
#define os_random Rand
|
||||
|
||||
//extern uint32 phy_get_rand(void);
|
||||
#define system_get_os_print() 1
|
||||
|
||||
|
@ -102,7 +104,6 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
|
|||
#define spi_flash_read(faddr, pbuf, size) flash_stream_read(&flashobj, faddr, size, (uint8_t *)pbuf)
|
||||
#define spi_flash_erase_block(blk) flash_erase_block(&flashobj, (blk)<<16);
|
||||
|
||||
|
||||
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
||||
|
@ -121,6 +122,13 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
|
|||
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
#ifndef MAC2STR
|
||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef DEBUGSOO
|
||||
/* CONFIG_DEBUG_LOG:
|
||||
=0 Off all diag/debug msg,
|
||||
=1 Only errors,
|
||||
|
@ -135,5 +143,12 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
|
|||
#else
|
||||
#define DEBUGSOO CONFIG_DEBUG_LOG
|
||||
#endif
|
||||
#endif //#ifndef DEBUGSOO
|
||||
|
||||
//#define system_get_sdk_version() "3.5.3"
|
||||
|
||||
//#define system_get_time xTaskGetTickCount
|
||||
//#define ets_get_cpu_frequency HalGetCpuClk
|
||||
|
||||
|
||||
#endif // _INCLUDE_ESP_COMP_H_
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <PinNames.h>
|
||||
#include <pinmap.h>
|
||||
#include <gpio_api.h>
|
||||
#include <rtw_wowlan/wifi_wowlan.h>
|
||||
#include <wifi_wowlan.h>
|
||||
#include <freertos_pmu.h>
|
||||
#include <wifi_conf.h>
|
||||
|
||||
|
|
|
@ -212,16 +212,16 @@ struct rtw_wowlan_rx_filter {
|
|||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
//#error "this structure needs to be packed!"
|
||||
#error "this structure needs to be packed!"
|
||||
#endif
|
||||
struct rtw_wowlan {
|
||||
struct rtw_wowlan_status {
|
||||
u32 wakeup_reasons; //record wake up reason
|
||||
u32 filter_id; //record which pattern is matched
|
||||
} _status __attribute__ ((__packed__));
|
||||
};
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
//#error "this structure needs to be packed!"
|
||||
#error "this structure needs to be packed!"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,8 +10,10 @@
|
|||
#include <lwip/netif.h>
|
||||
#include "wifi/wifi_conf.h"
|
||||
#include <platform/platform_stdlib.h>
|
||||
#ifdef CONFIG_ENABLE_EAP
|
||||
#include <polarssl/ssl.h>
|
||||
#include <polarssl/memory.h>
|
||||
#endif
|
||||
|
||||
#define WLAN0_NAME "wlan0"
|
||||
#ifndef ENABLE
|
||||
|
@ -21,6 +23,21 @@
|
|||
#define DISABLE (0)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ENABLE_EAP
|
||||
int get_eap_phase(void){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_eap_method(void){
|
||||
return 0;
|
||||
}
|
||||
|
||||
void eap_autoreconnect_hdl(u8 method_id)
|
||||
{
|
||||
(void) method_id;
|
||||
}
|
||||
#else
|
||||
|
||||
u8 eap_phase = 0;
|
||||
u8 eap_method = 0;
|
||||
|
||||
|
@ -42,9 +59,6 @@ void eap_eapol_recvd_hdl(char *buf, int buf_len, int flags, void* handler_user_d
|
|||
void eap_eapol_start_hdl(char *buf, int buf_len, int flags, void* handler_user_data);
|
||||
#endif
|
||||
|
||||
void set_eap_phase(unsigned char is_trigger_eap){
|
||||
eap_phase = is_trigger_eap;
|
||||
}
|
||||
|
||||
int get_eap_phase(void){
|
||||
return eap_phase;
|
||||
|
@ -54,6 +68,10 @@ int get_eap_method(void){
|
|||
return eap_method;
|
||||
}
|
||||
|
||||
void set_eap_phase(unsigned char is_trigger_eap){
|
||||
eap_phase = is_trigger_eap;
|
||||
}
|
||||
|
||||
void reset_config(void){
|
||||
eap_target_ssid = NULL;
|
||||
eap_identity = NULL;
|
||||
|
@ -64,6 +82,8 @@ void reset_config(void){
|
|||
eap_client_key_pwd = NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ENABLE_EAP
|
||||
|
||||
void judge_station_disconnect(void)
|
||||
{
|
||||
int mode = 0;
|
||||
|
@ -82,7 +102,7 @@ void judge_station_disconnect(void)
|
|||
wifi_disconnect();
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_ENABLE_EAP
|
||||
|
||||
void eap_disconnected_hdl(char *buf, int buf_len, int flags, void* handler_user_data){
|
||||
// printf("disconnected\n");
|
||||
wifi_unreg_event_handler(WIFI_EVENT_EAPOL_RECVD, eap_eapol_recvd_hdl);
|
||||
|
@ -258,11 +278,12 @@ static int connect_by_open_system(char *target_ssid)
|
|||
if (target_ssid != NULL) {
|
||||
while (1) {
|
||||
rtw_msleep_os(500); //wait scan complete.
|
||||
ret = wifi_connect(target_ssid,
|
||||
ret = wifi_connect(
|
||||
NULL,
|
||||
0,
|
||||
target_ssid,
|
||||
RTW_SECURITY_OPEN,
|
||||
NULL,
|
||||
strlen(target_ssid),
|
||||
0,
|
||||
0,
|
||||
NULL);
|
||||
if (ret == RTW_SUCCESS) {
|
||||
|
@ -451,3 +472,5 @@ int eap_cert_setup(ssl_context *ssl)
|
|||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //#ifdef CONFIG_ENABLE_EAP
|
||||
|
|
|
@ -303,11 +303,12 @@ static int wps_connect_to_AP_by_certificate(rtw_network_info_t *wifi)
|
|||
printf("ssid_len = %d\n", wifi->ssid.len);
|
||||
printf("password_len = %d\n", wifi->password_len);
|
||||
while (1) {
|
||||
ret = wifi_connect((char*)wifi->ssid.val,
|
||||
ret = wifi_connect(
|
||||
NULL,
|
||||
0,
|
||||
(char*)wifi->ssid.val,
|
||||
wifi->security_type,
|
||||
(char*)wifi->password,
|
||||
wifi->ssid.len,
|
||||
wifi->password_len,
|
||||
wifi->key_id,
|
||||
NULL);
|
||||
if (ret == RTW_SUCCESS) {
|
||||
|
@ -336,11 +337,11 @@ static int wps_connect_to_AP_by_open_system(char *target_ssid)
|
|||
if (target_ssid != NULL) {
|
||||
rtw_msleep_os(500); //wait scan complete.
|
||||
while (1) {
|
||||
ret = wifi_connect(target_ssid,
|
||||
RTW_SECURITY_OPEN,
|
||||
ret = wifi_connect(
|
||||
NULL,
|
||||
strlen(target_ssid),
|
||||
0,
|
||||
target_ssid,
|
||||
RTW_SECURITY_OPEN,
|
||||
0,
|
||||
NULL);
|
||||
if (ret == RTW_SUCCESS) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <wifi/wifi_conf.h>
|
||||
#include <wifi/wifi_util.h>
|
||||
#include <wifi/wifi_ind.h>
|
||||
#include <wifi_api.h>
|
||||
#include "tcpip.h"
|
||||
#include <osdep_service.h>
|
||||
|
||||
|
@ -22,8 +23,6 @@
|
|||
extern int inic_start(void);
|
||||
extern int inic_stop(void);
|
||||
#endif
|
||||
#include "wifi_api.h"
|
||||
|
||||
#include "wlan_lib.h"
|
||||
|
||||
#if CONFIG_DEBUG_LOG > 0
|
||||
|
@ -429,8 +428,18 @@ void restore_wifi_info_to_flash() {
|
|||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
|
||||
int ssid_len, int password_len, int key_id, void *semaphore) {
|
||||
int wifi_connect(
|
||||
unsigned char bssid[ETH_ALEN],
|
||||
char use_bssid, // flag
|
||||
char *ssid,
|
||||
rtw_security_t security_type,
|
||||
char *password,
|
||||
int key_id,
|
||||
void *semaphore) {
|
||||
|
||||
int ssid_len = 0;
|
||||
int password_len = 0;
|
||||
int bssid_len = 6;
|
||||
xSemaphoreHandle join_semaphore;
|
||||
rtw_result_t result = RTW_SUCCESS;
|
||||
u8 wep_hex = 0;
|
||||
|
@ -441,7 +450,34 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
|
|||
return RTW_ERROR;
|
||||
}
|
||||
|
||||
if(ssid) {
|
||||
ssid_len = rtl_strlen(ssid);
|
||||
if(ssid_len > NDIS_802_11_LENGTH_SSID)
|
||||
ssid_len = NDIS_802_11_LENGTH_SSID;
|
||||
}
|
||||
if(password) {
|
||||
password_len = rtl_strlen(password);
|
||||
if(password_len > IW_PASSPHRASE_MAX_SIZE)
|
||||
password_len = IW_PASSPHRASE_MAX_SIZE;
|
||||
}
|
||||
|
||||
rtw_join_status = 0; //clear for last connect status
|
||||
error_flag = RTW_UNKNOWN; //clear for last connect status
|
||||
internal_join_result_t *join_result =
|
||||
(internal_join_result_t *) rtw_zmalloc(
|
||||
sizeof(internal_join_result_t));
|
||||
if (!join_result) {
|
||||
#if CONFIG_DEBUG_LOG > 3
|
||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||
#endif
|
||||
return RTW_NOMEM;
|
||||
}
|
||||
if (ssid_len && ssid) {
|
||||
join_result->network_info.ssid.len = ssid_len > 32 ? 32 : ssid_len;
|
||||
rtw_memcpy(join_result->network_info.ssid.val, ssid, ssid_len);
|
||||
}
|
||||
if(bssid) rtw_memcpy(join_result->network_info.bssid.octet, bssid, ETH_ALEN);
|
||||
|
||||
error_flag = RTW_UNKNOWN; //clear for last connect status
|
||||
if ((((password_len > RTW_MAX_PSK_LEN) || (password_len < RTW_MIN_PSK_LEN))
|
||||
&& ((security_type == RTW_SECURITY_WPA_TKIP_PSK)
|
||||
|
@ -463,24 +499,24 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
|
|||
|
||||
if (password_len == 10) {
|
||||
|
||||
u32 p[5] = { 0 };
|
||||
u32 g[5] = { 0 };
|
||||
u8 i = 0;
|
||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &p[0],
|
||||
&p[1], &p[2], &p[3], &p[4]);
|
||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &g[0],
|
||||
&g[1], &g[2], &g[3], &g[4]);
|
||||
for (i = 0; i < 5; i++)
|
||||
wep_pwd[i] = (u8) p[i];
|
||||
wep_pwd[i] = (u8) g[i];
|
||||
wep_pwd[5] = '\0';
|
||||
password_len = 5;
|
||||
wep_hex = 1;
|
||||
} else if (password_len == 26) {
|
||||
u32 p[13] = { 0 };
|
||||
u32 g[13] = { 0 };
|
||||
u8 i = 0;
|
||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x%02x%02x"
|
||||
"%02x%02x%02x%02x%02x%02x", &p[0], &p[1], &p[2], &p[3],
|
||||
&p[4], &p[5], &p[6], &p[7], &p[8], &p[9], &p[10],
|
||||
&p[11], &p[12]);
|
||||
"%02x%02x%02x%02x%02x%02x", &g[0], &g[1], &g[2], &g[3],
|
||||
&g[4], &g[5], &g[6], &g[7], &g[8], &g[9], &g[10],
|
||||
&g[11], &g[12]);
|
||||
for (i = 0; i < 13; i++)
|
||||
wep_pwd[i] = (u8) p[i];
|
||||
wep_pwd[i] = (u8) g[i];
|
||||
wep_pwd[13] = '\0';
|
||||
password_len = 13;
|
||||
wep_hex = 1;
|
||||
|
@ -488,20 +524,8 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
|
|||
}
|
||||
}
|
||||
|
||||
internal_join_result_t *join_result =
|
||||
(internal_join_result_t *) rtw_zmalloc(
|
||||
sizeof(internal_join_result_t));
|
||||
if (!join_result) {
|
||||
#if CONFIG_DEBUG_LOG > 3
|
||||
error_printf("%s: Can't malloc memory!\n", __func__);
|
||||
#endif
|
||||
return RTW_NOMEM;
|
||||
}
|
||||
|
||||
join_result->network_info.ssid.len = ssid_len > 32 ? 32 : ssid_len;
|
||||
rtw_memcpy(join_result->network_info.ssid.val, ssid, ssid_len);
|
||||
|
||||
join_result->network_info.password_len = password_len;
|
||||
|
||||
if (password_len) {
|
||||
/* add \0 to the end */
|
||||
join_result->network_info.password = rtw_zmalloc(password_len + 1);
|
||||
|
@ -542,9 +566,33 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
|
|||
#if DD_WIFI_CONN // дублирование с wifi_connect_bssid_local()
|
||||
wifi_connect_local(&join_result->network_info);
|
||||
#else
|
||||
if (wifi_connect_local(&join_result->network_info) == 0)
|
||||
wext_set_ssid(WLAN0_NAME, join_result->network_info.ssid.val,
|
||||
join_result->network_info.ssid.len);
|
||||
rtw_network_info_t *pWifi = &join_result->network_info;
|
||||
|
||||
if (wifi_connect_local(pWifi) == 0) {
|
||||
uint16 flg = 0;
|
||||
if(use_bssid) {
|
||||
struct {
|
||||
u8 bssid[ETH_ALEN + 2];
|
||||
void * p;
|
||||
} bs = { 0 };
|
||||
memcpy(bs.bssid, pWifi->bssid.octet, ETH_ALEN);
|
||||
for(int i = 0; i < ETH_ALEN; i++) {
|
||||
flg += bs.bssid[i];
|
||||
}
|
||||
if(flg == 0x5FA || flg == 0) { // 0x5FA = 6*0xff
|
||||
use_bssid = 0;
|
||||
flg = 0;
|
||||
}
|
||||
else {
|
||||
use_bssid = 1;
|
||||
wext_set_bssid(WLAN0_NAME, bs.bssid);
|
||||
}
|
||||
}
|
||||
if(!use_bssid) {
|
||||
wext_set_ssid(WLAN0_NAME, join_result->network_info.ssid.val,
|
||||
join_result->network_info.ssid.len);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
join_user_data = join_result;
|
||||
|
||||
|
@ -604,10 +652,18 @@ int wifi_connect(char *ssid, rtw_security_t security_type, char *password,
|
|||
wifi_handshake_done_hdl);
|
||||
return result;
|
||||
}
|
||||
/*
|
||||
|
||||
int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid,
|
||||
rtw_security_t security_type, char *password, int bssid_len,
|
||||
int ssid_len, int password_len, int key_id, void *semaphore) {
|
||||
int wifi_connect_bssid(
|
||||
unsigned char bssid[ETH_ALEN],
|
||||
char *ssid,
|
||||
rtw_security_t security_type,
|
||||
char *password,
|
||||
int bssid_len,
|
||||
int ssid_len,
|
||||
int password_len,
|
||||
int key_id,
|
||||
void *semaphore) {
|
||||
xSemaphoreHandle join_semaphore;
|
||||
rtw_result_t result = RTW_SUCCESS;
|
||||
|
||||
|
@ -643,7 +699,7 @@ int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid,
|
|||
}
|
||||
join_result->network_info.password_len = password_len;
|
||||
if (password_len) {
|
||||
/* add \0 to the end */
|
||||
// add \0 to the end
|
||||
join_result->network_info.password = rtw_zmalloc(password_len + 1);
|
||||
if (!join_result->network_info.password) {
|
||||
return RTW_NOMEM;
|
||||
|
@ -726,6 +782,7 @@ int wifi_connect_bssid(unsigned char bssid[ETH_ALEN], char *ssid,
|
|||
wifi_handshake_done_hdl);
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
int wifi_disconnect(void) {
|
||||
int ret = 0;
|
||||
|
@ -740,7 +797,6 @@ int wifi_disconnect(void) {
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_is_connected_to_ap(void) {
|
||||
return rltk_wlan_is_connected_to_ap();
|
||||
|
@ -874,17 +930,23 @@ int wifi_get_drv_ability(uint32_t *ability) {
|
|||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_country(rtw_country_code_t country_code) {
|
||||
return wext_set_country(WLAN0_NAME, country_code);
|
||||
int ret;
|
||||
|
||||
ret = wext_set_country(WLAN0_NAME, country_code);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_channel_plan(uint8_t channel_plan) {
|
||||
const char * ifname = WLAN0_NAME;
|
||||
int ret = 0;
|
||||
char buf[24];
|
||||
|
||||
rtw_memset(buf, 0, sizeof(buf));
|
||||
snprintf(buf, 24, "set_ch_plan %x", channel_plan);
|
||||
return wext_private_command(ifname, buf, SHOW_PRIVATE_OUT);
|
||||
ret = wext_private_command(ifname, buf, SHOW_PRIVATE_OUT);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
@ -918,12 +980,16 @@ void wifi_set_mib(void) {
|
|||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_rf_on(void) {
|
||||
return rltk_wlan_rf_on();
|
||||
int ret;
|
||||
ret = rltk_wlan_rf_on();
|
||||
return ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_rf_off(void) {
|
||||
return rltk_wlan_rf_off();
|
||||
int ret;
|
||||
ret = rltk_wlan_rf_off();
|
||||
return ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
@ -1070,63 +1136,21 @@ int wifi_get_last_error(void) {
|
|||
int wpas_wps_init(const char* ifname);
|
||||
#endif
|
||||
|
||||
int wifi_start_ap_s(PSOFTAP_CONFIG p) {
|
||||
const char *ifname = WLAN0_NAME;
|
||||
int ret = 0;
|
||||
|
||||
if (wifi_mode == RTW_MODE_STA_AP) {
|
||||
ifname = WLAN1_NAME;
|
||||
}
|
||||
|
||||
if (is_promisc_enabled())
|
||||
promisc_set(0, NULL, 0);
|
||||
|
||||
wifi_reg_event_handler(WIFI_EVENT_STA_ASSOC, wifi_ap_sta_assoc_hdl, NULL);
|
||||
wifi_reg_event_handler(WIFI_EVENT_STA_DISASSOC, wifi_ap_sta_disassoc_hdl,
|
||||
NULL);
|
||||
|
||||
ret = wext_set_mode(ifname, IW_MODE_MASTER);
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
ret = wext_set_channel(ifname, p->channel); //Set channel before starting ap
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
|
||||
switch (p->security_type) {
|
||||
case RTW_SECURITY_OPEN:
|
||||
break;
|
||||
case RTW_SECURITY_WPA2_AES_PSK:
|
||||
ret = wext_set_auth_param(ifname, IW_AUTH_80211_AUTH_ALG,
|
||||
IW_AUTH_ALG_OPEN_SYSTEM);
|
||||
if (ret == 0)
|
||||
ret = wext_set_key_ext(ifname, IW_ENCODE_ALG_CCMP, NULL, 0, 0, 0, 0,
|
||||
NULL, 0);
|
||||
if (ret == 0)
|
||||
ret = wext_set_passphrase(ifname, (u8*) p->password, strlen(p->password));
|
||||
break;
|
||||
default:
|
||||
ret = -1;
|
||||
printf("WIFICONF: security type is not supported\n");
|
||||
break;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
if(p->ssid_hidden) {
|
||||
ret = set_hidden_ssid(ifname, 1);
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
}
|
||||
ret = wext_set_ap_ssid(ifname, (u8*) p->ssid, strlen(p->ssid));
|
||||
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||
wpas_wps_init(ifname);
|
||||
#endif
|
||||
exit: return ret;
|
||||
}
|
||||
|
||||
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
|
||||
int ssid_len, int password_len, int channel) {
|
||||
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password, int channel, char ssid_hidden) {
|
||||
const char *ifname = WLAN0_NAME;
|
||||
int ssid_len = 0;
|
||||
int password_len = 0;
|
||||
int ret = 0;
|
||||
if(ssid) {
|
||||
ssid_len = rtl_strlen(ssid);
|
||||
if(ssid_len > NDIS_802_11_LENGTH_SSID)
|
||||
ssid_len = NDIS_802_11_LENGTH_SSID;
|
||||
}
|
||||
if(password) {
|
||||
password_len = rtl_strlen(password);
|
||||
if(password_len > IW_PASSPHRASE_MAX_SIZE)
|
||||
password_len = IW_PASSPHRASE_MAX_SIZE;
|
||||
}
|
||||
|
||||
if (wifi_mode == RTW_MODE_STA_AP) {
|
||||
ifname = WLAN1_NAME;
|
||||
|
@ -1142,6 +1166,7 @@ int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
|
|||
ret = wext_set_mode(ifname, IW_MODE_MASTER);
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
// if(!channel) channel = 1;
|
||||
ret = wext_set_channel(ifname, channel); //Set channel before starting ap
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
|
@ -1166,13 +1191,19 @@ int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password,
|
|||
if (ret < 0)
|
||||
goto exit;
|
||||
|
||||
if(ssid_hidden) {
|
||||
ret = set_hidden_ssid(ifname, 1);
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ret = wext_set_ap_ssid(ifname, (u8*) ssid, ssid_len);
|
||||
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||
wpas_wps_init(ifname);
|
||||
#endif
|
||||
exit: return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
int wifi_start_ap_with_hidden_ssid(char *ssid, rtw_security_t security_type,
|
||||
char *password, int ssid_len, int password_len, int channel) {
|
||||
const char *ifname = WLAN0_NAME;
|
||||
|
@ -1226,6 +1257,7 @@ int wifi_start_ap_with_hidden_ssid(char *ssid, rtw_security_t security_type,
|
|||
#endif
|
||||
exit: return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
void wifi_scan_each_report_hdl(char* buf, int buf_len, int flags,
|
||||
void* userdata) {
|
||||
|
@ -1710,7 +1742,7 @@ void wifi_enter_promisc_mode() {
|
|||
}
|
||||
|
||||
int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
||||
unsigned char *password, int ssid_len, int password_len, int channel) {
|
||||
unsigned char *password, int channel) {
|
||||
unsigned char idx = 0;
|
||||
struct ip_addr ipaddr;
|
||||
struct ip_addr netmask;
|
||||
|
@ -1747,8 +1779,7 @@ int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
|||
wifi_on(RTW_MODE_AP);
|
||||
}
|
||||
// start ap
|
||||
if (wifi_start_ap((char*) ssid, security_type, (char*) password, ssid_len,
|
||||
password_len, channel) < 0) {
|
||||
if (wifi_start_ap((char*) ssid, security_type, (char*) password, channel, 0) < 0) {
|
||||
printf("ERROR: Operation failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -3,16 +3,18 @@
|
|||
#define __WIFI_CONF_API_H
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "wifi_constants.h"
|
||||
#include "wifi_constants.h"
|
||||
#include "wifi_structures.h"
|
||||
#include "wifi_util.h"
|
||||
#include "wifi_ind.h"
|
||||
#include "wifi_ind.h"
|
||||
#include <platform/platform_stdlib.h>
|
||||
#include "wifi_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Macros
|
||||
******************************************************/
|
||||
|
@ -137,14 +139,14 @@ int wifi_manager_init(void);
|
|||
* RTW_ERROR : if an error occurred
|
||||
*/
|
||||
int wifi_connect(
|
||||
unsigned char bssid[ETH_ALEN],
|
||||
char use_bssid,
|
||||
char *ssid,
|
||||
rtw_security_t security_type,
|
||||
char *password,
|
||||
int ssid_len,
|
||||
int password_len,
|
||||
int key_id,
|
||||
void *semaphore);
|
||||
|
||||
/*
|
||||
int wifi_connect_bssid(
|
||||
unsigned char bssid[ETH_ALEN],
|
||||
char *ssid,
|
||||
|
@ -155,7 +157,7 @@ int wifi_connect_bssid(
|
|||
int password_len,
|
||||
int key_id,
|
||||
void *semaphore);
|
||||
|
||||
*/
|
||||
/** Disassociates from a Wi-Fi network.
|
||||
*
|
||||
* @return RTW_SUCCESS : On successful disassociation from
|
||||
|
@ -446,6 +448,8 @@ int wifi_get_lps_dtim(unsigned char *dtim);
|
|||
* @return RTW_SUCCESS : if successfully creates an AP
|
||||
* RTW_ERROR : if an error occurred
|
||||
*/
|
||||
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password, int channel, char ssid_hidden);
|
||||
/*
|
||||
int wifi_start_ap(
|
||||
char *ssid,
|
||||
rtw_security_t security_type,
|
||||
|
@ -453,7 +457,7 @@ int wifi_start_ap(
|
|||
int ssid_len,
|
||||
int password_len,
|
||||
int channel);
|
||||
|
||||
*/
|
||||
/** Starts an infrastructure WiFi network with hidden SSID
|
||||
*
|
||||
* @warning If a STA interface is active when this function is called, the softAP will\n
|
||||
|
@ -478,6 +482,7 @@ int wifi_start_ap(
|
|||
* @return RTW_SUCCESS : if successfully creates an AP
|
||||
* RTW_ERROR : if an error occurred
|
||||
*/
|
||||
/*
|
||||
int wifi_start_ap_with_hidden_ssid(
|
||||
char *ssid,
|
||||
rtw_security_t security_type,
|
||||
|
@ -485,7 +490,7 @@ int wifi_start_ap_with_hidden_ssid(
|
|||
int ssid_len,
|
||||
int password_len,
|
||||
int channel);
|
||||
|
||||
*/
|
||||
/** Initiates a scan to search for 802.11 networks.
|
||||
*
|
||||
* The scan progressively accumulates results over time, and
|
||||
|
@ -638,8 +643,6 @@ int wifi_restart_ap(
|
|||
unsigned char *ssid,
|
||||
rtw_security_t security_type,
|
||||
unsigned char *password,
|
||||
int ssid_len,
|
||||
int password_len,
|
||||
int channel);
|
||||
|
||||
int wifi_config_autoreconnect(__u8 mode, __u8 retyr_times, __u16 timeout);
|
||||
|
|
|
@ -530,8 +530,13 @@ enum sc_result SC_parse_scan_result_and_connect(scan_buf_arg* scan_buf, rtw_netw
|
|||
ret = SC_TARGET_CHANNEL_SCAN_FAIL;
|
||||
goto sc_connect_wifi_fail;
|
||||
}
|
||||
ret = wifi_connect_bssid(scan_result.mac, (char*)wifi->ssid.val, SC_translate_iw_security_mode(scan_result.sec_mode),
|
||||
(char*)wifi->password, ETH_ALEN, wifi->ssid.len, wifi->password_len, 0, NULL);
|
||||
ret = wifi_connect(
|
||||
scan_result.mac,
|
||||
1,
|
||||
(char*)wifi->ssid.val,
|
||||
SC_translate_iw_security_mode(scan_result.sec_mode),
|
||||
(char*)wifi->password,
|
||||
0, NULL);
|
||||
if (ret == RTW_SUCCESS)
|
||||
goto sc_connect_wifi_success;
|
||||
}
|
||||
|
@ -691,8 +696,13 @@ enum sc_result SC_connect_to_AP(void)
|
|||
goto wifi_connect_fail;
|
||||
}
|
||||
rtw_join_status = 0;//clear simple config status
|
||||
ret = wifi_connect_bssid(g_bssid, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password,
|
||||
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL);
|
||||
ret = wifi_connect(g_bssid,
|
||||
1,
|
||||
(char*)wifi.ssid.val,
|
||||
wifi.security_type,
|
||||
(char*)wifi.password,
|
||||
wifi.key_id,
|
||||
NULL);
|
||||
|
||||
if (ret == RTW_SUCCESS)
|
||||
goto wifi_connect_success;
|
||||
|
|
|
@ -68,15 +68,13 @@ struct simple_config_lib_config {
|
|||
|
||||
};
|
||||
|
||||
|
||||
#pragma pack(push, 1)
|
||||
#pragma pack(1)
|
||||
struct rtk_test_sc {
|
||||
/* API exposed to user */
|
||||
unsigned char ssid[32];
|
||||
unsigned char password[65];
|
||||
unsigned int ip_addr;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/* expose data */
|
||||
extern s32 is_promisc_callback_unlock;
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
#include "wifi_api.h"
|
||||
#include "wifi_user_set.h"
|
||||
|
||||
#ifdef CONFIG_ENABLE_WPS
|
||||
extern void cmd_ap_wps(int argc, char **argv);
|
||||
extern int wpas_wps_dev_config(u8 *dev_addr, u8 bregistrar);
|
||||
#endif //CONFIG_WPS_AP
|
||||
|
||||
//=========================================
|
||||
//--- Wlan Config Init-------------------
|
||||
WIFI_CONFIG wifi_cfg = {
|
||||
|
@ -68,6 +73,7 @@ STATION_CONFIG wifi_st_cfg = {
|
|||
.ssid = DEF_ST_SSID,
|
||||
.password = DEF_ST_PASSWORD,
|
||||
.bssid = DEF_ST_BSSID,
|
||||
.flg = DEF_ST_BSSID,
|
||||
.security_type = DEF_ST_SECURITY,
|
||||
.autoreconnect = DEF_ST_AUTORECONNECT,
|
||||
.reconnect_pause = DEF_ST_RECONNECT_PAUSE
|
||||
|
@ -115,9 +121,10 @@ uint32 write_wifi_cfg(uint32 flg)
|
|||
uint32 ret = 0;
|
||||
PFEEP_ELEMENT p = feep_tab;
|
||||
for(int m = 1; m && p->id != 0; m <<= 1, p++) {
|
||||
if((flg & m)
|
||||
&& flash_write_cfg(p->obj, p->id, p->size) < p->size) {
|
||||
ret |= m;
|
||||
if(flg & m) {
|
||||
if(!flash_write_cfg(p->obj, p->id, p->size)) {
|
||||
ret |= m;
|
||||
};
|
||||
};
|
||||
};
|
||||
return ret;
|
||||
|
@ -173,8 +180,6 @@ uint8 chk_ap_netif_num(void)
|
|||
return wlan_ap_netifn;
|
||||
}
|
||||
|
||||
extern int wifi_start_ap_s(PSOFTAP_CONFIG p);
|
||||
|
||||
rtw_result_t wifi_run_ap(void) {
|
||||
chk_ap_netif_num();
|
||||
|
||||
|
@ -186,7 +191,18 @@ rtw_result_t wifi_run_ap(void) {
|
|||
if(wext_set_sta_num(wifi_ap_cfg.max_sta) != 0) { // Max number of STAs, should be 1..3, default is 3
|
||||
error_printf("AP not set max connections %d!\n", wifi_ap_cfg.max_sta);
|
||||
};
|
||||
ret = wifi_start_ap_s(&wifi_ap_cfg);
|
||||
#if defined(CONFIG_ENABLE_WPS_AP) && CONFIG_ENABLE_WPS_AP
|
||||
// todo: ветка не доделана
|
||||
wpas_wps_dev_config(xnetif[WLAN_AP_NETIF_NUM].hwaddr, 1);
|
||||
#endif //CONFIG_WPS_AP
|
||||
if(wifi_ap_cfg.channel == 0 || wifi_ap_cfg.channel > 14) {
|
||||
wifi_ap_cfg.channel = 1;
|
||||
}
|
||||
ret = wifi_start_ap(wifi_ap_cfg.ssid, //char *ssid,
|
||||
wifi_ap_cfg.security_type, //rtw_security_t ecurity_type,
|
||||
wifi_ap_cfg.password, //char *password,
|
||||
wifi_ap_cfg.channel, //int channel
|
||||
wifi_ap_cfg.ssid_hidden); //
|
||||
wifi_run_mode |= RTW_MODE_AP;
|
||||
if (ret != RTW_SUCCESS) {
|
||||
error_printf("Error(%d): Start AP failed!\n\n", ret);;
|
||||
|
@ -233,13 +249,13 @@ rtw_result_t StartStDHCPClient(void)
|
|||
struct netif * pnetif = &xnetif[WLAN_ST_NETIF_NUM];
|
||||
DHCP_CONFIG *p = (dhcp_cfg *)&wifi_st_dhcp;
|
||||
unsigned char mode = p->mode;
|
||||
if((mode == 3)
|
||||
&& (p->ip == IP4ADDR(255,255,255,255)
|
||||
|| p->ip == IP4ADDR(0,0,0,0))) {
|
||||
mode = 2;
|
||||
if((mode == 3) // Auto fix
|
||||
&& p->ip != IP4ADDR(255,255,255,255)
|
||||
&& p->ip != IP4ADDR(0,0,0,0)) {
|
||||
// mode = 2; // fixed ip
|
||||
}
|
||||
else mode = 1;
|
||||
if(mode == 2) {
|
||||
else mode = 1; // DHCP On
|
||||
if(mode == 2) { // fixed ip
|
||||
netif_set_addr(pnetif, (ip_addr_t *)&p->ip, (ip_addr_t *)&p->mask, (ip_addr_t *)&p->gw);
|
||||
// dhcps_init(pnetif);
|
||||
}
|
||||
|
@ -254,8 +270,8 @@ rtw_result_t StartStDHCPClient(void)
|
|||
p->ip = pnetif->ip_addr.addr;
|
||||
p->gw = pnetif->gw.addr;
|
||||
p->mask = pnetif->netmask.addr;
|
||||
if(p->mode == 3) {
|
||||
p->mode = 2;
|
||||
if(p->mode == 3) { // Auto fix
|
||||
p->mode = 2; // fixed ip
|
||||
write_wifi_cfg(BID_ST_DHCP_CFG);
|
||||
}
|
||||
ret = RTW_SUCCESS;
|
||||
|
@ -282,9 +298,14 @@ rtw_result_t wifi_run_st(void) {
|
|||
}
|
||||
#endif
|
||||
info_printf("Connected to AP (%s, netif%d)...\n", wlan_st_name, wlan_st_netifn);
|
||||
ret = wifi_connect(wifi_st_cfg.ssid, wifi_st_cfg.security_type,
|
||||
wifi_st_cfg.password, strlen(wifi_st_cfg.ssid),
|
||||
strlen(wifi_st_cfg.password), -1, NULL);
|
||||
ret = wifi_connect(
|
||||
wifi_st_cfg.bssid,
|
||||
wifi_st_cfg.flg,
|
||||
wifi_st_cfg.ssid,
|
||||
wifi_st_cfg.security_type,
|
||||
wifi_st_cfg.password,
|
||||
-1,
|
||||
NULL);
|
||||
wifi_run_mode |= RTW_MODE_STA;
|
||||
if (ret != RTW_SUCCESS) {
|
||||
error_printf("%s: Operation failed! Error(%d)\n", __func__, ret);
|
||||
|
@ -328,7 +349,7 @@ int _wifi_on(rtw_mode_t mode) {
|
|||
// wext_set_adaptivity(RTW_ADAPTIVITY_NORMAL);
|
||||
// wext_set_adaptivity(RTW_ADAPTIVITY_CARRIER_SENSE);
|
||||
|
||||
devnum = (mode == RTW_MODE_STA_AP);
|
||||
devnum = (mode == RTW_MODE_STA_AP); // flag use 2 netif
|
||||
|
||||
ret = rltk_wlan_init(0, mode);
|
||||
if (ret < 0) return ret;
|
||||
|
@ -390,8 +411,9 @@ void _LwIP_Init(void)
|
|||
netif_set_up(&xnetif[idx]);
|
||||
}
|
||||
info_printf("interface %d is initialized\n", idx);
|
||||
wifi_mode = 0;
|
||||
lwip_init_done = 1;
|
||||
// для отслеживания первого старта ?
|
||||
// wifi_mode = RTW_MODE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -400,9 +422,6 @@ int wifi_run(rtw_mode_t mode) {
|
|||
#if CONFIG_DEBUG_LOG > 4
|
||||
debug_printf("\n%s(%d), %d\n", __func__, mode, wifi_run_mode);
|
||||
#endif
|
||||
if(mode != RTW_MODE_NONE) {
|
||||
_LwIP_Init();
|
||||
};
|
||||
if(wifi_run_mode & RTW_MODE_AP) {
|
||||
info_printf("Deinit old AP...\n");
|
||||
LwIP_DHCP(WLAN_AP_NETIF_NUM, DHCP_STOP);
|
||||
|
@ -435,25 +454,37 @@ int wifi_run(rtw_mode_t mode) {
|
|||
if(wifi_set_country(wifi_cfg.country_code) != RTW_SUCCESS) {
|
||||
error_printf("Error set tx country_code (%d)!", wifi_cfg.country_code);
|
||||
};
|
||||
// extern uint8_t rtw_power_percentage_idx; // rtw_tx_pwr_percentage_t
|
||||
#if 1 // rltk_set_tx_power_percentage() return all = 0 !
|
||||
rltk_set_tx_power_percentage(wifi_cfg.tx_pwr);
|
||||
#else
|
||||
// extern uint8_t rtw_power_percentage_idx;
|
||||
if(rtw_power_percentage_idx != wifi_cfg.tx_pwr) {
|
||||
if(rltk_set_tx_power_percentage(wifi_cfg.tx_pwr) != RTW_SUCCESS) {
|
||||
error_printf("Error set tx power (%d)!", wifi_cfg.tx_pwr);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
debug_printf("mode == wifi_mode? (%d == %d?)\n", mode, wifi_mode);
|
||||
// if(mode == wifi_mode)
|
||||
{
|
||||
if((wifi_mode == RTW_MODE_AP) || (wifi_mode == RTW_MODE_STA_AP)) {
|
||||
wifi_run_ap();
|
||||
};
|
||||
if((wifi_mode == RTW_MODE_STA) || (wifi_mode == RTW_MODE_STA_AP)) {
|
||||
wifi_run_st();
|
||||
};
|
||||
switch(wifi_mode) {
|
||||
case RTW_MODE_STA_AP:
|
||||
wifi_run_ap();
|
||||
wifi_run_st();
|
||||
break;
|
||||
case RTW_MODE_STA:
|
||||
wifi_run_st();
|
||||
break;
|
||||
case RTW_MODE_AP:
|
||||
wifi_run_ap();
|
||||
break;
|
||||
#if 0// CONFIG_ENABLE_??
|
||||
case RTW_MODE_PROMISC:
|
||||
break;
|
||||
#endif
|
||||
#if CONFIG_ENABLE_P2P
|
||||
case RTW_MODE_P2P:
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
error_printf("Error WiFi mode(%d)\n", wifi_mode);
|
||||
}
|
||||
#if CONFIG_INTERACTIVE_MODE
|
||||
/* Initial uart rx swmaphore*/
|
||||
vSemaphoreCreateBinary(uart_rx_interrupt_sema);
|
||||
|
@ -475,6 +506,7 @@ error_end:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Load cfg, init WiFi + LwIP init, WiFi start if wifi_cfg.mode != RTW_MODE_NONE */
|
||||
void wifi_init(void) {
|
||||
debug_printf("\nLoad Config\n");
|
||||
read_wifi_cfg(wifi_cfg.load_flg); // DEF_LOAD_CFG
|
||||
|
@ -483,13 +515,12 @@ void wifi_init(void) {
|
|||
// Call back from application layer after wifi_connection success
|
||||
// p_write_reconnect_ptr = wlan_write_reconnect_data_to_flash;
|
||||
p_wlan_autoreconnect_hdl = NULL;
|
||||
if (wifi_cfg.mode != RTW_MODE_NONE) {
|
||||
wifi_mode = wifi_cfg.mode;
|
||||
_LwIP_Init();
|
||||
#if CONFIG_WIFI_IND_USE_THREAD
|
||||
wifi_manager_init();
|
||||
wifi_manager_init();
|
||||
#endif
|
||||
wifi_run(wifi_cfg.mode);
|
||||
}
|
||||
// wifi_cfg.mode = RTW_MODE_PROMISC; //RTW_MODE_P2P;
|
||||
wifi_run(wifi_cfg.mode);
|
||||
}
|
||||
|
||||
rtw_security_t translate_rtw_security(u8 security_type)
|
||||
|
@ -519,6 +550,7 @@ rtw_security_t translate_rtw_security(u8 security_type)
|
|||
return security_mode;
|
||||
}
|
||||
|
||||
|
||||
void show_wifi_ap_ip(void) {
|
||||
printf("SoftAP ip: " IPSTR "\n", IP2STR(&xnetif[WLAN_AP_NETIF_NUM].ip_addr));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef _WIFI_API_H_
|
||||
#define _WIFI_API_H_
|
||||
#include "wifi_constants.h"
|
||||
#include "wifi_conf.h"
|
||||
|
||||
#define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1])
|
||||
|
@ -64,21 +63,21 @@ typedef struct _wifi_config {
|
|||
typedef struct _softap_config {
|
||||
unsigned char ssid[NDIS_802_11_LENGTH_SSID];
|
||||
unsigned char password[IW_PASSPHRASE_MAX_SIZE];
|
||||
rtw_security_t security_type; // Only: RTW_SECURITY_OPEN, RTW_SECURITY_WPA2_AES_PSK
|
||||
unsigned short beacon_interval; // default 100
|
||||
rtw_security_t security_type; // RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK
|
||||
uint16 beacon_interval; // Note: support 100 ~ 60000 ms, default 100
|
||||
unsigned char channel; // 1..14
|
||||
unsigned char ssid_hidden; // Note: default 0
|
||||
unsigned char max_sta; // 1..3
|
||||
} SOFTAP_CONFIG, * PSOFTAP_CONFIG;
|
||||
} SOFTAP_CONFIG, *PSOFTAP_CONFIG;
|
||||
//---- Interface 1 - wlan1 - ST - struct -
|
||||
typedef struct _station_config {
|
||||
unsigned char ssid[NDIS_802_11_LENGTH_SSID];
|
||||
unsigned char password[IW_PASSPHRASE_MAX_SIZE];
|
||||
rtw_security_t security_type;
|
||||
unsigned char bssid[6]; // Note: If bssid set is not ff.ff.ff.ff.ff.ff,
|
||||
// station will connect to the router with both ssid[] and bssid[] matched.
|
||||
unsigned char bssid[6]; // Note: If bssid set is not ff.ff.ff.ff.ff.ff || 00:00:00:00:00:00
|
||||
unsigned char autoreconnect; // 0 - none, 1..254 - count, 255 - all
|
||||
unsigned char reconnect_pause; // in sec
|
||||
unsigned char reconnect_pause; // in sec
|
||||
unsigned char flg; // station will connect to the router with both ssid[], else if set flg - bssid[] matched.
|
||||
// rtw_adaptivity_mode_t
|
||||
} STATION_CONFIG, *PSTATION_CONFIG;
|
||||
//--- LwIP Config -------------------------
|
||||
|
@ -106,6 +105,7 @@ extern DHCP_CONFIG wifi_ap_dhcp;
|
|||
extern STATION_CONFIG wifi_st_cfg;
|
||||
extern DHCP_CONFIG wifi_st_dhcp;
|
||||
extern rtw_mode_t wifi_run_mode;
|
||||
extern rtw_mode_t wifi_mode;
|
||||
extern char wlan_st_name[];
|
||||
extern char wlan_ap_name[];
|
||||
extern char wlan_st_netifn;
|
||||
|
|
|
@ -124,9 +124,9 @@ extern void cmd_googlenest(int argc, char **argv);
|
|||
extern void cmd_jd_smart(int argc, char **argv);
|
||||
#endif
|
||||
#if CONFIG_WLAN
|
||||
static void cmd_wifi_on(int argc, char **argv);
|
||||
static void cmd_wifi_off(int argc, char **argv);
|
||||
static void cmd_wifi_disconnect(int argc, char **argv);
|
||||
void cmd_wifi_on(int argc, char **argv);
|
||||
void cmd_wifi_off(int argc, char **argv);
|
||||
void cmd_wifi_disconnect(int argc, char **argv);
|
||||
extern void cmd_promisc(int argc, char **argv);
|
||||
extern void cmd_simple_config(int argc, char **argv);
|
||||
|
||||
|
@ -222,9 +222,8 @@ static void cmd_wifi_sta_and_ap(int argc, char **argv)
|
|||
if(wifi_start_ap(argv[1],
|
||||
RTW_SECURITY_WPA2_AES_PSK,
|
||||
argv[3],
|
||||
strlen((const char *)argv[1]),
|
||||
strlen((const char *)argv[3]),
|
||||
channel
|
||||
channel,
|
||||
0
|
||||
) != RTW_SUCCESS) {
|
||||
printf("ERROR: Operation failed!\n\n");
|
||||
return;
|
||||
|
@ -234,9 +233,8 @@ static void cmd_wifi_sta_and_ap(int argc, char **argv)
|
|||
if(wifi_start_ap(argv[1],
|
||||
RTW_SECURITY_OPEN,
|
||||
NULL,
|
||||
strlen((const char *)argv[1]),
|
||||
0,
|
||||
channel
|
||||
channel,
|
||||
0
|
||||
) != RTW_SUCCESS) {
|
||||
printf("ERROR: Operation failed!\n");
|
||||
return;
|
||||
|
@ -332,9 +330,8 @@ static void cmd_wifi_ap(int argc, char **argv)
|
|||
if(wifi_start_ap(argv[1],
|
||||
RTW_SECURITY_WPA2_AES_PSK,
|
||||
argv[3],
|
||||
strlen((const char *)argv[1]),
|
||||
strlen((const char *)argv[3]),
|
||||
channel
|
||||
channel,
|
||||
0
|
||||
) != RTW_SUCCESS) {
|
||||
printf("ERROR: Operation failed!\n");
|
||||
return;
|
||||
|
@ -344,9 +341,8 @@ static void cmd_wifi_ap(int argc, char **argv)
|
|||
if(wifi_start_ap(argv[1],
|
||||
RTW_SECURITY_OPEN,
|
||||
NULL,
|
||||
strlen((const char *)argv[1]),
|
||||
0,
|
||||
channel
|
||||
channel,
|
||||
0
|
||||
) != RTW_SUCCESS) {
|
||||
printf("ERROR: Operation failed!\n");
|
||||
return;
|
||||
|
@ -443,11 +439,12 @@ static void cmd_wifi_connect(int argc, char **argv)
|
|||
semaphore = NULL;
|
||||
}
|
||||
|
||||
ret = wifi_connect(ssid,
|
||||
security_type,
|
||||
password,
|
||||
ssid_len,
|
||||
password_len,
|
||||
ret = wifi_connect(
|
||||
NULL,
|
||||
0,
|
||||
ssid,
|
||||
security_type,
|
||||
password,
|
||||
key_id,
|
||||
semaphore);
|
||||
|
||||
|
@ -480,7 +477,6 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
|
|||
char *ssid = NULL;
|
||||
rtw_security_t security_type;
|
||||
char *password;
|
||||
int bssid_len;
|
||||
int ssid_len = 0;
|
||||
int password_len;
|
||||
int key_id;
|
||||
|
@ -525,21 +521,18 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
|
|||
if(argc == 3 + index){
|
||||
security_type = RTW_SECURITY_OPEN;
|
||||
password = NULL;
|
||||
bssid_len = ETH_ALEN;
|
||||
password_len = 0;
|
||||
key_id = 0;
|
||||
semaphore = NULL;
|
||||
}else if(argc ==4 + index){
|
||||
security_type = RTW_SECURITY_WPA2_AES_PSK;
|
||||
password = argv[3 + index];
|
||||
bssid_len = ETH_ALEN;
|
||||
password_len = strlen((const char *)argv[3 + index]);
|
||||
key_id = 0;
|
||||
semaphore = NULL;
|
||||
}else{
|
||||
security_type = RTW_SECURITY_WEP_PSK;
|
||||
password = argv[3 + index];
|
||||
bssid_len = ETH_ALEN;
|
||||
password_len = strlen((const char *)argv[3 + index]);
|
||||
key_id = atoi(argv[4 + index]);
|
||||
if(( password_len != 5) && (password_len != 13)) {
|
||||
|
@ -553,13 +546,12 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
|
|||
semaphore = NULL;
|
||||
}
|
||||
|
||||
ret = wifi_connect_bssid(bssid,
|
||||
ret = wifi_connect(
|
||||
bssid,
|
||||
1,
|
||||
ssid,
|
||||
security_type,
|
||||
password,
|
||||
bssid_len,
|
||||
ssid_len,
|
||||
password_len,
|
||||
security_type,
|
||||
password,
|
||||
key_id,
|
||||
semaphore);
|
||||
|
||||
|
@ -578,7 +570,7 @@ static void cmd_wifi_connect_bssid(int argc, char **argv)
|
|||
printf("Got IP after %dms.\n", (tick3-tick1));
|
||||
}
|
||||
|
||||
static void cmd_wifi_disconnect(int argc, char **argv)
|
||||
void cmd_wifi_disconnect(int argc, char **argv)
|
||||
{
|
||||
int timeout = 20;
|
||||
char essid[33];
|
||||
|
@ -714,14 +706,14 @@ static void cmd_wifi_info(int argc, char **argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void cmd_wifi_on(int argc, char **argv)
|
||||
void cmd_wifi_on(int argc, char **argv)
|
||||
{
|
||||
if(wifi_on(RTW_MODE_STA)<0){
|
||||
printf("ERROR: Wifi on failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void cmd_wifi_off(int argc, char **argv)
|
||||
void cmd_wifi_off(int argc, char **argv)
|
||||
{
|
||||
#if CONFIG_WEBSERVER
|
||||
stop_web_server();
|
||||
|
@ -1059,7 +1051,7 @@ static const cmd_entry cmd_table[] = {
|
|||
{"wifi_wps", cmd_wps},
|
||||
#endif
|
||||
#ifdef CONFIG_WPS_AP
|
||||
//pvvx {"wifi_ap_wps", cmd_ap_wps},
|
||||
{"wifi_ap_wps", cmd_ap_wps},
|
||||
#endif
|
||||
#if CONFIG_ENABLE_P2P
|
||||
{"wifi_p2p_start", cmd_wifi_p2p_start},
|
||||
|
|
|
@ -333,10 +333,14 @@ int joinlink_finish(unsigned char security_type)
|
|||
//printf("ap_bssid: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", ap_bssid[0],ap_bssid[1],ap_bssid[2],ap_bssid[3],ap_bssid[4],ap_bssid[5]);
|
||||
|
||||
|
||||
ret = wifi_connect((unsigned char *)result.ssid, security_mode,
|
||||
(unsigned char *)result.pwd, result.ssid_length,
|
||||
result.pwd_length,
|
||||
0,NULL);
|
||||
ret = wifi_connect(
|
||||
NULL,
|
||||
0,
|
||||
(unsigned char *)result.ssid,
|
||||
security_mode,
|
||||
(unsigned char *)result.pwd,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
if(ret == RTW_SUCCESS){
|
||||
printf("Connect ok!\n");
|
||||
|
|
|
@ -1694,11 +1694,12 @@ int uartadapter_connect_wifi(rtw_network_info_t *p_wifi, uint32_t channel, uint8
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = wifi_connect((char*)p_wifi->ssid.val,
|
||||
ret = wifi_connect(
|
||||
NULL,
|
||||
0,
|
||||
(char*)p_wifi->ssid.val,
|
||||
p_wifi->security_type,
|
||||
(char*)p_wifi->password,
|
||||
p_wifi->ssid.len,
|
||||
p_wifi->password_len,
|
||||
p_wifi->key_id,
|
||||
NULL);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ SD_RESULT SD_GetCapacity(uint32_t *sector_count) {
|
|||
|
||||
//----- SD_ReadBlocks
|
||||
SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
|
||||
int rd_count = 0;
|
||||
int rd_count;
|
||||
unsigned char * buf;
|
||||
|
||||
if ((u32) data & 3) {
|
||||
|
@ -144,7 +144,7 @@ SD_RESULT SD_ReadBlocks(u32 sector, u8 *data, u32 count) {
|
|||
|
||||
//----- SD_WriteBlocks
|
||||
SD_RESULT SD_WriteBlocks(u32 sector, const u8 *data, u32 count) {
|
||||
int wr_count = 0;
|
||||
int wr_count;
|
||||
unsigned char * buf;
|
||||
|
||||
if ((u32) data & 3) {
|
||||
|
|
|
@ -612,20 +612,20 @@ struct _ADAPTER{
|
|||
u16 interface_type;//USB,SDIO,SPI,PCI
|
||||
u32 work_mode; //STA, AP, STA+AP, PROMISC, P2P
|
||||
|
||||
struct dvobj_priv *dvobj; //+8
|
||||
struct mlme_priv mlmepriv; //+12 [1244]
|
||||
struct mlme_ext_priv mlmeextpriv; //+1256 [912]
|
||||
struct cmd_priv cmdpriv; //+2168
|
||||
struct dvobj_priv *dvobj;
|
||||
struct mlme_priv mlmepriv;
|
||||
struct mlme_ext_priv mlmeextpriv;
|
||||
struct cmd_priv cmdpriv;
|
||||
struct evt_priv evtpriv;
|
||||
//struct io_queue *pio_queue;
|
||||
struct io_priv iopriv;
|
||||
struct xmit_priv xmitpriv; //+2248
|
||||
struct recv_priv recvpriv; //+2752
|
||||
struct sta_priv stapriv; //+3024 [164]
|
||||
struct xmit_priv xmitpriv;
|
||||
struct recv_priv recvpriv;
|
||||
struct sta_priv stapriv;
|
||||
struct security_priv securitypriv;
|
||||
struct registry_priv registrypriv; // registrypriv.power_percentage_idx +4929
|
||||
struct pwrctrl_priv pwrctrlpriv; // pwrctrlpriv.bInternalAutoSuspend //+5061
|
||||
struct eeprom_priv eeprompriv; //+5128?
|
||||
struct registry_priv registrypriv;
|
||||
struct pwrctrl_priv pwrctrlpriv;
|
||||
struct eeprom_priv eeprompriv;
|
||||
//TODO
|
||||
// struct led_priv ledpriv;
|
||||
|
||||
|
@ -666,20 +666,20 @@ struct _ADAPTER{
|
|||
struct wifi_display_info wfd_info;
|
||||
#endif //CONFIG_WFD
|
||||
|
||||
PVOID HalData; //+5656
|
||||
u32 hal_data_sz; //+5660
|
||||
struct hal_ops HalFunc; //+5664
|
||||
PVOID HalData;
|
||||
u32 hal_data_sz;
|
||||
struct hal_ops HalFunc;
|
||||
|
||||
s32 bDriverStopped; //+5880
|
||||
s32 bSurpriseRemoved; //+5884
|
||||
s32 bCardDisableWOHSM; //+5888
|
||||
u8 RxStop; //Used to stop rx thread as early as possible //+5892
|
||||
s32 bDriverStopped;
|
||||
s32 bSurpriseRemoved;
|
||||
s32 bCardDisableWOHSM;
|
||||
u8 RxStop; //Used to stop rx thread as early as possible
|
||||
|
||||
u32 IsrContent;
|
||||
u32 ImrContent;
|
||||
|
||||
u8 EepromAddressSize;
|
||||
u8 hw_init_completed; //+5905
|
||||
u8 hw_init_completed;
|
||||
u8 bDriverIsGoingToUnload;
|
||||
u8 init_adpt_in_progress;
|
||||
u8 bMpDriver;
|
||||
|
@ -692,9 +692,9 @@ struct _ADAPTER{
|
|||
_thread_hdl_ evtThread;
|
||||
#endif
|
||||
#if defined(CONFIG_ISR_THREAD_MODE_POLLING) || defined(CONFIG_ISR_THREAD_MODE_INTERRUPT)
|
||||
struct task_struct isrThread; //+5888?
|
||||
struct task_struct isrThread;
|
||||
#endif
|
||||
struct task_struct cmdThread; //+5920
|
||||
struct task_struct cmdThread;
|
||||
#ifdef CONFIG_XMIT_THREAD_MODE
|
||||
struct task_struct xmitThread;
|
||||
#endif
|
||||
|
@ -702,13 +702,13 @@ struct _ADAPTER{
|
|||
struct task_struct recvThread;
|
||||
#endif
|
||||
#ifdef CONFIG_RECV_TASKLET_THREAD
|
||||
struct task_struct recvtasklet_thread; //+5952
|
||||
struct task_struct recvtasklet_thread;
|
||||
#endif
|
||||
#ifdef CONFIG_XMIT_TASKLET_THREAD
|
||||
#ifdef PLATFORM_LINUX
|
||||
struct tasklet_struct xmit_tasklet;
|
||||
#else
|
||||
struct task_struct xmittasklet_thread; //+5984
|
||||
struct task_struct xmittasklet_thread;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_SDIO_XMIT_THREAD
|
||||
|
@ -721,8 +721,8 @@ struct _ADAPTER{
|
|||
void (*dvobj_deinit)(struct dvobj_priv *dvobj);
|
||||
#endif
|
||||
|
||||
void (*intf_start)(_adapter * adapter); //+6008
|
||||
void (*intf_stop)(_adapter * adapter); //+6012
|
||||
void (*intf_start)(_adapter * adapter);
|
||||
void (*intf_stop)(_adapter * adapter);
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
_nic_hdl hndis_adapter;//hNdisAdapter(NDISMiniportAdapterHandle);
|
||||
|
@ -741,9 +741,9 @@ struct _ADAPTER{
|
|||
#endif //#ifdef PLATFORM_ECOS
|
||||
|
||||
#if defined(PLATFORM_FREERTOS) || defined (PLATFORM_CMSIS_RTOS)
|
||||
_nic_hdl pnetdev; //+6016
|
||||
int bup; //+6020
|
||||
struct net_device_stats stats; //+6024
|
||||
_nic_hdl pnetdev;
|
||||
int bup;
|
||||
struct net_device_stats stats;
|
||||
#endif //#ifdef PLATFORM_FREERTOS
|
||||
|
||||
#ifdef PLATFORM_LINUX
|
||||
|
@ -773,7 +773,7 @@ struct _ADAPTER{
|
|||
int bup;
|
||||
_lock glock;
|
||||
#endif //PLATFORM_FREEBSD
|
||||
u8 net_closed; //+6052
|
||||
u8 net_closed;
|
||||
|
||||
u8 bFWReady;
|
||||
//u8 bBTFWReady;
|
||||
|
@ -785,20 +785,20 @@ struct _ADAPTER{
|
|||
u8 bDisableAutosuspend;
|
||||
#endif
|
||||
|
||||
_adapter *pbuddy_adapter; //+6056
|
||||
_adapter *pbuddy_adapter;
|
||||
|
||||
_mutex *hw_init_mutex; //+6060
|
||||
_mutex *hw_init_mutex;
|
||||
#if defined(CONFIG_CONCURRENT_MODE)
|
||||
u8 isprimary; //is primary adapter or not //+6064
|
||||
u8 adapter_type; //+6065
|
||||
u8 iface_type; //interface port type //+6056
|
||||
u8 isprimary; //is primary adapter or not
|
||||
u8 adapter_type;
|
||||
u8 iface_type; //interface port type
|
||||
|
||||
//for global synchronization
|
||||
_mutex *ph2c_fwcmd_mutex; //+6068
|
||||
_mutex *psetch_mutex; //+6072
|
||||
_mutex *psetbw_mutex; //+6076
|
||||
_mutex *ph2c_fwcmd_mutex;
|
||||
_mutex *psetch_mutex;
|
||||
_mutex *psetbw_mutex;
|
||||
|
||||
struct co_data_priv *pcodatapriv;//data buffer shared among interfaces //+6080
|
||||
struct co_data_priv *pcodatapriv;//data buffer shared among interfaces
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BR_EXT
|
||||
|
@ -827,7 +827,7 @@ struct _ADAPTER{
|
|||
PLOOPBACKDATA ploopback;
|
||||
#endif
|
||||
|
||||
u8 fix_rate; //+6084
|
||||
u8 fix_rate;
|
||||
#ifdef CONFIG_CAC_TEST
|
||||
unsigned char in_cta_test;
|
||||
#endif
|
||||
|
@ -837,7 +837,7 @@ struct _ADAPTER{
|
|||
u8 debug_level;
|
||||
#endif
|
||||
|
||||
}; // [6088] (!)
|
||||
};
|
||||
|
||||
#define adapter_to_dvobj(adapter) (adapter->dvobj)
|
||||
#define adapter_to_pwrctl(adapter) (&adapter->pwrctrlpriv)
|
||||
|
|
|
@ -234,7 +234,7 @@ struct hal_ops {
|
|||
void (*disable_interrupt)(_adapter *padapter);
|
||||
|
||||
s32 (*interrupt_handler)(_adapter *padapter);
|
||||
// void (*clear_interrupt)(_adapter *padapter); // None SDK3.5a
|
||||
void (*clear_interrupt)(_adapter *padapter);
|
||||
|
||||
#ifdef CONFIG_WOWLAN
|
||||
void (*disable_interrupt_but_cpwm2)(_adapter *padapter);
|
||||
|
|
|
@ -925,11 +925,11 @@ Result:
|
|||
|
||||
#define H2C_RSP_OFFSET 512
|
||||
|
||||
#define H2C_SUCCESS 0x00
|
||||
#define H2C_SUCCESS 0x00
|
||||
#define H2C_SUCCESS_RSP 0x01
|
||||
#define H2C_DUPLICATED 0x02
|
||||
#define H2C_DROPPED 0x03
|
||||
#define H2C_PARAMETERS_ERROR 0x04
|
||||
#define H2C_DROPPED 0x03
|
||||
#define H2C_PARAMETERS_ERROR 0x04
|
||||
#define H2C_REJECTED 0x05
|
||||
#define H2C_CMD_OVERFLOW 0x06
|
||||
#define H2C_RESERVED 0x07
|
||||
|
|
|
@ -68,7 +68,7 @@ u8 rtw_validate_ssid(NDIS_802_11_SSID *ssid);
|
|||
u16 rtw_get_cur_max_rate(_adapter *adapter);
|
||||
//int rtw_set_scan_mode(_adapter *adapter, RT_SCAN_TYPE scan_mode);
|
||||
int rtw_set_channel_plan(_adapter *adapter, u8 channel_plan);
|
||||
//int rtw_set_country(_adapter *adapter, const char *country_code);
|
||||
int rtw_set_country(_adapter *adapter, const char *country_code);
|
||||
//int rtw_set_band(_adapter *adapter, enum _BAND band);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -481,13 +481,13 @@ typedef struct _RT_CHANNEL_INFO
|
|||
extern int rtw_is_channel_set_contains_channel(RT_CHANNEL_INFO *channel_set, const u32 channel_num, int *pchannel_idx);
|
||||
|
||||
#ifdef CONFIG_CUSTOM_IE
|
||||
#ifndef __CUS_IE_
|
||||
#define __CUS_IE_
|
||||
typedef struct __cus_ie
|
||||
#ifndef _CUS_IE_
|
||||
#define _CUS_IE_
|
||||
typedef struct _cus_ie
|
||||
{
|
||||
u8 *ie;
|
||||
u8 type;
|
||||
} rtw_custom_ie_t, *p_rtw_custom_ie_t;
|
||||
}rtw_custom_ie_t, *p_rtw_custom_ie_t;
|
||||
#endif /* _CUS_IE_ */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ typedef enum {
|
|||
RTW_TX_PWR_PERCENTAGE_75 = 1, /* 75% */
|
||||
RTW_TX_PWR_PERCENTAGE_50 = 2, /* 50% */
|
||||
RTW_TX_PWR_PERCENTAGE_25 = 3, /* 25% */
|
||||
RTW_TX_PWR_PERCENTAGE_12_5 = 4, /* 12.5% */
|
||||
RTW_TX_PWR_PERCENTAGE_12_5 = 4 /* 12.5% */
|
||||
}rtw_tx_pwr_percentage_t;
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,13 +7,7 @@
|
|||
|
||||
#include "osdep_service.h"
|
||||
#include "freertos/wrapper.h"
|
||||
//#include "wlan_bssdef.h"
|
||||
//#include "wifi_simple_config_parser.h"
|
||||
//#include "rtw_rf.h"
|
||||
#include "rtl_bios_data.h"
|
||||
#include "drv_types.h"
|
||||
#include "wlan/realtek/src/hal/hal_data.h"
|
||||
//#include "phydm.h"
|
||||
|
||||
#define _atr_aligned2_ __attribute__((aligned(2)))
|
||||
#define _atr_aligned4_ __attribute__((aligned(4)))
|
||||
|
@ -60,16 +54,16 @@ typedef uint8_t BOOLEAN;
|
|||
|
||||
typedef uint8_t u1Byte;
|
||||
typedef uint16_t u2Byte;
|
||||
//typedef uint32_t u4Byte;
|
||||
typedef uint32_t u4Byte;
|
||||
typedef uint64_t u8Byte;
|
||||
typedef uint64_t __attribute__((aligned(4))) _u8Byte;
|
||||
//typedef sint8_t s1Byte;
|
||||
typedef sint8_t s1Byte;
|
||||
typedef sint16_t s2Byte;
|
||||
//typedef sint32_t s4Byte;
|
||||
//typedef sint8_t *ps1Byte;
|
||||
typedef sint32_t s4Byte;
|
||||
typedef sint8_t *ps1Byte;
|
||||
typedef uint8_t *pu1Byte;
|
||||
typedef uint16_t *pu2Byte;
|
||||
//typedef uint32_t *pu4Byte;
|
||||
typedef uint32_t *pu4Byte;
|
||||
|
||||
typedef uint32_t sizetype;
|
||||
typedef struct _ADAPTER _adapter;
|
||||
|
@ -81,7 +75,6 @@ typedef void *_mutex;
|
|||
|
||||
typedef int (*init_done_ptr)(void);
|
||||
|
||||
/* rtw_efuse.h
|
||||
enum _EFUSE_DEF_TYPE // : sint32_t
|
||||
{
|
||||
TYPE_EFUSE_MAX_SECTION = 0x0,
|
||||
|
@ -97,9 +90,7 @@ enum _IFACE_TYPE //: sint32_t
|
|||
{
|
||||
IFACE_PORT0 = 0x0, IFACE_PORT1 = 0x1, MAX_IFACE_PORT = 0x2,
|
||||
};
|
||||
*/
|
||||
|
||||
/* rtl8195a_pmu_task.h
|
||||
enum _FW_ERR0_STATUS_ //: sint32_t
|
||||
{
|
||||
FES0_H2C_CMDID = 0x1,
|
||||
|
@ -363,7 +354,7 @@ struct atomic_t {
|
|||
_lock lock;
|
||||
};
|
||||
*/
|
||||
/* osdep_intf.h
|
||||
|
||||
struct iw_request_info {
|
||||
uint16_t cmd;
|
||||
uint16_t flags;
|
||||
|
@ -371,9 +362,7 @@ struct iw_request_info {
|
|||
|
||||
typedef int (*iw_handler)(struct net_device *, struct iw_request_info *,
|
||||
union iwreq_data *, char *);
|
||||
*/
|
||||
|
||||
/* wlan_bssdef.h
|
||||
struct _NDIS_802_11_SSID {
|
||||
uint32_t SsidLength;
|
||||
uint8_t Ssid[36];
|
||||
|
@ -466,7 +455,6 @@ struct wlan_network {
|
|||
WLAN_BSSID_EX network;
|
||||
WLAN_BCN_INFO BcnInfo;
|
||||
};
|
||||
*/
|
||||
|
||||
/* osdep_service.h
|
||||
typedef void *_timerHandle;
|
||||
|
@ -479,13 +467,12 @@ struct wlan_network {
|
|||
};
|
||||
|
||||
typedef struct timer_list _timer;
|
||||
*/
|
||||
/* rtw_qos.h
|
||||
*/
|
||||
|
||||
struct qos_priv {
|
||||
uint32_t qos_option;
|
||||
};
|
||||
*/
|
||||
/* wifi.h
|
||||
|
||||
struct __attribute__((packed)) _atr_aligned2_ rtw_ieee80211_ht_cap {
|
||||
uint16_t cap_info;
|
||||
uint8_t ampdu_params_info;
|
||||
|
@ -494,9 +481,7 @@ struct __attribute__((packed)) _atr_aligned2_ rtw_ieee80211_ht_cap {
|
|||
uint32_t tx_BF_cap_info;
|
||||
uint8_t antenna_selection_info;
|
||||
};
|
||||
*/
|
||||
|
||||
/* rtw_ht.h
|
||||
struct ht_priv {
|
||||
uint32_t ht_option;
|
||||
uint32_t ampdu_enable;
|
||||
|
@ -508,8 +493,7 @@ struct ht_priv {
|
|||
uint8_t stbc_cap;
|
||||
struct rtw_ieee80211_ht_cap ht_cap;
|
||||
};
|
||||
*/
|
||||
/* rtw_mlme.h
|
||||
|
||||
struct _atr_aligned4_ _RT_LINK_DETECT_T {
|
||||
uint32_t NumTxOkInPeriod;
|
||||
uint32_t NumRxOkInPeriod;
|
||||
|
@ -522,6 +506,7 @@ struct _atr_aligned4_ _RT_LINK_DETECT_T {
|
|||
BOOLEAN bHigherBusyTxTraffic;
|
||||
};
|
||||
typedef struct _RT_LINK_DETECT_T RT_LINK_DETECT_T;
|
||||
|
||||
enum _RT_SCAN_TYPE //: sint32_t
|
||||
{
|
||||
SCAN_PASSIVE = 0x0, SCAN_ACTIVE = 0x1, SCAN_MIX = 0x2
|
||||
|
@ -584,8 +569,7 @@ struct mlme_priv {
|
|||
uint8_t scanning_via_buddy_intf;
|
||||
struct recv_frame *p_copy_recv_frame;
|
||||
};
|
||||
*/
|
||||
/* rtw_mlme_ext.h
|
||||
|
||||
struct _atr_aligned4_ _RT_CHANNEL_INFO {
|
||||
uint8_t ChannelNum;
|
||||
RT_SCAN_TYPE ScanType; // uint8_t ScanType; // byte/dword?
|
||||
|
@ -600,8 +584,7 @@ struct ss_res {
|
|||
int scan_mode;
|
||||
NDIS_802_11_SSID ssid[1];
|
||||
};
|
||||
*/
|
||||
/* wifi.h
|
||||
|
||||
struct __attribute__((packed)) __attribute__((aligned(1))) ADDBA_request {
|
||||
uint8_t dialog_token;
|
||||
uint16_t BA_para_set;
|
||||
|
@ -640,8 +623,7 @@ struct HT_info_element {
|
|||
uint8_t infos[5];
|
||||
uint8_t MCS_rate[16];
|
||||
};
|
||||
*/
|
||||
/* rtw_mlme_ext.h
|
||||
|
||||
struct FW_Sta_Info {
|
||||
struct sta_info *psta;
|
||||
uint32_t status;
|
||||
|
@ -690,17 +672,16 @@ struct mlme_ext_info {
|
|||
struct HT_info_element HT_info;
|
||||
struct FW_Sta_Info FW_sta_info[5];
|
||||
};
|
||||
*/
|
||||
/*
|
||||
|
||||
#ifndef _CUS_IE_
|
||||
#define _CUS_IE_
|
||||
typedef struct _cus_ie{
|
||||
__u8 *ie;
|
||||
__u8 type;
|
||||
} cus_ie, *p_cus_ie;
|
||||
#endif */
|
||||
#endif /* _CUS_IE_ */
|
||||
// typedef struct _cus_ie *p_cus_ie;
|
||||
/* rtw_mlme_ext.h
|
||||
|
||||
struct mlme_ext_priv { //__attribute__((packed))?
|
||||
_adapter *padapter; //+0 padapter+1256 [912]
|
||||
uint8_t mlmeext_init;
|
||||
|
@ -744,9 +725,7 @@ struct mlme_ext_priv { //__attribute__((packed))?
|
|||
uint8_t bChDeauthDisabled;
|
||||
uint8_t bConcurrentFlushingSTA;
|
||||
};
|
||||
*/
|
||||
|
||||
/* rtw_cmd.h
|
||||
struct cmd_priv {
|
||||
_queue cmd_queue;
|
||||
uint8_t cmdthd_running;
|
||||
|
@ -759,27 +738,6 @@ struct evt_priv {
|
|||
uint8_t *evt_allocated_buf;
|
||||
uint32_t evt_done_cnt;
|
||||
};
|
||||
*/
|
||||
/* drv_types.h
|
||||
struct dvobj_priv
|
||||
{
|
||||
void *if1;
|
||||
void *if2;
|
||||
void *padapters[2];
|
||||
uint8_t iface_nums;
|
||||
uint8_t RtOutPipe[3];
|
||||
uint8_t Queue2Pipe[8];
|
||||
uint8_t irq_alloc;
|
||||
uint8_t irq_enabled;
|
||||
_lock irq_th_lock;
|
||||
};
|
||||
*/
|
||||
/* trw_io.h
|
||||
|
||||
struct fifo_more_data {
|
||||
uint32_t more_data;
|
||||
uint32_t len;
|
||||
};
|
||||
|
||||
struct _io_ops {
|
||||
int (*init_io_priv)(struct dvobj_priv *);
|
||||
|
@ -798,8 +756,7 @@ struct _io_ops {
|
|||
struct io_priv {
|
||||
struct _io_ops io_ops;
|
||||
};
|
||||
*/
|
||||
/* rtw_xmit.h
|
||||
|
||||
struct rtw_tx_ring {
|
||||
struct tx_buf_desc *desc;
|
||||
dma_addr_t dma;
|
||||
|
@ -845,8 +802,7 @@ struct _atr_aligned8_ xmit_priv {
|
|||
uint32_t free_xmit_extbuf_cnt;
|
||||
uint16_t nqos_ssn;
|
||||
};
|
||||
*/
|
||||
/* trw_recv.h
|
||||
|
||||
struct rtw_rx_ring {
|
||||
struct recv_buf_stat *desc;
|
||||
dma_addr_t dma;
|
||||
|
@ -909,8 +865,7 @@ struct _atr_aligned8_ recv_priv {
|
|||
uint16_t promisc_bk_rxfltmap2;
|
||||
uint8_t promisc_mgntframe_enabled;
|
||||
};
|
||||
*/
|
||||
/* sta_info.h
|
||||
|
||||
struct _atr_aligned4_ sta_priv {
|
||||
uint8_t *pallocated_stainfo_buf;
|
||||
uint32_t allocated_stainfo_size;
|
||||
|
@ -934,13 +889,14 @@ struct _atr_aligned4_ sta_priv {
|
|||
uint16_t tim_bitmap;
|
||||
uint16_t max_num_sta;
|
||||
};
|
||||
*/
|
||||
/* trw_security.h
|
||||
|
||||
union Keytype {
|
||||
uint8_t skey[16];
|
||||
uint32_t lkey[4];
|
||||
};
|
||||
|
||||
|
||||
|
||||
union pn48 {
|
||||
u8Byte val;
|
||||
struct {
|
||||
|
@ -954,9 +910,7 @@ union pn48 {
|
|||
uint8_t TSC7;
|
||||
}_byte_;
|
||||
};
|
||||
*/
|
||||
|
||||
/* wlan_bssdef.h
|
||||
struct _NDIS_802_11_WEP {
|
||||
uint32_t Length;
|
||||
uint32_t KeyIndex;
|
||||
|
@ -964,9 +918,7 @@ struct _NDIS_802_11_WEP {
|
|||
uint8_t KeyMaterial[16];
|
||||
};
|
||||
typedef struct _NDIS_802_11_WEP NDIS_802_11_WEP;
|
||||
*/
|
||||
|
||||
/* rtw_psk.h
|
||||
struct $D75518714447A990003EBC933C23F70E {
|
||||
uint32_t HighPart;
|
||||
uint32_t LowPart;
|
||||
|
@ -1027,9 +979,7 @@ struct _wpa_global_info {
|
|||
typedef struct _wpa_global_info WPA_GLOBAL_INFO;
|
||||
|
||||
typedef struct _wpa_sta_info WPA_STA_INFO;
|
||||
*/
|
||||
|
||||
/* rtw_security.h
|
||||
struct _atr_aligned4_ security_priv {
|
||||
uint32_t dot11AuthAlgrthm;
|
||||
uint32_t dot11PrivacyAlgrthm;
|
||||
|
@ -1073,8 +1023,7 @@ struct _atr_aligned4_ security_priv {
|
|||
uint8_t wpa_passphrase[65];
|
||||
uint8_t wps_phase;
|
||||
};
|
||||
*/
|
||||
/* derv_types.h
|
||||
|
||||
struct _atr_aligned4_ registry_priv {
|
||||
uint8_t chip_version;
|
||||
uint8_t hci;
|
||||
|
@ -1118,8 +1067,7 @@ struct _atr_aligned4_ registry_priv {
|
|||
uint8_t adaptivity_dc_backoff;
|
||||
int8_t adaptivity_th_l2h_ini;
|
||||
};
|
||||
*/
|
||||
/* trw_powerctrl.h
|
||||
|
||||
typedef void *_sema;
|
||||
|
||||
typedef _sema _pwrlock;
|
||||
|
@ -1190,8 +1138,7 @@ struct _atr_aligned4_ pwrctrl_priv {
|
|||
uint8_t tdma_rfon_period_len_3;
|
||||
uint8_t lps_dtim;
|
||||
};
|
||||
*/
|
||||
/* rtw_eeprom.h
|
||||
|
||||
struct _atr_aligned2_ eeprom_priv { // __attribute__((packed))!?
|
||||
uint8_t bautoload_fail_flag;
|
||||
uint8_t mac_addr[6];
|
||||
|
@ -1201,8 +1148,7 @@ struct _atr_aligned2_ eeprom_priv { // __attribute__((packed))!?
|
|||
uint8_t EEPROMRFGainOffset;
|
||||
uint8_t EEPROMRFGainVal;
|
||||
};
|
||||
*/
|
||||
/* rtw_rf.h
|
||||
|
||||
enum _CHANNEL_WIDTH // : sint32_t
|
||||
{
|
||||
CHANNEL_WIDTH_20 = 0x0,
|
||||
|
@ -1213,9 +1159,7 @@ enum _CHANNEL_WIDTH // : sint32_t
|
|||
CHANNEL_WIDTH_MAX = 0x5,
|
||||
};
|
||||
typedef enum _CHANNEL_WIDTH CHANNEL_WIDTH;
|
||||
*/
|
||||
|
||||
/* hal_intf.h
|
||||
enum _HAL_DEF_VARIABLE // : sint32_t
|
||||
{
|
||||
HAL_DEF_UNDERCORATEDSMOOTHEDPWDB = 0x0,
|
||||
|
@ -1252,11 +1196,11 @@ enum _HAL_ODM_VARIABLE // : sint32_t
|
|||
HAL_ODM_REGULATION = 0x4,
|
||||
};
|
||||
typedef enum _HAL_ODM_VARIABLE HAL_ODM_VARIABLE;
|
||||
*/
|
||||
/* freertos_service.h
|
||||
|
||||
typedef void *_thread_hdl_;
|
||||
*/
|
||||
/* osdep_service.h
|
||||
|
||||
/*
|
||||
// osdep_service.h
|
||||
struct task_struct
|
||||
{
|
||||
const char *task_name;
|
||||
|
@ -1282,7 +1226,19 @@ typedef struct net_device *_nic_hdl;
|
|||
uint32_t rx_overflow;
|
||||
};
|
||||
*/
|
||||
/* rtw_recv.h
|
||||
|
||||
struct dvobj_priv {
|
||||
void *if1;
|
||||
void *if2;
|
||||
void *padapters[2];
|
||||
uint8_t iface_nums;
|
||||
uint8_t RtOutPipe[3];
|
||||
uint8_t Queue2Pipe[8];
|
||||
uint8_t irq_alloc;
|
||||
uint8_t irq_enabled;
|
||||
_lock irq_th_lock;
|
||||
};
|
||||
|
||||
struct phy_info {
|
||||
uint8_t RxPWDBAll;
|
||||
uint8_t SignalQuality;
|
||||
|
@ -1358,7 +1314,7 @@ union {
|
|||
uint32_t mem[32];
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
union $AB04817EA6EB89125E28056B7464A4D7 {
|
||||
_list list;
|
||||
struct recv_frame_hdr hdr;
|
||||
|
@ -1369,7 +1325,8 @@ union recv_frame {
|
|||
union $AB04817EA6EB89125E28056B7464A4D7 u;
|
||||
};
|
||||
*/
|
||||
/* skbuff.h
|
||||
/*
|
||||
// skbuff.h
|
||||
struct sk_buff
|
||||
{
|
||||
struct sk_buff *next;
|
||||
|
@ -1390,7 +1347,7 @@ union recv_frame {
|
|||
uint32_t qlen;
|
||||
};
|
||||
*/
|
||||
/* rtw_xmit.h
|
||||
|
||||
struct tx_servq {
|
||||
_list tx_pending;
|
||||
_queue sta_pending;
|
||||
|
@ -1409,12 +1366,6 @@ struct sta_xmit_priv {
|
|||
_list apsd;
|
||||
uint16_t txseq_tid[16];
|
||||
};
|
||||
*/
|
||||
/* rtw_recv.h
|
||||
struct recv_buf_stat {
|
||||
uint32_t rxdw0;
|
||||
uint32_t rxdw1;
|
||||
};
|
||||
|
||||
struct stainfo_rxcache {
|
||||
uint16_t tid_rxseq[16];
|
||||
|
@ -1426,9 +1377,8 @@ struct sta_recv_priv {
|
|||
_queue defrag_q;
|
||||
struct stainfo_rxcache rxcache;
|
||||
};
|
||||
*/
|
||||
/* sta_info.h
|
||||
struct stainfo_stats {
|
||||
|
||||
struct stainfo_stats {
|
||||
u8Byte rx_mgnt_pkts;
|
||||
u8Byte rx_ctrl_pkts;
|
||||
u8Byte rx_data_pkts;
|
||||
|
@ -1525,15 +1475,20 @@ struct sta_info {
|
|||
uint8_t RXEVM[4];
|
||||
uint8_t RXSNR[4];
|
||||
};
|
||||
*/
|
||||
/* wifi_conf.h
|
||||
/*
|
||||
// wifi_conf.h
|
||||
struct _atr_aligned4_ _cus_ie
|
||||
{
|
||||
uint8_t *ie;
|
||||
uint8_t type;
|
||||
};
|
||||
*/
|
||||
/* rtw_xmit.h
|
||||
|
||||
struct fifo_more_data {
|
||||
uint32_t more_data;
|
||||
uint32_t len;
|
||||
};
|
||||
|
||||
struct hw_xmit {
|
||||
_queue *sta_queue;
|
||||
int accnt;
|
||||
|
@ -1549,8 +1504,12 @@ struct tx_buf_desc {
|
|||
uint32_t txdw6;
|
||||
uint32_t txdw7;
|
||||
};
|
||||
*/
|
||||
/* rtw_psk.h
|
||||
|
||||
struct recv_buf_stat {
|
||||
uint32_t rxdw0;
|
||||
uint32_t rxdw1;
|
||||
};
|
||||
|
||||
struct _wpa_sta_info {
|
||||
int state;
|
||||
int gstate;
|
||||
|
@ -1577,8 +1536,7 @@ struct _wpa_sta_info {
|
|||
int clientGkeyUpdate;
|
||||
LARGE_INTEGER clientMICReportReplayCounter;
|
||||
};
|
||||
*/
|
||||
/* rtw_xmit.h
|
||||
|
||||
struct pkt_attrib {
|
||||
uint8_t type;
|
||||
uint8_t subtype;
|
||||
|
@ -1669,7 +1627,6 @@ struct submit_ctx {
|
|||
uint32_t timeout_ms;
|
||||
int status;
|
||||
};
|
||||
*/
|
||||
/*
|
||||
// wrapper.h
|
||||
struct net_device
|
||||
|
@ -1755,15 +1712,12 @@ struct submit_ctx {
|
|||
union iwreq_data u;
|
||||
};
|
||||
*/
|
||||
/* drv_types.h
|
||||
struct co_data_priv {
|
||||
uint8_t co_ch;
|
||||
uint8_t co_bw;
|
||||
uint8_t co_ch_offset;
|
||||
uint8_t rsvd;
|
||||
};
|
||||
*/
|
||||
/* hal_intf.h
|
||||
|
||||
enum _HARDWARE_TYPE // : sint32_t
|
||||
{
|
||||
|
@ -1805,8 +1759,7 @@ enum _HARDWARE_TYPE // : sint32_t
|
|||
HARDWARE_TYPE_RTL8188FS = 0x23,
|
||||
HARDWARE_TYPE_MAX = 0x24,
|
||||
};
|
||||
*/
|
||||
/* hal_phy.h
|
||||
|
||||
struct RF_Shadow_Compare_Map {
|
||||
uint32_t Value;
|
||||
uint8_t Compare;
|
||||
|
@ -1815,8 +1768,7 @@ struct RF_Shadow_Compare_Map {
|
|||
uint8_t Driver_Write;
|
||||
};
|
||||
typedef struct RF_Shadow_Compare_Map RF_SHADOW_T;
|
||||
*/
|
||||
/* rtw_powerctrl.h
|
||||
|
||||
enum _PS_BBRegBackup_ // : sint32_t
|
||||
{
|
||||
PSBBREG_RF0 = 0x0,
|
||||
|
@ -1825,8 +1777,9 @@ enum _PS_BBRegBackup_ // : sint32_t
|
|||
PSBBREG_AFE0 = 0x3,
|
||||
PSBBREG_TOTALCNT = 0x4,
|
||||
};
|
||||
*/
|
||||
/* hal_irqn.h
|
||||
|
||||
/*
|
||||
// hal_irqn.h
|
||||
enum _IRQn_Type_ // : sint32_t
|
||||
{
|
||||
NonMaskableInt_IRQn = 0xFFFFFFF2,
|
||||
|
@ -1899,8 +1852,9 @@ enum _PS_BBRegBackup_ // : sint32_t
|
|||
uint32_t Priority;
|
||||
};
|
||||
typedef struct _IRQ_HANDLE_ IRQ_HANDLE;
|
||||
*/
|
||||
/* hal_soc_ps_monitor.h
|
||||
*/
|
||||
/*
|
||||
// hal_soc_ps_monitor.h
|
||||
struct _power_state_
|
||||
{
|
||||
uint8_t FuncIdx;
|
||||
|
@ -1922,9 +1876,9 @@ enum _PS_BBRegBackup_ // : sint32_t
|
|||
BOOL SleepFlag;
|
||||
};
|
||||
typedef struct _power_mgn_ Power_Mgn;
|
||||
*/
|
||||
|
||||
/* hal_gpio.h
|
||||
/*
|
||||
// hal_gpio.h
|
||||
enum $E1AD70AB12E7AA6E98B8D89D9B965EB5 //: sint32_t
|
||||
{
|
||||
_PORT_A = 0x0,
|
||||
|
@ -1959,7 +1913,7 @@ enum _PS_BBRegBackup_ // : sint32_t
|
|||
};
|
||||
typedef struct _HAL_GPIO_ADAPTER_ *PHAL_GPIO_ADAPTER;
|
||||
*/
|
||||
/* hal_intf.h
|
||||
|
||||
struct hal_ops {
|
||||
uint32_t (*hal_power_on)(_adapter *);
|
||||
uint32_t (*hal_init)(_adapter *);
|
||||
|
@ -2022,8 +1976,66 @@ struct hal_ops {
|
|||
uint8_t);
|
||||
uint8_t (*hal_get_tx_buff_rsvd_page_num)(_adapter *, bool);
|
||||
};
|
||||
*/
|
||||
/* HalVerDef.h
|
||||
|
||||
struct _atr_aligned4_ _ADAPTER {
|
||||
uint16_t HardwareType;
|
||||
uint16_t interface_type; //+2
|
||||
uint32_t work_mode;
|
||||
struct dvobj_priv *dvobj; //+8
|
||||
struct mlme_priv mlmepriv; //+12 [1244]
|
||||
struct mlme_ext_priv mlmeextpriv; //+1256 [912]
|
||||
struct cmd_priv cmdpriv; //+2168
|
||||
struct evt_priv evtpriv; //+
|
||||
struct io_priv iopriv;
|
||||
struct xmit_priv xmitpriv; //+2248
|
||||
struct recv_priv recvpriv; //+2752
|
||||
struct sta_priv stapriv; //+3024 [164]
|
||||
struct security_priv securitypriv;
|
||||
struct registry_priv registrypriv;
|
||||
struct pwrctrl_priv pwrctrlpriv; // pwrctrlpriv.bInternalAutoSuspend //+5061
|
||||
struct eeprom_priv eeprompriv;
|
||||
PVOID HalData;
|
||||
uint32_t hal_data_sz;
|
||||
struct hal_ops HalFunc;
|
||||
int32_t bDriverStopped; //+5880
|
||||
int32_t bSurpriseRemoved; //+5884
|
||||
int32_t bCardDisableWOHSM; //+5888
|
||||
uint8_t RxStop; //+5892
|
||||
uint32_t IsrContent;
|
||||
uint32_t ImrContent;
|
||||
uint8_t EepromAddressSize;
|
||||
uint8_t hw_init_completed; //+5905
|
||||
uint8_t bDriverIsGoingToUnload;
|
||||
uint8_t init_adpt_in_progress;
|
||||
uint8_t bMpDriver;
|
||||
uint8_t bForwardingDisabled;
|
||||
struct task_struct isrThread; //+5888
|
||||
struct task_struct cmdThread; //+5920
|
||||
struct task_struct recvtasklet_thread; //+5952
|
||||
struct task_struct xmittasklet_thread; //+5984
|
||||
void (*intf_start)(_adapter *); //+6008
|
||||
void (*intf_stop)(_adapter *); //+6012
|
||||
_nic_hdl pnetdev; //+6016
|
||||
int bup; //+6020
|
||||
struct net_device_stats stats;
|
||||
uint8_t net_closed; //+6052
|
||||
uint8_t bFWReady;
|
||||
uint8_t bLinkInfoDump;
|
||||
uint8_t bRxRSSIDisplay;
|
||||
_adapter *pbuddy_adapter; //+6056
|
||||
_mutex *hw_init_mutex; //+6060
|
||||
uint8_t isprimary; //+6064
|
||||
uint8_t adapter_type; //+6065
|
||||
uint8_t iface_type; //+6056
|
||||
_mutex *ph2c_fwcmd_mutex; //+6068
|
||||
_mutex *psetch_mutex; //+6072
|
||||
_mutex *psetbw_mutex; //+6076
|
||||
struct co_data_priv *pcodatapriv; //+6080
|
||||
uint8_t fix_rate; //+6084
|
||||
}; // [6088] (!)
|
||||
typedef struct _ADAPTER *PADAPTER;
|
||||
// if sizeof(struct _ADAPTER) != 6088 #error "Check aligned struct!" !
|
||||
|
||||
enum tag_HAL_IC_Type_Definition // : sint32_t
|
||||
{
|
||||
CHIP_8192S = 0x0,
|
||||
|
@ -2092,8 +2104,7 @@ struct _atr_aligned4_ tag_HAL_VERSION {
|
|||
uint8_t ROMVer;
|
||||
};
|
||||
typedef struct tag_HAL_VERSION HAL_VERSION;
|
||||
*/
|
||||
/* hal_intf.h
|
||||
|
||||
enum _HW_VARIABLES //: sint32_t
|
||||
{
|
||||
HW_VAR_MEDIA_STATUS = 0x0,
|
||||
|
@ -2178,15 +2189,13 @@ enum _HW_VARIABLES //: sint32_t
|
|||
HW_VAR_ASIX_IOT = 0x4F,
|
||||
HW_VAR_PROMISC = 0x50,
|
||||
};
|
||||
*/
|
||||
/* hal_phy.h
|
||||
|
||||
enum _BAND_TYPE // : sint32_t
|
||||
{
|
||||
BAND_ON_2_4G = 0x0, BAND_ON_5G = 0x1, BAND_ON_BOTH = 0x2, BANDMAX = 0x3,
|
||||
};
|
||||
typedef enum _BAND_TYPE BAND_TYPE;
|
||||
*/
|
||||
/* hal_com_phycfg.h
|
||||
|
||||
struct _BB_REGISTER_DEFINITION {
|
||||
uint32_t rfintfs;
|
||||
uint32_t rfintfo;
|
||||
|
@ -2197,8 +2206,7 @@ struct _BB_REGISTER_DEFINITION {
|
|||
uint32_t rfLSSIReadBackPi;
|
||||
};
|
||||
typedef struct _BB_REGISTER_DEFINITION BB_REGISTER_DEFINITION_T;
|
||||
*/
|
||||
/* rtw_mlme.h
|
||||
|
||||
enum dot11AuthAlgrthmNum //: sint32_t
|
||||
{
|
||||
dot11AuthAlgrthm_Open = 0x0,
|
||||
|
@ -2208,8 +2216,7 @@ enum dot11AuthAlgrthmNum //: sint32_t
|
|||
dot11AuthAlgrthm_WAPI = 0x4,
|
||||
dot11AuthAlgrthm_MaxNum = 0x5,
|
||||
};
|
||||
*/
|
||||
/* rtw_mlme_ext.h
|
||||
|
||||
enum _RT_CHANNEL_DOMAIN //: sint32_t
|
||||
{
|
||||
RT_CHANNEL_DOMAIN_FCC = 0x0,
|
||||
|
@ -2276,8 +2283,7 @@ enum _RT_CHANNEL_DOMAIN //: sint32_t
|
|||
RT_CHANNEL_DOMAIN_MAX = 0x59,
|
||||
RT_CHANNEL_DOMAIN_REALTEK_DEFINE = 0x7F,
|
||||
};
|
||||
*/
|
||||
/* freertos_intfs.h
|
||||
|
||||
struct _driver_priv {
|
||||
int drv_registered;
|
||||
_mutex hw_init_mutex;
|
||||
|
@ -2286,9 +2292,7 @@ struct _driver_priv {
|
|||
_mutex setbw_mutex;
|
||||
};
|
||||
typedef struct _driver_priv drv_priv;
|
||||
*/
|
||||
|
||||
/* PhyDM_Adaptivity.h
|
||||
struct _ADAPTIVITY_STATISTICS {
|
||||
s1Byte TH_L2H_ini_mode2;
|
||||
s1Byte TH_EDCCA_HL_diff_mode2;
|
||||
|
@ -2305,14 +2309,12 @@ struct _ADAPTIVITY_STATISTICS {
|
|||
u1Byte AdajustIGILevel;
|
||||
};
|
||||
typedef struct _ADAPTIVITY_STATISTICS ADAPTIVITY_STATISTICS;
|
||||
*/
|
||||
/* phydm_NoiseMonitor.h
|
||||
|
||||
struct _ODM_NOISE_MONITOR_ {
|
||||
s1Byte noise[1];
|
||||
s2Byte noise_all;
|
||||
};
|
||||
typedef struct _ODM_NOISE_MONITOR_ ODM_NOISE_MONITOR;
|
||||
*/
|
||||
/* in rtl_bios_data.h
|
||||
struct _FALSE_ALARM_STATISTICS {
|
||||
u4Byte Cnt_Parity_Fail;
|
||||
|
@ -2333,13 +2335,13 @@ struct _FALSE_ALARM_STATISTICS {
|
|||
};
|
||||
typedef struct _FALSE_ALARM_STATISTICS FALSE_ALARM_STATISTICS;
|
||||
*/
|
||||
/* phydm.h
|
||||
|
||||
enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE //: sint32_t
|
||||
{
|
||||
PHY_REG_PG_RELATIVE_VALUE = 0x0, PHY_REG_PG_EXACT_VALUE = 0x1,
|
||||
};
|
||||
typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE PHY_REG_PG_TYPE;
|
||||
*/
|
||||
|
||||
/* in rtl_bios_data.h
|
||||
struct _atr_aligned4_ _CFO_TRACKING_ {
|
||||
BOOLEAN bATCStatus;
|
||||
|
@ -2368,13 +2370,11 @@ struct _atr_aligned8_ _ROM_INFO {
|
|||
};
|
||||
typedef struct _ROM_INFO ROM_INFO;
|
||||
*/
|
||||
/* ROM_RTL8195A_PHYDM.h
|
||||
|
||||
typedef struct _ROM_INFO *PROM_INFO;
|
||||
*/
|
||||
/* phydm_types.h
|
||||
|
||||
typedef struct sta_info *PSTA_INFO_T;
|
||||
*/
|
||||
/* phydm.h
|
||||
|
||||
struct _ODM_Phy_Dbg_Info_ {
|
||||
s1Byte RxSNRdB[4];
|
||||
u4Byte NumQryPhyStatus;
|
||||
|
@ -2717,73 +2717,7 @@ struct _atr_aligned8_ ODM_RF_Calibration_Structure {
|
|||
u4Byte DpkThermal[4];
|
||||
};
|
||||
typedef struct ODM_RF_Calibration_Structure ODM_RF_CAL_T;
|
||||
*/
|
||||
/* drv_types.h
|
||||
#include "ieee80211.h"
|
||||
#include "rtw_cmd.h"
|
||||
|
||||
struct _atr_aligned4_ _ADAPTER {
|
||||
uint16_t HardwareType;
|
||||
uint16_t interface_type; //+2
|
||||
uint32_t work_mode;
|
||||
struct dvobj_priv *dvobj; //+8
|
||||
struct mlme_priv mlmepriv; //+12 [1244]
|
||||
struct mlme_ext_priv mlmeextpriv; //+1256 [912]
|
||||
struct cmd_priv cmdpriv; //+2168
|
||||
struct evt_priv evtpriv; //+
|
||||
struct io_priv iopriv;
|
||||
struct xmit_priv xmitpriv; //+2248
|
||||
struct recv_priv recvpriv; //+2752
|
||||
struct sta_priv stapriv; //+3024 [164]
|
||||
struct security_priv securitypriv;
|
||||
struct registry_priv registrypriv;
|
||||
struct pwrctrl_priv pwrctrlpriv; // pwrctrlpriv.bInternalAutoSuspend //+5061
|
||||
struct eeprom_priv eeprompriv;
|
||||
PVOID HalData;
|
||||
uint32_t hal_data_sz;
|
||||
struct hal_ops HalFunc;
|
||||
int32_t bDriverStopped; //+5880
|
||||
int32_t bSurpriseRemoved; //+5884
|
||||
int32_t bCardDisableWOHSM; //+5888
|
||||
uint8_t RxStop; //+5892
|
||||
uint32_t IsrContent;
|
||||
uint32_t ImrContent;
|
||||
uint8_t EepromAddressSize;
|
||||
uint8_t hw_init_completed; //+5905
|
||||
uint8_t bDriverIsGoingToUnload;
|
||||
uint8_t init_adpt_in_progress;
|
||||
uint8_t bMpDriver;
|
||||
uint8_t bForwardingDisabled;
|
||||
struct task_struct isrThread; //+5888
|
||||
struct task_struct cmdThread; //+5920
|
||||
struct task_struct recvtasklet_thread; //+5952
|
||||
struct task_struct xmittasklet_thread; //+5984
|
||||
void (*intf_start)(_adapter *); //+6008
|
||||
void (*intf_stop)(_adapter *); //+6012
|
||||
_nic_hdl pnetdev; //+6016
|
||||
int bup; //+6020
|
||||
struct net_device_stats stats;
|
||||
uint8_t net_closed; //+6052
|
||||
uint8_t bFWReady;
|
||||
uint8_t bLinkInfoDump;
|
||||
uint8_t bRxRSSIDisplay;
|
||||
_adapter *pbuddy_adapter; //+6056
|
||||
_mutex *hw_init_mutex; //+6060
|
||||
uint8_t isprimary; //+6064
|
||||
uint8_t adapter_type; //+6065
|
||||
uint8_t iface_type; //+6056
|
||||
_mutex *ph2c_fwcmd_mutex; //+6068
|
||||
_mutex *psetch_mutex; //+6072
|
||||
_mutex *psetbw_mutex; //+6076
|
||||
struct co_data_priv *pcodatapriv; //+6080
|
||||
uint8_t fix_rate; //+6084
|
||||
}; // [6088] (!)
|
||||
typedef struct _ADAPTER *PADAPTER;
|
||||
// if sizeof(struct _ADAPTER) != 6088 #error "Check aligned struct!" !
|
||||
|
||||
*/
|
||||
|
||||
/* phydm.h
|
||||
struct _atr_aligned8_ DM_Out_Source_Dynamic_Mechanism_Structure {
|
||||
PADAPTER Adapter;
|
||||
BOOLEAN odm_ready;
|
||||
|
@ -2953,8 +2887,7 @@ struct _atr_aligned8_ DM_Out_Source_Dynamic_Mechanism_Structure {
|
|||
};
|
||||
typedef struct DM_Out_Source_Dynamic_Mechanism_Structure DM_ODM_T;
|
||||
typedef struct DM_Out_Source_Dynamic_Mechanism_Structure *PDM_ODM_T;
|
||||
*/
|
||||
/* halphy
|
||||
|
||||
enum _PWRTRACK_CONTROL_METHOD //: sint32_t
|
||||
{
|
||||
BBSWING = 0x0, TXAGC = 0x1, MIX_MODE = 0x2,
|
||||
|
@ -3006,9 +2939,7 @@ struct _H2CParam_RsvdPage_ {
|
|||
};
|
||||
typedef struct _H2CParam_RsvdPage_ H2CParam_RsvdPage;
|
||||
typedef struct _H2CParam_RsvdPage_ *PH2CParam_RsvdPage;
|
||||
*/
|
||||
|
||||
/* wlan_bssdef.h
|
||||
struct _NDIS_802_11_VARIABLE_IEs {
|
||||
uint8_t ElementID;
|
||||
uint8_t Length;
|
||||
|
@ -3046,7 +2977,6 @@ enum _NDIS_802_11_WEP_STATUS //: sint32_t
|
|||
Ndis802_11_EncrypteionWAPI = 0x8,
|
||||
};
|
||||
typedef enum _NDIS_802_11_WEP_STATUS NDIS_802_11_WEP_STATUS;
|
||||
*/
|
||||
|
||||
struct __attribute__((packed)) __attribute__((aligned(1))) rtk_sc {
|
||||
u8 pattern_type;
|
||||
|
@ -3093,7 +3023,7 @@ struct pattern_ops {
|
|||
sc_decode_profile_call_back decode_profile;
|
||||
sc_get_tlv_info_call_back get_tlv_info;
|
||||
};
|
||||
/* halpower
|
||||
|
||||
struct _atr_aligned2_ _WL_PWR_CFG_ { // __attribute__((packed))!?
|
||||
uint16_t offset;
|
||||
uint8_t cut_msk;
|
||||
|
@ -3105,21 +3035,17 @@ struct _atr_aligned2_ _WL_PWR_CFG_ { // __attribute__((packed))!?
|
|||
uint8_t value;
|
||||
};
|
||||
typedef struct _WL_PWR_CFG_ WLAN_PWR_CFG;
|
||||
*/
|
||||
|
||||
/* rtw_mlme.h
|
||||
struct cmd_hdl {
|
||||
uint32_t parmsize;
|
||||
uint8_t (*h2cfuns)(struct _ADAPTER *, uint8_t *);
|
||||
};
|
||||
*/
|
||||
/* rtw_cmd.h
|
||||
|
||||
struct _cmd_callback {
|
||||
uint32_t cmd_code;
|
||||
void (*callback)(_adapter *, struct cmd_obj *);
|
||||
};
|
||||
*/
|
||||
/* phydm.h
|
||||
|
||||
enum _ODM_Common_Info_Definition //: sint32_t
|
||||
{
|
||||
ODM_CMNINFO_PLATFORM = 0x0,
|
||||
|
@ -3225,15 +3151,13 @@ enum _ODM_Support_Ability_Definition // : sint32_t
|
|||
ODM_RF_RX_GAIN_TRACK = 0x2000000,
|
||||
ODM_RF_CALIBRATION = 0x4000000,
|
||||
};
|
||||
*/
|
||||
/* hal_phy.h
|
||||
|
||||
enum _RF_PATH //: sint32_t
|
||||
{
|
||||
RF_PATH_A = 0x0, RF_PATH_B = 0x1, RF_PATH_C = 0x2, RF_PATH_D = 0x3,
|
||||
};
|
||||
typedef enum _RF_PATH RF_PATH;
|
||||
*/
|
||||
/* rtw_cmd.h
|
||||
|
||||
enum _EXTCHNL_OFFSET //: sint32_t
|
||||
{
|
||||
EXTCHNL_OFFSET_NO_EXT = 0x0,
|
||||
|
@ -3332,8 +3256,7 @@ enum MGN_RATE //: sint32_t
|
|||
MGN_VHT4SS_MCS9 = 0xC7,
|
||||
MGN_UNKNOWN = 0xC8,
|
||||
};
|
||||
*/
|
||||
/* rtw_mlme.h rtw_mlme_ext.h
|
||||
|
||||
struct _RT_CHANNEL_PLAN_2G {
|
||||
uint8_t Channel[14];
|
||||
uint8_t Len;
|
||||
|
@ -3353,14 +3276,12 @@ struct mlme_handler {
|
|||
uint32_t num;
|
||||
uint32_t (*func)(_adapter *, struct recv_frame *);
|
||||
};
|
||||
*/
|
||||
/* rtw_event.h
|
||||
|
||||
struct fwevent {
|
||||
uint32_t parmsize;
|
||||
void (*event_callback)(_adapter *, uint8_t *);
|
||||
};
|
||||
*/
|
||||
/* rtw_recv.h
|
||||
|
||||
struct recv_buf {
|
||||
_list list;
|
||||
PADAPTER adapter;
|
||||
|
@ -3381,8 +3302,7 @@ struct recv_reorder_ctrl {
|
|||
_queue pending_recvframe_queue;
|
||||
_timer reordering_ctrl_timer;
|
||||
};
|
||||
*/
|
||||
/* phydm.h
|
||||
|
||||
enum _ODM_RF_RADIO_PATH // : sint32_t
|
||||
{
|
||||
ODM_RF_PATH_A = 0x0,
|
||||
|
@ -3483,8 +3403,7 @@ enum _ODM_FW_Config_Type //: sint32_t
|
|||
CONFIG_FW_BT = 0x7,
|
||||
};
|
||||
typedef enum _ODM_FW_Config_Type ODM_FW_Config_Type;
|
||||
*/
|
||||
/* hal_com_phycfg.h
|
||||
|
||||
enum _RATE_SECTION //: sint32_t
|
||||
{
|
||||
CCK = 0x0,
|
||||
|
@ -3499,8 +3418,12 @@ enum _RATE_SECTION //: sint32_t
|
|||
VHT_4SSMCS0_4SSMCS9 = 0x9,
|
||||
};
|
||||
typedef enum _RATE_SECTION RATE_SECTION;
|
||||
*/
|
||||
/* hal_pg.h
|
||||
|
||||
struct map_mask_s {
|
||||
uint16_t mask_start;
|
||||
uint16_t mask_end;
|
||||
};
|
||||
|
||||
struct _TxPowerInfo24G {
|
||||
uint8_t IndexCCK_Base[1][6];
|
||||
uint8_t IndexBW40_Base[1][6];
|
||||
|
@ -3509,69 +3432,6 @@ struct _TxPowerInfo24G {
|
|||
};
|
||||
typedef struct _TxPowerInfo24G TxPowerInfo24G;
|
||||
typedef struct _TxPowerInfo24G *PTxPowerInfo24G;
|
||||
*/
|
||||
/* wifi_constants.h
|
||||
enum rtw_bss_type_t // __int32
|
||||
{
|
||||
RTW_BSS_TYPE_INFRASTRUCTURE = 0x0,
|
||||
RTW_BSS_TYPE_ADHOC = 0x1,
|
||||
RTW_BSS_TYPE_ANY = 0x2,
|
||||
RTW_BSS_TYPE_UNKNOWN = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
enum rtw_security_t // __int32
|
||||
{
|
||||
RTW_SECURITY_OPEN = 0x0,
|
||||
RTW_SECURITY_WEP_PSK = 0x1,
|
||||
RTW_SECURITY_WEP_SHARED = 0x8001,
|
||||
RTW_SECURITY_WPA_TKIP_PSK = 0x200002,
|
||||
RTW_SECURITY_WPA_AES_PSK = 0x200004,
|
||||
RTW_SECURITY_WPA2_AES_PSK = 0x400004,
|
||||
RTW_SECURITY_WPA2_TKIP_PSK = 0x400002,
|
||||
RTW_SECURITY_WPA2_MIXED_PSK = 0x400006,
|
||||
RTW_SECURITY_WPA_WPA2_MIXED = 0x600000,
|
||||
RTW_SECURITY_WPS_OPEN = 0x10000000,
|
||||
RTW_SECURITY_WPS_SECURE = 0x10000004,
|
||||
RTW_SECURITY_UNKNOWN = 0xFFFFFFFF,
|
||||
RTW_SECURITY_FORCE_32_BIT = 0x7FFFFFFF,
|
||||
};
|
||||
|
||||
enum rtw_802_11_band_t // __int32
|
||||
{
|
||||
RTW_802_11_BAND_5GHZ = 0x0,
|
||||
RTW_802_11_BAND_2_4GHZ = 0x1,
|
||||
};
|
||||
|
||||
*/
|
||||
/* wifi_structures.h
|
||||
struct rtw_ssid
|
||||
{
|
||||
unsigned int8_t len;
|
||||
unsigned int8_t val[33];
|
||||
};
|
||||
|
||||
typedef rtw_ssid rtw_ssid_t;
|
||||
|
||||
struct rtw_mac
|
||||
{
|
||||
unsigned int8_t octet[6];
|
||||
};
|
||||
|
||||
typedef rtw_mac rtw_mac_t;
|
||||
|
||||
struct rtw_scan_result
|
||||
{
|
||||
rtw_ssid_t SSID;
|
||||
rtw_mac_t BSSID;
|
||||
sint16_t signal_strength;
|
||||
enum rtw_bss_type_t bss_type;
|
||||
enum rtw_security_t security;
|
||||
enum rtw_wps_type_t wps_type;
|
||||
unsigned int channel;
|
||||
enum rtw_802_11_band_t band;
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#endif // _WLAN_LIB_H
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
//#pragma pack(1)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ typedef struct rtw_network_info {
|
|||
int key_id;
|
||||
}rtw_network_info_t;
|
||||
|
||||
#if defined(__IAR_SYSTEMS_ICC__)// || defined(__GNUC__)
|
||||
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
|
@ -96,14 +96,14 @@ typedef struct rtw_network_info {
|
|||
typedef struct rtw_scan_result {
|
||||
rtw_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */
|
||||
rtw_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */
|
||||
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
|
||||
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
|
||||
rtw_bss_type_t bss_type; /**< Network type */
|
||||
rtw_security_t security; /**< Security type */
|
||||
rtw_wps_type_t wps_type; /**< WPS type */
|
||||
unsigned int channel; /**< Radio channel that the AP beacon was received on */
|
||||
unsigned int channel; /**< Radio channel that the AP beacon was received on */
|
||||
rtw_802_11_band_t band; /**< Radio band */
|
||||
} rtw_scan_result_t;
|
||||
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__)
|
||||
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
|
@ -117,7 +117,7 @@ typedef struct rtw_scan_handler_result {
|
|||
|
||||
} rtw_scan_handler_result_t;
|
||||
|
||||
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__)
|
||||
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
|
@ -125,14 +125,14 @@ typedef struct rtw_scan_handler_result {
|
|||
* @brief The structure is used to store the WIFI setting gotten from WIFI driver.
|
||||
*/
|
||||
typedef struct rtw_wifi_setting {
|
||||
rtw_mode_t mode;
|
||||
rtw_mode_t mode;
|
||||
unsigned char ssid[33];
|
||||
unsigned char channel;
|
||||
rtw_security_t security_type;
|
||||
unsigned char password[65];
|
||||
unsigned char key_idx;
|
||||
}rtw_wifi_setting_t;
|
||||
#if defined(__IAR_SYSTEMS_ICC__) //|| defined(__GNUC__)
|
||||
#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
|
@ -167,7 +167,7 @@ typedef struct {
|
|||
unsigned int version; /**< version field */
|
||||
unsigned int length; /**< byte length of data in this record, */
|
||||
/* starting at version and including IEs */
|
||||
rtw_mac_t BSSID;
|
||||
rtw_mac_t BSSID;
|
||||
unsigned short beacon_period; /**< units are Kusec */
|
||||
unsigned short capability; /**< Capability information */
|
||||
unsigned char SSID_len;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1277,7 +1277,7 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
|
|||
//-----------HOOK BEFORE REG INIT-----------//
|
||||
// ODM Platform info AP/ADSL/CE/MP = 1/2/3/4
|
||||
u1Byte SupportPlatform;
|
||||
// ODM Support Ability DIG/RATR/TX_PWR_TRACK/ <EFBFBD>K<EFBFBD>K = 1/2/3/<2F>K
|
||||
// ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ¡K¡K = 1/2/3/¡K
|
||||
u4Byte SupportAbility;
|
||||
// ODM PCIE/USB/SDIO = 1/2/3
|
||||
u1Byte SupportInterface;
|
||||
|
@ -1491,7 +1491,7 @@ typedef struct DM_Out_Source_Dynamic_Mechanism_Structure
|
|||
PROM_INFO pROMInfo;
|
||||
|
||||
FALSE_ALARM_STATISTICS FalseAlmCnt;
|
||||
CFO_TRACKING DM_CfoTrack;
|
||||
CFO_TRACKING DM_CfoTrack;
|
||||
|
||||
FALSE_ALARM_STATISTICS FlaseAlmCntBuddyAdapter;
|
||||
//#ifdef CONFIG_ANTENNA_DIVERSITY
|
||||
|
|
|
@ -375,10 +375,10 @@ typedef enum _RT_SPINLOCK_TYPE{
|
|||
typedef unsigned short u2Byte,*pu2Byte;
|
||||
typedef unsigned int u4Byte,*pu4Byte;
|
||||
typedef unsigned long long u8Byte,*pu8Byte;
|
||||
typedef signed char s1Byte,*ps1Byte; /* GCC ROM char = unsigned char */
|
||||
typedef signed char s1Byte,*ps1Byte; /* GCC ROM char = unsigned char */
|
||||
typedef signed short s2Byte,*ps2Byte;
|
||||
typedef signed long s4Byte,*ps4Byte;
|
||||
typedef long long s8Byte,*ps8Byte;
|
||||
typedef signed long s4Byte,*ps4Byte;
|
||||
typedef long long s8Byte,*ps8Byte;
|
||||
|
||||
typedef struct sta_info STA_INFO_T,*PSTA_INFO_T;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#ifndef __ROM_RTL8195A_PHYDM_H__
|
||||
#define __ROM_RTL8195A_PHYDM_H__
|
||||
|
||||
#ifndef _RTL_BIOS_DATA_H_
|
||||
typedef struct _FALSE_ALARM_STATISTICS{
|
||||
u4Byte Cnt_Parity_Fail;
|
||||
u4Byte Cnt_Rate_Illegal;
|
||||
|
@ -57,19 +56,16 @@ typedef struct _CFO_TRACKING_
|
|||
u1Byte CFO_TH_ATC;
|
||||
}CFO_TRACKING, *PCFO_TRACKING;
|
||||
|
||||
|
||||
extern FALSE_ALARM_STATISTICS FalseAlmCnt;
|
||||
extern CFO_TRACKING DM_CfoTrack;
|
||||
|
||||
typedef struct _ROM_INFO{
|
||||
u1Byte EEPROMVersion;
|
||||
u1Byte CrystalCap;
|
||||
u8Byte DebugComponents;
|
||||
u4Byte DebugLevel;
|
||||
} ROM_INFO, *PROM_INFO;
|
||||
}ROM_INFO, *PROM_INFO;
|
||||
|
||||
extern FALSE_ALARM_STATISTICS FalseAlmCnt;
|
||||
extern CFO_TRACKING DM_CfoTrack;
|
||||
extern ROM_INFO ROMInfo;
|
||||
#endif
|
||||
|
||||
u1Byte
|
||||
ROM_odm_QueryRxPwrPercentage(
|
||||
|
|
|
@ -414,7 +414,7 @@ struct net_device_stats {
|
|||
struct net_device {
|
||||
char name[16];
|
||||
void *priv; /* pointer to private data */
|
||||
unsigned char dev_addr[6]; /* set during bootup */
|
||||
unsigned char dev_addr[6]; /* set during bootup */
|
||||
int (*init)(void);
|
||||
int (*open)(struct net_device *dev);
|
||||
int (*stop)(struct net_device *dev);
|
||||
|
@ -444,13 +444,11 @@ int dev_alloc_name(struct net_device *net_dev, const char *ifname);
|
|||
//----- ------------------------------------------------------------------
|
||||
void init_timer(struct timer_list *timer);
|
||||
void mod_timer(struct timer_list *timer, u32 delay_time_ms);
|
||||
void cancel_timer_ex(struct timer_list * timer);
|
||||
void cancel_timer_ex(struct timer_list * timer);
|
||||
void del_timer_sync(struct timer_list * timer);
|
||||
void init_timer_wrapper(void);
|
||||
void deinit_timer_wrapper(void);
|
||||
|
||||
typedef void (*TIMER_FUN)(void *context);
|
||||
|
||||
void rtw_init_timer(_timer *ptimer, void *adapter, TIMER_FUN pfunc,void* cntx, const char *name);
|
||||
void rtw_set_timer(_timer *ptimer,u32 delay_time);
|
||||
u8 rtw_cancel_timer(_timer *ptimer);
|
||||
|
|
|
@ -165,7 +165,7 @@ int read_uart_atcmd_setting_from_system_data(UART_LOG_CONF* uartconf)
|
|||
|
||||
if(load_default == _TRUE){
|
||||
// load default setting
|
||||
uartconf->BaudRate = UART_BAUD_RATE_38400;
|
||||
uartconf->BaudRate = DEFAULT_BAUDRATE;
|
||||
uartconf->DataBits = 8;
|
||||
uartconf->Parity = ParityNone;
|
||||
uartconf->StopBits = 1;
|
||||
|
|
|
@ -107,7 +107,14 @@ int wlan_init_done_callback()
|
|||
// rtw_network_info_t *wifi;
|
||||
// SC_connect_to_candidate_AP
|
||||
// SC_parse_scan_result_and_connect();
|
||||
if (wifi_connect(data->psk_essid, data->security_type, data->psk_passphrase, strlen(data->psk_essid), strlen(data->psk_passphrase), RTW_SECURITY_OPEN, NULL) == RTW_SUCCESS) {
|
||||
if (wifi_connect(
|
||||
NULL,
|
||||
0,
|
||||
data->psk_essid,
|
||||
data->security_type,
|
||||
data->psk_passphrase,
|
||||
RTW_SECURITY_OPEN,
|
||||
NULL) == RTW_SUCCESS) {
|
||||
#else
|
||||
//set partial scan for entering to listen beacon quickly
|
||||
channel = data->channel & 0xFF;
|
||||
|
@ -124,7 +131,14 @@ int wlan_init_done_callback()
|
|||
u8 bssid[ETH_ALEN] = { 0xbc,0xae,0xc5,0xeb,0x09,0x90 };
|
||||
|
||||
// if (wifi_connect(data->psk_essid, data->security_type, data->psk_passphrase, strlen(data->psk_essid), strlen(data->psk_passphrase), RTW_SECURITY_OPEN, NULL) == RTW_SUCCESS) {
|
||||
if (wifi_connect_bssid(bssid, data->psk_essid, data->security_type, data->psk_passphrase, ETH_ALEN, strlen(data->psk_essid), strlen(data->psk_passphrase), data->channel>>28, NULL) == RTW_SUCCESS) {
|
||||
if (wifi_connect(
|
||||
bssid,
|
||||
1,
|
||||
data->psk_essid,
|
||||
data->security_type,
|
||||
data->psk_passphrase,
|
||||
data->channel>>28,
|
||||
NULL) == RTW_SUCCESS) {
|
||||
#endif
|
||||
// DBG_8195A("WiFi connected at start %dms\n", xTaskGetTickCount());
|
||||
#if CONFIG_LWIP_LAYER
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct analogin_s analogin_t;
|
||||
typedef struct analogin_s analogin_t; // 444 bytes!
|
||||
|
||||
void analogin_init (analogin_t *obj, PinName pin);
|
||||
float analogin_read (analogin_t *obj);
|
||||
|
|
|
@ -26,19 +26,19 @@ extern "C" {
|
|||
|
||||
typedef struct pwmout_s pwmout_t;
|
||||
|
||||
void pwmout_init (pwmout_t* obj, PinName pin);
|
||||
int pwmout_init (pwmout_t* obj, PinName pin); // != 0 - error
|
||||
void pwmout_free (pwmout_t* obj);
|
||||
|
||||
void pwmout_write (pwmout_t* obj, float percent);
|
||||
float pwmout_read (pwmout_t* obj);
|
||||
//void pwmout_write (pwmout_t* obj, float percent);
|
||||
//float pwmout_read (pwmout_t* obj);
|
||||
|
||||
void pwmout_period (pwmout_t* obj, float seconds);
|
||||
void pwmout_period_ms (pwmout_t* obj, int ms);
|
||||
void pwmout_period_us (pwmout_t* obj, int us);
|
||||
//void pwmout_period (pwmout_t* obj, float seconds);
|
||||
//void pwmout_period_ms (pwmout_t* obj, int ms);
|
||||
void pwmout_period_us (pwmout_t* obj, uint32_t us);
|
||||
|
||||
void pwmout_pulsewidth (pwmout_t* obj, float seconds);
|
||||
void pwmout_pulsewidth_ms(pwmout_t* obj, int ms);
|
||||
void pwmout_pulsewidth_us(pwmout_t* obj, int us);
|
||||
//void pwmout_pulsewidth (pwmout_t* obj, float seconds);
|
||||
//void pwmout_pulsewidth_ms(pwmout_t* obj, uint32_t ms);
|
||||
void pwmout_pulsewidth_us(pwmout_t* obj, uint32_t us);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -119,6 +119,14 @@ void analogin_init (analogin_t *obj, PinName pin){
|
|||
|
||||
float analogin_read(analogin_t *obj){
|
||||
float value;
|
||||
union {
|
||||
unsigned int ui[2];
|
||||
unsigned short us[4];
|
||||
} adata;
|
||||
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
||||
RtkADCReceiveBuf(p, &adata.ui);
|
||||
return (float)(adata.us[p->DevNum]) / (float)(0xCE80);
|
||||
/*
|
||||
uint32_t AnaloginTmp[2] = {0,0};
|
||||
uint32_t AnaloginDatMsk = 0xFFFF;
|
||||
uint8_t AnaloginIdx = 0;
|
||||
|
@ -144,9 +152,18 @@ float analogin_read(analogin_t *obj){
|
|||
value = (float)(AnalogDat) / (float)(AnalogDatFull);
|
||||
|
||||
return (float)value;
|
||||
*/
|
||||
}
|
||||
|
||||
uint16_t analogin_read_u16(analogin_t *obj){
|
||||
union {
|
||||
unsigned int ui[2];
|
||||
unsigned short us[4];
|
||||
} adata;
|
||||
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
||||
RtkADCRxManualRotate(p, &adata.ui);
|
||||
return adata.us[p->DevNum];
|
||||
/*
|
||||
uint32_t AnaloginTmp[2] = {0,0};
|
||||
uint32_t AnaloginDatMsk = 0xFFFF;
|
||||
uint8_t AnaloginIdx = 0;
|
||||
|
@ -166,20 +183,23 @@ uint16_t analogin_read_u16(analogin_t *obj){
|
|||
AnalogDat = AnaloginTmp[(AnaloginIdx/2)];
|
||||
AnalogDat = (AnalogDat & AnaloginDatMsk);
|
||||
AnalogDat = (AnalogDat>>((u32)(16*(AnaloginIdx&0x01))));
|
||||
|
||||
return (uint16_t)AnalogDat;
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
void analogin_deinit(analogin_t *obj){
|
||||
PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL;
|
||||
/*
|
||||
PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL;
|
||||
PSAL_ADC_HND pSalADCHND = NULL;
|
||||
|
||||
pSalADCMngtAdpt = &(obj->SalADCMngtAdpt);
|
||||
pSalADCHND = &(pSalADCMngtAdpt->pSalHndPriv->SalADCHndPriv);
|
||||
p = &(pSalADCMngtAdpt->pSalHndPriv->SalADCHndPriv); */
|
||||
|
||||
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
||||
|
||||
/* To deinit analogin */
|
||||
RtkADCDeInit(pSalADCHND);
|
||||
RtkADCDeInit(p);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -119,7 +119,7 @@ void log_uart_free(log_uart_t *obj)
|
|||
ACTCK_LOG_UART_CCTRL(ON);
|
||||
|
||||
//4 Inital Log uart
|
||||
UartAdapter.BaudRate = UART_BAUD_RATE_38400;
|
||||
UartAdapter.BaudRate = DEFAULT_BAUDRATE;
|
||||
UartAdapter.DataLength = UART_DATA_LEN_8BIT;
|
||||
UartAdapter.FIFOControl = 0xC1;
|
||||
UartAdapter.IntEnReg = 0x00;
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
* Copyright (c) 2014, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*******************************************************************************
|
||||
* bug fixing: pvvx
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
|
@ -18,8 +17,10 @@
|
|||
#ifdef CONFIG_PWM_EN
|
||||
#include "pwmout_api.h"
|
||||
#include "objects.h"
|
||||
|
||||
extern u32 gTimerRecord;
|
||||
|
||||
static const PinMap PinMap_PWM[] = {
|
||||
const PinMap PinMap_PWM[] = {
|
||||
{PB_4, RTL_PIN_PERI(PWM0, 0, S0), RTL_PIN_FUNC(PWM0, S0)},
|
||||
{PB_5, RTL_PIN_PERI(PWM1, 1, S0), RTL_PIN_FUNC(PWM1, S0)},
|
||||
{PB_6, RTL_PIN_PERI(PWM2, 2, S0), RTL_PIN_FUNC(PWM2, S0)},
|
||||
|
@ -43,7 +44,7 @@ static const PinMap PinMap_PWM[] = {
|
|||
{NC, NC, 0}
|
||||
};
|
||||
|
||||
void pwmout_init(pwmout_t* obj, PinName pin)
|
||||
int pwmout_init(pwmout_t* obj, PinName pin)
|
||||
{
|
||||
uint32_t peripheral;
|
||||
u32 pwm_idx;
|
||||
|
@ -56,7 +57,7 @@ void pwmout_init(pwmout_t* obj, PinName pin)
|
|||
|
||||
if (unlikely(peripheral == NC)) {
|
||||
DBG_PWM_ERR("%s: Cannot find matched pwm for this pin(0x%x)\n", __FUNCTION__, pin);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
pwm_idx = RTL_GET_PERI_IDX(peripheral);
|
||||
|
@ -66,75 +67,33 @@ void pwmout_init(pwmout_t* obj, PinName pin)
|
|||
obj->pin_sel = pin_sel;
|
||||
obj->period = 0;
|
||||
obj->pulse = 0;
|
||||
_memset((void *)&obj->pwm_hal_adp, 0, sizeof(HAL_PWM_ADAPTER));
|
||||
rtl_memset((void *)&obj->pwm_hal_adp, 0, sizeof(HAL_PWM_ADAPTER));
|
||||
if (HAL_OK != HAL_Pwm_Init(&obj->pwm_hal_adp, pwm_idx, pin_sel)) {
|
||||
DBG_PWM_ERR("pwmout_init Err!\n");
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
pwmout_period_us(obj, 20000); // 20 ms per default
|
||||
HAL_Pwm_Enable(&obj->pwm_hal_adp);
|
||||
// pwmout_period_us(obj, 20000); // 20 ms per default
|
||||
// HAL_Pwm_Enable(&obj->pwm_hal_adp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pwmout_free(pwmout_t* obj)
|
||||
{
|
||||
HAL_Pwm_Disable(&obj->pwm_hal_adp);
|
||||
gTimerRecord &= ~(1 << obj->pwm_hal_adp.gtimer_id);
|
||||
}
|
||||
|
||||
void pwmout_write(pwmout_t* obj, float value)
|
||||
void pwmout_period_us(pwmout_t* obj, uint32_t us)
|
||||
{
|
||||
if (value < (float)0.0) {
|
||||
value = 0.0;
|
||||
}
|
||||
else if (value > (float)1.0) {
|
||||
value = 1.0;
|
||||
}
|
||||
|
||||
obj->pulse = (uint32_t)((float)obj->period * value);
|
||||
HAL_Pwm_SetDuty(&obj->pwm_hal_adp, obj->period, obj->pulse);
|
||||
obj->period = us;
|
||||
HAL_Pwm_SetDuty(&obj->pwm_hal_adp, us, obj->pulse);
|
||||
}
|
||||
|
||||
float pwmout_read(pwmout_t* obj)
|
||||
void pwmout_pulsewidth_us(pwmout_t* obj, uint32_t us)
|
||||
{
|
||||
float value = 0;
|
||||
if (obj->period > 0) {
|
||||
value = (float)(obj->pulse) / (float)(obj->period);
|
||||
}
|
||||
return ((value > (float)1.0) ? (float)(1.0) : (value));
|
||||
}
|
||||
|
||||
void pwmout_period(pwmout_t* obj, float seconds)
|
||||
{
|
||||
pwmout_period_us(obj, (int)(seconds * 1000000.0f));
|
||||
}
|
||||
|
||||
void pwmout_period_ms(pwmout_t* obj, int ms)
|
||||
{
|
||||
pwmout_period_us(obj, (int)(ms * 1000));
|
||||
}
|
||||
|
||||
void pwmout_period_us(pwmout_t* obj, int us)
|
||||
{
|
||||
float dc = pwmout_read(obj);
|
||||
|
||||
obj->period = us;
|
||||
// Set duty cycle again
|
||||
pwmout_write(obj, dc);
|
||||
}
|
||||
|
||||
void pwmout_pulsewidth(pwmout_t* obj, float seconds)
|
||||
{
|
||||
pwmout_pulsewidth_us(obj, (int)(seconds * 1000000.0f));
|
||||
}
|
||||
|
||||
void pwmout_pulsewidth_ms(pwmout_t* obj, int ms)
|
||||
{
|
||||
pwmout_pulsewidth_us(obj, ms * 1000);
|
||||
}
|
||||
|
||||
void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
||||
{
|
||||
float value = (float)us / (float)obj->period;
|
||||
pwmout_write(obj, value);
|
||||
obj->pulse = us;
|
||||
if(us > obj->period) obj->period = us;
|
||||
HAL_Pwm_SetDuty(&obj->pwm_hal_adp, obj->period, us);
|
||||
}
|
||||
|
||||
#endif // #ifdef CONFIG_PWM_EN
|
||||
|
|
|
@ -158,12 +158,10 @@ void sys_log_uart_off(void)
|
|||
|
||||
void sys_adc_calibration(u8 write, u16 *offset, u16 *gain)
|
||||
{
|
||||
flash_t flash;
|
||||
u8* pbuf;
|
||||
|
||||
extern flash_t flash;
|
||||
if(write){
|
||||
// backup
|
||||
pbuf = RtlMalloc(FLASH_SECTOR_SIZE);
|
||||
u8 *pbuf = RtlMalloc(FLASH_SECTOR_SIZE);
|
||||
if(!pbuf) return;
|
||||
device_mutex_lock(RT_DEV_LOCK_FLASH);
|
||||
flash_stream_read(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf);
|
||||
|
@ -172,7 +170,7 @@ void sys_adc_calibration(u8 write, u16 *offset, u16 *gain)
|
|||
flash_erase_sector(&flash, FLASH_RESERVED_DATA_BASE);
|
||||
flash_stream_write(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf);
|
||||
// Write
|
||||
flash_stream_read(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf);
|
||||
// flash_stream_read(&flash, FLASH_RESERVED_DATA_BASE, FLASH_SECTOR_SIZE, pbuf);
|
||||
flash_erase_sector(&flash, FLASH_SYSTEM_DATA_ADDR);
|
||||
flash_stream_write(&flash, FLASH_SYSTEM_DATA_ADDR, FLASH_SECTOR_SIZE, pbuf);
|
||||
device_mutex_unlock(RT_DEV_LOCK_FLASH);
|
||||
|
|
|
@ -41,22 +41,22 @@
|
|||
#ifdef LWIP_DEBUG
|
||||
|
||||
static const char *err_strerr[] = {
|
||||
"Ok.", /* ERR_OK 0 */
|
||||
"Out of memory error.", /* ERR_MEM -1 */
|
||||
"Buffer error.", /* ERR_BUF -2 */
|
||||
"Timeout.", /* ERR_TIMEOUT -3 */
|
||||
"Routing problem.", /* ERR_RTE -4 */
|
||||
"Operation in progress.", /* ERR_INPROGRESS -5 */
|
||||
"Illegal value.", /* ERR_VAL -6 */
|
||||
"Operation would block.", /* ERR_WOULDBLOCK -7 */
|
||||
"Address in use.", /* ERR_USE -8 */
|
||||
"Already connected.", /* ERR_ISCONN -9 */
|
||||
"Connection aborted.", /* ERR_ABRT -10 */
|
||||
"Connection reset.", /* ERR_RST -11 */
|
||||
"Connection closed.", /* ERR_CLSD -12 */
|
||||
"Not connected.", /* ERR_CONN -13 */
|
||||
"Illegal argument.", /* ERR_ARG -14 */
|
||||
"Low-level netif error.", /* ERR_IF -15 */
|
||||
"Ok", /* ERR_OK 0 */
|
||||
"Out of memory error", /* ERR_MEM -1 */
|
||||
"Buffer error", /* ERR_BUF -2 */
|
||||
"Timeout", /* ERR_TIMEOUT -3 */
|
||||
"Routing problem", /* ERR_RTE -4 */
|
||||
"Operation in progress", /* ERR_INPROGRESS -5 */
|
||||
"Illegal value", /* ERR_VAL -6 */
|
||||
"Operation would block", /* ERR_WOULDBLOCK -7 */
|
||||
"Address in use", /* ERR_USE -8 */
|
||||
"Already connected", /* ERR_ISCONN -9 */
|
||||
"Connection aborted", /* ERR_ABRT -10 */
|
||||
"Connection reset", /* ERR_RST -11 */
|
||||
"Connection closed", /* ERR_CLSD -12 */
|
||||
"Not connected", /* ERR_CONN -13 */
|
||||
"Illegal argument", /* ERR_ARG -14 */
|
||||
"Low-level netif error", /* ERR_IF -15 */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -184,7 +184,6 @@ void
|
|||
lwip_socket_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a externally used socket index to the internal socket representation.
|
||||
*
|
||||
|
@ -213,6 +212,14 @@ get_socket(int s)
|
|||
return sock;
|
||||
}
|
||||
|
||||
/*
|
||||
* pvvx: errno
|
||||
*/
|
||||
int lwip_last_err_socket(int s) {
|
||||
struct lwip_sock * sc = get_socket(s);
|
||||
if(sc) return sc->err;
|
||||
else return EBADF;
|
||||
}
|
||||
/**
|
||||
* Same as get_socket but doesn't set errno
|
||||
*
|
||||
|
|
|
@ -342,6 +342,8 @@ int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptse
|
|||
int lwip_ioctl(int s, long cmd, void *argp);
|
||||
int lwip_fcntl(int s, int cmd, int val);
|
||||
|
||||
int lwip_last_err_socket(int s); // errno
|
||||
|
||||
#if LWIP_COMPAT_SOCKETS
|
||||
#define accept(a,b,c) lwip_accept(a,b,c)
|
||||
#define bind(a,b,c) lwip_bind(a,b,c)
|
||||
|
@ -361,6 +363,7 @@ int lwip_fcntl(int s, int cmd, int val);
|
|||
#define select(a,b,c,d,e) lwip_select(a,b,c,d,e)
|
||||
#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c)
|
||||
|
||||
|
||||
#if LWIP_POSIX_SOCKETS_IO_NAMES
|
||||
#define read(a,b,c) lwip_read(a,b,c)
|
||||
#define write(a,b,c) lwip_write(a,b,c)
|
||||
|
|
|
@ -163,13 +163,12 @@ PACK_STRUCT_END
|
|||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
LOCAL char toupper(char ch) {
|
||||
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
|
||||
}
|
||||
//#define toupper(CH) \
|
||||
// (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
|
||||
|
||||
|
||||
/** NetBIOS decoding name */
|
||||
LOCAL int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
|
||||
static int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
|
||||
{
|
||||
uint8_t i, j;
|
||||
char c;
|
||||
|
@ -218,7 +217,7 @@ static void NBNS_encode(char *dst, char *src, uint8_t type)
|
|||
#endif
|
||||
|
||||
/** NetBIOS Name service recv callback */
|
||||
LOCAL void NETBIOS_CODE_ATTR
|
||||
static void NETBIOS_CODE_ATTR
|
||||
netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
|
||||
u16_t port) {
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
@ -227,7 +226,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
|
|||
if (current_netif != NULL && current_netif->num < NET_IF_NUM) {
|
||||
uint32 ip = current_netif->ip_addr.addr;
|
||||
char *curbiosname = netbios_name[current_netif->num];
|
||||
if (curbiosname[0] != '\0' && ip != 0
|
||||
if (curbiosname[0] != '\0' && ip != NULL
|
||||
/* we only answer if we got a default interface */
|
||||
&& (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети
|
||||
#if DEBUGSOO > 3
|
||||
|
@ -309,7 +308,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
|
|||
}
|
||||
}
|
||||
|
||||
LOCAL struct udp_pcb * NETBIOS_CODE_ATTR netbios_pcb(void) {
|
||||
struct udp_pcb * NETBIOS_CODE_ATTR netbios_pcb(void) {
|
||||
struct udp_pcb *pcb;
|
||||
for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||
if (pcb->local_port == NETBIOS_PORT)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
/****************Define if using the polarssl*******************/
|
||||
#define USING_SSL
|
||||
|
||||
|
||||
/******************Define the function used*********************/
|
||||
#ifdef USING_SSL
|
||||
int wss_set_fun_ops(wsclient_context *wsclient);
|
||||
|
@ -19,9 +18,6 @@ int ws_set_fun_ops(wsclient_context *wsclient);
|
|||
#endif
|
||||
/***************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
** Function Name : create_wsclient
|
||||
** Description : Creating the websocket client context structure
|
||||
|
@ -31,7 +27,7 @@ int ws_set_fun_ops(wsclient_context *wsclient);
|
|||
** Return : Created: websocket client context structure
|
||||
** Failed: NULL
|
||||
**************************************************************************************************/
|
||||
wsclient_context *create_wsclient(char *url, int port,char *path, char* origin);
|
||||
wsclient_context *create_wsclient(char *url, int port, char *path, char* origin);
|
||||
|
||||
/*************************************************************************************************
|
||||
** Function Name : ws_connect_url
|
||||
|
@ -105,4 +101,4 @@ readyStateValues ws_getReadyState(wsclient_context *wsclient);
|
|||
**************************************************************************************************/
|
||||
void ws_close(wsclient_context *wsclient);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -740,8 +740,8 @@ static void RestartSoftAP()
|
|||
wifi_restart_ap(wifi_setting.ssid,
|
||||
wifi_setting.security_type,
|
||||
wifi_setting.password,
|
||||
strlen((char*)wifi_setting.ssid),
|
||||
strlen((char*)wifi_setting.password),
|
||||
// strlen((char*)wifi_setting.ssid),
|
||||
// strlen((char*)wifi_setting.password),
|
||||
wifi_setting.channel);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,12 +74,12 @@ static int inHandlerMode (void)
|
|||
#if configSignalManagementSupport // the older FreeRTOS version didn't support Signal Management functions
|
||||
static void add_thread_signal_map (osThreadId thread_id, EventGroupHandle_t signals)
|
||||
{
|
||||
uint32_t dummy;
|
||||
int dummy;
|
||||
// uint32_t i;
|
||||
ThreadSignalRec *prec_entity;
|
||||
|
||||
if (inHandlerMode()) {
|
||||
dummy = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
dummy = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
}
|
||||
else {
|
||||
vPortEnterCritical();
|
||||
|
@ -135,7 +135,7 @@ static EventGroupHandle_t find_signal_by_thread (osThreadId thread_id)
|
|||
{
|
||||
EventGroupHandle_t signals_hdl=NULL;
|
||||
// uint32_t i;
|
||||
uint32_t dummy;
|
||||
int dummy;
|
||||
ThreadSignalRec *prec_entity;
|
||||
|
||||
if (inHandlerMode()) {
|
||||
|
@ -185,7 +185,7 @@ static EventGroupHandle_t remove_thread_signal_map (osThreadId thread_id)
|
|||
{
|
||||
EventGroupHandle_t signals_hdl=NULL;
|
||||
// uint32_t i;
|
||||
uint32_t dummy;
|
||||
int dummy;
|
||||
ThreadSignalRec *prec_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.
|
||||
void *osPoolAlloc (osPoolId pool_id)
|
||||
{
|
||||
uint32_t dummy;
|
||||
int dummy;
|
||||
void *p = NULL;
|
||||
uint32_t i;
|
||||
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.
|
||||
osStatus osPoolFree (osPoolId pool_id, void *block)
|
||||
{
|
||||
uint32_t dummy;
|
||||
int dummy;
|
||||
uint32_t index;
|
||||
|
||||
if (pool_id == NULL) {
|
||||
|
|
|
@ -1,67 +1,67 @@
|
|||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
* A sample implementation of pvPortMalloc() that allows the heap to be defined
|
||||
|
@ -111,10 +111,9 @@
|
|||
#include "platform_autoconf.h"
|
||||
#include "hal_misc.h"
|
||||
|
||||
|
||||
/* 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
|
||||
task.h is included from an application file. */
|
||||
all the API functions to use the MPU wrappers. That should only be done when
|
||||
task.h is included from an application file. */
|
||||
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
|
@ -129,11 +128,10 @@ task.h is included from an application file. */
|
|||
#define heapBITS_PER_BYTE ( ( size_t ) 8 )
|
||||
|
||||
/* Define the linked list structure. This is used to link free blocks in order
|
||||
of their memory address. */
|
||||
typedef struct A_BLOCK_LINK
|
||||
{
|
||||
struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */
|
||||
size_t xBlockSize; /*<< The size of the free block. */
|
||||
of their memory address. */
|
||||
typedef struct A_BLOCK_LINK {
|
||||
struct A_BLOCK_LINK *pxNextFreeBlock; /*<< The next free block in the list. */
|
||||
size_t xBlockSize; /*<< The size of the free block. */
|
||||
} BlockLink_t;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -144,31 +142,33 @@ typedef struct A_BLOCK_LINK
|
|||
* the block in front it and/or the block behind it if the memory blocks are
|
||||
* adjacent to each other.
|
||||
*/
|
||||
static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert );
|
||||
static void prvInsertBlockIntoFreeList(BlockLink_t *pxBlockToInsert);
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* The size of the structure placed at the beginning of each allocated memory
|
||||
block must by correctly byte aligned. */
|
||||
static const uint32_t uxHeapStructSize = ( ( sizeof ( BlockLink_t ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK );
|
||||
block must by correctly byte aligned. */
|
||||
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. */
|
||||
static BlockLink_t xStart, *pxEnd = NULL;
|
||||
|
||||
/* Keeps track of the number of free bytes remaining, but says nothing about
|
||||
fragmentation. */
|
||||
fragmentation. */
|
||||
static size_t xFreeBytesRemaining = 0;
|
||||
static size_t xMinimumEverFreeBytesRemaining = 0;
|
||||
|
||||
/* Gets set to the top bit of an size_t type. When this bit in the xBlockSize
|
||||
member of an BlockLink_t structure is set then the block belongs to the
|
||||
application. When the bit is free the block is still part of the free heap
|
||||
space. */
|
||||
member of an BlockLink_t structure is set then the block belongs to the
|
||||
application. When the bit is free the block is still part of the free heap
|
||||
space. */
|
||||
//static size_t xBlockAllocatedBit = 0;
|
||||
/* Work out the position of the top bit in a size_t variable. */
|
||||
#define xBlockAllocatedBit (( ( size_t ) 1 ) << ( ( sizeof( size_t ) * heapBITS_PER_BYTE ) - 1 ))
|
||||
|
||||
/* Realtek test code start */
|
||||
//TODO: remove section when combine BD and BF
|
||||
#if (defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B))
|
||||
#include "section_config.h"
|
||||
SRAM_HEAP_SECTION
|
||||
|
@ -184,18 +184,18 @@ extern HeapRegion_t xHeapRegions[];
|
|||
#if defined(CONFIG_PLATFORM_8195A)
|
||||
HeapRegion_t xHeapRegions[] =
|
||||
{
|
||||
{ (uint8_t*)0x10003000, 0x10006000 - 0x10003000 }, // __ram_heap1_start__, __ram_heap1_end__ - __ram_heap1_start__
|
||||
{ ucHeap, sizeof(ucHeap) }, // Defines a block from ucHeap
|
||||
{ (uint8_t*)0x10003000, 0x10006000 - 0x10003000}, // __ram_heap1_start__, __ram_heap1_end__ - __ram_heap1_start__
|
||||
{ ucHeap, sizeof(ucHeap)}, // Defines a block from ucHeap
|
||||
#ifdef CONFIG_SDR_EN
|
||||
{ (uint8_t*)&__sdram_bss_end__, 0x80000 },
|
||||
{ (uint8_t*)&__sdram_bss_end__, 0x80000},
|
||||
#endif
|
||||
{ NULL, 0 } // Terminates the array.
|
||||
{ NULL, 0} // Terminates the array.
|
||||
};
|
||||
#elif (defined CONFIG_PLATFORM_8711B)
|
||||
HeapRegion_t xHeapRegions[] =
|
||||
{
|
||||
{ ucHeap, sizeof(ucHeap) }, // Defines a block from ucHeap
|
||||
{ NULL, 0 } // Terminates the array.
|
||||
{ ucHeap, sizeof(ucHeap)}, // Defines a block from ucHeap
|
||||
{ NULL, 0} // Terminates the array.
|
||||
};
|
||||
#else
|
||||
#error NOT SUPPORT CHIP
|
||||
|
@ -204,152 +204,138 @@ HeapRegion_t xHeapRegions[] =
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
/*
|
||||
Dump xBlock list
|
||||
*/
|
||||
void dump_mem_block_list(void)
|
||||
{
|
||||
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions );
|
||||
Dump xBlock list
|
||||
*/
|
||||
void dump_mem_block_list(void) {
|
||||
if (pxEnd == NULL)
|
||||
vPortDefineHeapRegions(xHeapRegions);
|
||||
#if CONFIG_DEBUG_LOG > 1
|
||||
// if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions ); // test code start
|
||||
BlockLink_t *pxBlock = &xStart;
|
||||
int count = 0;
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void *pvPortMalloc( size_t xWantedSize )
|
||||
{
|
||||
BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
|
||||
void *pvReturn = NULL;
|
||||
void *pvPortMalloc(size_t xWantedSize) {
|
||||
BlockLink_t *pxBlock, *pxPreviousBlock, *pxNewBlockLink;
|
||||
void *pvReturn = NULL;
|
||||
|
||||
/* Realtek test code start */
|
||||
if(pxEnd == NULL) vPortDefineHeapRegions( xHeapRegions );
|
||||
if (pxEnd == NULL)
|
||||
vPortDefineHeapRegions(xHeapRegions);
|
||||
/* Realtek test code end */
|
||||
|
||||
/* The heap must be initialised before the first call to
|
||||
prvPortMalloc(). */
|
||||
prvPortMalloc(). */
|
||||
configASSERT( pxEnd );
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
/* Check the requested block size is not so large that the top bit is
|
||||
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
|
||||
kernel, so it must be free. */
|
||||
if( ( xWantedSize & xBlockAllocatedBit ) == 0 )
|
||||
{
|
||||
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
|
||||
kernel, so it must be free. */
|
||||
if ((xWantedSize & xBlockAllocatedBit) == 0) {
|
||||
/* The wanted size is increased so it can contain a BlockLink_t
|
||||
structure in addition to the requested amount of bytes. */
|
||||
if( xWantedSize > 0 )
|
||||
{
|
||||
structure in addition to the requested amount of bytes. */
|
||||
if (xWantedSize > 0) {
|
||||
xWantedSize += uxHeapStructSize;
|
||||
|
||||
/* Ensure that blocks are always aligned to the required number
|
||||
of bytes. */
|
||||
if( ( xWantedSize & portBYTE_ALIGNMENT_MASK ) != 0x00 )
|
||||
{
|
||||
of bytes. */
|
||||
if ((xWantedSize & portBYTE_ALIGNMENT_MASK) != 0x00) {
|
||||
/* Byte alignment required. */
|
||||
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
xWantedSize += ( portBYTE_ALIGNMENT
|
||||
- (xWantedSize & portBYTE_ALIGNMENT_MASK));
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
if( ( xWantedSize > 0 ) && ( xWantedSize <= xFreeBytesRemaining ) )
|
||||
{
|
||||
if ((xWantedSize > 0) && (xWantedSize <= xFreeBytesRemaining)) {
|
||||
/* Traverse the list from the start (lowest address) block until
|
||||
one of adequate size is found. */
|
||||
one of adequate size is found. */
|
||||
pxPreviousBlock = &xStart;
|
||||
pxBlock = xStart.pxNextFreeBlock;
|
||||
while( ( pxBlock->xBlockSize < xWantedSize ) && ( pxBlock->pxNextFreeBlock != NULL ) )
|
||||
{
|
||||
while ((pxBlock->xBlockSize < xWantedSize)
|
||||
&& (pxBlock->pxNextFreeBlock != NULL)) {
|
||||
pxPreviousBlock = pxBlock;
|
||||
pxBlock = pxBlock->pxNextFreeBlock;
|
||||
}
|
||||
|
||||
/* If the end marker was reached then a block of adequate size
|
||||
was not found. */
|
||||
if( pxBlock != pxEnd )
|
||||
{
|
||||
was not found. */
|
||||
if (pxBlock != pxEnd) {
|
||||
/* Return the memory space pointed to - jumping over the
|
||||
BlockLink_t structure at its start. */
|
||||
pvReturn = ( void * ) ( ( ( uint8_t * ) pxPreviousBlock->pxNextFreeBlock ) + uxHeapStructSize );
|
||||
BlockLink_t structure at its start. */
|
||||
pvReturn =
|
||||
(void *) (((uint8_t *) pxPreviousBlock->pxNextFreeBlock)
|
||||
+ uxHeapStructSize);
|
||||
|
||||
/* This block is being returned for use so must be taken out
|
||||
of the list of free blocks. */
|
||||
of the list of free blocks. */
|
||||
pxPreviousBlock->pxNextFreeBlock = pxBlock->pxNextFreeBlock;
|
||||
|
||||
/* If the block is larger than required it can be split into
|
||||
two. */
|
||||
if( ( pxBlock->xBlockSize - xWantedSize ) > heapMINIMUM_BLOCK_SIZE )
|
||||
{
|
||||
two. */
|
||||
if ((pxBlock->xBlockSize - xWantedSize)
|
||||
> heapMINIMUM_BLOCK_SIZE) {
|
||||
/* This block is to be split into two. Create a new
|
||||
block following the number of bytes requested. The void
|
||||
cast is used to prevent byte alignment warnings from the
|
||||
compiler. */
|
||||
pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize );
|
||||
block following the number of bytes requested. The void
|
||||
cast is used to prevent byte alignment warnings from the
|
||||
compiler. */
|
||||
pxNewBlockLink = (void *) (((uint8_t *) pxBlock)
|
||||
+ xWantedSize);
|
||||
|
||||
/* Calculate the sizes of two blocks split from the
|
||||
single block. */
|
||||
pxNewBlockLink->xBlockSize = pxBlock->xBlockSize - xWantedSize;
|
||||
single block. */
|
||||
pxNewBlockLink->xBlockSize = pxBlock->xBlockSize
|
||||
- xWantedSize;
|
||||
pxBlock->xBlockSize = xWantedSize;
|
||||
|
||||
/* Insert the new block into the list of free blocks. */
|
||||
prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
prvInsertBlockIntoFreeList((pxNewBlockLink));
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
xFreeBytesRemaining -= pxBlock->xBlockSize;
|
||||
|
||||
if( xFreeBytesRemaining < xMinimumEverFreeBytesRemaining )
|
||||
{
|
||||
if (xFreeBytesRemaining < xMinimumEverFreeBytesRemaining) {
|
||||
xMinimumEverFreeBytesRemaining = xFreeBytesRemaining;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
/* The block is being returned - it is allocated and owned
|
||||
by the application and has no "next" block. */
|
||||
by the application and has no "next" block. */
|
||||
pxBlock->xBlockSize |= xBlockAllocatedBit;
|
||||
pxBlock->pxNextFreeBlock = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
traceMALLOC( pvReturn, xWantedSize );
|
||||
} traceMALLOC( pvReturn, xWantedSize );
|
||||
}
|
||||
( void ) xTaskResumeAll();
|
||||
if(pvReturn == NULL) {
|
||||
DBG_RAM_HEAP_WARN("ram_alloc(%d): freeSpace(%d)!\n", xWantedSize, xFreeBytesRemaining);
|
||||
(void) xTaskResumeAll();
|
||||
if (pvReturn == NULL) {
|
||||
DBG_RAM_HEAP_WARN("ram_alloc(%d): freeSpace(%d)!\n", xWantedSize,
|
||||
xFreeBytesRemaining);
|
||||
} else {
|
||||
// DBG_RAM_HEAP_INFO("ram_alloc:%p[%d]\n", pvReturn , xWantedSize);
|
||||
}
|
||||
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
|
||||
#if( configUSE_MALLOC_FAILED_HOOK == 1 )
|
||||
{
|
||||
if( pvReturn == NULL )
|
||||
{
|
||||
|
@ -361,36 +347,31 @@ void *pvReturn = NULL;
|
|||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return pvReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void __vPortFree( void *pv )
|
||||
{
|
||||
uint8_t *puc = ( uint8_t * ) pv;
|
||||
BlockLink_t *pxLink;
|
||||
void __vPortFree(void *pv) {
|
||||
uint8_t *puc = (uint8_t *) pv;
|
||||
BlockLink_t *pxLink;
|
||||
|
||||
if( pv != NULL )
|
||||
{
|
||||
if (pv != NULL) {
|
||||
/* The memory being freed will have an BlockLink_t structure immediately
|
||||
before it. */
|
||||
before it. */
|
||||
puc -= uxHeapStructSize;
|
||||
|
||||
/* This casting is to keep the compiler from issuing warnings. */
|
||||
pxLink = ( void * ) puc;
|
||||
pxLink = (void *) puc;
|
||||
|
||||
/* Check the block is actually allocated. */
|
||||
configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 );
|
||||
configASSERT( pxLink->pxNextFreeBlock == NULL );
|
||||
configASSERT( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 ); configASSERT( pxLink->pxNextFreeBlock == NULL );
|
||||
|
||||
if( ( pxLink->xBlockSize & xBlockAllocatedBit ) != 0 )
|
||||
{
|
||||
if( pxLink->pxNextFreeBlock == NULL )
|
||||
{
|
||||
if ((pxLink->xBlockSize & xBlockAllocatedBit) != 0) {
|
||||
if (pxLink->pxNextFreeBlock == NULL) {
|
||||
/* The block is being returned to the heap - it is no longer
|
||||
allocated. */
|
||||
allocated. */
|
||||
pxLink->xBlockSize &= ~xBlockAllocatedBit;
|
||||
|
||||
vTaskSuspendAll();
|
||||
|
@ -398,17 +379,13 @@ BlockLink_t *pxLink;
|
|||
/* Add this block to the list of free blocks. */
|
||||
xFreeBytesRemaining += pxLink->xBlockSize;
|
||||
traceFREE( pv, pxLink->xBlockSize );
|
||||
prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) );
|
||||
prvInsertBlockIntoFreeList(((BlockLink_t *) pxLink));
|
||||
}
|
||||
( void ) xTaskResumeAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) xTaskResumeAll();
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
// DBG_RAM_HEAP_INFO("ram_free:%p[%d]\n", pv , pxLink->xBlockSize);
|
||||
|
@ -417,136 +394,120 @@ BlockLink_t *pxLink;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Add by Alfa 2015/02/04 -----------------------------------*/
|
||||
static void (*ext_free)( void *p ) = NULL;
|
||||
static void (*ext_free)(void *p) = NULL;
|
||||
//static
|
||||
uint32_t ext_upper = 0;
|
||||
//static
|
||||
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_upper = upper;
|
||||
ext_lower = lower;
|
||||
}
|
||||
|
||||
void vPortFree( void *pv )
|
||||
{
|
||||
if( ((uint32_t)pv >= ext_lower) && ((uint32_t)pv < ext_upper) ){
|
||||
void vPortFree(void *pv) {
|
||||
if (((uint32_t) pv >= ext_lower) && ((uint32_t) pv < ext_upper)) {
|
||||
// use external free function
|
||||
if( ext_free ) ext_free( pv );
|
||||
}else
|
||||
__vPortFree( pv );
|
||||
if (ext_free)
|
||||
ext_free(pv);
|
||||
} else
|
||||
__vPortFree(pv);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
size_t xPortGetFreeHeapSize( void )
|
||||
{
|
||||
size_t xPortGetFreeHeapSize(void) {
|
||||
return xFreeBytesRemaining;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
size_t xPortGetMinimumEverFreeHeapSize( void )
|
||||
{
|
||||
size_t xPortGetMinimumEverFreeHeapSize(void) {
|
||||
return xMinimumEverFreeBytesRemaining;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvInsertBlockIntoFreeList( BlockLink_t *pxBlockToInsert )
|
||||
{
|
||||
BlockLink_t *pxIterator;
|
||||
uint8_t *puc;
|
||||
static void prvInsertBlockIntoFreeList(BlockLink_t *pxBlockToInsert) {
|
||||
BlockLink_t *pxIterator;
|
||||
uint8_t *puc;
|
||||
|
||||
/* Iterate through the list until a block is found that has a higher address
|
||||
than the block being inserted. */
|
||||
for( pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert; pxIterator = pxIterator->pxNextFreeBlock )
|
||||
{
|
||||
than the block being inserted. */
|
||||
for (pxIterator = &xStart; pxIterator->pxNextFreeBlock < pxBlockToInsert;
|
||||
pxIterator = pxIterator->pxNextFreeBlock) {
|
||||
/* Nothing to do here, just iterate to the right position. */
|
||||
}
|
||||
|
||||
/* Do the block being inserted, and the block it is being inserted after
|
||||
make a contiguous block of memory? */
|
||||
puc = ( uint8_t * ) pxIterator;
|
||||
if( ( puc + pxIterator->xBlockSize ) == ( uint8_t * ) pxBlockToInsert )
|
||||
{
|
||||
make a contiguous block of memory? */
|
||||
puc = (uint8_t *) pxIterator;
|
||||
if ((puc + pxIterator->xBlockSize) == (uint8_t *) pxBlockToInsert) {
|
||||
pxIterator->xBlockSize += pxBlockToInsert->xBlockSize;
|
||||
pxBlockToInsert = pxIterator;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
/* Do the block being inserted, and the block it is being inserted before
|
||||
make a contiguous block of memory? */
|
||||
puc = ( uint8_t * ) pxBlockToInsert;
|
||||
if( ( puc + pxBlockToInsert->xBlockSize ) == ( uint8_t * ) pxIterator->pxNextFreeBlock )
|
||||
{
|
||||
if( pxIterator->pxNextFreeBlock != pxEnd )
|
||||
{
|
||||
make a contiguous block of memory? */
|
||||
puc = (uint8_t *) pxBlockToInsert;
|
||||
if ((puc + pxBlockToInsert->xBlockSize)
|
||||
== (uint8_t *) pxIterator->pxNextFreeBlock) {
|
||||
if (pxIterator->pxNextFreeBlock != pxEnd) {
|
||||
/* Form one big block from the two blocks. */
|
||||
pxBlockToInsert->xBlockSize += pxIterator->pxNextFreeBlock->xBlockSize;
|
||||
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock->pxNextFreeBlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
pxBlockToInsert->xBlockSize +=
|
||||
pxIterator->pxNextFreeBlock->xBlockSize;
|
||||
pxBlockToInsert->pxNextFreeBlock =
|
||||
pxIterator->pxNextFreeBlock->pxNextFreeBlock;
|
||||
} else {
|
||||
pxBlockToInsert->pxNextFreeBlock = pxEnd;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
pxBlockToInsert->pxNextFreeBlock = pxIterator->pxNextFreeBlock;
|
||||
}
|
||||
|
||||
/* If the block being inserted plugged a gab, so was merged with the block
|
||||
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
|
||||
to itself. */
|
||||
if( pxIterator != pxBlockToInsert )
|
||||
{
|
||||
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
|
||||
to itself. */
|
||||
if (pxIterator != pxBlockToInsert) {
|
||||
pxIterator->pxNextFreeBlock = pxBlockToInsert;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
|
||||
{
|
||||
BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock;
|
||||
uint8_t *pucAlignedHeap;
|
||||
size_t xTotalRegionSize, xTotalHeapSize = 0;
|
||||
BaseType_t xDefinedRegions = 0;
|
||||
uint32_t ulAddress;
|
||||
const HeapRegion_t *pxHeapRegion;
|
||||
static void vPortDefineHeapRegions(const HeapRegion_t * const pxHeapRegions) {
|
||||
BlockLink_t *pxFirstFreeBlockInRegion = NULL, *pxPreviousFreeBlock;
|
||||
uint8_t *pucAlignedHeap;
|
||||
size_t xTotalRegionSize, xTotalHeapSize = 0;
|
||||
BaseType_t xDefinedRegions = 0;
|
||||
uint32_t ulAddress;
|
||||
const HeapRegion_t *pxHeapRegion;
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A)
|
||||
/*
|
||||
xHeapRegions[0].pucStartAddress = (uint8_t*)&__ram_heap1_start__;
|
||||
xHeapRegions[0].xSizeInBytes = (u32)&__ram_heap1_end__ - (u32)xHeapRegions[0].pucStartAddress;
|
||||
xHeapRegions[1].pucStartAddress = &ucHeap; // (uint8_t*)&__ram_heap2_start__;
|
||||
xHeapRegions[1].xSizeInBytes = (u32)0x10070000 - (u32)xHeapRegions[1].pucStartAddress;
|
||||
xHeapRegions[2].pucStartAddress = (uint8_t*)&__sdram_data_start__;
|
||||
xHeapRegions[2].xSizeInBytes = (u32)0x30200000 - (u32)xHeapRegions[2].pucStartAddress;
|
||||
*/
|
||||
/*
|
||||
xHeapRegions[0].pucStartAddress = (uint8_t*)&__ram_heap1_start__;
|
||||
xHeapRegions[0].xSizeInBytes = (u32)&__ram_heap1_end__ - (u32)xHeapRegions[0].pucStartAddress;
|
||||
xHeapRegions[1].pucStartAddress = &ucHeap; // (uint8_t*)&__ram_heap2_start__;
|
||||
xHeapRegions[1].xSizeInBytes = (u32)0x10070000 - (u32)xHeapRegions[1].pucStartAddress;
|
||||
xHeapRegions[2].pucStartAddress = (uint8_t*)&__sdram_data_start__;
|
||||
xHeapRegions[2].xSizeInBytes = (u32)0x30200000 - (u32)xHeapRegions[2].pucStartAddress;
|
||||
*/
|
||||
#endif
|
||||
/* Can only call once! */
|
||||
configASSERT( pxEnd == NULL );
|
||||
|
||||
pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] );
|
||||
pxHeapRegion = &(pxHeapRegions[xDefinedRegions]);
|
||||
|
||||
uint8 chip_id = HalGetChipId();
|
||||
while( pxHeapRegion->xSizeInBytes > 0 )
|
||||
{
|
||||
if(pxHeapRegion->pucStartAddress > (uint8_t *)0x20000000
|
||||
&& chip_id >= CHIP_ID_8711AN && chip_id <= CHIP_ID_8711AF) {
|
||||
while (pxHeapRegion->xSizeInBytes > 0) {
|
||||
if (pxHeapRegion->pucStartAddress
|
||||
> 0x20000000 && chip_id >= CHIP_ID_8711AN && chip_id <= CHIP_ID_8711AF) {
|
||||
// pxHeapRegion->pucStartAddress = 0;
|
||||
// pxHeapRegion->xSizeInBytes = 0;
|
||||
// DBG_8195A("ChipID: %p !\n", chip_id);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
#if CONFIG_DEBUG_LOG > 2
|
||||
DBG_8195A("Init Heap Region: %p[%d]\n", pxHeapRegion->pucStartAddress, pxHeapRegion->xSizeInBytes);
|
||||
#endif
|
||||
|
@ -555,30 +516,27 @@ const HeapRegion_t *pxHeapRegion;
|
|||
#endif
|
||||
xTotalRegionSize = pxHeapRegion->xSizeInBytes;
|
||||
/* Ensure the heap region starts on a correctly aligned boundary. */
|
||||
ulAddress = ( uint32_t ) pxHeapRegion->pucStartAddress;
|
||||
if( ( ulAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
|
||||
{
|
||||
ulAddress += ( portBYTE_ALIGNMENT - 1 );
|
||||
ulAddress = (uint32_t) pxHeapRegion->pucStartAddress;
|
||||
if ((ulAddress & portBYTE_ALIGNMENT_MASK) != 0) {
|
||||
ulAddress += ( portBYTE_ALIGNMENT - 1);
|
||||
ulAddress &= ~portBYTE_ALIGNMENT_MASK;
|
||||
|
||||
/* 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. */
|
||||
if( xDefinedRegions == 0 )
|
||||
{
|
||||
if (xDefinedRegions == 0) {
|
||||
/* 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. */
|
||||
xStart.pxNextFreeBlock = ( BlockLink_t * ) pucAlignedHeap;
|
||||
xStart.xBlockSize = ( size_t ) 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
free blocks. The void cast is used to prevent compiler warnings. */
|
||||
xStart.pxNextFreeBlock = (BlockLink_t *) pucAlignedHeap;
|
||||
xStart.xBlockSize = (size_t) 0;
|
||||
} else {
|
||||
/* Should only get here if one region has already been added to the
|
||||
heap. */
|
||||
heap. */
|
||||
configASSERT( pxEnd != NULL );
|
||||
|
||||
/* Check blocks are passed in with increasing start addresses. */
|
||||
|
@ -586,29 +544,29 @@ const HeapRegion_t *pxHeapRegion;
|
|||
}
|
||||
|
||||
/* Remember the location of the end marker in the previous region, if
|
||||
any. */
|
||||
any. */
|
||||
pxPreviousFreeBlock = pxEnd;
|
||||
|
||||
/* pxEnd is used to mark the end of the list of free blocks and is
|
||||
inserted at the end of the region space. */
|
||||
ulAddress = ( ( uint32_t ) pucAlignedHeap ) + xTotalRegionSize;
|
||||
inserted at the end of the region space. */
|
||||
ulAddress = ((uint32_t) pucAlignedHeap) + xTotalRegionSize;
|
||||
ulAddress -= uxHeapStructSize;
|
||||
ulAddress &= ~portBYTE_ALIGNMENT_MASK;
|
||||
pxEnd = ( BlockLink_t * ) ulAddress;
|
||||
pxEnd = (BlockLink_t *) ulAddress;
|
||||
pxEnd->xBlockSize = 0;
|
||||
pxEnd->pxNextFreeBlock = NULL;
|
||||
|
||||
/* To start with there is a single free block in this region that is
|
||||
sized to take up the entire heap region minus the space taken by the
|
||||
free block structure. */
|
||||
pxFirstFreeBlockInRegion = ( BlockLink_t * ) pucAlignedHeap;
|
||||
pxFirstFreeBlockInRegion->xBlockSize = ulAddress - ( uint32_t ) pxFirstFreeBlockInRegion;
|
||||
sized to take up the entire heap region minus the space taken by the
|
||||
free block structure. */
|
||||
pxFirstFreeBlockInRegion = (BlockLink_t *) pucAlignedHeap;
|
||||
pxFirstFreeBlockInRegion->xBlockSize = ulAddress
|
||||
- (uint32_t) pxFirstFreeBlockInRegion;
|
||||
pxFirstFreeBlockInRegion->pxNextFreeBlock = pxEnd;
|
||||
|
||||
/* If this is not the first region that makes up the entire heap space
|
||||
then link the previous region to this region. */
|
||||
if( pxPreviousFreeBlock != NULL )
|
||||
{
|
||||
then link the previous region to this region. */
|
||||
if (pxPreviousFreeBlock != NULL) {
|
||||
pxPreviousFreeBlock->pxNextFreeBlock = pxFirstFreeBlockInRegion;
|
||||
}
|
||||
|
||||
|
@ -616,7 +574,7 @@ const HeapRegion_t *pxHeapRegion;
|
|||
}
|
||||
/* Move onto the next HeapRegion_t structure. */
|
||||
xDefinedRegions++;
|
||||
pxHeapRegion = &( pxHeapRegions[ xDefinedRegions ] );
|
||||
pxHeapRegion = &(pxHeapRegions[xDefinedRegions]);
|
||||
}
|
||||
|
||||
xMinimumEverFreeBytesRemaining = xTotalHeapSize;
|
||||
|
@ -627,72 +585,68 @@ const HeapRegion_t *pxHeapRegion;
|
|||
|
||||
}
|
||||
|
||||
void* pvPortReAlloc( void *pv, size_t xWantedSize )
|
||||
{
|
||||
void* pvPortReAlloc(void *pv, size_t xWantedSize) {
|
||||
BlockLink_t *pxLink;
|
||||
|
||||
if( ((uint32_t)pv >= ext_lower) && ((uint32_t)pv < ext_upper) ){
|
||||
if( ext_free ) ext_free( pv );
|
||||
if (((uint32_t) pv >= ext_lower) && ((uint32_t) pv < ext_upper)) {
|
||||
if (ext_free)
|
||||
ext_free(pv);
|
||||
pv = NULL;
|
||||
}
|
||||
|
||||
unsigned char *puc = ( unsigned char * ) pv;
|
||||
unsigned char *puc = (unsigned char *) pv;
|
||||
|
||||
if( pv )
|
||||
{
|
||||
if( !xWantedSize )
|
||||
{
|
||||
vPortFree( pv );
|
||||
if (pv) {
|
||||
if (!xWantedSize) {
|
||||
vPortFree(pv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *newArea = pvPortMalloc( xWantedSize );
|
||||
if( newArea )
|
||||
{
|
||||
void *newArea = pvPortMalloc(xWantedSize);
|
||||
if (newArea) {
|
||||
/* The memory being freed will have an xBlockLink structure immediately
|
||||
before it. */
|
||||
before it. */
|
||||
puc -= uxHeapStructSize;
|
||||
|
||||
/* This casting is to keep the compiler from issuing warnings. */
|
||||
pxLink = ( void * ) puc;
|
||||
pxLink = (void *) puc;
|
||||
|
||||
int oldSize = (pxLink->xBlockSize & ~xBlockAllocatedBit) - uxHeapStructSize;
|
||||
int copySize = ( oldSize < xWantedSize ) ? oldSize : xWantedSize;
|
||||
memcpy( newArea, pv, copySize );
|
||||
int oldSize = (pxLink->xBlockSize & ~xBlockAllocatedBit) - uxHeapStructSize;
|
||||
int copySize = (oldSize < xWantedSize) ? oldSize : xWantedSize;
|
||||
rtl_memcpy(newArea, pv, copySize);
|
||||
|
||||
vTaskSuspendAll();
|
||||
{
|
||||
/* Add this block to the list of free blocks. */
|
||||
pxLink->xBlockSize &= ~xBlockAllocatedBit;
|
||||
xFreeBytesRemaining += pxLink->xBlockSize;
|
||||
prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) );
|
||||
prvInsertBlockIntoFreeList(((BlockLink_t *) pxLink));
|
||||
}
|
||||
xTaskResumeAll();
|
||||
return newArea;
|
||||
}
|
||||
}
|
||||
else if( xWantedSize )
|
||||
return pvPortMalloc( xWantedSize );
|
||||
} else if (xWantedSize)
|
||||
return pvPortMalloc(xWantedSize);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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);
|
||||
if(prt) _memset(prt, 0, xWantedSize);
|
||||
if (prt)
|
||||
_memset(prt, 0, xWantedSize);
|
||||
return prt;
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef ARDUINO_SDK
|
||||
int vPortAddHeapRegion(uint8_t *addr, size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
#ifdef ARDUINO_SDK
|
||||
int vPortAddHeapRegion(uint8_t *addr, size_t size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
|
|
@ -79,7 +79,7 @@ typedef struct _RTL_TIMER{
|
|||
u32 msPeriod; // The period of this timer
|
||||
void *Context; // Timer specific context.
|
||||
u8 isPeriodical; // is a periodical timer
|
||||
u8 TimerName[35]; // the Name of timer
|
||||
u8 TimerName[15]; // the Name of timer
|
||||
}RTL_TIMER, *PRTL_TIMER;
|
||||
|
||||
__inline static VOID
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define _OSDEP_API_C_
|
||||
|
||||
#include <osdep_api.h>
|
||||
#include <task.h>
|
||||
|
||||
extern _LONG_CALL_ char *_strcpy(char *dest, const char *src);
|
||||
extern _LONG_CALL_ VOID *_memset(void *dst0, int Val,SIZE_T length);
|
||||
|
|
|
@ -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 ) );
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 );
|
||||
return FAIL;
|
||||
|
|
|
@ -89,6 +89,8 @@ prvDiagSPrintf(
|
|||
IN const char *fmt, ...
|
||||
);
|
||||
|
||||
extern char print_off;
|
||||
|
||||
#if CONFIG_DEBUG_LOG > 3
|
||||
#define debug_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
|
||||
#define info_printf(fmt, ...) rtl_printf(fmt, ##__VA_ARGS__)
|
||||
|
|
|
@ -51,6 +51,9 @@
|
|||
#define UART_STOP_1BIT 0x0
|
||||
#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_WRITE32(addr, value) HAL_WRITE32(LOG_UART_REG_BASE, addr, value)
|
||||
|
|
|
@ -336,7 +336,7 @@ PatchHalInitPlatformLogUart(
|
|||
UartIrqHandle.Priority = 0;
|
||||
|
||||
//4 Inital Log uart
|
||||
UartAdapter.BaudRate = UART_BAUD_RATE_38400;
|
||||
UartAdapter.BaudRate = DEFAULT_BAUDRATE;
|
||||
UartAdapter.DataLength = UART_DATA_LEN_8BIT;
|
||||
UartAdapter.FIFOControl = 0xC1;
|
||||
UartAdapter.IntEnReg = 0x00;
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
|
||||
//-------------------------------------------------------------------------
|
||||
// Data declarations
|
||||
|
||||
#define DEFAULT_BAUDRATE UART_BAUD_RATE_38400
|
||||
#ifndef DEFAULT_BAUDRATE
|
||||
#define DEFAULT_BAUDRATE 38400
|
||||
#endif
|
||||
|
||||
/* 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 */
|
||||
|
|
|
@ -616,6 +616,7 @@
|
|||
#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)
|
||||
|
||||
// BIT25 - To release DAC delta sigma clock gating
|
||||
|
||||
//2 REG_RSVD
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* 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 "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.
|
||||
|
@ -33,33 +34,30 @@ Pwm_SetTimerTick_8195a(
|
|||
u32 tick_time
|
||||
)
|
||||
{
|
||||
TIMER_ADAPTER TimerAdapter;
|
||||
|
||||
|
||||
if (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
|
||||
if (pPwmAdapt->tick_time != tick_time) {
|
||||
TimerAdapter.IrqDis = 1; // Disable Irq
|
||||
TimerAdapter.IrqHandle.IrqFun = (IRQ_FUN) NULL;
|
||||
TimerAdapter.IrqHandle.IrqNum = TIMER2_7_IRQ;
|
||||
TimerAdapter.IrqHandle.Priority = 10;
|
||||
TimerAdapter.IrqHandle.Data = (u32)NULL;
|
||||
TimerAdapter.TimerId = pPwmAdapt->gtimer_id;
|
||||
TimerAdapter.TimerIrqPriority = 0;
|
||||
TimerAdapter.TimerLoadValueUs = tick_time-1;
|
||||
TimerAdapter.TimerMode = 1; // auto-reload with user defined value
|
||||
|
||||
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);
|
||||
// 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.IrqHandle.IrqFun = (IRQ_FUN) NULL;
|
||||
TimerAdapter.IrqHandle.IrqNum = TIMER2_7_IRQ;
|
||||
TimerAdapter.IrqHandle.Priority = 10;
|
||||
TimerAdapter.IrqHandle.Data = (u32)NULL;
|
||||
TimerAdapter.TimerId = pPwmAdapt->gtimer_id;
|
||||
TimerAdapter.TimerIrqPriority = 0;
|
||||
TimerAdapter.TimerLoadValueUs = tick_time-1;
|
||||
TimerAdapter.TimerMode = 1; // auto-reload with user defined value
|
||||
HalTimerInitRtl8195a_Patch((VOID*) &TimerAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,7 +93,7 @@ HAL_Pwm_SetDuty_8195a(
|
|||
period = MIN_GTIMER_TIMEOUT*2;
|
||||
}
|
||||
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) {
|
||||
tick_time = MIN_GTIMER_TIMEOUT;
|
||||
}
|
||||
|
@ -103,36 +101,24 @@ HAL_Pwm_SetDuty_8195a(
|
|||
|
||||
Pwm_SetTimerTick_8195a(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;
|
||||
if (period_tick == 0) {
|
||||
period_tick = 1;
|
||||
}
|
||||
|
||||
if (pulse_width >= period) {
|
||||
// pulse_width = period-1;
|
||||
pulse_width = period;
|
||||
}
|
||||
pulsewidth_tick = pulse_width/tick_time;
|
||||
if (pulsewidth_tick == 0) {
|
||||
// pulsewidth_tick = 1;
|
||||
}
|
||||
|
||||
timer_id = pPwmAdapt->gtimer_id;
|
||||
|
||||
pPwmAdapt->period = period_tick & 0x3ff;
|
||||
pPwmAdapt->pulsewidth = pulsewidth_tick & 0x3ff;
|
||||
pPwmAdapt->period = period_tick & BIT_MASK_PERI_PWM0_PERIOD;
|
||||
pPwmAdapt->pulsewidth = pulsewidth_tick & BIT_MASK_PERI_PWM0_DUTY;
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -157,10 +143,10 @@ HAL_Pwm_Init_8195a(
|
|||
pwm_id = pPwmAdapt->pwm_id;
|
||||
pin_sel = pPwmAdapt->sel;
|
||||
// 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
|
||||
HAL_Pwm_SetDuty_8195a(pPwmAdapt, 20000, 10000);
|
||||
//p/ HAL_Pwm_SetDuty_8195a(pPwmAdapt, 20000, 10000);
|
||||
|
||||
// Configure the Pin Mux
|
||||
PinCtrl((PWM0+pwm_id), pin_sel, 1);
|
||||
|
@ -187,7 +173,7 @@ HAL_Pwm_Enable_8195a(
|
|||
// Configure the Pin Mux
|
||||
if (!pPwmAdapt->enable) {
|
||||
PinCtrl((PWM0+pwm_id), pPwmAdapt->sel, 1);
|
||||
HalTimerOp.HalTimerEn(pPwmAdapt->gtimer_id);
|
||||
HalTimerEnRtl8195a_Patch(pPwmAdapt->gtimer_id);
|
||||
pPwmAdapt->enable = 1;
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +197,7 @@ HAL_Pwm_Disable_8195a(
|
|||
// Configure the Pin Mux
|
||||
if (pPwmAdapt->enable) {
|
||||
PinCtrl((PWM0+pwm_id), pPwmAdapt->sel, 0);
|
||||
HalTimerOp.HalTimerDis(pPwmAdapt->gtimer_id);
|
||||
HalTimerDisRtl8195a(pPwmAdapt->gtimer_id);
|
||||
pPwmAdapt->enable = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,8 +142,6 @@ HalRuartResetTRxFifoRtl8195a(
|
|||
return HAL_OK;
|
||||
}
|
||||
|
||||
extern u64 div_u64(u64 dividend, u32 divisor);
|
||||
|
||||
HAL_Status
|
||||
HalRuartGenBaudRateRtl8195a(
|
||||
IN RUART_SPEED_SETTING *pBaudSetting
|
||||
|
@ -154,7 +152,7 @@ HalRuartGenBaudRateRtl8195a(
|
|||
u32 min_err=0xffffffff;
|
||||
u32 uart_ovsr;
|
||||
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;
|
||||
u64 uart_clock;
|
||||
u32 divisor_temp;
|
||||
|
|
|
@ -650,7 +650,7 @@ RtkADCPinMuxInit(
|
|||
ADCLocalTemp |= BIT25;
|
||||
|
||||
/* To release DAC delta sigma clock gating */
|
||||
HAL_WRITE32(SYSTEM_CTRL_BASE,REG_SYS_SYSPLL_CTRL2,ADCLocalTemp);
|
||||
HAL_WRITE32(SYSTEM_CTRL_BASE, REG_SYS_SYSPLL_CTRL2, ADCLocalTemp);
|
||||
|
||||
/* Turn on DAC active clock */
|
||||
ACTCK_ADC_CCTRL(ON);
|
||||
|
@ -1267,12 +1267,14 @@ RtkADCReceive(
|
|||
pHALADCGdmaAdpt->MuliBlockCunt = 0;
|
||||
|
||||
pHALADCGdmaOp->HalGdmaChSeting(pHALADCGdmaAdpt);
|
||||
pHALADCGdmaOp->HalGdmaChEn(pHALADCGdmaAdpt);
|
||||
|
||||
pSalADCHND->DevSts = ADC_STS_RX_ING;
|
||||
AdcTempDat = HAL_ADC_READ32(REG_ADC_POWER);
|
||||
AdcTempDat |= BIT_ADC_PWR_AUTO;
|
||||
HAL_ADC_WRITE32(REG_ADC_POWER, AdcTempDat);
|
||||
|
||||
pHALADCGdmaOp->HalGdmaChEn(pHALADCGdmaAdpt);
|
||||
|
||||
pSalADCHND->DevSts = ADC_STS_RX_ING;
|
||||
return _EXIT_SUCCESS;
|
||||
}
|
||||
return _EXIT_FAILURE;
|
||||
|
@ -1288,9 +1290,6 @@ RtkADCReceiveBuf(
|
|||
PSAL_ADC_HND pSalADCHND = (PSAL_ADC_HND) Data;
|
||||
PSAL_ADC_HND_PRIV pSalADCHNDPriv = NULL;
|
||||
PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL;
|
||||
|
||||
|
||||
|
||||
PHAL_ADC_OP pHalADCOP = NULL;
|
||||
|
||||
//PIRQ_HANDLE pIrqHandleADCGdma = NULL;
|
||||
|
@ -1299,13 +1298,8 @@ RtkADCReceiveBuf(
|
|||
/* To Get the SAL_I2C_MNGT_ADPT Pointer */
|
||||
pSalADCHNDPriv = CONTAINER_OF(pSalADCHND, SAL_ADC_HND_PRIV, SalADCHndPriv);
|
||||
pSalADCMngtAdpt = CONTAINER_OF(pSalADCHNDPriv->ppSalADCHnd, SAL_ADC_MNGT_ADPT, pSalHndPriv);
|
||||
|
||||
|
||||
|
||||
|
||||
pHalADCOP = pSalADCMngtAdpt->pHalOp;
|
||||
|
||||
|
||||
pHalADCOP = pSalADCMngtAdpt->pHalOp;
|
||||
|
||||
/* Clear ADC Status */
|
||||
//HAL_ADC_READ32(REG_ADC_INTR_STS);
|
||||
|
@ -1315,11 +1309,12 @@ RtkADCReceiveBuf(
|
|||
//DBG_8195A(">>INTR:%x\n",AdcTempDat);
|
||||
|
||||
ADCFullStsFlag = 0;
|
||||
HalDelayUs(2000);
|
||||
/// HalDelayUs(2000); ?
|
||||
HalDelayUs(20);
|
||||
|
||||
DBG_ADC_INFO("RtkADCReceiveBuf, Check to enable ADC manully or not\n");
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER);
|
||||
if (unlikely((AdcTempDat & 0x00000008) == 0)) {
|
||||
if (unlikely((AdcTempDat & BIT_ADC_ISO_MANUAL) == 0)) {
|
||||
;
|
||||
}
|
||||
else {
|
||||
|
@ -1329,23 +1324,22 @@ RtkADCReceiveBuf(
|
|||
//AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER);
|
||||
}
|
||||
|
||||
|
||||
pSalADCHND->pInitDat->ADCIntrMSK = (BIT_ADC_FIFO_FULL_EN);
|
||||
pHalADCOP->HalADCIntrCtrl(pSalADCHND->pInitDat);
|
||||
pSalADCHND->DevSts = ADC_STS_IDLE;
|
||||
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);
|
||||
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);
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
|
||||
DBG_ADC_INFO("RtkADCReceiveBuf, After set, Reg AD1:%x\n", AdcTempDat);
|
||||
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
|
||||
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);
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
|
||||
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);
|
||||
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);
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
|
||||
DBG_ADC_INFO("RtkADCReceiveBuf, End of ADC, After set, AD0:%x\n", AdcTempDat);
|
||||
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
|
||||
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);
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
|
||||
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");
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_POWER);
|
||||
if (unlikely((AdcTempDat & 0x00000008) == 0)) {
|
||||
if (unlikely((AdcTempDat & BIT_ADC_ISO_MANUAL) == 0)) {
|
||||
;
|
||||
}
|
||||
else {
|
||||
|
@ -1426,7 +1420,7 @@ RtkADCRxManualRotate(
|
|||
pSalADCHND->DevSts = ADC_STS_IDLE;
|
||||
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);
|
||||
DBG_ADC_INFO("RtkADCRxManualRotate, Before set, Reg AD1:%x\n", AdcTempDat);
|
||||
/* Clear for manual rotrate first*/
|
||||
|
@ -1435,7 +1429,7 @@ RtkADCRxManualRotate(
|
|||
AdcTempDat |= (BIT0);
|
||||
|
||||
/* Enable manual mode, this is to turn cali. off */
|
||||
AdcTempDat &= ~(BIT11);
|
||||
// AdcTempDat &= ~(BIT11);
|
||||
AdcTempDat |= (BIT11);
|
||||
|
||||
/* Set rotation to default state
|
||||
|
@ -1476,7 +1470,7 @@ RtkADCRxManualRotate(
|
|||
|
||||
/* Read Content */
|
||||
for (tempcnt=0; tempcnt<16; tempcnt++){
|
||||
ADCDatBuf[0] = (u32)HAL_ADC_READ32(REG_ADC_FIFO_READ);
|
||||
ADCDatBuf[0] = (u32)HAL_ADC_READ32(REG_ADC_FIFO_READ);
|
||||
}
|
||||
|
||||
/* Close ADC */
|
||||
|
@ -1507,7 +1501,7 @@ RtkADCRxManualRotate(
|
|||
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
|
||||
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);
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
|
||||
DBG_ADC_INFO("RtkADCRxManualRotate, After set, Reg AD0:%x\n", AdcTempDat);
|
||||
|
@ -1537,14 +1531,14 @@ RtkADCRxManualRotate(
|
|||
/* Close ADC */
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
|
||||
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);
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD0);
|
||||
DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, After set, AD0:%x\n", AdcTempDat);
|
||||
|
||||
AdcTempDat = (u32)HAL_ADC_READ32(REG_ADC_ANAPAR_AD1);
|
||||
DBG_ADC_INFO("RtkADCRxManualRotate, End of ADC, Before set, AD1:%x\n", AdcTempDat);
|
||||
AdcTempDat &= (~0x01);
|
||||
AdcTempDat &= (~BIT0);
|
||||
|
||||
/* Disable manual mode */
|
||||
AdcTempDat &= (~BIT11);
|
||||
|
|
|
@ -161,7 +161,7 @@ void HalLogUartIrqHandle(VOID * Data) {
|
|||
void HalLogUartSetBaudRate(HAL_LOG_UART_ADAPTER *pUartAdapter) {
|
||||
u32 clk4 = HalGetCpuClk() >> 2; // PLATFORM_CLOCK/2; // (unsigned int) HalGetCpuClk() >> 2; // div 4
|
||||
if (pUartAdapter->BaudRate == 0)
|
||||
pUartAdapter->BaudRate = UART_BAUD_RATE_38400;
|
||||
pUartAdapter->BaudRate = DEFAULT_BAUDRATE;
|
||||
u32 br16 = pUartAdapter->BaudRate << 4; // * 16
|
||||
if ((br16 != 0) && (br16 <= clk4)) {
|
||||
unsigned int dll = clk4 / br16;
|
||||
|
@ -200,7 +200,7 @@ u32 HalLogUartInitSetting(HAL_LOG_UART_ADAPTER *pUartAdapter) {
|
|||
// HalPinCtrlRtl8195A(LOG_UART, 0, 1); ????
|
||||
u32 clk4 = HalGetCpuClk() >> 2; // PLATFORM_CLOCK/2; // (unsigned int) HalGetCpuClk() >> 2; // div 4
|
||||
if (pUartAdapter->BaudRate == 0)
|
||||
pUartAdapter->BaudRate = UART_BAUD_RATE_38400;
|
||||
pUartAdapter->BaudRate = DEFAULT_BAUDRATE;
|
||||
u32 br16 = pUartAdapter->BaudRate << 4; // * 16
|
||||
HAL_UART_WRITE32(UART_INTERRUPT_EN_REG_OFF, 0); // 40003004 = 0;
|
||||
if (br16 <= clk4) {
|
||||
|
@ -418,7 +418,7 @@ void HalInitLogUart(void) {
|
|||
HAL_PERI_ON_WRITE32(REG_PESOC_CLK_CTRL,
|
||||
HAL_PERI_ON_READ32(REG_PESOC_CLK_CTRL) | BIT_SOC_ACTCK_LOG_UART_EN); // 40000230 |= 0x1000u;
|
||||
HalPinCtrlRtl8195A(LOG_UART, 0, 1);
|
||||
UartAdapter.BaudRate = UART_BAUD_RATE_38400;
|
||||
UartAdapter.BaudRate = DEFAULT_BAUDRATE;
|
||||
UartAdapter.DataLength = UART_DATA_LEN_8BIT;
|
||||
UartAdapter.FIFOControl = FCR_RX_TRIG_MASK | FCR_FIFO_EN; // 0xC1;
|
||||
UartAdapter.IntEnReg = IER_ERBFI | IER_ELSI; // 5
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ PatchHalLogUartInit(
|
|||
u32 Divisor;
|
||||
u32 Dlh;
|
||||
u32 Dll;
|
||||
u32 SysClock;
|
||||
|
||||
/*
|
||||
Interrupt enable Register
|
||||
|
@ -71,21 +70,11 @@ PatchHalLogUartInit(
|
|||
// set up buad rate division
|
||||
|
||||
#ifdef CONFIG_FPGA
|
||||
SysClock = SYSTEM_CLK;
|
||||
Divisor = (SysClock / (16 * (UartAdapter.BaudRate)));
|
||||
Divisor = (SYSTEM_CLK / (16 * (UartAdapter.BaudRate)));
|
||||
#else
|
||||
{
|
||||
u32 SampleRate, Remaind;
|
||||
|
||||
SysClock = HalGetCpuClk() >> 2;
|
||||
|
||||
SampleRate = (16 * (UartAdapter.BaudRate));
|
||||
|
||||
Divisor= SysClock/SampleRate;
|
||||
|
||||
Remaind = ((SysClock*10)/SampleRate) - (Divisor*10);
|
||||
|
||||
if (Remaind > 4) Divisor++;
|
||||
Divisor = HalGetCpuClk()/(32 * UartAdapter.BaudRate);
|
||||
Divisor = (Divisor & 1) + (Divisor >> 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -98,7 +87,7 @@ PatchHalLogUartInit(
|
|||
HAL_UART_WRITE32(UART_DLL_OFF, Dll);
|
||||
HAL_UART_WRITE32(UART_DLH_OFF, Dlh);
|
||||
// clear DLAB bit
|
||||
HAL_UART_WRITE32(UART_LINE_CTL_REG_OFF, 0);
|
||||
// HAL_UART_WRITE32(UART_LINE_CTL_REG_OFF, 0); // есть далее
|
||||
|
||||
// set data format
|
||||
SetData = UartAdapter.Parity | UartAdapter.Stop | UartAdapter.DataLength;
|
||||
|
@ -160,7 +149,7 @@ PSHalInitPlatformLogUart(
|
|||
UartIrqHandle.Priority = 0;
|
||||
|
||||
//4 Inital Log uart
|
||||
UartAdapter.BaudRate = UART_BAUD_RATE_38400;
|
||||
UartAdapter.BaudRate = DEFAULT_BAUDRATE;
|
||||
UartAdapter.DataLength = UART_DATA_LEN_8BIT;
|
||||
UartAdapter.FIFOControl = 0xC1;
|
||||
UartAdapter.IntEnReg = 0x00;
|
||||
|
|
|
@ -547,13 +547,13 @@ HalSsiInit(VOID *Data)
|
|||
DBG_SSI_ERR("Invalid SPI Index.\n");
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
||||
ret = FunctionChk(Function, (u32)PinmuxSelect);
|
||||
if(ret == _FALSE){
|
||||
DBG_SSI_ERR("Invalid Pinmux Setting.\n");
|
||||
return HAL_ERR_PARA;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SOC_PS_MODULE
|
||||
REG_POWER_STATE SsiPwrState;
|
||||
#endif
|
||||
|
|
|
@ -6,11 +6,9 @@
|
|||
*/
|
||||
//======================================================
|
||||
#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
|
||||
#ifndef CONSOLE_PRIORITY
|
||||
#define CONSOLE_PRIORITY 0
|
||||
#endif
|
||||
//======================================================
|
||||
#include "rtl8195a.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 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 UartLogRamCmdTableSize;
|
||||
|
@ -128,9 +126,9 @@ void UartLogIrqHandleRam(void * Data) {
|
|||
// для передачи ' ' или ','.
|
||||
// Начальные пробелы cmd или arg удаляются.
|
||||
//======================================================
|
||||
int GetArgvRam(IN u8 *pstr) {
|
||||
int GetArgvRam(IN u8 *pstr, u8** argv) {
|
||||
int arvc = 0;
|
||||
u8** argv = ArgvArray;
|
||||
// u8** argv = ArgvArray;
|
||||
u8* p = pstr;
|
||||
u8 t, n = ' ';
|
||||
int m = 0;
|
||||
|
@ -213,7 +211,7 @@ MON_RAM_TEXT_SECTION void RtlConsolTaskRam(void *Data) {
|
|||
RtlDownSema(&p->Sema);
|
||||
if (p->ExecuteCmd) {
|
||||
// UartLogCmdExecute(pUartLogCtl);
|
||||
int argc = GetArgvRam(p->pTmpLogBuf->UARTLogBuf);
|
||||
int argc = GetArgvRam(p->pTmpLogBuf->UARTLogBuf, ArgvArray);
|
||||
if(argc) {
|
||||
StrUpr(ArgvArray[0]);
|
||||
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");
|
||||
}
|
||||
LOCAL void print_on(int argc, char *argv[])
|
||||
{
|
||||
print_off = argv[1][0]!='1';
|
||||
}
|
||||
// (!) размещается в специальном сегменте '.mon.tab*' (см. *.ld файл)
|
||||
MON_RAM_TAB_SECTION COMMAND_TABLE console_commands[] = {
|
||||
{"PR", 1, print_on, "<1/0>: Printf on/off"}, // Help
|
||||
{"?", 0, console_help, ": This Help"} // Help
|
||||
// {"HELP", 0, console_help, ": Help"} // Help
|
||||
};
|
||||
|
|
|
@ -92,7 +92,7 @@ typedef struct _FALSE_ALARM_STATISTICS {
|
|||
u32 Cnt_CCA_all;
|
||||
u32 Cnt_BW_USC;
|
||||
u32 Cnt_BW_LSC;
|
||||
} FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS;
|
||||
} FALSE_ALARM_STATISTICS;
|
||||
extern FALSE_ALARM_STATISTICS FalseAlmCnt; // 100006E0
|
||||
|
||||
typedef struct _rom_info {
|
||||
|
@ -100,7 +100,7 @@ typedef struct _rom_info {
|
|||
u8 CrystalCap;
|
||||
u64 DebugComponents;
|
||||
u32 DebugLevel;
|
||||
} ROM_INFO, *PROM_INFO;
|
||||
} ROM_INFO;
|
||||
extern ROM_INFO ROMInfo; // 10000720
|
||||
|
||||
typedef struct _CFO_TRACKING_ {
|
||||
|
@ -118,7 +118,7 @@ typedef struct _CFO_TRACKING_ {
|
|||
u8 CFO_TH_XTAL_HIGH;
|
||||
u8 CFO_TH_XTAL_LOW;
|
||||
u8 CFO_TH_ATC;
|
||||
} CFO_TRACKING, *PCFO_TRACKING;;
|
||||
}CFO_TRACKING;
|
||||
extern CFO_TRACKING DM_CfoTrack; // 10000738
|
||||
|
||||
/* in rom_libgloss_retarget.h
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "libc/rom/string/rom_libc_string.h"
|
||||
#include "strproc.h"
|
||||
|
||||
#define memchr __rtl_memchr_v1_00
|
||||
#define memcmp __rtl_memcmp_v1_00
|
||||
|
@ -23,6 +22,10 @@
|
|||
#define strsep __rtl_strsep_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 ENDIAN_LITTLE 1234
|
||||
#define ENDIAN_BIG 4321
|
||||
|
@ -188,13 +191,6 @@ str_fmt(char *p, int size, int fmt)
|
|||
/*
|
||||
* strtoupper()
|
||||
*/
|
||||
#define strtoupper StrUpr
|
||||
/*
|
||||
|
||||
LOCAL char toupper(char ch) {
|
||||
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
|
||||
};
|
||||
|
||||
void
|
||||
strtoupper(char *p)
|
||||
{
|
||||
|
@ -203,7 +199,7 @@ strtoupper(char *p)
|
|||
for (; *p; p++)
|
||||
*p = toupper (*p);
|
||||
}
|
||||
*/
|
||||
|
||||
/* $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')
|
||||
base = 8;
|
||||
else //if (*s == 'b')
|
||||
else if (*s == 'b')
|
||||
base = 2;
|
||||
if (longlong)
|
||||
llbtoa(d, va_arg (ap, quad_t),
|
||||
|
@ -1078,12 +1074,9 @@ int c_printf(const char *fmt, ...)
|
|||
|
||||
int puts (const char *s)
|
||||
{
|
||||
int i = 0;
|
||||
while(*s) {
|
||||
HalSerialPutcRtl8195a(*s++);
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void vTaskDelete(void *);
|
||||
|
|
|
@ -62,7 +62,8 @@ char * rtl_strtok(char *s, const char *delim);
|
|||
|
||||
extern struct _reent * _rtl_impure_ptr;
|
||||
|
||||
int libc_has_init;
|
||||
char libc_has_init;
|
||||
char print_off;
|
||||
// extern rtl_impure_ptr
|
||||
// extern impure_ptr
|
||||
|
||||
|
@ -139,14 +140,17 @@ int rtl_printf(const char *fmt, ...) {
|
|||
if (!libc_has_init) {
|
||||
rtl_libc_init();
|
||||
}
|
||||
#endif
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
|
||||
_rtl_impure_ptr->_stdout, fmt, args);
|
||||
__rtl_fflush_r_v1_00(_rtl_impure_ptr, _rtl_impure_ptr->_stdout);
|
||||
// va_end (args);
|
||||
return result;
|
||||
#endif
|
||||
if(!print_off) {
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
|
||||
_rtl_impure_ptr->_stdout, fmt, args);
|
||||
__rtl_fflush_r_v1_00(_rtl_impure_ptr, _rtl_impure_ptr->_stdout);
|
||||
// va_end (args);
|
||||
return result;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
//----- rtl_vprintf()
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#include "rtl_bios_data.h"
|
||||
#include "va_list.h"
|
||||
#include "strproc.h"
|
||||
#include "rt_lib_rom.h"
|
||||
|
||||
#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;
|
||||
|
||||
#if CHECK_LIBC_INIT
|
||||
extern int libc_has_init;
|
||||
#endif
|
||||
// extern impure_ptr
|
||||
extern char libc_has_init;
|
||||
extern char print_off;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Function
|
||||
|
@ -142,13 +138,17 @@ int printf(const char *fmt, ...) {
|
|||
rtl_libc_init();
|
||||
}
|
||||
#endif
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
|
||||
_rtl_impure_ptr->_stdout, fmt, args);
|
||||
__rtl_fflush_r_v1_00(_rtl_impure_ptr, _rtl_impure_ptr->_stdout);
|
||||
// va_end (args);
|
||||
return result;
|
||||
if(!print_off) {
|
||||
|
||||
va_list args;
|
||||
va_start (args, fmt);
|
||||
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
|
||||
_rtl_impure_ptr->_stdout, fmt, args);
|
||||
__rtl_fflush_r_v1_00(_rtl_impure_ptr, _rtl_impure_ptr->_stdout);
|
||||
// va_end (args);
|
||||
return result;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
//----- vprintf()
|
||||
|
@ -169,6 +169,7 @@ int vprintf(const char * fmt, __VALIST param) {
|
|||
int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) {
|
||||
int result;
|
||||
int w;
|
||||
int v11;
|
||||
FILE f;
|
||||
#if CHECK_LIBC_INIT
|
||||
if (!libc_has_init) {
|
||||
|
@ -299,9 +300,9 @@ int sscanf(const char *buf, const char *fmt, ...) {
|
|||
return i;
|
||||
}
|
||||
|
||||
LOCAL char toupper(char ch) {
|
||||
char toupper(char ch) {
|
||||
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
|
||||
}
|
||||
};
|
||||
|
||||
int _stricmp (const char *s1, const char *s2)
|
||||
{
|
||||
|
@ -378,15 +379,12 @@ int __aeabi_dtoi(double d)
|
|||
return __rtl_dtoi_v1_00(d);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ int __rtl_dtoui_v1_00(double d);
|
||||
|
||||
//----- __aeabi_dtoui()
|
||||
int __aeabi_dtoui(double d)
|
||||
{
|
||||
return __rtl_dtoui_v1_00(d);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_itof_v1_00(int val);
|
||||
//----- __aeabi_i2f()
|
||||
float __aeabi_i2f(int val)
|
||||
{
|
||||
|
@ -411,7 +409,6 @@ int __aeabi_ui2d(unsigned int val)
|
|||
return __rtl_uitod_v1_00(val);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ char * __rtl_ltoa_v1_00(int value, char *string, int radix);
|
||||
//----- __aeabi_itoa()
|
||||
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);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ char * __rtl_ultoa_v1_00(unsigned int value, char *string, int radix);
|
||||
//----- __aeabi_utoa()
|
||||
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);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ long long __rtl_ftol_v1_00(float f);
|
||||
//----- __aeabi_ftol()
|
||||
long long __aeabi_ftol(float f)
|
||||
int __aeabi_ftol(float f)
|
||||
{
|
||||
return __rtl_ftol_v1_00(f);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ double __rtl_ftod_v1_00(float f);
|
||||
//----- __aeabi_ftod()
|
||||
double __aeabi_ftod(float f)
|
||||
int __aeabi_ftod(float f)
|
||||
{
|
||||
return __rtl_ftod_v1_00(f);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_dtof_v1_00(double d);
|
||||
//----- __aeabi_dtof()
|
||||
float __aeabi_dtof(double d)
|
||||
{
|
||||
return __rtl_dtof_v1_00(d);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fadd_v1_00(float a, float b);
|
||||
//----- __aeabi_fadd()
|
||||
float __aeabi_fadd(float a, float b)
|
||||
{
|
||||
return __rtl_fadd_v1_00(a, b);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fsub_v1_00(float a, float b);
|
||||
//----- __aeabi_fsub()
|
||||
float __aeabi_fsub(float a, float b)
|
||||
{
|
||||
return __rtl_fsub_v1_00(a, b);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fmul_v1_00(float a, float b);
|
||||
//----- __aeabi_fmul()
|
||||
float __aeabi_fmul(float a, float b)
|
||||
{
|
||||
return __rtl_fmul_v1_00(a, b);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fdiv_v1_00(float a, float b);
|
||||
//----- __aeabi_fdiv()
|
||||
float __aeabi_fdiv(float a, float b)
|
||||
{
|
||||
|
@ -487,25 +476,25 @@ float __aeabi_fdiv(float a, float b)
|
|||
}
|
||||
|
||||
//----- __aeabi_dadd()
|
||||
double __aeabi_dadd(double a, double b)
|
||||
int __aeabi_dadd(double a, double b)
|
||||
{
|
||||
return __rtl_dadd_v1_00(a, b);
|
||||
}
|
||||
|
||||
//----- __aeabi_dsub()
|
||||
double __aeabi_dsub(double a, double b)
|
||||
int __aeabi_dsub(double a, double b)
|
||||
{
|
||||
return __rtl_dsub_v1_00(a, b);
|
||||
}
|
||||
|
||||
//----- __aeabi_dmul()
|
||||
double __aeabi_dmul(double a, double b)
|
||||
int __aeabi_dmul(double a, double b)
|
||||
{
|
||||
return __rtl_dmul_v1_00(a, b);
|
||||
}
|
||||
|
||||
//----- __aeabi_ddiv()
|
||||
double __aeabi_ddiv(double a, double b)
|
||||
int __aeabi_ddiv(double a, double 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);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ int __rtl_dcmple_v1_00(double a, double b);
|
||||
//----- __aeabi_dcmple()
|
||||
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);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ int __rtl_fcmplt_v1_00(float a, float b);
|
||||
//----- __aeabi_fcmplt()
|
||||
int __aeabi_fcmplt(float a, float b)
|
||||
{
|
||||
return __rtl_fcmplt_v1_00(a, b);
|
||||
}
|
||||
extern _LONG_CALL_ int __rtl_fcmpgt_v1_00(float a, float b);
|
||||
|
||||
//----- __aeabi_fcmpgt()
|
||||
int __aeabi_fcmpgt(float a, float b)
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
#include "basic_types.h"
|
||||
#include "rt_lib_rom.h"
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
|
@ -72,15 +71,12 @@ int rtl_dtoi(double d)
|
|||
return __rtl_dtoi_v1_00(d);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ int __rtl_dtoui_v1_00(double d);
|
||||
|
||||
//----- rtl_dtoui()
|
||||
int rtl_dtoui(double d)
|
||||
{
|
||||
return __rtl_dtoui_v1_00(d);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_itof_v1_00(int val);
|
||||
//----- rtl_i2f()
|
||||
float rtl_i2f(int val)
|
||||
{
|
||||
|
@ -105,7 +101,6 @@ int rtl_ui2d(unsigned int val)
|
|||
return __rtl_uitod_v1_00(val);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ char * __rtl_ltoa_v1_00(int value, char *string, int radix);
|
||||
//----- rtl_itoa()
|
||||
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);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ char * __rtl_ultoa_v1_00(unsigned int value, char *string, int radix);
|
||||
//----- rtl_utoa()
|
||||
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);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ double __rtl_ftod_v1_00(float f);
|
||||
//----- rtl_ftol()
|
||||
int rtl_ftol(float f)
|
||||
{
|
||||
|
@ -144,7 +137,6 @@ int rtl_ftod(float f)
|
|||
return __rtl_ftod_v1_00(f);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fsub_v1_00(float a, float b);
|
||||
//----- rtl_dtof()
|
||||
float rtl_dtof(double d)
|
||||
{
|
||||
|
@ -163,14 +155,12 @@ float rtl_fsub(float a, float b)
|
|||
return __rtl_fsub_v1_00(a, b);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fmul_v1_00(float a, float b);
|
||||
//----- rtl_fmul()
|
||||
float rtl_fmul(float a, float b)
|
||||
{
|
||||
return __rtl_fmul_v1_00(a, b);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fdiv_v1_00(float a, float b);
|
||||
//----- rtl_fdiv()
|
||||
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);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ int __rtl_dcmple_v1_00(double a, double b);
|
||||
//----- rtl_dcmple()
|
||||
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);
|
||||
}
|
||||
extern _LONG_CALL_ int __rtl_fcmplt_v1_00(float a, float b);
|
||||
|
||||
//----- rtl_fcmplt()
|
||||
int rtl_fcmplt(float a, float b)
|
||||
{
|
||||
return __rtl_fcmplt_v1_00(a, b);
|
||||
}
|
||||
extern _LONG_CALL_ int __rtl_fcmpgt_v1_00(float a, float b);
|
||||
|
||||
//----- rtl_fcmpgt()
|
||||
int rtl_fcmpgt(float a, float b)
|
||||
{
|
||||
|
|
|
@ -20,28 +20,25 @@ float rtl_sin_f32(float a);
|
|||
// int __rtl_cos_f32_v1_00();
|
||||
// int __rtl_sin_f32_v1_00();
|
||||
|
||||
extern _LONG_CALL_ float __rtl_fabsf_v1_00(float a);
|
||||
|
||||
//----- rtl_fabsf()
|
||||
float rtl_fabsf(float a)
|
||||
{
|
||||
return __rtl_fabsf_v1_00(a);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ double __rtl_fabs_v1_00(double number);
|
||||
//----- rtl_fabs()
|
||||
int rtl_fabs(double a)
|
||||
{
|
||||
return __rtl_fabs_v1_00(a);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_cos_f32_v1_00(float a);
|
||||
//----- rtl_cos_f32()
|
||||
float rtl_cos_f32(float a)
|
||||
{
|
||||
return __rtl_cos_f32_v1_00(a);
|
||||
}
|
||||
|
||||
extern _LONG_CALL_ float __rtl_sin_f32_v1_00(float a);
|
||||
//----- rtl_sin_f32()
|
||||
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.
4693
build/obj/build.nmap
4693
build/obj/build.nmap
File diff suppressed because it is too large
Load diff
|
@ -9,6 +9,7 @@
|
|||
#include "FreeRTOS.h"
|
||||
#include "diag.h"
|
||||
#include "wifi_api.h"
|
||||
#include "wifi_conf.h"
|
||||
#include "rtl8195a/rtl_libc.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"},
|
||||
{"ATPA", 1, fATPA, "=<SSID>[,password[,encryption[,channel[,hidden[,max connections]]]]]: Start WIFI AP"},
|
||||
{"ATWR", 0, fATWR, ": WIFI Connect, Disconnect"},
|
||||
// {"ATON", 0, fATON, ": Open connections"},
|
||||
// {"ATOF", 0, fATOF, ": Close connections"},
|
||||
{"ATON", 0, fATON, ": Open connections"},
|
||||
{"ATOF", 0, fATOF, ": Close connections"},
|
||||
{"ATWI", 0, fATWI, ": WiFi Info"},
|
||||
#if CONFIG_DEBUG_LOG > 3
|
||||
{"ATWT", 1, fATWT, "=<tx_power>: WiFi tx power: 0 - 100%, 1 - 75%, 2 - 50%, 3 - 25%, 4 - 12.5%"},
|
||||
|
|
Loading…
Reference in a new issue