mirror of
https://github.com/pvvx/RTL00_WEB.git
synced 2024-11-25 07:24:18 +00:00
update -Wall
This commit is contained in:
parent
af72faa906
commit
c98cbe6e00
86 changed files with 523 additions and 352 deletions
|
@ -9,22 +9,30 @@
|
||||||
#define DATA_IRAM_ATTR
|
#define DATA_IRAM_ATTR
|
||||||
#define ICACHE_RAM_ATTR
|
#define ICACHE_RAM_ATTR
|
||||||
|
|
||||||
#define os_printf(...) rtl_printf(__VA_ARGS__)
|
|
||||||
#define os_printf_plus(...) rtl_printf(__VA_ARGS__)
|
|
||||||
#define os_sprintf_fd(...) rtl_sprintf(__VA_ARGS__)
|
|
||||||
#define ets_sprintf(...) rtl_sprintf(__VA_ARGS__)
|
|
||||||
#ifndef os_malloc
|
|
||||||
#define os_malloc pvPortMalloc
|
|
||||||
#define os_zalloc pvPortZalloc
|
|
||||||
#define os_calloc pvPortCalloc
|
|
||||||
#define os_realloc pvPortRealloc
|
|
||||||
#endif
|
|
||||||
#undef os_free
|
|
||||||
#define os_free vPortFree
|
|
||||||
#define system_get_free_heap_size xPortGetFreeHeapSize
|
|
||||||
#undef os_realloc
|
|
||||||
#define os_realloc pvPortReAlloc
|
|
||||||
|
|
||||||
|
#define os_printf rtl_printf
|
||||||
|
#define os_printf_plus rtl_printf
|
||||||
|
#define os_sprintf_fd rtl_sprintf
|
||||||
|
#define ets_sprintf rtl_sprintf
|
||||||
|
|
||||||
|
//#ifndef os_malloc
|
||||||
|
#undef os_malloc
|
||||||
|
extern void *pvPortMalloc(size_t xWantedSize);
|
||||||
|
#define os_malloc pvPortMalloc
|
||||||
|
#undef os_zalloc
|
||||||
|
extern void *pvPortZalloc(size_t xWantedSize);
|
||||||
|
#define os_zalloc pvPortZalloc
|
||||||
|
//#undef os_calloc
|
||||||
|
//#define os_calloc pvPortCalloc
|
||||||
|
#undef os_realloc
|
||||||
|
extern void *pvPortReAlloc(void *pv, size_t xWantedSize);
|
||||||
|
#define os_realloc pvPortReAlloc
|
||||||
|
#undef os_free
|
||||||
|
extern void vPortFree(void *pv);
|
||||||
|
#define os_free vPortFree
|
||||||
|
//#endif
|
||||||
|
extern size_t xPortGetFreeHeapSize(void);
|
||||||
|
#define system_get_free_heap_size xPortGetFreeHeapSize
|
||||||
|
|
||||||
#define os_bzero rtl_bzero
|
#define os_bzero rtl_bzero
|
||||||
#define os_delay_us wait_us // HalDelayUs
|
#define os_delay_us wait_us // HalDelayUs
|
||||||
|
@ -104,22 +112,28 @@ extern SpiFlashChip * flashchip; // in RAM-BIOS: 0x3fffc714
|
||||||
#define spi_flash_read(faddr, pbuf, size) flash_stream_read(&flashobj, faddr, size, (uint8_t *)pbuf)
|
#define spi_flash_read(faddr, pbuf, size) flash_stream_read(&flashobj, faddr, size, (uint8_t *)pbuf)
|
||||||
#define spi_flash_erase_block(blk) flash_erase_block(&flashobj, (blk)<<16);
|
#define spi_flash_erase_block(blk) flash_erase_block(&flashobj, (blk)<<16);
|
||||||
|
|
||||||
|
#ifndef ip4_addr1
|
||||||
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
||||||
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
||||||
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
||||||
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
|
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
|
||||||
|
#endif
|
||||||
/* These are cast to u16_t, with the intent that they are often arguments
|
/* These are cast to u16_t, with the intent that they are often arguments
|
||||||
* to printf using the U16_F format from cc.h. */
|
* to printf using the U16_F format from cc.h. */
|
||||||
|
#ifndef ip4_addr1_16
|
||||||
#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
|
#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
|
||||||
#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
|
#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
|
||||||
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
||||||
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef IP2STR
|
||||||
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
||||||
ip4_addr2_16(ipaddr), \
|
ip4_addr2_16(ipaddr), \
|
||||||
ip4_addr3_16(ipaddr), \
|
ip4_addr3_16(ipaddr), \
|
||||||
ip4_addr4_16(ipaddr)
|
ip4_addr4_16(ipaddr)
|
||||||
|
|
||||||
|
#undef IPSTR
|
||||||
#define IPSTR "%d.%d.%d.%d"
|
#define IPSTR "%d.%d.%d.%d"
|
||||||
|
|
||||||
#ifndef MAC2STR
|
#ifndef MAC2STR
|
||||||
|
|
|
@ -157,6 +157,9 @@ extern unsigned char dhcp_mode_sta;
|
||||||
#include "freertos/wrapper.h"
|
#include "freertos/wrapper.h"
|
||||||
#include "skbuff.h"
|
#include "skbuff.h"
|
||||||
|
|
||||||
|
extern unsigned char is_promisc_enabled(void);
|
||||||
|
extern int promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char*, unsigned int, void*), unsigned char len_used);
|
||||||
|
|
||||||
//------------------------------------------------------------------------end-patch//
|
//------------------------------------------------------------------------end-patch//
|
||||||
static int wifi_connect_local(rtw_network_info_t *pWifi) {
|
static int wifi_connect_local(rtw_network_info_t *pWifi) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -278,8 +281,8 @@ static void wifi_disconn_hdl(char* buf, int buf_len, int flags, void* userdata)
|
||||||
else if (rtw_join_status == 0)
|
else if (rtw_join_status == 0)
|
||||||
error_flag = RTW_CONNECT_FAIL;
|
error_flag = RTW_CONNECT_FAIL;
|
||||||
|
|
||||||
else if (rtw_join_status == JOIN_COMPLETE | JOIN_SECURITY_COMPLETE
|
else if (rtw_join_status == (JOIN_COMPLETE | JOIN_SECURITY_COMPLETE
|
||||||
| JOIN_ASSOCIATED | JOIN_AUTHENTICATED | JOIN_LINK_READY)
|
| JOIN_ASSOCIATED | JOIN_AUTHENTICATED | JOIN_LINK_READY))
|
||||||
error_flag = RTW_WRONG_PASSWORD;
|
error_flag = RTW_WRONG_PASSWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,6 +371,7 @@ void restore_wifi_info_to_flash() {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int wext_set_bssid(const char *ifname, const __u8 *bssid);
|
||||||
//----------------------------------------------------------------------------//
|
//----------------------------------------------------------------------------//
|
||||||
int wifi_connect(
|
int wifi_connect(
|
||||||
unsigned char bssid[ETH_ALEN],
|
unsigned char bssid[ETH_ALEN],
|
||||||
|
@ -380,7 +384,7 @@ int wifi_connect(
|
||||||
|
|
||||||
int ssid_len = 0;
|
int ssid_len = 0;
|
||||||
int password_len = 0;
|
int password_len = 0;
|
||||||
int bssid_len = 6;
|
// int bssid_len = 6;
|
||||||
xSemaphoreHandle join_semaphore;
|
xSemaphoreHandle join_semaphore;
|
||||||
rtw_result_t result = RTW_SUCCESS;
|
rtw_result_t result = RTW_SUCCESS;
|
||||||
u8 wep_hex = 0;
|
u8 wep_hex = 0;
|
||||||
|
@ -440,7 +444,7 @@ int wifi_connect(
|
||||||
|
|
||||||
if (password_len == 10) {
|
if (password_len == 10) {
|
||||||
|
|
||||||
u32 g[5] = { 0 };
|
unsigned int g[5] = { 0 };
|
||||||
u8 i = 0;
|
u8 i = 0;
|
||||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &g[0],
|
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &g[0],
|
||||||
&g[1], &g[2], &g[3], &g[4]);
|
&g[1], &g[2], &g[3], &g[4]);
|
||||||
|
@ -450,7 +454,7 @@ int wifi_connect(
|
||||||
password_len = 5;
|
password_len = 5;
|
||||||
wep_hex = 1;
|
wep_hex = 1;
|
||||||
} else if (password_len == 26) {
|
} else if (password_len == 26) {
|
||||||
u32 g[13] = { 0 };
|
unsigned int g[13] = { 0 };
|
||||||
u8 i = 0;
|
u8 i = 0;
|
||||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x%02x%02x"
|
sscanf((const char*) password, "%02x%02x%02x%02x%02x%02x%02x"
|
||||||
"%02x%02x%02x%02x%02x%02x", &g[0], &g[1], &g[2], &g[3],
|
"%02x%02x%02x%02x%02x%02x", &g[0], &g[1], &g[2], &g[3],
|
||||||
|
@ -731,8 +735,10 @@ int wifi_get_ap_info(rtw_bss_info_t * ap_info, rtw_security_t* security) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int wext_get_drv_ability(const char *ifname, __u32 *ability);
|
||||||
|
|
||||||
int wifi_get_drv_ability(uint32_t *ability) {
|
int wifi_get_drv_ability(uint32_t *ability) {
|
||||||
return wext_get_drv_ability(WLAN0_NAME, ability);
|
return wext_get_drv_ability(WLAN0_NAME, (__u32 *)ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------//
|
//----------------------------------------------------------------------------//
|
||||||
|
@ -861,6 +867,9 @@ int wifi_on(rtw_mode_t mode) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void dhcps_deinit(void); //#include "dhcps.h"
|
||||||
|
|
||||||
|
|
||||||
int wifi_off(void) {
|
int wifi_off(void) {
|
||||||
// int ret = 0;
|
// int ret = 0;
|
||||||
|
|
||||||
|
@ -948,6 +957,8 @@ int wifi_get_last_error(void) {
|
||||||
int wpas_wps_init(const char* ifname);
|
int wpas_wps_init(const char* ifname);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int set_hidden_ssid(const char *ifname, uint8_t value);
|
||||||
|
|
||||||
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password, int channel, char ssid_hidden) {
|
int wifi_start_ap(char *ssid, rtw_security_t security_type, char *password, int channel, char ssid_hidden) {
|
||||||
const char *ifname = WLAN0_NAME;
|
const char *ifname = WLAN0_NAME;
|
||||||
int ssid_len = 0;
|
int ssid_len = 0;
|
||||||
|
@ -1489,6 +1500,8 @@ void wifi_enter_promisc_mode() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void dhcps_init(struct netif * pnetif);
|
||||||
|
|
||||||
int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
||||||
unsigned char *password, int channel) {
|
unsigned char *password, int channel) {
|
||||||
unsigned char idx = 0;
|
unsigned char idx = 0;
|
||||||
|
@ -1543,10 +1556,8 @@ int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
||||||
printf("AP: security_type=%d\n", setting.security_type);
|
printf("AP: security_type=%d\n", setting.security_type);
|
||||||
printf("AP: password=%s\n", (char* )setting.password);
|
printf("AP: password=%s\n", (char* )setting.password);
|
||||||
printf("AP: key_idx =%d\n", setting.key_idx);
|
printf("AP: key_idx =%d\n", setting.key_idx);
|
||||||
ret = wifi_connect((char*) setting.ssid, setting.security_type,
|
ret = wifi_connect(NULL, 0 , (char*) setting.ssid, setting.security_type,
|
||||||
(char*) setting.password, strlen((char* )setting.ssid),
|
(char*) setting.password, setting.key_idx, NULL);
|
||||||
strlen((char* )setting.password), setting.key_idx,
|
|
||||||
NULL);
|
|
||||||
if (ret == RTW_SUCCESS) {
|
if (ret == RTW_SUCCESS) {
|
||||||
#if CONFIG_DHCP_CLIENT
|
#if CONFIG_DHCP_CLIENT
|
||||||
/* Start DHCPClient */
|
/* Start DHCPClient */
|
||||||
|
@ -1723,25 +1734,32 @@ int wifi_disable_packet_filter(unsigned char filter_id) {
|
||||||
int wifi_remove_packet_filter(unsigned char filter_id) {
|
int wifi_remove_packet_filter(unsigned char filter_id) {
|
||||||
return promisc_remove_packet_filter(filter_id);
|
return promisc_remove_packet_filter(filter_id);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // CONFIG_PROMISC
|
||||||
|
|
||||||
#ifdef CONFIG_AP_MODE
|
#ifdef CONFIG_AP_MODE
|
||||||
|
|
||||||
|
extern int wext_enable_forwarding(const char *ifname);
|
||||||
int wifi_enable_forwarding(void) {
|
int wifi_enable_forwarding(void) {
|
||||||
return wext_enable_forwarding(WLAN0_NAME);
|
return wext_enable_forwarding(WLAN0_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int wext_disable_forwarding(const char *ifname);
|
||||||
int wifi_disable_forwarding(void) {
|
int wifi_disable_forwarding(void) {
|
||||||
return wext_disable_forwarding(WLAN0_NAME);
|
return wext_disable_forwarding(WLAN0_NAME);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // CONFIG_AP_MODE
|
||||||
|
|
||||||
/* API to set flag for concurrent mode wlan1 issue_deauth when channel switched by wlan0
|
/* API to set flag for concurrent mode wlan1 issue_deauth when channel switched by wlan0
|
||||||
* usage: wifi_set_ch_deauth(0) -> wlan0 wifi_connect -> wifi_set_ch_deauth(1)
|
* usage: wifi_set_ch_deauth(0) -> wlan0 wifi_connect -> wifi_set_ch_deauth(1)
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_CONCURRENT_MODE
|
#ifdef CONFIG_CONCURRENT_MODE
|
||||||
|
|
||||||
|
extern int wext_set_ch_deauth(const char *ifname, __u8 enable);
|
||||||
int wifi_set_ch_deauth(__u8 enable) {
|
int wifi_set_ch_deauth(__u8 enable) {
|
||||||
return wext_set_ch_deauth(WLAN1_NAME, enable);
|
return wext_set_ch_deauth(WLAN1_NAME, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------//
|
//----------------------------------------------------------------------------//
|
||||||
|
|
|
@ -102,103 +102,103 @@ void wifi_indication(WIFI_EVENT_INDICATE event, unsigned char *buf, int buf_len,
|
||||||
// , and tries not to share the same stack with wlan driver if remaining stack space is
|
// , and tries not to share the same stack with wlan driver if remaining stack space is
|
||||||
// not available for the following operations.
|
// not available for the following operations.
|
||||||
// ex: using semaphore to notice another thread.
|
// ex: using semaphore to notice another thread.
|
||||||
switch (event) {
|
switch ((u32)event) {
|
||||||
case WIFI_EVENT_DISCONNECT:
|
case WIFI_EVENT_DISCONNECT:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
info_printf("%s(%d): Disconnection indication received\n", __func__, event);
|
info_printf("%s(%d): Disconnection indication received\n", __func__, event);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_CONNECT:
|
case WIFI_EVENT_CONNECT:
|
||||||
// For WPA/WPA2 mode, indication of connection does not mean data can be
|
// For WPA/WPA2 mode, indication of connection does not mean data can be
|
||||||
// correctly transmitted or received. Data can be correctly transmitted or
|
// correctly transmitted or received. Data can be correctly transmitted or
|
||||||
// received only when 4-way handshake is done.
|
// received only when 4-way handshake is done.
|
||||||
// Please check WIFI_EVENT_FOURWAY_HANDSHAKE_DONE event
|
// Please check WIFI_EVENT_FOURWAY_HANDSHAKE_DONE event
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
// Sample: return mac address
|
// Sample: return mac address
|
||||||
if (buf != NULL && buf_len == 6) {
|
if (buf != NULL && buf_len == 6) {
|
||||||
info_printf(
|
info_printf(
|
||||||
"%s(%d): Connect indication received: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
"%s(%d): Connect indication received: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
__func__, event, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
|
__func__, event, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case WIFI_EVENT_FOURWAY_HANDSHAKE_DONE:
|
#endif
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
case WIFI_EVENT_FOURWAY_HANDSHAKE_DONE:
|
||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_SCAN_RESULT_REPORT:
|
case WIFI_EVENT_SCAN_RESULT_REPORT:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): WIFI_EVENT_SCAN_RESULT_REPORT\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_SCAN_RESULT_REPORT\n", __func__, event);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case WIFI_EVENT_SCAN_DONE:
|
#endif
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
case WIFI_EVENT_SCAN_DONE:
|
||||||
info_printf("%s(%d): WIFI_EVENT_SCAN_DONE\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_SCAN_DONE\n", __func__, event);
|
||||||
//#if CONFIG_DEBUG_LOG > 3
|
//#if CONFIG_DEBUG_LOG > 3
|
||||||
// debug_printf("Time at start %d ms.\n", xTaskGetTickCount());
|
// debug_printf("Time at start %d ms.\n", xTaskGetTickCount());
|
||||||
//#endif
|
//#endif
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_RECONNECTION_FAIL:
|
case WIFI_EVENT_RECONNECTION_FAIL:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_NO_NETWORK:
|
case WIFI_EVENT_NO_NETWORK:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#if CONFIG_ENABLE_P2P
|
#if CONFIG_ENABLE_P2P
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_SEND_ACTION_DONE:
|
case WIFI_EVENT_SEND_ACTION_DONE:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): %s\n", __func__, event, buf);
|
info_printf("%s(%d): %s\n", __func__, event, buf);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_RX_MGNT:
|
case WIFI_EVENT_RX_MGNT:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): WIFI_EVENT_RX_MGNT\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_RX_MGNT\n", __func__, event);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#endif //CONFIG_ENABLE_P2P
|
#endif //CONFIG_ENABLE_P2P
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_STA_ASSOC:
|
case WIFI_EVENT_STA_ASSOC:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): WIFI_EVENT_STA_ASSOC\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_STA_ASSOC\n", __func__, event);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_STA_DISASSOC:
|
case WIFI_EVENT_STA_DISASSOC:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): WIFI_EVENT_STA_DISASSOC\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_STA_DISASSOC\n", __func__, event);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_WPS
|
#ifdef CONFIG_WPS
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_STA_WPS_START:
|
case WIFI_EVENT_STA_WPS_START:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): WIFI_EVENT_STA_WPS_START\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_STA_WPS_START\n", __func__, event);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
case WIFI_EVENT_WPS_FINISH:
|
case WIFI_EVENT_WPS_FINISH:
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
|
||||||
info_printf("%s(%d): WIFI_EVENT_WPS_FINISH\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_WPS_FINISH\n", __func__, event);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case WIFI_EVENT_EAPOL_RECVD:
|
#endif
|
||||||
#if(WIFI_INDICATE_MSG>0)
|
#if(WIFI_INDICATE_MSG>0)
|
||||||
|
case WIFI_EVENT_EAPOL_RECVD:
|
||||||
info_printf("%s(%d): WIFI_EVENT_EAPOL_RECVD\n", __func__, event);
|
info_printf("%s(%d): WIFI_EVENT_EAPOL_RECVD\n", __func__, event);
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case WIFI_EVENT_BEACON_AFTER_DHCP:
|
|
||||||
#if(WIFI_INDICATE_MSG>1)
|
|
||||||
info_printf("%s(%d): WIFI_EVENT_BEACON_AFTER_DHCP\n", __func__, event);
|
|
||||||
#endif
|
#endif
|
||||||
|
#if(WIFI_INDICATE_MSG>1)
|
||||||
|
case WIFI_EVENT_BEACON_AFTER_DHCP:
|
||||||
|
info_printf("%s(%d): WIFI_EVENT_BEACON_AFTER_DHCP\n", __func__, event);
|
||||||
#if 0 // test beacon
|
#if 0 // test beacon
|
||||||
gpio_write(&gpio_led, 1);
|
gpio_write(&gpio_led, 1);
|
||||||
gpio_write(&gpio_led, 0);
|
gpio_write(&gpio_led, 0);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_INIC_EN
|
#if CONFIG_INIC_EN
|
||||||
|
|
|
@ -55,6 +55,7 @@ int promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char*, unsign
|
||||||
unsigned char is_promisc_enabled(void)
|
unsigned char is_promisc_enabled(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PROMISC
|
#ifdef CONFIG_PROMISC
|
||||||
|
extern unsigned char _is_promisc_enabled(void);
|
||||||
return _is_promisc_enabled();
|
return _is_promisc_enabled();
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -64,6 +65,7 @@ unsigned char is_promisc_enabled(void)
|
||||||
int promisc_get_fixed_channel(void *fixed_bssid, u8 *ssid, int *ssid_length)
|
int promisc_get_fixed_channel(void *fixed_bssid, u8 *ssid, int *ssid_length)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PROMISC
|
#ifdef CONFIG_PROMISC
|
||||||
|
extern int _promisc_get_fixed_channel(void *fixed_bssid, u8 *ssid, int *ssid_length);
|
||||||
return _promisc_get_fixed_channel(fixed_bssid, ssid, ssid_length);
|
return _promisc_get_fixed_channel(fixed_bssid, ssid, ssid_length);
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -111,7 +113,7 @@ static struct eth_buffer eth_buffer;
|
||||||
#ifdef CONFIG_PROMISC
|
#ifdef CONFIG_PROMISC
|
||||||
#define MAX_PACKET_FILTER_INFO 5
|
#define MAX_PACKET_FILTER_INFO 5
|
||||||
#define FILTER_ID_INIT_VALUE 10
|
#define FILTER_ID_INIT_VALUE 10
|
||||||
rtw_packet_filter_info_t paff_array[MAX_PACKET_FILTER_INFO]={0, 0, 0, 0, 0};
|
rtw_packet_filter_info_t paff_array[MAX_PACKET_FILTER_INFO]; //={0, 0, 0, 0, 0};
|
||||||
static u8 packet_filter_enable_num = 0;
|
static u8 packet_filter_enable_num = 0;
|
||||||
|
|
||||||
void promisc_init_packet_filter()
|
void promisc_init_packet_filter()
|
||||||
|
|
|
@ -321,7 +321,6 @@ int wext_set_tdma_param(const char *ifname, __u8 slot_period,
|
||||||
return ret;
|
return ret;
|
||||||
#else
|
#else
|
||||||
struct iwreq iwr;
|
struct iwreq iwr;
|
||||||
int ret = -1;
|
|
||||||
__u16 pindex = 7;
|
__u16 pindex = 7;
|
||||||
__u8 para[16]; // 7+(1+1+4)
|
__u8 para[16]; // 7+(1+1+4)
|
||||||
int cmd_len = sizeof("pm_set");
|
int cmd_len = sizeof("pm_set");
|
||||||
|
@ -409,7 +408,6 @@ int wext_get_lps_dtim(const char *ifname, __u8 *lps_dtim) {
|
||||||
|
|
||||||
int wext_set_tos_value(const char *ifname, __u8 *tos_value) {
|
int wext_set_tos_value(const char *ifname, __u8 *tos_value) {
|
||||||
struct iwreq iwr;
|
struct iwreq iwr;
|
||||||
int ret = -1;
|
|
||||||
__u8 para[sizeof("set_tos_value") + 4];
|
__u8 para[sizeof("set_tos_value") + 4];
|
||||||
int cmd_len = sizeof("set_tos_value");
|
int cmd_len = sizeof("set_tos_value");
|
||||||
memset(&iwr, 0, sizeof(iwr));
|
memset(&iwr, 0, sizeof(iwr));
|
||||||
|
@ -753,7 +751,7 @@ int wext_private_command_with_retval(const char *ifname, char *cmd,
|
||||||
iwr.u.data.length = buf_size;
|
iwr.u.data.length = buf_size;
|
||||||
iwr.u.data.flags = 0;
|
iwr.u.data.flags = 0;
|
||||||
ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr);
|
ret = iw_ioctl(ifname, SIOCDEVPRIVATE, &iwr);
|
||||||
if (ret >= 0 & ret_buf != NULL) {
|
if (ret >= 0 && ret_buf != NULL) {
|
||||||
if (ret_len > iwr.u.data.length)
|
if (ret_len > iwr.u.data.length)
|
||||||
ret_len = iwr.u.data.length;
|
ret_len = iwr.u.data.length;
|
||||||
memcpy(ret_buf, (char *) iwr.u.data.pointer, ret_len);
|
memcpy(ret_buf, (char *) iwr.u.data.pointer, ret_len);
|
||||||
|
@ -925,7 +923,6 @@ int wext_set_gen_ie(const char *ifname, char *buf, __u16 buf_len, __u16 flags) {
|
||||||
int wext_set_autoreconnect(const char *ifname, __u8 mode, __u8 retyr_times,
|
int wext_set_autoreconnect(const char *ifname, __u8 mode, __u8 retyr_times,
|
||||||
__u16 timeout) {
|
__u16 timeout) {
|
||||||
struct iwreq iwr;
|
struct iwreq iwr;
|
||||||
int ret = 0;
|
|
||||||
__u8 para[sizeof("SetAutoRecnt") + 4];
|
__u8 para[sizeof("SetAutoRecnt") + 4];
|
||||||
int cmd_len = sizeof("SetAutoRecnt");
|
int cmd_len = sizeof("SetAutoRecnt");
|
||||||
memset(&iwr, 0, sizeof(iwr));
|
memset(&iwr, 0, sizeof(iwr));
|
||||||
|
@ -1019,7 +1016,7 @@ int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index) {
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
memset(&iwr, 0, sizeof(iwr));
|
memset(&iwr, 0, sizeof(iwr));
|
||||||
cmd_len = para = pvPortMalloc((4) * 2 + cmd_len); //size:addr len+cmd_len
|
para = pvPortMalloc((4) * 2 + cmd_len); //size:addr len+cmd_len
|
||||||
if (para != NULL) {
|
if (para != NULL) {
|
||||||
//Cmd
|
//Cmd
|
||||||
snprintf(para, cmd_len, "UpdateIE");
|
snprintf(para, cmd_len, "UpdateIE");
|
||||||
|
|
|
@ -74,7 +74,7 @@ WIFI_CONFIG wifi_cfg = {
|
||||||
SOFTAP_CONFIG wifi_ap_cfg = {
|
SOFTAP_CONFIG wifi_ap_cfg = {
|
||||||
.ssid = DEF_AP_SSID,
|
.ssid = DEF_AP_SSID,
|
||||||
.password = DEF_AP_PASSWORD,
|
.password = DEF_AP_PASSWORD,
|
||||||
.security = DEF_AP_SECURITY, // RTW_SECURITY_WPA2_AES_PSK or RTW_SECURITY_OPEN
|
.security = (unsigned char)DEF_AP_SECURITY, // RTW_SECURITY_WPA2_AES_PSK or RTW_SECURITY_OPEN
|
||||||
.beacon_interval = DEF_AP_BEACON,
|
.beacon_interval = DEF_AP_BEACON,
|
||||||
.channel = DEF_AP_CHANNEL,
|
.channel = DEF_AP_CHANNEL,
|
||||||
.ssid_hidden = 0,
|
.ssid_hidden = 0,
|
||||||
|
@ -91,7 +91,7 @@ STATION_CONFIG wifi_st_cfg = {
|
||||||
.ssid = DEF_ST_SSID,
|
.ssid = DEF_ST_SSID,
|
||||||
.password = DEF_ST_PASSWORD,
|
.password = DEF_ST_PASSWORD,
|
||||||
.bssid = DEF_ST_BSSID,
|
.bssid = DEF_ST_BSSID,
|
||||||
.flg = DEF_ST_BSSID,
|
.flg = DEF_ST_USE_BSSID,
|
||||||
.security = DEF_ST_SECURITY,
|
.security = DEF_ST_SECURITY,
|
||||||
.autoreconnect = DEF_ST_AUTORECONNECT,
|
.autoreconnect = DEF_ST_AUTORECONNECT,
|
||||||
.reconnect_pause = DEF_ST_RECONNECT_PAUSE,
|
.reconnect_pause = DEF_ST_RECONNECT_PAUSE,
|
||||||
|
@ -204,8 +204,8 @@ LOCAL int wlan_init_done_callback(void) {
|
||||||
//char wlan_st_name[] = WLAN0_NAME;
|
//char wlan_st_name[] = WLAN0_NAME;
|
||||||
char wlan_st_name[] = WLAN0_NAME;
|
char wlan_st_name[] = WLAN0_NAME;
|
||||||
char wlan_ap_name[] = WLAN1_NAME;
|
char wlan_ap_name[] = WLAN1_NAME;
|
||||||
char wlan_st_netifn = 0;
|
unsigned char wlan_st_netifn = 0;
|
||||||
char wlan_ap_netifn = 1;
|
unsigned char wlan_ap_netifn = 1;
|
||||||
|
|
||||||
|
|
||||||
uint32 get_new_ip(void)
|
uint32 get_new_ip(void)
|
||||||
|
@ -283,7 +283,7 @@ rtw_result_t _wext_enable_powersave(int adapter_num, uint8 ips_mode, uint8 lps_m
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCAL int _wext_cmp_ssid(int adapter_num, uint8 *ssid)
|
LOCAL int _wext_cmp_ssid(int adapter_num, unsigned char *ssid)
|
||||||
{
|
{
|
||||||
_adapter * pad = get_padaptern(adapter_num);
|
_adapter * pad = get_padaptern(adapter_num);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -362,7 +362,7 @@ LOCAL rtw_result_t wifi_run_ap(void) {
|
||||||
int timeout = wifi_test_timeout_ms / wifi_test_timeout_step_ms;
|
int timeout = wifi_test_timeout_ms / wifi_test_timeout_step_ms;
|
||||||
while (1) {
|
while (1) {
|
||||||
#if 1
|
#if 1
|
||||||
if (_wext_cmp_ssid(WLAN_AP_NETIF_NUM, &wifi_ap_cfg.ssid )) {
|
if (_wext_cmp_ssid(WLAN_AP_NETIF_NUM, wifi_ap_cfg.ssid )) {
|
||||||
#else
|
#else
|
||||||
char essid[33];
|
char essid[33];
|
||||||
if ((wext_get_ssid(wlan_ap_name, (unsigned char *) essid) > 0)
|
if ((wext_get_ssid(wlan_ap_name, (unsigned char *) essid) > 0)
|
||||||
|
@ -409,7 +409,7 @@ LOCAL rtw_result_t StartStDHCPClient(void)
|
||||||
debug_printf("Start DHCPClient...\n");
|
debug_printf("Start DHCPClient...\n");
|
||||||
int ret = RTW_SUCCESS;
|
int ret = RTW_SUCCESS;
|
||||||
struct netif * pnetif = &xnetif[WLAN_ST_NETIF_NUM];
|
struct netif * pnetif = &xnetif[WLAN_ST_NETIF_NUM];
|
||||||
DHCP_CONFIG *p = (dhcp_cfg *)&wifi_st_dhcp;
|
DHCP_CONFIG *p = (DHCP_CONFIG *)&wifi_st_dhcp;
|
||||||
unsigned char mode = p->mode;
|
unsigned char mode = p->mode;
|
||||||
if(mode == 2 && p->ip != IP4ADDR(255,255,255,255) && p->ip != IP4ADDR(0,0,0,0)) { // fixed ip
|
if(mode == 2 && p->ip != IP4ADDR(255,255,255,255) && p->ip != IP4ADDR(0,0,0,0)) { // fixed ip
|
||||||
netif_set_addr(pnetif, (ip_addr_t *)&p->ip, (ip_addr_t *)&p->mask, (ip_addr_t *)&p->gw);
|
netif_set_addr(pnetif, (ip_addr_t *)&p->ip, (ip_addr_t *)&p->mask, (ip_addr_t *)&p->gw);
|
||||||
|
@ -602,8 +602,8 @@ LOCAL void _LwIP_Init(void)
|
||||||
xnetif[idx].name[0] = 'r';
|
xnetif[idx].name[0] = 'r';
|
||||||
xnetif[idx].name[1] = '0' + idx;
|
xnetif[idx].name[1] = '0' + idx;
|
||||||
}
|
}
|
||||||
netif_add(&xnetif[WLAN_ST_NETIF_NUM], (struct netif *)&wifi_st_dhcp.ip, (struct netif *)&wifi_st_dhcp.mask, (struct netif *)&wifi_st_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
netif_add(&xnetif[WLAN_ST_NETIF_NUM], (ip_addr_t *)&wifi_st_dhcp.ip, (ip_addr_t *)&wifi_st_dhcp.mask, (ip_addr_t *)&wifi_st_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
||||||
netif_add(&xnetif[WLAN_AP_NETIF_NUM], (struct netif *)&wifi_ap_dhcp.ip, (struct netif *)&wifi_ap_dhcp.mask, (struct netif *)&wifi_ap_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
netif_add(&xnetif[WLAN_AP_NETIF_NUM], (ip_addr_t *)&wifi_ap_dhcp.ip, (ip_addr_t *)&wifi_ap_dhcp.mask, (ip_addr_t *)&wifi_ap_dhcp.gw, NULL, ðernetif_init, &tcpip_input);
|
||||||
#if CONFIG_ETHERNET // && NET_IF_NUM > 2
|
#if CONFIG_ETHERNET // && NET_IF_NUM > 2
|
||||||
{
|
{
|
||||||
struct ip_addr ipaddr;
|
struct ip_addr ipaddr;
|
||||||
|
@ -628,6 +628,8 @@ LOCAL void _LwIP_Init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int rltk_set_tx_power_percentage(rtw_tx_pwr_percentage_t power_percentage_idx);
|
||||||
|
|
||||||
int wifi_run(rtw_mode_t mode) {
|
int wifi_run(rtw_mode_t mode) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
#if CONFIG_DEBUG_LOG > 4
|
#if CONFIG_DEBUG_LOG > 4
|
||||||
|
@ -668,8 +670,8 @@ int wifi_run(rtw_mode_t mode) {
|
||||||
netbios_set_name(WLAN_ST_NETIF_NUM, lwip_host_name[0]);
|
netbios_set_name(WLAN_ST_NETIF_NUM, lwip_host_name[0]);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
netif_set_addr(&xnetif[WLAN_ST_NETIF_NUM], &wifi_st_dhcp.ip,
|
netif_set_addr(&xnetif[WLAN_ST_NETIF_NUM], (ip_addr_t *) &wifi_st_dhcp.ip,
|
||||||
&wifi_st_dhcp.mask, &wifi_st_dhcp.gw);
|
(ip_addr_t *) &wifi_st_dhcp.mask, (ip_addr_t *) &wifi_st_dhcp.gw);
|
||||||
pnif = &xnetif[WLAN_AP_NETIF_NUM];
|
pnif = &xnetif[WLAN_AP_NETIF_NUM];
|
||||||
#if LWIP_NETIF_HOSTNAME
|
#if LWIP_NETIF_HOSTNAME
|
||||||
// @todo ethernetif_init()...
|
// @todo ethernetif_init()...
|
||||||
|
@ -678,8 +680,8 @@ int wifi_run(rtw_mode_t mode) {
|
||||||
netbios_set_name(WLAN_AP_NETIF_NUM, lwip_host_name[1]);
|
netbios_set_name(WLAN_AP_NETIF_NUM, lwip_host_name[1]);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
netif_set_addr(&xnetif[WLAN_AP_NETIF_NUM], &wifi_ap_dhcp.ip,
|
netif_set_addr(&xnetif[WLAN_AP_NETIF_NUM], (ip_addr_t *) &wifi_ap_dhcp.ip,
|
||||||
&wifi_ap_dhcp.mask, &wifi_ap_dhcp.gw);
|
(ip_addr_t *) &wifi_ap_dhcp.mask, (ip_addr_t *) &wifi_ap_dhcp.gw);
|
||||||
|
|
||||||
}
|
}
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
#include "wifi_constants.h"
|
#include "wifi_constants.h"
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
|
|
||||||
|
#ifndef ip4_addr1
|
||||||
#define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0])
|
#define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0])
|
||||||
#define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1])
|
#define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1])
|
||||||
#define ip4_addr3(ipaddr) (((uint8_t*)(ipaddr))[2])
|
#define ip4_addr3(ipaddr) (((uint8_t*)(ipaddr))[2])
|
||||||
#define ip4_addr4(ipaddr) (((uint8_t*)(ipaddr))[3])
|
#define ip4_addr4(ipaddr) (((uint8_t*)(ipaddr))[3])
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IPSTR "%d.%d.%d.%d"
|
#define IPSTR "%d.%d.%d.%d"
|
||||||
|
|
||||||
|
@ -118,8 +120,8 @@ extern unsigned char wifi_mode; // rtw_mode_t
|
||||||
extern unsigned char wifi_st_status; // WIFI_STA_ENUM
|
extern unsigned char wifi_st_status; // WIFI_STA_ENUM
|
||||||
extern char wlan_st_name[];
|
extern char wlan_st_name[];
|
||||||
extern char wlan_ap_name[];
|
extern char wlan_ap_name[];
|
||||||
extern char wlan_st_netifn;
|
extern unsigned char wlan_st_netifn;
|
||||||
extern char wlan_ap_netifn;
|
extern unsigned char wlan_ap_netifn;
|
||||||
|
|
||||||
/* WiFi Station & scan security */
|
/* WiFi Station & scan security */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -90,7 +90,7 @@ LOCAL void _wifi_scan_done_hdl(char* buf, int buf_len, int flags, void* userdata
|
||||||
web_scan_handler_t * pwscn_rec = &web_scan_handler_ptr;
|
web_scan_handler_t * pwscn_rec = &web_scan_handler_ptr;
|
||||||
if(pscan_rec->gscan_result_handler) {
|
if(pscan_rec->gscan_result_handler) {
|
||||||
// сторонний вывод
|
// сторонний вывод
|
||||||
(*pscan_rec->gscan_result_handler)(pscan_rec);
|
(*pscan_rec->gscan_result_handler)((rtw_scan_handler_result_t *) pscan_rec);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// оставить структуру pscan_rec->pap_details[i] для вывода в web scan на 5 сек
|
// оставить структуру pscan_rec->pap_details[i] для вывода в web scan на 5 сек
|
||||||
|
@ -136,6 +136,7 @@ LOCAL int _wifi_scan_networks(rtw_scan_result_handler_t results_handler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- wext_set_pscan_channels ----------------- */
|
/* -------- wext_set_pscan_channels ----------------- */
|
||||||
|
extern int iw_ioctl(const char * ifname, unsigned long request, struct iwreq * pwrq);
|
||||||
|
|
||||||
LOCAL int wext_set_pscan_channels(void) {
|
LOCAL int wext_set_pscan_channels(void) {
|
||||||
struct iwreq iwr;
|
struct iwreq iwr;
|
||||||
|
@ -183,7 +184,7 @@ rtw_result_t api_wifi_scan(api_scan_result_handler_t scan_result_cb)
|
||||||
// error_printf("Error xTimerStart\n");
|
// error_printf("Error xTimerStart\n");
|
||||||
} else if(wext_set_pscan_channels() < 0) {
|
} else if(wext_set_pscan_channels() < 0) {
|
||||||
// error_printf("ERROR: wifi set partial scan channel fail\n");
|
// error_printf("ERROR: wifi set partial scan channel fail\n");
|
||||||
} else if(_wifi_scan_networks(scan_result_cb) != RTW_SUCCESS) {
|
} else if(_wifi_scan_networks((rtw_scan_result_handler_t) scan_result_cb) != RTW_SUCCESS) {
|
||||||
// error_printf("ERROR: wifi scan failed\n");
|
// error_printf("ERROR: wifi scan failed\n");
|
||||||
} else if(scan_result_cb) {
|
} else if(scan_result_cb) {
|
||||||
int i = 300;
|
int i = 300;
|
||||||
|
|
|
@ -208,6 +208,7 @@
|
||||||
#if defined(CONFIG_HARDWARE_8188F)
|
#if defined(CONFIG_HARDWARE_8188F)
|
||||||
#define NET_IF_NUM 2
|
#define NET_IF_NUM 2
|
||||||
#else
|
#else
|
||||||
|
#undef NET_IF_NUM
|
||||||
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
|
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include <section_config.h>
|
#include <section_config.h>
|
||||||
//#include "rtl_utility_ram.h"
|
//#include "rtl_utility_ram.h"
|
||||||
#include "platform/platform_stdlib.h"
|
#include "platform/platform_stdlib.h"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define SRAM_BD_DATA_SECTION
|
#define SRAM_BD_DATA_SECTION
|
||||||
#define WLAN_ROM_TEXT_SECTION
|
#define WLAN_ROM_TEXT_SECTION
|
||||||
|
|
|
@ -39,8 +39,8 @@
|
||||||
// 0x0000h ~ 0x00FFh System Configuration
|
// 0x0000h ~ 0x00FFh System Configuration
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
#define REG_SYS_ISO_CTRL 0x0000
|
#define REG_SYS_ISO_CTRL_ 0x0000
|
||||||
#define REG_SYS_FUNC_EN 0x0002
|
#define REG_SYS_FUNC_EN_ 0x0002
|
||||||
#define REG_APS_FSMCO 0x0004
|
#define REG_APS_FSMCO 0x0004
|
||||||
#define REG_SYS_CLKR 0x0008
|
#define REG_SYS_CLKR 0x0008
|
||||||
#define REG_9346CR 0x000A
|
#define REG_9346CR 0x000A
|
||||||
|
@ -515,7 +515,7 @@
|
||||||
#define REG_BSSID1 0x0708
|
#define REG_BSSID1 0x0708
|
||||||
|
|
||||||
/* port0 & port1 enable */
|
/* port0 & port1 enable */
|
||||||
#define REG_PORT_CTRL 0x76D
|
// #define REG_PORT_CTRL 0x76D
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -872,7 +872,7 @@ Default: 00b.
|
||||||
#define IMR_PSTIMEOUT BIT14 // Power save time out interrupt
|
#define IMR_PSTIMEOUT BIT14 // Power save time out interrupt
|
||||||
#define IMR_BcnInt BIT13 // Beacon DMA Interrupt 0
|
#define IMR_BcnInt BIT13 // Beacon DMA Interrupt 0
|
||||||
#define IMR_RXFOVW BIT12 // Receive FIFO Overflow
|
#define IMR_RXFOVW BIT12 // Receive FIFO Overflow
|
||||||
#define IMR_RDU BIT11 // Receive Descriptor Unavailable
|
#define IMR_RDU_ BIT11 // Receive Descriptor Unavailable
|
||||||
#define IMR_ATIMEND BIT10 // For 92C,ATIM Window End Interrupt. For 8723 and later ICs, it also means P2P CTWin End interrupt.
|
#define IMR_ATIMEND BIT10 // For 92C,ATIM Window End Interrupt. For 8723 and later ICs, it also means P2P CTWin End interrupt.
|
||||||
#define IMR_BDOK BIT9 // Beacon Queue DMA OK Interrup
|
#define IMR_BDOK BIT9 // Beacon Queue DMA OK Interrup
|
||||||
#define IMR_HIGHDOK BIT8 // High Queue DMA OK Interrupt
|
#define IMR_HIGHDOK BIT8 // High Queue DMA OK Interrupt
|
||||||
|
|
|
@ -846,7 +846,7 @@ __inline static union recv_frame *rxmem_to_recvframe(u8 *rxmem)
|
||||||
|
|
||||||
__inline static union recv_frame *pkt_to_recvframe(_pkt *pkt)
|
__inline static union recv_frame *pkt_to_recvframe(_pkt *pkt)
|
||||||
{
|
{
|
||||||
|
(void) pkt;
|
||||||
u8 * buf_star = NULL;
|
u8 * buf_star = NULL;
|
||||||
union recv_frame * precv_frame = NULL;
|
union recv_frame * precv_frame = NULL;
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
|
|
@ -143,8 +143,8 @@ void list_add(struct list_head *new, struct list_head *head);
|
||||||
void list_add_tail(struct list_head *new, struct list_head *head);
|
void list_add_tail(struct list_head *new, struct list_head *head);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void save_and_cli(void);
|
//extern void save_and_cli(void);
|
||||||
extern void restore_flags(void);
|
//extern void restore_flags(void);
|
||||||
//----- ------------------------------------------------------------------
|
//----- ------------------------------------------------------------------
|
||||||
// SKB Operation
|
// SKB Operation
|
||||||
//----- ------------------------------------------------------------------
|
//----- ------------------------------------------------------------------
|
||||||
|
|
|
@ -133,7 +133,7 @@ void rltk_wlan_recv(int idx, struct eth_drv_sg *sg_list, int sg_len)
|
||||||
|
|
||||||
DBG_TRACE("%s is called", __FUNCTION__);
|
DBG_TRACE("%s is called", __FUNCTION__);
|
||||||
|
|
||||||
if (!rltk_wlan_check_isup(idx))
|
if (rltk_wlan_check_isup(idx) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(idx == -1){
|
if(idx == -1){
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
#include "wait_api.h"
|
#include "wait_api.h"
|
||||||
#include "us_ticker_api.h"
|
#include "us_ticker_api.h"
|
||||||
|
|
||||||
|
@ -79,6 +81,7 @@ typedef struct
|
||||||
#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
|
#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void wait(float s) { // До 1073741 секунд? 298 часов
|
void wait(float s) { // До 1073741 секунд? 298 часов
|
||||||
// wait_us((int)(s * 1000000.0f));
|
// wait_us((int)(s * 1000000.0f));
|
||||||
vTaskDelay((int)(s * 1000.0f));
|
vTaskDelay((int)(s * 1000.0f));
|
||||||
|
|
|
@ -17,9 +17,9 @@ extern "C" {
|
||||||
#include <queue.h>
|
#include <queue.h>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#ifndef FLASH_SECTOR_SIZE
|
//#ifndef FLASH_SECTOR_SIZE
|
||||||
#define FLASH_SECTOR_SIZE 4096
|
// #define FLASH_SECTOR_SIZE 4096
|
||||||
#endif
|
//#endif
|
||||||
#define FLASH_SECTORS 256 // 1 Mbytes
|
#define FLASH_SECTORS 256 // 1 Mbytes
|
||||||
#define FLASH_CHIP_SIZE (FLASH_SECTORS * FLASH_SECTOR_SIZE)
|
#define FLASH_CHIP_SIZE (FLASH_SECTORS * FLASH_SECTOR_SIZE)
|
||||||
#define FMEMORY_SCFG_BANK_SIZE FLASH_SECTOR_SIZE // размер сектора, 4096 bytes
|
#define FMEMORY_SCFG_BANK_SIZE FLASH_SECTOR_SIZE // размер сектора, 4096 bytes
|
||||||
|
|
|
@ -194,7 +194,7 @@ typedef enum {
|
||||||
PWM_OUT = PD_4,
|
PWM_OUT = PD_4,
|
||||||
*/
|
*/
|
||||||
// Not connected
|
// Not connected
|
||||||
NC = (uint32_t)0xFFFFFFFF
|
NC = -1 // (uint32_t)0xFFFFFFFF
|
||||||
} PinName;
|
} PinName;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -124,7 +124,7 @@ float analogin_read(analogin_t *obj){
|
||||||
unsigned short us[4];
|
unsigned short us[4];
|
||||||
} adata;
|
} adata;
|
||||||
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
||||||
RtkADCReceiveBuf(p, &adata.ui);
|
RtkADCReceiveBuf(p, (u32 *) &adata.ui);
|
||||||
return (float)(adata.us[p->DevNum]) / (float)(0xCE80);
|
return (float)(adata.us[p->DevNum]) / (float)(0xCE80);
|
||||||
/*
|
/*
|
||||||
uint32_t AnaloginTmp[2] = {0,0};
|
uint32_t AnaloginTmp[2] = {0,0};
|
||||||
|
@ -161,7 +161,7 @@ uint16_t analogin_read_u16(analogin_t *obj){
|
||||||
unsigned short us[4];
|
unsigned short us[4];
|
||||||
} adata;
|
} adata;
|
||||||
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
||||||
RtkADCRxManualRotate(p, &adata.ui);
|
RtkADCRxManualRotate(p, (u32 *) &adata.ui);
|
||||||
return adata.us[p->DevNum];
|
return adata.us[p->DevNum];
|
||||||
/*
|
/*
|
||||||
uint32_t AnaloginTmp[2] = {0,0};
|
uint32_t AnaloginTmp[2] = {0,0};
|
||||||
|
|
|
@ -592,6 +592,8 @@ unsigned int flash_get_size(flash_t *obj) {
|
||||||
/*
|
/*
|
||||||
* Read Flash OTP data
|
* Read Flash OTP data
|
||||||
*/
|
*/
|
||||||
|
extern void SpicTxCmdWithDataRtl8195A(u8 cmd, u8 DataPhaseLen, u8* pData, SPIC_INIT_PARA SpicInitPara);
|
||||||
|
|
||||||
int flash_otp_read(flash_t *obj, uint32_t address, uint32_t Length,
|
int flash_otp_read(flash_t *obj, uint32_t address, uint32_t Length,
|
||||||
uint8_t * data) {
|
uint8_t * data) {
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
|
@ -350,7 +350,7 @@ LOCAL FLASH_EEP_ATTR unsigned int pack_cfg_fmem(fobj_head obj)
|
||||||
#if 0
|
#if 0
|
||||||
copy_align4_to_align1((uint8 *)pbuf, rdaddr, len);
|
copy_align4_to_align1((uint8 *)pbuf, rdaddr, len);
|
||||||
#else
|
#else
|
||||||
SpicUserReadFourByteRtl8195A(len, rdaddr, (unsigned int *)pbuf, flashobj.SpicInitPara.Mode.BitMode);
|
SpicUserReadFourByteRtl8195A(len, rdaddr, (u32 *)pbuf, flashobj.SpicInitPara.Mode.BitMode);
|
||||||
#endif
|
#endif
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int size4b = len >> 2;
|
int size4b = len >> 2;
|
||||||
|
|
|
@ -44,6 +44,8 @@ const PinMap PinMap_PWM[] = {
|
||||||
{NC, NC, 0}
|
{NC, NC, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern void * rtl_memset(void * m , int c , size_t n);
|
||||||
|
|
||||||
int pwmout_init(pwmout_t* obj, PinName pin)
|
int pwmout_init(pwmout_t* obj, PinName pin)
|
||||||
{
|
{
|
||||||
uint32_t peripheral;
|
uint32_t peripheral;
|
||||||
|
|
|
@ -26,11 +26,16 @@
|
||||||
#define OTA_Signature_len 8
|
#define OTA_Signature_len 8
|
||||||
#define OTA_Signature_offset 8
|
#define OTA_Signature_offset 8
|
||||||
#define OTA_valid_offset 0x100000
|
#define OTA_valid_offset 0x100000
|
||||||
|
|
||||||
|
#undef printf
|
||||||
#define printf DiagPrintf
|
#define printf DiagPrintf
|
||||||
|
|
||||||
#if !defined(__ICCARM__)
|
#if !defined(__ICCARM__)
|
||||||
|
#undef memcmp
|
||||||
#define memcmp(dst, src, sz) _memcmp(dst, src, sz)
|
#define memcmp(dst, src, sz) _memcmp(dst, src, sz)
|
||||||
|
#undef memset
|
||||||
#define memset(dst, val, sz) _memset(dst, val, sz)
|
#define memset(dst, val, sz) _memset(dst, val, sz)
|
||||||
|
#undef memcpy
|
||||||
#define memcpy(dst, src, sz) _memcpy(dst, src, sz)
|
#define memcpy(dst, src, sz) _memcpy(dst, src, sz)
|
||||||
#endif // #if !defined(__ICCARM__)
|
#endif // #if !defined(__ICCARM__)
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
#define DHCP_MESSAGE_HTYPE (1)
|
#define DHCP_MESSAGE_HTYPE (1)
|
||||||
#define DHCP_MESSAGE_HLEN (6)
|
#define DHCP_MESSAGE_HLEN (6)
|
||||||
|
|
||||||
#define DHCP_SERVER_PORT (67)
|
//#define DHCP_SERVER_PORT (67) // in dhcp.h
|
||||||
#define DHCP_CLIENT_PORT (68)
|
//#define DHCP_CLIENT_PORT (68) // in dhcp.h
|
||||||
|
|
||||||
#define DHCP_MESSAGE_TYPE_DISCOVER (1)
|
#define DHCP_MESSAGE_TYPE_DISCOVER (1)
|
||||||
#define DHCP_MESSAGE_TYPE_OFFER (2)
|
#define DHCP_MESSAGE_TYPE_OFFER (2)
|
||||||
|
|
|
@ -91,9 +91,11 @@ static void arp_timer(void *arg);
|
||||||
|
|
||||||
#if LWIP_NETIF_HOSTNAME
|
#if LWIP_NETIF_HOSTNAME
|
||||||
char lwip_host_name[NET_IF_NUM][LWIP_NETIF_HOSTNAME_SIZE] = {
|
char lwip_host_name[NET_IF_NUM][LWIP_NETIF_HOSTNAME_SIZE] = {
|
||||||
DEF_HOSTNAME"0",
|
{ DEF_HOSTNAME "0" },
|
||||||
DEF_HOSTNAME"1",
|
{ DEF_HOSTNAME "1" }
|
||||||
DEF_HOSTNAME"2"
|
#if NET_IF_NUM > 2
|
||||||
|
,{ DEF_HOSTNAME "2" }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,9 @@ struct netif *
|
||||||
ip_route(ip_addr_t *dest)
|
ip_route(ip_addr_t *dest)
|
||||||
{
|
{
|
||||||
struct netif *netif;
|
struct netif *netif;
|
||||||
|
#if CONFIG_ETHERNET
|
||||||
struct netif *last_netif = NULL;
|
struct netif *last_netif = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LWIP_HOOK_IP4_ROUTE
|
#ifdef LWIP_HOOK_IP4_ROUTE
|
||||||
netif = LWIP_HOOK_IP4_ROUTE(dest);
|
netif = LWIP_HOOK_IP4_ROUTE(dest);
|
||||||
|
|
|
@ -217,10 +217,12 @@ u8_t ip4_addr_netmask_valid(u32_t netmask);
|
||||||
ipaddr != NULL ? ip4_addr4_16(ipaddr) : 0))
|
ipaddr != NULL ? ip4_addr4_16(ipaddr) : 0))
|
||||||
|
|
||||||
/* Get one byte from the 4-byte address */
|
/* Get one byte from the 4-byte address */
|
||||||
|
#ifndef ip4_addr1
|
||||||
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
||||||
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
||||||
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
||||||
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
|
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
|
||||||
|
#endif
|
||||||
/* These are cast to u16_t, with the intent that they are often arguments
|
/* These are cast to u16_t, with the intent that they are often arguments
|
||||||
* to printf using the U16_F format from cc.h. */
|
* to printf using the U16_F format from cc.h. */
|
||||||
#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
|
#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
|
||||||
|
|
|
@ -163,9 +163,9 @@ PACK_STRUCT_END
|
||||||
# include "arch/epstruct.h"
|
# include "arch/epstruct.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define toupper(CH) \
|
//#define toupper(CH) (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
|
||||||
// (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
|
|
||||||
|
|
||||||
|
extern int toupper(int ch);
|
||||||
|
|
||||||
/** NetBIOS decoding name */
|
/** NetBIOS decoding name */
|
||||||
static int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
|
static int8_t NETBIOS_CODE_ATTR NBNS_decode(char *dst, char *src)
|
||||||
|
@ -226,7 +226,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
|
||||||
if (current_netif != NULL && current_netif->num < NET_IF_NUM) {
|
if (current_netif != NULL && current_netif->num < NET_IF_NUM) {
|
||||||
uint32 ip = current_netif->ip_addr.addr;
|
uint32 ip = current_netif->ip_addr.addr;
|
||||||
char *curbiosname = netbios_name[current_netif->num];
|
char *curbiosname = netbios_name[current_netif->num];
|
||||||
if (curbiosname[0] != '\0' && ip != NULL
|
if (curbiosname[0] != '\0' && ip != 0
|
||||||
/* we only answer if we got a default interface */
|
/* we only answer if we got a default interface */
|
||||||
&& (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети
|
&& (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети
|
||||||
#if DEBUGSOO > 3
|
#if DEBUGSOO > 3
|
||||||
|
|
|
@ -159,7 +159,7 @@ void sntp_get_lasttime(long *sec, long *usec, unsigned int *tick)
|
||||||
|
|
||||||
time_t sntp_gen_system_time(int timezone)
|
time_t sntp_gen_system_time(int timezone)
|
||||||
{
|
{
|
||||||
struct tm current_tm;
|
// struct tm current_tm;
|
||||||
unsigned int update_tick;
|
unsigned int update_tick;
|
||||||
long update_sec, update_usec, current_sec = 0;
|
long update_sec, update_usec, current_sec = 0;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
#include <osdep_service.h>
|
#include <osdep_service.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <freertos_pmu.h>
|
#include <freertos_pmu.h>
|
||||||
//#include <tcm_heap.h>
|
#include <tcm_heap.h>
|
||||||
|
#include <netdev.h>
|
||||||
/********************* os depended utilities ********************/
|
/********************* os depended utilities ********************/
|
||||||
|
|
||||||
#ifndef USE_MUTEX_FOR_SPINLOCK
|
#ifndef USE_MUTEX_FOR_SPINLOCK
|
||||||
|
@ -549,7 +550,9 @@ static u32 _freertos_GetFreeHeapSize(void)
|
||||||
{
|
{
|
||||||
return (u32)xPortGetFreeHeapSize();
|
return (u32)xPortGetFreeHeapSize();
|
||||||
}
|
}
|
||||||
void *tcm_heap_malloc(int size);
|
|
||||||
|
//extern void *tcm_heap_malloc(int size);
|
||||||
|
|
||||||
static int _freertos_create_task(struct task_struct *ptask, const char *name,
|
static int _freertos_create_task(struct task_struct *ptask, const char *name,
|
||||||
u32 stack_size, u32 priority, thread_func_t func, void *thctx)
|
u32 stack_size, u32 priority, thread_func_t func, void *thctx)
|
||||||
{
|
{
|
||||||
|
@ -576,7 +579,7 @@ static int _freertos_create_task(struct task_struct *ptask, const char *name,
|
||||||
|
|
||||||
priority += tskIDLE_PRIORITY + PRIORITIE_OFFSET;
|
priority += tskIDLE_PRIORITY + PRIORITIE_OFFSET;
|
||||||
|
|
||||||
if(rtw_if_wifi_thread(name) == 0){
|
if(rtw_if_wifi_thread((char *)name) == 0){
|
||||||
|
|
||||||
#if CONFIG_USE_TCM_HEAP
|
#if CONFIG_USE_TCM_HEAP
|
||||||
void *stack_addr = tcm_heap_malloc(stack_size*sizeof(int));
|
void *stack_addr = tcm_heap_malloc(stack_size*sizeof(int));
|
||||||
|
|
|
@ -162,7 +162,7 @@ typedef struct HeapRegion
|
||||||
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
||||||
* with the lowest start address must appear first in the array.
|
* with the lowest start address must appear first in the array.
|
||||||
*/
|
*/
|
||||||
static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
|
//static void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -376,7 +376,7 @@ BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode,
|
||||||
TaskHandle_t * const pxCreatedTask,
|
TaskHandle_t * const pxCreatedTask,
|
||||||
StackType_t * const puxStackBuffer,
|
StackType_t * const puxStackBuffer,
|
||||||
const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION;
|
const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION;
|
||||||
#define xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ) xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( NULL ), ( NULL ) )
|
#define xTaskCreate(pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ) xTaskGenericCreate( (TaskFunction_t)( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( NULL ), ( NULL ) )
|
||||||
#else
|
#else
|
||||||
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
|
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
|
||||||
const char * const pcName,
|
const char * const pcName,
|
||||||
|
|
|
@ -689,6 +689,7 @@ __attribute__(( weak )) void vPortSetupTimerInterrupt( void )
|
||||||
#endif /* configASSERT_DEFINED */
|
#endif /* configASSERT_DEFINED */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
#if configUSE_IDLE_HOOK
|
#if configUSE_IDLE_HOOK
|
||||||
|
extern void WDGRefresh(void);
|
||||||
void vApplicationIdleHook( void )
|
void vApplicationIdleHook( void )
|
||||||
{
|
{
|
||||||
/* Use the idle task to place the CPU into a low power mode. Greater power
|
/* Use the idle task to place the CPU into a low power mode. Greater power
|
||||||
|
|
|
@ -134,6 +134,7 @@ typedef struct A_BLOCK_LINK {
|
||||||
size_t xBlockSize; /*<< The size of the free block. */
|
size_t xBlockSize; /*<< The size of the free block. */
|
||||||
} BlockLink_t;
|
} BlockLink_t;
|
||||||
|
|
||||||
|
static void vPortDefineHeapRegions(const HeapRegion_t * const pxHeapRegions);
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -502,7 +503,7 @@ static void vPortDefineHeapRegions(const HeapRegion_t * const pxHeapRegions) {
|
||||||
uint8 chip_id = HalGetChipId();
|
uint8 chip_id = HalGetChipId();
|
||||||
while (pxHeapRegion->xSizeInBytes > 0) {
|
while (pxHeapRegion->xSizeInBytes > 0) {
|
||||||
if (pxHeapRegion->pucStartAddress
|
if (pxHeapRegion->pucStartAddress
|
||||||
> 0x20000000 && chip_id >= CHIP_ID_8711AN && chip_id <= CHIP_ID_8711AF) {
|
> (uint8_t *) 0x20000000 && chip_id >= CHIP_ID_8711AN && chip_id <= CHIP_ID_8711AF) {
|
||||||
// pxHeapRegion->pucStartAddress = 0;
|
// pxHeapRegion->pucStartAddress = 0;
|
||||||
// pxHeapRegion->xSizeInBytes = 0;
|
// pxHeapRegion->xSizeInBytes = 0;
|
||||||
// DBG_8195A("ChipID: %p !\n", chip_id);
|
// DBG_8195A("ChipID: %p !\n", chip_id);
|
||||||
|
@ -584,6 +585,8 @@ static void vPortDefineHeapRegions(const HeapRegion_t * const pxHeapRegions) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern _LONG_CALL_ void * __rtl_memcpy_v1_00(void * __restrict dst0 , const void * __restrict src0 , size_t len0);
|
||||||
|
|
||||||
void* pvPortReAlloc(void *pv, size_t xWantedSize) {
|
void* pvPortReAlloc(void *pv, size_t xWantedSize) {
|
||||||
BlockLink_t *pxLink;
|
BlockLink_t *pxLink;
|
||||||
|
|
||||||
|
@ -612,7 +615,7 @@ void* pvPortReAlloc(void *pv, size_t xWantedSize) {
|
||||||
|
|
||||||
int oldSize = (pxLink->xBlockSize & ~xBlockAllocatedBit) - uxHeapStructSize;
|
int oldSize = (pxLink->xBlockSize & ~xBlockAllocatedBit) - uxHeapStructSize;
|
||||||
int copySize = (oldSize < xWantedSize) ? oldSize : xWantedSize;
|
int copySize = (oldSize < xWantedSize) ? oldSize : xWantedSize;
|
||||||
rtl_memcpy(newArea, pv, copySize);
|
__rtl_memcpy_v1_00(newArea, pv, copySize);
|
||||||
|
|
||||||
vTaskSuspendAll();
|
vTaskSuspendAll();
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,7 @@ task.h is included from an application file. */
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
|
#include "tcm_heap.h"
|
||||||
#include "StackMacros.h"
|
#include "StackMacros.h"
|
||||||
|
|
||||||
/* Lint e961 and e750 are suppressed as a MISRA exception justified because the
|
/* Lint e961 and e750 are suppressed as a MISRA exception justified because the
|
||||||
|
|
|
@ -1296,7 +1296,7 @@ struct osdep_service_ops {
|
||||||
int (*ATOMIC_INC_RETURN)(ATOMIC_T *v);
|
int (*ATOMIC_INC_RETURN)(ATOMIC_T *v);
|
||||||
int (*ATOMIC_DEC_RETURN)(ATOMIC_T *v);
|
int (*ATOMIC_DEC_RETURN)(ATOMIC_T *v);
|
||||||
u64 (*rtw_modular64)(u64 x, u64 y);
|
u64 (*rtw_modular64)(u64 x, u64 y);
|
||||||
int (*rtw_get_random_bytes)(void* dst, u32 size);
|
int (*rtw_get_random_bytes)(void* dst, size_t size);
|
||||||
u32 (*rtw_getFreeHeapSize)(void);
|
u32 (*rtw_getFreeHeapSize)(void);
|
||||||
int (*rtw_create_task)(struct task_struct *task, const char *name, u32 stack_size, u32 priority, thread_func_t func, void *thctx);
|
int (*rtw_create_task)(struct task_struct *task, const char *name, u32 stack_size, u32 priority, thread_func_t func, void *thctx);
|
||||||
void (*rtw_delete_task)(struct task_struct *task);
|
void (*rtw_delete_task)(struct task_struct *task);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include <osdep_service.h>
|
#include <osdep_service.h>
|
||||||
|
#include "tcm_heap.h"
|
||||||
#define OSDEP_DBG(x, ...) do {} while(0)
|
#define OSDEP_DBG(x, ...) do {} while(0)
|
||||||
|
|
||||||
extern struct osdep_service_ops osdep_service;
|
extern struct osdep_service_ops osdep_service;
|
||||||
|
|
|
@ -287,6 +287,7 @@ RtkDACIdxChk(
|
||||||
IN u8 DACIdx
|
IN u8 DACIdx
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
(void) DACIdx;
|
||||||
#if !DAC0_USED
|
#if !DAC0_USED
|
||||||
if (DACIdx == DAC0_SEL)
|
if (DACIdx == DAC0_SEL)
|
||||||
return _EXIT_FAILURE;
|
return _EXIT_FAILURE;
|
||||||
|
|
|
@ -72,10 +72,10 @@ typedef struct _LOG_UART_ADAPTER_ {
|
||||||
}LOG_UART_ADAPTER, *PLOG_UART_ADAPTER;
|
}LOG_UART_ADAPTER, *PLOG_UART_ADAPTER;
|
||||||
|
|
||||||
typedef struct _COMMAND_TABLE_ {
|
typedef struct _COMMAND_TABLE_ {
|
||||||
const u8* cmd;
|
const char * cmd;
|
||||||
u16 ArgvCnt;
|
u16 ArgvCnt;
|
||||||
u32 (*func)(u16 argc, u8* argv[]);
|
void (*func)(int argc, char * argv[]);
|
||||||
const u8* msg;
|
const char * msg;
|
||||||
}COMMAND_TABLE, *PCOMMAND_TABLE;
|
}COMMAND_TABLE, *PCOMMAND_TABLE;
|
||||||
|
|
||||||
//VOID
|
//VOID
|
||||||
|
|
|
@ -190,11 +190,11 @@ typedef struct _HAL_GPIO_PIN_ {
|
||||||
u32 pin_name; // Pin: [7:5]: port number, [4:0]: pin number
|
u32 pin_name; // Pin: [7:5]: port number, [4:0]: pin number
|
||||||
}HAL_GPIO_PIN, *PHAL_GPIO_PIN;
|
}HAL_GPIO_PIN, *PHAL_GPIO_PIN;
|
||||||
|
|
||||||
typedef struct _HAL_GPIO_OP_ {
|
|
||||||
#if defined(__ICCARM__)
|
#if defined(__ICCARM__)
|
||||||
|
typedef struct _HAL_GPIO_OP_ {
|
||||||
void* dummy;
|
void* dummy;
|
||||||
#endif
|
|
||||||
}HAL_GPIO_OP, *PHAL_GPIO_OP;
|
}HAL_GPIO_OP, *PHAL_GPIO_OP;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void (*GPIO_IRQ_FUN)(VOID *Data, u32 Id);
|
typedef void (*GPIO_IRQ_FUN)(VOID *Data, u32 Id);
|
||||||
typedef void (*GPIO_USER_IRQ_FUN)(u32 Id);
|
typedef void (*GPIO_USER_IRQ_FUN)(u32 Id);
|
||||||
|
|
|
@ -288,7 +288,7 @@ typedef enum _I2C_ERR_TYPE_ {
|
||||||
// I2C Time Out type
|
// I2C Time Out type
|
||||||
typedef enum _I2C_TIMEOUT_TYPE_ {
|
typedef enum _I2C_TIMEOUT_TYPE_ {
|
||||||
I2C_TIMEOOUT_DISABLE = 0x00,
|
I2C_TIMEOOUT_DISABLE = 0x00,
|
||||||
I2C_TIMEOOUT_ENDLESS = 0xFFFFFFFF,
|
I2C_TIMEOOUT_ENDLESS = -1 // 0xFFFFFFFF,
|
||||||
}I2C_TIMEOUT_TYPE, *PI2C_TIMEOUT_TYPE;
|
}I2C_TIMEOUT_TYPE, *PI2C_TIMEOUT_TYPE;
|
||||||
|
|
||||||
//======================================================
|
//======================================================
|
||||||
|
|
|
@ -116,7 +116,7 @@ HAL_CUT_B_RAM_DATA_SECTION u32 rand_x = 123456789; // 10000be4
|
||||||
0, \
|
0, \
|
||||||
"", \
|
"", \
|
||||||
0, \
|
0, \
|
||||||
0x0437DC, \
|
(void *)0x0437DC, \
|
||||||
0, \
|
0, \
|
||||||
_NULL, \
|
_NULL, \
|
||||||
_NULL, \
|
_NULL, \
|
||||||
|
|
|
@ -257,7 +257,7 @@ LOCAL int BOOT_RAM_TEXT_SECTION SetSpicBitMode(uint8 BitMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOOT_RAM_TEXT_SECTION InitSpicFlashType(struct spic_table_flash_type *ptable_flash) {
|
void BOOT_RAM_TEXT_SECTION InitSpicFlashType(struct spic_table_flash_type *ptable_flash) {
|
||||||
u8 * ptrb = &ptable_flash->cmd;
|
u8 * ptrb = (u8 *) &ptable_flash->cmd;
|
||||||
volatile u32 * ptrreg = (volatile u32 *)(SPI_FLASH_CTRL_BASE + REG_SPIC_READ_FAST_SINGLE);// 0x400060E0
|
volatile u32 * ptrreg = (volatile u32 *)(SPI_FLASH_CTRL_BASE + REG_SPIC_READ_FAST_SINGLE);// 0x400060E0
|
||||||
HAL_SPI_WRITE32(REG_SPIC_SSIENR, 0); // Disable SPI_FLASH User Mode
|
HAL_SPI_WRITE32(REG_SPIC_SSIENR, 0); // Disable SPI_FLASH User Mode
|
||||||
do {
|
do {
|
||||||
|
@ -404,7 +404,7 @@ LOCAL const uint32 tab_seg_def[] = { 0x10000000, 0x10070000, 0x1fff0000,
|
||||||
|
|
||||||
LOCAL uint32 BOOT_RAM_TEXT_SECTION get_seg_id(uint32 addr, int32 size) {
|
LOCAL uint32 BOOT_RAM_TEXT_SECTION get_seg_id(uint32 addr, int32 size) {
|
||||||
uint32 ret = SEG_ID_ERR;
|
uint32 ret = SEG_ID_ERR;
|
||||||
uint32 * ptr = &tab_seg_def;
|
uint32 * ptr = (uint32 *) &tab_seg_def;
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
do {
|
do {
|
||||||
ret++;
|
ret++;
|
||||||
|
@ -447,7 +447,7 @@ LOCAL uint32 BOOT_RAM_TEXT_SECTION load_segs(uint32 faddr, PIMG2HEAD hdr,
|
||||||
segnum, faddr, txt_tab_seg[seg_id], hdr->seg.ldaddr,
|
segnum, faddr, txt_tab_seg[seg_id], hdr->seg.ldaddr,
|
||||||
hdr->seg.size);
|
hdr->seg.size);
|
||||||
#endif
|
#endif
|
||||||
fnextaddr += flashcpy(fnextaddr, hdr->seg.ldaddr, hdr->seg.size);
|
fnextaddr += flashcpy(fnextaddr, (void *)hdr->seg.ldaddr, hdr->seg.size);
|
||||||
} else if (seg_id) {
|
} else if (seg_id) {
|
||||||
#if CONFIG_DEBUG_LOG > 2
|
#if CONFIG_DEBUG_LOG > 2
|
||||||
DBG_8195A("Skip Flash seg%d: 0x%08x -> %s: 0x%08x, size: %d\n", segnum,
|
DBG_8195A("Skip Flash seg%d: 0x%08x -> %s: 0x%08x, size: %d\n", segnum,
|
||||||
|
@ -476,7 +476,7 @@ LOCAL int BOOT_RAM_TEXT_SECTION loadUserImges(int imgnum) {
|
||||||
faddr = (faddr + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
|
faddr = (faddr + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
|
||||||
uint32 img_id = load_img2_head(faddr, &hdr);
|
uint32 img_id = load_img2_head(faddr, &hdr);
|
||||||
if ((img_id >> 8) > 4 || (uint8) img_id != 0) {
|
if ((img_id >> 8) > 4 || (uint8) img_id != 0) {
|
||||||
faddr = load_segs(faddr + 0x10, &hdr.seg, imagenum == imgnum);
|
faddr = load_segs(faddr + 0x10, (PIMG2HEAD) &hdr.seg, imagenum == imgnum);
|
||||||
if (imagenum == imgnum) {
|
if (imagenum == imgnum) {
|
||||||
// DBG_8195A("Image%d: %s\n", imgnum, hdr.name);
|
// DBG_8195A("Image%d: %s\n", imgnum, hdr.name);
|
||||||
break;
|
break;
|
||||||
|
@ -535,6 +535,8 @@ LOCAL uint8 BOOT_RAM_TEXT_SECTION IsForceLoadDefaultImg2(void) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern _LONG_CALL_ void RtlConsolTaskRom(void *Data);
|
||||||
|
|
||||||
/* RTL Console ROM */
|
/* RTL Console ROM */
|
||||||
LOCAL void BOOT_RAM_TEXT_SECTION RtlConsolRam(void) {
|
LOCAL void BOOT_RAM_TEXT_SECTION RtlConsolRam(void) {
|
||||||
// DiagPrintf("\r\nRTL Console ROM\r\n");
|
// DiagPrintf("\r\nRTL Console ROM\r\n");
|
||||||
|
@ -544,7 +546,7 @@ LOCAL void BOOT_RAM_TEXT_SECTION RtlConsolRam(void) {
|
||||||
pUartLogCtl->pTmpLogBuf->UARTLogBuf[0] = '?';
|
pUartLogCtl->pTmpLogBuf->UARTLogBuf[0] = '?';
|
||||||
pUartLogCtl->pTmpLogBuf->BufCount = 1;
|
pUartLogCtl->pTmpLogBuf->BufCount = 1;
|
||||||
pUartLogCtl->ExecuteCmd = 1;
|
pUartLogCtl->ExecuteCmd = 1;
|
||||||
RtlConsolTaskRom(pUartLogCtl);
|
RtlConsolTaskRom((void *) pUartLogCtl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enter Image 1.5 */
|
/* Enter Image 1.5 */
|
||||||
|
|
|
@ -26,6 +26,15 @@ extern void xPortPendSVHandler(void);
|
||||||
extern void xPortSysTickHandler(void);
|
extern void xPortSysTickHandler(void);
|
||||||
extern void vPortSVCHandler(void);
|
extern void vPortSVCHandler(void);
|
||||||
extern void rtl_libc_init(void);
|
extern void rtl_libc_init(void);
|
||||||
|
extern _LONG_CALL_ void HalCpuClkConfig(unsigned char CpuType);
|
||||||
|
extern void PSHalInitPlatformLogUart(void);
|
||||||
|
extern _LONG_CALL_ void UartLogCmdExecute(PUART_LOG_CTL pUartLogCtlExe);
|
||||||
|
extern void HalReInitPlatformTimer(void);
|
||||||
|
extern void SystemCoreClockUpdate (void);
|
||||||
|
extern void En32KCalibration(void);
|
||||||
|
extern void SdrCtrlInit(void);
|
||||||
|
extern void InitSoCPM(void);
|
||||||
|
extern u32 SdrControllerInit(void);
|
||||||
//extern void ShowRamBuildInfo(void); // app_start.c: VOID ShowRamBuildInfo(VOID)
|
//extern void ShowRamBuildInfo(void); // app_start.c: VOID ShowRamBuildInfo(VOID)
|
||||||
//void HalNMIHandler_Patch(void);
|
//void HalNMIHandler_Patch(void);
|
||||||
void SDIO_Device_Off(void);
|
void SDIO_Device_Off(void);
|
||||||
|
@ -97,7 +106,7 @@ __weak int main(void) {
|
||||||
DiagPrintf("\r<RTL>");
|
DiagPrintf("\r<RTL>");
|
||||||
while (1) {
|
while (1) {
|
||||||
while (pUartLogCtl->ExecuteCmd != 1);
|
while (pUartLogCtl->ExecuteCmd != 1);
|
||||||
UartLogCmdExecute(pUartLogCtl);
|
UartLogCmdExecute((PUART_LOG_CTL) pUartLogCtl);
|
||||||
DiagPrintf("\r<RTL>");
|
DiagPrintf("\r<RTL>");
|
||||||
pUartLogCtl->ExecuteCmd = 0;
|
pUartLogCtl->ExecuteCmd = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ HAL_Status HalSsiInitRtl8195a_Patch(VOID *Adaptor)
|
||||||
u32 IRQ_UNKNOWN = 999;
|
u32 IRQ_UNKNOWN = 999;
|
||||||
u32 Ctrlr0Value = 0;
|
u32 Ctrlr0Value = 0;
|
||||||
u32 Ctrlr1Value = 0;
|
u32 Ctrlr1Value = 0;
|
||||||
u32 SerValue = 0;
|
u32 SerValue;
|
||||||
u32 BaudrValue = 0;
|
u32 BaudrValue = 0;
|
||||||
u32 TxftlrValue = 0;
|
u32 TxftlrValue = 0;
|
||||||
u32 RxftlrValue = 0;
|
u32 RxftlrValue = 0;
|
||||||
|
@ -617,7 +617,7 @@ HAL_Status HalSsiSetFormatRtl8195a(VOID *Adaptor)
|
||||||
u32 RxftlrValue = 0;
|
u32 RxftlrValue = 0;
|
||||||
u8 Index = pHalSsiAdaptor->Index;
|
u8 Index = pHalSsiAdaptor->Index;
|
||||||
u8 Role = pHalSsiAdaptor->Role;
|
u8 Role = pHalSsiAdaptor->Role;
|
||||||
u32 Spi_mode = 0;
|
u32 Spi_mode;
|
||||||
|
|
||||||
if (Index > 2) {
|
if (Index > 2) {
|
||||||
DBG_SSI_ERR("HalSsiSetFormatRtl8195a: Invalid SSI Idx %d\r\n", Index);
|
DBG_SSI_ERR("HalSsiSetFormatRtl8195a: Invalid SSI Idx %d\r\n", Index);
|
||||||
|
@ -741,7 +741,7 @@ HAL_Status HalSsiIntReadRtl8195a(VOID *Adapter, VOID *RxData, u32 Length)
|
||||||
{
|
{
|
||||||
PHAL_SSI_ADAPTOR pHalSsiAdapter = (PHAL_SSI_ADAPTOR) Adapter;
|
PHAL_SSI_ADAPTOR pHalSsiAdapter = (PHAL_SSI_ADAPTOR) Adapter;
|
||||||
u32 RxFifoThresholdLevel;
|
u32 RxFifoThresholdLevel;
|
||||||
u8 Index = pHalSsiAdapter->Index;
|
// u8 Index = pHalSsiAdapter->Index;
|
||||||
|
|
||||||
DBG_SSI_INFO("HalSsiIntReadRtl8195a: Idx=%d, RxData=0x%x, Len=0x%x\r\n", Index, RxData, Length);
|
DBG_SSI_INFO("HalSsiIntReadRtl8195a: Idx=%d, RxData=0x%x, Len=0x%x\r\n", Index, RxData, Length);
|
||||||
// if (HalSsiBusyRtl8195a(Adapter)) {
|
// if (HalSsiBusyRtl8195a(Adapter)) {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "rtl8195a_uart.h"
|
#include "rtl8195a_uart.h"
|
||||||
#include "hal_uart.h"
|
#include "hal_uart.h"
|
||||||
#include "hal_gdma.h"
|
#include "hal_gdma.h"
|
||||||
|
#include "strproc.h"
|
||||||
|
|
||||||
u8
|
u8
|
||||||
HalRuartGetChipVerRtl8195a(VOID)
|
HalRuartGetChipVerRtl8195a(VOID)
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
|
|
||||||
#include "bitband_io.h"
|
#include "bitband_io.h"
|
||||||
|
//#include "rtl8195a_gpio.h"
|
||||||
|
|
||||||
|
#define BITBAND_ADDR(a,b) (0x02000000 + (a & 0xF0000000) + (a - (a & 0xF0000000)) * 32 + ((b) * 4)) // Convert address ?
|
||||||
|
|
||||||
volatile uint8_t * BitBandAddr(void *addr, uint8_t bit) {
|
volatile uint8_t * BitBandAddr(void *addr, uint8_t bit) {
|
||||||
return (volatile uint8_t *)(BITBAND_ADDR((u32)addr, bit));
|
uint32_t ret = BITBAND_ADDR((u32)addr, bit);
|
||||||
|
return (volatile uint8_t *) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile uint8_t * BitBandPeriAddr(void *addr, uint8_t bit) {
|
volatile uint8_t * BitBandPeriAddr(void *addr, uint8_t bit) {
|
||||||
|
@ -10,7 +14,7 @@ volatile uint8_t * BitBandPeriAddr(void *addr, uint8_t bit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile uint8_t * GetOutPinBitBandAddr(PinName pin) {
|
volatile uint8_t * GetOutPinBitBandAddr(PinName pin) {
|
||||||
uint32_t paddr = NULL;
|
volatile uint8_t * paddr = 0;
|
||||||
uint32_t ippin = HAL_GPIO_GetIPPinName_8195a(pin);
|
uint32_t ippin = HAL_GPIO_GetIPPinName_8195a(pin);
|
||||||
if(ippin < 0xff) {
|
if(ippin < 0xff) {
|
||||||
// paddr = 0x42000000 + (0x40001000 + 0x0c * (ippin >> 5) - 0x40000000) * 32 + ((ippin & 0x1f) * 4);
|
// paddr = 0x42000000 + (0x40001000 + 0x0c * (ippin >> 5) - 0x40000000) * 32 + ((ippin & 0x1f) * 4);
|
||||||
|
@ -29,6 +33,9 @@ volatile uint8_t * GetInPinBitBandAddr(PinName pin) {
|
||||||
return paddr;
|
return paddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern _LONG_CALL_ u32 GPIO_FuncOn_8195a(VOID);
|
||||||
|
extern void wait_us(int us);
|
||||||
|
|
||||||
volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val)
|
volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val)
|
||||||
{
|
{
|
||||||
volatile uint8_t *paddr = NULL;
|
volatile uint8_t *paddr = NULL;
|
||||||
|
@ -39,7 +46,8 @@ volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val)
|
||||||
_pHAL_Gpio_Adapter = &gBoot_Gpio_Adapter;
|
_pHAL_Gpio_Adapter = &gBoot_Gpio_Adapter;
|
||||||
}
|
}
|
||||||
if(_pHAL_Gpio_Adapter->Gpio_Func_En == 0) GPIO_FuncOn_8195a();
|
if(_pHAL_Gpio_Adapter->Gpio_Func_En == 0) GPIO_FuncOn_8195a();
|
||||||
delayMicroseconds(100);
|
wait_us(100);
|
||||||
|
// delayMicroseconds(100);
|
||||||
// paddr = 0x42000000 + (0x40001000 + 0x0c * (ippin >> 5) - 0x40000000) * 32 + ((ippin & 0x1f) * 4);
|
// paddr = 0x42000000 + (0x40001000 + 0x0c * (ippin >> 5) - 0x40000000) * 32 + ((ippin & 0x1f) * 4);
|
||||||
#if CONFIG_DEBUG_LOG > 3
|
#if CONFIG_DEBUG_LOG > 3
|
||||||
GpioFunctionChk(ippin, ENABLE);
|
GpioFunctionChk(ippin, ENABLE);
|
||||||
|
|
|
@ -34,7 +34,7 @@ void HalReInitPlatformTimer(void)
|
||||||
TimerAdapter.IrqDis = 1;
|
TimerAdapter.IrqDis = 1;
|
||||||
TimerAdapter.TimerId = 1;
|
TimerAdapter.TimerId = 1;
|
||||||
HalTimerOpInit_Patch(&HalTimerOp);
|
HalTimerOpInit_Patch(&HalTimerOp);
|
||||||
HAL_TIMER_OP x;
|
// HAL_TIMER_OP x;
|
||||||
HalTimerOp.HalTimerInit(&TimerAdapter);
|
HalTimerOp.HalTimerInit(&TimerAdapter);
|
||||||
HalTimerOp.HalTimerEn(1);
|
HalTimerOp.HalTimerEn(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ Sdr_Rand2(
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
extern __attribute__ ((long_call)) unsigned int Rand(void);
|
||||||
HAL_SDRC_TEXT_SECTION
|
HAL_SDRC_TEXT_SECTION
|
||||||
s32
|
s32
|
||||||
MemTest(
|
MemTest(
|
||||||
|
|
|
@ -541,7 +541,7 @@ VOID SleepPwrGatted(
|
||||||
u32 Rtemp = 0;
|
u32 Rtemp = 0;
|
||||||
u32 ScaleTemp = 0;
|
u32 ScaleTemp = 0;
|
||||||
u32 PeriodTemp = 0;
|
u32 PeriodTemp = 0;
|
||||||
u32 CalTemp = 0;
|
|
||||||
|
|
||||||
//Backup CPU CLK
|
//Backup CPU CLK
|
||||||
BackupCPUClk();
|
BackupCPUClk();
|
||||||
|
@ -553,7 +553,7 @@ VOID SleepPwrGatted(
|
||||||
//3 1.1 Set TU timer timescale
|
//3 1.1 Set TU timer timescale
|
||||||
//0x4000_0090[21:16] = 6'h1F
|
//0x4000_0090[21:16] = 6'h1F
|
||||||
//0x4000_0090[15] = 1'b0 => Disable timer
|
//0x4000_0090[15] = 1'b0 => Disable timer
|
||||||
CalTemp = (CLKCal(ANACK) << 16);
|
u32 CalTemp = (CLKCal(ANACK) << 16);
|
||||||
Rtemp = (HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_ANA_TIM_CTRL)
|
Rtemp = (HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_ANA_TIM_CTRL)
|
||||||
& (~((BIT_MASK_SYS_DSTDY_TIM_SCAL << BIT_SHIFT_SYS_DSTDY_TIM_SCAL) | (BIT_MASK_SYS_ANACK_TU_TIME << BIT_SHIFT_SYS_ANACK_TU_TIME))))
|
& (~((BIT_MASK_SYS_DSTDY_TIM_SCAL << BIT_SHIFT_SYS_DSTDY_TIM_SCAL) | (BIT_MASK_SYS_ANACK_TU_TIME << BIT_SHIFT_SYS_ANACK_TU_TIME))))
|
||||||
| ScaleTemp;
|
| ScaleTemp;
|
||||||
|
@ -608,7 +608,6 @@ DStandby(
|
||||||
u32 Rtemp = 0;
|
u32 Rtemp = 0;
|
||||||
u32 ScaleTemp = 0;
|
u32 ScaleTemp = 0;
|
||||||
u32 PeriodTemp = 0;
|
u32 PeriodTemp = 0;
|
||||||
u32 CalTemp = 0;
|
|
||||||
|
|
||||||
//Backup CPU CLK
|
//Backup CPU CLK
|
||||||
BackupCPUClk();
|
BackupCPUClk();
|
||||||
|
@ -621,7 +620,7 @@ DStandby(
|
||||||
//3 1.1 Set TU timer timescale
|
//3 1.1 Set TU timer timescale
|
||||||
//0x4000_0090[21:16] = 6'h1F
|
//0x4000_0090[21:16] = 6'h1F
|
||||||
//0x4000_0090[15] = 1'b0 => Disable timer
|
//0x4000_0090[15] = 1'b0 => Disable timer
|
||||||
CalTemp = (CLKCal(ANACK) << 16);
|
u32 CalTemp = (CLKCal(ANACK) << 16);
|
||||||
Rtemp = (HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_ANA_TIM_CTRL)
|
Rtemp = (HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_ANA_TIM_CTRL)
|
||||||
& (~((BIT_MASK_SYS_DSTDY_TIM_SCAL << BIT_SHIFT_SYS_DSTDY_TIM_SCAL) | (BIT_MASK_SYS_ANACK_TU_TIME << BIT_SHIFT_SYS_ANACK_TU_TIME))))
|
& (~((BIT_MASK_SYS_DSTDY_TIM_SCAL << BIT_SHIFT_SYS_DSTDY_TIM_SCAL) | (BIT_MASK_SYS_ANACK_TU_TIME << BIT_SHIFT_SYS_ANACK_TU_TIME))))
|
||||||
| ScaleTemp;
|
| ScaleTemp;
|
||||||
|
@ -679,7 +678,7 @@ DSleep(
|
||||||
u32 UTemp = 0;
|
u32 UTemp = 0;
|
||||||
u32 MaxTemp = 0;
|
u32 MaxTemp = 0;
|
||||||
|
|
||||||
u32 Reada335 = 0;
|
u32 Reada335;
|
||||||
|
|
||||||
//2 Deep Sleep mode:
|
//2 Deep Sleep mode:
|
||||||
//3 2.1 Set TU timer timescale
|
//3 2.1 Set TU timer timescale
|
||||||
|
|
|
@ -44,7 +44,7 @@ IN u8 EchoFlag);
|
||||||
//_LONG_CALL_ extern void UartLogCmdExecute(IN PUART_LOG_CTL pUartLogCtlExe);
|
//_LONG_CALL_ extern void UartLogCmdExecute(IN PUART_LOG_CTL pUartLogCtlExe);
|
||||||
//======================================================
|
//======================================================
|
||||||
extern PCOMMAND_TABLE UartLogRamCmdTable[];
|
extern PCOMMAND_TABLE UartLogRamCmdTable[];
|
||||||
extern UartLogRamCmdTableSize;
|
extern int UartLogRamCmdTableSize;
|
||||||
//======================================================
|
//======================================================
|
||||||
//<Function>: UartLogIrqHandleRam
|
//<Function>: UartLogIrqHandleRam
|
||||||
//<Usage >: To deal with Uart-Log RX IRQ
|
//<Usage >: To deal with Uart-Log RX IRQ
|
||||||
|
@ -61,7 +61,7 @@ void UartLogIrqHandleRam(void * Data) {
|
||||||
if (UartReceiveData == 0) {
|
if (UartReceiveData == 0) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
PUART_LOG_CTL p = pUartLogCtl;
|
PUART_LOG_CTL p = (PUART_LOG_CTL) pUartLogCtl;
|
||||||
//KB_ESC chk is for cmd history, it's a special case here.
|
//KB_ESC chk is for cmd history, it's a special case here.
|
||||||
if (UartReceiveData == KB_ASCII_ESC) {
|
if (UartReceiveData == KB_ASCII_ESC) {
|
||||||
// Esc detection is only valid in the first stage of boot sequence (few seconds)
|
// Esc detection is only valid in the first stage of boot sequence (few seconds)
|
||||||
|
@ -130,7 +130,7 @@ int GetArgvRam(IN u8 *pstr, u8** argv) {
|
||||||
int arvc = 0;
|
int arvc = 0;
|
||||||
// u8** argv = ArgvArray;
|
// u8** argv = ArgvArray;
|
||||||
u8* p = pstr;
|
u8* p = pstr;
|
||||||
u8 t, n = ' ';
|
u8 t = 0, n = ' ';
|
||||||
int m = 0;
|
int m = 0;
|
||||||
while(*p != 0
|
while(*p != 0
|
||||||
&& *p != '\r'
|
&& *p != '\r'
|
||||||
|
@ -200,7 +200,7 @@ int GetArgvRam(IN u8 *pstr, u8** argv) {
|
||||||
//<Notes >:
|
//<Notes >:
|
||||||
//======================================================
|
//======================================================
|
||||||
MON_RAM_TEXT_SECTION void RtlConsolTaskRam(void *Data) {
|
MON_RAM_TEXT_SECTION void RtlConsolTaskRam(void *Data) {
|
||||||
PUART_LOG_CTL p = pUartLogCtl;
|
PUART_LOG_CTL p = (PUART_LOG_CTL) pUartLogCtl;
|
||||||
#ifdef USE_ROM_CONSOLE // show Help
|
#ifdef USE_ROM_CONSOLE // show Help
|
||||||
p->pTmpLogBuf->UARTLogBuf[0] = '?';
|
p->pTmpLogBuf->UARTLogBuf[0] = '?';
|
||||||
p->pTmpLogBuf->BufCount = 1;
|
p->pTmpLogBuf->BufCount = 1;
|
||||||
|
@ -225,9 +225,9 @@ MON_RAM_TEXT_SECTION void RtlConsolTaskRam(void *Data) {
|
||||||
flg = 0;
|
flg = 0;
|
||||||
if(pcmd->ArgvCnt < argc) {
|
if(pcmd->ArgvCnt < argc) {
|
||||||
#ifdef USE_ROM_CONSOLE
|
#ifdef USE_ROM_CONSOLE
|
||||||
pcmd->func(argc-1, &ArgvArray[1]);
|
pcmd->func(argc-1, (char **) &ArgvArray[1]);
|
||||||
#else
|
#else
|
||||||
pcmd->func(argc, &ArgvArray);
|
pcmd->func(argc, (char **) &ArgvArray);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef USE_ROM_CONSOLE
|
#ifdef USE_ROM_CONSOLE
|
||||||
|
@ -291,7 +291,7 @@ MON_RAM_TEXT_SECTION void console_init(void) {
|
||||||
#endif
|
#endif
|
||||||
pUartLogCtl->RevdNo = UART_LOG_HISTORY_LEN;
|
pUartLogCtl->RevdNo = UART_LOG_HISTORY_LEN;
|
||||||
// Create a Semaphone
|
// Create a Semaphone
|
||||||
rtw_init_sema(&pUartLogCtl->Sema, 1);
|
rtw_init_sema((_sema *)&pUartLogCtl->Sema, 1);
|
||||||
// executing boot sequence
|
// executing boot sequence
|
||||||
pUartLogCtl->ExecuteCmd = _FALSE;
|
pUartLogCtl->ExecuteCmd = _FALSE;
|
||||||
pUartLogCtl->ExecuteEsc = _TRUE; //don't check Esc anymore
|
pUartLogCtl->ExecuteEsc = _TRUE; //don't check Esc anymore
|
||||||
|
@ -316,7 +316,7 @@ extern char str_rom_57ch3Dch0A[]; // "==========================================
|
||||||
_WEAK void console_help(int argc, char *argv[]) { // Help
|
_WEAK void console_help(int argc, char *argv[]) { // Help
|
||||||
DiagPrintf("CONSOLE COMMAND SET:\n");
|
DiagPrintf("CONSOLE COMMAND SET:\n");
|
||||||
DiagPrintf(&str_rom_57ch3Dch0A[25]); // DiagPrintf("==============================\n");
|
DiagPrintf(&str_rom_57ch3Dch0A[25]); // DiagPrintf("==============================\n");
|
||||||
PCOMMAND_TABLE pcmdtab = UartLogRamCmdTable;
|
PCOMMAND_TABLE pcmdtab = (PCOMMAND_TABLE) UartLogRamCmdTable;
|
||||||
while(pcmdtab->cmd) {
|
while(pcmdtab->cmd) {
|
||||||
#ifdef USE_ROM_CONSOLE
|
#ifdef USE_ROM_CONSOLE
|
||||||
DiagPrintf(pcmdtab->msg);
|
DiagPrintf(pcmdtab->msg);
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "platform_autoconf.h"
|
#include "platform_autoconf.h"
|
||||||
#include "sys_api.h"
|
#include "sys_api.h"
|
||||||
#include "sleep_ex_api.h"
|
#include "sleep_ex_api.h"
|
||||||
|
#include "us_ticker_api.h"
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ unsigned char generate_wakelock_stats = 0;
|
||||||
* @param expected_idle_time : The time that FreeRTOS expect to sleep.
|
* @param expected_idle_time : The time that FreeRTOS expect to sleep.
|
||||||
* If we set this value to 0 then FreeRTOS will do nothing in its sleep function.
|
* If we set this value to 0 then FreeRTOS will do nothing in its sleep function.
|
||||||
**/
|
**/
|
||||||
void freertos_pre_sleep_processing(unsigned int *expected_idle_time) {
|
void freertos_pre_sleep_processing(uint32_t *expected_idle_time) {
|
||||||
|
|
||||||
#ifdef CONFIG_SOC_PS_MODULE
|
#ifdef CONFIG_SOC_PS_MODULE
|
||||||
|
|
||||||
|
@ -150,7 +152,7 @@ void freertos_pre_sleep_processing(unsigned int *expected_idle_time) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void freertos_post_sleep_processing(unsigned int *expected_idle_time) {
|
void freertos_post_sleep_processing(uint32_t *expected_idle_time) {
|
||||||
#ifndef configSYSTICK_CLOCK_HZ
|
#ifndef configSYSTICK_CLOCK_HZ
|
||||||
*expected_idle_time = 1 + ( portNVIC_SYSTICK_CURRENT_VALUE_REG / ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) );
|
*expected_idle_time = 1 + ( portNVIC_SYSTICK_CURRENT_VALUE_REG / ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) );
|
||||||
#else
|
#else
|
||||||
|
@ -246,6 +248,10 @@ void pmu_enable_wakelock_stats(unsigned char enable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||||
|
|
||||||
|
extern int sprintf(char* str, const char* fmt, ...);
|
||||||
|
extern size_t strlen(const char *str);
|
||||||
|
//#define sprintf rtl_sprintf
|
||||||
void pmu_get_wakelock_hold_stats( char *pcWriteBuffer ) {
|
void pmu_get_wakelock_hold_stats( char *pcWriteBuffer ) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t current_timestamp = osKernelSysTick();
|
uint32_t current_timestamp = osKernelSysTick();
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "diag.h"
|
#include "diag.h"
|
||||||
#include "os_support.h"
|
#include "os_support.h"
|
||||||
#include "osdep_service.h"
|
#include "osdep_service.h"
|
||||||
|
#include "timers.h"
|
||||||
|
|
||||||
|
|
||||||
#define JIFFIES xTaskGetTickCount()
|
#define JIFFIES xTaskGetTickCount()
|
||||||
|
|
|
@ -105,6 +105,22 @@ extern _LONG_CALL_ double __rtl_dsub_v1_00(double a, double b);
|
||||||
extern _LONG_CALL_ double __rtl_dmul_v1_00(double a, double b);
|
extern _LONG_CALL_ double __rtl_dmul_v1_00(double a, double b);
|
||||||
extern _LONG_CALL_ double __rtl_ddiv_v1_00(double a, double b);
|
extern _LONG_CALL_ double __rtl_ddiv_v1_00(double a, double b);
|
||||||
|
|
||||||
|
// --- ???
|
||||||
|
extern _LONG_CALL_ float __rtl_dtof_v1_00(double d);
|
||||||
|
extern _LONG_CALL_ int __rtl_dtoui_v1_00(double d);
|
||||||
|
extern _LONG_CALL_ float __rtl_itof_v1_00(int val);
|
||||||
|
extern _LONG_CALL_ char *__rtl_ltoa_v1_00(int value, char *string, int radix);
|
||||||
|
extern _LONG_CALL_ char *__rtl_ultoa_v1_00(unsigned int value, char *string, int radix);
|
||||||
|
extern _LONG_CALL_ int __rtl_ftol_v1_00(float f);
|
||||||
|
extern _LONG_CALL_ int __rtl_ftod_v1_00(float f);
|
||||||
|
extern _LONG_CALL_ float __rtl_fadd_v1_00(float a, float b);
|
||||||
|
extern _LONG_CALL_ float __rtl_fsub_v1_00(float a, float b);
|
||||||
|
extern _LONG_CALL_ float __rtl_fmul_v1_00(float a, float b);
|
||||||
|
extern _LONG_CALL_ float __rtl_fdiv_v1_00(float a, float b);
|
||||||
|
extern _LONG_CALL_ int __rtl_dcmple_v1_00(double a, double b);
|
||||||
|
extern _LONG_CALL_ int __rtl_fcmplt_v1_00(float a, float b);
|
||||||
|
extern _LONG_CALL_ int __rtl_fcmpgt_v1_00(float a, float b);
|
||||||
|
// --- ???
|
||||||
|
|
||||||
//
|
//
|
||||||
// mprec
|
// mprec
|
||||||
|
|
|
@ -22,7 +22,9 @@
|
||||||
#define strsep __rtl_strsep_v1_00
|
#define strsep __rtl_strsep_v1_00
|
||||||
#define strtok __rtl_strtok_v1_00
|
#define strtok __rtl_strtok_v1_00
|
||||||
|
|
||||||
static char toupper(char ch) {
|
extern int isdigit (int c);
|
||||||
|
|
||||||
|
static int toupper(int ch) {
|
||||||
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
|
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1072,6 +1074,8 @@ int c_printf(const char *fmt, ...)
|
||||||
|
|
||||||
#endif // ENAC_FLOAT
|
#endif // ENAC_FLOAT
|
||||||
|
|
||||||
|
extern _LONG_CALL_ROM_ void HalSerialPutcRtl8195a(char c);
|
||||||
|
|
||||||
int puts (const char *s)
|
int puts (const char *s)
|
||||||
{
|
{
|
||||||
while(*s) {
|
while(*s) {
|
||||||
|
|
|
@ -170,7 +170,6 @@ int rtl_vprintf(const char *fmt, va_list param) {
|
||||||
int rtl_vsnprintf(char *str, size_t size, const char *fmt, va_list param) {
|
int rtl_vsnprintf(char *str, size_t size, const char *fmt, va_list param) {
|
||||||
int result;
|
int result;
|
||||||
int w;
|
int w;
|
||||||
int v11;
|
|
||||||
FILE f;
|
FILE f;
|
||||||
#if CHECK_LIBC_INIT
|
#if CHECK_LIBC_INIT
|
||||||
if (!libc_has_init) {
|
if (!libc_has_init) {
|
||||||
|
|
|
@ -122,6 +122,6 @@ void init_rom_libgloss_ram_map(void) {
|
||||||
rom_libgloss_ram_map.libgloss_open = ram_libgloss_open;
|
rom_libgloss_ram_map.libgloss_open = ram_libgloss_open;
|
||||||
rom_libgloss_ram_map.libgloss_read = ram_libgloss_read;
|
rom_libgloss_ram_map.libgloss_read = ram_libgloss_read;
|
||||||
rom_libgloss_ram_map.libgloss_write = ram_libgloss_write;
|
rom_libgloss_ram_map.libgloss_write = ram_libgloss_write;
|
||||||
rom_libgloss_ram_map.libgloss_sbrk = ram_libgloss_sbrk;
|
rom_libgloss_ram_map.libgloss_sbrk = (void*)ram_libgloss_sbrk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,6 @@ int vprintf(const char * fmt, __VALIST param) {
|
||||||
int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) {
|
int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) {
|
||||||
int result;
|
int result;
|
||||||
int w;
|
int w;
|
||||||
int v11;
|
|
||||||
FILE f;
|
FILE f;
|
||||||
#if CHECK_LIBC_INIT
|
#if CHECK_LIBC_INIT
|
||||||
if (!libc_has_init) {
|
if (!libc_has_init) {
|
||||||
|
@ -324,7 +323,7 @@ int sscanf(const char *buf, const char *fmt, ...) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
char toupper(char ch) {
|
int toupper(int ch) {
|
||||||
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
|
return ((ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "basic_types.h"
|
#include "basic_types.h"
|
||||||
|
#include "rt_lib_rom.h"
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// Function declarations
|
// Function declarations
|
||||||
|
|
|
@ -20,25 +20,28 @@ float rtl_sin_f32(float a);
|
||||||
// int __rtl_cos_f32_v1_00();
|
// int __rtl_cos_f32_v1_00();
|
||||||
// int __rtl_sin_f32_v1_00();
|
// int __rtl_sin_f32_v1_00();
|
||||||
|
|
||||||
|
extern _LONG_CALL_ float __rtl_fabsf_v1_00(float a);
|
||||||
//----- rtl_fabsf()
|
//----- rtl_fabsf()
|
||||||
float rtl_fabsf(float a)
|
float rtl_fabsf(float a)
|
||||||
{
|
{
|
||||||
return __rtl_fabsf_v1_00(a);
|
return __rtl_fabsf_v1_00(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern _LONG_CALL_ int __rtl_fabs_v1_00(double a);
|
||||||
//----- rtl_fabs()
|
//----- rtl_fabs()
|
||||||
int rtl_fabs(double a)
|
int rtl_fabs(double a)
|
||||||
{
|
{
|
||||||
return __rtl_fabs_v1_00(a);
|
return __rtl_fabs_v1_00(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern _LONG_CALL_ float __rtl_cos_f32_v1_00(float a);
|
||||||
//----- rtl_cos_f32()
|
//----- rtl_cos_f32()
|
||||||
float rtl_cos_f32(float a)
|
float rtl_cos_f32(float a)
|
||||||
{
|
{
|
||||||
return __rtl_cos_f32_v1_00(a);
|
return __rtl_cos_f32_v1_00(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern _LONG_CALL_ float __rtl_sin_f32_v1_00(float a);
|
||||||
//----- rtl_sin_f32()
|
//----- rtl_sin_f32()
|
||||||
float rtl_sin_f32(float a)
|
float rtl_sin_f32(float a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,9 +19,13 @@
|
||||||
# FLAGS
|
# FLAGS
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
CFLAGS = -DM3 -DCONFIG_PLATFORM_8195A -DGCC_ARMCM3 -DARDUINO_SDK -DF_CPU=166666666L -DNDEBUG
|
CFLAGS = -DM3 -DCONFIG_PLATFORM_8195A -DGCC_ARMCM3 -DARDUINO_SDK -DF_CPU=166666666L -DNDEBUG
|
||||||
CFLAGS += -mcpu=cortex-m3 -mthumb -g2 -Os -std=gnu99 -Wall -Werror -Wpedantic -Wextra
|
CFLAGS += -mcpu=cortex-m3 -mthumb -g2 -Os -std=gnu99
|
||||||
CFLAGS += -fno-common -fmessage-length=0 -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-short-enums -fsigned-char
|
CFLAGS += -fno-common -fmessage-length=0 -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-short-enums -fsigned-char
|
||||||
CFLAGS += -w -Wno-pointer-sign
|
CFLAGS += -Wall
|
||||||
|
CFLAGS += -Wno-old-style-declaration -Wno-pointer-sign -Wno-strict-aliasing
|
||||||
|
CFLAGS += -Wno-variadic-macros -Wno-empty-body
|
||||||
|
#CFLAGS += -Werror -Wpedantic -Wno-char-subscripts -Wno-unused-parameter
|
||||||
|
|
||||||
ifdef USE_GCC_LIB
|
ifdef USE_GCC_LIB
|
||||||
LFLAGS = -mcpu=cortex-m3 -mthumb -g -Os -nostartfiles --specs=nano.specs
|
LFLAGS = -mcpu=cortex-m3 -mthumb -g -Os -nostartfiles --specs=nano.specs
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# SDK CONFIG
|
# SDK CONFIG
|
||||||
#=============================================
|
#=============================================
|
||||||
#WEB_INA219_DRV = 1
|
#WEB_INA219_DRV = 1
|
||||||
WEB_ADC_DRV = 1
|
#WEB_ADC_DRV = 1
|
||||||
#USE_SDCARD = 1
|
#USE_SDCARD = 1
|
||||||
#USE_AT = 1
|
#USE_AT = 1
|
||||||
#USE_FATFS = 1
|
#USE_FATFS = 1
|
||||||
|
@ -69,5 +69,3 @@ ADD_SRC_C += project/src/web/web_int_callbacks.c
|
||||||
ADD_SRC_C += project/src/web/web_int_vars.c
|
ADD_SRC_C += project/src/web/web_int_vars.c
|
||||||
ADD_SRC_C += project/src/web/web_auth.c
|
ADD_SRC_C += project/src/web/web_auth.c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -134,8 +134,8 @@ extern uint32_t SystemCoreClock;
|
||||||
|
|
||||||
#if (__IASMARM__ != 1)
|
#if (__IASMARM__ != 1)
|
||||||
|
|
||||||
extern void freertos_pre_sleep_processing(unsigned int *expected_idle_time);
|
extern void freertos_pre_sleep_processing(uint32_t *expected_idle_time);
|
||||||
extern void freertos_post_sleep_processing(unsigned int *expected_idle_time);
|
extern void freertos_post_sleep_processing(uint32_t *expected_idle_time);
|
||||||
extern int freertos_ready_to_sleep();
|
extern int freertos_ready_to_sleep();
|
||||||
|
|
||||||
/* Enable tickless power saving. */
|
/* Enable tickless power saving. */
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
#ifndef _INC_FEEP_CONFIG_H_
|
#ifndef _INC_FEEP_CONFIG_H_
|
||||||
#define _INC_FEEP_CONFIG_H_
|
#define _INC_FEEP_CONFIG_H_
|
||||||
|
|
||||||
#define FEEP_ID_WIFI_CFG 0x5730 // id:'0W', type: struct wlan_fast_reconnect
|
//#define FEEP_ID_WIFI_CFG 0x4347 // id:'0W', type: struct wlan_fast_reconnect
|
||||||
#define FEEP_ID_WIFI_AP_CFG 0x5731 // id:'1W', type: struct rtw_wifi_config_t
|
//#define FEEP_ID_WIFI_AP_CFG 0x5041 // id:'1W', type: struct rtw_wifi_config_t
|
||||||
#define FEEP_ID_UART_CFG 0x5530 // id:'0U', type: UART_LOG_CONF
|
#define FEEP_ID_UART_CFG 0x5530 // id:'0U', type: UART_LOG_CONF
|
||||||
#define FEEP_ID_LWIP_CFG 0x4C30 // id:'0L', type: struct atcmd_lwip_conf
|
#define FEEP_ID_LWIP_CFG 0x4C30 // id:'0L', type: struct atcmd_lwip_conf
|
||||||
#define FEEP_ID_DHCP_CFG 0x4430 // id:'0D', type: struct _sdhcp_cfg
|
#define FEEP_ID_DHCP_CFG 0x4430 // id:'0D', type: struct _sdhcp_cfg
|
||||||
|
|
|
@ -185,6 +185,7 @@ a lot of data that needs to be copied, this should be set high. */
|
||||||
|
|
||||||
/* Support Multicast */
|
/* Support Multicast */
|
||||||
#define LWIP_IGMP 1
|
#define LWIP_IGMP 1
|
||||||
|
extern __attribute__ ((long_call)) unsigned int Rand(void);
|
||||||
#define LWIP_RAND() Rand()
|
#define LWIP_RAND() Rand()
|
||||||
|
|
||||||
/* Support TCP Keepalive */
|
/* Support TCP Keepalive */
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#define RTL8195A 1
|
#define RTL8195A 1
|
||||||
/* 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000? Hz,
|
/* 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000? Hz,
|
||||||
6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000? Hz */
|
6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000? Hz */
|
||||||
#define CONFIG_CPU_CLK 0
|
#define CONFIG_CPU_CLK 1
|
||||||
//166.6MHZ - RUN/IDLE/SLP ~63/21/6.4 mA
|
//166.6MHZ - RUN/IDLE/SLP ~63/21/6.4 mA
|
||||||
//83.3MHZ - RUN/IDLE/SLP ~55/15/6.4 mA
|
//83.3MHZ - RUN/IDLE/SLP ~55/15/6.4 mA
|
||||||
//41.6MHZ - RUN/IDLE ~51/11 mA
|
//41.6MHZ - RUN/IDLE ~51/11 mA
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#ifndef _INC_RTL_LIBC_
|
#ifndef _INC_RTL_LIBC_
|
||||||
#define _INC_RTL_LIBC_
|
#define _INC_RTL_LIBC_
|
||||||
|
|
||||||
//#undef malloc
|
#undef malloc
|
||||||
#define malloc(size) pvPortMalloc(size)
|
#define malloc(size) pvPortMalloc(size)
|
||||||
//#undef free
|
#undef free
|
||||||
#define free(pbuf) vPortFree(pbuf)
|
#define free(pbuf) vPortFree(pbuf)
|
||||||
|
|
||||||
#define atoi(str) prvAtoi(str)
|
#define atoi(str) prvAtoi(str)
|
||||||
|
|
|
@ -8,11 +8,12 @@
|
||||||
#define __TCP_SERV_CONN_H__
|
#define __TCP_SERV_CONN_H__
|
||||||
|
|
||||||
#include "user_config.h"
|
#include "user_config.h"
|
||||||
//#include "os_type.h"
|
#include "tcp.h"
|
||||||
|
|
||||||
#include "lwip/err.h"
|
#include "lwip/err.h"
|
||||||
|
|
||||||
#define mMIN(a, b) ((a < b)? a : b)
|
#define mMIN(a, b) ((a < b)? a : b)
|
||||||
|
#define mMAX(a, b) ((a>b)?a:b)
|
||||||
|
|
||||||
enum srvconn_state {
|
enum srvconn_state {
|
||||||
SRVCONN_NONE =0,
|
SRVCONN_NONE =0,
|
||||||
|
@ -178,8 +179,8 @@ err_t tcpsrv_close(TCP_SERV_CFG *p);
|
||||||
err_t tcpsrv_close_port(uint16 portn);
|
err_t tcpsrv_close_port(uint16 portn);
|
||||||
err_t tcpsrv_close_all(void);
|
err_t tcpsrv_close_all(void);
|
||||||
|
|
||||||
char * tspsrv_error_msg(err_t err);
|
const char * tspsrv_error_msg(err_t err);
|
||||||
char * tspsrv_tcp_state_msg(enum tcp_state state);
|
const char * tspsrv_tcp_state_msg(enum tcp_state state);
|
||||||
char * tspsrv_srvconn_state_msg(enum srvconn_state state);
|
const char * tspsrv_srvconn_state_msg(enum srvconn_state state);
|
||||||
|
|
||||||
#endif // __TCP_SERV_CONN_H__
|
#endif // __TCP_SERV_CONN_H__
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#ifndef _user_config_h_
|
#ifndef _user_config_h_
|
||||||
#define _user_config_h_
|
#define _user_config_h_
|
||||||
|
|
||||||
#define SYS_VERSION "1.0.0"
|
#define SYS_VERSION "1.0.1"
|
||||||
//#define SDK_VERSION "3.5.3"
|
|
||||||
#include "sdk_ver.h"
|
#include "sdk_ver.h"
|
||||||
|
|
||||||
#define USE_WEB 80 // включить в трансялцию порт Web, если =0 - по умолчанию выключен
|
#define USE_WEB 80 // включить в трансялцию порт Web, если =0 - по умолчанию выключен
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
err_t websock_tx_close_err(TCP_SERV_CONN *ts_conn, uint32 err);
|
err_t websock_tx_close_err(TCP_SERV_CONN *ts_conn, uint32 err);
|
||||||
bool websock_rx_data(TCP_SERV_CONN *ts_conn);
|
bool websock_rx_data(TCP_SERV_CONN *ts_conn);
|
||||||
|
err_t websock_tx_frame(TCP_SERV_CONN *ts_conn, uint32 opcode, uint8 *raw_data, uint32 raw_len);
|
||||||
|
|
||||||
#endif // WEBSOCKET_ENA
|
#endif // WEBSOCKET_ENA
|
||||||
#endif /* _WEB_WEBSOCKET_H_ */
|
#endif /* _WEB_WEBSOCKET_H_ */
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
//==== Interface 1 - wlan1 = STA ==========
|
//==== Interface 1 - wlan1 = STA ==========
|
||||||
#define DEF_ST_SSID "HOMEAP" // Имя SSID AP (роутера) для присоединения по умолчанию (первый старт)
|
#define DEF_ST_SSID "HOMEAP" // Имя SSID AP (роутера) для присоединения по умолчанию (первый старт)
|
||||||
#define DEF_ST_PASSWORD "0123456789" // Пароль AP (роутера) для присоединения по умолчанию (первый старт)
|
#define DEF_ST_PASSWORD "0123456789" // Пароль AP (роутера) для присоединения по умолчанию (первый старт)
|
||||||
#define DEF_ST_SECURITY RTW_SECURITY_WPA_WPA2_MIXED // Тип Security
|
#define DEF_ST_SECURITY RTW_ENCRYPTION_WPA2_MIXED // Тип Security
|
||||||
#define DEF_ST_BSSID { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } // If bssid set is not ff.ff.ff.ff.ff.ff,
|
#define DEF_ST_BSSID { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } // If bssid set is not ff.ff.ff.ff.ff.ff,
|
||||||
#define DEF_ST_USE_BSSID 0 // station will connect to the router with both ssid[] and bssid[] matched.
|
#define DEF_ST_USE_BSSID 0 // station will connect to the router with both ssid[] and bssid[] matched.
|
||||||
#define DEF_ST_CHANNEL 1 // 1..14
|
#define DEF_ST_CHANNEL 1 // 1..14
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
#include "hal_adc.h"
|
#include "hal_adc.h"
|
||||||
#include "analogin_api.h"
|
#include "analogin_api.h"
|
||||||
#include "timer_api.h"
|
#include "timer_api.h"
|
||||||
//#include "strproc.h"
|
|
||||||
|
|
||||||
#include "web_srv.h"
|
#include "web_srv.h"
|
||||||
#include "websock.h"
|
#include "websock.h"
|
||||||
|
#include "web_websocket.h"
|
||||||
#include "driver/adc_drv.h"
|
#include "driver/adc_drv.h"
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
|
|
||||||
|
@ -39,8 +39,14 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef CONFIG_MBED_ENABLED
|
#ifndef CONFIG_MBED_ENABLED
|
||||||
|
extern void *pvPortZalloc(size_t xWantedSize);
|
||||||
|
extern void vPortFree(void *pv);
|
||||||
|
extern void *pvPortMalloc(size_t xWantedSize);
|
||||||
|
#undef malloc
|
||||||
#define malloc pvPortMalloc
|
#define malloc pvPortMalloc
|
||||||
|
#undef zalloc
|
||||||
#define zalloc pvPortZalloc
|
#define zalloc pvPortZalloc
|
||||||
|
#undef free
|
||||||
#define free vPortFree
|
#define free vPortFree
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -65,8 +71,8 @@ typedef struct _adc_drv {
|
||||||
#endif
|
#endif
|
||||||
} ADC_DRV, *PADC_DRV;
|
} ADC_DRV, *PADC_DRV;
|
||||||
|
|
||||||
#define mMIN(a, b) ((a<b)?a:b)
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
#define mMAX(a, b) ((a>b)?a:b)
|
//#define mMAX(a, b) ((a>b)?a:b)
|
||||||
|
|
||||||
ADC_DRV adc_drv = {
|
ADC_DRV adc_drv = {
|
||||||
.buf_idx = (1460*2 - 80)/(sizeof(ADC_DATA)/2) // циклический буфер на ~1420 замеров (см. sizeof(ADC_DATA))
|
.buf_idx = (1460*2 - 80)/(sizeof(ADC_DATA)/2) // циклический буфер на ~1420 замеров (см. sizeof(ADC_DATA))
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "tcm_heap.h"
|
#include "tcm_heap.h"
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
|
|
||||||
|
#include "flash_api.h"
|
||||||
#include "sleep_ex_api.h"
|
#include "sleep_ex_api.h"
|
||||||
|
|
||||||
#include "lwip/tcp_impl.h"
|
#include "lwip/tcp_impl.h"
|
||||||
|
@ -36,12 +37,14 @@ void ShowMemInfo(void)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Mem, Tasks info
|
// Mem, Tasks info
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
LOCAL void fATST(int argc, char *argv[]) {
|
void fATST(int argc, char *argv[]) {
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
ShowMemInfo();
|
ShowMemInfo();
|
||||||
#if 0 //CONFIG_DEBUG_LOG > 1
|
#if 0 //CONFIG_DEBUG_LOG > 1
|
||||||
dump_mem_block_list();
|
dump_mem_block_list();
|
||||||
tcm_heap_dump();
|
tcm_heap_dump();
|
||||||
#endif;
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||||
char *cBuffer = pvPortMalloc(512);
|
char *cBuffer = pvPortMalloc(512);
|
||||||
|
@ -127,12 +130,12 @@ extern char str_rom_hex_addr[]; // in *.ld "[Addr] .0 .1 .2 .3 .4 .5 .6 .7 .8
|
||||||
void dump_bytes(uint32 addr, int size)
|
void dump_bytes(uint32 addr, int size)
|
||||||
{
|
{
|
||||||
uint8 buf[17];
|
uint8 buf[17];
|
||||||
u32 symbs_line = sizeof(buf)-1;
|
int symbs_line = sizeof(buf)-1;
|
||||||
printf(str_rom_hex_addr);
|
printf(str_rom_hex_addr);
|
||||||
while (size) {
|
while (size) {
|
||||||
if (symbs_line > size) symbs_line = size;
|
if (symbs_line > size) symbs_line = size;
|
||||||
printf("%08X ", addr);
|
printf("%08X ", addr);
|
||||||
copy_align4_to_align1(buf, addr, symbs_line);
|
copy_align4_to_align1(buf, (void *) addr, symbs_line);
|
||||||
print_hex_dump(buf, symbs_line, ' ');
|
print_hex_dump(buf, symbs_line, ' ');
|
||||||
int i;
|
int i;
|
||||||
for(i = 0 ; i < symbs_line ; i++) {
|
for(i = 0 ; i < symbs_line ; i++) {
|
||||||
|
@ -151,6 +154,12 @@ void dump_bytes(uint32 addr, int size)
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Dump byte register
|
// Dump byte register
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
extern u32 Strtoul(
|
||||||
|
IN const u8 *nptr,
|
||||||
|
IN u8 **endptr,
|
||||||
|
IN u32 base
|
||||||
|
);
|
||||||
|
|
||||||
LOCAL void fATSB(int argc, char *argv[])
|
LOCAL void fATSB(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int size = 16;
|
int size = 16;
|
||||||
|
@ -169,7 +178,8 @@ LOCAL void fATSB(int argc, char *argv[])
|
||||||
dump_bytes(addr, size);
|
dump_bytes(addr, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
extern u32 CmdDumpWord(IN u16 argc, IN u8 *argv[]);
|
||||||
|
extern u32 CmdWriteWord(IN u16 argc, IN u8 *argv[]);
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Dump dword register
|
// Dump dword register
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -280,6 +290,7 @@ void print_tcp_pcb(void)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
LOCAL void fATLW(int argc, char *argv[]) // Info Lwip
|
LOCAL void fATLW(int argc, char *argv[]) // Info Lwip
|
||||||
{
|
{
|
||||||
|
(void) argc; (void) argv;
|
||||||
print_udp_pcb();
|
print_udp_pcb();
|
||||||
print_tcp_pcb();
|
print_tcp_pcb();
|
||||||
}
|
}
|
||||||
|
@ -289,6 +300,7 @@ LOCAL void fATLW(int argc, char *argv[]) // Info Lwip
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
LOCAL void fATGI(int argc, char *argv[])
|
LOCAL void fATGI(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
(void) argc; (void) argv;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < _PORT_MAX; i++)
|
for (i = 0; i < _PORT_MAX; i++)
|
||||||
printf("Port %c state: 0x%04x\n", i + 'A', GPIOState[i]);
|
printf("Port %c state: 0x%04x\n", i + 'A', GPIOState[i]);
|
||||||
|
|
|
@ -198,8 +198,10 @@ LOCAL void fATWI(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint8_t rtw_power_percentage_idx;
|
extern uint8_t rtw_power_percentage_idx;
|
||||||
|
extern int rltk_set_tx_power_percentage(rtw_tx_pwr_percentage_t power_percentage_idx);
|
||||||
|
|
||||||
LOCAL void fATWT(int argc, char *argv[]) {
|
void fATWT(int argc, char *argv[]) {
|
||||||
|
(void) argc; (void) argv;
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
int txpwr = atoi(argv[1]);
|
int txpwr = atoi(argv[1]);
|
||||||
debug_printf("set tx power (%d)...\n", txpwr);
|
debug_printf("set tx power (%d)...\n", txpwr);
|
||||||
|
@ -212,7 +214,10 @@ LOCAL void fATWT(int argc, char *argv[]) {
|
||||||
|
|
||||||
//-- Test tsf (64-bits counts, 1 us step) ---
|
//-- Test tsf (64-bits counts, 1 us step) ---
|
||||||
|
|
||||||
#include "hal_com_reg.h"
|
//#include "hal_com_reg.h"
|
||||||
|
#define WIFI_REG_BASE 0x40080000
|
||||||
|
#define REG_TSFTR 0x0560
|
||||||
|
#define REG_TSFTR1 0x0568 // HW Port 1 TSF Register
|
||||||
|
|
||||||
#define ReadTSF_Lo32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR)))
|
#define ReadTSF_Lo32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR)))
|
||||||
#define ReadTSF_Hi32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR1)))
|
#define ReadTSF_Hi32() (*((volatile unsigned int *)(WIFI_REG_BASE + REG_TSFTR1)))
|
||||||
|
@ -222,13 +227,15 @@ LOCAL uint64_t get_tsf(void)
|
||||||
return *((uint64_t *)(WIFI_REG_BASE + REG_TSFTR));
|
return *((uint64_t *)(WIFI_REG_BASE + REG_TSFTR));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCAL void fATSF(int argc, char *argv[])
|
void fATSF(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
(void) argc; (void) argv;
|
||||||
uint64_t tsf = get_tsf();
|
uint64_t tsf = get_tsf();
|
||||||
printf("\nTSF: %08x%08x\n", (uint32_t)(tsf>>32), (uint32_t)(tsf));
|
printf("\nTSF: %08x%08x\n", (uint32_t)(tsf>>32), (uint32_t)(tsf));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCAL void fATWP(int argc, char *argv[]) {
|
void fATWP(int argc, char *argv[]) {
|
||||||
|
(void) argc; (void) argv;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
x = atoi(argv[1]);
|
x = atoi(argv[1]);
|
||||||
|
@ -248,7 +255,7 @@ LOCAL void fATWP(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* -------- WiFi Scan ------------------------------- */
|
/* -------- WiFi Scan ------------------------------- */
|
||||||
LOCAL void scan_result_handler(internal_scan_handler_t* ap_scan_result)
|
LOCAL rtw_result_t scan_result_handler(internal_scan_handler_t* ap_scan_result)
|
||||||
{
|
{
|
||||||
if (ap_scan_result) {
|
if (ap_scan_result) {
|
||||||
if(ap_scan_result->scan_cnt) {
|
if(ap_scan_result->scan_cnt) {
|
||||||
|
@ -274,10 +281,13 @@ LOCAL void scan_result_handler(internal_scan_handler_t* ap_scan_result)
|
||||||
} else {
|
} else {
|
||||||
printf("Scan networks: None!\n");
|
printf("Scan networks: None!\n");
|
||||||
}
|
}
|
||||||
|
return RTW_SUCCESS;
|
||||||
}
|
}
|
||||||
/* -------- WiFi Scan ------------------------------- */
|
/* -------- WiFi Scan ------------------------------- */
|
||||||
LOCAL void fATSN(int argc, char *argv[])
|
void fATSN(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
api_wifi_scan(scan_result_handler);
|
api_wifi_scan(scan_result_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
*/
|
*/
|
||||||
#include <platform_opts.h>
|
#include <platform_opts.h>
|
||||||
#include "rtl8195a.h"
|
#include "rtl8195a.h"
|
||||||
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
#if 1
|
#if 1
|
||||||
#include "drv_types.h" // or #include "wlan_lib.h"
|
#include "drv_types.h" // or #include "wlan_lib.h"
|
||||||
#else
|
#else
|
||||||
|
@ -18,11 +20,12 @@
|
||||||
//#include "hal_diag.h"
|
//#include "hal_diag.h"
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
|
|
||||||
extern void dump_bytes(uint32 addr, int size);
|
void dump_bytes(uint32 addr, int size);
|
||||||
extern Rltk_wlan_t rltk_wlan_info[2]; // in wrapper.h
|
extern Rltk_wlan_t rltk_wlan_info[2]; // in wrapper.h
|
||||||
|
|
||||||
LOCAL void tst_wlan_struct(int argc, char *argv[])
|
LOCAL void tst_wlan_struct(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
(void) argc; (void) argv;
|
||||||
printf("Test: sizeof(struct _ADAPTER) = %d\n", sizeof(struct _ADAPTER)); //6088
|
printf("Test: sizeof(struct _ADAPTER) = %d\n", sizeof(struct _ADAPTER)); //6088
|
||||||
printf("mlmeextpriv\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv)); //+1256
|
printf("mlmeextpriv\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv)); //+1256
|
||||||
printf("TSFValue\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv.TSFValue)); //+1992
|
printf("TSFValue\t+%d\n", offsetof(struct _ADAPTER, mlmeextpriv.TSFValue)); //+1992
|
||||||
|
|
|
@ -32,9 +32,16 @@
|
||||||
#define ts_printf(...) rtl_printf(__VA_ARGS__)
|
#define ts_printf(...) rtl_printf(__VA_ARGS__)
|
||||||
#define system_get_free_heap_size xPortGetFreeHeapSize
|
#define system_get_free_heap_size xPortGetFreeHeapSize
|
||||||
|
|
||||||
|
extern void *pvPortZalloc(size_t xWantedSize);
|
||||||
|
extern void vPortFree(void *pv);
|
||||||
|
extern void *pvPortMalloc(size_t xWantedSize);
|
||||||
|
#undef os_free
|
||||||
#define os_free(p) vPortFree(p)
|
#define os_free(p) vPortFree(p)
|
||||||
|
#undef os_malloc
|
||||||
#define os_malloc(p) pvPortMalloc(p)
|
#define os_malloc(p) pvPortMalloc(p)
|
||||||
|
#undef os_zalloc
|
||||||
#define os_zalloc(p) pvPortZalloc(p)
|
#define os_zalloc(p) pvPortZalloc(p)
|
||||||
|
#undef os_realloc
|
||||||
#define os_realloc(p,s) pvPortReAlloc(p,s)
|
#define os_realloc(p,s) pvPortReAlloc(p,s)
|
||||||
/*
|
/*
|
||||||
extern __rtl_memsetw_v1_00(void *, uint32, size_t);
|
extern __rtl_memsetw_v1_00(void *, uint32, size_t);
|
||||||
|
@ -55,16 +62,16 @@ const uint8 txt_tcpsrv_already_initialized[] TCP_SRV_RODATA_ATTR = "tcpsrv: alre
|
||||||
const uint8 txt_tcpsrv_out_of_mem[] TCP_SRV_RODATA_ATTR = "tcpsrv: out of mem!\n";
|
const uint8 txt_tcpsrv_out_of_mem[] TCP_SRV_RODATA_ATTR = "tcpsrv: out of mem!\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define mMIN(a, b) ((a<b)?a:b)
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
// пред.описание...
|
// пред.описание...
|
||||||
static void tcpsrv_list_delete(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
static void tcpsrv_list_delete(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
||||||
static void tcpsrv_disconnect_successful(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
static void tcpsrv_disconnect_successful(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
||||||
static void tcpsrv_server_close(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
static void tcpsrv_server_close(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
||||||
static err_t tcpsrv_poll(void *arg, struct tcp_pcb *pcb) TCP_SRV_CODE_ATTR;
|
static err_t tcpsrv_poll(void *arg, struct tcp_pcb *pcb) TCP_SRV_CODE_ATTR;
|
||||||
static void tcpsrv_error(void *arg, err_t err) TCP_SRV_CODE_ATTR;
|
static void tcpsrv_error(void *arg, err_t err) TCP_SRV_CODE_ATTR;
|
||||||
static err_t tcpsrv_connected(void *arg, struct tcp_pcb *tpcb, err_t err) TCP_SRV_CODE_ATTR;
|
//err_t tcpsrv_connected(void *arg, struct tcp_pcb *tpcb, err_t err) TCP_SRV_CODE_ATTR;
|
||||||
static err_t tcpsrv_client_connect(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
//err_t tcpsrv_client_connect(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
||||||
static void tcpsrv_client_reconnect(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
//void tcpsrv_client_reconnect(TCP_SERV_CONN * ts_conn) TCP_SRV_CODE_ATTR;
|
||||||
|
|
||||||
#ifndef LWIP_DEBUG
|
#ifndef LWIP_DEBUG
|
||||||
#include "lwip/init.h"
|
#include "lwip/init.h"
|
||||||
|
@ -90,6 +97,7 @@ static const char *err_strerr[] = {
|
||||||
"Low-level netif error", /* ERR_IF -15 */
|
"Low-level netif error", /* ERR_IF -15 */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char srvContenErrX[] = "?";
|
static const char srvContenErrX[] = "?";
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* FunctionName : tspsrv_error_msg
|
* FunctionName : tspsrv_error_msg
|
||||||
|
@ -97,7 +105,7 @@ static const char srvContenErrX[] = "?";
|
||||||
* Parameters : LwIP err
|
* Parameters : LwIP err
|
||||||
* Returns : указатель на строку ошибки
|
* Returns : указатель на строку ошибки
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
char * tspsrv_error_msg(err_t err)
|
const char * tspsrv_error_msg(err_t err)
|
||||||
{
|
{
|
||||||
if((err > -16) && (err < 1)) {
|
if((err > -16) && (err < 1)) {
|
||||||
return lwip_strerr(err);
|
return lwip_strerr(err);
|
||||||
|
@ -112,7 +120,7 @@ extern const char * const tcp_state_str[];
|
||||||
* Parameters : LwIP tcp_state
|
* Parameters : LwIP tcp_state
|
||||||
* Returns : указатель на строку
|
* Returns : указатель на строку
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
char * tspsrv_tcp_state_msg(enum tcp_state state)
|
const char * tspsrv_tcp_state_msg(enum tcp_state state)
|
||||||
{
|
{
|
||||||
if(state > TIME_WAIT && state < CLOSED) return srvContenErrX;
|
if(state > TIME_WAIT && state < CLOSED) return srvContenErrX;
|
||||||
return tcp_state_str[state];
|
return tcp_state_str[state];
|
||||||
|
@ -123,17 +131,18 @@ char * tspsrv_tcp_state_msg(enum tcp_state state)
|
||||||
* Parameters : LwIP tcp_state
|
* Parameters : LwIP tcp_state
|
||||||
* Returns : указатель на строку
|
* Returns : указатель на строку
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static char *msg_srvconn_state[] = {
|
static const char *msg_srvconn_state[] = {
|
||||||
"NONE",
|
"NONE",
|
||||||
"CLOSEWAIT",
|
"CLOSEWAIT",
|
||||||
"LISTEN",
|
"LISTEN",
|
||||||
"CONNECT",
|
"CONNECT",
|
||||||
"CLOSED"
|
"CLOSED"
|
||||||
};
|
};
|
||||||
char * tspsrv_srvconn_state_msg(enum srvconn_state state)
|
|
||||||
|
const char * tspsrv_srvconn_state_msg(enum srvconn_state state)
|
||||||
{
|
{
|
||||||
if(state > SRVCONN_CLOSED && state < SRVCONN_NONE) return srvContenErrX;
|
if(state > SRVCONN_CLOSED && state < SRVCONN_NONE) return (const char *) srvContenErrX;
|
||||||
return msg_srvconn_state[state];
|
return (const char *) msg_srvconn_state[state];
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -11,12 +11,13 @@
|
||||||
#include "hal_log_uart.h"
|
#include "hal_log_uart.h"
|
||||||
#include "hal_misc.h"
|
#include "hal_misc.h"
|
||||||
#include "diag.h"
|
#include "diag.h"
|
||||||
//#include "wdt_api.h"
|
#include "tcm_heap.h"
|
||||||
//#include <osdep_service.h>
|
|
||||||
#include "hal_platform.h"
|
#include "hal_platform.h"
|
||||||
#include "rtl8195a_sys_on.h"
|
#include "rtl8195a_sys_on.h"
|
||||||
|
#include "hal_timer.h"
|
||||||
|
|
||||||
#ifdef CONFIG_WDG_ON_IDLE
|
#ifdef CONFIG_WDG_ON_IDLE
|
||||||
|
#include "rtl8195a_wdt.h"
|
||||||
#include "hal_peri_on.h"
|
#include "hal_peri_on.h"
|
||||||
#include "rtl8195a_peri_on.h"
|
#include "rtl8195a_peri_on.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,6 +42,7 @@ const unsigned char cus_sig[32] = "WEB Sample";
|
||||||
#define CONFIG_INTERACTIVE_MODE 1
|
#define CONFIG_INTERACTIVE_MODE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern VOID WDGStart(VOID);
|
||||||
extern void user_init_thrd(void);
|
extern void user_init_thrd(void);
|
||||||
|
|
||||||
/* RAM/TCM/Heaps info */
|
/* RAM/TCM/Heaps info */
|
||||||
|
@ -51,7 +53,7 @@ void ShowMemInfo(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* main */
|
/* main */
|
||||||
void main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
#if DEBUG_MAIN_LEVEL > 3
|
#if DEBUG_MAIN_LEVEL > 3
|
||||||
ConfigDebugErr = -1;
|
ConfigDebugErr = -1;
|
||||||
|
|
|
@ -58,6 +58,7 @@ void sys_write_cfg(void)
|
||||||
flash_write_cfg(&syscfg, FEEP_ID_SYS_CFG, sizeof(syscfg));
|
flash_write_cfg(&syscfg, FEEP_ID_SYS_CFG, sizeof(syscfg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void console_init(void);
|
||||||
|
|
||||||
void user_init_thrd(void) {
|
void user_init_thrd(void) {
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "diag.h"
|
#include "diag.h"
|
||||||
|
#include "tcm_heap.h"
|
||||||
#include "lwip/tcp.h"
|
#include "lwip/tcp.h"
|
||||||
#include "flash_eep.h"
|
#include "flash_eep.h"
|
||||||
#include "device_lock.h"
|
#include "device_lock.h"
|
||||||
|
@ -49,9 +50,10 @@
|
||||||
#include "overlay.h"
|
#include "overlay.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef atoi
|
||||||
#define atoi rom_atoi
|
#define atoi rom_atoi
|
||||||
|
|
||||||
#define mMIN(a, b) ((a<b)?a:b)
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
#define ifcmp(a) if(rom_xstrcmp(cstr, a))
|
#define ifcmp(a) if(rom_xstrcmp(cstr, a))
|
||||||
|
|
||||||
#define OpenFlash() { device_mutex_lock(RT_DEV_LOCK_FLASH); flash_turnon(); }
|
#define OpenFlash() { device_mutex_lock(RT_DEV_LOCK_FLASH); flash_turnon(); }
|
||||||
|
@ -127,6 +129,7 @@ void ICACHE_FLASH_ATTR web_test_adc(TCP_SERV_CONN *ts_conn)
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
// WiFi Scan XML
|
// WiFi Scan XML
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
extern void wifi_set_timer_scan(int ms);
|
||||||
LOCAL void ICACHE_FLASH_ATTR web_wscan_xml(TCP_SERV_CONN *ts_conn)
|
LOCAL void ICACHE_FLASH_ATTR web_wscan_xml(TCP_SERV_CONN *ts_conn)
|
||||||
{
|
{
|
||||||
WEB_SRV_CONN *web_conn = (WEB_SRV_CONN *) ts_conn->linkd;
|
WEB_SRV_CONN *web_conn = (WEB_SRV_CONN *) ts_conn->linkd;
|
||||||
|
@ -489,7 +492,7 @@ extern int adc_ws(TCP_SERV_CONN *ts_conn, char cmd);
|
||||||
else ifcmp("wifi_") {
|
else ifcmp("wifi_") {
|
||||||
cstr+=5;
|
cstr+=5;
|
||||||
ifcmp("rdcfg") read_wifi_cfg(-1);
|
ifcmp("rdcfg") read_wifi_cfg(-1);
|
||||||
else ifcmp("newcfg") webserver_qfn((web_ex_func_cb)wifi_run, (void *)wifi_cfg.mode, 200);
|
else ifcmp("newcfg") webserver_qfn((web_ex_func_cb)wifi_run, (void *)((uint32)wifi_cfg.mode), 200);
|
||||||
else ifcmp("cmode") tcp_puts("%d", wifi_mode);
|
else ifcmp("cmode") tcp_puts("%d", wifi_mode);
|
||||||
else ifcmp("mode") tcp_puts("%d", wifi_cfg.mode);
|
else ifcmp("mode") tcp_puts("%d", wifi_cfg.mode);
|
||||||
else ifcmp("bgn") tcp_puts("%d", wifi_cfg.bgn);
|
else ifcmp("bgn") tcp_puts("%d", wifi_cfg.bgn);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "ethernetif.h"
|
#include "ethernetif.h"
|
||||||
#include "web_srv_int.h"
|
#include "web_srv_int.h"
|
||||||
#include "web_utils.h"
|
#include "web_utils.h"
|
||||||
|
#include "webfs/webfs.h"
|
||||||
#include "flash_eep.h"
|
#include "flash_eep.h"
|
||||||
#include "device_lock.h"
|
#include "device_lock.h"
|
||||||
#include "rtl8195a/rtl_libc.h"
|
#include "rtl8195a/rtl_libc.h"
|
||||||
|
@ -63,6 +64,7 @@ extern void web_hexdump(TCP_SERV_CONN *ts_conn);
|
||||||
#define ifcmp(a) if(rom_xstrcmp(cstr, a))
|
#define ifcmp(a) if(rom_xstrcmp(cstr, a))
|
||||||
|
|
||||||
extern int rom_atoi(const char *);
|
extern int rom_atoi(const char *);
|
||||||
|
#undef atoi
|
||||||
#define atoi rom_atoi
|
#define atoi rom_atoi
|
||||||
|
|
||||||
typedef uint32 (* call_func)(uint32 a, uint32 b, uint32 c);
|
typedef uint32 (* call_func)(uint32 a, uint32 b, uint32 c);
|
||||||
|
@ -119,7 +121,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
||||||
cstr += 4;
|
cstr += 4;
|
||||||
ifcmp("port") {
|
ifcmp("port") {
|
||||||
if(syscfg.web_port != val) {
|
if(syscfg.web_port != val) {
|
||||||
webserver_qfn((web_ex_func_cb)webserver_reinit, (void *)syscfg.web_port, 200);
|
webserver_qfn((web_ex_func_cb)webserver_reinit, (void *)((uint32)syscfg.web_port), 200);
|
||||||
syscfg.web_port = val;
|
syscfg.web_port = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +191,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
||||||
cstr+=5;
|
cstr+=5;
|
||||||
ifcmp("scan") api_wifi_scan(NULL);
|
ifcmp("scan") api_wifi_scan(NULL);
|
||||||
else ifcmp("rdcfg") web_conn->udata_stop = read_wifi_cfg(val);
|
else ifcmp("rdcfg") web_conn->udata_stop = read_wifi_cfg(val);
|
||||||
else ifcmp("newcfg") webserver_qfn((web_ex_func_cb)wifi_run, (void *)wifi_cfg.mode, 200);
|
else ifcmp("newcfg") webserver_qfn((web_ex_func_cb)wifi_run, (void *)((uint32) wifi_cfg.mode), 200);
|
||||||
else ifcmp("mode") wifi_cfg.mode = val;
|
else ifcmp("mode") wifi_cfg.mode = val;
|
||||||
else ifcmp("bgn") wifi_cfg.bgn = val;
|
else ifcmp("bgn") wifi_cfg.bgn = val;
|
||||||
else ifcmp("lflg") wifi_cfg.load_flg = val;
|
else ifcmp("lflg") wifi_cfg.load_flg = val;
|
||||||
|
@ -246,7 +248,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
||||||
if(wifi_cfg.save_flg & BID_AP_HOSTNAME) {
|
if(wifi_cfg.save_flg & BID_AP_HOSTNAME) {
|
||||||
WEB_SRV_QFNK x;
|
WEB_SRV_QFNK x;
|
||||||
x.fnc = write_wifi_cfg;
|
x.fnc = write_wifi_cfg;
|
||||||
x.param = BID_AP_HOSTNAME;
|
x.param = (void *)BID_AP_HOSTNAME;
|
||||||
xQueueSendToBack(xQueueWebSrv, &x, 0);
|
xQueueSendToBack(xQueueWebSrv, &x, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,7 +305,7 @@ void ICACHE_FLASH_ATTR web_int_vars(TCP_SERV_CONN *ts_conn, uint8 *pcmd, uint8 *
|
||||||
if(wifi_cfg.save_flg & BID_ST_HOSTNAME) {
|
if(wifi_cfg.save_flg & BID_ST_HOSTNAME) {
|
||||||
WEB_SRV_QFNK x;
|
WEB_SRV_QFNK x;
|
||||||
x.fnc = write_wifi_cfg;
|
x.fnc = write_wifi_cfg;
|
||||||
x.param = BID_ST_HOSTNAME;
|
x.param = (void *)BID_ST_HOSTNAME;
|
||||||
x.pause_ms = 0;
|
x.pause_ms = 0;
|
||||||
xQueueSendToBack(xQueueWebSrv, &x, 0);
|
xQueueSendToBack(xQueueWebSrv, &x, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,9 @@
|
||||||
|
|
||||||
#define max_len_buf_write_flash 2048 // размер буфера при записи flash. Увеличение/уменньшение размера (до сектора 4096) ускорения не дает (1..2%)
|
#define max_len_buf_write_flash 2048 // размер буфера при записи flash. Увеличение/уменньшение размера (до сектора 4096) ускорения не дает (1..2%)
|
||||||
|
|
||||||
#define mMIN(a, b) ((a<b)?a:b)
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
#define mMAX(a, b) ((a>b)?a:b)
|
//#define mMAX(a, b) ((a>b)?a:b)
|
||||||
|
#undef atoi
|
||||||
#define atoi(s) rom_atoi(s)
|
#define atoi(s) rom_atoi(s)
|
||||||
|
|
||||||
LOCAL void web_print_headers(HTTP_CONN *CurHTTP, TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR ;
|
LOCAL void web_print_headers(HTTP_CONN *CurHTTP, TCP_SERV_CONN *ts_conn) ICACHE_FLASH_ATTR ;
|
||||||
|
@ -854,7 +854,7 @@ LOCAL void ICACHE_FLASH_ATTR web_send_fnohanle(TCP_SERV_CONN *ts_conn) {
|
||||||
}
|
}
|
||||||
if(pdata != 0 && size != 0) {
|
if(pdata != 0 && size != 0) {
|
||||||
// spi_flash_read(pdata & MASK_ADDR_FLASH_ICACHE_DATA, pbuf, size);
|
// spi_flash_read(pdata & MASK_ADDR_FLASH_ICACHE_DATA, pbuf, size);
|
||||||
tcpsrv_int_sent_data(ts_conn, pdata, size);
|
tcpsrv_int_sent_data(ts_conn, (uint8 *) pdata, size);
|
||||||
}
|
}
|
||||||
#if DEBUGSOO > 1
|
#if DEBUGSOO > 1
|
||||||
os_printf("%u ", size);
|
os_printf("%u ", size);
|
||||||
|
@ -864,7 +864,7 @@ LOCAL void ICACHE_FLASH_ATTR web_send_fnohanle(TCP_SERV_CONN *ts_conn) {
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
LOCAL int ICACHE_FLASH_ATTR web_find_cbs(uint8 * chrbuf, uint32 len) {
|
LOCAL int ICACHE_FLASH_ATTR web_find_cbs(uint8 * chrbuf, uint32 len) {
|
||||||
int i;
|
uint32 i;
|
||||||
for(i = 0; i < len; i++) if(chrbuf[i] == '~') return i;
|
for(i = 0; i < len; i++) if(chrbuf[i] == '~') return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1442,7 +1442,7 @@ LOCAL int ICACHE_FLASH_ATTR upload_boundary(TCP_SERV_CONN *ts_conn) // HTTP_UPLO
|
||||||
#if DEBUGSOO > 2
|
#if DEBUGSOO > 2
|
||||||
os_printf("Write flash addr:%p[0x%04x]\n", pupload->faddr, block_size);
|
os_printf("Write flash addr:%p[0x%04x]\n", pupload->faddr, block_size);
|
||||||
#endif
|
#endif
|
||||||
flash_stream_write(&flashobj, pupload->faddr, (block_size + 3)&(~3), (uint32 *)pstr);
|
flash_stream_write(&flashobj, pupload->faddr, (block_size + 3)&(~3), (uint8_t *)pstr);
|
||||||
|
|
||||||
device_mutex_unlock(RT_DEV_LOCK_FLASH);
|
device_mutex_unlock(RT_DEV_LOCK_FLASH);
|
||||||
|
|
||||||
|
@ -1938,6 +1938,8 @@ void qfnk_task(void)
|
||||||
WEB_SRV_QFNK qfn;
|
WEB_SRV_QFNK qfn;
|
||||||
WEB_SRV_QFNK qfnt;
|
WEB_SRV_QFNK qfnt;
|
||||||
TickType_t timetick;
|
TickType_t timetick;
|
||||||
|
qfnt.fnc = NULL;
|
||||||
|
qfnt.pause_ms = 0;
|
||||||
while(1) {
|
while(1) {
|
||||||
if(xQueueReceive(xQueueWebSrv, &qfn, 5) == pdPASS) { // portMAX_DELAY
|
if(xQueueReceive(xQueueWebSrv, &qfn, 5) == pdPASS) { // portMAX_DELAY
|
||||||
if(qfn.fnc) {
|
if(qfn.fnc) {
|
||||||
|
@ -1948,7 +1950,7 @@ void qfnk_task(void)
|
||||||
timetick = xTaskGetTickCount();
|
timetick = xTaskGetTickCount();
|
||||||
qfnt = qfn;
|
qfnt = qfn;
|
||||||
}
|
}
|
||||||
else qfn.fnc(qfn.param);
|
else qfn.fnc((uint32) qfn.param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(qfnt.fnc) {
|
else if(qfnt.fnc) {
|
||||||
|
@ -1956,7 +1958,7 @@ void qfnk_task(void)
|
||||||
#if DEBUGSOO > 3
|
#if DEBUGSOO > 3
|
||||||
os_printf("qfnt: %p(%p),%d\n", qfnt.fnc, qfnt.param, qfnt.pause_ms);
|
os_printf("qfnt: %p(%p),%d\n", qfnt.fnc, qfnt.param, qfnt.pause_ms);
|
||||||
#endif
|
#endif
|
||||||
qfnt.fnc(qfnt.param);
|
qfnt.fnc((uint32) qfnt.param);
|
||||||
qfnt.fnc = NULL;
|
qfnt.fnc = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2026,7 +2028,7 @@ err_t ICACHE_FLASH_ATTR webserver_close(uint16 portn)
|
||||||
#endif
|
#endif
|
||||||
if(xQueueWebSrv) {
|
if(xQueueWebSrv) {
|
||||||
WEB_SRV_QFNK qfn;
|
WEB_SRV_QFNK qfn;
|
||||||
qfn.fnc = vTaskDelete;
|
qfn.fnc = (web_ex_func_cb) vTaskDelete;
|
||||||
qfn.param = NULL;
|
qfn.param = NULL;
|
||||||
qfn.pause_ms = 0;
|
qfn.pause_ms = 0;
|
||||||
if(xQueueSendToBack(xQueueWebSrv, &qfn, 1000) == pdPASS) {
|
if(xQueueSendToBack(xQueueWebSrv, &qfn, 1000) == pdPASS) {
|
||||||
|
|
|
@ -123,7 +123,7 @@ const uint32 tab_seg_def[] = {
|
||||||
|
|
||||||
SEG_ID get_seg_id(uint32 addr, int32 size) {
|
SEG_ID get_seg_id(uint32 addr, int32 size) {
|
||||||
SEG_ID ret = SEG_ID_ERR;
|
SEG_ID ret = SEG_ID_ERR;
|
||||||
uint32 * ptr = &tab_seg_def;
|
uint32 * ptr = (uint32 *) &tab_seg_def;
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
do {
|
do {
|
||||||
ret++;
|
ret++;
|
||||||
|
@ -531,6 +531,9 @@ int ICACHE_FLASH_ATTR htmlcode(uint8 *d, uint8 *s, uint16 lend, uint16 lens)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
extern size_t rtl_strlen(const char *str);
|
||||||
|
extern int rtl_strncmp(const char *s1, const char *s2, size_t n);
|
||||||
|
|
||||||
uint8* ICACHE_FLASH_ATTR
|
uint8* ICACHE_FLASH_ATTR
|
||||||
web_strnstr(const uint8* buffer, const uint8* token, int len)
|
web_strnstr(const uint8* buffer, const uint8* token, int len)
|
||||||
{
|
{
|
||||||
|
@ -563,7 +566,7 @@ bool ICACHE_FLASH_ATTR base64decode(const uint8 *in, int len, uint8_t *out, int
|
||||||
{
|
{
|
||||||
// uint8 *map = (uint8 *)UartDev.rcv_buff.pRcvMsgBuff;
|
// uint8 *map = (uint8 *)UartDev.rcv_buff.pRcvMsgBuff;
|
||||||
// ets_memcpy(map, base64map, 128);
|
// ets_memcpy(map, base64map, 128);
|
||||||
uint8 *map = base64map;
|
uint8 *map = (uint8 *) base64map;
|
||||||
int g, t, x, y, z;
|
int g, t, x, y, z;
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
g = 3;
|
g = 3;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#define copy_s4d1 rtl_memcpy
|
#define copy_s4d1 rtl_memcpy
|
||||||
|
|
||||||
#define mMIN(a, b) ((a<b)?a:b)
|
//#define mMIN(a, b) ((a<b)?a:b)
|
||||||
|
|
||||||
#define MAX_RX_BUF_SIZE 8192
|
#define MAX_RX_BUF_SIZE 8192
|
||||||
|
|
||||||
|
|
|
@ -464,7 +464,7 @@ uint32 WEBFS_CODE_ATTR WEBFS_curent_size(void)
|
||||||
{
|
{
|
||||||
uint32 size = 0;
|
uint32 size = 0;
|
||||||
web_mutex_lock();
|
web_mutex_lock();
|
||||||
if(numFiles) flash_read_word(&flashobj, disk_base_addr + 8, &size);
|
if(numFiles) flash_read_word(&flashobj, disk_base_addr + 8, (uint32_t *) &size);
|
||||||
web_mutex_unlock();
|
web_mutex_unlock();
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ SDK_PATH = USDK/
|
||||||
#GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/6.2017-q1-update/bin/# + or set in PATH
|
#GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/6.2017-q1-update/bin/# + or set in PATH
|
||||||
OPENOCD_PATH = D:/MCU/OpenOCD/bin/
|
OPENOCD_PATH = D:/MCU/OpenOCD/bin/
|
||||||
TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/
|
TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/
|
||||||
#FLASHER_TYPE = Jlink
|
FLASHER_TYPE = Jlink
|
||||||
FLASHER_TYPE = cmsis-dap
|
#FLASHER_TYPE = cmsis-dap
|
||||||
FLASHER_SPEED = 3500
|
FLASHER_SPEED = 3500
|
||||||
FLASHER_PATH = flasher/
|
FLASHER_PATH = flasher/
|
||||||
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/
|
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/
|
||||||
|
|
Loading…
Reference in a new issue