mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
update -Wall -Werror
This commit is contained in:
parent
2c29a376ba
commit
7cb9553f73
102 changed files with 3686 additions and 3504 deletions
|
|
@ -184,7 +184,9 @@ uint8_t LwIP_DHCP(uint8_t idx, uint8_t dhcp_state) {
|
|||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
uint32_t IPaddress;
|
||||
#if CONFIG_DEBUG_LOG > 2
|
||||
uint8_t iptab[4];
|
||||
#endif
|
||||
uint8_t DHCP_state;
|
||||
int mscnt = 0;
|
||||
struct netif *pnetif = NULL;
|
||||
|
|
@ -228,12 +230,14 @@ uint8_t LwIP_DHCP(uint8_t idx, uint8_t dhcp_state) {
|
|||
|
||||
/* Stop DHCP */
|
||||
// dhcp_stop(pnetif); /* can not stop, need to renew, Robbie*/
|
||||
#if CONFIG_DEBUG_LOG > 2
|
||||
iptab[0] = (uint8_t) (IPaddress >> 24);
|
||||
iptab[1] = (uint8_t) (IPaddress >> 16);
|
||||
iptab[2] = (uint8_t) (IPaddress >> 8);
|
||||
iptab[3] = (uint8_t) (IPaddress);
|
||||
info_printf("Interface %d IP address: %d.%d.%d.%d\n", idx, iptab[3],
|
||||
iptab[2], iptab[1], iptab[0]);
|
||||
#endif
|
||||
#if CONFIG_WLAN
|
||||
error_flag = RTW_NO_ERROR;
|
||||
#endif
|
||||
|
|
@ -251,6 +255,7 @@ uint8_t LwIP_DHCP(uint8_t idx, uint8_t dhcp_state) {
|
|||
IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1, NETMASK_ADDR2, NETMASK_ADDR3);
|
||||
IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
|
||||
netif_set_addr(pnetif, &ipaddr, &netmask, &gw);
|
||||
#if CONFIG_DEBUG_LOG > 2
|
||||
|
||||
iptab[0] = IP_ADDR3;
|
||||
iptab[1] = IP_ADDR2;
|
||||
|
|
@ -258,6 +263,7 @@ uint8_t LwIP_DHCP(uint8_t idx, uint8_t dhcp_state) {
|
|||
iptab[3] = IP_ADDR0;
|
||||
info_printf("Interface %d DHCP timeout\n", idx);
|
||||
info_printf("Static IP address: %d.%d.%d.%d\n", iptab[3], iptab[2], iptab[1], iptab[0]);
|
||||
#endif
|
||||
#if CONFIG_WLAN
|
||||
error_flag = RTW_DHCP_FAIL;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,22 +9,30 @@
|
|||
#define DATA_IRAM_ATTR
|
||||
#define ICACHE_RAM_ATTR
|
||||
|
||||
#define os_printf(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_printf_plus(...) rtl_printf(__VA_ARGS__)
|
||||
#define os_sprintf_fd(...) rtl_sprintf(__VA_ARGS__)
|
||||
#define ets_sprintf(...) rtl_sprintf(__VA_ARGS__)
|
||||
#ifndef os_malloc
|
||||
#define os_malloc pvPortMalloc
|
||||
#define os_zalloc pvPortZalloc
|
||||
#define os_calloc pvPortCalloc
|
||||
#define os_realloc pvPortRealloc
|
||||
#endif
|
||||
#undef os_free
|
||||
#define os_free vPortFree
|
||||
#define system_get_free_heap_size xPortGetFreeHeapSize
|
||||
#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_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_erase_block(blk) flash_erase_block(&flashobj, (blk)<<16);
|
||||
|
||||
#ifndef ip4_addr1
|
||||
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
|
||||
#endif
|
||||
/* These are cast to u16_t, with the intent that they are often arguments
|
||||
* 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_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
|
||||
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
||||
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
||||
#endif
|
||||
|
||||
#undef IP2STR
|
||||
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
||||
ip4_addr2_16(ipaddr), \
|
||||
ip4_addr3_16(ipaddr), \
|
||||
ip4_addr4_16(ipaddr)
|
||||
|
||||
#undef IPSTR
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
#ifndef MAC2STR
|
||||
|
|
|
|||
|
|
@ -95,11 +95,11 @@
|
|||
#define memset rtl_memset
|
||||
#define strcat rtl_strcat
|
||||
#define strchr rtl_strchr
|
||||
#define strcmp(s1, s2) rtl_strcmp((const char *)s1, (const char *)s2)
|
||||
#define strcmp rtl_strcmp
|
||||
#define strcpy rtl_strcpy
|
||||
#define strlen(str) rtl_strlen((const char *)str)
|
||||
#define strlen rtl_strlen
|
||||
#define strncat rtl_strncat
|
||||
#define strncmp(s1, s2, n) rtl_strncmp((const char *)s1, (const char *)s2, n)
|
||||
#define strncmp rtl_strncmp
|
||||
#define strncpy rtl_strncpy
|
||||
#define strstr rtl_strstr
|
||||
#define strsep rtl_strsep
|
||||
|
|
@ -157,13 +157,22 @@
|
|||
//
|
||||
// memory management
|
||||
//
|
||||
#ifndef CONFIG_MBED_ENABLED
|
||||
extern void *pvPortMalloc( size_t xWantedSize );
|
||||
extern void vPortFree( void *pv );
|
||||
#define malloc pvPortMalloc
|
||||
#define zalloc pvPortZalloc
|
||||
#define free vPortFree
|
||||
#endif
|
||||
#undef malloc
|
||||
extern void *pvPortMalloc(size_t xWantedSize);
|
||||
#define malloc pvPortMalloc
|
||||
|
||||
#undef zalloc
|
||||
extern void *pvPortZalloc(size_t xWantedSize);
|
||||
#define zalloc pvPortZalloc
|
||||
|
||||
#undef realloc
|
||||
extern void *pvPortReAlloc(void *pv, size_t xWantedSize);
|
||||
#define realloc pvPortReAlloc
|
||||
|
||||
#undef free
|
||||
extern void vPortFree(void *pv);
|
||||
#define free vPortFree
|
||||
|
||||
#elif defined (CONFIG_PLATFORM_8711B)
|
||||
|
||||
#if defined (__IARSTDLIB__)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
#endif
|
||||
#include <lwip_netconf.h>
|
||||
#include <osdep_service.h>
|
||||
#include "dhcp.h"
|
||||
#include "dhcp/dhcps.h"
|
||||
|
||||
#if CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#include "wlan_fast_connect/example_wlan_fast_connect.h"
|
||||
|
|
@ -157,6 +159,9 @@ extern unsigned char dhcp_mode_sta;
|
|||
#include "freertos/wrapper.h"
|
||||
#include "skbuff.h"
|
||||
|
||||
extern int is_promisc_enabled();
|
||||
extern int promisc_set(rtw_rcr_level_t enabled, void (*callback)(u8 *, unsigned int, void *), int len_used);
|
||||
|
||||
//------------------------------------------------------------------------end-patch//
|
||||
static int wifi_connect_local(rtw_network_info_t *pWifi) {
|
||||
int ret = 0;
|
||||
|
|
@ -278,8 +283,8 @@ static void wifi_disconn_hdl(char* buf, int buf_len, int flags, void* userdata)
|
|||
else if (rtw_join_status == 0)
|
||||
error_flag = RTW_CONNECT_FAIL;
|
||||
|
||||
else if (rtw_join_status == JOIN_COMPLETE | JOIN_SECURITY_COMPLETE
|
||||
| JOIN_ASSOCIATED | JOIN_AUTHENTICATED | JOIN_LINK_READY)
|
||||
else if (rtw_join_status == (JOIN_COMPLETE | JOIN_SECURITY_COMPLETE
|
||||
| JOIN_ASSOCIATED | JOIN_AUTHENTICATED | JOIN_LINK_READY))
|
||||
error_flag = RTW_WRONG_PASSWORD;
|
||||
}
|
||||
|
||||
|
|
@ -368,6 +373,7 @@ void restore_wifi_info_to_flash() {
|
|||
|
||||
#endif
|
||||
|
||||
extern int wext_set_bssid(const char *ifname, const __u8 *bssid);
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_connect(
|
||||
unsigned char bssid[ETH_ALEN],
|
||||
|
|
@ -380,7 +386,7 @@ int wifi_connect(
|
|||
|
||||
int ssid_len = 0;
|
||||
int password_len = 0;
|
||||
int bssid_len = 6;
|
||||
// int bssid_len = 6;
|
||||
xSemaphoreHandle join_semaphore;
|
||||
rtw_result_t result = RTW_SUCCESS;
|
||||
u8 wep_hex = 0;
|
||||
|
|
@ -440,7 +446,7 @@ int wifi_connect(
|
|||
|
||||
if (password_len == 10) {
|
||||
|
||||
u32 g[5] = { 0 };
|
||||
unsigned int g[5] = { 0 };
|
||||
u8 i = 0;
|
||||
sscanf((const char*) password, "%02x%02x%02x%02x%02x", &g[0],
|
||||
&g[1], &g[2], &g[3], &g[4]);
|
||||
|
|
@ -450,7 +456,7 @@ int wifi_connect(
|
|||
password_len = 5;
|
||||
wep_hex = 1;
|
||||
} else if (password_len == 26) {
|
||||
u32 g[13] = { 0 };
|
||||
unsigned int g[13] = { 0 };
|
||||
u8 i = 0;
|
||||
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],
|
||||
|
|
@ -731,6 +737,8 @@ int wifi_get_ap_info(rtw_bss_info_t * ap_info, rtw_security_t* security) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
extern int wext_get_drv_ability(const char *ifname, uint32_t *ability);
|
||||
|
||||
int wifi_get_drv_ability(uint32_t *ability) {
|
||||
return wext_get_drv_ability(WLAN0_NAME, ability);
|
||||
}
|
||||
|
|
@ -948,6 +956,8 @@ int wifi_get_last_error(void) {
|
|||
int wpas_wps_init(const char* ifname);
|
||||
#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) {
|
||||
const char *ifname = WLAN0_NAME;
|
||||
int ssid_len = 0;
|
||||
|
|
@ -1543,10 +1553,8 @@ int wifi_restart_ap(unsigned char *ssid, rtw_security_t security_type,
|
|||
printf("AP: security_type=%d\n", setting.security_type);
|
||||
printf("AP: password=%s\n", (char* )setting.password);
|
||||
printf("AP: key_idx =%d\n", setting.key_idx);
|
||||
ret = wifi_connect((char*) setting.ssid, setting.security_type,
|
||||
(char*) setting.password, strlen((char* )setting.ssid),
|
||||
strlen((char* )setting.password), setting.key_idx,
|
||||
NULL);
|
||||
ret = wifi_connect(NULL, 0 , (char*) setting.ssid, setting.security_type,
|
||||
(char*) setting.password, setting.key_idx, NULL);
|
||||
if (ret == RTW_SUCCESS) {
|
||||
#if CONFIG_DHCP_CLIENT
|
||||
/* Start DHCPClient */
|
||||
|
|
@ -1726,6 +1734,9 @@ int wifi_remove_packet_filter(unsigned char filter_id) {
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_AP_MODE
|
||||
extern int wext_enable_forwarding(const char *ifname);
|
||||
extern int wext_disable_forwarding(const char *ifname);
|
||||
|
||||
int wifi_enable_forwarding(void) {
|
||||
return wext_enable_forwarding(WLAN0_NAME);
|
||||
}
|
||||
|
|
@ -1739,6 +1750,8 @@ int wifi_disable_forwarding(void) {
|
|||
* usage: wifi_set_ch_deauth(0) -> wlan0 wifi_connect -> wifi_set_ch_deauth(1)
|
||||
*/
|
||||
#ifdef CONFIG_CONCURRENT_MODE
|
||||
extern int wext_set_ch_deauth(const char *ifname, __u8 enable);
|
||||
|
||||
int wifi_set_ch_deauth(__u8 enable) {
|
||||
return wext_set_ch_deauth(WLAN1_NAME, enable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ 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
|
||||
// not available for the following operations.
|
||||
// ex: using semaphore to notice another thread.
|
||||
switch (event) {
|
||||
switch ((int)event) {
|
||||
case WIFI_EVENT_DISCONNECT:
|
||||
#if(WIFI_INDICATE_MSG>0)
|
||||
info_printf("%s(%d): Disconnection indication received\n", __func__, event);
|
||||
|
|
|
|||
|
|
@ -19,9 +19,8 @@
|
|||
extern void _promisc_deinit(_adapter *padapter);
|
||||
extern int _promisc_recv_func(_adapter *padapter, recv_frame *rframe);
|
||||
extern int _promisc_set(rtw_rcr_level_t enabled, void (*callback)(unsigned char *, unsigned int, void *), unsigned char len_used);
|
||||
extern unsigned char is_promisc_enabled(void);
|
||||
extern int promisc_get_fixed_channel(void *fixed_bssid, unsigned char *ssid, int *ssid_length);
|
||||
extern unsigned char is_promisc_enabled(void);
|
||||
extern unsigned char _is_promisc_enabled(void);
|
||||
extern int _promisc_get_fixed_channel(void *fixed_bssid, unsigned char *ssid, int *ssid_length);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -111,7 +110,7 @@ static struct eth_buffer eth_buffer;
|
|||
#ifdef CONFIG_PROMISC
|
||||
#define MAX_PACKET_FILTER_INFO 5
|
||||
#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;
|
||||
|
||||
void promisc_init_packet_filter()
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ int wext_get_passphrase(const char *ifname, __u8 *passphrase) {
|
|||
rtw_result_t ret = RTW_ERROR;
|
||||
if(pdev) {
|
||||
uint16 len[4];
|
||||
ret = rtw_wx_get_passphrase(pdev, 0, &len, passphrase);
|
||||
ret = rtw_wx_get_passphrase(pdev, 0,(union iwreq_data *) &len, passphrase);
|
||||
if(ret == RTW_SUCCESS) passphrase[len[2]] = '\0';
|
||||
debug_printf("pas[%d]-<%s>\n", len[2], passphrase);
|
||||
}
|
||||
|
|
@ -404,7 +404,6 @@ int wext_get_lps_dtim(const char *ifname, __u8 *lps_dtim) {
|
|||
|
||||
int wext_set_tos_value(const char *ifname, __u8 *tos_value) {
|
||||
struct iwreq iwr;
|
||||
int ret = -1;
|
||||
__u8 para[sizeof("set_tos_value") + 4];
|
||||
int cmd_len = sizeof("set_tos_value");
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
|
|
@ -562,6 +561,8 @@ int wext_get_mode(const char *ifname, int *mode) {
|
|||
#endif
|
||||
}
|
||||
|
||||
extern int rtw_wx_set_ap_essid(struct net_device *dev, struct iw_request_info *a, union iwreq_data *wrqu, char *extra);
|
||||
|
||||
int wext_set_ap_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len) {
|
||||
#ifdef USE_WIFI_ADAPTER
|
||||
struct net_device * pdev = rltk_wlan_info[0].dev;
|
||||
|
|
@ -572,7 +573,7 @@ int wext_set_ap_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len) {
|
|||
uint16 len[2];
|
||||
len[0] = ssid_len;
|
||||
len[1] = (ssid_len != 0);
|
||||
ret = rtw_wx_set_ap_essid(pdev, 0, &len, ssid);
|
||||
ret = rtw_wx_set_ap_essid(pdev, 0, (union iwreq_data *) &len, (char *)ssid);
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
|
|
@ -751,7 +752,7 @@ int wext_private_command_with_retval(const char *ifname, char *cmd,
|
|||
iwr.u.data.length = buf_size;
|
||||
iwr.u.data.flags = 0;
|
||||
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)
|
||||
ret_len = iwr.u.data.length;
|
||||
memcpy(ret_buf, (char *) iwr.u.data.pointer, ret_len);
|
||||
|
|
@ -923,7 +924,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,
|
||||
__u16 timeout) {
|
||||
struct iwreq iwr;
|
||||
int ret = 0;
|
||||
__u8 para[sizeof("SetAutoRecnt") + 4];
|
||||
int cmd_len = sizeof("SetAutoRecnt");
|
||||
memset(&iwr, 0, sizeof(iwr));
|
||||
|
|
@ -1017,7 +1017,7 @@ int wext_update_custom_ie(const char *ifname, void * cus_ie, int ie_index) {
|
|||
#endif
|
||||
} else {
|
||||
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) {
|
||||
//Cmd
|
||||
snprintf(para, cmd_len, "UpdateIE");
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ STATION_CONFIG wifi_st_cfg = {
|
|||
.ssid = DEF_ST_SSID,
|
||||
.password = DEF_ST_PASSWORD,
|
||||
.bssid = DEF_ST_BSSID,
|
||||
.flg = DEF_ST_BSSID,
|
||||
.flg = DEF_ST_USE_BSSID,
|
||||
.security = DEF_ST_SECURITY,
|
||||
.autoreconnect = DEF_ST_AUTORECONNECT,
|
||||
.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_ap_name[] = WLAN1_NAME;
|
||||
char wlan_st_netifn = 0;
|
||||
char wlan_ap_netifn = 1;
|
||||
unsigned char wlan_st_netifn = 0;
|
||||
unsigned char wlan_ap_netifn = 1;
|
||||
|
||||
|
||||
uint32 get_new_ip(void)
|
||||
|
|
@ -256,7 +256,7 @@ extern Rltk_wlan_t rltk_wlan_info[2]; // in wrapper.h
|
|||
};*/
|
||||
#define get_padapter(num) (*(_adapter **)((rltk_wlan_info[num].dev)->priv));
|
||||
|
||||
LOCAL rtw_result_t _wext_set_lps_dtim(int adapter_num, uint8 lps_dtim ) {
|
||||
rtw_result_t _wext_set_lps_dtim(int adapter_num, uint8 lps_dtim ) {
|
||||
_adapter * pad = get_padapter(adapter_num);
|
||||
rtw_result_t ret = RTW_ERROR;
|
||||
if(pad) {
|
||||
|
|
@ -265,7 +265,7 @@ LOCAL rtw_result_t _wext_set_lps_dtim(int adapter_num, uint8 lps_dtim ) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
LOCAL rtw_result_t _wext_enable_powersave(int adapter_num, uint8 ips_mode, uint8 lps_mode) {
|
||||
rtw_result_t _wext_enable_powersave(int adapter_num, uint8 ips_mode, uint8 lps_mode) {
|
||||
_adapter * pad = get_padapter(adapter_num);
|
||||
rtw_result_t ret = RTW_ERROR;
|
||||
if(pad) {
|
||||
|
|
@ -278,7 +278,7 @@ LOCAL rtw_result_t _wext_enable_powersave(int adapter_num, uint8 ips_mode, uint8
|
|||
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_padapter(adapter_num);
|
||||
int ret = 0;
|
||||
|
|
@ -357,7 +357,7 @@ LOCAL rtw_result_t wifi_run_ap(void) {
|
|||
int timeout = wifi_test_timeout_ms / wifi_test_timeout_step_ms;
|
||||
while (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
|
||||
char essid[33];
|
||||
if ((wext_get_ssid(wlan_ap_name, (unsigned char *) essid) > 0)
|
||||
|
|
@ -404,7 +404,7 @@ LOCAL rtw_result_t StartStDHCPClient(void)
|
|||
debug_printf("Start DHCPClient...\n");
|
||||
int ret = RTW_SUCCESS;
|
||||
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;
|
||||
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);
|
||||
|
|
@ -597,8 +597,8 @@ LOCAL void _LwIP_Init(void)
|
|||
xnetif[idx].name[0] = 'r';
|
||||
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_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_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], (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
|
||||
{
|
||||
struct ip_addr ipaddr;
|
||||
|
|
@ -623,6 +623,9 @@ 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 ret = 0;
|
||||
#if CONFIG_DEBUG_LOG > 4
|
||||
|
|
@ -663,8 +666,8 @@ int wifi_run(rtw_mode_t mode) {
|
|||
netbios_set_name(WLAN_ST_NETIF_NUM, lwip_host_name[0]);
|
||||
#endif
|
||||
#endif
|
||||
netif_set_addr(&xnetif[WLAN_ST_NETIF_NUM], &wifi_st_dhcp.ip,
|
||||
&wifi_st_dhcp.mask, &wifi_st_dhcp.gw);
|
||||
netif_set_addr(&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);
|
||||
pnif = &xnetif[WLAN_AP_NETIF_NUM];
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
// @todo ethernetif_init()...
|
||||
|
|
@ -673,8 +676,8 @@ int wifi_run(rtw_mode_t mode) {
|
|||
netbios_set_name(WLAN_AP_NETIF_NUM, lwip_host_name[1]);
|
||||
#endif
|
||||
#endif
|
||||
netif_set_addr(&xnetif[WLAN_AP_NETIF_NUM], &wifi_ap_dhcp.ip,
|
||||
&wifi_ap_dhcp.mask, &wifi_ap_dhcp.gw);
|
||||
netif_set_addr(&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);
|
||||
|
||||
}
|
||||
switch(mode) {
|
||||
|
|
@ -856,3 +859,32 @@ void show_wifi_cfg(void) {
|
|||
printf("\tSave flags: %p\n", wifi_cfg.save_flg);
|
||||
}
|
||||
|
||||
#if SDK_VER_NUM >= 0x4000
|
||||
extern int wext_get_associated_client_list(const char *ifname, void * client_list_buffer, __u16 buffer_length);
|
||||
|
||||
int show_wifi_ap_clients(void) {
|
||||
if((wifi_mode == RTW_MODE_AP) || (wifi_mode == RTW_MODE_STA_AP)) {
|
||||
struct {
|
||||
int count;
|
||||
rtw_mac_t mac_list[AP_STA_NUM];
|
||||
} client_info;
|
||||
client_info.count = AP_STA_NUM;
|
||||
if(wext_get_associated_client_list(wlan_ap_name, &client_info, sizeof(client_info)) >= 0) {
|
||||
if(client_info.count) {
|
||||
printf("\tAP %u clients:\n", client_info.count);
|
||||
int client_idx = 0;
|
||||
while(client_idx++ < client_info.count) {
|
||||
unsigned char *pmac = client_info.mac_list[client_idx].octet;
|
||||
printf("\tsta[%u]: %02x:%02x:%02x:%02x:%02x:%02x\n", client_idx,
|
||||
pmac[0],pmac[1],pmac[2],pmac[3],pmac[4],pmac[5]);
|
||||
}
|
||||
} else {
|
||||
printf("\tAP clients none\n");
|
||||
}
|
||||
return client_info.count;
|
||||
};
|
||||
};
|
||||
printf("Get AP clients error!\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@
|
|||
#include "wifi_constants.h"
|
||||
#include "queue.h"
|
||||
|
||||
#ifndef ip4_addr1
|
||||
#define ip4_addr1(ipaddr) (((uint8_t*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((uint8_t*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((uint8_t*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((uint8_t*)(ipaddr))[3])
|
||||
#endif
|
||||
|
||||
#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 char wlan_st_name[];
|
||||
extern char wlan_ap_name[];
|
||||
extern char wlan_st_netifn;
|
||||
extern char wlan_ap_netifn;
|
||||
extern unsigned char wlan_st_netifn;
|
||||
extern unsigned char wlan_ap_netifn;
|
||||
|
||||
/* WiFi Station & scan security */
|
||||
typedef enum {
|
||||
|
|
@ -152,6 +154,9 @@ void show_wifi_st_ip(void);
|
|||
void show_wifi_cfg(void);
|
||||
void show_wifi_st_cfg(void);
|
||||
void show_wifi_ap_cfg(void);
|
||||
#if SDK_VER_NUM >= 0x4000
|
||||
int show_wifi_ap_clients(void);
|
||||
#endif
|
||||
uint32 read_wifi_cfg(uint32 flg);
|
||||
uint32 write_wifi_cfg(uint32 flg);
|
||||
int wifi_run(rtw_mode_t mode);
|
||||
|
|
@ -185,4 +190,9 @@ rtw_result_t api_wifi_scan(api_scan_result_handler_t scan_result_cb);
|
|||
void wifi_close_scan(void);
|
||||
|
||||
|
||||
rtw_result_t _wext_set_lps_dtim(int adapter_num, uint8 lps_dtim);
|
||||
int _wext_get_lps_dtim(int adapter_num);
|
||||
rtw_result_t _wext_enable_powersave(int adapter_num, uint8 ips_mode, uint8 lps_mode);
|
||||
|
||||
|
||||
#endif // _WIFI_API_H_
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
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 {
|
||||
// оставить структуру 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 ----------------- */
|
||||
extern int iw_ioctl(const char * ifname, unsigned long request, struct iwreq * pwrq);
|
||||
|
||||
LOCAL int wext_set_pscan_channels(void) {
|
||||
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");
|
||||
} else if(wext_set_pscan_channels() < 0) {
|
||||
// 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");
|
||||
} else if(scan_result_cb) {
|
||||
int i = 300;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ void sd_xfer_done_callback(void *obj) {
|
|||
}
|
||||
|
||||
void sd_xfer_err_callback(void *obj) {
|
||||
DBG_SDIO_ERR("sd_xfer_err_callback \r\n");
|
||||
DBG_SDIO_ERR("sd_xfer_err_callback\r\n");
|
||||
}
|
||||
|
||||
//----- SD_WaitReady
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ s8 sdio_sd_setClock(SD_CLK_FREQUENCY SDCLK) {
|
|||
DBG_SDIO_ERR("Malloc ADMA2 table fail.\n");
|
||||
return -1;
|
||||
}
|
||||
DBG_SDIO_INFO("SD card set CLK %d Hz\n", PLATFORM_CLOCK/(4<<(8-SDCLK)));
|
||||
DBG_SDIO_INFO("SD card set CLK %d Hz\n", PLATFORM_CLOCK/(2 << (SD_CLK_41_6MHZ - SDCLK)));
|
||||
sta = HalSdioHostOp.HalSdioHostChangeSdClock(&SdioHostAdapter, SDCLK);
|
||||
rtw_mfree(padma, sizeof(ADMA2_DESC_FMT));
|
||||
if (sta)
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
// 0x0000h ~ 0x00FFh System Configuration
|
||||
//
|
||||
//-----------------------------------------------------
|
||||
#define REG_SYS_ISO_CTRL 0x0000
|
||||
#define REG_SYS_FUNC_EN 0x0002
|
||||
#define REG_SYS_ISO_CTRL_ 0x0000
|
||||
#define REG_SYS_FUNC_EN_ 0x0002
|
||||
#define REG_APS_FSMCO 0x0004
|
||||
#define REG_SYS_CLKR 0x0008
|
||||
#define REG_9346CR 0x000A
|
||||
|
|
@ -515,7 +515,7 @@
|
|||
#define REG_BSSID1 0x0708
|
||||
|
||||
/* 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_BcnInt BIT13 // Beacon DMA Interrupt 0
|
||||
#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_BDOK BIT9 // Beacon Queue DMA OK Interrup
|
||||
#define IMR_HIGHDOK BIT8 // High Queue DMA OK Interrupt
|
||||
|
|
|
|||
|
|
@ -133,13 +133,13 @@ void rltk_wlan_recv(int idx, struct eth_drv_sg *sg_list, int sg_len)
|
|||
|
||||
DBG_TRACE("%s is called", __FUNCTION__);
|
||||
|
||||
if (!rltk_wlan_check_isup(idx))
|
||||
return;
|
||||
|
||||
if(idx == -1){
|
||||
DBG_ERR("skb is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rltk_wlan_check_isup(idx))
|
||||
return;
|
||||
|
||||
skb = rltk_wlan_get_recv_skb(idx);
|
||||
DBG_ASSERT(skb, "No pending rx skb");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _SDCARD_H_
|
||||
#define _SDCARD_H_
|
||||
#include "fatfs_ext/inc/ff_driver.h"
|
||||
#include "ff_driver.h"
|
||||
|
||||
extern ll_diskio_drv SD_disk_Driver;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
#include "us_ticker_api.h"
|
||||
|
||||
#include "platform_autoconf.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
|
||||
#define WAIT_US_USE_CYCCNT
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ extern "C" {
|
|||
typedef enum {
|
||||
IRQ_NONE,
|
||||
IRQ_RISE,
|
||||
IRQ_FALL
|
||||
IRQ_FALL,
|
||||
IRQ_LOW,
|
||||
IRQ_HIGH
|
||||
} gpio_irq_event;
|
||||
|
||||
typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ typedef void (*dma_irq_handler)(uint32_t id);
|
|||
void dma_memcpy_init(gdma_t *dma_obj, dma_irq_handler handler, uint32_t id);
|
||||
void dma_memcpy_deinit(gdma_t *dma_obj);
|
||||
void dma_memcpy(gdma_t *dma_obj, void *dst, void* src, uint32_t len);
|
||||
void dma_memcpy_aggr_init(gdma_t * dma_obj, dma_irq_handler handler, uint32_t id);
|
||||
void dma_memcpy_aggr(gdma_t * dma_obj, PHAL_GDMA_BLOCK block_info);
|
||||
void dma_memcpy_aggr_init(gdma_t *dma_obj, dma_irq_handler handler, uint32_t id);
|
||||
void dma_memcpy_aggr(gdma_t *dma_obj, PHAL_GDMA_BLOCK block_info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,12 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
typedef enum {
|
||||
IRQ_LOW = 3,
|
||||
IRQ_HIGH =4
|
||||
} gpio_irq_event_ex;
|
||||
*/
|
||||
|
||||
void gpio_irq_deinit(gpio_irq_t *obj);
|
||||
void gpio_irq_pull_ctrl(gpio_irq_t *obj, PinMode pull_type);
|
||||
|
|
@ -37,4 +39,4 @@ void gpio_irq_pull_ctrl(gpio_irq_t *obj, PinMode pull_type);
|
|||
|
||||
#endif // end of "#if DEVICE_INTERRUPTIN"
|
||||
|
||||
#endif // end of #ifndef MBED_GPIO_IRQ_EX_API_H
|
||||
#endif // end of #ifndef MBED_GPIO_IRQ_EX_API_H
|
||||
|
|
|
|||
|
|
@ -118,13 +118,13 @@ void analogin_init (analogin_t *obj, PinName pin){
|
|||
}
|
||||
|
||||
float analogin_read(analogin_t *obj){
|
||||
float value;
|
||||
// float value;
|
||||
union {
|
||||
unsigned int ui[2];
|
||||
unsigned short us[4];
|
||||
} adata;
|
||||
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
||||
RtkADCReceiveBuf(p, &adata.ui);
|
||||
RtkADCReceiveBuf(p, (u32 *) &adata.ui);
|
||||
return (float)(adata.us[p->DevNum]) / (float)(0xCE80);
|
||||
/*
|
||||
uint32_t AnaloginTmp[2] = {0,0};
|
||||
|
|
@ -161,7 +161,7 @@ uint16_t analogin_read_u16(analogin_t *obj){
|
|||
unsigned short us[4];
|
||||
} adata;
|
||||
PSAL_ADC_HND p = &((&(obj->SalADCMngtAdpt))->pSalHndPriv->SalADCHndPriv);
|
||||
RtkADCRxManualRotate(p, &adata.ui);
|
||||
RtkADCRxManualRotate(p, (u32 *) &adata.ui);
|
||||
return adata.us[p->DevNum];
|
||||
/*
|
||||
uint32_t AnaloginTmp[2] = {0,0};
|
||||
|
|
|
|||
|
|
@ -592,6 +592,8 @@ unsigned int flash_get_size(flash_t *obj) {
|
|||
/*
|
||||
* 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,
|
||||
uint8_t * data) {
|
||||
int ret = 1;
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ LOCAL FLASH_EEP_ATTR unsigned int pack_cfg_fmem(fobj_head obj)
|
|||
#if 0
|
||||
copy_align4_to_align1((uint8 *)pbuf, rdaddr, len);
|
||||
#else
|
||||
SpicUserReadFourByteRtl8195A(len, rdaddr, (unsigned int *)pbuf, flashobj.SpicInitPara.Mode.BitMode);
|
||||
SpicUserReadFourByteRtl8195A(len, rdaddr, (u32 *)pbuf, flashobj.SpicInitPara.Mode.BitMode);
|
||||
#endif
|
||||
int i = 0;
|
||||
int size4b = len >> 2;
|
||||
|
|
@ -376,7 +376,7 @@ LOCAL signed short FLASH_EEP_ATTR _flash_write_cfg(void *ptr, unsigned short id,
|
|||
fobj_head fobj;
|
||||
fobj.n.id = id;
|
||||
fobj.n.size = size;
|
||||
bool retb = false;
|
||||
// bool retb = false;
|
||||
unsigned int faddr = get_addr_bscfg(false);
|
||||
|
||||
if(faddr >= FMEM_ERROR_MAX) {
|
||||
|
|
|
|||
|
|
@ -573,6 +573,7 @@ int i2c_enable_control(i2c_t *obj, int enable) {
|
|||
pSalI2CHND->pInitDat->I2CEn = enable;
|
||||
|
||||
pSalI2CMngtAdpt->pHalOp->HalI2CEnable(pSalI2CHND->pInitDat);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if DEVICE_I2CSLAVE
|
||||
|
|
@ -719,14 +720,14 @@ int i2c_slave_write(i2c_t *obj, const char *data, int length) {
|
|||
* \return result
|
||||
*/
|
||||
int i2c_slave_set_for_rd_req(i2c_t *obj, int set) {
|
||||
PSAL_I2C_MNGT_ADPT pSalI2CMngtAdpt = NULL;
|
||||
PSAL_I2C_HND pSalI2CHND = NULL;
|
||||
PHAL_I2C_INIT_DAT pHalI2CInitDat = NULL;
|
||||
PHAL_I2C_OP pHalI2COP = NULL;
|
||||
PSAL_I2C_MNGT_ADPT pSalI2CMngtAdpt;
|
||||
// PSAL_I2C_HND pSalI2CHND = NULL;
|
||||
PHAL_I2C_INIT_DAT pHalI2CInitDat;
|
||||
PHAL_I2C_OP pHalI2COP;
|
||||
u32 I2CLocalTemp;
|
||||
|
||||
pSalI2CMngtAdpt = &(obj->SalI2CMngtAdpt);
|
||||
pSalI2CHND = &(pSalI2CMngtAdpt->pSalHndPriv->SalI2CHndPriv);
|
||||
// pSalI2CHND = &(pSalI2CMngtAdpt->pSalHndPriv->SalI2CHndPriv);
|
||||
pHalI2CInitDat = pSalI2CMngtAdpt->pHalInitDat;
|
||||
pHalI2COP = pSalI2CMngtAdpt->pHalOp;
|
||||
|
||||
|
|
@ -772,6 +773,7 @@ int i2c_slave_set_for_data_nak(i2c_t *obj, int set_nak) {
|
|||
//}
|
||||
|
||||
HAL_I2C_WRITE32(pSalI2CHND->DevNum, REG_DW_I2C_IC_SLV_DATA_NACK_ONLY, set_nak);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // CONFIG_I2C_SLAVE_EN
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ void log_uart_irq_set(log_uart_t *obj, LOG_UART_INT_ID irq, uint32_t enable)
|
|||
|
||||
char log_uart_getc(log_uart_t *obj)
|
||||
{
|
||||
HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
// HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
|
||||
while (!log_uart_readable(obj));
|
||||
return (char)(HAL_UART_READ32(UART_REV_BUF_OFF) & 0xFF);
|
||||
|
|
@ -261,7 +261,7 @@ char log_uart_getc(log_uart_t *obj)
|
|||
|
||||
void log_uart_putc(log_uart_t *obj, char c)
|
||||
{
|
||||
HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
// HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
|
||||
while (!log_uart_writable(obj));
|
||||
HAL_UART_WRITE8(UART_TRAN_HOLD_OFF, c);
|
||||
|
|
@ -269,7 +269,7 @@ void log_uart_putc(log_uart_t *obj, char c)
|
|||
|
||||
int log_uart_readable(log_uart_t *obj)
|
||||
{
|
||||
HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
// HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
volatile u8 line_status;
|
||||
|
||||
line_status = HAL_UART_READ8(UART_LINE_STATUS_REG_OFF);
|
||||
|
|
@ -283,7 +283,7 @@ int log_uart_readable(log_uart_t *obj)
|
|||
|
||||
int log_uart_writable(log_uart_t *obj)
|
||||
{
|
||||
HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
// HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
volatile u8 line_status;
|
||||
|
||||
line_status = HAL_UART_READ8(UART_LINE_STATUS_REG_OFF);
|
||||
|
|
@ -321,7 +321,7 @@ void log_uart_clear_rx(log_uart_t *obj)
|
|||
|
||||
void log_uart_break_set(log_uart_t *obj)
|
||||
{
|
||||
HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
// HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
u32 RegValue;
|
||||
|
||||
RegValue = HAL_UART_READ32(UART_LINE_CTL_REG_OFF);
|
||||
|
|
@ -331,7 +331,7 @@ void log_uart_break_set(log_uart_t *obj)
|
|||
|
||||
void log_uart_break_clear(log_uart_t *obj)
|
||||
{
|
||||
HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
// HAL_LOG_UART_ADAPTER *pUartAdapter=(PHAL_LOG_UART_ADAPTER)&(obj->log_hal_uart);
|
||||
u32 RegValue;
|
||||
|
||||
RegValue = HAL_UART_READ32(UART_LINE_CTL_REG_OFF);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ const PinMap PinMap_PWM[] = {
|
|||
{NC, NC, 0}
|
||||
};
|
||||
|
||||
extern void * rtl_memset(void *m, int c, size_t n);
|
||||
|
||||
int pwmout_init(pwmout_t* obj, PinName pin)
|
||||
{
|
||||
uint32_t peripheral;
|
||||
|
|
|
|||
|
|
@ -536,12 +536,12 @@ int32_t serial_send_stream (serial_t *obj, char *ptxbuf, uint32_t len)
|
|||
|
||||
int32_t serial_recv_stream_dma (serial_t *obj, char *prxbuf, uint32_t len)
|
||||
{
|
||||
PHAL_RUART_OP pHalRuartOp;
|
||||
// PHAL_RUART_OP pHalRuartOp;
|
||||
PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
|
||||
u8 uart_idx = pHalRuartAdapter->UartIndex;
|
||||
int32_t ret;
|
||||
|
||||
pHalRuartOp = &(obj->hal_uart_op);
|
||||
// pHalRuartOp = &(obj->hal_uart_op);
|
||||
if ((serial_dma_en[uart_idx] & SERIAL_RX_DMA_EN)==0) {
|
||||
PUART_DMA_CONFIG pHalRuartDmaCfg;
|
||||
|
||||
|
|
@ -563,12 +563,12 @@ int32_t serial_recv_stream_dma (serial_t *obj, char *prxbuf, uint32_t len)
|
|||
|
||||
int32_t serial_send_stream_dma (serial_t *obj, char *ptxbuf, uint32_t len)
|
||||
{
|
||||
PHAL_RUART_OP pHalRuartOp;
|
||||
// PHAL_RUART_OP pHalRuartOp;
|
||||
PHAL_RUART_ADAPTER pHalRuartAdapter=(PHAL_RUART_ADAPTER)&(obj->hal_uart_adp);
|
||||
u8 uart_idx = pHalRuartAdapter->UartIndex;
|
||||
int32_t ret;
|
||||
|
||||
pHalRuartOp = &(obj->hal_uart_op);
|
||||
// pHalRuartOp = &(obj->hal_uart_op);
|
||||
|
||||
if ((serial_dma_en[uart_idx] & SERIAL_TX_DMA_EN)==0) {
|
||||
PUART_DMA_CONFIG pHalRuartDmaCfg;
|
||||
|
|
|
|||
|
|
@ -58,13 +58,11 @@ void spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName sse
|
|||
|
||||
_memset((void*)obj, 0, sizeof(spi_t));
|
||||
obj->state = 0;
|
||||
uint32_t SystemClock = SystemGetCpuClk();
|
||||
uint32_t MaxSsiFreq = (SystemClock >> 2) >> 1;
|
||||
|
||||
/* SsiClockDivider doesn't support odd number */
|
||||
|
||||
DBG_SSI_INFO("SystemClock: %d\n", SystemClock);
|
||||
DBG_SSI_INFO("MaxSsiFreq : %d\n", MaxSsiFreq);
|
||||
DBG_SSI_INFO("SystemClock: %d\n", SystemGetCpuClk());
|
||||
DBG_SSI_INFO("MaxSsiFreq : %d\n", (SystemClock >> 2) >> 1);
|
||||
|
||||
ssi_mosi = pinmap_peripheral(mosi, PinMap_SSI_MOSI);
|
||||
ssi_miso = pinmap_peripheral(miso, PinMap_SSI_MISO);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ extern void HalDeinitLogUart(void);
|
|||
|
||||
#ifdef CONFIG_SDR_EN
|
||||
//#if defined ( __ICCARM__ )
|
||||
extern u8 IsSdrPowerOn();
|
||||
extern u8 IsSdrPowerOn(void);
|
||||
//#endif
|
||||
#endif
|
||||
/**
|
||||
|
|
@ -204,11 +204,16 @@ void sys_reset(void)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_SDR_EN
|
||||
|
||||
extern u8 IsSdrPowerOn(void);
|
||||
|
||||
u8 sys_is_sdram_power_on(void)
|
||||
{
|
||||
return IsSdrPowerOn();
|
||||
}
|
||||
|
||||
extern void SdrPowerOff(void);
|
||||
|
||||
void sys_sdram_off(void)
|
||||
{
|
||||
if (IsSdrPowerOn()) {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
#define DHCP_MESSAGE_HTYPE (1)
|
||||
#define DHCP_MESSAGE_HLEN (6)
|
||||
|
||||
#define DHCP_SERVER_PORT (67)
|
||||
#define DHCP_CLIENT_PORT (68)
|
||||
//#define DHCP_SERVER_PORT (67)
|
||||
//#define DHCP_CLIENT_PORT (68)
|
||||
|
||||
#define DHCP_MESSAGE_TYPE_DISCOVER (1)
|
||||
#define DHCP_MESSAGE_TYPE_OFFER (2)
|
||||
|
|
|
|||
|
|
@ -91,9 +91,12 @@ static void arp_timer(void *arg);
|
|||
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
char lwip_host_name[NET_IF_NUM][LWIP_NETIF_HOSTNAME_SIZE] = {
|
||||
DEF_HOSTNAME"0",
|
||||
DEF_HOSTNAME"1",
|
||||
DEF_HOSTNAME"2"
|
||||
{ DEF_HOSTNAME"0" },
|
||||
{ DEF_HOSTNAME"1" }
|
||||
#if NET_IF_NUM > 2
|
||||
,{ DEF_HOSTNAME "2" }
|
||||
#endif
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include "lwip/err.h"
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
|
||||
static const char *err_strerr[] = {
|
||||
"Ok", /* ERR_OK 0 */
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ struct lwip_select_cb {
|
|||
struct lwip_setgetsockopt_data {
|
||||
/** socket struct for which to change options */
|
||||
struct lwip_sock *sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
/** socket index for which to change options */
|
||||
int s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
|
|
@ -1641,7 +1641,7 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
|
|||
|
||||
/* Now do the actual option processing */
|
||||
data.sock = sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
data.s = s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
data.level = level;
|
||||
|
|
@ -1662,7 +1662,7 @@ static void
|
|||
lwip_getsockopt_internal(void *arg)
|
||||
{
|
||||
struct lwip_sock *sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
int s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
int level, optname;
|
||||
|
|
@ -1673,7 +1673,7 @@ lwip_getsockopt_internal(void *arg)
|
|||
|
||||
data = (struct lwip_setgetsockopt_data*)arg;
|
||||
sock = data->sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
s = data->s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
level = data->level;
|
||||
|
|
@ -2059,7 +2059,7 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
|
|||
|
||||
/* Now do the actual option processing */
|
||||
data.sock = sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
data.s = s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
data.level = level;
|
||||
|
|
@ -2080,7 +2080,7 @@ static void
|
|||
lwip_setsockopt_internal(void *arg)
|
||||
{
|
||||
struct lwip_sock *sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
int s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
int level, optname;
|
||||
|
|
@ -2091,7 +2091,7 @@ lwip_setsockopt_internal(void *arg)
|
|||
|
||||
data = (struct lwip_setgetsockopt_data*)arg;
|
||||
sock = data->sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
s = data->s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
level = data->level;
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ err_t
|
|||
tcpip_apimsg(struct api_msg *apimsg)
|
||||
{
|
||||
struct tcpip_msg msg;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
/* catch functions that don't set err */
|
||||
apimsg->msg.err = ERR_VAL;
|
||||
#endif
|
||||
|
|
@ -339,7 +339,7 @@ tcpip_apimsg(struct api_msg *apimsg)
|
|||
err_t
|
||||
tcpip_apimsg_lock(struct api_msg *apimsg)
|
||||
{
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
/* catch functions that don't set err */
|
||||
apimsg->msg.err = ERR_VAL;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1008,7 +1008,7 @@ dhcp_bind(struct netif *netif)
|
|||
|
||||
ip_addr_copy(gw_addr, dhcp->offered_gw_addr);
|
||||
/* gateway address not given? */
|
||||
if (ip_addr_isany(&gw_addr)) {
|
||||
if (gw_addr.addr == IPADDR_ANY) {
|
||||
/* copy network address */
|
||||
ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask);
|
||||
/* use first host address on network as gateway */
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void
|
|||
icmp_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
u8_t type;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
u8_t code;
|
||||
#endif /* LWIP_DEBUG */
|
||||
struct icmp_echo_hdr *iecho;
|
||||
|
|
@ -96,7 +96,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||
}
|
||||
|
||||
type = *((u8_t *)p->payload);
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
code = *(((u8_t *)p->payload)+1);
|
||||
#endif /* LWIP_DEBUG */
|
||||
switch (type) {
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ igmp_init(void)
|
|||
IP4_ADDR(&allrouters, 224, 0, 0, 2);
|
||||
}
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
/**
|
||||
* Dump global IGMP groups list
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -128,8 +128,9 @@ struct netif *
|
|||
ip_route(ip_addr_t *dest)
|
||||
{
|
||||
struct netif *netif;
|
||||
#if CONFIG_ETHERNET
|
||||
struct netif *last_netif = NULL;
|
||||
|
||||
#endif
|
||||
#ifdef LWIP_HOOK_IP4_ROUTE
|
||||
netif = LWIP_HOOK_IP4_ROUTE(dest);
|
||||
if (netif != NULL) {
|
||||
|
|
@ -498,7 +499,7 @@ ip_input(struct pbuf *p, struct netif *inp)
|
|||
/* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */
|
||||
#if IP_ACCEPT_LINK_LAYER_ADDRESSING
|
||||
/* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */
|
||||
if (check_ip_src && !ip_addr_isany(¤t_iphdr_src))
|
||||
if (check_ip_src && current_iphdr_src.addr != IPADDR_ANY)
|
||||
#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */
|
||||
{ if ((ip_addr_isbroadcast(¤t_iphdr_src, inp)) ||
|
||||
(ip_addr_ismulticast(¤t_iphdr_src))) {
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ static const u16_t memp_num[MEMP_MAX] = {
|
|||
};
|
||||
|
||||
/** This array holds a textual description of each pool. */
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
static const char *memp_desc[MEMP_MAX] = {
|
||||
#define LWIP_MEMPOOL(name,num,size,desc) (desc),
|
||||
#include "lwip/memp_std.h"
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct stats_ lwip_stats;
|
|||
|
||||
void stats_init(void)
|
||||
{
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
#if MEMP_STATS
|
||||
const char * memp_names[] = {
|
||||
#define LWIP_MEMPOOL(name,num,size,desc) desc,
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ etharp_free_entry(int i)
|
|||
}
|
||||
/* recycle entry for re-use */
|
||||
arp_table[i].state = ETHARP_STATE_EMPTY;
|
||||
#ifdef LWIP_DEBUG
|
||||
#if defined(LWIP_DEBUG) && (LWIP_DEBUG != 0)
|
||||
/* for debugging, clean out the complete entry */
|
||||
arp_table[i].ctime = 0;
|
||||
arp_table[i].netif = NULL;
|
||||
|
|
|
|||
|
|
@ -163,8 +163,7 @@ PACK_STRUCT_END
|
|||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
//#define toupper(CH) \
|
||||
// (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
|
||||
#define toupper(CH) (((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
|
||||
|
||||
|
||||
/** NetBIOS decoding name */
|
||||
|
|
@ -226,7 +225,7 @@ netbios_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr,
|
|||
if (current_netif != NULL && current_netif->num < NET_IF_NUM) {
|
||||
uint32 ip = current_netif->ip_addr.addr;
|
||||
char *curbiosname = netbios_name[current_netif->num];
|
||||
if (curbiosname[0] != '\0' && ip != NULL
|
||||
if (curbiosname[0] != '\0' && ip != 0
|
||||
/* we only answer if we got a default interface */
|
||||
&& (((ip ^ addr->addr) & current_netif->netmask.addr) == 0)) { // запрет ответа другой подсети
|
||||
#if DEBUGSOO > 3
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __NETBIOS_H__
|
||||
#define __NETBIOS_H__
|
||||
|
||||
#include "autoconf.h"
|
||||
#include "lwip/opt.h"
|
||||
|
||||
/** default port number for "NetBIOS Name service */
|
||||
|
|
@ -9,9 +10,9 @@
|
|||
/** size of a NetBIOS name */
|
||||
#define NETBIOS_NAME_LEN 16
|
||||
|
||||
#ifndef NET_IF_NUM
|
||||
#define NET_IF_NUM 2
|
||||
#endif
|
||||
//#ifndef NET_IF_NUM
|
||||
//#define NET_IF_NUM 2
|
||||
//#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ void sntp_get_lasttime(long *sec, long *usec, unsigned int *tick)
|
|||
|
||||
time_t sntp_gen_system_time(int timezone)
|
||||
{
|
||||
struct tm current_tm;
|
||||
// struct tm current_tm;
|
||||
unsigned int update_tick;
|
||||
long update_sec, update_usec, current_sec = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue