mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
update
This commit is contained in:
parent
02f846fa9a
commit
8face3e309
158 changed files with 43738 additions and 3116 deletions
|
@ -15,6 +15,7 @@ typedef enum _WIFI_EVENT_INDICATE{
|
|||
WIFI_EVENT_DISCONNECT = 1,
|
||||
WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
|
||||
}WIFI_EVENT_INDICATE;
|
||||
rtw_event_indicate_t
|
||||
|
||||
int wext_get_ssid(const char *ifname, __u8 *ssid);
|
||||
int wext_set_ssid(const char *ifname, const __u8 *ssid, __u16 ssid_len);
|
||||
|
|
|
@ -1,17 +1,38 @@
|
|||
/******************************************************************************
|
||||
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
|
||||
*
|
||||
* Copyright(c) 2007 - 2014 Realtek Corporation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
#ifndef __PLATFORM_STDLIB_H__
|
||||
#define __PLATFORM_STDLIB_H__
|
||||
|
||||
#define USE_CLIB_PATCH 0
|
||||
#if defined (__GNUC__)
|
||||
/* build rom should set USE_RTL_ROM_CLIB=0 */
|
||||
#ifndef CONFIG_MBED_ENABLED
|
||||
#include <rt_lib_rom.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BUILD_ROM
|
||||
#define USE_RTL_ROM_CLIB 0
|
||||
#else
|
||||
#define BUFFERED_PRINTF 0
|
||||
#ifndef CONFIG_MBED_ENABLED
|
||||
#define USE_RTL_ROM_CLIB 1
|
||||
#else
|
||||
#define USE_RTL_ROM_CLIB 1
|
||||
#define USE_RTL_ROM_CLIB 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A)
|
||||
|
@ -59,7 +80,12 @@
|
|||
#endif
|
||||
|
||||
#if USE_RTL_ROM_CLIB
|
||||
#if BUFFERED_PRINTF
|
||||
extern int buffered_printf(const char* fmt, ...);
|
||||
#define printf buffered_printf
|
||||
#else
|
||||
#define printf rtl_printf
|
||||
#endif
|
||||
#define sprintf rtl_sprintf
|
||||
#define snprintf rtl_snprintf
|
||||
#define memchr rtl_memchr
|
||||
|
@ -67,7 +93,6 @@
|
|||
#define memcpy rtl_memcpy
|
||||
#define memmove rtl_memmove
|
||||
#define memset rtl_memset
|
||||
#define bzero(s,l) rtl_memset(s,0,l)
|
||||
#define strcat rtl_strcat
|
||||
#define strchr rtl_strchr
|
||||
#define strcmp(s1, s2) rtl_strcmp((const char *)s1, (const char *)s2)
|
||||
|
@ -85,12 +110,12 @@
|
|||
extern char* DiagStrtokPatch(char *str, const char* delim);
|
||||
extern char* DiagStrstrPatch(char *string, char *substring);
|
||||
extern int DiagSnPrintfPatch(char *buf, size_t size, const char *fmt, ...);
|
||||
extern int DiagPrintfPatch(const char *fmt, ...);
|
||||
extern int DiagSPrintfPatch(u8 *buf, const char *fmt, ...);
|
||||
extern u32 DiagPrintfPatch(const char *fmt, ...);
|
||||
extern u32 DiagSPrintfPatch(u8 *buf, const char *fmt, ...);
|
||||
#define printf DiagPrintfPatch
|
||||
#define sprintf DiagSPrintfPatch
|
||||
#define snprintf DiagSnPrintfPatch
|
||||
#define strstr(a, b) DiagStrstrPatch((char *)(a), (char *)(b))
|
||||
#define strstr(a, b) DiagStrstrPatch((char *)(a), (char *)(b))
|
||||
#define strtok DiagStrtokPatch
|
||||
#else
|
||||
#define printf DiagPrintf
|
||||
|
@ -125,25 +150,27 @@
|
|||
//extern int DiagSscanfPatch(const char *buf, const char *fmt, ...);
|
||||
//#define sscanf DiagSscanfPatch
|
||||
#define sscanf sscanf // use libc sscanf
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif // defined (__IARSTDLIB__)
|
||||
|
||||
//
|
||||
// memory management
|
||||
//
|
||||
#ifndef CONFIG_MBED_ENABLED
|
||||
extern void *pvPortMalloc( size_t xWantedSize );
|
||||
extern void vPortFree( void *pv );
|
||||
#undef malloc
|
||||
#define malloc pvPortMalloc
|
||||
#undef free
|
||||
#define free vPortFree
|
||||
#endif
|
||||
#elif defined (CONFIG_PLATFORM_8711B)
|
||||
|
||||
#if defined (__IARSTDLIB__)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h> /* va_list */
|
||||
#include "diag.h"
|
||||
|
||||
#define strsep(str, delim) _strsep(str, delim)
|
||||
|
@ -151,18 +178,24 @@ extern void vPortFree( void *pv );
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h> /* va_list */
|
||||
#include "diag.h"
|
||||
#include "strproc.h"
|
||||
#include "memproc.h"
|
||||
#include "basic_types.h"
|
||||
#include "hal_misc.h"
|
||||
#if USE_RTL_ROM_CLIB
|
||||
#include "rtl_lib.h"
|
||||
#include "rom_libc_string.h"
|
||||
#endif
|
||||
|
||||
#undef printf
|
||||
#undef sprintf
|
||||
#undef snprintf
|
||||
#undef atoi
|
||||
#undef memchr
|
||||
#undef memcmp
|
||||
#undef memcpy
|
||||
#undef memset
|
||||
#undef memmove
|
||||
#undef strcmp
|
||||
#undef strcpy
|
||||
#undef strlen
|
||||
|
@ -170,63 +203,61 @@ extern void vPortFree( void *pv );
|
|||
#undef strncpy
|
||||
#undef strsep
|
||||
#undef strtok
|
||||
|
||||
#if USE_RTL_ROM_CLIB
|
||||
#undef memchr
|
||||
#undef memmove
|
||||
#undef strcat
|
||||
#undef strchr
|
||||
#undef strncat
|
||||
#undef strstr
|
||||
#undef atol
|
||||
#undef atoi
|
||||
#undef strpbrk
|
||||
|
||||
#define printf rtl_printf
|
||||
#define sprintf rtl_sprintf
|
||||
#define snprintf rtl_snprintf
|
||||
#define memchr rtl_memchr
|
||||
#define memcmp rtl_memcmp
|
||||
#define memcpy rtl_memcpy
|
||||
#define memmove rtl_memmove
|
||||
#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 strcpy rtl_strcpy
|
||||
#define strlen(str) rtl_strlen((const char *)str)
|
||||
#define strncat rtl_strncat
|
||||
#define strncmp(s1, s2, n) rtl_strncmp((const char *)s1, (const char *)s2, n)
|
||||
#define strncpy rtl_strncpy
|
||||
#define strstr rtl_strstr
|
||||
#define strsep rtl_strsep
|
||||
#define strtok rtl_strtok
|
||||
#if USE_RTL_ROM_CLIB
|
||||
#if BUFFERED_PRINTF
|
||||
extern int buffered_printf(const char* fmt, ...);
|
||||
#define printf buffered_printf
|
||||
#else
|
||||
#define printf DiagPrintf
|
||||
#define sprintf(fmt, arg...) DiagSPrintf((u8*)fmt, ##arg)
|
||||
#if defined (__GNUC__)
|
||||
#define snprintf DiagSnPrintf // NULL function
|
||||
#define strstr(str1, str2) prvStrStr(str1, str2) // NULL function
|
||||
#define printf rtl_printf
|
||||
#endif
|
||||
#define strtok(str, delim) _strsep(str, delim)
|
||||
|
||||
#define sprintf rtl_sprintf
|
||||
#define snprintf rtl_snprintf
|
||||
#define vsnprintf rtl_vsnprintf
|
||||
#else
|
||||
#define printf DiagPrintf
|
||||
#define sprintf(fmt, arg...) DiagSPrintf((u8*)fmt, ##arg)
|
||||
#define snprintf DiagSnPrintf // NULL function
|
||||
#define vsnprintf(buf, size, fmt, ap) VSprintf(buf, fmt, ap)
|
||||
#endif
|
||||
#define memchr __rtl_memchr_v1_00
|
||||
#define memcmp(dst, src, sz) _memcmp(dst, src, sz)
|
||||
#define memcpy(dst, src, sz) _memcpy(dst, src, sz)
|
||||
#define memmove __rtl_memmove_v1_00
|
||||
#define memset(dst, val, sz) _memset(dst, val, sz)
|
||||
|
||||
#define strchr(s, c) _strchr(s, c) // for B-cut ROM
|
||||
#define strcmp(str1, str2) prvStrCmp((const unsigned char *) str1, (const unsigned char *) str2)
|
||||
#define strcpy(dest, src) _strcpy(dest, src)
|
||||
#define strlen(str) prvStrLen((const unsigned char *) str)
|
||||
#define strlen(str) prvStrLen((const unsigned char *) str)
|
||||
#define strsep(str, delim) _strsep(str, delim)
|
||||
#define strstr(str1, str2) prvStrStr(str1, str2) // NULL function
|
||||
#define strtok(str, delim) prvStrtok(str, delim)//_strsep(str, delim)
|
||||
#define strcat __rtl_strcat_v1_00
|
||||
|
||||
#define strncmp(str1, str2, cnt) _strncmp(str1, str2, cnt)
|
||||
#define strncpy(dest, src, count) _strncpy(dest, src, count)
|
||||
#define strsep(str, delim) _strsep(str, delim)
|
||||
|
||||
#define strncat __rtl_strncat_v1_00
|
||||
|
||||
#define atol(str) strtol(str,NULL,10)
|
||||
#define atoi(str) prvAtoi(str)
|
||||
#define strpbrk(cs, ct) _strpbrk(cs, ct) // for B-cut ROM
|
||||
|
||||
#define strpbrk(cs, ct) _strpbrk(cs, ct) // for B-cut ROM
|
||||
#if defined (__GNUC__)
|
||||
#undef sscanf
|
||||
#define sscanf _sscanf
|
||||
#define sscanf _sscanf_patch
|
||||
#define rand Rand
|
||||
#endif
|
||||
//extern int _sscanf_patch(const char *buf, const char *fmt, ...);
|
||||
//#define sscanf _sscanf_patch
|
||||
|
||||
|
||||
#endif
|
||||
#endif // defined (__IARSTDLIB__)
|
||||
|
||||
//
|
||||
|
@ -245,3 +276,4 @@ extern void vPortFree( void *pv );
|
|||
|
||||
|
||||
#endif //__PLATFORM_STDLIB_H__
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//----------------------------------------------------------------------------//
|
||||
#ifndef __WIFI_API_H
|
||||
#define __WIFI_API_H
|
||||
#ifndef __WIFI_CONF_API_H
|
||||
#define __WIFI_CONF_API_H
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "wifi_constants.h"
|
||||
|
@ -705,6 +705,6 @@ int wifi_remove_packet_filter(unsigned char filter_id);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // __WIFI_API_H
|
||||
#endif // __WIFI_CONF_API_H
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
|
|
@ -367,38 +367,40 @@ extern int lwip_init_done;
|
|||
|
||||
void _LwIP_Init(void)
|
||||
{
|
||||
int idx;
|
||||
debug_printf("LwIP Init (%d)\n", wifi_mode);
|
||||
/* Create tcp_ip stack thread */
|
||||
tcpip_init( NULL, NULL );
|
||||
if(!lwip_init_done) {
|
||||
int idx;
|
||||
debug_printf("LwIP Init (%d)\n", wifi_mode);
|
||||
/* Create tcp_ip stack thread */
|
||||
tcpip_init( NULL, NULL );
|
||||
|
||||
chk_ap_netif_num(); // Исполняется после _wifi_on()
|
||||
for(int idx = 0; idx < NET_IF_NUM; idx++) {
|
||||
xnetif[idx].name[0] = 'r';
|
||||
xnetif[idx].name[1] = '0' + idx;
|
||||
chk_ap_netif_num(); // Исполняется после _wifi_on()
|
||||
for(int idx = 0; idx < NET_IF_NUM; idx++) {
|
||||
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);
|
||||
#if CONFIG_ETHERNET // && NET_IF_NUM > 2
|
||||
{
|
||||
struct ip_addr ipaddr;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
ipaddr.addr = DEF_EH_IP;
|
||||
netmask.addr = DEF_EH_MSK;
|
||||
gw.addr = DEF_EH_GW;
|
||||
netif_add(&xnetif[2], &ipaddr, &netmask, &gw, NULL, ðernetif_mii_init, &tcpip_input);
|
||||
}
|
||||
#endif
|
||||
/* Registers the default network interface. */
|
||||
netif_set_default(&xnetif[0]);
|
||||
/* When the netif is fully configured this function must be called.*/
|
||||
for(idx = 0; idx < NET_IF_NUM; idx++) {
|
||||
netif_set_up(&xnetif[idx]);
|
||||
}
|
||||
info_printf("interface %d is initialized\n", idx);
|
||||
wifi_mode = 0;
|
||||
lwip_init_done = 1;
|
||||
}
|
||||
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);
|
||||
#if CONFIG_ETHERNET // && NET_IF_NUM > 2
|
||||
{
|
||||
struct ip_addr ipaddr;
|
||||
struct ip_addr netmask;
|
||||
struct ip_addr gw;
|
||||
ipaddr.addr = DEF_EH_IP;
|
||||
netmask.addr = DEF_EH_MSK;
|
||||
gw.addr = DEF_EH_GW;
|
||||
netif_add(&xnetif[2], &ipaddr, &netmask, &gw, NULL, ðernetif_mii_init, &tcpip_input);
|
||||
}
|
||||
#endif
|
||||
/* Registers the default network interface. */
|
||||
netif_set_default(&xnetif[0]);
|
||||
/* When the netif is fully configured this function must be called.*/
|
||||
for(idx = 0; idx < NET_IF_NUM; idx++) {
|
||||
netif_set_up(&xnetif[idx]);
|
||||
}
|
||||
info_printf("interface %d is initialized\n", idx);
|
||||
wifi_mode = 0;
|
||||
lwip_init_done = 1;
|
||||
}
|
||||
|
||||
int wifi_run(rtw_mode_t mode) {
|
||||
|
@ -406,6 +408,9 @@ int wifi_run(rtw_mode_t mode) {
|
|||
#if CONFIG_DEBUG_LOG > 4
|
||||
debug_printf("\n%s(%d), %d\n", __func__, mode, wifi_run_mode);
|
||||
#endif
|
||||
if(mode != RTW_MODE_NONE) {
|
||||
_LwIP_Init();
|
||||
};
|
||||
if(wifi_run_mode & RTW_MODE_AP) {
|
||||
info_printf("Deinit old AP...\n");
|
||||
LwIP_DHCP(WLAN_AP_NETIF_NUM, DHCP_STOP);
|
||||
|
@ -414,12 +419,12 @@ int wifi_run(rtw_mode_t mode) {
|
|||
#endif
|
||||
dhcps_deinit();
|
||||
wifi_run_mode &= ~RTW_MODE_AP;
|
||||
}
|
||||
};
|
||||
if(wifi_run_mode & RTW_MODE_STA) {
|
||||
info_printf("Deinit old ST...\n");
|
||||
LwIP_DHCP(WLAN_ST_NETIF_NUM, DHCP_STOP);
|
||||
wifi_run_mode &= ~RTW_MODE_STA;
|
||||
}
|
||||
};
|
||||
// if(mode != wifi_mode)
|
||||
// wifi_mode = mode;
|
||||
// chk_ap_netif_num();
|
||||
|
@ -469,7 +474,7 @@ error_end:
|
|||
connect_close();
|
||||
#endif
|
||||
wifi_off();
|
||||
}
|
||||
};
|
||||
chk_ap_netif_num();
|
||||
return ret;
|
||||
}
|
||||
|
@ -484,10 +489,6 @@ void wifi_init_thrd(void) {
|
|||
p_wlan_autoreconnect_hdl = NULL;
|
||||
if (wifi_cfg.mode != RTW_MODE_NONE) {
|
||||
wifi_mode = wifi_cfg.mode;
|
||||
if(!lwip_init_done) {
|
||||
/* Initilaize the LwIP stack */
|
||||
_LwIP_Init();
|
||||
};
|
||||
user_start();
|
||||
#if CONFIG_WIFI_IND_USE_THREAD
|
||||
wifi_manager_init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue