Updated all other files to be inline with version 1.00.10 of the SDK
This commit is contained in:
parent
1c6b25a74b
commit
2bda5c0102
@ -20,6 +20,7 @@
|
||||
EXTERN FUNC
|
||||
*****************************************************************/
|
||||
extern int demo_connect_net(void *, ...);
|
||||
extern int demo_connect_net_with_specific_info(void *, ...);
|
||||
extern int demo_socket_client(void *, ...);
|
||||
extern int demo_socket_server(void *, ...);
|
||||
extern int demo_oneshot(void *, ...);
|
||||
@ -64,6 +65,8 @@ extern int CreateMCastDemoTask(void *, ...);
|
||||
extern int adc_input_voltage_demo(void *, ...);
|
||||
extern int adc_chip_temperature_demo(void*,...);
|
||||
extern int adc_power_voltage_demo(void *, ...);
|
||||
extern int adc_input_voltage_cal_demo(void *, ...);
|
||||
extern int adc_input_voltage_multipoint_cal_demo(void *, ...);
|
||||
extern int sd_card_test(void *, ...);
|
||||
|
||||
extern int demo_wps_pbc(void *, ...);
|
||||
@ -78,7 +81,8 @@ extern int tls_i2s_io_init(void *, ...);
|
||||
extern int tls_i2s_demo(void *, ...);
|
||||
extern int i2c_demo(void *, ...);
|
||||
extern int scan_demo(void *, ...);
|
||||
|
||||
extern int scan_format2_demo(void *, ...);
|
||||
extern int scan_specified_demo(void *, ...);
|
||||
extern int https_demo(void *, ...);
|
||||
extern int mqtt_demo(void *, ...);
|
||||
extern int fatfs_test(void *, ...);
|
||||
@ -147,8 +151,8 @@ struct demo_console_info_t
|
||||
char *info;
|
||||
};
|
||||
|
||||
#define DEMO_CONSOLE_CMD 1 //被解析成cmd
|
||||
#define DEMO_CONSOLE_SHORT_CMD 2 //CMD的一部分,没有解析完
|
||||
#define DEMO_CONSOLE_CMD 1 //被解析成cmd
|
||||
#define DEMO_CONSOLE_SHORT_CMD 2 //CMD的一部分,没有解析完
|
||||
#define DEMO_CONSOLE_WRONG_CMD 3
|
||||
|
||||
#define DEMO_BUF_SIZE TLS_UART_RX_BUF_SIZE
|
||||
@ -162,6 +166,7 @@ struct demo_console_info_t console_tbl[] =
|
||||
//To Do When Add New Demo
|
||||
#if DEMO_CONNECT_NET
|
||||
{"t-connect", demo_connect_net, 0, 2, "Test connecting ap;t-connect(\"ssid\",\"pwd\"); For open ap, pwd should be empty"},
|
||||
{"t-connect_ss", demo_connect_net_with_specific_info, 0x1C, 5, "Test connecting ap;t-connect_ss(\"ssid\",\"pwd\",timeout,pci_en,scan_mode); For open ap, pwd should be empty"},
|
||||
{"t-oneshot", demo_oneshot, 0, 0, "Test Oneshot configuration"},
|
||||
// {"t-socketcfg", demo_socket_config, 0, 0, "Test socket configuration"},
|
||||
{"t-webcfg", demo_webserver_config, 0, 0, "Test web server configuration"},
|
||||
@ -187,6 +192,8 @@ struct demo_console_info_t console_tbl[] =
|
||||
|
||||
#if DEMO_SCAN
|
||||
{"t-scan", scan_demo, 0x0, 0, "Test wifi scan"},
|
||||
{"t-scanf2", scan_format2_demo, 0x0, 0, "Test wifi scan format2"},
|
||||
{"t-ss", scan_specified_demo, 0x3c, 6, "Test specified scan t-ss(\"ssid\",\"mac\",chan,scan_type,min_interval,max_interval)"},
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
@ -255,6 +262,8 @@ struct demo_console_info_t console_tbl[] =
|
||||
{"t-adctemp", adc_chip_temperature_demo, 0x0, 0, "(ADC)Test chip temperature"},
|
||||
{"t-adcvolt", adc_input_voltage_demo, 0x1, 1, "(ADC)Test input voltage,0-PA1(chan0), 1-PA4(chan1),8-different"},
|
||||
{"t-adcpower", adc_power_voltage_demo, 0x0, 0, "(ADC)Sample power supply voltage"},
|
||||
{"t-adccal", adc_input_voltage_cal_demo, 0x3, 2, "(ADC)Calibrate input voltage"},
|
||||
{"t-adccalmp", adc_input_voltage_multipoint_cal_demo, 0x1F, 5, "(ADC) mulitpoint Calibrate t-adccalmp(chanbitmap,chan1ref,chan2ref,chan3ref,chan4ref),unit:mV"},
|
||||
#endif
|
||||
|
||||
#if DEMO_7816
|
||||
@ -317,7 +326,7 @@ struct demo_console_info_t console_tbl[] =
|
||||
#endif
|
||||
|
||||
#if DEMO_MQTT
|
||||
{"t-mqtt", mqtt_demo, 0x0, 0, "Test mqtt"},
|
||||
{"t-mqtt", mqtt_demo, 0x1, 1, "Test mqtt: 0-TCP; 1-TLS; 2-WS; 3-WSS"},
|
||||
#endif
|
||||
|
||||
#if DEMO_FATFS
|
||||
@ -363,11 +372,11 @@ struct demo_console_info_t console_tbl[] =
|
||||
{"t-avoidcopy", avoid_copy_entry, 0x0, 0, "Test Avoid Copy function"},
|
||||
#endif
|
||||
|
||||
//控制台上显示的最后一个命令,如果要让命令显示在控制台上,需要放在该行的上面
|
||||
//控制台上显示的最后一个命令,如果要让命令显示在控制台上,需要放在该行的上面
|
||||
{"demohelp", demo_console_show_help, 0, 0, "Display Help information"},
|
||||
//下面的命令用于内部测试,不显示在控制台上
|
||||
//下面的命令用于内部测试,不显示在控制台上
|
||||
{"reset", demo_sys_reset, 0, 0, "Reset System"},
|
||||
//最后一个命令,检索命令时判断结束标识
|
||||
//最后一个命令,检索命令时判断结束标识
|
||||
{"lastcmd", NULL, 0, 0, "Table Terminal Flag; MUST BE THE LAST ONE"}
|
||||
};
|
||||
|
||||
|
@ -223,11 +223,14 @@ int demo_cmd_execute(Demo_Console *sys)
|
||||
}
|
||||
else if (str_r && str_n)
|
||||
{
|
||||
if (((str_r > str_n) && (str_r > strfirst))
|
||||
||((str_r < str_n) && (str_n > strfirst)))
|
||||
if (((str_r > str_n) && (str_r > strfirst)))
|
||||
{
|
||||
strfirst[str_n - strfirst] = '\0';
|
||||
}
|
||||
else if ((str_r < str_n) && (str_n > strfirst))
|
||||
{
|
||||
strfirst[str_r - strfirst] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/*parser()*/
|
||||
@ -242,6 +245,11 @@ int demo_cmd_execute(Demo_Console *sys)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(!pparam_begin)
|
||||
{
|
||||
printf("\ndemo cmd short\n");
|
||||
return DEMO_CONSOLE_SHORT_CMD;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -261,7 +269,7 @@ int demo_cmd_execute(Demo_Console *sys)
|
||||
if (!pparam_begin && !pparam_end)
|
||||
{
|
||||
/*No Parameter,use default parameter to execute*/
|
||||
printf("[CMD]%s", console_tbl[i].cmd);
|
||||
printf("\n[CMD]%s\n", console_tbl[i].cmd);
|
||||
for (j = 0; j < console_tbl[i].param_cnt; j++)
|
||||
{
|
||||
if (!((console_tbl[i].type >> j) & 0x1))
|
||||
@ -363,6 +371,8 @@ int demo_cmd_execute(Demo_Console *sys)
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n[CMD]%s\n", console_tbl[i].cmd);
|
||||
|
||||
ret = demo_call_fn((int (*)())console_tbl[i].callfn, param, console_tbl[i].param_cnt);
|
||||
if(WM_FAILED == ret)
|
||||
{
|
||||
@ -375,6 +385,7 @@ int demo_cmd_execute(Demo_Console *sys)
|
||||
}
|
||||
else if (pparam_begin && !pparam_end)
|
||||
{
|
||||
printf("\ndemo cmd short\n");
|
||||
return DEMO_CONSOLE_SHORT_CMD;
|
||||
}
|
||||
else
|
||||
@ -390,6 +401,7 @@ int demo_cmd_execute(Demo_Console *sys)
|
||||
{
|
||||
/*wrong cmd parameter,discard this cmd*/
|
||||
//demo_console_show_help(NULL);
|
||||
printf("\nwrong cmd\n");
|
||||
return DEMO_CONSOLE_WRONG_CMD;
|
||||
}
|
||||
}
|
||||
@ -407,6 +419,7 @@ void demo_console_task(void *sdata)
|
||||
demo_console_show_help(NULL);
|
||||
demo_console_malloc();
|
||||
gstConsole.rptr = 0;
|
||||
gstConsole.rx_data_len = DEMO_CONSOLE_BUF_SIZE;
|
||||
tls_uart_set_baud_rate(TLS_UART_0, 115200);
|
||||
tls_uart_rx_callback_register(TLS_UART_0, demo_console_rx, NULL);
|
||||
|
||||
@ -416,22 +429,36 @@ void demo_console_task(void *sdata)
|
||||
switch((u32)msg)
|
||||
{
|
||||
case 1:
|
||||
ret = tls_uart_read(TLS_UART_0, gstConsole.rx_buf + gstConsole.rptr, gstConsole.rx_data_len);
|
||||
if(ret <= 0)
|
||||
while(1)
|
||||
{
|
||||
ret = tls_uart_read(TLS_UART_0, gstConsole.rx_buf + gstConsole.rptr, gstConsole.rx_data_len);
|
||||
if(ret <= 0)
|
||||
break;
|
||||
gstConsole.rx_data_len -= ret;
|
||||
gstConsole.rptr += ret;
|
||||
if(gstConsole.rx_data_len <= 0)
|
||||
break;
|
||||
tls_os_time_delay(20);
|
||||
}
|
||||
if(gstConsole.rptr == 0)
|
||||
break;
|
||||
gstConsole.rx_data_len -= ret;
|
||||
gstConsole.rptr += ret;
|
||||
ret = demo_cmd_execute(&gstConsole); //parse command and execute if needed
|
||||
if((DEMO_CONSOLE_CMD == ret) || (DEMO_CONSOLE_WRONG_CMD == ret))
|
||||
if(DEMO_CONSOLE_CMD == ret)
|
||||
{
|
||||
/*modify*/
|
||||
memset(gstConsole.rx_buf, 0, DEMO_CONSOLE_BUF_SIZE); /*After command finished transfering, clear buffer*/
|
||||
gstConsole.rptr = 0;
|
||||
//printf("Demo cmd is finished\r\n");
|
||||
}
|
||||
else if(DEMO_CONSOLE_WRONG_CMD == ret)
|
||||
{
|
||||
//printf("Demo cmd is wrong\r\n");
|
||||
}
|
||||
else if(DEMO_CONSOLE_SHORT_CMD == ret)
|
||||
{
|
||||
//param not passed all, do nothing.
|
||||
//printf("Demo cmd is short\r\n");
|
||||
}
|
||||
memset(gstConsole.rx_buf, 0, DEMO_CONSOLE_BUF_SIZE); /*After command finished transfering, clear buffer*/
|
||||
gstConsole.rptr = 0;
|
||||
|
||||
if(gstConsole.MsgNum)
|
||||
gstConsole.MsgNum --;
|
||||
|
@ -17,12 +17,89 @@
|
||||
|
||||
|
||||
#if DEMO_ADC
|
||||
#define TMAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
#define TMACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
int adc_input_voltage_cal_demo(u8 chan, signed short refvoltage)
|
||||
{
|
||||
int ret =0;
|
||||
u8 mac[6];
|
||||
|
||||
tls_get_mac_addr(mac);
|
||||
printf("Mac["TMACSTR"],Cch[%d], Refvol[%d] ", TMAC2STR(mac), chan, refvoltage);
|
||||
|
||||
ret = adc_offset_calibration(chan, refvoltage);
|
||||
if (ret == 0)
|
||||
{
|
||||
printf("Calok ");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Calerr \r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int voltage =0;
|
||||
int i =0 ;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (i != chan)
|
||||
{
|
||||
wm_adc_config(i);
|
||||
voltage = adc_get_inputVolt(i);
|
||||
printf("Mch[%d]-%d(mV) ", i, voltage);
|
||||
}
|
||||
}
|
||||
printf("\r\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int adc_input_voltage_multipoint_cal_demo(int chanused,int chan0ref, int chan1ref, int chan2ref, int chan3ref)
|
||||
{
|
||||
int ret =0;
|
||||
u8 mac[6];
|
||||
int refvol[4] = {chan0ref, chan1ref, chan2ref, chan3ref};
|
||||
|
||||
tls_get_mac_addr(mac);
|
||||
printf("Mac["TMACSTR"],", TMAC2STR(mac));
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (chanused&(1<<i))
|
||||
{
|
||||
printf("ch[%d], refvol[%d] ", i, refvol[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ret = adc_multipoint_calibration(chanused, refvol);
|
||||
if (ret == 0)
|
||||
{
|
||||
printf("Calok \r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Calerr \r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int voltage =0;
|
||||
int i =0 ;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
wm_adc_config(i);
|
||||
voltage = adc_get_inputVolt(i);
|
||||
printf("Mch[%d]-%d(mV) \r\n", i, voltage);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int adc_input_voltage_demo(u8 chan)
|
||||
{
|
||||
int voltage =0;
|
||||
|
||||
if (chan <= 1)
|
||||
if (chan < 4)
|
||||
{
|
||||
wm_adc_config(chan);
|
||||
}
|
||||
@ -31,6 +108,15 @@ int adc_input_voltage_demo(u8 chan)
|
||||
wm_adc_config(0);
|
||||
wm_adc_config(1);
|
||||
}
|
||||
else if (chan == 9)
|
||||
{
|
||||
wm_adc_config(2);
|
||||
wm_adc_config(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
voltage = adc_get_inputVolt(chan);
|
||||
if (voltage < 0)
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "wm_include.h"
|
||||
#include "wm_demo.h"
|
||||
#include "wm_wifi_oneshot.h"
|
||||
#include "wm_param.h"
|
||||
|
||||
#if DEMO_CONNECT_NET
|
||||
static void con_net_status_changed_event(u8 status )
|
||||
@ -113,5 +114,63 @@ int demo_connect_net(char *ssid, char *pwd)
|
||||
|
||||
return WM_SUCCESS;
|
||||
}
|
||||
|
||||
//acitve connect to specified AP, use command as: t-connet_ss("ssid","pwd", 10, 0, 0);
|
||||
int demo_connect_net_with_specific_info(char *ssid, char *pwd, u32 timeout, u32 pci_en, u32 scan_mode)
|
||||
{
|
||||
struct tls_param_ip *ip_param = NULL;
|
||||
u8 wireless_protocol = 0;
|
||||
|
||||
|
||||
if (!ssid)
|
||||
{
|
||||
return WM_FAILED;
|
||||
}
|
||||
|
||||
printf("\nssid:%s\n", ssid);
|
||||
printf("password=%s\n", pwd);
|
||||
tls_wifi_disconnect();
|
||||
|
||||
/*clear quick connect information because of scan_mode */
|
||||
{
|
||||
struct tls_param_quick_connect quick_connect;
|
||||
quick_connect.quick_connect_en = FALSE;
|
||||
quick_connect.chanId = 255;
|
||||
|
||||
tls_param_set(TLS_PARAM_ID_QUICK_CONNECT, &quick_connect, TRUE);
|
||||
}
|
||||
|
||||
tls_param_get(TLS_PARAM_ID_WPROTOCOL, (void *) &wireless_protocol, TRUE);
|
||||
if (TLS_PARAM_IEEE80211_INFRA != wireless_protocol)
|
||||
{
|
||||
tls_wifi_softap_destroy();
|
||||
wireless_protocol = TLS_PARAM_IEEE80211_INFRA;
|
||||
tls_param_set(TLS_PARAM_ID_WPROTOCOL, (void *) &wireless_protocol, FALSE);
|
||||
}
|
||||
|
||||
tls_wifi_set_oneshot_flag(0);
|
||||
|
||||
ip_param = tls_mem_alloc(sizeof(struct tls_param_ip));
|
||||
if (ip_param)
|
||||
{
|
||||
tls_param_get(TLS_PARAM_ID_IP, ip_param, FALSE);
|
||||
ip_param->dhcp_enable = TRUE;
|
||||
tls_param_set(TLS_PARAM_ID_IP, ip_param, FALSE);
|
||||
tls_mem_free(ip_param);
|
||||
}
|
||||
|
||||
tls_netif_add_status_event(con_net_status_changed_event);
|
||||
/*configure if sta can connect open/wep AP*/
|
||||
tls_wifi_cfg_connect_pci(pci_en);
|
||||
/*configure the timeout that module connect AP during scanning*/
|
||||
tls_wifi_cfg_connect_timeout(timeout);
|
||||
/*configure if the module immediately connect AP after scan specific AP*/
|
||||
tls_wifi_cfg_connect_scan_mode(scan_mode);
|
||||
tls_wifi_connect((u8 *)ssid, strlen(ssid), (u8 *)pwd, strlen(pwd));
|
||||
printf("\nplease wait connect net......\n");
|
||||
|
||||
return WM_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -32,6 +32,12 @@ u32 http_snd_req(HTTPParameters ClientParams, HTTP_VERB verb, char *pSndData, u8
|
||||
nRetCode = HTTP_CLIENT_ERROR_INVALID_HANDLE;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
if((nRetCode = HTTPClientAddRequestHeaders(pHTTP,"media type", "application/json", 1))!= HTTP_CLIENT_SUCCESS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
*/
|
||||
// Set the Verb
|
||||
nRetCode = HTTPClientSetVerb(pHTTP, verb);
|
||||
if(nRetCode != HTTP_CLIENT_SUCCESS)
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "wm_sockets.h"
|
||||
#include "lwip/inet.h"
|
||||
|
||||
#include "wm_sockets2.0.3.h"
|
||||
#include "wm_sockets.h"
|
||||
#include "HTTPClientWrapper.h"
|
||||
|
||||
#if DEMO_HTTPS
|
||||
|
@ -12,6 +12,7 @@
|
||||
* Date : 2019-3-24
|
||||
*****************************************************************************/
|
||||
#include <string.h>
|
||||
#include "list.h"
|
||||
#include "wm_include.h"
|
||||
#include "wm_netif.h"
|
||||
#include "wm_demo.h"
|
||||
@ -19,14 +20,17 @@
|
||||
#include "lwip/netif.h"
|
||||
#include "wm_sockets.h"
|
||||
#include "lwip/inet.h"
|
||||
#include "wm_sockets2.0.3.h"
|
||||
#include "wm_sockets.h"
|
||||
#include "libemqtt.h"
|
||||
#include "private-libwebsockets.h"
|
||||
#include "libwebsockets.h"
|
||||
#include "HTTPClient.h"
|
||||
|
||||
#if DEMO_MQTT
|
||||
|
||||
#define MQTT_DEMO_TASK_PRIO 39
|
||||
#define MQTT_DEMO_TASK_SIZE 512
|
||||
#define MQTT_DEMO_QUEUE_SIZE 4
|
||||
#define MQTT_DEMO_TASK_SIZE 2048
|
||||
#define MQTT_DEMO_QUEUE_SIZE 16
|
||||
|
||||
#define MQTT_DEMO_RECV_BUF_LEN_MAX 1024
|
||||
|
||||
@ -36,26 +40,56 @@
|
||||
|
||||
#define MQTT_DEMO_READ_TIMEOUT (-1000)
|
||||
|
||||
#define MQTT_DEMO_READ_TIME_SEC 1
|
||||
#define MQTT_DEMO_READ_TIME_SEC 5
|
||||
#define MQTT_DEMO_READ_TIME_US 0
|
||||
|
||||
#define MQTT_DEMO_CLIENT_ID "wm_mqtt_client"
|
||||
#define MQTT_DEMO_TX_PUB_TOPIC "winnermicro/mqtt_tx_demo"
|
||||
#define MQTT_DEMO_RX_PUB_TOPIC "winnermicro/mqtt_rx_demo"
|
||||
#define MQTT_DEMO_TX_PUB_TOPIC "topic_tx"
|
||||
#define MQTT_DEMO_RX_PUB_TOPIC "topic_rx"
|
||||
|
||||
#define MQTT_DEMO_SERVER_ADDR "mqtt.yichen.link"
|
||||
#define MQTT_DEMO_SERVER_PORT 3883
|
||||
#define MQTT_DEMO_SERVER_ADDR "192.168.1.101"
|
||||
#define MQTT_DEMO_SERVER_PORT_TCP 1883
|
||||
#define MQTT_DEMO_SERVER_PORT_TLS 8883
|
||||
#define MQTT_DEMO_SERVER_PORT_WS 8080
|
||||
#define MQTT_DEMO_SERVER_PORT_WSS 8081
|
||||
|
||||
typedef enum _conn_type
|
||||
{
|
||||
MQTT_CONN_TYPE_TCP = 0,
|
||||
MQTT_CONN_TYPE_TLS,
|
||||
MQTT_CONN_TYPE_WS,
|
||||
MQTT_CONN_TYPE_WSS,
|
||||
}mqtt_conn_type;
|
||||
|
||||
typedef struct _mqtt_demo_context
|
||||
{
|
||||
mqtt_conn_type conn_type;
|
||||
int mqtt_demo_socket_id;
|
||||
tls_ssl_t *ssl;
|
||||
struct lws* ws_context;
|
||||
struct dl_list ws_tx_list;
|
||||
struct dl_list ws_rx_list;
|
||||
uint16_t server_port;
|
||||
int (*connect)(struct _mqtt_demo_context *ctx, const struct sockaddr *name, socklen_t namelen,char *hostname);
|
||||
int (*close_mqtt)(struct _mqtt_demo_context *ctx);
|
||||
int (*send_packet)(int socket_info, const void *buf, unsigned int count);
|
||||
int (*read_packet)(struct _mqtt_demo_context *ctx, uint8_t *buf, int buf_len, int sec, int us);
|
||||
int mqtt_demo_mqtt_keepalive;
|
||||
tls_os_timer_t *mqtt_demo_heartbeat_timer;
|
||||
mqtt_broker_handle_t mqtt_demo_mqtt_broker;
|
||||
uint8_t mqtt_demo_packet_buffer[MQTT_DEMO_RECV_BUF_LEN_MAX];
|
||||
}mqtt_demo_context_t;
|
||||
|
||||
static bool mqtt_demo_inited = FALSE;
|
||||
static OS_STK mqtt_demo_task_stk[MQTT_DEMO_TASK_SIZE];
|
||||
static tls_os_queue_t *mqtt_demo_task_queue = NULL;
|
||||
static tls_os_timer_t *mqtt_demo_heartbeat_timer = NULL;
|
||||
/*static tls_os_timer_t *mqtt_demo_heartbeat_timer = NULL;
|
||||
|
||||
static int mqtt_demo_socket_id;
|
||||
static int mqtt_demo_mqtt_keepalive = 300;
|
||||
static mqtt_broker_handle_t mqtt_demo_mqtt_broker;
|
||||
|
||||
static uint8_t mqtt_demo_packet_buffer[MQTT_DEMO_RECV_BUF_LEN_MAX];
|
||||
static uint8_t mqtt_demo_packet_buffer[MQTT_DEMO_RECV_BUF_LEN_MAX];*/
|
||||
|
||||
extern struct netif *tls_get_netif(void);
|
||||
extern int wm_printf(const char *fmt, ...);
|
||||
@ -83,24 +117,283 @@ static void mqtt_demo_net_status(u8 status)
|
||||
|
||||
static void mqtt_demo_heart_timer(void *ptmr, void *parg)
|
||||
{
|
||||
tls_os_queue_send(mqtt_demo_task_queue, (void *)MQTT_DEMO_CMD_HEART, 0);
|
||||
tls_os_status_t os_status = tls_os_queue_send(mqtt_demo_task_queue, (void *)MQTT_DEMO_CMD_HEART, 0);
|
||||
wm_printf("==> heart timer %d\n", os_status);
|
||||
}
|
||||
|
||||
static int mqtt_demo_close_socket(mqtt_broker_handle_t *broker)
|
||||
typedef struct _ws_packet
|
||||
{
|
||||
int fd = broker->socketid;
|
||||
struct dl_list list;
|
||||
char *buf;
|
||||
int buf_len;
|
||||
}ws_packet;
|
||||
static int lwsCallbackNotify(struct lws *wsi,enum lws_callback_reasons reason,void *user, void *in, size_t len)
|
||||
{
|
||||
mqtt_demo_context_t *ctx = (mqtt_demo_context_t *)user;
|
||||
u32 cpu_sr;
|
||||
ws_packet *packet = NULL;
|
||||
//wm_printf("%s: enter ctx 0x%x, reason %d\n", __func__, ctx, reason);
|
||||
switch (reason)
|
||||
{
|
||||
case LWS_CALLBACK_CLIENT_ESTABLISHED:
|
||||
wm_printf("CLIENT_ESTABLISHED\n");
|
||||
//now_state = HANDLE_SESSION;
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
|
||||
wm_printf("CLIENT_CONNECTION_ERROR\n");
|
||||
//now_state = EXIT_SESSION;
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_CLOSED:
|
||||
wm_printf("CLOSED\n");
|
||||
//now_state = EXIT_SESSION;
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_CLIENT_RECEIVE:
|
||||
//((char *)in)[len] = '\0';
|
||||
wm_printf("lws receive len %d\n", len);
|
||||
do
|
||||
{
|
||||
packet = (ws_packet *)tls_mem_alloc(sizeof(ws_packet));
|
||||
if(packet == NULL)
|
||||
{
|
||||
wm_printf("%s: malloc packet error\n", __func__);
|
||||
break;
|
||||
}
|
||||
dl_list_init(&packet->list);
|
||||
packet->buf = tls_mem_alloc(len);
|
||||
if(packet->buf == NULL)
|
||||
{
|
||||
tls_mem_free(packet);
|
||||
wm_printf("%s: malloc packet buffer error\n", __func__);
|
||||
break;
|
||||
}
|
||||
memset(packet->buf, 0, len);
|
||||
memcpy(packet->buf, in, len);
|
||||
packet->buf_len = len;
|
||||
cpu_sr = tls_os_set_critical();
|
||||
dl_list_add_tail(&ctx->ws_rx_list, &packet->list);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
//wm_printf("recv packets count %d\n", dl_list_len(&ctx->ws_rx_list));
|
||||
}while(0);
|
||||
break;
|
||||
|
||||
case LWS_CALLBACK_CLIENT_WRITEABLE:
|
||||
//wm_printf("lws writeable list count %d\n", dl_list_len(&ctx->ws_tx_list));
|
||||
packet = dl_list_first(&ctx->ws_tx_list, ws_packet, list);
|
||||
//wm_printf("dl_list_first packet 0x%x\n", packet);
|
||||
if(packet != NULL)
|
||||
{
|
||||
wm_printf("lws_write ");
|
||||
int n = lws_write( wsi, (unsigned char *)packet->buf + LWS_SEND_BUFFER_PRE_PADDING, packet->buf_len, LWS_WRITE_BINARY );
|
||||
wm_printf("ret %d\n", n);
|
||||
if( n <= 0 )
|
||||
{
|
||||
wm_printf("send error %d\r\n", n);
|
||||
}
|
||||
cpu_sr = tls_os_set_critical();
|
||||
dl_list_del(&packet->list);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
tls_mem_free(packet->buf);
|
||||
tls_mem_free(packet);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct lws_protocols protocols[] = {
|
||||
{
|
||||
"mqtt",
|
||||
lwsCallbackNotify,
|
||||
0,
|
||||
2048,
|
||||
0,
|
||||
NULL
|
||||
},
|
||||
{ NULL, NULL, 0, 0, 0, NULL } /* end */
|
||||
};
|
||||
#define LWS_SERVER_PATH "/"
|
||||
|
||||
static int mqtt_ws_connect(mqtt_demo_context_t *ctx, const struct sockaddr *name, socklen_t namelen,char *hostname)
|
||||
{
|
||||
struct lws_client_connect_info connInfo;
|
||||
struct lws_context_creation_info info;
|
||||
struct lws_context *lwscontext = NULL;
|
||||
|
||||
memset(&info, 0, sizeof(info) );
|
||||
info.port = CONTEXT_PORT_NO_LISTEN;
|
||||
if(ctx->server_port == MQTT_DEMO_SERVER_PORT_WSS)
|
||||
{
|
||||
info.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
|
||||
}
|
||||
protocols[0].user = ctx;
|
||||
protocols[0].per_session_data_size = sizeof(mqtt_demo_context_t *);
|
||||
wm_printf("protocols[0].user 0x%x\n", protocols[0].user);
|
||||
info.protocols = protocols;
|
||||
info.max_http_header_data=512;
|
||||
info.max_http_header_pool=4;
|
||||
|
||||
lwscontext = lws_create_context(&info);
|
||||
memset(&connInfo, 0 , sizeof(connInfo) );
|
||||
connInfo.context = lwscontext;
|
||||
connInfo.address = MQTT_DEMO_SERVER_ADDR;
|
||||
connInfo.port = ctx->server_port;
|
||||
connInfo.ssl_connection = ctx->server_port == MQTT_DEMO_SERVER_PORT_WSS ? 1 : 0;
|
||||
connInfo.path = LWS_SERVER_PATH;
|
||||
connInfo.host = MQTT_DEMO_SERVER_ADDR;
|
||||
connInfo.userdata = ctx;
|
||||
connInfo.protocol = protocols[0].name;
|
||||
connInfo.ietf_version_or_minus_one=13;
|
||||
connInfo.origin = MQTT_DEMO_SERVER_ADDR;
|
||||
ctx->ws_context = lws_client_connect_via_info( &connInfo );
|
||||
if(ctx->ws_context == NULL )
|
||||
{
|
||||
lws_context_destroy(lwscontext);
|
||||
ctx->ws_context->context = NULL;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int mqtt_ws_close_socket(mqtt_demo_context_t *ctx)
|
||||
{
|
||||
wm_printf("EXIT_SESSION ctx 0x%x\n", ctx);
|
||||
if(ctx->ws_context != NULL )
|
||||
{
|
||||
if( ctx->ws_context->context != NULL ) {
|
||||
lws_context_destroy(ctx->ws_context->context);
|
||||
ctx->ws_context->context = NULL;
|
||||
}
|
||||
lws_free(ctx->ws_context);
|
||||
ctx->ws_context = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static int mqtt_ws_send_packet(int socket_info, const void *buf, unsigned int count)
|
||||
{
|
||||
mqtt_demo_context_t *ctx = (mqtt_demo_context_t *)socket_info;
|
||||
u32 cpu_sr;
|
||||
ws_packet *packet = (ws_packet *)tls_mem_alloc(sizeof(ws_packet));
|
||||
|
||||
//wm_printf("%s: enter ctx 0x%x\n", __func__, ctx);
|
||||
if(packet == NULL)
|
||||
{
|
||||
wm_printf("%s: malloc packet error\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
dl_list_init(&packet->list);
|
||||
packet->buf = tls_mem_alloc(count + LWS_SEND_BUFFER_PRE_PADDING + 4);
|
||||
if(packet->buf == NULL)
|
||||
{
|
||||
tls_mem_free(packet);
|
||||
wm_printf("%s: malloc packet buffer error\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
memset(packet->buf, 0, count + LWS_SEND_BUFFER_PRE_PADDING + 4);
|
||||
memcpy(packet->buf + LWS_SEND_BUFFER_PRE_PADDING, buf, count);
|
||||
packet->buf_len = count;
|
||||
cpu_sr = tls_os_set_critical();
|
||||
dl_list_add_tail(&ctx->ws_tx_list, &packet->list);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
//wm_printf("send packets count %d\n", dl_list_len(&ctx->ws_tx_list));
|
||||
lws_callback_on_writable(ctx->ws_context);
|
||||
return count;
|
||||
}
|
||||
static int mqtt_ws_read_packet(mqtt_demo_context_t *ctx, uint8_t *buf, int buf_len, int sec, int us)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
ws_packet *packet = NULL;
|
||||
int start_tick = tls_os_get_time();
|
||||
volatile int now_tick;
|
||||
int timeout = (sec*1000 + us/1000) * HZ / 1000;
|
||||
//wm_printf("%s: enter ctx 0x%x, timeout %d, start_tick %d\n", __func__, ctx, timeout, start_tick);
|
||||
|
||||
do
|
||||
{
|
||||
lws_service(ctx->ws_context->context, 250);
|
||||
lws_callback_on_writable(ctx->ws_context);
|
||||
packet = dl_list_first(&ctx->ws_rx_list, ws_packet, list);
|
||||
//wm_printf("%s dl_list_first packet 0x%x\n", __func__, packet);
|
||||
if(packet != NULL)
|
||||
{
|
||||
if(buf_len > packet->buf_len)
|
||||
{
|
||||
buf_len = packet->buf_len;
|
||||
}
|
||||
memcpy(buf, packet->buf, buf_len);
|
||||
cpu_sr = tls_os_set_critical();
|
||||
dl_list_del(&packet->list);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
tls_mem_free(packet->buf);
|
||||
tls_mem_free(packet);
|
||||
return buf_len;
|
||||
}
|
||||
tls_os_time_delay(10);
|
||||
now_tick = tls_os_get_time();
|
||||
//wm_printf("%s tick now %d | %d < %d\n", __func__, now_tick, (now_tick - start_tick), timeout);
|
||||
}while((now_tick - start_tick) < timeout);
|
||||
//wm_printf("%s return timeout\n", __func__);
|
||||
return MQTT_DEMO_READ_TIMEOUT;
|
||||
}
|
||||
|
||||
static int mqtt_tls_connect(mqtt_demo_context_t *ctx, const struct sockaddr *name, socklen_t namelen,char *hostname)
|
||||
{
|
||||
return HTTPWrapperSSLConnect(&ctx->ssl, ctx->mqtt_demo_socket_id, name, namelen, hostname);
|
||||
}
|
||||
static int mqtt_tls_close_socket(mqtt_demo_context_t *ctx)
|
||||
{
|
||||
return HTTPWrapperSSLClose(ctx->ssl, ctx->mqtt_demo_socket_id);
|
||||
}
|
||||
static int mqtt_tls_send_packet(int socket_info, const void *buf, unsigned int count)
|
||||
{
|
||||
mqtt_demo_context_t *ctx = (mqtt_demo_context_t *)socket_info;
|
||||
return HTTPWrapperSSLSend(ctx->ssl, ctx->mqtt_demo_socket_id, (char *)buf, count, 0);
|
||||
}
|
||||
static int mqtt_tls_read_packet(mqtt_demo_context_t *ctx, uint8_t *buf, int buf_len, int sec, int us)
|
||||
{
|
||||
int ret = HTTPWrapperSSLRecv(ctx->ssl, ctx->mqtt_demo_socket_id, (char *)buf, buf_len, 0);
|
||||
if (ret <= 0)
|
||||
{
|
||||
if (SOCKET_SSL_MORE_DATA == ret)
|
||||
{
|
||||
ret = buf_len;
|
||||
}
|
||||
else if(MBEDTLS_ERR_SSL_TIMEOUT == ret)
|
||||
{
|
||||
ret = MQTT_DEMO_READ_TIMEOUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
wm_printf("tls recv %d closed\r\n", ret);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mqtt_tcp_connect(mqtt_demo_context_t *ctx, const struct sockaddr *name, socklen_t namelen,char *hostname)
|
||||
{
|
||||
return connect(ctx->mqtt_demo_socket_id, name, namelen);
|
||||
}
|
||||
static int mqtt_tcp_close_socket(mqtt_demo_context_t *ctx)
|
||||
{
|
||||
int fd = ctx->mqtt_demo_socket_id;
|
||||
return closesocket(fd);
|
||||
}
|
||||
|
||||
static int mqtt_demo_send_packet(int socket_info, const void *buf, unsigned int count)
|
||||
static int mqtt_tcp_send_packet(int socket_info, const void *buf, unsigned int count)
|
||||
{
|
||||
int fd = socket_info;
|
||||
return send(fd, buf, count, 0);
|
||||
mqtt_demo_context_t *ctx = (mqtt_demo_context_t *)socket_info;
|
||||
return send(ctx->mqtt_demo_socket_id, buf, count, 0);
|
||||
}
|
||||
|
||||
static int mqtt_demo_read_packet(int sec, int us)
|
||||
static int mqtt_tcp_read_packet(mqtt_demo_context_t *ctx, uint8_t *buf, int buf_len, int sec, int us)
|
||||
{
|
||||
int ret = 0;
|
||||
int bytes_rcvd;
|
||||
int fd = ctx->mqtt_demo_socket_id;
|
||||
|
||||
if ((sec >= 0) || (us >= 0))
|
||||
{
|
||||
@ -109,14 +402,14 @@ static int mqtt_demo_read_packet(int sec, int us)
|
||||
|
||||
// Initialize the file descriptor set
|
||||
FD_ZERO (&readfds);
|
||||
FD_SET (mqtt_demo_socket_id, &readfds);
|
||||
FD_SET (fd, &readfds);
|
||||
|
||||
// Initialize the timeout data structure
|
||||
tmv.tv_sec = sec;
|
||||
tmv.tv_usec = us;
|
||||
|
||||
// select returns 0 if timeout, 1 if input available, -1 if error
|
||||
ret = select(mqtt_demo_socket_id + 1, &readfds, NULL, NULL, &tmv);
|
||||
ret = select(fd + 1, &readfds, NULL, NULL, &tmv);
|
||||
if(ret < 0)
|
||||
return -2;
|
||||
else if(ret == 0)
|
||||
@ -124,14 +417,24 @@ static int mqtt_demo_read_packet(int sec, int us)
|
||||
|
||||
}
|
||||
|
||||
int total_bytes = 0, bytes_rcvd, packet_length;
|
||||
memset(mqtt_demo_packet_buffer, 0, sizeof(mqtt_demo_packet_buffer));
|
||||
|
||||
if((bytes_rcvd = recv(mqtt_demo_socket_id, (mqtt_demo_packet_buffer + total_bytes), MQTT_DEMO_RECV_BUF_LEN_MAX, 0)) <= 0)
|
||||
if((bytes_rcvd = recv(fd, buf, buf_len, 0)) <= 0)
|
||||
{
|
||||
//printf("%d, %d\r\n", bytes_rcvd, mqtt_demo_socket_id);
|
||||
return -1;
|
||||
}
|
||||
return bytes_rcvd;
|
||||
}
|
||||
|
||||
static int mqtt_demo_recv_parse(mqtt_demo_context_t *ctx, int sec, int us)
|
||||
{
|
||||
int total_bytes = 0, bytes_rcvd, packet_length;
|
||||
memset(ctx->mqtt_demo_packet_buffer, 0, sizeof(ctx->mqtt_demo_packet_buffer));
|
||||
|
||||
bytes_rcvd = ctx->read_packet(ctx, (ctx->mqtt_demo_packet_buffer + total_bytes), MQTT_DEMO_RECV_BUF_LEN_MAX, sec, us);
|
||||
if(bytes_rcvd <= 0)
|
||||
{
|
||||
return bytes_rcvd;
|
||||
}
|
||||
//printf("recv [len=%d] : %s\n", bytes_rcvd, mqtt_demo_packet_buffer);
|
||||
total_bytes += bytes_rcvd; // Keep tally of total bytes
|
||||
if (total_bytes < 2)
|
||||
@ -139,8 +442,8 @@ static int mqtt_demo_read_packet(int sec, int us)
|
||||
|
||||
// now we have the full fixed header in mqtt_demo_packet_buffer
|
||||
// parse it for remaining length and number of bytes
|
||||
uint16_t rem_len = mqtt_parse_rem_len(mqtt_demo_packet_buffer);
|
||||
uint8_t rem_len_bytes = mqtt_num_rem_len_bytes(mqtt_demo_packet_buffer);
|
||||
uint16_t rem_len = mqtt_parse_rem_len(ctx->mqtt_demo_packet_buffer);
|
||||
uint8_t rem_len_bytes = mqtt_num_rem_len_bytes(ctx->mqtt_demo_packet_buffer);
|
||||
|
||||
//packet_length = mqtt_demo_packet_buffer[1] + 2; // Remaining length + fixed header length
|
||||
// total packet length = remaining length + byte 1 of fixed header + remaning length part of fixed header
|
||||
@ -148,7 +451,7 @@ static int mqtt_demo_read_packet(int sec, int us)
|
||||
|
||||
while(total_bytes < packet_length) // Reading the packet
|
||||
{
|
||||
if((bytes_rcvd = recv(mqtt_demo_socket_id, (mqtt_demo_packet_buffer + total_bytes), MQTT_DEMO_RECV_BUF_LEN_MAX, 0)) <= 0)
|
||||
if((bytes_rcvd = ctx->read_packet(ctx, (ctx->mqtt_demo_packet_buffer + total_bytes), MQTT_DEMO_RECV_BUF_LEN_MAX, sec, us)) <= 0)
|
||||
return -1;
|
||||
total_bytes += bytes_rcvd; // Keep tally of total bytes
|
||||
}
|
||||
@ -156,19 +459,19 @@ static int mqtt_demo_read_packet(int sec, int us)
|
||||
return packet_length;
|
||||
}
|
||||
|
||||
static int mqtt_demo_init_socket(mqtt_broker_handle_t *broker, const char *hostname, short port, int keepalive)
|
||||
static int mqtt_demo_init_socket(mqtt_demo_context_t *ctx, const char *hostname, short port, int keepalive)
|
||||
{
|
||||
int flag = 1;
|
||||
struct hostent *hp;
|
||||
|
||||
// Create the socket
|
||||
if((mqtt_demo_socket_id = socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
||||
if((ctx->mqtt_demo_socket_id = socket(PF_INET, SOCK_STREAM, 0)) < 0)
|
||||
return -1;
|
||||
|
||||
// Disable Nagle Algorithm
|
||||
if (setsockopt(mqtt_demo_socket_id, IPPROTO_TCP, 0x01, (char *)&flag, sizeof(flag)) < 0)
|
||||
if (setsockopt(ctx->mqtt_demo_socket_id, IPPROTO_TCP, 0x01, (char *)&flag, sizeof(flag)) < 0)
|
||||
{
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -176,7 +479,7 @@ static int mqtt_demo_init_socket(mqtt_broker_handle_t *broker, const char *hostn
|
||||
hp = gethostbyname(hostname);
|
||||
if (hp == NULL )
|
||||
{
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@ -187,30 +490,31 @@ static int mqtt_demo_init_socket(mqtt_broker_handle_t *broker, const char *hostn
|
||||
memcpy(&(socket_address.sin_addr), hp->h_addr, hp->h_length);
|
||||
|
||||
// Connect the socket
|
||||
if((connect(mqtt_demo_socket_id, (struct sockaddr *)&socket_address, sizeof(socket_address))) < 0)
|
||||
if((ctx->connect(ctx, (struct sockaddr *)&socket_address, sizeof(socket_address), NULL)) < 0)
|
||||
{
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// MQTT stuffs
|
||||
mqtt_set_alive(broker, mqtt_demo_mqtt_keepalive);
|
||||
broker->socketid = mqtt_demo_socket_id;
|
||||
broker->mqttsend = mqtt_demo_send_packet;
|
||||
mqtt_set_alive(&ctx->mqtt_demo_mqtt_broker, ctx->mqtt_demo_mqtt_keepalive);
|
||||
ctx->mqtt_demo_mqtt_broker.socketid = (int)ctx;
|
||||
ctx->mqtt_demo_mqtt_broker.mqttsend = ctx->send_packet;
|
||||
//wm_printf("socket id = %d\n", mqtt_demo_socket_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mqtt_demo_init(void)
|
||||
static int mqtt_demo_init(mqtt_demo_context_t *ctx)
|
||||
{
|
||||
int packet_length, ret = 0;
|
||||
uint16_t msg_id, msg_id_rcv;
|
||||
|
||||
wm_printf("step1: init mqtt lib.\r\n");
|
||||
mqtt_init(&mqtt_demo_mqtt_broker, MQTT_DEMO_CLIENT_ID);
|
||||
mqtt_init(&ctx->mqtt_demo_mqtt_broker, MQTT_DEMO_CLIENT_ID);
|
||||
mqtt_init_auth(&ctx->mqtt_demo_mqtt_broker, "admin", "password");
|
||||
|
||||
wm_printf("step2: establishing TCP connection.\r\n");
|
||||
ret = mqtt_demo_init_socket(&mqtt_demo_mqtt_broker, MQTT_DEMO_SERVER_ADDR, MQTT_DEMO_SERVER_PORT, mqtt_demo_mqtt_keepalive);
|
||||
ret = mqtt_demo_init_socket(ctx, MQTT_DEMO_SERVER_ADDR, ctx->server_port, ctx->mqtt_demo_mqtt_keepalive);
|
||||
if(ret)
|
||||
{
|
||||
wm_printf("init_socket ret=%d\n", ret);
|
||||
@ -218,96 +522,117 @@ static int mqtt_demo_init(void)
|
||||
}
|
||||
|
||||
wm_printf("step3: establishing mqtt connection.\r\n");
|
||||
ret = mqtt_connect(&mqtt_demo_mqtt_broker);
|
||||
ret = mqtt_connect(&ctx->mqtt_demo_mqtt_broker);
|
||||
if(ret)
|
||||
{
|
||||
wm_printf("mqtt_connect ret=%d\n", ret);
|
||||
return -5;
|
||||
}
|
||||
|
||||
packet_length = mqtt_demo_read_packet(MQTT_DEMO_READ_TIME_SEC, MQTT_DEMO_READ_TIME_US);
|
||||
packet_length = mqtt_demo_recv_parse(ctx, MQTT_DEMO_READ_TIME_SEC, MQTT_DEMO_READ_TIME_US);
|
||||
if(packet_length < 0)
|
||||
{
|
||||
wm_printf("Error(%d) on read packet!\n", packet_length);
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(MQTTParseMessageType(mqtt_demo_packet_buffer) != MQTT_MSG_CONNACK)
|
||||
if(MQTTParseMessageType(ctx->mqtt_demo_packet_buffer) != MQTT_MSG_CONNACK)
|
||||
{
|
||||
wm_printf("CONNACK expected!\n");
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -2;
|
||||
}
|
||||
|
||||
if(mqtt_demo_packet_buffer[3] != 0x00)
|
||||
if(ctx->mqtt_demo_packet_buffer[3] != 0x00)
|
||||
{
|
||||
wm_printf("CONNACK failed!\n");
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
wm_printf("step4: subscribe mqtt\r\n");
|
||||
mqtt_subscribe(&mqtt_demo_mqtt_broker, MQTT_DEMO_TX_PUB_TOPIC, &msg_id);
|
||||
mqtt_subscribe(&ctx->mqtt_demo_mqtt_broker, MQTT_DEMO_TX_PUB_TOPIC, &msg_id);
|
||||
|
||||
packet_length = mqtt_demo_read_packet(MQTT_DEMO_READ_TIME_SEC, MQTT_DEMO_READ_TIME_US);
|
||||
packet_length = mqtt_demo_recv_parse(ctx, MQTT_DEMO_READ_TIME_SEC, MQTT_DEMO_READ_TIME_US);
|
||||
if(packet_length < 0)
|
||||
{
|
||||
wm_printf("Error(%d) on read packet!\n", packet_length);
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(MQTTParseMessageType(mqtt_demo_packet_buffer) != MQTT_MSG_SUBACK)
|
||||
if(MQTTParseMessageType(ctx->mqtt_demo_packet_buffer) != MQTT_MSG_SUBACK)
|
||||
{
|
||||
wm_printf("SUBACK expected!\n");
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -2;
|
||||
}
|
||||
|
||||
msg_id_rcv = mqtt_parse_msg_id(mqtt_demo_packet_buffer);
|
||||
msg_id_rcv = mqtt_parse_msg_id(ctx->mqtt_demo_packet_buffer);
|
||||
if(msg_id != msg_id_rcv)
|
||||
{
|
||||
wm_printf("%d message id was expected, but %d message id was found!\n", msg_id, msg_id_rcv);
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -3;
|
||||
}
|
||||
#if 0
|
||||
wm_printf("step4+: unsubscribe mqtt\r\n");
|
||||
mqtt_unsubscribe(&ctx->mqtt_demo_mqtt_broker, MQTT_DEMO_TX_PUB_TOPIC, &msg_id);
|
||||
|
||||
wm_printf("step5: start the Heart-beat preservation timer\r\n");
|
||||
ret = tls_os_timer_create(&mqtt_demo_heartbeat_timer,
|
||||
packet_length = mqtt_demo_recv_parse(ctx, MQTT_DEMO_READ_TIME_SEC, MQTT_DEMO_READ_TIME_US);
|
||||
if(packet_length < 0)
|
||||
{
|
||||
wm_printf("Error(%d) on read packet!\n", packet_length);
|
||||
ctx->close_mqtt(ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(MQTTParseMessageType(ctx->mqtt_demo_packet_buffer) != MQTT_MSG_UNSUBACK)
|
||||
{
|
||||
wm_printf("UNSUBACK expected!\n");
|
||||
ctx->close_mqtt(ctx);
|
||||
return -2;
|
||||
}
|
||||
#endif
|
||||
wm_printf("step5: start the Heart-beat preservation timer ");
|
||||
ret = tls_os_timer_create(&ctx->mqtt_demo_heartbeat_timer,
|
||||
mqtt_demo_heart_timer,
|
||||
NULL, (10 * HZ), TRUE, NULL);
|
||||
if (TLS_OS_SUCCESS == ret)
|
||||
tls_os_timer_start(mqtt_demo_heartbeat_timer);
|
||||
{
|
||||
tls_os_timer_start(ctx->mqtt_demo_heartbeat_timer);
|
||||
}
|
||||
wm_printf("%s\r\n" , TLS_OS_SUCCESS == ret ? "ok" : "error");
|
||||
|
||||
/* step6: push mqtt subscription (when a subscription message is received) */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mqtt_demo_loop(void)
|
||||
static int mqtt_demo_loop(mqtt_demo_context_t *ctx)
|
||||
{
|
||||
int packet_length = 0;
|
||||
int counter = 0;
|
||||
|
||||
counter++;
|
||||
packet_length = mqtt_demo_read_packet(0, 1);
|
||||
packet_length = mqtt_demo_recv_parse(ctx, 1, 1);
|
||||
if(packet_length > 0)
|
||||
{
|
||||
//wm_printf("recvd Packet Header: 0x%x...\n", mqtt_demo_packet_buffer[0]);
|
||||
|
||||
if (MQTTParseMessageType(mqtt_demo_packet_buffer) == MQTT_MSG_PUBLISH)
|
||||
if (MQTTParseMessageType(ctx->mqtt_demo_packet_buffer) == MQTT_MSG_PUBLISH)
|
||||
{
|
||||
uint8_t topic[100], *msg;
|
||||
uint16_t len;
|
||||
len = mqtt_parse_pub_topic(mqtt_demo_packet_buffer, topic);
|
||||
len = mqtt_parse_pub_topic(ctx->mqtt_demo_packet_buffer, topic);
|
||||
topic[len] = '\0'; // for printf
|
||||
len = mqtt_parse_publish_msg(mqtt_demo_packet_buffer, &msg);
|
||||
len = mqtt_parse_publish_msg(ctx->mqtt_demo_packet_buffer, &msg);
|
||||
msg[len] = '\0'; // for printf
|
||||
wm_printf("recvd: %s >>> %s\n", topic, msg);
|
||||
|
||||
mqtt_publish(&mqtt_demo_mqtt_broker, (const char *)MQTT_DEMO_RX_PUB_TOPIC, (const char *)msg, len, 0);
|
||||
mqtt_publish(&ctx->mqtt_demo_mqtt_broker, (const char *)MQTT_DEMO_RX_PUB_TOPIC, (const char *)msg, len, 0);
|
||||
wm_printf("pushed: %s <<< %s\n", MQTT_DEMO_RX_PUB_TOPIC, msg);
|
||||
}
|
||||
|
||||
@ -320,8 +645,8 @@ static int mqtt_demo_loop(void)
|
||||
else if(packet_length == -1)
|
||||
{
|
||||
wm_printf("mqtt error:(%d), stop mqtt demo!\n", packet_length);
|
||||
tls_os_timer_stop(mqtt_demo_heartbeat_timer);
|
||||
mqtt_demo_close_socket(&mqtt_demo_mqtt_broker);
|
||||
tls_os_timer_stop(ctx->mqtt_demo_heartbeat_timer);
|
||||
ctx->close_mqtt(ctx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -332,7 +657,48 @@ static void mqtt_demo_task(void *p)
|
||||
int ret;
|
||||
void *msg;
|
||||
struct tls_ethif *ether_if = tls_netif_get_ethif();
|
||||
mqtt_demo_context_t *ctx = tls_mem_alloc(sizeof(mqtt_demo_context_t));
|
||||
|
||||
if(ctx == NULL)
|
||||
{
|
||||
wm_printf("MQTT Demo context malloc Error!\n");
|
||||
return;
|
||||
}
|
||||
memset(ctx, 0, sizeof(mqtt_demo_context_t));
|
||||
ctx->conn_type = (mqtt_conn_type)p;
|
||||
wm_printf("conn_type %u ctx 0x%x mqtt_demo_socket_id 0x%x\n", ctx->conn_type, ctx, (int)&ctx->mqtt_demo_socket_id);
|
||||
switch(ctx->conn_type)
|
||||
{
|
||||
case MQTT_CONN_TYPE_TCP:
|
||||
ctx->connect = mqtt_tcp_connect;
|
||||
ctx->close_mqtt = mqtt_tcp_close_socket;
|
||||
ctx->send_packet = mqtt_tcp_send_packet;
|
||||
ctx->read_packet = mqtt_tcp_read_packet;
|
||||
ctx->server_port = MQTT_DEMO_SERVER_PORT_TCP;
|
||||
break;
|
||||
case MQTT_CONN_TYPE_TLS:
|
||||
ctx->connect = mqtt_tls_connect;
|
||||
ctx->close_mqtt = mqtt_tls_close_socket;
|
||||
ctx->send_packet = mqtt_tls_send_packet;
|
||||
ctx->read_packet = mqtt_tls_read_packet;
|
||||
ctx->server_port = MQTT_DEMO_SERVER_PORT_TLS;
|
||||
break;
|
||||
case MQTT_CONN_TYPE_WS:
|
||||
case MQTT_CONN_TYPE_WSS:
|
||||
ctx->connect = mqtt_ws_connect;
|
||||
ctx->close_mqtt = mqtt_ws_close_socket;
|
||||
ctx->send_packet = mqtt_ws_send_packet;
|
||||
ctx->read_packet = mqtt_ws_read_packet;
|
||||
ctx->server_port = MQTT_CONN_TYPE_WS == ctx->conn_type ? MQTT_DEMO_SERVER_PORT_WS : MQTT_DEMO_SERVER_PORT_WSS;
|
||||
break;
|
||||
default:
|
||||
wm_printf("conn_type %u is not supported error!\n");
|
||||
return;
|
||||
}
|
||||
ctx->mqtt_demo_socket_id = -1;
|
||||
ctx->mqtt_demo_mqtt_keepalive = 300;
|
||||
dl_list_init(&ctx->ws_tx_list);
|
||||
dl_list_init(&ctx->ws_rx_list);
|
||||
if (ether_if->status)
|
||||
{
|
||||
wm_printf("sta ip: %v\n", ether_if->ip_addr.addr);
|
||||
@ -349,7 +715,7 @@ static void mqtt_demo_task(void *p)
|
||||
case MQTT_DEMO_CMD_START:
|
||||
do
|
||||
{
|
||||
ret = mqtt_demo_init();
|
||||
ret = mqtt_demo_init(ctx);
|
||||
if (ret)
|
||||
break;
|
||||
tls_os_queue_send(mqtt_demo_task_queue, (void *)MQTT_DEMO_CMD_LOOP, 0);
|
||||
@ -358,10 +724,10 @@ static void mqtt_demo_task(void *p)
|
||||
break;
|
||||
case MQTT_DEMO_CMD_HEART:
|
||||
wm_printf("send heart ping\r\n");
|
||||
mqtt_ping(&mqtt_demo_mqtt_broker);
|
||||
mqtt_ping(&ctx->mqtt_demo_mqtt_broker);
|
||||
break;
|
||||
case MQTT_DEMO_CMD_LOOP:
|
||||
mqtt_demo_loop();
|
||||
mqtt_demo_loop(ctx);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -372,16 +738,16 @@ static void mqtt_demo_task(void *p)
|
||||
|
||||
|
||||
//mqtt demo
|
||||
//测试服务器:mqtt.yichen.link:3883
|
||||
//服务器端用于发送的订阅主题为:winnermicro/mqtt_tx_demo
|
||||
//服务器端用于接收的订阅主题为:winnermicro/mqtt_rx_demo
|
||||
//工作流程: 接收到winnermicro/mqtt_tx_demo推送的消息后打印在屏幕上,并再次推送到winnermicro/mqtt_rx_demo
|
||||
int mqtt_demo(void)
|
||||
//测试服务器:mqtt.yichen.link:3883
|
||||
//服务器端用于发送的订阅主题为:winnermicro/mqtt_tx_demo
|
||||
//服务器端用于接收的订阅主题为:winnermicro/mqtt_rx_demo
|
||||
//工作流程: 接收到winnermicro/mqtt_tx_demo推送的消息后打印在屏幕上,并再次推送到winnermicro/mqtt_rx_demo
|
||||
int mqtt_demo(int type)
|
||||
{
|
||||
if (!mqtt_demo_inited)
|
||||
{
|
||||
tls_os_task_create(NULL, NULL, mqtt_demo_task,
|
||||
NULL, (void *)mqtt_demo_task_stk, /* task's stack start address */
|
||||
(void *)type, (void *)mqtt_demo_task_stk, /* task's stack start address */
|
||||
MQTT_DEMO_TASK_SIZE * sizeof(u32), /* task's stack size, unit:byte */
|
||||
MQTT_DEMO_TASK_PRIO, 0);
|
||||
|
||||
|
@ -152,6 +152,286 @@ end:
|
||||
tls_mem_free(buf1);
|
||||
}
|
||||
}
|
||||
|
||||
static void wifi_scan_format2_handler(void)
|
||||
{
|
||||
char *buf = NULL;
|
||||
char *buf1 = NULL;
|
||||
u32 buflen;
|
||||
int i, j;
|
||||
int err;
|
||||
u8 ssid[33];
|
||||
struct tls_scan_bss_format2_t *wsr;
|
||||
struct tls_bss_info_format2_t *bss_info;
|
||||
|
||||
buflen = 2000;
|
||||
buf = tls_mem_alloc(buflen);
|
||||
if (!buf)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
buf1 = tls_mem_alloc(300);
|
||||
if(!buf1)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
memset(buf1, 0, 300);
|
||||
|
||||
err = tls_wifi_get_scan_rslt_format2((u8 *)buf, buflen);
|
||||
if (err)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
wsr = (struct tls_scan_bss_format2_t *)buf;
|
||||
bss_info = (struct tls_bss_info_format2_t *)(buf + 8);
|
||||
|
||||
printf("\n");
|
||||
|
||||
for(i = 0; i < wsr->count; i++)
|
||||
{
|
||||
j = sprintf(buf1, "(%d,", bss_info->ecn);
|
||||
memcpy(ssid, bss_info->ssid, bss_info->ssid_len);
|
||||
ssid[bss_info->ssid_len] = '\0';
|
||||
|
||||
j += sprintf(buf1 + j, "%s", ssid);
|
||||
|
||||
j += sprintf(buf1 + j, ",%d, ", (signed char)bss_info->rssi);
|
||||
|
||||
j += sprintf(buf1 + j, "\"%02x:%02x:%02x:%02x:%02x:%02x\", ", bss_info->bssid[0], bss_info->bssid[1],
|
||||
bss_info->bssid[2], bss_info->bssid[3], bss_info->bssid[4], bss_info->bssid[5]);
|
||||
|
||||
j += sprintf(buf1 + j, "%d, ", bss_info->channel);
|
||||
|
||||
j += sprintf(buf1 + j, "%d, ", bss_info->group_cipher);
|
||||
|
||||
j += sprintf(buf1 + j, "%d, ", bss_info->pairwise_cipher);
|
||||
|
||||
j += sprintf(buf1 + j, "%d, ", bss_info->bgn);
|
||||
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->wps_support);
|
||||
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->freq_offset);
|
||||
|
||||
j += sprintf(buf1 + j, "%d)", bss_info->freqcal_val);
|
||||
|
||||
|
||||
printf("%s\n", buf1);
|
||||
|
||||
bss_info ++;
|
||||
}
|
||||
|
||||
end:
|
||||
if(buf)
|
||||
{
|
||||
tls_mem_free(buf);
|
||||
}
|
||||
if(buf1)
|
||||
{
|
||||
tls_mem_free(buf1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct specified_scan_info
|
||||
{
|
||||
u8 specified_ssid[33];
|
||||
u16 specified_ssid_len;
|
||||
u8 specified_bssid[18];
|
||||
u8 specified_chan;
|
||||
u8 specified_mask;
|
||||
};
|
||||
|
||||
struct specified_scan_info specifiedinfo;
|
||||
|
||||
static void wifi_scan_format2_filter_handler(void)
|
||||
{
|
||||
char *buf = NULL;
|
||||
char *buf1 = NULL;
|
||||
u32 buflen;
|
||||
int i, j;
|
||||
int err;
|
||||
u8 ssid[33];
|
||||
u8 bssid[18];
|
||||
struct tls_scan_bss_format2_t *wsr;
|
||||
struct tls_bss_info_format2_t *bss_info;
|
||||
u8 bitmask = 0;
|
||||
|
||||
buflen = 2000;
|
||||
buf = tls_mem_alloc(buflen);
|
||||
if (!buf)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
buf1 = tls_mem_alloc(300);
|
||||
if(!buf1)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
memset(buf1, 0, 300);
|
||||
|
||||
err = tls_wifi_get_scan_rslt_format2((u8 *)buf, buflen);
|
||||
if (err)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
wsr = (struct tls_scan_bss_format2_t *)buf;
|
||||
bss_info = (struct tls_bss_info_format2_t *)(buf + 8);
|
||||
|
||||
printf("\n");
|
||||
bitmask = specifiedinfo.specified_mask;
|
||||
for(i = 0; i < wsr->count; i++)
|
||||
{
|
||||
j = sprintf(buf1, "(%d,", bss_info->ecn);
|
||||
if (bitmask&0x1)
|
||||
{
|
||||
if((specifiedinfo.specified_ssid_len != bss_info->ssid_len)
|
||||
|| memcmp(bss_info->ssid,specifiedinfo.specified_ssid,bss_info->ssid_len))
|
||||
{
|
||||
bss_info++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
memcpy(ssid, bss_info->ssid, bss_info->ssid_len);
|
||||
ssid[bss_info->ssid_len] = '\0';
|
||||
|
||||
j += sprintf(buf1 + j, "%s", ssid);
|
||||
|
||||
j += sprintf(buf1 + j, ",%d,", (signed char)bss_info->rssi);
|
||||
|
||||
if (bitmask&0x2)
|
||||
{
|
||||
sprintf((char *)bssid, "%02x:%02x:%02x:%02x:%02x:%02x", bss_info->bssid[0], bss_info->bssid[1],
|
||||
bss_info->bssid[2], bss_info->bssid[3], bss_info->bssid[4], bss_info->bssid[5]);
|
||||
if (strcmp((const char *)bssid, (const char *)specifiedinfo.specified_bssid))
|
||||
{
|
||||
bss_info++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
j += sprintf(buf1 + j, "\"%02x:%02x:%02x:%02x:%02x:%02x\",", bss_info->bssid[0], bss_info->bssid[1],
|
||||
bss_info->bssid[2], bss_info->bssid[3], bss_info->bssid[4], bss_info->bssid[5]);
|
||||
|
||||
if (bitmask&0x4)
|
||||
{
|
||||
if (bss_info->channel != specifiedinfo.specified_chan)
|
||||
{
|
||||
bss_info++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->channel);
|
||||
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->freq_offset);
|
||||
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->freqcal_val);
|
||||
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->pairwise_cipher);
|
||||
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->group_cipher);
|
||||
|
||||
j += sprintf(buf1 + j, "%d,", bss_info->bgn);
|
||||
|
||||
j += sprintf(buf1 + j, "%d)", bss_info->wps_support);
|
||||
|
||||
|
||||
|
||||
|
||||
printf("%s\n", buf1);
|
||||
|
||||
bss_info ++;
|
||||
}
|
||||
|
||||
end:
|
||||
if(buf)
|
||||
{
|
||||
tls_mem_free(buf);
|
||||
}
|
||||
if(buf1)
|
||||
{
|
||||
tls_mem_free(buf1);
|
||||
}
|
||||
}
|
||||
|
||||
int user_scan_specified(u8 *ssid, u8 *mac, u8 chan, u8 scan_type, u32 min_interval, u32 max_interval)
|
||||
{
|
||||
struct tls_wifi_scan_param_t wscan_param;
|
||||
|
||||
memset(&specifiedinfo, 0, sizeof(specifiedinfo));
|
||||
specifiedinfo.specified_mask = 0;
|
||||
if (strlen((const char *)ssid) && (strlen((const char *)ssid) < 33))
|
||||
{
|
||||
memset(specifiedinfo.specified_ssid, 0, 33);
|
||||
strcpy((char *)specifiedinfo.specified_ssid, (char *)ssid);
|
||||
specifiedinfo.specified_ssid_len = strlen((const char *)ssid);
|
||||
specifiedinfo.specified_mask = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
specifiedinfo.specified_ssid[0] = '\0';
|
||||
specifiedinfo.specified_ssid_len = 0;
|
||||
specifiedinfo.specified_mask &= ~1;
|
||||
}
|
||||
|
||||
if (strlen((const char *)mac) == 17)
|
||||
{
|
||||
memset(specifiedinfo.specified_bssid, 0, 17);
|
||||
strcpy((char *)specifiedinfo.specified_bssid, (char *)mac);
|
||||
specifiedinfo.specified_mask |= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
specifiedinfo.specified_bssid[0] = '\0';
|
||||
specifiedinfo.specified_mask &= ~2;
|
||||
}
|
||||
|
||||
if (scan_type)
|
||||
{
|
||||
wscan_param.scan_type = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
wscan_param.scan_type = 0;
|
||||
}
|
||||
if (chan == 0)
|
||||
{
|
||||
specifiedinfo.specified_chan = 0;
|
||||
wscan_param.scan_chanlist = 0x1FFF;
|
||||
specifiedinfo.specified_mask &= ~4;
|
||||
}
|
||||
else
|
||||
{
|
||||
specifiedinfo.specified_chan = chan;
|
||||
specifiedinfo.specified_mask |=4;
|
||||
wscan_param.scan_chanlist = 1<<(chan-1);
|
||||
}
|
||||
|
||||
if (min_interval == 0)
|
||||
{
|
||||
wscan_param.scan_chinterval = 120;
|
||||
wscan_param.scan_times = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
wscan_param.scan_chinterval = min_interval;
|
||||
if (max_interval >= min_interval)
|
||||
{
|
||||
wscan_param.scan_times = (max_interval + min_interval/2)/min_interval;
|
||||
}
|
||||
else
|
||||
{
|
||||
wscan_param.scan_times = 1;
|
||||
}
|
||||
}
|
||||
|
||||
tls_wifi_scan_by_param(&wscan_param);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*Scan demo*/
|
||||
int scan_demo(void)
|
||||
{
|
||||
@ -160,5 +440,22 @@ int scan_demo(void)
|
||||
return WM_SUCCESS;
|
||||
}
|
||||
|
||||
int scan_format2_demo(void)
|
||||
{
|
||||
|
||||
tls_wifi_scan_result_cb_register(wifi_scan_format2_handler);
|
||||
tls_wifi_scan();
|
||||
return WM_SUCCESS;
|
||||
}
|
||||
|
||||
/*specified Scan demo*/
|
||||
int scan_specified_demo(u8 *ssid, u8 *mac, u32 chan, u32 scan_type, u32 min_interval, u32 max_interval)
|
||||
{
|
||||
tls_wifi_scan_result_cb_register(wifi_scan_format2_filter_handler);
|
||||
user_scan_specified(ssid, mac, chan, scan_type, min_interval, max_interval);
|
||||
return WM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "wm_cpu.h"
|
||||
#include "random.h"
|
||||
#include "wm_gpio_afsel.h"
|
||||
#include "utils.h"
|
||||
|
||||
#if DEMO_SDIO_HOST
|
||||
extern int wm_sd_card_set_blocklen(uint32_t blocklen);
|
||||
@ -30,6 +31,7 @@ static int sdh_card_wr_sb(uint32_t rca, uint8_t bus_width, const uint32_t tsize)
|
||||
int i = 0;
|
||||
char* buf = NULL;
|
||||
char* bufR = NULL;
|
||||
uint32_t sd_addr = 0;
|
||||
|
||||
buf = tls_mem_alloc(512);
|
||||
if(buf == NULL)
|
||||
@ -48,7 +50,8 @@ static int sdh_card_wr_sb(uint32_t rca, uint8_t bus_width, const uint32_t tsize)
|
||||
|
||||
for(i=0; i<(tsize/512); i++)
|
||||
{
|
||||
ret = wm_sd_card_block_write(rca, i, buf);
|
||||
sd_addr = SDCardInfo.CSDVer == 1 ? (i * 512) : i;
|
||||
ret = wm_sd_card_block_write(rca, sd_addr, buf);
|
||||
if(ret)
|
||||
goto end;
|
||||
}
|
||||
@ -57,11 +60,15 @@ static int sdh_card_wr_sb(uint32_t rca, uint8_t bus_width, const uint32_t tsize)
|
||||
goto end;
|
||||
for(i=0; i<(tsize/512); i++)
|
||||
{
|
||||
ret = wm_sd_card_block_read(rca, i, bufR);
|
||||
sd_addr = SDCardInfo.CSDVer == 1 ? (i * 512) : i;
|
||||
ret = wm_sd_card_block_read(rca, sd_addr, bufR);
|
||||
if(ret)
|
||||
goto end;
|
||||
if(memcmp(buf, bufR, 512))
|
||||
{
|
||||
printf("i=%d\n", i);
|
||||
dumpBuffer("buf", buf, 512);
|
||||
dumpBuffer("bufR", bufR, 512);
|
||||
ret = -2;
|
||||
goto end;
|
||||
}
|
||||
@ -80,6 +87,76 @@ end:
|
||||
TEST_DEBUG("ret %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#if 0
|
||||
static int sdh_card_wr_sb_fullchip(uint32_t rca, uint8_t bus_width, const uint32_t tsize)
|
||||
{
|
||||
int ret = -1;
|
||||
int i = 0;
|
||||
char* buf = NULL;
|
||||
char* bufR = NULL;
|
||||
uint32_t sd_addr = 0;
|
||||
|
||||
buf = tls_mem_alloc(768);
|
||||
if(buf == NULL)
|
||||
goto end;
|
||||
bufR = tls_mem_alloc(512);
|
||||
if(bufR == NULL)
|
||||
goto end;
|
||||
for(i = 0; i < 768; i++)
|
||||
{
|
||||
buf[i] = i & 0xFF;
|
||||
}
|
||||
TEST_DEBUG("bus width %s\n", bus_width == 0 ? "1bit" : "4bits");
|
||||
ret = wm_sd_card_set_bus_width(rca, bus_width);
|
||||
if(ret)
|
||||
goto end;
|
||||
ret = wm_sd_card_set_blocklen(0x200); //512
|
||||
if(ret)
|
||||
goto end;
|
||||
#if 1
|
||||
for(i=(SDCardInfo.CardCapacity-tsize)/512; i<(SDCardInfo.CardCapacity/512); i++)
|
||||
{
|
||||
sd_addr = SDCardInfo.CSDVer == 1 ? (i * 512) : i;
|
||||
ret = wm_sd_card_block_write(rca, sd_addr, &buf[(i%256)/4*4]);
|
||||
if(ret)
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
ret = wm_sd_card_query_status(rca, NULL);
|
||||
if(ret)
|
||||
goto end;
|
||||
for(i=(SDCardInfo.CardCapacity-tsize)/512; i<(SDCardInfo.CardCapacity/512); i++)
|
||||
{
|
||||
sd_addr = SDCardInfo.CSDVer == 1 ? (i * 512) : i;
|
||||
ret = wm_sd_card_block_read(rca, sd_addr, bufR);
|
||||
if(ret)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
printf("i=%d\n", i);
|
||||
if(memcmp(&buf[(i%256)/4*4], bufR, 512))
|
||||
{
|
||||
dumpBuffer("buf", &buf[(i%256)/4*4], 512);
|
||||
dumpBuffer("bufR", bufR, 512);
|
||||
ret = -2;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
end:
|
||||
if(buf)
|
||||
{
|
||||
tls_mem_free(buf);
|
||||
}
|
||||
if(bufR)
|
||||
{
|
||||
tls_mem_free(bufR);
|
||||
}
|
||||
TEST_DEBUG("ret %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* multi blocks write & read by dma
|
||||
* bus_width: 0:1bit; 2:4bits
|
||||
@ -92,6 +169,7 @@ static int sdh_card_wr_mbs_dma_4M_test(uint32_t rca, uint8_t bus_width, uint32_t
|
||||
char* bufR = NULL;
|
||||
const uint32_t tsize = 4*1024;//*1024;
|
||||
int buflen = 512*block_cnt;
|
||||
uint32_t sd_addr = 0;
|
||||
|
||||
buf = tls_mem_alloc(buflen);
|
||||
if(buf == NULL)
|
||||
@ -113,7 +191,8 @@ static int sdh_card_wr_mbs_dma_4M_test(uint32_t rca, uint8_t bus_width, uint32_t
|
||||
//(sd_addr)---->start from address 0(block 0 too)
|
||||
for(i=0; i<(tsize/512); i+=block_cnt)
|
||||
{
|
||||
ret = wm_sd_card_blocks_write(rca, i, buf, buflen);
|
||||
sd_addr = SDCardInfo.CSDVer == 1 ? (i * 512) : i;
|
||||
ret = wm_sd_card_blocks_write(rca, sd_addr, buf, buflen);
|
||||
if(ret)
|
||||
goto end;
|
||||
}
|
||||
@ -123,8 +202,9 @@ static int sdh_card_wr_mbs_dma_4M_test(uint32_t rca, uint8_t bus_width, uint32_t
|
||||
|
||||
for(i=0; i<(tsize/512); i+=block_cnt)
|
||||
{
|
||||
sd_addr = SDCardInfo.CSDVer == 1 ? (i * 512) : i;
|
||||
memset(bufR, 0, buflen);
|
||||
ret = wm_sd_card_blocks_read(rca, i, bufR, buflen);
|
||||
ret = wm_sd_card_blocks_read(rca, sd_addr, bufR, buflen);
|
||||
if(ret)
|
||||
goto end;
|
||||
if(memcmp(buf, bufR, buflen))
|
||||
@ -168,6 +248,11 @@ int sd_card_test(void)
|
||||
wm_sdio_host_config(0);
|
||||
ret += sdh_card_init(&rca);
|
||||
printf("\nsdh_card_init, ret = %d\n", ret);
|
||||
#if 0
|
||||
ret += sdh_card_wr_sb_fullchip(rca, 0, 1024*1024);
|
||||
printf("\nW & R 0, ret = %d\n", ret);
|
||||
wr_delay(10000);
|
||||
#else
|
||||
ret += sdh_card_wr_sb(rca, 0, 1024);
|
||||
printf("\nW & R 1, ret = %d\n", ret);
|
||||
wr_delay(10000);
|
||||
@ -180,7 +265,7 @@ int sd_card_test(void)
|
||||
ret += sdh_card_wr_mbs_dma_4M_test(rca, 2, 6);
|
||||
printf("W & R 4, ret = %d\n", ret);
|
||||
wr_delay(10000);
|
||||
|
||||
#endif
|
||||
if( ret ==0 ) {
|
||||
printf("\nsd card write read OK, ret = %d\n", ret);
|
||||
}
|
||||
|
@ -103,8 +103,19 @@ static s16 HspiRxCmdCb(char *buf)
|
||||
static void HspiInit(int type)
|
||||
{
|
||||
|
||||
|
||||
wm_hspi_gpio_config(0);
|
||||
if(type == HSPI_INTERFACE_SPI)
|
||||
{
|
||||
wm_hspi_gpio_config(0);
|
||||
}
|
||||
else if (type == HSPI_INTERFACE_SDIO)
|
||||
{
|
||||
wm_sdio_slave_config(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("do not support interface\n");
|
||||
return;
|
||||
}
|
||||
|
||||
tls_slave_spi_init();
|
||||
tls_set_high_speed_interface_type(type);
|
||||
@ -119,16 +130,17 @@ int slave_spi_demo(int type)
|
||||
if(type == 0)
|
||||
{
|
||||
type = HSPI_INTERFACE_SPI;
|
||||
printf("\r\ntype:%s\r\n", "HSPI_SLAVE");
|
||||
HspiInit(type);
|
||||
}
|
||||
else
|
||||
{
|
||||
type = HSPI_INTERFACE_SDIO;
|
||||
printf("\r\ntype:%s\r\n", "SDIO_SLAVE");
|
||||
HspiInit(type);
|
||||
}
|
||||
printf("\r\ntype:%d\r\n", type);
|
||||
|
||||
HspiInit(type);
|
||||
|
||||
return WM_SUCCESS;
|
||||
return WM_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,20 @@
|
||||
2)Add sta list monitor task*/
|
||||
static tls_os_timer_t *sta_monitor_tim = NULL;
|
||||
static u32 totalstanum = 0;
|
||||
/*mac that not allowed to join soft ap, you can change it.*/
|
||||
unsigned char blackmac[6] = {0x44,0xc3,0x46,0x41,0x71,0x1f};
|
||||
|
||||
static u32 delblackstatimeout = 60;
|
||||
static u32 delcnt = 0;
|
||||
|
||||
static u32 addrefusecnt = 0;
|
||||
static u32 addrefusecnttimeout = 60;
|
||||
|
||||
#define ADD_BLACK_STATE 0
|
||||
#define DEL_BLACK_STATE 1
|
||||
static u32 blackstate = DEL_BLACK_STATE;
|
||||
|
||||
|
||||
static void demo_monitor_stalist_tim(void *ptmr, void *parg)
|
||||
{
|
||||
u8 *stabuf = NULL;
|
||||
@ -28,16 +42,55 @@ static void demo_monitor_stalist_tim(void *ptmr, void *parg)
|
||||
stabuf = tls_mem_alloc(1024);
|
||||
if (stabuf)
|
||||
{
|
||||
stanum = 0;
|
||||
memset(stabuf, 0, 1024);
|
||||
tls_wifi_get_authed_sta_info(&stanum, stabuf, 1024);
|
||||
if (totalstanum != stanum)
|
||||
{
|
||||
wm_printf("sta mac:\n");
|
||||
wm_printf("white sta mac:\n");
|
||||
for (i = 0; i < stanum ; i++)
|
||||
{
|
||||
wm_printf("%M\n", &stabuf[i * 6]);
|
||||
}
|
||||
}
|
||||
totalstanum = stanum;
|
||||
stanum = 0;
|
||||
memset(stabuf, 0, 1024);
|
||||
tls_wifi_softap_get_blackinfo(&stanum, stabuf, 1024);
|
||||
wm_printf("black sta mac:\n");
|
||||
for (i = 0; i < stanum ; i++)
|
||||
{
|
||||
wm_printf("%M\n", &stabuf[i * 6]);
|
||||
}
|
||||
|
||||
switch (blackstate)
|
||||
{
|
||||
case DEL_BLACK_STATE: /*delete sta's for black list*/
|
||||
delcnt++;
|
||||
if (delcnt > delblackstatimeout)
|
||||
{
|
||||
for (i = 0; i < stanum ; i++)
|
||||
{
|
||||
tls_wifi_softap_del_blacksta(&stabuf[i*6]);
|
||||
}
|
||||
delcnt = 0;
|
||||
blackstate = ADD_BLACK_STATE;
|
||||
}
|
||||
break;
|
||||
case ADD_BLACK_STATE: /*add station into black list*/
|
||||
addrefusecnt ++;
|
||||
if (addrefusecnt > addrefusecnttimeout)
|
||||
{
|
||||
tls_wifi_softap_add_blacksta(blackmac);
|
||||
tls_wifi_softap_del_station(blackmac);
|
||||
addrefusecnt = 0;
|
||||
blackstate = DEL_BLACK_STATE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
tls_mem_free(stabuf);
|
||||
stabuf = NULL;
|
||||
}
|
||||
@ -51,6 +104,7 @@ int demo_create_softap(u8 *ssid, u8 *key, int chan, int encrypt, int format)
|
||||
u8 ssid_set = 0;
|
||||
u8 wireless_protocol = 0;
|
||||
|
||||
|
||||
u8 ssid_len = 0;
|
||||
if (!ssid)
|
||||
{
|
||||
@ -109,6 +163,9 @@ int demo_create_softap(u8 *ssid, u8 *key, int chan, int encrypt, int format)
|
||||
ipinfo->netmask[3] = 0;
|
||||
MEMCPY(ipinfo->dnsname, "local.wm", sizeof("local.wm"));
|
||||
|
||||
blackstate = DEL_BLACK_STATE;
|
||||
tls_wifi_softap_add_blacksta(blackmac);
|
||||
|
||||
ret = tls_wifi_softap_create(apinfo, ipinfo);
|
||||
wm_printf("\n ap create %s ! \n", (ret == WM_SUCCESS) ? "Successfully" : "Error");
|
||||
|
||||
|
@ -169,7 +169,7 @@ int uart_demo(int bandrate, int parity, int stopbits)
|
||||
demo_uart_task,
|
||||
(void *) demo_uart,
|
||||
(void *) demo_uart_task_stk, /** 任务栈的起始地址 */
|
||||
DEMO_UART_TAST_STK_SIZE, /** 任务栈的大小 */
|
||||
DEMO_UART_TAST_STK_SIZE*4, /** 任务栈的大小 */
|
||||
DEMO_UART_TASK_PRIO, 0);
|
||||
}
|
||||
if (-1 == bandrate)
|
||||
|
@ -1,6 +1,48 @@
|
||||
==========================================================
|
||||
| CHANGELOG: WinnerMicro Software Development Kit |
|
||||
==========================================================
|
||||
W800 SDK v1.00.10 | 2022/12/29
|
||||
==========================
|
||||
1. 驱动更新
|
||||
1)提供模组ADC校准功能接口
|
||||
2)修复PSRAM IO复用不完整问题
|
||||
3)Flash驱动修改不再每次都写状态寄存器
|
||||
4)增加RF参数备份机制
|
||||
5)修改对于SD 1.0卡的支持
|
||||
|
||||
2. 更新secboot,支持青藤Flash的QIO模式切换;优化每次启动过程都操作flash状态寄存器来切QIO模式的操作
|
||||
|
||||
3. 升级LWIP版本至V2.1.3版本
|
||||
4. 优化一键配网功能
|
||||
5. demo修改:
|
||||
1)HSPI和SDIO的从设备的DEMO更新,通过参数区分HSPI和SDIO的初始化
|
||||
2)修改demo的控制台的接收处理,解决接收命令字不足后无法使用控制台的问题
|
||||
3)增加新的联网demo
|
||||
4)增加新的扫描demo
|
||||
5)增加softap的黑名单功能demo
|
||||
6. 修复芯片Sleep模式功耗波动问题,修改GPIO默认配置为输入上拉;客户使用时按照IO复用配置,使用指定的上下拉功能
|
||||
7. RTOS问题修复
|
||||
1)修复rtos适配函数没有判断指针是否为空的操作
|
||||
2)修复RTOS任务创建时句柄赋值处理
|
||||
8. 修复因调整tick值并进行时间计算而导致的可能除0操作
|
||||
|
||||
9. Wi-Fi库更新内容:
|
||||
1)增加WLAN数字增益可调接口
|
||||
2)增加连接扫描不到热点的时间可控的API
|
||||
3)增加可配置是否可连接open/wep网络的API
|
||||
4)增加是否扫描到立即连接AP的API
|
||||
5)支持AP的黑名单功能
|
||||
6)修复APSTA模式下某些手机连接不上的问题(因信道变更时信标帧内部分信道相关信息未更新)
|
||||
|
||||
10. 编译相关
|
||||
1)修复某些场景下的编译报错问题(例如:内存调试打开,mbedtls模块编译报错的问题)
|
||||
2)修改编译工具链,支持CPP代码的编译
|
||||
3)因为升级了LWIP和MQTT,CDK的编译工程变更,建议使用新的工程,把之前改动合过来;
|
||||
如果确实要使用之前的工程,需要把相关文件加入,编译前要清理一下编译工程下的过程中文件(.mk,.bat,.txt,LST和OBJ)
|
||||
4)如果用户打开较多demo、或者进行内存调试,或者打开wm_debug.h调试功能,而且要使用经典蓝牙的CDK工程编译
|
||||
或者使用make编译,需要对链接文件里的I-SRAM进行调整(位置、大小)由此带来一系列的调整(编译固件存放的位置也要调整)
|
||||
5)清理编译告警
|
||||
|
||||
W800 SDK v1.00.08 | 2022/07/26
|
||||
==========================
|
||||
*********
|
||||
|
Binary file not shown.
437
src/W800_SDK_v1.00.10/include/app/wm_netif2.1.3.h
Normal file
437
src/W800_SDK_v1.00.10/include/app/wm_netif2.1.3.h
Normal file
@ -0,0 +1,437 @@
|
||||
/**
|
||||
* @file wm_netif2.1.3.h
|
||||
*
|
||||
* @brief netif213 module
|
||||
*
|
||||
* @author WinnerMicro
|
||||
*
|
||||
* Copyright (c) 2014 Winner Microelectronics Co., Ltd.
|
||||
*/
|
||||
|
||||
#ifndef WM_NETIF2_0_3_H
|
||||
#define WM_NETIF2_0_3_H
|
||||
|
||||
#include "wm_config.h"
|
||||
#include "wm_type_def.h"
|
||||
#include "wm_sockets.h"
|
||||
#include "wm_wifi.h"
|
||||
#include "wm_params.h"
|
||||
|
||||
/** MACRO for callback EVENT to join AP or create soft-AP successfully */
|
||||
#define NETIF_WIFI_JOIN_SUCCESS 0x1
|
||||
/** MACRO for callback EVENT to fail to join AP */
|
||||
#define NETIF_WIFI_JOIN_FAILED 0x2
|
||||
/** MACRO for callback EVENT to disconnect from AP or destroy soft-AP */
|
||||
#define NETIF_WIFI_DISCONNECTED 0x3
|
||||
/** MACRO for callbck EVENT to get IP address */
|
||||
#define NETIF_IP_NET_UP 0x4
|
||||
/** MACRO for callback EVNET to create AP successfully */
|
||||
#define NETIF_WIFI_SOFTAP_SUCCESS 0x5
|
||||
/** MACRO for callback EVNET to create soft-AP failed */
|
||||
#define NETIF_WIFI_SOFTAP_FAILED 0x6
|
||||
/** MACRO for callback EVNET to close soft-AP */
|
||||
#define NETIF_WIFI_SOFTAP_CLOSED 0x7
|
||||
/** MACRO for callback EVNET to inform soft ap's net */
|
||||
#define NETIF_IP_NET2_UP 0x8
|
||||
|
||||
#define NETIF_IPV6_NET_UP 0x9
|
||||
|
||||
/** These are the values for ip_addr_t.type */
|
||||
#define IPADDR_TYPE_V4 0U
|
||||
#define IPADDR_TYPE_V6 6U
|
||||
#define IPADDR_TYPE_ANY 46U
|
||||
|
||||
#define IPV6_ADDR_MAX_NUM 3
|
||||
|
||||
#if 0
|
||||
struct ip_addr {
|
||||
u32_t addr;
|
||||
};
|
||||
|
||||
typedef struct ip_addr ip_addr_t;
|
||||
#endif
|
||||
#if 0
|
||||
struct ip4_addr {
|
||||
u32_t addr;
|
||||
};
|
||||
typedef struct ip4_addr ip4_addr_t;
|
||||
|
||||
struct ip6_addr {
|
||||
u32_t addr[4];
|
||||
};
|
||||
typedef struct ip6_addr ip6_addr_t;
|
||||
|
||||
#if (TLS_CONFIG_IPV4 && TLS_CONFIG_IPV6)
|
||||
typedef struct _ip_addr {
|
||||
union {
|
||||
ip6_addr_t ip6;
|
||||
ip4_addr_t ip4;
|
||||
} u_addr;
|
||||
u8_t type;
|
||||
} ip_addr_t;
|
||||
#else
|
||||
#if TLS_CONFIG_IPV4
|
||||
typedef ip4_addr_t ip_addr_t;
|
||||
#else
|
||||
typedef ip6_addr_t ip_addr_t;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
struct tls_ethif {
|
||||
ip_addr_t ip_addr;
|
||||
ip_addr_t netmask;
|
||||
ip_addr_t gw;
|
||||
#if TLS_CONFIG_IPV6
|
||||
ip_addr_t ip6_addr[IPV6_ADDR_MAX_NUM];
|
||||
#endif
|
||||
ip_addr_t dns1;
|
||||
ip_addr_t dns2;
|
||||
u8 status; //0:net down; 1:net up
|
||||
#if TLS_CONFIG_IPV6
|
||||
u8 ipv6_status[IPV6_ADDR_MAX_NUM]; //0:net down; 1:net up
|
||||
#endif
|
||||
};
|
||||
|
||||
//type defination of netif status changed callback.
|
||||
typedef void (*tls_netif_status_event_fn)(u8 status);
|
||||
|
||||
/**
|
||||
* @defgroup APP_APIs APP APIs
|
||||
* @brief APP APIs
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup APP_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup NETIF_APIs NETIF APIs
|
||||
* @brief network interface APIs
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup NETIF_APIs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief This function is used to initialize TCP/IP Stack
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval other failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
int tls_ethernet_init(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to get IP information stored in
|
||||
tls_ethif struct
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval tls_ethif * Pointer to struct tls_ethif
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
struct tls_ethif * tls_netif_get_ethif(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to set tls_ethif status
|
||||
*
|
||||
* @param[in] status net status, 0-up, 1-down
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
void tls_netif_set_status(u8 status);
|
||||
|
||||
/**
|
||||
* @brief This function is used to start DHCP Client
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
err_t tls_dhcp_start(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to stop DHCP client
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
err_t tls_dhcp_stop(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to change IP information
|
||||
*
|
||||
* @param[in] *ipaddr IP address
|
||||
* @param[in] *netmask netmask
|
||||
* @param[in] *gw default gateway
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
err_t tls_netif_set_addr(ip_addr_t *ipaddr,
|
||||
ip_addr_t *netmask,
|
||||
ip_addr_t *gw);
|
||||
|
||||
/**
|
||||
* @brief This function is used to set dns servers
|
||||
*
|
||||
* @param[in] numdns index of the DNS server to set
|
||||
must be < DNS_MAX_SERVERS
|
||||
* @param[in] *dnsserver IP address of the DNS server to set
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
void tls_netif_dns_setserver(u8 numdns, ip_addr_t *dnsserver);
|
||||
|
||||
/**
|
||||
* @brief This function is used to bring up an interface,available
|
||||
for processing traffic
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
err_t tls_netif_set_up(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to bring down an interface,disabling
|
||||
any traffic processing
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
err_t tls_netif_set_down(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to add netif status changed callback
|
||||
to event list,if exists, do nothing
|
||||
*
|
||||
* @param[in] event_fn pointer to tls_netif_status_event_fn
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
err_t tls_netif_add_status_event(tls_netif_status_event_fn event_fn);
|
||||
|
||||
/**
|
||||
* @brief This function is used to remove netif status changed
|
||||
callback function from event list,if not exists, do nothing
|
||||
*
|
||||
* @param[in] event_fn pointer to tls_netif_status_event_fn
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
err_t tls_netif_remove_status_event(tls_netif_status_event_fn event_fn);
|
||||
|
||||
/**
|
||||
* @brief This function is used to get pointer of netif
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval pointer of netif
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
struct netif *tls_get_netif(void);
|
||||
|
||||
#if TLS_CONFIG_AP
|
||||
/**
|
||||
* @brief Start DHCP Server for a network interface
|
||||
* *
|
||||
* @retval DHCPS_ERR_SUCCESS - No error
|
||||
* @retval DHCPS_ERR_MEM - Out of memory
|
||||
* @retval DHCPS_ERR_LINKDOWN - The NI is inactive
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
INT8S tls_dhcps_start(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to stop DHCP Server
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
void tls_dhcps_stop(void);
|
||||
|
||||
/**
|
||||
* @brief Start the dns server's service
|
||||
* *
|
||||
* @retval DHCPS_ERR_SUCCESS - No error
|
||||
* @retval DHCPS_ERR_MEM - Out of memory
|
||||
* @retval DHCPS_ERR_LINKDOWN - The NI is inactive
|
||||
* @retval DNSS_ERR_PARAM - Input parameter error
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
INT8S tls_dnss_start(INT8U * DnsName);
|
||||
|
||||
/**
|
||||
* @brief Stop the dns server's service
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
void tls_dnss_stop(void);
|
||||
|
||||
/**
|
||||
* @brief Get station's ip address by mac address
|
||||
*
|
||||
* @param[in] mac station's mac address
|
||||
*
|
||||
* @retval ip_addr station's ip address
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
ip_addr_t *tls_dhcps_getip(const u8_t *mac);
|
||||
|
||||
/**
|
||||
* @brief Get station's mac address by ip address
|
||||
*
|
||||
* @param[in] ip station's ip address
|
||||
*
|
||||
* @retval u8* station's mac address
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
u8 *tls_dhcps_getmac(const ip_addr_t *ip);
|
||||
#endif //TLS_CONFIG_AP
|
||||
|
||||
#if TLS_CONFIG_RMMS
|
||||
/**
|
||||
* @brief Start remote manager server.
|
||||
* *
|
||||
* @retval DHCPS_ERR_SUCCESS - No error
|
||||
* @retval DHCPS_ERR_MEM - Out of memory
|
||||
* @retval DHCPS_ERR_LINKDOWN - The NIF is inactive
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
INT8S tls_rmms_start(void);
|
||||
|
||||
/**
|
||||
* @brief Disable remote manager server
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
void tls_rmms_stop(void);
|
||||
#endif
|
||||
|
||||
#if TLS_CONFIG_AP
|
||||
/**
|
||||
* @brief This is used to bring up an interface for APSTA,available
|
||||
for processing traffic
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note Can only be used at APSTA mode
|
||||
*/
|
||||
err_t tls_netif2_set_up(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to bring down an interface for APSTA, disabling
|
||||
any traffic processing
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note Can only be used at APSTA mode
|
||||
*/
|
||||
err_t tls_netif2_set_down(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to change IP information for
|
||||
a network interface for APSTA
|
||||
*
|
||||
* @param[in] *ipaddr IP address
|
||||
* @param[in] *netmask netmask
|
||||
* @param[in] *gw default gateway
|
||||
*
|
||||
* @retval 0 success
|
||||
* @retval Minus failed
|
||||
*
|
||||
* @note Can only be used at APSTA mode
|
||||
*/
|
||||
err_t tls_netif2_set_addr(ip_addr_t *ipaddr,
|
||||
ip_addr_t *netmask,
|
||||
ip_addr_t *gw);
|
||||
/***************************************************************************
|
||||
* Function: tls_dhcps_setdns
|
||||
* Description: Set dhcp server's dns address.
|
||||
*
|
||||
* Input: numdns: the index of the DNS server to set must be less than DNS_MAX_SERVERS
|
||||
*
|
||||
* Output: None
|
||||
*
|
||||
* Return: None
|
||||
*
|
||||
* Date : 2015-3-10
|
||||
****************************************************************************/
|
||||
/**
|
||||
* @brief Set dhcp server's dns address
|
||||
*
|
||||
* @param[in] numdns the index of the DNS server to set must be less than DNS_MAX_SERVERS
|
||||
*
|
||||
* @retval None
|
||||
*
|
||||
* @note Can only be used at APSTA mode
|
||||
*/
|
||||
void tls_dhcps_setdns(u8_t numdns);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif //WM_NETIF_H
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "wm_type_def.h"
|
||||
|
||||
#define ADC_DEST_BUFFER_SIZE 16383//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ
|
||||
#define ADC_DEST_BUFFER_SIZE 16383//ÒÔ×ÖΪµ¥Î»
|
||||
|
||||
|
||||
/*ADC Result*/
|
||||
@ -111,15 +111,15 @@
|
||||
#define ADC_INT_TYPE_DMA 1
|
||||
#define ADC_INT_TYPE_ADC_COMP 2
|
||||
|
||||
#define ADC_REFERENCE_EXTERNAL 0 //<EFBFBD>ⲿ<EFBFBD>ο<EFBFBD>
|
||||
#define ADC_REFERENCE_INTERNAL 1 //<EFBFBD>ڲ<EFBFBD><EFBFBD>ο<EFBFBD>
|
||||
#define ADC_REFERENCE_EXTERNAL 0 //Íⲿ²Î¿¼
|
||||
#define ADC_REFERENCE_INTERNAL 1 //ÄÚ²¿²Î¿¼
|
||||
|
||||
typedef struct adc_st{
|
||||
u8 dmachannel;
|
||||
void (*adc_cb)(int *buf, u16 len);
|
||||
void (*adc_bigger_cb)(int *buf, u16 len);
|
||||
void (*adc_dma_cb)(int *buf,u16 len);
|
||||
u16 valuelen; /*dma <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>*/
|
||||
u16 valuelen; /*dma ²ÉÑùÊý¾Ý³¤¶È*/
|
||||
u16 offset;
|
||||
}ST_ADC;
|
||||
|
||||
@ -294,6 +294,41 @@ u32 adc_get_interVolt(void);
|
||||
*/
|
||||
int adc_temp(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to calibrate adc single-end voltage. offset after FT or multipoint calibration.
|
||||
*
|
||||
* @param[in] chan: adc calibration channel to be used, ADC channel 0,1,2,3
|
||||
* @param[in] refvoltage: calibration reference voltage to be used, unit:mV
|
||||
* input range[100,2300)mV, suggest reference voltage[500,2000]mV
|
||||
*
|
||||
* @return 0: success, < 0: failure
|
||||
*
|
||||
* @note After FT calibration or mulitpoint calibration, adc curve is y=ax+b,
|
||||
* y is real voltage(unit:mV), x is adc sample data
|
||||
* a and b is the coefficient. This fuction only used to revise b value.
|
||||
*/
|
||||
int adc_offset_calibration(int chan, int refvoltage);
|
||||
|
||||
/**
|
||||
* @brief This function can used to calibrate adc coefficient if not calibrated,
|
||||
* or adc offset after FT or multipoint calibration.
|
||||
*
|
||||
* @param[in] chanused: bitmap, specified calibration channel,only bit0-3 can be used
|
||||
* @param[in] refvoltage[]: array, calibration reference voltage to be used, unit:mV
|
||||
* refvoltage keep the same position with chan bitmap
|
||||
* input range[100,2300)mV, suggest reference voltage[500,2000]mV
|
||||
*
|
||||
* @return 0: success, < 0: failure
|
||||
*
|
||||
* @note 1)Adc curve is y=ax+b,y is real voltage(unit:mV), x is adc sample data.
|
||||
* After calibration, we can get a and b, or only update b.
|
||||
* 2) Only used single-end adc
|
||||
* 3) For example, use chan 0,1,3, and refvoltage 500,1000,2000,
|
||||
* then chanused is 0xB, refvoltage[] value is {500,1000,0, 2000};
|
||||
*/
|
||||
int adc_multipoint_calibration(int chanused, int refvoltage[]);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -311,6 +346,9 @@ void signedToUnsignedData(int *adcValue);
|
||||
void tls_adc_buffer_bypass_set(u8 isset);
|
||||
void tls_adc_cmp_start(int Channel, int cmp_data, int cmp_pol);
|
||||
u32 adc_get_offset(void);
|
||||
void tls_adc_set_pga(int gain1, int gain2);
|
||||
int cal_voltage(double vol);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -25,6 +25,8 @@ enum {
|
||||
CMD_RX_IQ_PHASE,
|
||||
CMD_TX_GAIN,
|
||||
CMD_TX_ADC_CAL,
|
||||
CMD_FREQ_ERR,
|
||||
CMD_RF_CAL_FLAG,
|
||||
CMD_ALL,
|
||||
};
|
||||
|
||||
@ -45,7 +47,9 @@ typedef struct FT_ADC_CAL_UNIT
|
||||
typedef struct FT_ADC_CAL
|
||||
{
|
||||
unsigned int valid_cnt;
|
||||
FT_ADC_CAL_UINT_ST units[8];
|
||||
FT_ADC_CAL_UINT_ST units[6];
|
||||
float a;
|
||||
float b;
|
||||
}FT_ADC_CAL_ST;
|
||||
|
||||
typedef struct FT_TEMP_CAL
|
||||
@ -303,6 +307,18 @@ int tls_rf_cal_finish_op(u8 *calflag, u8 flag);
|
||||
*/
|
||||
int tls_get_adc_cal_param(FT_ADC_CAL_ST *adc_cal);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is used to set adc cal param
|
||||
*
|
||||
* @param[out] adc_cal adc cal param
|
||||
*
|
||||
* @retval TLS_EFUSE_STATUS_OK get success
|
||||
* @retval TLS_EFUSE_STATUS_EIO get failed
|
||||
*/
|
||||
int tls_set_adc_cal_param(FT_ADC_CAL_ST *adc_cal);
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ enum TYPE_FLASH_ID{
|
||||
SPIFLASH_MID_XMC = 0x20,
|
||||
SPIFLASH_MID_XTX = 0x0B,
|
||||
SPIFLASH_MID_TSINGTENG = 0xEB, /*UNIGROUP TSINGTENG*/
|
||||
SPIFLASH_MID_TSINGTENG_1MB = 0xCD, /*UNIGROUP TSINGTENG*/
|
||||
SPIFLASH_MID_TSINGTENG_1MB_4MB = 0xCD, /*UNIGROUP TSINGTENG*/
|
||||
};
|
||||
|
||||
typedef union {
|
||||
|
@ -34,7 +34,7 @@ typedef struct
|
||||
long long CardCapacity;
|
||||
u32 CardBlockSize;
|
||||
u16 RCA;
|
||||
u8 CardType;
|
||||
u8 CSDVer;
|
||||
} SD_CardInfo_t;
|
||||
extern SD_CardInfo_t SDCardInfo;
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@
|
||||
//#define WM_MEM_DEBUG 1
|
||||
#if WM_MEM_DEBUG
|
||||
|
||||
#include "list.h"
|
||||
#include "../list.h"
|
||||
|
||||
#define MEM_HEADER_PATTERN 0x76028412
|
||||
#define MEM_TAILER_PATTERN 0x83395627
|
||||
|
@ -113,6 +113,28 @@ enum tls_wifi_auth_mode {
|
||||
WM_WIFI_AUTH_MODE_UNKNOWN = 128
|
||||
};
|
||||
|
||||
/** Wi-Fi encryption enum */
|
||||
enum tls_wifi_encrypt_mode {
|
||||
WM_WIFI_ECN_MODE_OPEN = 0, /**< encrypt mode : open */
|
||||
WM_WIFI_ECN_MODE_WEP = 1, /**< encrypt mode : wep*/
|
||||
WM_WIFI_ECN_MODE_WPA_PSK = 2, /**< encrypt mode : wpa psk*/
|
||||
WM_WIFI_ECN_MODE_WPA2_PSK = 3, /**< encrypt mode : wpa2 psk*/
|
||||
WM_WIFI_ECN_MODE_WPA_WPA2_PSK = 4, /**< encrypt mode : wpa and wpa2 psk*/
|
||||
WM_WIFI_ECN_MODE_UNKNOWN = 5, /**< encrypt mode : unknown*/
|
||||
};
|
||||
|
||||
/** Wi-Fi group/pairwise cipher enumu*/
|
||||
enum tls_wifi_cipher_mode{
|
||||
WM_WIFI_CIPHER_NONE = 0,
|
||||
WM_WIFI_CIPHER_WEP40 = 1,
|
||||
WM_WIFI_CIPHER_WEP104 = 2,
|
||||
WM_WIFI_CIPHER_TKIP = 3,
|
||||
WM_WIFI_CIPHER_CCMP = 4,
|
||||
WM_WIFI_CIPHER_TKIP_AND_CCMP = 5,
|
||||
WM_WIFI_CIPHER_AES_CMAC_128 = 6,
|
||||
};
|
||||
|
||||
|
||||
/** Wi-Fi states */
|
||||
enum tls_wifi_states {
|
||||
WM_WIFI_DISCONNECTED, /**< Disconnected state */
|
||||
@ -270,6 +292,29 @@ struct tls_scan_bss_t {
|
||||
struct tls_bss_info_t bss[1]; /**< list of bss found*/
|
||||
};
|
||||
|
||||
/** format2 bss information */
|
||||
struct tls_bss_info_format2_t {
|
||||
u8 ecn; /**< encryption type, @ref enum tls_wifi_encrypt_mode */
|
||||
u8 rssi; /**< signal strength of AP, real rssi = (signed char)rssi */
|
||||
u8 ssid[32]; /**< SSID of AP */
|
||||
u8 ssid_len; /**< SSID length */
|
||||
u8 bssid[ETH_ALEN]; /**< MAC address of AP */
|
||||
u8 channel; /**< channel of AP */
|
||||
s16 freq_offset; /**< reserved do not support*/
|
||||
s16 freqcal_val; /**< reserved do not support*/
|
||||
s8 pairwise_cipher; /**< pairwise cipher. @ref enum tls_wifi_cipher_mode */
|
||||
s8 group_cipher; /**< group cipher. @ref enum tls_wifi_cipher_mode */
|
||||
u8 bgn; /**< bgnmode, bit0:b mode, bit1:g mode, bit2:n mode */
|
||||
bool wps_support; /**< is support WPS function */
|
||||
};
|
||||
|
||||
/** format2 scan result */
|
||||
struct tls_scan_bss_format2_t {
|
||||
u32 count; /**< total count */
|
||||
u32 length; /**< bss info total length */
|
||||
struct tls_bss_info_format2_t bss[1]; /**< list of bss found*/
|
||||
};
|
||||
|
||||
/** station information */
|
||||
struct tls_sta_info_t {
|
||||
u8 mac_addr[ETH_ALEN]; /**< MAC address of station */
|
||||
@ -299,7 +344,8 @@ struct tls_wifi_tx_rate_t {
|
||||
|
||||
/** scan param */
|
||||
struct tls_wifi_scan_param_t{
|
||||
u32 scan_times; /**< Scan times, >=0, if zero, only 1 times */
|
||||
u16 scan_type;
|
||||
u16 scan_times; /**< Scan times, >=0, if zero, only 1 times */
|
||||
u16 scan_chanlist; /**< Scan channel list ,[0,3FFF],per bit is one channel,if zero or above 0x3FFF, scan all channel*/
|
||||
u16 scan_chinterval; /**< Scan channel switch time,>=0, if zero, use default value, unit:ms */
|
||||
};
|
||||
@ -632,6 +678,24 @@ void tls_wifi_scan_result_cb_register(void (*callback)(void));
|
||||
int tls_wifi_get_scan_rslt(u8* buf, u32 buffer_size);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Function: tls_wifi_get_scan_rslt_format2
|
||||
*
|
||||
* Description: get result of last scan for format2 result
|
||||
*
|
||||
* Input: buffer: address to store returned BSS info
|
||||
* buffer_size: the length of the buffer
|
||||
* Output: BSS info got by last scan
|
||||
*
|
||||
* Return: WM_SUCCESS: return ok;
|
||||
* WM_FAILED: failed to get result;
|
||||
* Note: user need to memalloc a buffer in advance. size for one item of scan result is @ref struct tls_bss_info_format2_t
|
||||
* the buffer size depends how many items user wants.
|
||||
* Date : 2022-6-07
|
||||
****************************************************************************/
|
||||
int tls_wifi_get_scan_rslt_format2(u8* buf, u32 buffer_size);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is used to create soft ap
|
||||
*
|
||||
@ -1014,20 +1078,6 @@ int tls_wifi_send_mgmt(enum tls_wifi_mgmt_type type, struct tls_wifi_hdr_mac_t *
|
||||
*/
|
||||
int tls_wifi_send_data(struct tls_wifi_hdr_mac_t *mac, u8 *data, u16 data_len, struct tls_wifi_tx_rate_t *tx);
|
||||
|
||||
#if TLS_CONFIG_AP
|
||||
/**
|
||||
* @brief This function is used to get authed sta list
|
||||
*
|
||||
* @param[out] *sta_num authed's station number
|
||||
* @param[out] *buf address to store returned station list info, tls_sta_info_t
|
||||
* @param[in] buf_size buffer size
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
void tls_wifi_get_authed_sta_info(u32 *sta_num, u8 *buf, u32 buf_size);
|
||||
#endif
|
||||
/**
|
||||
* @brief This function is used to get current Wi-Fi State
|
||||
*
|
||||
@ -1114,6 +1164,43 @@ int tls_wifi_softap_set_sta_num(unsigned char ap_sta_num);
|
||||
*/
|
||||
int tls_wifi_softap_del_station(unsigned char* hwaddr);
|
||||
|
||||
/**
|
||||
* @brief This function used to add sta to black list for softap
|
||||
*
|
||||
* @param[out] hwaddr: sta's mac address to forbid
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
int tls_wifi_softap_add_blacksta(unsigned char *hwaddr);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function used to accept sta joining softap that sta in balck list
|
||||
*
|
||||
* @param[out] hwaddr: mac address to delete from black list
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
int tls_wifi_softap_del_blacksta(unsigned char *hwaddr);
|
||||
|
||||
/**
|
||||
* @brief This function used to get stations from blacklist
|
||||
*
|
||||
* @param[out] sta_num: station's number in blacklist
|
||||
* @param[out] buf: store stations to get from blacklist
|
||||
* @param[in] buf_size: memory size to store stations in blacklist
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note None
|
||||
*/
|
||||
int tls_wifi_softap_get_blackinfo(u32 *sta_num, u8 *buf, u32 buf_size);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is used to set some information display in the process of wifi networking
|
||||
*
|
||||
@ -1147,6 +1234,109 @@ void tls_wifi_set_tempcomp_flag(int flag);
|
||||
*/
|
||||
u8 tls_wifi_get_tempcomp_flag(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to get temperature compensation flag
|
||||
*
|
||||
* @param[in] fixrateindex: 11b:0-3, 11g:4-11, 11n-ht20:12-19, 11n-ht40:20-27
|
||||
* @param[in] retrycnt: retry count, range[1,15]
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note When use this function, data to be transfered will use fix rate.
|
||||
*/
|
||||
void tls_wifi_set_fixed_rate(u32 fixrateindex, u32 retrycnt);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is used to set listen_interval (dummy interface)
|
||||
*
|
||||
* @param[in] listen_interval: >=1
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note this is dummy interface. this value can used only in sta mode.
|
||||
*/
|
||||
int tls_wifi_cfg_listen_interval(u16 listen_interval);
|
||||
|
||||
/**
|
||||
* @brief This function is used to set connect timeout
|
||||
*
|
||||
* @param[in] timeout: to connect ap's time, >=5s
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note valid only when scan AP failed.
|
||||
*/
|
||||
int tls_wifi_cfg_connect_timeout(u16 timeout);
|
||||
|
||||
/**
|
||||
* @brief This function is used to configure scan mode
|
||||
*
|
||||
* @param[in] mode:0-find max RSSI AP, 1-find AP and immediately stop scan to start join
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note only used in STA mode.
|
||||
*/
|
||||
int tls_wifi_cfg_connect_scan_mode(u32 mode);
|
||||
|
||||
/**
|
||||
* @brief This function is used to set pci flag
|
||||
*
|
||||
* @param[in] pci flag:0-can join any supported AP(open,wep,wpa,wpa2)
|
||||
* 1-only join AP(WPA/WPA2 that supported)
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
* @note none.
|
||||
*/
|
||||
int tls_wifi_cfg_connect_pci(u32 pci_en);
|
||||
|
||||
/**
|
||||
* @brief This function is used to set 11b's digital gain
|
||||
*
|
||||
* @param[in] value:gain value, <0x40
|
||||
*
|
||||
* @return 0:if value is valid,-1:if value is invalid
|
||||
*
|
||||
* @note none.
|
||||
*/
|
||||
int tls_wifi_set_11b_digital_gain(u8 value);
|
||||
|
||||
/**
|
||||
* @brief This function is used to get 11b's gain value
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @return gain value
|
||||
*
|
||||
* @note none.
|
||||
*/
|
||||
u8 tls_wifi_get_11b_digital_gain(void);
|
||||
|
||||
/**
|
||||
* @brief This function is used to set 11n's digital gain
|
||||
*
|
||||
* @param[in] value:gain value, <0x40
|
||||
*
|
||||
* @return 0:if value is valid,-1:if value is invalid
|
||||
*
|
||||
* @note none.
|
||||
*/
|
||||
int tls_wifi_set_11n_digital_gain(u8 value);
|
||||
|
||||
/**
|
||||
* @brief This function is used to get 11n's gain value
|
||||
*
|
||||
* @param[in] None
|
||||
*
|
||||
* @return gain value
|
||||
*
|
||||
* @note none.
|
||||
*/
|
||||
u8 tls_wifi_get_11n_digital_gain(void);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
@ -9,10 +9,8 @@
|
||||
*/
|
||||
#ifndef __WM_TYPE_DEF_H__
|
||||
#define __WM_TYPE_DEF_H__
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef bool
|
||||
#undef bool
|
||||
#endif
|
||||
#ifdef u8
|
||||
#undef u8
|
||||
#endif
|
||||
@ -53,7 +51,6 @@ typedef unsigned char INT8U;
|
||||
#endif
|
||||
typedef signed char INT8S;
|
||||
|
||||
typedef unsigned char bool;
|
||||
typedef unsigned char u8;
|
||||
typedef signed char s8;
|
||||
typedef unsigned short u16;
|
||||
|
@ -22,7 +22,7 @@
|
||||
******************************************************************************/
|
||||
MEMORY
|
||||
{
|
||||
I-SRAM : ORIGIN = 0x080d0400 , LENGTH = 0x138000 /* I-SRAM 1M+128KB */
|
||||
I-SRAM : ORIGIN = 0x080d0400 , LENGTH = 0x128000 /* I-SRAM 1M+160KB */
|
||||
D-SRAM : ORIGIN = 0x20000100 , LENGTH = 0x47EFC /* D-SRAM 288KB */
|
||||
V-SRAM : ORIGIN = 0x20000000 , LENGTH = 0x100 /* off-chip SRAM 8MB */
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ void tls_mem_alloc_info(void)
|
||||
i = 1;
|
||||
dl_list_for_each(pos, &memory_used_list, MEMORY_BLOCK, list){
|
||||
printf("Block(%2d): addr<%p>, file<%s>, line<%d>, length<%d>\r\n",
|
||||
i, pos->header_pattern, pos->file, pos->line, pos->length);
|
||||
i, (void *)pos->header_pattern, pos->file, pos->line, pos->length);
|
||||
i++;
|
||||
}
|
||||
tls_os_release_critical(cpu_sr);
|
||||
@ -470,7 +470,7 @@ int is_safe_addr_debug(void* p, u32 len, char* file, int line)
|
||||
if(((u32)p) + len > ((u32)(pos->header_pattern + sizeof(MEMORY_PATTERN) + PRE_OVERSIZE + pos->length)))
|
||||
{
|
||||
printf("==>Memory oversize. Block(%2d): addr<%p>, file<%s>, line<%d>, length<%d>\r\n",
|
||||
i, pos->header_pattern, pos->file, pos->line, pos->length);
|
||||
i, (void *)pos->header_pattern, pos->file, pos->line, pos->length);
|
||||
break;
|
||||
}
|
||||
else
|
||||
@ -508,7 +508,7 @@ u32 alloc_heap_mem_max_size = 0;
|
||||
extern u32 total_mem_size;
|
||||
void * mem_alloc_debug(u32 size)
|
||||
{
|
||||
// u32 cpu_sr = 0;
|
||||
u32 cpu_sr = 0;
|
||||
u32 *buffer = NULL;
|
||||
u32 length = size;
|
||||
|
||||
@ -516,6 +516,8 @@ void * mem_alloc_debug(u32 size)
|
||||
//printf("size:%d\n", size);
|
||||
if (!memory_manager_initialized) {
|
||||
tls_os_status_t os_status;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
memory_manager_initialized = true;
|
||||
//
|
||||
// NOTE: If two thread allocate the very first allocation simultaneously
|
||||
@ -525,6 +527,7 @@ void * mem_alloc_debug(u32 size)
|
||||
os_status = tls_os_sem_create(&mem_sem, 1);
|
||||
if(os_status != TLS_OS_SUCCESS)
|
||||
printf("mem_alloc_debug: tls_os_sem_create mem_sem error\r\n");
|
||||
tls_os_release_critical(cpu_sr);
|
||||
}
|
||||
|
||||
#if USING_ADD_HEADER
|
||||
@ -545,7 +548,7 @@ void * mem_alloc_debug(u32 size)
|
||||
else
|
||||
{
|
||||
tls_os_sem_acquire(mem_sem, 0);
|
||||
//cpu_sr = tls_os_set_critical();
|
||||
cpu_sr = tls_os_set_critical();
|
||||
buffer = (u32*)malloc(length);
|
||||
if(buffer)
|
||||
{
|
||||
@ -555,11 +558,8 @@ void * mem_alloc_debug(u32 size)
|
||||
buffer++;
|
||||
total_mem_size -= length;
|
||||
}
|
||||
//if(tls_get_isr_count() == 0)
|
||||
// {
|
||||
// tls_os_release_critical(cpu_sr);
|
||||
tls_os_sem_release(mem_sem);
|
||||
// }
|
||||
tls_os_release_critical(cpu_sr);
|
||||
tls_os_sem_release(mem_sem);
|
||||
}
|
||||
#else
|
||||
tls_os_sem_acquire(mem_sem, 0);
|
||||
@ -574,7 +574,7 @@ void * mem_alloc_debug(u32 size)
|
||||
|
||||
void mem_free_debug(void *p)
|
||||
{
|
||||
// u32 cpu_sr = 0;
|
||||
u32 cpu_sr = 0;
|
||||
// u32 len = 0;
|
||||
#if USING_ADD_HEADER
|
||||
u32* intMemPtr = NULL;
|
||||
@ -584,7 +584,7 @@ void mem_free_debug(void *p)
|
||||
if(isrstatus == 0)
|
||||
{
|
||||
tls_os_sem_acquire(mem_sem, 0);
|
||||
// cpu_sr = tls_os_set_critical();
|
||||
cpu_sr = tls_os_set_critical();
|
||||
}
|
||||
|
||||
intMemPtr = (u32*)p;
|
||||
@ -611,7 +611,7 @@ void mem_free_debug(void *p)
|
||||
|
||||
if(isrstatus == 0)
|
||||
{
|
||||
// tls_os_release_critical(cpu_sr);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
tls_os_sem_release(mem_sem);
|
||||
}
|
||||
#else //UCOSII
|
||||
@ -627,7 +627,7 @@ void mem_free_debug(void *p)
|
||||
void * mem_realloc_debug(void *mem_address, u32 size)
|
||||
{
|
||||
u32 * mem_re_addr = NULL;
|
||||
// u32 cpu_sr = 0;
|
||||
u32 cpu_sr = 0;
|
||||
u32 length = size;
|
||||
|
||||
#if USING_ADD_HEADER
|
||||
@ -665,7 +665,7 @@ void * mem_realloc_debug(void *mem_address, u32 size)
|
||||
else
|
||||
{
|
||||
tls_os_sem_acquire(mem_sem, 0);
|
||||
// cpu_sr = tls_os_set_critical();
|
||||
cpu_sr = tls_os_set_critical();
|
||||
mem_re_addr = (u32*)malloc(length);
|
||||
if(mem_re_addr && mem_address)
|
||||
{
|
||||
@ -683,7 +683,7 @@ void * mem_realloc_debug(void *mem_address, u32 size)
|
||||
mem_re_addr ++;
|
||||
total_mem_size -= length;
|
||||
}
|
||||
// tls_os_release_critical(cpu_sr);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
tls_os_sem_release(mem_sem);
|
||||
|
||||
mem_free_debug(mem_address);
|
||||
@ -704,7 +704,7 @@ void * mem_realloc_debug(void *mem_address, u32 size)
|
||||
|
||||
void *mem_calloc_debug(u32 n, u32 size)
|
||||
{
|
||||
// u32 cpu_sr = 0;
|
||||
u32 cpu_sr = 0;
|
||||
u32 *buffer = NULL;
|
||||
u32 length = 0;
|
||||
|
||||
@ -728,7 +728,7 @@ void *mem_calloc_debug(u32 n, u32 size)
|
||||
else
|
||||
{
|
||||
tls_os_sem_acquire(mem_sem, 0);
|
||||
// cpu_sr = tls_os_set_critical();
|
||||
cpu_sr = tls_os_set_critical();
|
||||
buffer = (u32*)malloc(length);
|
||||
if(buffer)
|
||||
{
|
||||
@ -740,7 +740,7 @@ void *mem_calloc_debug(u32 n, u32 size)
|
||||
total_mem_size -= length;
|
||||
}
|
||||
|
||||
// tls_os_release_critical(cpu_sr);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
tls_os_sem_release(mem_sem);
|
||||
}
|
||||
#else //UCOSII
|
||||
@ -765,15 +765,15 @@ u32 tls_mem_get_avail_heapsize(void)
|
||||
{
|
||||
#if USING_ADD_HEADER
|
||||
u32 availablemem = 0;
|
||||
// u32 cpu_sr;
|
||||
u32 cpu_sr;
|
||||
|
||||
tls_os_sem_acquire(mem_sem, 0);
|
||||
//cpu_sr = tls_os_set_critical();
|
||||
cpu_sr = tls_os_set_critical();
|
||||
availablemem = total_mem_size;
|
||||
// tls_os_release_critical(cpu_sr);
|
||||
tls_os_release_critical(cpu_sr);
|
||||
tls_os_sem_release(mem_sem);
|
||||
|
||||
return availablemem/*&0xFFFFF000*/;
|
||||
return availablemem;
|
||||
#else
|
||||
u8 *p = NULL;
|
||||
u32 startpos = 0;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "wm_mem.h"
|
||||
#include "tls_common.h"
|
||||
#include "wm_debug.h"
|
||||
//#include "wm_sockets.h"
|
||||
#include "wm_sockets.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
@ -454,8 +454,8 @@ char * strndup(const char *s, size_t len)
|
||||
memcpy(ret, s, len);
|
||||
return ret;
|
||||
}
|
||||
#if 0
|
||||
int gettimeofday(struct timeval *tv, void *tz)
|
||||
#if 1
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
int ret = 0;
|
||||
u32 current_tick;
|
||||
|
@ -31,10 +31,14 @@ typedef struct
|
||||
double a[3];
|
||||
}ST_ADC_POLYFIT_PARAM;
|
||||
|
||||
/*f(x) = kx + b*/
|
||||
//#define ADC_CAL_K_POS (6)
|
||||
//#define ADC_CAL_B_POS (7)
|
||||
|
||||
|
||||
ST_ADC_POLYFIT_PARAM _polyfit_param = {0};
|
||||
extern void polyfit(int n,double x[],double y[],int poly_n,double a[]);
|
||||
//TODO
|
||||
#define HR_SD_ADC_CONFIG_REG 0
|
||||
|
||||
static int adc_offset = 0;
|
||||
static int *adc_dma_buffer = NULL;
|
||||
volatile ST_ADC gst_adc;
|
||||
@ -79,28 +83,45 @@ static void adc_dma_isr_callbk(void)
|
||||
}
|
||||
int adc_polyfit_init(ST_ADC_POLYFIT_PARAM *polyfit_param)
|
||||
{
|
||||
FT_ADC_CAL_ST adc_st;
|
||||
double x[16] = {0};
|
||||
double y[16] = {0};
|
||||
int n = 4, poly_n = 1; // or = 2
|
||||
|
||||
FT_ADC_CAL_ST adc_cal;
|
||||
/*function f(x) = ax + b*/
|
||||
float a = 0.0;
|
||||
float b = 0.0;
|
||||
int i;
|
||||
|
||||
double x[8] = {0.0};
|
||||
double y[8] = {0.0};
|
||||
|
||||
polyfit_param->poly_n = 0;
|
||||
memset(&adc_st, 0, sizeof(adc_st));
|
||||
tls_get_adc_cal_param(&adc_st);
|
||||
//dumpBuffer("adc_st",(char *)&adc_st, sizeof(adc_st));
|
||||
n = adc_st.valid_cnt;
|
||||
if(n >= 4 && n <= 8)
|
||||
memset(&adc_cal, 0, sizeof(adc_cal));
|
||||
tls_get_adc_cal_param(&adc_cal);
|
||||
if ((adc_cal.valid_cnt == 4)
|
||||
||(adc_cal.valid_cnt == 2)
|
||||
|| (adc_cal.valid_cnt == 3))
|
||||
{
|
||||
for(i = 0; i < n; i++)
|
||||
//memcpy((char *)&a, (char *)&adc_cal.units[ADC_CAL_K_POS], 4);
|
||||
//memcpy((char *)&b, (char *)&adc_cal.units[ADC_CAL_B_POS], 4);
|
||||
a = adc_cal.a;
|
||||
b = adc_cal.b;
|
||||
if ((a > 1.0) && (a < 1.3) && (b < -1000.0)) /*new calibration*/
|
||||
{
|
||||
x[i] = (double)adc_st.units[i].real_val;
|
||||
y[i] = (double)adc_st.units[i].ref_val;
|
||||
polyfit_param->poly_n = 1;
|
||||
polyfit_param->a[1] = a;
|
||||
polyfit_param->a[0] = b;
|
||||
}
|
||||
else /*old calibration*/
|
||||
{
|
||||
for(i = 0; i < adc_cal.valid_cnt; i++)
|
||||
{
|
||||
x[i] = (double)adc_cal.units[i].real_val;
|
||||
y[i] = (double)adc_cal.units[i].ref_val;
|
||||
}
|
||||
polyfit_param->poly_n = 1;
|
||||
polyfit(adc_cal.valid_cnt,x,y,1, polyfit_param->a);
|
||||
if (b < -1000.0)
|
||||
{
|
||||
polyfit_param->a[0] = b;
|
||||
}
|
||||
}
|
||||
polyfit_param->poly_n = poly_n;
|
||||
polyfit(n,x,y,poly_n,polyfit_param->a);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -472,26 +493,11 @@ static void waitForAdcDone(void)
|
||||
int cal_voltage(double vol)
|
||||
{
|
||||
double y1, voltage;
|
||||
|
||||
double vol_30mV;
|
||||
int average = ((int)vol >> 2) & 0xFFFF;
|
||||
|
||||
if(_polyfit_param.poly_n == 2)
|
||||
{
|
||||
y1 = _polyfit_param.a[2]*average*average + _polyfit_param.a[1]*average + _polyfit_param.a[0];
|
||||
}
|
||||
else if(_polyfit_param.poly_n == 1)
|
||||
if(_polyfit_param.poly_n == 1)
|
||||
{
|
||||
y1 = _polyfit_param.a[1]*average + _polyfit_param.a[0];
|
||||
vol_30mV = ((double)300.0L - _polyfit_param.a[0]) / _polyfit_param.a[1];
|
||||
if(average + 170 < vol_30mV)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(average < vol_30mV)
|
||||
{
|
||||
y1 = 300.0L - 200.0L*(vol_30mV - average) / 170.0L;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
187
src/W800_SDK_v1.00.10/platform/drivers/adc/wm_adc_cal.c
Normal file
187
src/W800_SDK_v1.00.10/platform/drivers/adc/wm_adc_cal.c
Normal file
@ -0,0 +1,187 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* File Name : wm_adc_cal.c
|
||||
*
|
||||
* Description: adc calibration
|
||||
*
|
||||
* Copyright (c) 2014 Winner Microelectronics Co., Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author :
|
||||
*
|
||||
* Date : 2022-10-10
|
||||
*****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "wm_include.h"
|
||||
#include "wm_regs.h"
|
||||
#include "wm_adc.h"
|
||||
#include "wm_io.h"
|
||||
#include "wm_gpio_afsel.h"
|
||||
#include "wm_efuse.h"
|
||||
|
||||
#define ZERO_CAL_MAX_NUM (10)
|
||||
/*f(x) = kx + b*/
|
||||
//#define ADC_CAL_B_POS (7)
|
||||
//#define ADC_CAL_K_POS (6)
|
||||
#define ADC_CAL_REF_VOLTAGE_POS (5)
|
||||
extern void polyfit(int n,double x[],double y[],int poly_n,double a[]);
|
||||
|
||||
/**
|
||||
* @brief This function can used to calibrate adc coefficient if not calibrated,
|
||||
* or adc offset after FT or multipoint calibration.
|
||||
*
|
||||
* @param[in] chanused: bitmap, specified calibration channel,only bit0-3 can be used
|
||||
* @param[in] refvoltage[]: array, calibration reference voltage to be used, unit:mV
|
||||
* refvoltage keep the same position with chan bitmap
|
||||
* real range[100,2300)mV, suggest reference voltage[500,2000]mV
|
||||
*
|
||||
* @return 0: success, < 0: failure
|
||||
*
|
||||
* @note 1)Adc curve is y=ax+b,y is real voltage(unit:mV), x is adc sample data.
|
||||
* After calibration, we can get a and b, or only update b.
|
||||
* 2) Only used single-end adc
|
||||
* 3) For example, use chan 0,1,3, and refvoltage 500,1000,2000,
|
||||
* then chanused is 0xB, refvoltage[] value is {500,1000,0, 2000};
|
||||
*/
|
||||
int adc_multipoint_calibration(int chanused, int refvoltage[])
|
||||
{
|
||||
#define MAX_ADC_CAL_CHAN (4)
|
||||
#define MAX_ADC_REF_VOLTAGE (2300)
|
||||
#define MIN_ADC_REF_VOLTAGE (100)
|
||||
if (((chanused &((1<<MAX_ADC_CAL_CHAN)-1)) == 0) || (refvoltage == NULL))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
FT_ADC_CAL_ST adc_cal;
|
||||
int average = 0;
|
||||
int chancnt = 0;
|
||||
u32 sum_value = 0;
|
||||
float b = 0.0;
|
||||
|
||||
int *prefvoltage = refvoltage;
|
||||
|
||||
/*update calibration parameter*/
|
||||
memset(&adc_cal, 0xFF, sizeof(FT_ADC_CAL_ST));
|
||||
|
||||
for (int j = 0; j < MAX_ADC_CAL_CHAN; j++)
|
||||
{
|
||||
if ((chanused&(1<<j)) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((prefvoltage[j] < MIN_ADC_REF_VOLTAGE) || (prefvoltage[j] >= MAX_ADC_REF_VOLTAGE))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
/*config adc chan for calibration*/
|
||||
wm_adc_config(j);
|
||||
|
||||
/*config adc and start capture data*/
|
||||
tls_adc_init(0, 0);
|
||||
tls_adc_reference_sel(ADC_REFERENCE_INTERNAL);
|
||||
tls_adc_set_pga(1,1);
|
||||
tls_adc_set_clk(40);
|
||||
tls_adc_start_with_cpu(j);
|
||||
|
||||
tls_os_time_delay(1);
|
||||
sum_value = 0;
|
||||
for (int i = 1; i <= ZERO_CAL_MAX_NUM; i++)
|
||||
{
|
||||
tls_os_time_delay(1);
|
||||
average = *(TLS_REG *)(HR_SD_ADC_RESULT_REG);
|
||||
average = ADC_RESULT_VAL(average);
|
||||
signedToUnsignedData(&average);
|
||||
sum_value += average;
|
||||
}
|
||||
|
||||
adc_cal.units[chancnt].ref_val = prefvoltage[j]*10;
|
||||
adc_cal.units[chancnt].real_val = sum_value/ZERO_CAL_MAX_NUM/4;
|
||||
chancnt++;
|
||||
tls_adc_stop(0);
|
||||
}
|
||||
|
||||
if (chancnt >= 2)
|
||||
{
|
||||
float k = 0.0;
|
||||
double a[4] = {0.0};
|
||||
double x[8] = {0.0};
|
||||
double y[8] = {0.0};
|
||||
|
||||
for(int i = 0; i < chancnt; i++)
|
||||
{
|
||||
x[i] = (double)adc_cal.units[i].real_val;
|
||||
y[i] = (double)adc_cal.units[i].ref_val;
|
||||
}
|
||||
|
||||
polyfit(chancnt, x, y, 1, a);
|
||||
|
||||
k = (float)a[1];
|
||||
b = (float)a[0];
|
||||
//memcpy((char *)&adc_cal.units[ADC_CAL_K_POS], (char *)&k, 4);
|
||||
//memcpy((char *)&adc_cal.units[ADC_CAL_B_POS], (char *)&b, 4);
|
||||
adc_cal.a = k;
|
||||
adc_cal.b = b;
|
||||
adc_cal.valid_cnt = chancnt;
|
||||
return tls_set_adc_cal_param(&adc_cal);
|
||||
}
|
||||
else /*only one reference voltage*/
|
||||
{
|
||||
/*update calibration parameter*/
|
||||
int currentvalue = cal_voltage((double)adc_cal.units[0].real_val*4);
|
||||
int ret = tls_get_adc_cal_param(&adc_cal);
|
||||
if ((ret == 0) && (adc_cal.valid_cnt >= 2) && (adc_cal.valid_cnt <= 4))
|
||||
{
|
||||
/*reference voltage by user settings*/
|
||||
for (int i = 0; i < MAX_ADC_CAL_CHAN; i++)
|
||||
{
|
||||
if (chanused&(1<<i))
|
||||
{
|
||||
adc_cal.units[ADC_CAL_REF_VOLTAGE_POS].ref_val = prefvoltage[i];
|
||||
average = prefvoltage[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*update parameter b that used by the function f(x)=ax+b */
|
||||
//memcpy((char *)&b, (char *)&adc_cal.units[ADC_CAL_B_POS], 4);
|
||||
b = adc_cal.b;
|
||||
b = b + (average - currentvalue)*10; /*0.1mV*/
|
||||
//memcpy((char *)&adc_cal.units[ADC_CAL_B_POS], (char *)&b, 4);
|
||||
adc_cal.b = b;
|
||||
return tls_set_adc_cal_param(&adc_cal);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function is used to calibrate adc offset after FT or multipoint calibration.
|
||||
*
|
||||
* @param[in] chan: adc calibration channel to be used
|
||||
* @param[in] refvoltage: calibration reference voltage to be used, unit:mV
|
||||
*
|
||||
* @return 0: success, < 0: failure
|
||||
*
|
||||
* @note After FT calibration or mulitpoint calibration, adc curve is y=ax+b,
|
||||
* y is real voltage(unit:mV), x is adc sample data
|
||||
* a and b is the coefficient. This fuction only used to revise b value.
|
||||
*/
|
||||
int adc_offset_calibration(int chan, int refvoltage)
|
||||
{
|
||||
if (chan >= 0 && chan < 4)
|
||||
{
|
||||
int refvol[4] = {0, 0, 0, 0};
|
||||
refvol[chan] = refvoltage;
|
||||
return adc_multipoint_calibration((1<<chan), refvol);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
void polyfit_verify(double x, double* a)
|
||||
{
|
||||
double y1 = a[2]*x*x + a[1]*x + a[0];
|
||||
double y1 = a[1]*x + a[0];
|
||||
printf("x=%d, y1=%d\n", (int)x, (int)(y1+0.5));
|
||||
}
|
||||
|
||||
@ -95,9 +95,9 @@ x[i]-=A[i*n+j]*x[j];
|
||||
|
||||
void polyfit_test(void)
|
||||
{
|
||||
int i,n=4,poly_n=2;
|
||||
double x[4]={4823, 9816, 14851, 19837},y[4]={5000, 9986, 15001, 19959};
|
||||
double a[3];
|
||||
int i,n=2,poly_n=1;
|
||||
double x[2]={15174, 19196},y[2]={5000, 9986};
|
||||
double a[2];
|
||||
void polyfit(int n,double *x,double *y,int poly_n,double a[]);
|
||||
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
|
||||
#define FT_MAGICNUM_ADDR (FLASH_BASE_ADDR)
|
||||
#define FT_PARAM_RUNTIME_ADDR (FT_MAGICNUM_ADDR + 0x1000)
|
||||
#define MAGICNUM_LEN (4)
|
||||
#define MAC_ADDR_LEN (6)
|
||||
#define FT_GAIN_LEN (84)
|
||||
@ -70,28 +71,23 @@ static u8 default_mac[6] = {0x00,0x25,0x08,0x09,0x01,0x0F};
|
||||
FT_PARAM_ST_VER1 gftParamVer1;
|
||||
|
||||
FT_PARAM_ST *gftParam = (FT_PARAM_ST *)&gftParamVer1;
|
||||
int tls_ft_param_init(void)
|
||||
static int _ft_ext1_valid(FT_PARAM_ST *pft)
|
||||
{
|
||||
//printf("version_no %d, ext_param_len %x\n", pft->version_no, pft->ext_param_len);
|
||||
if (pft->version_no > 0 && pft->version_no < 0xFFFF && pft->ext_param_len >= sizeof(FT_PARAM_ST_EXT_1) &&
|
||||
pft->ext_param_len <= (sizeof(FT_PARAM_ST_EXT_1) + FT_PARAM_EXT_REVERSED_LEN))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
static int _ft_param_init(u32 ft_addr, FT_PARAM_ST *pft)
|
||||
{
|
||||
u32 crcvalue = 0;
|
||||
psCrcContext_t ctx;
|
||||
FT_PARAM_ST_VER1 *pft_ver1 = NULL;
|
||||
FT_PARAM_ST *pft = NULL;
|
||||
|
||||
if (gftParam->magic_no == SIGNATURE_WORD)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pft = tls_mem_alloc(sizeof(FT_PARAM_ST_VER1));
|
||||
if (pft == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
memset(gftParam, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
|
||||
tls_fls_read(FT_MAGICNUM_ADDR, (unsigned char *)pft, sizeof(FT_PARAM_ST_VER1));
|
||||
tls_fls_read(ft_addr, (unsigned char *)pft, sizeof(FT_PARAM_ST_VER1));
|
||||
if (pft->magic_no == SIGNATURE_WORD)
|
||||
{
|
||||
tls_crypto_init();
|
||||
@ -100,14 +96,13 @@ int tls_ft_param_init(void)
|
||||
tls_crypto_crc_final(&ctx, &crcvalue);
|
||||
if (pft->checksum != crcvalue)
|
||||
{
|
||||
tls_mem_free(pft);
|
||||
//tls_mem_free(pft);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (pft->version_no > 0 && pft->version_no < 0xFFFF && pft->ext_param_len >= sizeof(FT_PARAM_ST_EXT_1) &&
|
||||
pft->ext_param_len <= (sizeof(FT_PARAM_ST_EXT_1) + FT_PARAM_EXT_REVERSED_LEN))
|
||||
if (_ft_ext1_valid(pft))
|
||||
{
|
||||
pft_ver1 = (FT_PARAM_ST_VER1 *)pft;
|
||||
tls_crypto_crc_init(&ctx, 0xFFFFFFFF, CRYPTO_CRC_TYPE_32, INPUT_REFLECT | OUTPUT_REFLECT);
|
||||
@ -115,31 +110,100 @@ int tls_ft_param_init(void)
|
||||
tls_crypto_crc_final(&ctx, &crcvalue);
|
||||
if(pft_ver1->ext_checksum == crcvalue)
|
||||
{
|
||||
memcpy((unsigned char *)gftParam, (unsigned char *)pft, sizeof(FT_PARAM_ST_VER1));
|
||||
break;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
pft->version_no = 0xFFFF;
|
||||
pft->ext_param_len = 0xFFFF;
|
||||
memcpy((unsigned char *)gftParam, (unsigned char *)pft, sizeof(FT_PARAM_ST));
|
||||
}while(0);
|
||||
return 2;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
int tls_ft_param_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
FT_PARAM_ST *pft = NULL;
|
||||
|
||||
if (gftParam->magic_no == SIGNATURE_WORD)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
memset(gftParam, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
|
||||
pft = tls_mem_alloc(sizeof(FT_PARAM_ST_VER1));
|
||||
if (pft == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
ret = _ft_param_init(FT_PARAM_RUNTIME_ADDR, pft);
|
||||
if(FALSE == ret)
|
||||
{
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
ret = _ft_param_init(FT_MAGICNUM_ADDR, pft);
|
||||
}
|
||||
if(1 == ret)
|
||||
{
|
||||
memcpy((unsigned char *)gftParam, (unsigned char *)pft, sizeof(FT_PARAM_ST_VER1));
|
||||
}
|
||||
else if(2 == ret)
|
||||
{
|
||||
memcpy((unsigned char *)gftParam, (unsigned char *)pft, sizeof(FT_PARAM_ST));
|
||||
}
|
||||
tls_mem_free(pft);
|
||||
|
||||
/*lock parameter*/
|
||||
tls_flash_unlock();
|
||||
return TRUE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tls_ft_param_get(unsigned int opnum, void *data, unsigned int rdlen)
|
||||
{
|
||||
int ret = 0;
|
||||
switch (opnum)
|
||||
{
|
||||
case CMD_FREQ_ERR:
|
||||
if(_ft_ext1_valid(gftParam))
|
||||
{
|
||||
memcpy(data, (char *)&gftParamVer1.ft_ext1.rf_freq_err, FREQERR_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = tls_fls_read(FREQERR_ADDR, data, FREQERR_LEN);
|
||||
if(ret)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CMD_RF_CAL_FLAG:
|
||||
if(_ft_ext1_valid(gftParam))
|
||||
{
|
||||
memcpy(data, (char *)&gftParamVer1.ft_ext1.rf_cal_flag, CAL_FLAG_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = tls_fls_read(CAL_FLAG_ADDR, data, CAL_FLAG_LEN);
|
||||
if(ret)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CMD_TX_ADC_CAL:
|
||||
if(gftParam->version_no > 0 && gftParam->version_no < 0xFFFF)
|
||||
if(_ft_ext1_valid(gftParam))
|
||||
{
|
||||
memcpy(data, (unsigned char *)&gftParamVer1.ft_ext1.adc_cal_param, rdlen);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case CMD_WIFI_MAC: /*MAC*/
|
||||
if ((gftParam->wifi_mac_addr[0]&0x1)
|
||||
@ -217,13 +281,57 @@ int tls_ft_param_set(unsigned int opnum, void *data, unsigned int len)
|
||||
{
|
||||
psCrcContext_t ctx;
|
||||
unsigned int writelen = 0;
|
||||
FT_PARAM_ST *pft = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (!data || !len)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
pft = tls_mem_alloc(sizeof(FT_PARAM_ST_VER1));
|
||||
if (pft == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
ret = _ft_param_init(FT_PARAM_RUNTIME_ADDR, pft);
|
||||
if(ret)
|
||||
{
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
ret = _ft_param_init(FT_MAGICNUM_ADDR, pft);
|
||||
if(!ret || memcmp(pft, gftParam, sizeof(FT_PARAM_ST_VER1)))
|
||||
{
|
||||
tls_flash_unlock();
|
||||
tls_fls_write(FT_MAGICNUM_ADDR, (unsigned char *)gftParam, sizeof(FT_PARAM_ST_VER1));
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
ret = _ft_param_init(FT_MAGICNUM_ADDR, pft);
|
||||
if(!ret || memcmp(pft, gftParam, sizeof(FT_PARAM_ST_VER1)))
|
||||
{
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
tls_mem_free(pft);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!_ft_ext1_valid(gftParam))
|
||||
{
|
||||
gftParam->version_no = 1;
|
||||
gftParam->ext_param_len = sizeof(FT_PARAM_ST_EXT_1);
|
||||
memset((char *)&gftParamVer1.ft_ext1, 0xFF, gftParam->ext_param_len);
|
||||
}
|
||||
switch (opnum)
|
||||
{
|
||||
case CMD_FREQ_ERR:
|
||||
memcpy((char *)&gftParamVer1.ft_ext1.rf_freq_err, (char *)data, FREQERR_LEN);
|
||||
break;
|
||||
case CMD_RF_CAL_FLAG:
|
||||
memcpy((char *)&gftParamVer1.ft_ext1.rf_cal_flag, (char *)data, CAL_FLAG_LEN);
|
||||
break;
|
||||
case CMD_TX_ADC_CAL:
|
||||
memcpy((unsigned char *)&gftParamVer1.ft_ext1.adc_cal_param, data, len);
|
||||
break;
|
||||
|
||||
case CMD_WIFI_MAC: /*MAC*/
|
||||
memcpy(gftParam->wifi_mac_addr, (unsigned char *)data, len);
|
||||
break;
|
||||
@ -269,25 +377,44 @@ int tls_ft_param_set(unsigned int opnum, void *data, unsigned int len)
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
tls_mem_free(pft);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tls_crypto_init();
|
||||
/*len to write to flash*/
|
||||
writelen = sizeof(FT_PARAM_ST_VER1);
|
||||
tls_crypto_crc_init(&ctx, 0xFFFFFFFF, CRYPTO_CRC_TYPE_32, INPUT_REFLECT | OUTPUT_REFLECT);
|
||||
tls_crypto_crc_update(&ctx, (unsigned char *)&gftParamVer1.ft_ext1, gftParam->ext_param_len);
|
||||
tls_crypto_crc_final(&ctx, &gftParamVer1.ext_checksum);
|
||||
|
||||
gftParam->magic_no = SIGNATURE_WORD;
|
||||
tls_crypto_crc_init(&ctx, 0xFFFFFFFF, CRYPTO_CRC_TYPE_32, INPUT_REFLECT | OUTPUT_REFLECT);
|
||||
tls_crypto_crc_update(&ctx, (unsigned char *)gftParam + 8, sizeof(FT_PARAM_ST) -8);
|
||||
tls_crypto_crc_final(&ctx, &gftParam->checksum);
|
||||
writelen = sizeof(FT_PARAM_ST);
|
||||
if(gftParam->version_no > 0 && gftParam->version_no < 0xFFFF)
|
||||
{
|
||||
writelen = sizeof(FT_PARAM_ST_VER1);
|
||||
tls_crypto_crc_init(&ctx, 0xFFFFFFFF, CRYPTO_CRC_TYPE_32, INPUT_REFLECT | OUTPUT_REFLECT);
|
||||
tls_crypto_crc_update(&ctx, (unsigned char *)&gftParamVer1.ft_ext1, gftParam->ext_param_len);
|
||||
tls_crypto_crc_final(&ctx, &gftParamVer1.ext_checksum);
|
||||
}
|
||||
|
||||
tls_flash_unlock();
|
||||
tls_fls_write(FT_PARAM_RUNTIME_ADDR, (unsigned char *)gftParam, writelen);
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
ret = _ft_param_init(FT_PARAM_RUNTIME_ADDR, pft);
|
||||
if(!ret || memcmp(pft, gftParam, sizeof(FT_PARAM_ST_VER1)))
|
||||
{
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
tls_mem_free(pft);
|
||||
return -1;
|
||||
}
|
||||
tls_fls_write(FT_MAGICNUM_ADDR, (unsigned char *)gftParam, writelen);
|
||||
tls_flash_lock();
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
ret = _ft_param_init(FT_MAGICNUM_ADDR, pft);
|
||||
if(!ret || memcmp(pft, gftParam, sizeof(FT_PARAM_ST_VER1)))
|
||||
{
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
tls_mem_free(pft);
|
||||
return -1;
|
||||
}
|
||||
memset(pft, 0xFF, sizeof(FT_PARAM_ST_VER1));
|
||||
tls_mem_free(pft);
|
||||
//tls_flash_lock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -479,45 +606,26 @@ int tls_set_rx_iq_phase(u8 *rxPhase)
|
||||
int tls_freq_err_op(u8 *freqerr, u8 flag)
|
||||
{
|
||||
int ret = 0;
|
||||
psCrcContext_t ctx;
|
||||
int value = 0;
|
||||
if (flag){
|
||||
tls_flash_unlock();
|
||||
if(gftParam->version_no > 0 && gftParam->version_no < 0xFFFF)
|
||||
{
|
||||
memcpy((char *)&gftParamVer1.ft_ext1.rf_freq_err, (char *)freqerr, FREQERR_LEN);
|
||||
tls_crypto_crc_init(&ctx, 0xFFFFFFFF, CRYPTO_CRC_TYPE_32, INPUT_REFLECT | OUTPUT_REFLECT);
|
||||
tls_crypto_crc_update(&ctx, (unsigned char *)&gftParamVer1.ft_ext1, gftParam->ext_param_len);
|
||||
tls_crypto_crc_final(&ctx, &gftParamVer1.ext_checksum);
|
||||
ret = tls_fls_write(FT_MAGICNUM_ADDR, (unsigned char *)gftParam, sizeof(FT_PARAM_ST_VER1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = tls_fls_write(FREQERR_ADDR, freqerr, FREQERR_LEN);
|
||||
}
|
||||
tls_flash_lock();
|
||||
ret = tls_ft_param_set(CMD_FREQ_ERR, freqerr, FREQERR_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gftParam->version_no > 0 && gftParam->version_no < 0xFFFF)
|
||||
ret = tls_ft_param_get(CMD_FREQ_ERR, freqerr, FREQERR_LEN);
|
||||
if(!ret)
|
||||
{
|
||||
memcpy((char *)freqerr, (char *)&gftParamVer1.ft_ext1.rf_freq_err, FREQERR_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = tls_fls_read(FREQERR_ADDR, freqerr, FREQERR_LEN);
|
||||
}
|
||||
|
||||
memcpy(&value, freqerr, FREQERR_LEN);
|
||||
if (value > 200000) /*when freq offset is out of range (-200KHz, 200KHz),do not use it*/
|
||||
{
|
||||
value = 200000;
|
||||
memcpy((char *)freqerr, (char *)&value, FREQERR_LEN);
|
||||
}
|
||||
else if (value < -200000)
|
||||
{
|
||||
value = -200000;
|
||||
memcpy((char *)freqerr, (char *)&value, FREQERR_LEN);
|
||||
memcpy(&value, freqerr, FREQERR_LEN);
|
||||
if (value > 200000) /*when freq offset is out of range (-200KHz, 200KHz),do not use it*/
|
||||
{
|
||||
value = 200000;
|
||||
memcpy((char *)freqerr, (char *)&value, FREQERR_LEN);
|
||||
}
|
||||
else if (value < -200000)
|
||||
{
|
||||
value = -200000;
|
||||
memcpy((char *)freqerr, (char *)&value, FREQERR_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret == 0)
|
||||
@ -533,33 +641,12 @@ int tls_freq_err_op(u8 *freqerr, u8 flag)
|
||||
int tls_rf_cal_finish_op(u8 *calflag, u8 flag)
|
||||
{
|
||||
int ret = 0;
|
||||
psCrcContext_t ctx;
|
||||
if (flag){
|
||||
tls_flash_unlock();
|
||||
if(gftParam->version_no > 0 && gftParam->version_no < 0xFFFF)
|
||||
{
|
||||
memcpy((char *)&gftParamVer1.ft_ext1.rf_cal_flag, (char *)calflag, CAL_FLAG_LEN);
|
||||
tls_crypto_crc_init(&ctx, 0xFFFFFFFF, CRYPTO_CRC_TYPE_32, INPUT_REFLECT | OUTPUT_REFLECT);
|
||||
tls_crypto_crc_update(&ctx, (unsigned char *)&gftParamVer1.ft_ext1, gftParam->ext_param_len);
|
||||
tls_crypto_crc_final(&ctx, &gftParamVer1.ext_checksum);
|
||||
ret = tls_fls_write(FT_MAGICNUM_ADDR, (unsigned char *)gftParam, sizeof(FT_PARAM_ST_VER1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = tls_fls_write(CAL_FLAG_ADDR, calflag, CAL_FLAG_LEN);
|
||||
}
|
||||
tls_flash_lock();
|
||||
ret = tls_ft_param_set(CMD_RF_CAL_FLAG, calflag, CAL_FLAG_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gftParam->version_no > 0 && gftParam->version_no < 0xFFFF)
|
||||
{
|
||||
memcpy((char *)calflag, (char *)&gftParamVer1.ft_ext1.rf_cal_flag, CAL_FLAG_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = tls_fls_read(CAL_FLAG_ADDR, calflag, CAL_FLAG_LEN);
|
||||
}
|
||||
ret = tls_ft_param_get(CMD_RF_CAL_FLAG, calflag, CAL_FLAG_LEN);
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
@ -600,11 +687,31 @@ int tls_set_tx_gain(u8 *txgain)
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function is used to get adc cal param
|
||||
*
|
||||
* @param[out] adc_cal adc cal param
|
||||
*
|
||||
* @retval TLS_EFUSE_STATUS_OK get success
|
||||
* @retval TLS_EFUSE_STATUS_EIO get failed
|
||||
*/
|
||||
int tls_get_adc_cal_param(FT_ADC_CAL_ST *adc_cal)
|
||||
{
|
||||
return tls_ft_param_get(CMD_TX_ADC_CAL, adc_cal, sizeof(FT_ADC_CAL_ST));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function is used to set adc cal param
|
||||
*
|
||||
* @param[out] adc_cal adc cal param
|
||||
*
|
||||
* @retval TLS_EFUSE_STATUS_OK get success
|
||||
* @retval TLS_EFUSE_STATUS_EIO get failed
|
||||
*/
|
||||
int tls_set_adc_cal_param(FT_ADC_CAL_ST *adc_cal)
|
||||
{
|
||||
return tls_ft_param_set(CMD_TX_ADC_CAL, adc_cal, sizeof(FT_ADC_CAL_ST));
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,7 +206,7 @@ void wm_psram_config(uint8_t numsel)
|
||||
{
|
||||
switch(numsel)
|
||||
{
|
||||
case 0:
|
||||
case 0://W800 or w801
|
||||
tls_io_cfg_set(WM_IO_PB_00, WM_IO_OPTION4);/*CK*/
|
||||
tls_io_cfg_set(WM_IO_PB_01, WM_IO_OPTION4);/*CS*/
|
||||
tls_io_cfg_set(WM_IO_PB_02, WM_IO_OPTION4);/*D0*/
|
||||
@ -217,6 +217,16 @@ void wm_psram_config(uint8_t numsel)
|
||||
break;
|
||||
|
||||
case 1://w801
|
||||
tls_io_cfg_set(WM_IO_PA_15, WM_IO_OPTION1);/*CK*/
|
||||
tls_io_cfg_set(WM_IO_PB_27, WM_IO_OPTION1);/*CS*/
|
||||
tls_io_cfg_set(WM_IO_PB_02, WM_IO_OPTION4);/*D0*/
|
||||
tls_io_cfg_set(WM_IO_PB_03, WM_IO_OPTION4);/*D1*/
|
||||
tls_io_cfg_set(WM_IO_PB_04, WM_IO_OPTION4);/*D2*/
|
||||
tls_io_cfg_set(WM_IO_PB_05, WM_IO_OPTION4);/*D3*/
|
||||
tls_open_peripheral_clock(TLS_PERIPHERAL_TYPE_PSRAM);
|
||||
break;
|
||||
|
||||
case 2://w861
|
||||
tls_io_cfg_set(WM_IO_PA_15, WM_IO_OPTION1);/*CK*/
|
||||
tls_io_cfg_set(WM_IO_PB_27, WM_IO_OPTION1);/*CS*/
|
||||
tls_io_cfg_set(WM_IO_PB_28, WM_IO_OPTION1);/*D0*/
|
||||
@ -1089,7 +1099,7 @@ void wm_gpio_af_disable(void)
|
||||
#endif
|
||||
tls_reg_write32(HR_GPIOB_AFSEL, 0x0);
|
||||
|
||||
tls_reg_write32(HR_GPIOA_DATA_PULLEN, 0xffff);
|
||||
tls_reg_write32(HR_GPIOB_DATA_PULLEN, 0xffffffff);
|
||||
tls_reg_write32(HR_GPIOA_DATA_PULLEN, 0x0);
|
||||
tls_reg_write32(HR_GPIOB_DATA_PULLEN, 0x0);
|
||||
}
|
||||
|
||||
|
@ -59,17 +59,18 @@ static void writeBpBit_for_1wreg(char cmp, char bp4, char bp3, char bp2, char bp
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x0C035;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
status |= (read_first_value() & 0xFF) << 8;
|
||||
|
||||
/*Write Enable*/
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x6;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
|
||||
bpstatus = (bp4 << 6) | (bp3 << 5) | (bp2 << 4) | (bp1 << 3) | (bp0 << 2);
|
||||
status = (status & 0xBF83) | bpstatus | (cmp << 14);
|
||||
if ((status & 0x407C) != (bpstatus|(cmp<<14)))
|
||||
{
|
||||
status = (status & 0xBF83) | bpstatus | (cmp << 14);
|
||||
/*Write Enable*/
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x6;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
|
||||
M32(RSA_BASE_ADDRESS) = status;
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x1A001;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
M32(RSA_BASE_ADDRESS) = status;
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x1A001;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
}
|
||||
}
|
||||
|
||||
static void writeBpBit_for_2wreg(char cmp, char bp4, char bp3, char bp2, char bp1, char bp0)
|
||||
@ -86,24 +87,29 @@ static void writeBpBit_for_2wreg(char cmp, char bp4, char bp3, char bp2, char bp
|
||||
status |= (read_first_value() & 0xFF) << 8;
|
||||
|
||||
/*Write Enable*/
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x6;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
|
||||
bpstatus = (bp4 << 6) | (bp3 << 5) | (bp2 << 4) | (bp1 << 3) | (bp0 << 2);
|
||||
bpstatus = (status & 0x83) | bpstatus;
|
||||
if ((bpstatus != (status & 0x7C)))
|
||||
{
|
||||
bpstatus = (status & 0x83) | bpstatus;
|
||||
|
||||
M32(RSA_BASE_ADDRESS) = bpstatus;
|
||||
M32(HR_FLASH_CMD_ADDR) = 0xA001;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x6;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
|
||||
M32(RSA_BASE_ADDRESS) = bpstatus;
|
||||
M32(HR_FLASH_CMD_ADDR) = 0xA001;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
}
|
||||
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x6;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
if (((status & 0x4000)>>8) != (cmp << 6))
|
||||
{
|
||||
M32(HR_FLASH_CMD_ADDR) = 0x6;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
|
||||
status = ((status>>8) & 0xBF) | (cmp << 6);
|
||||
M32(RSA_BASE_ADDRESS) = status;
|
||||
M32(HR_FLASH_CMD_ADDR) = 0xA031;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
status = ((status>>8) & 0xBF) | (cmp << 6);
|
||||
M32(RSA_BASE_ADDRESS) = status;
|
||||
M32(HR_FLASH_CMD_ADDR) = 0xA031;
|
||||
M32(HR_FLASH_CMD_START) = CMD_START_Msk;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -150,10 +156,10 @@ static int flashunlock(void)
|
||||
{
|
||||
case SPIFLASH_MID_GD:
|
||||
case SPIFLASH_MID_TSINGTENG:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB:
|
||||
writeBpBit_for_1wreg(0, 0, 0, 0, 0, 0);
|
||||
break;
|
||||
case SPIFLASH_MID_PUYA:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB_4MB:
|
||||
if (inside_fls->density == 0x100000)/*PUYA 1M Flash use 1 register to set lock/unlock*/
|
||||
{
|
||||
writeBpBit_for_1wreg(0, 0, 0, 0, 0, 0);
|
||||
@ -184,10 +190,10 @@ static int flashlock(void)
|
||||
{
|
||||
case SPIFLASH_MID_GD:
|
||||
case SPIFLASH_MID_TSINGTENG:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB:
|
||||
writeBpBit_for_1wreg(0, 1, 1, 0, 1, 0);
|
||||
break;
|
||||
case SPIFLASH_MID_PUYA:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB_4MB:
|
||||
if (inside_fls->density == 0x100000) /*PUYA 1M Flash use 1 register to set lock/unlock*/
|
||||
{
|
||||
writeBpBit_for_1wreg(0, 1, 1, 0, 1, 0);
|
||||
@ -655,7 +661,7 @@ int tls_fls_read_unique_id(unsigned char *uuid)
|
||||
case SPIFLASH_MID_GD:
|
||||
case SPIFLASH_MID_PUYA:
|
||||
case SPIFLASH_MID_TSINGTENG:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB_4MB:
|
||||
dumy_bytes = 4;
|
||||
uni_bytes = 16;
|
||||
break;
|
||||
@ -870,7 +876,7 @@ int tls_fls_otp_lock(void)
|
||||
case SPIFLASH_MID_TSINGTENG:
|
||||
writeLbBit_for_1wreg((1<<10));
|
||||
break;
|
||||
case SPIFLASH_MID_TSINGTENG_1MB:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB_4MB:
|
||||
writeLbBit_for_1wreg((7<<11));
|
||||
break;
|
||||
case SPIFLASH_MID_FUDANMICRO:
|
||||
@ -1460,8 +1466,21 @@ int tls_fls_init(void)
|
||||
fls->OTPWRParam.pageSize = 256;
|
||||
switch(fls->flashid)
|
||||
{
|
||||
case SPIFLASH_MID_TSINGTENG_1MB_4MB:
|
||||
if (fls->density == 0x100000)
|
||||
{
|
||||
fls->OTPWRParam.eraseSize = 1024;
|
||||
}
|
||||
else if (fls->density == 0x400000)
|
||||
{
|
||||
fls->OTPWRParam.eraseSize = 2048;
|
||||
}
|
||||
else
|
||||
{
|
||||
fls->OTPWRParam.eraseSize = 256;
|
||||
}
|
||||
break;
|
||||
case SPIFLASH_MID_GD:
|
||||
case SPIFLASH_MID_TSINGTENG_1MB:
|
||||
fls->OTPWRParam.eraseSize = 1024;
|
||||
break;
|
||||
case SPIFLASH_MID_FUDANMICRO:
|
||||
|
@ -33,6 +33,8 @@ static void io_cfg_option1(enum tls_io_name name)
|
||||
tls_reg_write32(HR_GPIO_AF_SEL + offset, tls_reg_read32(HR_GPIO_AF_SEL + offset) | BIT(pin)); /* gpio function */
|
||||
tls_reg_write32(HR_GPIO_AF_S1 + offset, tls_reg_read32(HR_GPIO_AF_S1 + offset) & (~BIT(pin)));
|
||||
tls_reg_write32(HR_GPIO_AF_S0 + offset, tls_reg_read32(HR_GPIO_AF_S0 + offset) & (~BIT(pin)));
|
||||
tls_reg_write32(HR_GPIO_PULLUP_EN + offset, tls_reg_read32(HR_GPIO_PULLUP_EN + offset) | (BIT(pin))); /*disable pullup*/
|
||||
tls_reg_write32(HR_GPIO_PULLDOWN_EN + offset, tls_reg_read32(HR_GPIO_PULLDOWN_EN + offset) & (~BIT(pin))); /*disable pulldown*/
|
||||
}
|
||||
|
||||
static void io_cfg_option2(enum tls_io_name name)
|
||||
@ -54,6 +56,8 @@ static void io_cfg_option2(enum tls_io_name name)
|
||||
tls_reg_write32(HR_GPIO_AF_SEL + offset, tls_reg_read32(HR_GPIO_AF_SEL + offset) | BIT(pin)); /* gpio function */
|
||||
tls_reg_write32(HR_GPIO_AF_S1 + offset, tls_reg_read32(HR_GPIO_AF_S1 + offset) & (~BIT(pin)));
|
||||
tls_reg_write32(HR_GPIO_AF_S0 + offset, tls_reg_read32(HR_GPIO_AF_S0 + offset) | BIT(pin));
|
||||
tls_reg_write32(HR_GPIO_PULLUP_EN + offset, tls_reg_read32(HR_GPIO_PULLUP_EN + offset) | (BIT(pin))); /*disable pullup*/
|
||||
tls_reg_write32(HR_GPIO_PULLDOWN_EN + offset, tls_reg_read32(HR_GPIO_PULLDOWN_EN + offset) & (~BIT(pin))); /*disable pulldown*/
|
||||
}
|
||||
|
||||
static void io_cfg_option3(enum tls_io_name name)
|
||||
@ -75,6 +79,8 @@ static void io_cfg_option3(enum tls_io_name name)
|
||||
tls_reg_write32(HR_GPIO_AF_SEL + offset, tls_reg_read32(HR_GPIO_AF_SEL + offset) | BIT(pin)); /* gpio function */
|
||||
tls_reg_write32(HR_GPIO_AF_S1 + offset, tls_reg_read32(HR_GPIO_AF_S1 + offset) | BIT(pin));
|
||||
tls_reg_write32(HR_GPIO_AF_S0 + offset, tls_reg_read32(HR_GPIO_AF_S0 + offset) & (~BIT(pin)));
|
||||
tls_reg_write32(HR_GPIO_PULLUP_EN + offset, tls_reg_read32(HR_GPIO_PULLUP_EN + offset) | (BIT(pin))); /*disable pullup*/
|
||||
tls_reg_write32(HR_GPIO_PULLDOWN_EN + offset, tls_reg_read32(HR_GPIO_PULLDOWN_EN + offset) & (~BIT(pin))); /*disable pulldown*/
|
||||
}
|
||||
|
||||
static void io_cfg_option4(enum tls_io_name name)
|
||||
@ -96,6 +102,8 @@ static void io_cfg_option4(enum tls_io_name name)
|
||||
tls_reg_write32(HR_GPIO_AF_SEL + offset, tls_reg_read32(HR_GPIO_AF_SEL + offset) | BIT(pin)); /* gpio function */
|
||||
tls_reg_write32(HR_GPIO_AF_S1 + offset, tls_reg_read32(HR_GPIO_AF_S1 + offset) | BIT(pin));
|
||||
tls_reg_write32(HR_GPIO_AF_S0 + offset, tls_reg_read32(HR_GPIO_AF_S0 + offset) | BIT(pin));
|
||||
tls_reg_write32(HR_GPIO_PULLUP_EN + offset, tls_reg_read32(HR_GPIO_PULLUP_EN + offset) | (BIT(pin))); /*disable pullup*/
|
||||
tls_reg_write32(HR_GPIO_PULLDOWN_EN + offset, tls_reg_read32(HR_GPIO_PULLDOWN_EN + offset) & (~BIT(pin))); /*disable pulldown*/
|
||||
}
|
||||
|
||||
static void io_cfg_option5(enum tls_io_name name)
|
||||
@ -115,6 +123,8 @@ static void io_cfg_option5(enum tls_io_name name)
|
||||
}
|
||||
|
||||
tls_reg_write32(HR_GPIO_AF_SEL + offset, tls_reg_read32(HR_GPIO_AF_SEL + offset) & (~BIT(pin))); /* disable gpio function */
|
||||
tls_reg_write32(HR_GPIO_PULLUP_EN + offset, tls_reg_read32(HR_GPIO_PULLUP_EN + offset) | (BIT(pin))); /*disable pullup*/
|
||||
tls_reg_write32(HR_GPIO_PULLDOWN_EN + offset, tls_reg_read32(HR_GPIO_PULLDOWN_EN + offset) & (~BIT(pin))); /*disable pulldown*/
|
||||
}
|
||||
|
||||
static u32 io_pa_option67 = 0;
|
||||
@ -139,8 +149,8 @@ static void io_cfg_option6(enum tls_io_name name)
|
||||
|
||||
tls_reg_write32(HR_GPIO_AF_SEL + offset, tls_reg_read32(HR_GPIO_AF_SEL + offset) & (~BIT(pin))); /* disable gpio function */
|
||||
tls_reg_write32(HR_GPIO_DIR + offset, tls_reg_read32(HR_GPIO_DIR + offset) & (~BIT(pin)));
|
||||
tls_reg_write32(HR_GPIO_PULLUP_EN + offset, tls_reg_read32(HR_GPIO_PULLUP_EN + offset) | (BIT(pin)));
|
||||
tls_reg_write32(HR_GPIO_PULLDOWN_EN + offset, tls_reg_read32(HR_GPIO_PULLDOWN_EN + offset) & (~BIT(pin)));
|
||||
tls_reg_write32(HR_GPIO_PULLUP_EN + offset, tls_reg_read32(HR_GPIO_PULLUP_EN + offset) | (BIT(pin))); /*disable pullup*/
|
||||
tls_reg_write32(HR_GPIO_PULLDOWN_EN + offset, tls_reg_read32(HR_GPIO_PULLDOWN_EN + offset) & (~BIT(pin))); /*disable pulldown*/
|
||||
}
|
||||
|
||||
static void io_cfg_option7(enum tls_io_name name)
|
||||
|
@ -88,10 +88,11 @@ int wm_sdh_config(void)
|
||||
|
||||
tls_sys_clk_get(&sysclk);
|
||||
SDIO_HOST->MMC_CARDSEL = 0xC0 | (sysclk.cpuclk / 2 - 1);//0xd3; //enable module, enable mmcclk
|
||||
SDIO_HOST->MMC_CTL = 0xD3;//0xC3; //4bits, low speed, 1/4 divider, auto transfer, mmc mode.
|
||||
SDIO_HOST->MMC_CTL = 0x13;//0xC3; //4bits, low speed, 1/4 divider, auto transfer, mmc mode.
|
||||
SDIO_HOST->MMC_INT_MASK = 0x100; //unmask sdio data interrupt.
|
||||
SDIO_HOST->MMC_CRCCTL = 0xC0; //
|
||||
SDIO_HOST->MMC_TIMEOUTCNT = 0xff;
|
||||
SDIO_HOST->MMC_IO_MBCTL |= 0xf0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -113,10 +114,14 @@ int wm_sd_card_initialize(uint32_t *rca)
|
||||
// CMD 3 Get RCA.
|
||||
//======================================================
|
||||
begin:
|
||||
wm_sdh_send_cmd(0, 0, 0x04); //Send CMD0
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
//Send CMD0 + 8 null clock to reset and stablize
|
||||
for (int i = 0; i < 7 - recnt; i++)
|
||||
{
|
||||
wm_sdh_send_cmd(0, 0, 0x84);
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
}
|
||||
delay_cnt(1000);
|
||||
wm_sdh_send_cmd(8, 0x1AA, 0x44); //Send CMD8
|
||||
wm_sdh_send_cmd(8, 0x1AA, 0xC4); //Send CMD8
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD8 respCmd", (char *)respCmd, 5);
|
||||
@ -129,14 +134,14 @@ begin:
|
||||
}
|
||||
while(1)
|
||||
{
|
||||
wm_sdh_send_cmd(55, 0, 0x44); //Send CMD55
|
||||
wm_sdh_send_cmd(55, 0, 0xC4); //Send CMD55
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD55 respCmd", (char *)respCmd, 5);
|
||||
if((respCmd[1] & 0xFF) != 55)
|
||||
goto end;
|
||||
|
||||
wm_sdh_send_cmd(41, 0xC0100000, 0x44); //Send ACMD41
|
||||
wm_sdh_send_cmd(41, 0xC0100000, 0xC4); //Send ACMD41
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
sm_sdh_wait_interrupt(3, 1000); //由于sd规范中,Acmd41返回的crc永远是11111,也就是应该忽略crc;这里的crc错误应该忽略。
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
@ -150,14 +155,14 @@ begin:
|
||||
}
|
||||
}
|
||||
|
||||
wm_sdh_send_cmd(2, 0, 0x54); //Send CMD2
|
||||
wm_sdh_send_cmd(2, 0, 0xD4); //Send CMD2
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
sm_sdh_wait_interrupt(3, 1000);
|
||||
wm_sdh_get_response(respCmd, 4);
|
||||
sh_dumpBuffer("CMD2 respCmd", (char *)respCmd, 16);
|
||||
if((respCmd[3] >> 24 & 0xFF) != 0x3F) //sd规范定义固定为0x3F,所以导致crc错误
|
||||
goto end;
|
||||
wm_sdh_send_cmd(3, 0, 0x44); //Send CMD3
|
||||
wm_sdh_send_cmd(3, 0, 0xC4); //Send CMD3
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD3 respCmd", (char *)respCmd, 5);
|
||||
@ -179,6 +184,7 @@ static uint32_t SD_GetCapacity(uint8_t *csd, SD_CardInfo_t *SDCardInfo)
|
||||
|
||||
if((csd[0]&0xC0)==0x40)//判断bit126是否为1
|
||||
{
|
||||
SDCardInfo->CSDVer = 2;
|
||||
csize = csd[9] + ((uint32_t)csd[8] << 8) + ((uint32_t)(csd[7] & 63) << 16) + 1;
|
||||
Capacity = csize << 9;
|
||||
SDCardInfo->CardCapacity = (long long)Capacity*1024;
|
||||
@ -186,6 +192,7 @@ static uint32_t SD_GetCapacity(uint8_t *csd, SD_CardInfo_t *SDCardInfo)
|
||||
}
|
||||
else
|
||||
{
|
||||
SDCardInfo->CSDVer = 1;
|
||||
n = (csd[5] & 0x0F) + ((csd[10] & 0x80) >> 7) + ((csd[9] & 0x03) << 1) + 2;
|
||||
csize = (csd[8] >> 6) + ((uint16_t)csd[7] << 2) + ((uint16_t)(csd[6] & 0x03) << 10) + 1;
|
||||
Capacity = (uint32_t)csize << (n - 10);
|
||||
@ -219,7 +226,7 @@ int wm_sd_card_set_blocklen(uint32_t blocklen)
|
||||
{
|
||||
int ret = -1;
|
||||
uint32_t respCmd[2];
|
||||
wm_sdh_send_cmd(16, blocklen, 0x44); //Send CMD16
|
||||
wm_sdh_send_cmd(16, blocklen, 0xC4); //Send CMD16
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD16 respCmd", (char *)respCmd, 5);
|
||||
@ -234,7 +241,7 @@ int wm_sd_card_select(uint32_t rca)
|
||||
{
|
||||
int ret = -1;
|
||||
uint32_t respCmd[2];
|
||||
wm_sdh_send_cmd(7, rca<<16, 0x44); //Send CMD7
|
||||
wm_sdh_send_cmd(7, rca<<16, 0xC4); //Send CMD7
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD7 respCmd", (char *)respCmd, 5);
|
||||
@ -247,7 +254,7 @@ end:
|
||||
|
||||
void wm_sd_card_deselect()
|
||||
{
|
||||
wm_sdh_send_cmd(7, 0, 0x04); //Send CMD7
|
||||
wm_sdh_send_cmd(7, 0, 0x84); //Send CMD7
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
}
|
||||
|
||||
@ -259,7 +266,7 @@ int wm_sd_card_query_status(uint32_t rca, uint32_t *respCmd0)
|
||||
uint8_t error_state = 0;
|
||||
#endif
|
||||
uint32_t respCmd[2];
|
||||
wm_sdh_send_cmd(13, rca<<16, 0x44); //Send CMD13
|
||||
wm_sdh_send_cmd(13, rca<<16, 0xC4); //Send CMD13
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD13 respCmd", (char *)respCmd, 5);
|
||||
@ -288,7 +295,7 @@ int wm_sd_card_switch_func(uint8_t speed_mode)
|
||||
int i;
|
||||
uint32_t respCmd[2];
|
||||
|
||||
wm_sdh_send_cmd(6, 0x00fffff1, 0x44); //Send CMD6
|
||||
wm_sdh_send_cmd(6, 0x00fffff1, 0xC4); //Send CMD6
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD6 respCmd", (char *)respCmd, 5);
|
||||
@ -296,7 +303,7 @@ int wm_sd_card_switch_func(uint8_t speed_mode)
|
||||
goto end;
|
||||
SDIO_HOST->BUF_CTL = 0x4020; //disable dma, read sd card
|
||||
SDIO_HOST->MMC_INT_SRC |= 0x7ff; // clear all firstly
|
||||
SDIO_HOST->MMC_IO = 0x3; //!!!read data, auto transfer
|
||||
SDIO_HOST->MMC_IO = 0x83; //!!!read data, auto transfer
|
||||
sm_sdh_wait_interrupt(1, -1);
|
||||
TEST_DEBUG("read complete\n");
|
||||
for(i = 0; i < 128; i++)
|
||||
@ -315,7 +322,7 @@ int wm_sd_card_switch_func(uint8_t speed_mode)
|
||||
TEST_DEBUG("the value of byte 17~20 is 0x%x\n", respCmd[1]);
|
||||
if(respCmd[1] & 0xF) //support high speed
|
||||
{
|
||||
wm_sdh_send_cmd(6, 0x80fffff0 | speed_mode, 0x44); //Send CMD6
|
||||
wm_sdh_send_cmd(6, 0x80fffff0 | speed_mode, 0xC4); //Send CMD6
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD6 respCmd", (char *)respCmd, 5);
|
||||
@ -323,7 +330,7 @@ int wm_sd_card_switch_func(uint8_t speed_mode)
|
||||
goto end;
|
||||
SDIO_HOST->BUF_CTL = 0x4020; //disable dma, read sd card
|
||||
SDIO_HOST->MMC_INT_SRC |= 0x7ff; // clear all firstly
|
||||
SDIO_HOST->MMC_IO = 0x3; //!!!read data, auto transfer
|
||||
SDIO_HOST->MMC_IO = 0x83; //!!!read data, auto transfer
|
||||
sm_sdh_wait_interrupt(1, -1);
|
||||
TEST_DEBUG("read complete\n");
|
||||
for(i = 0; i < 128; i++)
|
||||
@ -378,13 +385,13 @@ int wm_sd_card_set_bus_width(uint32_t rca, uint8_t bus_width)
|
||||
{
|
||||
SDIO_HOST->MMC_CTL &= ~(1 << 7);
|
||||
}
|
||||
wm_sdh_send_cmd(55, rca<<16, 0x44); //Send CMD55
|
||||
wm_sdh_send_cmd(55, rca<<16, 0xC4); //Send CMD55
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("CMD55 respCmd", (char *)respCmd, 5);
|
||||
if((respCmd[1] & 0xFF) != 55)
|
||||
goto end;
|
||||
wm_sdh_send_cmd(6, bus_width, 0x44); //Send ACMD6
|
||||
wm_sdh_send_cmd(6, bus_width, 0xC4); //Send ACMD6
|
||||
sm_sdh_wait_interrupt(0, -1);
|
||||
wm_sdh_get_response(respCmd, 2);
|
||||
sh_dumpBuffer("ACMD6 respCmd", (char *)respCmd, 5);
|
||||
@ -399,7 +406,7 @@ int wm_sd_card_stop_trans(void)
|
||||
{
|
||||
int ret = -1;
|
||||
uint32_t respCmd[2];
|
||||
wm_sdh_send_cmd(12, 0, 0x44); //Send CMD12
|
||||
wm_sdh_send_cmd(12, 0, 0xC4); //Send CMD12
|
||||
ret = sm_sdh_wait_interrupt(0, -1);
|
||||
if(ret)
|
||||
goto end;
|
||||
@ -415,7 +422,7 @@ end:
|
||||
static void sdio_host_reset(void)
|
||||
{
|
||||
tls_bitband_write(HR_CLK_RST_CTL, 27, 0);
|
||||
|
||||
delay_cnt(1000);
|
||||
tls_bitband_write(HR_CLK_RST_CTL, 27, 1);
|
||||
while(tls_bitband_read(HR_CLK_RST_CTL, 27) == 0);
|
||||
}
|
||||
@ -431,6 +438,7 @@ int sdh_card_init(uint32_t *rca_ref)
|
||||
ret = wm_sd_card_initialize(&rca);
|
||||
if(ret)
|
||||
goto end;
|
||||
SDCardInfo.RCA = (u16)(rca & 0xFFFF);
|
||||
ret = wm_sd_card_query_csd(rca);
|
||||
if(ret)
|
||||
goto end;
|
||||
@ -444,6 +452,8 @@ int sdh_card_init(uint32_t *rca_ref)
|
||||
if(ret)
|
||||
goto end;
|
||||
*rca_ref = rca;
|
||||
|
||||
SDIO_HOST->MMC_CTL = 0xD3;
|
||||
ret = 0;
|
||||
end:
|
||||
TEST_DEBUG("ret %d\n", ret);
|
||||
|
@ -606,7 +606,7 @@ ATTRIBUTE_ISR void UART0_IRQHandler(void)
|
||||
port->rx_callback(1, port->priv_data);
|
||||
}
|
||||
}
|
||||
if (port->rx_callback != NULL && !rx_byte_cb_flag)
|
||||
if (rxlen && port->rx_callback != NULL && !rx_byte_cb_flag)
|
||||
{
|
||||
port->rx_callback(rxlen, port->priv_data);
|
||||
}
|
||||
@ -693,6 +693,10 @@ ATTRIBUTE_ISR void UART1_IRQHandler(void)
|
||||
ch = (u8) port->regs->UR_RXW;
|
||||
recv->buf[recv->head] = ch;
|
||||
recv->head = (recv->head + 1) & (TLS_UART_RX_BUF_SIZE - 1);
|
||||
if(port->rx_callback != NULL && rx_byte_cb_flag)
|
||||
{
|
||||
port->rx_callback(1, port->priv_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -713,10 +717,6 @@ ATTRIBUTE_ISR void UART1_IRQHandler(void)
|
||||
port->plus_char_cnt = 3;
|
||||
break;
|
||||
}
|
||||
if(rxlen && port->rx_callback != NULL && rx_byte_cb_flag)
|
||||
{
|
||||
port->rx_callback(1, port->priv_data);
|
||||
}
|
||||
}
|
||||
if (rxlen && port->rx_callback!=NULL && !rx_byte_cb_flag)
|
||||
{
|
||||
@ -798,6 +798,10 @@ ATTRIBUTE_ISR void UART2_4_IRQHandler(void)
|
||||
}
|
||||
recv->buf[recv->head] = ch;
|
||||
recv->head = (recv->head + 1) & (TLS_UART_RX_BUF_SIZE - 1);
|
||||
if(port->rx_callback != NULL && rx_byte_cb_flag)
|
||||
{
|
||||
port->rx_callback(1, port->priv_data);
|
||||
}
|
||||
}
|
||||
|
||||
if( escapefifocnt==3 && ch=='+')
|
||||
@ -817,12 +821,8 @@ ATTRIBUTE_ISR void UART2_4_IRQHandler(void)
|
||||
port->plus_char_cnt = 3;
|
||||
break;
|
||||
}
|
||||
if(port->rx_callback != NULL && rx_byte_cb_flag)
|
||||
{
|
||||
port->rx_callback(1, port->priv_data);
|
||||
}
|
||||
}
|
||||
if (port->rx_callback!=NULL && !rx_byte_cb_flag)
|
||||
if (rxlen && port->rx_callback!=NULL && !rx_byte_cb_flag)
|
||||
{
|
||||
port->rx_callback(rxlen, port->priv_data);
|
||||
}
|
||||
|
@ -419,6 +419,7 @@ int tls_wl_if_sta_add(struct tls_wif *wif,
|
||||
int tls_wl_if_sta_remove(struct tls_wif *wif, u8 *addr);
|
||||
int tls_wl_if_get_inact_sec(struct tls_wif *wif, const u8 *addr);
|
||||
int tls_wl_if_get_scan_res(struct tls_wif *wif, u8 *buf, u32 buf_size);
|
||||
int tls_wl_if_get_scan_res_format2(struct tls_wif *wif, u8 *buf, u32 buf_size);
|
||||
int tls_wl_if_disconnect(struct tls_wif *wif);
|
||||
int tls_wl_if_tx(struct tls_wif *wif,
|
||||
u8 *buf, u32 buflen, bool last_packet, bool is_apsta, bool not_delay);
|
||||
|
@ -35,6 +35,8 @@ char * strdup(const char *s);
|
||||
char * strndup(const char *s, size_t len);
|
||||
|
||||
int sendchar(int ch);
|
||||
void dumpBuffer(char *name, char* buffer, int len);
|
||||
void dumpUint32(char *name, u32* buffer, int len);
|
||||
int sendchar_debug_uart(int ch);
|
||||
|
||||
#endif /* UTILS_H */
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "wm_watchdog.h"
|
||||
#include "wm_wifi.h"
|
||||
#if TLS_CONFIG_ONLY_FACTORY_ATCMD
|
||||
#include "factory_atcmd.h"
|
||||
#include "../../src/app/factorycmd/factory_atcmd.h"
|
||||
#endif
|
||||
|
||||
/* c librayr mutex */
|
||||
@ -101,7 +101,7 @@ tls_os_task_t tstusermainhdl = NULL;
|
||||
|
||||
#define FW_MAJOR_VER 0x1
|
||||
#define FW_MINOR_VER 0x0
|
||||
#define FW_PATCH_VER 0x8
|
||||
#define FW_PATCH_VER 0x10
|
||||
|
||||
const char FirmWareVer[4] =
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ static int bt_aes_decrypt(uint8_t *key, uint8_t *src_ptr, int length, uint8_t *d
|
||||
psCipherContext_t ctx;
|
||||
uint8_t *buf = NULL;
|
||||
TLS_DBGPRT_INFO("original data:");
|
||||
TLS_DBGPRT_DUMP(src_ptr, length);
|
||||
TLS_DBGPRT_DUMP((char *)src_ptr, length);
|
||||
|
||||
if(key == NULL || src_ptr == NULL || length % 16 != 0) {
|
||||
goto out;
|
||||
@ -182,7 +182,7 @@ static int bt_aes_decrypt(uint8_t *key, uint8_t *src_ptr, int length, uint8_t *d
|
||||
|
||||
MEMCPY(buf, src_ptr, length);
|
||||
TLS_DBGPRT_INFO("aes key:");
|
||||
TLS_DBGPRT_DUMP(key, 16);
|
||||
TLS_DBGPRT_DUMP((char *)key, 16);
|
||||
|
||||
if(tls_crypto_aes_init(&ctx, key, key, 16, CRYPTO_MODE_ECB) != 0) {
|
||||
goto out;
|
||||
@ -194,7 +194,7 @@ static int bt_aes_decrypt(uint8_t *key, uint8_t *src_ptr, int length, uint8_t *d
|
||||
|
||||
MEMCPY(dest_ptr, buf, length);
|
||||
TLS_DBGPRT_INFO("decrypt data:");
|
||||
TLS_DBGPRT_DUMP(dest_ptr, length);
|
||||
TLS_DBGPRT_DUMP((char *)dest_ptr, length);
|
||||
ret = DePKCS7Padding(dest_ptr, length);
|
||||
out:
|
||||
|
||||
@ -244,7 +244,7 @@ static int bt_aes_encrypt(uint8_t *key, uint8_t *src_ptr, int length, uint8_t *d
|
||||
psCipherContext_t ctx;
|
||||
unsigned char *aes_encode_temp = NULL;
|
||||
TLS_DBGPRT_INFO("original data:");
|
||||
TLS_DBGPRT_DUMP(src_ptr, length);
|
||||
TLS_DBGPRT_DUMP((char *)src_ptr, length);
|
||||
aes_encode_temp = tls_mem_alloc(length + 16);
|
||||
|
||||
if(aes_encode_temp == NULL) {
|
||||
@ -264,7 +264,7 @@ static int bt_aes_encrypt(uint8_t *key, uint8_t *src_ptr, int length, uint8_t *d
|
||||
}
|
||||
|
||||
//TLS_DBGPRT_INFO("encrypt data:");
|
||||
TLS_DBGPRT_DUMP(dest_ptr, len);
|
||||
TLS_DBGPRT_DUMP((char *)dest_ptr, len);
|
||||
ret = len;
|
||||
out:
|
||||
|
||||
|
@ -327,7 +327,7 @@ static int ble_uart_init(int8_t uart_idx, int bandrate, int parity, int stopbits
|
||||
wm_uart_task,
|
||||
(void *) wm_uart,
|
||||
(void *) wm_uart_task_stk, /** 任务栈的起始地址 */
|
||||
WM_UART_TAST_STK_SIZE, /** 任务栈的大小 */
|
||||
WM_UART_TAST_STK_SIZE*4, /** 任务栈的大小 */
|
||||
WM_UART_TASK_PRIO, 0);
|
||||
assert(status == 0);
|
||||
status = tls_os_queue_create(&(wm_uart->wm_queue_msg_available), 6);
|
||||
@ -336,7 +336,7 @@ static int ble_uart_init(int8_t uart_idx, int bandrate, int parity, int stopbits
|
||||
wm_dispatch_task,
|
||||
(void *) wm_uart,
|
||||
(void *) wm_disp_task_stk, /** 任务栈的起始地址 */
|
||||
WM_DISP_TAST_STK_SIZE, /** 任务栈的大小 */
|
||||
WM_DISP_TAST_STK_SIZE*4, /** 任务栈的大小 */
|
||||
WM_UART_TASK_PRIO+1, 0);
|
||||
assert(status == 0);
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "tls_common.h"
|
||||
#include "wm_mem.h"
|
||||
#include "wm_debug.h"
|
||||
#include "lwip/stats.h"
|
||||
@ -25,6 +24,8 @@
|
||||
#include "lwip/prot/dhcp.h"
|
||||
#include "netif/ethernetif.h"
|
||||
#include "dhcp_server.h"
|
||||
#include "tls_common.h"
|
||||
#include "wm_wifi.h"
|
||||
|
||||
#if TLS_CONFIG_AP
|
||||
|
||||
@ -36,7 +37,7 @@
|
||||
extern u8 *wpa_supplicant_get_mac(void);
|
||||
|
||||
|
||||
/* 是否根据客户端dhcp报文中的broadcast标志来回应,不使用则统一使用广播回复 */
|
||||
/* 是否根据客户端dhcp报文中的broadcast标志来回应,不使用则统一使用广播回复 */
|
||||
#define DHCPS_CHECK_BROADCAST_FLAG
|
||||
#ifdef DHCPS_CHECK_BROADCAST_FLAG
|
||||
#define IS_BROADCAST_SEND(x) (((x) >> 15) == 1 ? TRUE : FALSE)
|
||||
@ -158,7 +159,7 @@ static bool _CheckMacIsValid(u8 *mac)
|
||||
|
||||
sta_buf = tls_mem_alloc(STA_MAC_BUF_LEN);
|
||||
if (!sta_buf)
|
||||
return FALSE;/* 系统资源不足,无需再让client接入 */
|
||||
return FALSE;/* 系统资源不足,无需再让client接入 */
|
||||
|
||||
memset(sta_buf, 0, STA_MAC_BUF_LEN);
|
||||
tls_wifi_get_authed_sta_info(&sta_num, sta_buf, STA_MAC_BUF_LEN);
|
||||
@ -167,7 +168,7 @@ static bool _CheckMacIsValid(u8 *mac)
|
||||
{
|
||||
if (!compare_ether_addr(mac, sta->mac_addr))
|
||||
{
|
||||
ret = TRUE;/* 本SOFTAP下的client才予以分配IP */
|
||||
ret = TRUE;/* 本SOFTAP下的client才予以分配IP */
|
||||
break;
|
||||
}
|
||||
sta++;
|
||||
@ -1134,7 +1135,8 @@ INT8S DHCPS_Start(struct netif *Netif)
|
||||
udp_bind(DhcpServer->Socket, IP_ADDR_ANY, DHCP_SERVER_UDP_PORT);
|
||||
|
||||
/* bind multicast&broadcast netif */
|
||||
udp_bind_multicast_netif(DhcpServer->Socket, &Netif->ip_addr);
|
||||
//udp_bind_multicast_netif(DhcpServer->Socket, &Netif->ip_addr);
|
||||
udp_set_multicast_netif_addr(DhcpServer->Socket, &Netif->ip_addr);
|
||||
|
||||
/* Set up the recv callback and argument. */
|
||||
udp_recv(DhcpServer->Socket, (udp_recv_fn)DHCPS_RecvCb, Netif);
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "wm_internal_flash.h"
|
||||
#include "litepoint.h"
|
||||
#include "wm_ram_config.h"
|
||||
#include "wm_adc.h"
|
||||
#include "wm_gpio_afsel.h"
|
||||
|
||||
#define FACTORY_ATCMD_MAX_ARG 10
|
||||
#define FACTORY_ATCMD_NAME_MAX_LEN 10
|
||||
@ -523,7 +525,7 @@ static int factory_atcmd_txgi_proc( struct factory_atcmd_token_t *tok, char *res
|
||||
}
|
||||
}
|
||||
else{
|
||||
/*如实反映flash参数区的实际存储情况*/
|
||||
/*如实反映flash参数区的实际存储情况*/
|
||||
ret = tls_get_tx_gain(tx_gain);
|
||||
if (ret == 0)
|
||||
{
|
||||
@ -842,6 +844,102 @@ static int factory_atcmd_qver_proc( struct factory_atcmd_token_t *tok, char *res
|
||||
__DATE__, __TIME__);
|
||||
return 0;
|
||||
}
|
||||
static int factory_atcmd_test_mode_proc( struct factory_atcmd_token_t *tok, char *res_resp, u32 *res_len)
|
||||
{
|
||||
wm_adc_config(0);
|
||||
wm_adc_config(1);
|
||||
wm_adc_config(2);
|
||||
wm_adc_config(3);
|
||||
*res_len = factory_atcmd_ok_resp(res_resp);
|
||||
return 0;
|
||||
}
|
||||
static int factory_atcmd_adc_cal_proc( struct factory_atcmd_token_t *tok, char *res_resp, u32 *res_len)
|
||||
{
|
||||
int ret = 0;
|
||||
int val = 0;
|
||||
int i = 0;
|
||||
int refvoltage[4] = {0};
|
||||
FT_ADC_CAL_ST adc_cal;
|
||||
|
||||
if (tok->arg_found)
|
||||
{
|
||||
if (tok->arg_found < 5)
|
||||
{
|
||||
*res_len = factory_atcmd_err_resp(res_resp, FACTORY_ATCMD_ERR_INV_PARAMS);
|
||||
return 0;
|
||||
}
|
||||
ret = strtodec(&val, tok->arg[0]);
|
||||
if (ret < 0 || val > 15 || val < 1)
|
||||
{
|
||||
*res_len = factory_atcmd_err_resp(res_resp, FACTORY_ATCMD_ERR_INV_PARAMS);
|
||||
return 0;
|
||||
}
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
ret = strtodec(&refvoltage[i], tok->arg[i + 1]);
|
||||
if (ret < 0 )
|
||||
{
|
||||
*res_len = factory_atcmd_err_resp(res_resp, FACTORY_ATCMD_ERR_INV_PARAMS);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ret = adc_multipoint_calibration(val, refvoltage);
|
||||
if (ret == 0)
|
||||
{
|
||||
*res_len = factory_atcmd_ok_resp(res_resp);
|
||||
}
|
||||
else
|
||||
{
|
||||
*res_len = factory_atcmd_err_resp(res_resp, FACTORY_ATCMD_ERR_FLASH);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = tls_get_adc_cal_param(&adc_cal);
|
||||
//dumpBuffer("&adc_cal", &adc_cal, sizeof(adc_cal));
|
||||
if (ret == 0)
|
||||
{
|
||||
*res_len = sprintf(res_resp, "+OK=%lf,%lf\r\n", adc_cal.a, adc_cal.b);
|
||||
}
|
||||
else
|
||||
{
|
||||
*res_len = factory_atcmd_err_resp(res_resp,FACTORY_ATCMD_ERR_FLASH);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int factory_atcmd_adc_vol_proc( struct factory_atcmd_token_t *tok, char *res_resp, u32 *res_len)
|
||||
{
|
||||
int ret = 0;
|
||||
int val = 0xF;
|
||||
int i = 0;
|
||||
int voltage[4] = {0};
|
||||
|
||||
if (tok->arg_found)
|
||||
{
|
||||
ret = strtodec(&val, tok->arg[0]);
|
||||
if (ret < 0 || val > 15 || val < 1)
|
||||
{
|
||||
*res_len = factory_atcmd_err_resp(res_resp, FACTORY_ATCMD_ERR_INV_PARAMS);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
if (val & (1 << i))
|
||||
{
|
||||
wm_adc_config(i);
|
||||
voltage[i] = adc_get_inputVolt(i, 1, 1);
|
||||
}
|
||||
}
|
||||
*res_len = sprintf(res_resp, "+OK=%d,%d,%d,%d\r\n", voltage[0], voltage[1], voltage[2], voltage[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct factory_atcmd_t factory_atcmd_tbl[] =
|
||||
@ -869,6 +967,9 @@ static struct factory_atcmd_t factory_atcmd_tbl[] =
|
||||
{ "&LPRSTT", factory_atcmd_lprstt_proc},
|
||||
{ "&CALFIN", factory_atcmd_calfinish_proc},
|
||||
{ "FREQ", factory_atcmd_freq_err_proc},
|
||||
{ "&TESTM", factory_atcmd_test_mode_proc},
|
||||
{ "&ADCCAL", factory_atcmd_adc_cal_proc},
|
||||
{ "&ADCVOL", factory_atcmd_adc_vol_proc},
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
|
@ -1859,7 +1859,10 @@ static UINT32 HTTPIntrnConnectionOpen (P_HTTP_SESSION pHTTPSession)
|
||||
(HTTP_SOCKADDR*)&ServerAddress, // Server address
|
||||
sizeof(HTTP_SOCKADDR)); // Length of server address structure
|
||||
// The socket was set to be asyn so we should check the error being returned from connect()
|
||||
nRetCode = SocketGetErr(pHTTPSession->HttpConnection.HttpSocket);
|
||||
if(nRetCode)
|
||||
{
|
||||
nRetCode = SocketGetErr(pHTTPSession->HttpConnection.HttpSocket);
|
||||
}
|
||||
}
|
||||
|
||||
if(nRetCode == 0 || nRetCode == HTTP_EWOULDBLOCK || nRetCode == HTTP_EINPROGRESS)
|
||||
@ -1876,6 +1879,7 @@ static UINT32 HTTPIntrnConnectionOpen (P_HTTP_SESSION pHTTPSession)
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("%s: nRetCode %d\n", __func__, nRetCode);
|
||||
// Socket connection problem
|
||||
nRetCode = HTTP_CLIENT_ERROR_SOCKET_CONNECT;
|
||||
break;
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
#include "lwip/arch.h"
|
||||
#include "HTTPClientWrapper.h"
|
||||
#include "random.h"
|
||||
#include "wm_osal.h"
|
||||
@ -908,6 +907,7 @@ int HTTPWrapperSSLConnect(tls_ssl_t **ssl_p,int fd,const struct sockaddr *name,i
|
||||
/* OPTIONAL is not optimal for security,
|
||||
* but makes interop easier in this simplified example */
|
||||
mbedtls_ssl_conf_authmode( &ssl->conf, MBEDTLS_SSL_VERIFY_NONE );
|
||||
//mbedtls_ssl_conf_authmode( &ssl->conf, MBEDTLS_SSL_VERIFY_REQUIRED);
|
||||
#if MBEDTLS_DEMO_USE_CERT
|
||||
mbedtls_ssl_conf_ca_chain( &ssl->conf, &ssl->cacert, NULL );
|
||||
#endif
|
||||
@ -917,6 +917,8 @@ int HTTPWrapperSSLConnect(tls_ssl_t **ssl_p,int fd,const struct sockaddr *name,i
|
||||
mbedtls_ssl_conf_dbg( &ssl->conf, ssl_client_debug, stdout );
|
||||
#endif
|
||||
|
||||
mbedtls_ssl_conf_read_timeout( &ssl->conf, 5000 );
|
||||
|
||||
if( ( ret = mbedtls_ssl_setup( &ssl->ssl, &ssl->conf ) ) != 0 )
|
||||
{
|
||||
mbedtls_printf( " failed\n ! mbedtls_ssl_setup returned %d\n\n", ret );
|
||||
@ -929,7 +931,8 @@ int HTTPWrapperSSLConnect(tls_ssl_t **ssl_p,int fd,const struct sockaddr *name,i
|
||||
goto exit;
|
||||
}
|
||||
|
||||
mbedtls_ssl_set_bio( &ssl->ssl, &ssl->server_fd, mbedtls_net_send, mbedtls_net_recv, NULL );
|
||||
//mbedtls_ssl_set_bio( &ssl->ssl, &ssl->server_fd, mbedtls_net_send, mbedtls_net_recv, NULL );
|
||||
mbedtls_ssl_set_bio( &ssl->ssl, &ssl->server_fd, mbedtls_net_send, mbedtls_net_recv, mbedtls_net_recv_timeout);
|
||||
|
||||
/*
|
||||
* 4. Handshake
|
||||
|
@ -3,6 +3,7 @@
|
||||
#define HTTP_CLIENT_WRAPPER
|
||||
|
||||
#include "wm_config.h"
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/arch.h"
|
||||
|
||||
#if TLS_CONFIG_HTTP_CLIENT_SECURE
|
||||
|
@ -2210,17 +2210,15 @@ iperf_init_stream(struct iperf_stream *sp, struct iperf_test *test)
|
||||
}
|
||||
/* Set IP TOS */
|
||||
if ((opt = test->settings->tos)!=0) {
|
||||
if (test->settings->domain == AF_INET6) {
|
||||
#ifdef IPV6_TCLASS
|
||||
if (test->settings->domain == AF_INET6) {
|
||||
if (setsockopt(sp->socket, IPPROTO_IPV6, IPV6_TCLASS, &opt, sizeof(opt)) < 0) {
|
||||
i_errno = IESETCOS;
|
||||
return (-1);
|
||||
}
|
||||
#else
|
||||
i_errno = IESETCOS;
|
||||
return (-1);
|
||||
} else
|
||||
#endif
|
||||
} else {
|
||||
{
|
||||
if (setsockopt(sp->socket, IPPROTO_IP, IP_TOS, &opt, sizeof(opt)) < 0) {
|
||||
i_errno = IESETTOS;
|
||||
return (-1);
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <wm_sockets.h>
|
||||
#include "random.h"
|
||||
|
||||
static int poll ( struct lws_pollfd * fds, unsigned int nfds, int timeout)
|
||||
static int _poll ( struct lws_pollfd * fds, unsigned int nfds, int timeout)
|
||||
{
|
||||
int ret, i, max_fd=0;
|
||||
fd_set readset, writeset;
|
||||
@ -70,7 +70,7 @@ LWS_VISIBLE int lws_send_pipe_choked(struct lws *wsi)
|
||||
fds.events = POLLOUT;
|
||||
fds.revents = 0;
|
||||
|
||||
if (poll(&fds, 1, 0) != 1)
|
||||
if (_poll(&fds, 1, 0) != 1)
|
||||
return 1;
|
||||
|
||||
if ((fds.revents & POLLOUT) == 0)
|
||||
@ -84,7 +84,7 @@ LWS_VISIBLE int lws_send_pipe_choked(struct lws *wsi)
|
||||
LWS_VISIBLE int
|
||||
lws_poll_listen_fd(struct lws_pollfd *fd)
|
||||
{
|
||||
return poll(fd, 1, 0);
|
||||
return _poll(fd, 1, 0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -129,7 +129,7 @@ lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
|
||||
timeout_ms = 0;
|
||||
}
|
||||
|
||||
n = poll(pt->fds, pt->fds_count, timeout_ms);
|
||||
n = _poll(pt->fds, pt->fds_count, timeout_ms);
|
||||
|
||||
#if 0//def LWS_OPENSSL_SUPPORT
|
||||
if (!pt->rx_draining_ext_list &&
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/arch.h"
|
||||
#include "wm_osal.h"
|
||||
//#include <ctype.h>
|
||||
|
@ -149,6 +149,7 @@
|
||||
#include "APSCommonServices.h"
|
||||
#include "lwip/sockets.h"
|
||||
#include "wm_sockets.h"
|
||||
#include "wm_netif.h"
|
||||
#include "lwip/inet.h"
|
||||
#include "lwip/igmp.h"
|
||||
#include <time.h> // platform support for UTC time
|
||||
|
@ -2733,6 +2733,10 @@
|
||||
|
||||
/* Platform options */
|
||||
//#define MBEDTLS_PLATFORM_STD_MEM_HDR <stdlib.h> /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */
|
||||
#if WM_MEM_DEBUG
|
||||
#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */
|
||||
#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */
|
||||
#else
|
||||
#ifdef tls_mem_calloc
|
||||
#define MBEDTLS_PLATFORM_STD_CALLOC tls_mem_calloc /**< Default allocator to use, can be undefined */
|
||||
#define MBEDTLS_PLATFORM_STD_FREE tls_mem_free /**< Default free to use, can be undefined */
|
||||
@ -2740,6 +2744,7 @@
|
||||
#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */
|
||||
#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */
|
||||
#endif
|
||||
#endif
|
||||
//#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */
|
||||
//#define MBEDTLS_PLATFORM_STD_TIME tls_os_get_time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
|
||||
//#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
|
||||
|
@ -292,7 +292,7 @@ int mqtt_connect(mqtt_broker_handle_t* broker)
|
||||
memcpy(packet+offset, broker->password, passwordlen);
|
||||
offset += passwordlen;
|
||||
}
|
||||
|
||||
//dumpBuffer("conn packet", packet, packetLen);
|
||||
ret = broker->mqttsend(broker->socketid, packet, packetLen);
|
||||
if(ret < packetLen) {
|
||||
tls_mem_free(fixed_header);
|
||||
@ -475,6 +475,24 @@ int mqtt_pubrel(mqtt_broker_handle_t* broker, uint16_t message_id) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int encode_length(int length, uint8_t *buf)
|
||||
{
|
||||
int ret = 0;
|
||||
do
|
||||
{
|
||||
buf[ret] = (uint8_t)(length % 0x80);
|
||||
length /= 0x80;
|
||||
if(length > 0)
|
||||
{
|
||||
buf[ret] |= 0x80;
|
||||
}
|
||||
ret++;
|
||||
}while(length > 0);
|
||||
|
||||
//dumpBuffer("encode_length", buf, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int mqtt_subscribe(mqtt_broker_handle_t* broker, const char* topic, uint16_t* message_id) {
|
||||
uint16_t topiclen = strlen(topic);
|
||||
|
||||
@ -483,7 +501,8 @@ int mqtt_subscribe(mqtt_broker_handle_t* broker, const char* topic, uint16_t* me
|
||||
uint8_t *packet=NULL;
|
||||
int utf_topicLen;
|
||||
int packetLen;
|
||||
uint8_t fixed_header[2];
|
||||
uint8_t fixed_header[6];
|
||||
int fixed_header_len;
|
||||
|
||||
/*************************************************/
|
||||
|
||||
@ -514,11 +533,13 @@ int mqtt_subscribe(mqtt_broker_handle_t* broker, const char* topic, uint16_t* me
|
||||
/********************add by alex***********************/
|
||||
// Fixed header
|
||||
fixed_header[0] = MQTT_MSG_SUBSCRIBE | MQTT_QOS1_FLAG;
|
||||
fixed_header[1] = sizeof(var_header)+utf_topicLen;
|
||||
//fixed_header[1] = sizeof(var_header)+utf_topicLen;
|
||||
fixed_header_len = encode_length(sizeof(var_header)+utf_topicLen, &fixed_header[1]);
|
||||
fixed_header_len += 1;
|
||||
/******************************************************/
|
||||
|
||||
/***********************add by alex********************/
|
||||
packetLen = sizeof(var_header)+sizeof(fixed_header)+utf_topicLen;
|
||||
packetLen = sizeof(var_header)+fixed_header_len+utf_topicLen;
|
||||
packet = (uint8_t*)tls_mem_alloc( packetLen );
|
||||
if( packet==NULL )
|
||||
{
|
||||
@ -526,9 +547,11 @@ int mqtt_subscribe(mqtt_broker_handle_t* broker, const char* topic, uint16_t* me
|
||||
return -1;
|
||||
}
|
||||
memset(packet, 0, packetLen);
|
||||
memcpy(packet, fixed_header, sizeof(fixed_header));
|
||||
memcpy(packet+sizeof(fixed_header), var_header, sizeof(var_header));
|
||||
memcpy(packet+sizeof(fixed_header)+sizeof(var_header), utf_topic, utf_topicLen);
|
||||
memcpy(packet, fixed_header, fixed_header_len);
|
||||
memcpy(packet+fixed_header_len, var_header, sizeof(var_header));
|
||||
memcpy(packet+fixed_header_len+sizeof(var_header), utf_topic, utf_topicLen);
|
||||
|
||||
//dumpBuffer("subscribe packet", packet, packetLen);
|
||||
|
||||
// Send the packet
|
||||
if(broker->mqttsend(broker->socketid, packet, packetLen) < packetLen) {
|
||||
@ -549,7 +572,8 @@ int mqtt_unsubscribe(mqtt_broker_handle_t* broker, const char* topic, uint16_t*
|
||||
/******************add by alex*******************/
|
||||
uint8_t *utf_topic=NULL;
|
||||
int utf_topicLen;
|
||||
uint8_t fixed_header[2];
|
||||
uint8_t fixed_header[6];
|
||||
int fixed_header_len;
|
||||
uint8_t *packet = NULL;
|
||||
int packetLen;
|
||||
|
||||
@ -579,9 +603,11 @@ int mqtt_unsubscribe(mqtt_broker_handle_t* broker, const char* topic, uint16_t*
|
||||
/*************************add by alex*******************************/
|
||||
// Fixed header
|
||||
fixed_header[0] = MQTT_MSG_UNSUBSCRIBE | MQTT_QOS1_FLAG;
|
||||
fixed_header[1] = sizeof(var_header)+utf_topicLen;
|
||||
//fixed_header[1] = sizeof(var_header)+utf_topicLen;
|
||||
fixed_header_len = encode_length(sizeof(var_header)+utf_topicLen, &fixed_header[1]);
|
||||
fixed_header_len += 1;
|
||||
|
||||
packetLen = sizeof(var_header)+sizeof(fixed_header)+utf_topicLen;
|
||||
packetLen = sizeof(var_header)+fixed_header_len+utf_topicLen;
|
||||
packet = (uint8_t*)tls_mem_alloc( packetLen );
|
||||
if( packet==NULL )
|
||||
{
|
||||
@ -589,9 +615,9 @@ int mqtt_unsubscribe(mqtt_broker_handle_t* broker, const char* topic, uint16_t*
|
||||
return -1;
|
||||
}
|
||||
memset(packet, 0, packetLen);
|
||||
memcpy(packet, fixed_header, sizeof(fixed_header));
|
||||
memcpy(packet+sizeof(fixed_header), var_header, sizeof(var_header));
|
||||
memcpy(packet+sizeof(fixed_header)+sizeof(var_header), utf_topic, utf_topicLen);
|
||||
memcpy(packet, fixed_header, fixed_header_len);
|
||||
memcpy(packet+fixed_header_len, var_header, sizeof(var_header));
|
||||
memcpy(packet+fixed_header_len+sizeof(var_header), utf_topic, utf_topicLen);
|
||||
|
||||
// Send the packet
|
||||
if(broker->mqttsend(broker->socketid, packet, packetLen) < packetLen) {
|
||||
|
@ -38,20 +38,24 @@ lsd_printf_fn lsd_printf = NULL;
|
||||
|
||||
static u8 *lsd_scan_bss;
|
||||
|
||||
#define LSD_SRC_CNT (3)
|
||||
|
||||
const u8 lsd_dst_addr[3] = {0x01,0x00,0x5e};
|
||||
u8 lsd_last_num[2] = {0,0};
|
||||
u16 lsd_head[2][4] = {{0,0,0,0},{0,0,0,0}};
|
||||
u16 lsd_byte[2][4] = {{0,0,0,0},{0,0,0,0}};
|
||||
u8 lsd_state = 0;
|
||||
u16 lsd_data_datum = 0;
|
||||
u8 lsd_head_cnt[2] = {0,0};
|
||||
u8 lsd_byte_cnt[2] = {0,0};
|
||||
u8 lsd_sync_cnt = 0;
|
||||
u8 lsd_src_mac[6] = {0};
|
||||
u8 lsd_data_cnt = 0;
|
||||
u16 lsd_last_seq[2] = {0,0};
|
||||
u16 lsd_last_len = 0;
|
||||
u8 lsd_temp_lock = 0;
|
||||
u8 lsd_last_num[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u16 lsd_head[LSD_SRC_CNT][4] = {{0,0,0,0},{0,0,0,0},{0,0,0,0}};
|
||||
u16 lsd_byte[LSD_SRC_CNT][4] = {{0,0,0,0},{0,0,0,0},{0,0,0,0}};
|
||||
u8 lsd_state[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u16 lsd_data_datum[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u8 lsd_head_cnt[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u8 lsd_head_bw20[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u8 lsd_byte_cnt[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u8 lsd_sync_cnt[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u8 lsd_src_mac[LSD_SRC_CNT][6] = {{0}, {0}, {0}};
|
||||
u8 lsd_data_cnt[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u16 lsd_last_seq[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u16 lsd_last_len[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u8 lsd_temp_lock[LSD_SRC_CNT] = {0, 0, 0};
|
||||
u8 lsd_lock_chan_cnt = 0;
|
||||
|
||||
|
||||
struct lsd_data_t *lsd_data = NULL;
|
||||
@ -196,12 +200,24 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(hdr->duration_id == 0) //normal mode stbc 不处理
|
||||
{
|
||||
tods = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(1 == ieee80211_has_tods(hdr->frame_control))
|
||||
{
|
||||
tods = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
tods = 0;
|
||||
}
|
||||
}
|
||||
multicast = ieee80211_get_DA(hdr);
|
||||
|
||||
if(0 == ieee80211_has_tods(hdr->frame_control))
|
||||
{
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
|
||||
//for LSD only tods
|
||||
if (ieee80211_is_data_qos(hdr->frame_control))
|
||||
{
|
||||
@ -212,15 +228,15 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
frm_len = data_len;
|
||||
}
|
||||
|
||||
tods = ieee80211_has_tods(hdr->frame_control);
|
||||
//tods = ieee80211_has_tods(hdr->frame_control);
|
||||
SrcMac = ieee80211_get_SA(hdr);
|
||||
|
||||
if(memcmp(multicast, lsd_dst_addr, 3))
|
||||
if(memcmp(multicast, lsd_dst_addr, 3) && hdr->duration_id)
|
||||
{
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
|
||||
switch(lsd_state)
|
||||
switch(lsd_state[tods])
|
||||
{
|
||||
case 0:
|
||||
if ((frm_len < 60) || (frm_len > 86))
|
||||
@ -228,24 +244,26 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
|
||||
if(is_zero_ether_addr(lsd_src_mac))
|
||||
if(is_zero_ether_addr(lsd_src_mac[tods]))
|
||||
{
|
||||
memcpy(lsd_src_mac, SrcMac, 6);
|
||||
lsd_head_cnt[0] = lsd_head_cnt[1] = 0;
|
||||
lsd_sync_cnt = 0;
|
||||
lsd_last_seq[0] = lsd_last_seq[1] = 0;
|
||||
lsd_temp_lock = 0;
|
||||
memset(lsd_head, 0, sizeof(lsd_head));
|
||||
memcpy(lsd_src_mac[tods], SrcMac, 6);
|
||||
lsd_head_cnt[tods] = 0;
|
||||
lsd_head_bw20[tods] = 0;
|
||||
lsd_sync_cnt[tods] = 0;
|
||||
lsd_last_seq[tods] = 0;
|
||||
lsd_temp_lock[tods] = 0;
|
||||
memset(lsd_head[tods], 0, sizeof(lsd_head)/LSD_SRC_CNT);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(memcmp(lsd_src_mac, SrcMac, 6))
|
||||
if(memcmp(lsd_src_mac[tods], SrcMac, 6))
|
||||
{
|
||||
memcpy(lsd_src_mac, SrcMac, 6);
|
||||
lsd_head_cnt[0] = lsd_head_cnt[1] = 0;
|
||||
lsd_sync_cnt = 0;
|
||||
lsd_last_seq[0] = lsd_last_seq[1] = 0;
|
||||
memset(lsd_head, 0, sizeof(lsd_head));
|
||||
memcpy(lsd_src_mac[tods], SrcMac, 6);
|
||||
lsd_head_cnt[tods] = 0;
|
||||
lsd_head_bw20[tods] = 0;
|
||||
lsd_sync_cnt[tods] = 0;
|
||||
lsd_last_seq[tods] = 0;
|
||||
memset(lsd_head[tods], 0, sizeof(lsd_head)/LSD_SRC_CNT);
|
||||
}else{
|
||||
if(lsd_printf)
|
||||
lsd_printf("tods:%d,%d,"MACSTR"\n", tods, frm_len, MAC2STR(SrcMac));
|
||||
@ -265,22 +283,27 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(((lsd_head[tods][lsd_head_cnt[tods]]+1) != lsd_head[tods][lsd_head_cnt[tods]-1])
|
||||
&& ((lsd_head[tods][lsd_head_cnt[tods]]-3) != lsd_head[tods][lsd_head_cnt[tods]-1]))
|
||||
{
|
||||
lsd_temp_lock = 0;
|
||||
lsd_temp_lock[tods] = 0;
|
||||
lsd_head_cnt[tods] = 0;
|
||||
lsd_head_bw20[tods] = 0;
|
||||
lsd_head[tods][0] = frm_len;
|
||||
}else{
|
||||
lsd_temp_lock = 1;
|
||||
lsd_temp_lock[tods] = 1;
|
||||
}
|
||||
}
|
||||
lsd_head_cnt[tods] ++;
|
||||
if(0 == (hdr->duration_id&0x01))
|
||||
{
|
||||
lsd_head_bw20[tods] ++;
|
||||
}
|
||||
|
||||
if(lsd_head_cnt[tods] >= 4)
|
||||
{
|
||||
lsd_sync_cnt ++;
|
||||
lsd_sync_cnt[tods] ++;
|
||||
lsd_head_cnt[tods] = 0;
|
||||
}
|
||||
|
||||
if(lsd_sync_cnt >= 1)
|
||||
if(lsd_sync_cnt[tods] >= 1)
|
||||
{
|
||||
guide_len = lsd_head[tods][0];
|
||||
for(i=1; i<=3; i++)
|
||||
@ -288,28 +311,48 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(guide_len > lsd_head[tods][i])
|
||||
guide_len = lsd_head[tods][i]; //È¡³öͬ²½Í·ÖÐ×îСֵ
|
||||
}
|
||||
lsd_state = 1; //同步完成, 锁定源MAC和信道
|
||||
lsd_data_datum = guide_len - LSD_GUIDE_DATUM + LSD_DATA_OFFSET; //获取到基准长度
|
||||
lsd_state[tods] = 1; //同步完成, 锁定源MAC和信道
|
||||
lsd_data_datum[tods] = guide_len - LSD_GUIDE_DATUM + LSD_DATA_OFFSET; //获取到基准长度
|
||||
if(lsd_printf)
|
||||
lsd_printf("lsd lock:%d\n", lsd_data_datum);
|
||||
|
||||
printf("SRC MAC:%02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
lsd_src_mac[0],lsd_src_mac[1],lsd_src_mac[2],lsd_src_mac[3],lsd_src_mac[4],lsd_src_mac[5]);
|
||||
return LSD_ONESHOT_CHAN_LOCKED;
|
||||
if (lsd_printf)
|
||||
lsd_printf("SRC MAC:%02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
lsd_src_mac[tods][0],lsd_src_mac[tods][1],lsd_src_mac[tods][2],lsd_src_mac[tods][3],lsd_src_mac[tods][4],lsd_src_mac[tods][5]);
|
||||
if(lsd_head_bw20[tods] >= 4)
|
||||
{
|
||||
lsd_head_bw20[tods] = 0;
|
||||
if (lsd_lock_chan_cnt == 1)
|
||||
{
|
||||
lsd_lock_chan_cnt = 2;
|
||||
return LSD_ONESHOT_CHAN_LOCKED_BW20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lsd_lock_chan_cnt == 1)
|
||||
{
|
||||
lsd_lock_chan_cnt = 2;
|
||||
return LSD_ONESHOT_CHAN_LOCKED_BW40;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(lsd_temp_lock == 1)
|
||||
if(lsd_temp_lock[tods] == 1)
|
||||
{
|
||||
return LSD_ONESHOT_CHAN_TEMP_LOCKED;
|
||||
if (lsd_lock_chan_cnt == 0)
|
||||
{
|
||||
lsd_lock_chan_cnt = 1;
|
||||
return LSD_ONESHOT_CHAN_TEMP_LOCKED;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if((frm_len >= 1024) || (frm_len < lsd_data_datum))
|
||||
if((frm_len >= 1024) || (frm_len < lsd_data_datum[tods]))
|
||||
{
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
|
||||
if(memcmp(lsd_src_mac, SrcMac, 6))
|
||||
if(memcmp(lsd_src_mac[tods], SrcMac, 6))
|
||||
{
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
@ -327,7 +370,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
lsd_last_num[tods] = multicast[5];
|
||||
}
|
||||
|
||||
lsd_byte[tods][lsd_byte_cnt[tods]] = frm_len - lsd_data_datum;
|
||||
lsd_byte[tods][lsd_byte_cnt[tods]] = frm_len - lsd_data_datum[tods];
|
||||
if((lsd_byte_cnt[tods]==0) && (lsd_byte[tods][0]>=256))
|
||||
{
|
||||
lsd_byte_cnt[tods] = 0;
|
||||
@ -361,16 +404,16 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(data_coding.crc == (u8)crcValue)
|
||||
{
|
||||
if(lsd_printf)
|
||||
lsd_printf("%d\n", data_coding.seq);
|
||||
lsd_printf("[%d]%d\n", tods, data_coding.seq);
|
||||
lsd_data->data[data_coding.seq<<1] = data_coding.data1;
|
||||
lsd_data->used[data_coding.seq<<1] = 1;
|
||||
lsd_data_cnt ++;
|
||||
lsd_data_cnt[tods] ++;
|
||||
lsd_data->data[(data_coding.seq<<1)+1] = data_coding.data2;
|
||||
lsd_data->used[(data_coding.seq<<1)+1] = 1;
|
||||
lsd_data_cnt ++;
|
||||
if(lsd_data_cnt >= LSD_DATA_MAX)
|
||||
lsd_data_cnt[tods] ++;
|
||||
if(lsd_data_cnt[tods] >= LSD_DATA_MAX)
|
||||
{
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_ERR;
|
||||
}
|
||||
@ -386,7 +429,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
ssidLen = lsd_data->data[2];
|
||||
if((ssidLen > 32) || (pwdLen > 64))
|
||||
{
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_ERR;
|
||||
}
|
||||
@ -395,7 +438,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(lsd_printf)
|
||||
lsd_printf("totalLen:%d, ssidLen:%d, pwdLen:%d, err\n", totalLen, ssidLen, pwdLen);
|
||||
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
@ -406,7 +449,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(lsd_printf)
|
||||
lsd_printf("totalLen:%d, ssidLen:%d, pwdLen:%d, err\n", totalLen, ssidLen, pwdLen);
|
||||
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
@ -418,7 +461,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(lsd_printf)
|
||||
lsd_printf("totalLen:%d, ssidLen:%d, pwdLen:%d, err\n", totalLen, ssidLen, pwdLen);
|
||||
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
@ -428,7 +471,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(lsd_printf)
|
||||
lsd_printf("ssidLen:%d, pwdLen:%d, err\n", ssidLen, pwdLen);
|
||||
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
@ -437,12 +480,12 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(lsd_printf)
|
||||
lsd_printf("ssidLen:%d, pwdLen:%d, err\n", ssidLen, pwdLen);
|
||||
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
|
||||
if(lsd_data_cnt >= totalLen + 2)
|
||||
if(lsd_data_cnt[tods] >= totalLen + 2)
|
||||
{
|
||||
if(lsd_printf)
|
||||
lsd_printf("get all\n");
|
||||
@ -452,7 +495,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
if(lsd_printf)
|
||||
lsd_printf("totalCrc err\n");
|
||||
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
@ -464,7 +507,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
lsd_param->user_len = totalLen - 2;
|
||||
if(lsd_param->user_len > 128)
|
||||
{
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_ERR;
|
||||
}
|
||||
@ -477,17 +520,17 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
bssidCrc = lsd_data->data[3];
|
||||
if(pwdLen > 0)
|
||||
{
|
||||
memcpy(lsd_param->pwd, &lsd_data->data[4], pwdLen);
|
||||
memcpy(lsd_param->ssid, &lsd_data->data[5+pwdLen], ssidLen);
|
||||
memcpy(&lsd_param->pwd, &lsd_data->data[4], pwdLen);
|
||||
memcpy(&lsd_param->ssid, &lsd_data->data[5+pwdLen], ssidLen);
|
||||
ssidCrc = lsd_data->data[5+ssidLen+pwdLen];
|
||||
lsd_param->user_len = totalLen - pwdLen - ssidLen - 5;
|
||||
if(lsd_param->user_len > 128)
|
||||
{
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_ERR;
|
||||
}
|
||||
memcpy(lsd_param->user_data, &lsd_data->data[6+ssidLen+pwdLen], lsd_param->user_len);
|
||||
memcpy(&lsd_param->user_data, &lsd_data->data[6+ssidLen+pwdLen], lsd_param->user_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -496,7 +539,7 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
lsd_param->user_len = totalLen - ssidLen - 4;
|
||||
if(lsd_param->user_len > 128)
|
||||
{
|
||||
lsd_data_cnt = 0;
|
||||
lsd_data_cnt[tods] = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
return LSD_ONESHOT_ERR;
|
||||
}
|
||||
@ -569,8 +612,11 @@ int tls_lsd_recv(u8 *buf, u16 data_len)
|
||||
{
|
||||
if(lsd_printf)
|
||||
lsd_printf("pwdCrc err\n");
|
||||
lsd_data_cnt = 0;
|
||||
memset((u8 *)lsd_data, 0, sizeof(struct lsd_data_t));
|
||||
memset((u8 *)&lsd_data->data[4], 0, pwdLen);
|
||||
memset((u8 *)&lsd_data->used[4], 0, pwdLen);
|
||||
lsd_data->used[1] = 0;
|
||||
lsd_data->data[1] = 0;
|
||||
lsd_data_cnt[tods] = lsd_data_cnt[tods] - pwdLen;
|
||||
memset(lsd_param->pwd, 0, 65);
|
||||
return LSD_ONESHOT_CONTINUE;
|
||||
}
|
||||
@ -634,18 +680,20 @@ void tls_lsd_init(u8 *scanBss)
|
||||
|
||||
memset(lsd_head, 0, sizeof(lsd_head));
|
||||
memset(lsd_byte, 0, sizeof(lsd_byte));
|
||||
memset(lsd_src_mac, 0, 6);
|
||||
memset(lsd_src_mac, 0, sizeof(lsd_src_mac));
|
||||
|
||||
memset(lsd_last_num, 0, sizeof(lsd_last_num));
|
||||
lsd_temp_lock = 0;
|
||||
lsd_state = 0;
|
||||
lsd_data_datum = 0;
|
||||
memset(lsd_temp_lock, 0, sizeof(lsd_temp_lock));
|
||||
memset(lsd_state, 0, sizeof(lsd_state));
|
||||
memset(lsd_data_datum, 0, sizeof(lsd_data_datum));
|
||||
memset(lsd_head_bw20, 0, sizeof(lsd_head_bw20));
|
||||
memset(lsd_head_cnt, 0, sizeof(lsd_head_cnt));
|
||||
memset(lsd_byte_cnt, 0, sizeof(lsd_byte_cnt));
|
||||
lsd_sync_cnt = 0;
|
||||
lsd_data_cnt = 0;
|
||||
memset(lsd_sync_cnt, 0, sizeof(lsd_sync_cnt));
|
||||
memset(lsd_data_cnt, 0, sizeof(lsd_data_cnt));
|
||||
memset(lsd_last_seq, 0, sizeof(lsd_last_seq));
|
||||
lsd_scan_bss = scanBss;
|
||||
lsd_lock_chan_cnt = 0;
|
||||
|
||||
if(lsd_printf)
|
||||
lsd_printf("tls_lsd_init\n");
|
||||
|
@ -24,11 +24,14 @@ typedef enum
|
||||
|
||||
LSD_ONESHOT_CHAN_TEMP_LOCKED = 1,
|
||||
|
||||
LSD_ONESHOT_CHAN_LOCKED = 2,
|
||||
LSD_ONESHOT_CHAN_LOCKED_BW20 = 2,
|
||||
|
||||
LSD_ONESHOT_COMPLETE = 3,
|
||||
LSD_ONESHOT_CHAN_LOCKED_BW40 = 3,
|
||||
|
||||
LSD_ONESHOT_COMPLETE = 4,
|
||||
|
||||
LSD_ONESHOT_ERR = 5
|
||||
|
||||
LSD_ONESHOT_ERR = 4
|
||||
|
||||
} lsd_oneshot_status_t;
|
||||
|
||||
|
@ -107,6 +107,11 @@ static u8 scanChanErr = 0;
|
||||
|
||||
static tls_os_sem_t *gWifiRecvSem = NULL;
|
||||
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
#define ONESHOT_SPECIAL_DELAY_TIME (8 * HZ)
|
||||
static u32 g_oneshot_dur_time = 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if TLS_CONFIG_AP_MODE_ONESHOT
|
||||
@ -451,7 +456,7 @@ int tls_filter_module_srcmac(u8 *mac){
|
||||
|
||||
static void wifi_change_chanel(u32 chanid, u8 bandwidth)
|
||||
{
|
||||
tls_wl_change_channel_info(chanid, 0);//bandwidth);
|
||||
tls_wl_change_channel_info(chanid, bandwidth);
|
||||
}
|
||||
|
||||
#if TLS_CONFIG_UDP_LSD_SPECIAL
|
||||
@ -489,6 +494,7 @@ static void oneshot_lsd_finish(void)
|
||||
int tls_wifi_lsd_oneshot_special(u8 *data, u16 data_len)
|
||||
{
|
||||
int ret;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr*)data;
|
||||
|
||||
ret = tls_lsd_recv(data, data_len);
|
||||
if(ret == LSD_ONESHOT_ERR)
|
||||
@ -501,9 +507,14 @@ int tls_wifi_lsd_oneshot_special(u8 *data, u16 data_len)
|
||||
ONESHOT_DBG("LSD_ONESHOT_CHAN_TEMP_LOCKED:%d\r\n", tls_os_get_time());
|
||||
tls_oneshot_switch_channel_tim_temp_stop();
|
||||
}
|
||||
else if(ret == LSD_ONESHOT_CHAN_LOCKED)
|
||||
else if(ret == LSD_ONESHOT_CHAN_LOCKED_BW20)
|
||||
{
|
||||
ONESHOT_DBG("LSD_ONESHOT_CHAN_LOCKED:%d\r\n", tls_os_get_time());
|
||||
ONESHOT_DBG("LSD_ONESHOT_CHAN_LOCKED_BW20:%d,%x\r\n", tls_os_get_time(), hdr->duration_id);
|
||||
tls_oneshot_switch_channel_tim_stop((struct ieee80211_hdr *)data);
|
||||
}
|
||||
else if(ret == LSD_ONESHOT_CHAN_LOCKED_BW40)
|
||||
{
|
||||
hdr->duration_id |= 0x0001; ////force change to bw40
|
||||
tls_oneshot_switch_channel_tim_stop((struct ieee80211_hdr *)data);
|
||||
}
|
||||
else if(ret == LSD_ONESHOT_COMPLETE)
|
||||
@ -554,7 +565,7 @@ int soft_ap_create(void)
|
||||
|
||||
apinfo.encrypt = 0; /*0:open, 1:wep64, 2:wep128*/
|
||||
apinfo.channel = 5; /*channel random*/
|
||||
/*ip information: ip address?ê?netmask?ê?dns*/
|
||||
/*ip information: ip address?ê?netmask?ê?dns*/
|
||||
ipinfo.ip_addr[0] = 192;
|
||||
ipinfo.ip_addr[1] = 168;
|
||||
ipinfo.ip_addr[2] = 1;
|
||||
@ -695,7 +706,11 @@ void tls_oneshot_callback_start(void)
|
||||
tls_airkiss_start();
|
||||
#endif
|
||||
|
||||
#if TLS_CONFIG_UDP_LSD_SPECIAL
|
||||
#if TLS_CONFIG_UDP_LSD_SPECIAL
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
tls_wl_plcp_stop();
|
||||
#endif
|
||||
|
||||
#if LSD_ONESHOT_DEBUG
|
||||
lsd_printf = printf;
|
||||
#endif
|
||||
@ -1099,6 +1114,10 @@ void tls_oneshot_switch_channel_tim_stop(struct ieee80211_hdr *hdr)
|
||||
ONESHOT_DBG("change to BW20 ch:%d\n", ch);
|
||||
tls_wifi_change_chanel(ch);
|
||||
}
|
||||
else if(hdr->duration_id == 0)
|
||||
{
|
||||
ONESHOT_DBG("special frame!!!!!!!!!!!!!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
void tls_oneshot_switch_channel_tim_temp_stop(void)
|
||||
@ -1249,6 +1268,9 @@ void tls_oneshot_task_handle(void *arg)
|
||||
void *msg;
|
||||
#if TLS_CONFIG_UDP_ONE_SHOT
|
||||
static int chanCnt = 0;
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
static int chanRepeat = 0;
|
||||
#endif
|
||||
#endif
|
||||
for(;;)
|
||||
{
|
||||
@ -1274,6 +1296,10 @@ void tls_oneshot_task_handle(void *arg)
|
||||
tls_oneshot_scan_result_deal();
|
||||
|
||||
chanCnt = 0;
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
chanRepeat = 0;
|
||||
g_oneshot_dur_time = tls_os_get_time();
|
||||
#endif
|
||||
wifi_change_chanel(airwifichan[chanCnt], airchantype[chanCnt]);
|
||||
|
||||
tls_oneshot_callback_start();
|
||||
@ -1305,9 +1331,33 @@ void tls_oneshot_task_handle(void *arg)
|
||||
{
|
||||
chanCnt = 0;
|
||||
}
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
if (chanRepeat)
|
||||
{
|
||||
if((tls_os_get_time() - g_oneshot_dur_time) >= ONESHOT_SPECIAL_DELAY_TIME)
|
||||
{
|
||||
ONESHOT_DBG("plcp stop\r\n");
|
||||
tls_wl_plcp_stop();
|
||||
chanRepeat = 0;
|
||||
g_oneshot_dur_time = tls_os_get_time();
|
||||
}
|
||||
wifi_change_chanel(airwifichan[chanCnt], 0);
|
||||
ONESHOT_DBG("@chan:%d,bandwidth:%d,%d\n", airwifichan[chanCnt], 0, tls_os_get_time());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
if((tls_os_get_time() - g_oneshot_dur_time) >= ONESHOT_SPECIAL_DELAY_TIME)
|
||||
{
|
||||
ONESHOT_DBG("plcp start\r\n");
|
||||
tls_wl_plcp_start();
|
||||
chanRepeat = 1;
|
||||
g_oneshot_dur_time = tls_os_get_time();
|
||||
}
|
||||
#endif
|
||||
wifi_change_chanel(airwifichan[chanCnt], airchantype[chanCnt]);
|
||||
ONESHOT_DBG("chan:%d,bandwidth:%d\n", airwifichan[chanCnt], airchantype[chanCnt]);
|
||||
ONESHOT_DBG("chan:%d,bandwidth:%d,%d\n", airwifichan[chanCnt], airchantype[chanCnt], tls_os_get_time());
|
||||
}
|
||||
|
||||
#if TLS_CONFIG_AIRKISS_MODE_ONESHOT
|
||||
@ -1342,6 +1392,9 @@ void tls_oneshot_task_handle(void *arg)
|
||||
|
||||
case ONESHOT_STOP_CHAN_SWITCH:
|
||||
gchanLock = 1;
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
tls_wl_plcp_start();
|
||||
#endif
|
||||
ONESHOT_DBG("stop channel ch:%d time:%d\n",airwifichan[chanCnt], (tls_os_get_time()-oneshottime)*1000/HZ);
|
||||
if (gWifiSwitchChanTim)
|
||||
{
|
||||
@ -1358,8 +1411,6 @@ void tls_oneshot_task_handle(void *arg)
|
||||
tls_os_timer_stop(gWifiRecvTimOut);
|
||||
tls_os_timer_change(gWifiRecvTimOut, TLS_ONESHOT_RECV_TIME);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case ONESHOT_HANDSHAKE_TIMEOUT:
|
||||
@ -1520,8 +1571,8 @@ void tls_oneshot_task_create(void)
|
||||
err = tls_os_task_create(NULL, NULL,
|
||||
tls_oneshot_task_handle,
|
||||
NULL,
|
||||
(void *)OneshotTaskStk, /* 任务栈的起始地址 */
|
||||
ONESHOT_TASK_SIZE * sizeof(u32), /* 任务栈的大小 */
|
||||
(void *)OneshotTaskStk, /* 任务栈的起始地址 */
|
||||
ONESHOT_TASK_SIZE * sizeof(u32), /* 任务栈的大小 */
|
||||
TLS_ONESHOT_TASK_PRIO,
|
||||
0);
|
||||
if (err != TLS_OS_SUCCESS)
|
||||
@ -1661,7 +1712,11 @@ int tls_wifi_set_oneshot_flag(u8 flag)
|
||||
else /*udp mode*/
|
||||
{
|
||||
tls_wifi_set_listen_mode(1);
|
||||
#if TLS_CONFIG_ONESHOT_DELAY_SPECIAL
|
||||
#else
|
||||
tls_wl_plcp_start();
|
||||
#endif
|
||||
|
||||
}
|
||||
tls_wifi_start_oneshot();
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ int ping_test_sync(struct ping_param *para)
|
||||
if (ret > 0)
|
||||
{
|
||||
//memset(icmppacket, 0, PACKET_SIZE);
|
||||
ret = recvfrom(socketid, icmppacket, sizeof(icmppacket), 0, NULL, NULL);
|
||||
ret = recvfrom(socketid, icmppacket, PACKET_SIZE, 0, NULL, NULL);
|
||||
if (ret > 0)
|
||||
{
|
||||
ret = ping_test_unpack(icmppacket, ret, tls_os_get_time(), NULL);
|
||||
|
@ -84,6 +84,7 @@
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "httpd.h"
|
||||
#include "wm_wifi.h"
|
||||
#include "wm_fwup.h"
|
||||
#include "wm_watchdog.h"
|
||||
#include "wm_params.h"
|
||||
|
@ -347,7 +347,7 @@ int tls_cmd_scan( enum tls_cmd_mode mode)
|
||||
return CMD_ERR_OK;
|
||||
}
|
||||
|
||||
int tls_cmd_scan_by_param( enum tls_cmd_mode mode, u16 channellist, u32 times, u16 switchinterval)
|
||||
int tls_cmd_scan_by_param( enum tls_cmd_mode mode, u16 channellist, u32 times, u16 switchinterval, u16 scantype)
|
||||
{
|
||||
|
||||
int ret=0;
|
||||
@ -365,6 +365,7 @@ int tls_cmd_scan_by_param( enum tls_cmd_mode mode, u16 channellist, u32 times, u
|
||||
tls_wifi_scan_result_cb_register(hostif_wscan_cmplt);
|
||||
|
||||
/* trigger the scan */
|
||||
scan_param.scan_type = scantype;
|
||||
scan_param.scan_chanlist = channellist;
|
||||
scan_param.scan_chinterval = switchinterval;
|
||||
scan_param.scan_times = times;
|
||||
|
@ -188,7 +188,7 @@ int tls_cmd_pmtf(void);
|
||||
void tls_cmd_reset_sys(void);
|
||||
int tls_cmd_get_ver( struct tls_cmd_ver_t *ver);
|
||||
int tls_cmd_scan( enum tls_cmd_mode mode);
|
||||
int tls_cmd_scan_by_param( enum tls_cmd_mode mode, u16 channellist, u32 times, u16 switchinterval);
|
||||
int tls_cmd_scan_by_param( enum tls_cmd_mode mode, u16 channellist, u32 times, u16 switchinterval, u16 scantype);
|
||||
int tls_cmd_join( enum tls_cmd_mode mode,struct tls_cmd_connect_t *conn);
|
||||
int tls_cmd_disconnect_network(u8 mode);
|
||||
int tls_cmd_get_link_status(struct tls_cmd_link_status_t *lks);
|
||||
|
@ -2433,7 +2433,7 @@ int wscan_proc(u8 set_opt, u8 update_flash, union HOSTIF_CMD_PARAMS_UNION *cmd,
|
||||
struct tls_hostif *hif = tls_get_hostif();
|
||||
|
||||
hif->uart_atcmd_bits &= ~(1 << UART_ATCMD_BIT_WSCAN);
|
||||
ret = tls_cmd_scan_by_param(cmd->scanparam.mode, cmd->scanparam.chlist, cmd->scanparam.scantimes, cmd->scanparam.switchinterval);
|
||||
ret = tls_cmd_scan_by_param(cmd->scanparam.mode, cmd->scanparam.chlist, cmd->scanparam.scantimes, cmd->scanparam.switchinterval, cmd->scanparam.scantype);
|
||||
if(ret){
|
||||
return -ret;
|
||||
}
|
||||
@ -3800,7 +3800,7 @@ int txg_proc(u8 set_opt, u8 update_flash, union HOSTIF_CMD_PARAMS_UNION *cmd, un
|
||||
if(set_opt){
|
||||
memcpy(tx_gain, cmd->txg.tx_gain, TX_GAIN_LEN);
|
||||
TLS_DBGPRT_INFO("save tx gain!\r\n");
|
||||
tls_set_tx_gain(tx_gain);
|
||||
return tls_set_tx_gain(tx_gain);
|
||||
}else{
|
||||
MEMCPY(cmdrsp->txg.tx_gain, tx_gain, TX_GAIN_LEN);
|
||||
}
|
||||
@ -3867,7 +3867,7 @@ int txg_rate_set_proc(u8 set_opt, u8 update_flash, union HOSTIF_CMD_PARAMS_UNION
|
||||
tx_gain[cmd->txgr.tx_rate] = cmd->txgr.txr_gain[0];
|
||||
tx_gain[cmd->txgr.tx_rate+TX_GAIN_LEN/3] = cmd->txgr.txr_gain[1];
|
||||
tx_gain[cmd->txgr.tx_rate+TX_GAIN_LEN*2/3] = cmd->txgr.txr_gain[2];
|
||||
tls_set_tx_gain(tx_gain);
|
||||
return tls_set_tx_gain(tx_gain);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -3890,7 +3890,7 @@ int mac_proc(u8 set_opt, u8 update_flash, union HOSTIF_CMD_PARAMS_UNION *cmd, un
|
||||
return -CMD_ERR_INV_PARAMS;
|
||||
}
|
||||
wpa_supplicant_set_mac(cmd->mac.macaddr);
|
||||
tls_set_mac_addr(cmd->mac.macaddr);
|
||||
return tls_set_mac_addr(cmd->mac.macaddr);
|
||||
}else{
|
||||
u8 *mac = NULL;
|
||||
mac = wpa_supplicant_get_mac();
|
||||
@ -7889,9 +7889,16 @@ int at_parse_func(char *at_name, struct tls_atcmd_token_t *tok, union HOSTIF_CMD
|
||||
cmd->scanparam.switchinterval = 0;
|
||||
cmd->scanparam.scantimes = 0;
|
||||
cmd->scanparam.chlist = 0;
|
||||
cmd->scanparam.scantype = 0;
|
||||
|
||||
switch(tok->arg_found)
|
||||
{
|
||||
case 4:
|
||||
ret = string_to_uint(tok->arg[3], &value);
|
||||
if(ret)
|
||||
return -CMD_ERR_INV_PARAMS;
|
||||
cmd->scanparam.scantype = value;
|
||||
|
||||
case 3:
|
||||
ret = string_to_uint(tok->arg[2], &value);
|
||||
if(ret)
|
||||
@ -7912,6 +7919,7 @@ int at_parse_func(char *at_name, struct tls_atcmd_token_t *tok, union HOSTIF_CMD
|
||||
cmd->scanparam.switchinterval = 0;
|
||||
cmd->scanparam.scantimes = 0;
|
||||
cmd->scanparam.chlist = 0;
|
||||
cmd->scanparam.scantype = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -856,9 +856,10 @@ typedef struct HOSTIF_CMD_PARAMS_TXGR{
|
||||
|
||||
typedef struct _HOSTIF_CMD_PARAMS_SCANPARAM{
|
||||
enum tls_cmd_mode mode;
|
||||
u32 scantimes;
|
||||
u16 scantimes;
|
||||
u16 chlist;
|
||||
u16 switchinterval;
|
||||
u16 scantype;
|
||||
}__attribute__((packed))HOSTIF_CMD_PARAMS_SCANPARAM;
|
||||
|
||||
|
||||
|
@ -3,8 +3,8 @@ sinclude $(TOP_DIR)/tools/w800/conf.mk
|
||||
|
||||
ifndef PDIR
|
||||
GEN_LIBS = libnetwork$(LIB_EXT)
|
||||
COMPONENTS_libnetwork = api2.0.3/liblwipapi$(LIB_EXT) \
|
||||
lwip2.0.3/liblwip$(LIB_EXT)
|
||||
COMPONENTS_libnetwork = api_wm/liblwipapi$(LIB_EXT) \
|
||||
lwip2.1.3/liblwip$(LIB_EXT)
|
||||
endif
|
||||
|
||||
#DEFINES +=
|
||||
|
@ -407,7 +407,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef configCHECK_FOR_STACK_OVERFLOW
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 1
|
||||
#endif
|
||||
|
||||
#ifndef configRECORD_STACK_HIGH_ADDRESS
|
||||
|
@ -112,6 +112,9 @@ to exclude the API function. */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS (1)
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle (1)
|
||||
|
||||
#define configUSE_APPLICATION_TASK_TAG 1
|
||||
#define INCLUDE_xQueueGetMutexHolder 1
|
||||
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
|
@ -260,11 +260,6 @@ void cpu_intrpt_restore( void )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName, signed char prio )
|
||||
{
|
||||
printf("\ntask[%s] priority[%d] stack over flow\n",pcTaskName, prio);
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
|
||||
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
|
||||
|
@ -5597,3 +5597,11 @@ static void prvAddCurrentTaskToDelayedList( TickType_t xTicksToWait,
|
||||
#endif
|
||||
|
||||
#endif /* if ( configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H == 1 ) */
|
||||
|
||||
#if ( configCHECK_FOR_STACK_OVERFLOW == 1 )
|
||||
void vApplicationStackOverflowHook( TaskHandle_t xTask, char * pcTaskName )
|
||||
{
|
||||
printf("\ntask[%s] priority[%d] stack over flow\n",pcTaskName, configMAX_PRIORITIES - (int)(xTask->uxPriority));
|
||||
for(;;);
|
||||
}
|
||||
#endif /* if ( configCHECK_FOR_STACK_OVERFLOW == 1 )*/
|
||||
|
@ -93,15 +93,18 @@ tls_os_status_t tls_os_task_create(tls_os_task_t *task,
|
||||
xTaskHandle xHandle;
|
||||
BaseType_t xreturn;
|
||||
|
||||
pTask = tls_mem_alloc(sizeof(StaticTask_t));
|
||||
if(pTask == NULL)
|
||||
{
|
||||
return TLS_OS_ERROR;
|
||||
}
|
||||
|
||||
stk_size /= sizeof(StackType_t);
|
||||
if (stk_start)
|
||||
{
|
||||
pTask = tls_mem_alloc(sizeof(StaticTask_t));
|
||||
if(pTask == NULL)
|
||||
{
|
||||
return TLS_OS_ERROR;
|
||||
}
|
||||
if (task)
|
||||
{
|
||||
*task = pTask;
|
||||
}
|
||||
xHandle = xTaskCreateStatic(entry, name, stk_size, param,
|
||||
configMAX_PRIORITIES - prio, (StackType_t *)stk_start, pTask);
|
||||
xreturn = (xHandle==NULL) ? pdFALSE:pdTRUE;
|
||||
@ -109,19 +112,25 @@ tls_os_status_t tls_os_task_create(tls_os_task_t *task,
|
||||
else
|
||||
{
|
||||
xreturn = xTaskCreate( entry, name, stk_size, param,
|
||||
configMAX_PRIORITIES - prio, (TaskHandle_t * const)pTask);
|
||||
configMAX_PRIORITIES - prio, (TaskHandle_t * const)task);
|
||||
}
|
||||
|
||||
//printf("configMAX_PRIORITIES - prio:%d\n", configMAX_PRIORITIES - prio);
|
||||
if (xreturn == pdTRUE)
|
||||
{
|
||||
*task = pTask;
|
||||
os_status = TLS_OS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
tls_mem_free(pTask);
|
||||
pTask = NULL;
|
||||
if (pTask)
|
||||
{
|
||||
tls_mem_free(pTask);
|
||||
pTask = NULL;
|
||||
}
|
||||
if (task)
|
||||
{
|
||||
*task = NULL;
|
||||
}
|
||||
os_status = TLS_OS_ERROR;
|
||||
}
|
||||
|
||||
|
@ -111,12 +111,27 @@ LIB_EXT = .a
|
||||
CCFLAGS := -Wall \
|
||||
-DTLS_CONFIG_CPU_XT804=1 \
|
||||
-DGCC_COMPILE=1 \
|
||||
-DNO_PERSISTENCE=1 \
|
||||
-DUSE_SELECT=1 \
|
||||
-DHIGH_PERFORMANCE=1 \
|
||||
-DUSE_MBEDTLS=1 \
|
||||
-mcpu=ck804ef \
|
||||
$(optimization) \
|
||||
-std=gnu99 \
|
||||
-c \
|
||||
-mhard-float \
|
||||
-Wall \
|
||||
-fdata-sections \
|
||||
-ffunction-sections
|
||||
|
||||
CXXFLAGS := -Wall \
|
||||
-DTLS_CONFIG_CPU_XT804=1 \
|
||||
-DGCC_COMPILE=1 \
|
||||
-mcpu=ck804ef \
|
||||
$(optimization) \
|
||||
-c \
|
||||
-MMD \
|
||||
-MP \
|
||||
-mhard-float \
|
||||
-fdata-sections \
|
||||
-ffunction-sections
|
||||
|
||||
|
@ -37,8 +37,8 @@ INCLUDES += -I $(TOP_DIR)/src/app/libwebsockets-2.1-stable
|
||||
INCLUDES += -I $(TOP_DIR)/src/app/fatfs
|
||||
INCLUDES += -I $(TOP_DIR)/src/app/mbedtls/include
|
||||
INCLUDES += -I $(TOP_DIR)/src/app/mbedtls/ports
|
||||
INCLUDES += -I $(TOP_DIR)/src/network/api2.0.3
|
||||
INCLUDES += -I $(TOP_DIR)/src/network/lwip2.0.3/include
|
||||
INCLUDES += -I $(TOP_DIR)/src/network/api_wm
|
||||
INCLUDES += -I $(TOP_DIR)/src/network/lwip2.1.3/include
|
||||
INCLUDES += -I $(TOP_DIR)/src/os/rtos/include
|
||||
|
||||
INCLUDES += -I $(TOP_DIR)/src/app/factorycmd
|
||||
|
File diff suppressed because one or more lines are too long
@ -1185,612 +1185,588 @@
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="network">
|
||||
<VirtualDirectory Name="api2.0">
|
||||
<File Name="../../../../../../../src/network/api2.0.3/tls_netconn.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/api2.0.3/tls_netconn.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/api2.0.3/tls_sockets.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="lwip2.0">
|
||||
<VirtualDirectory Name="lwip2.1.3">
|
||||
<VirtualDirectory Name="api">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/api_lib.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/api_lib.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/api_msg.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/api_msg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/err.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/err.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/netbuf.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/netbuf.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/netdb.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/netdb.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/netifapi.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/netifapi.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/pppapi.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/if_api.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/sockets.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/sockets.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/api/tcpip.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/api/tcpip.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="core">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/alg.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/alg.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/def.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/altcp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/dns.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/altcp_alloc.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/inet_chksum.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/altcp_tcp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/init.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/def.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ip.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/dns.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/inet_chksum.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/init.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ip.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<VirtualDirectory Name="ipv4">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/autoip.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/autoip.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/dhcp.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/dhcp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/etharp.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/etharp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/icmp.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/icmp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/igmp.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/igmp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/ip4.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/ip4.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/ip4_addr.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/ip4_addr.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/ip4_frag.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv4/ip_frag.c" ExcludeProjConfig="BuildSet">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv4/ip4_frag.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ipv6">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/dhcp6.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/dhcp6.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/ethip6.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/ethip6.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/icmp6.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/icmp6.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/inet6.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/inet6.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/ip6.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/ip6.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/ip6_addr.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/ip6_addr.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/ip6_frag.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/ip6_frag.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/mld6.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/mld6.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/ipv6/nd6.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/ipv6/nd6.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/mem.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/mem.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/memp.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/memp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/netif.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/netif.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/pbuf.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/pbuf.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/raw.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/raw.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/stats.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/stats.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/sys.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/sys.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/tcp.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/tcp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/tcp_in.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/tcp_in.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/tcp_out.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/tcp_out.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/timeouts.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/timeouts.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/timers.c" ExcludeProjConfig="BuildSet">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/core/udp.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/core/udp.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="include">
|
||||
<VirtualDirectory Name="arch">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/arch/cc.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/arch/perf.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/arch/sys_arch.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="lwip">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/alg.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/alg.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/api.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/altcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/altcp_tls.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/altcp_tcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/api.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<VirtualDirectory Name="apps">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/fs.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/fs.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/httpd.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/httpd.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/httpd_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/httpd_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/lwiperf.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/lwiperf.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/mdns.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/mdns.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/mdns_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/mdns_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/mdns_priv.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/mdns_priv.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/mqtt.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/mqtt.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/mqtt_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/mqtt_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/netbiosns.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/netbiosns.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/netbiosns_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/netbiosns_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmpv3.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmpv3.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmp_core.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmp_core.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmp_mib2.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmp_mib2.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmp_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmp_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmp_scalar.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmp_scalar.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmp_table.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmp_table.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/snmp_threadsync.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/snmp_threadsync.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/sntp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/sntp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/sntp_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/sntp_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/tftp_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/tftp_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/apps/tftp_server.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/apps/tftp_server.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/arch.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/arch.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/autoip.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/autoip.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/debug.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/debug.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/def.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/def.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/dhcp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/dhcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/dhcp6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/dhcp6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/dns.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/dns.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/err.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/err.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/errno.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/errno.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/etharp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/etharp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ethip6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ethip6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/icmp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/icmp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/icmp6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/icmp6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/igmp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/igmp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/inet.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/inet.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/inet_chksum.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/inet_chksum.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/init.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/init.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip4.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip4.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip4_addr.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip4_addr.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip4_frag.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip4_frag.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip6_addr.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip6_addr.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip6_frag.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip6_frag.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip_addr.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/ip_addr.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/ip_frag.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/tcpbase.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/lwipopts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/mem.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/mem.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/memp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/memp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/mld6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/mld6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/nd6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/nd6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/netbuf.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/netbuf.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/netdb.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/netdb.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/netif.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/netif.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/netifapi.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/netifapi.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/opt.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/opt.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/pbuf.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/pbuf.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/pppapi.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/if_api.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<VirtualDirectory Name="priv">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/priv/api_msg.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/priv/api_msg.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/priv/memp_priv.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/priv/memp_priv.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/priv/memp_std.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/priv/memp_std.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/priv/nd6_priv.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/priv/nd6_priv.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/priv/tcpip_priv.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/priv/tcpip_priv.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/priv/tcp_priv.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/priv/tcp_priv.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="prot">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/autoip.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/autoip.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/dhcp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/dhcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/dns.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/dns.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/etharp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/etharp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/ethernet.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/ethernet.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/icmp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/icmp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/icmp6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/icmp6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/igmp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/igmp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/ip.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/ip.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/ip4.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/ip4.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/ip6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/ip6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/mld6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/mld6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/nd6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/nd6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/tcp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/tcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/prot/udp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/prot/udp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/raw.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/raw.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/sio.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/sio.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/snmp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/snmp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/sockets.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/sockets.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/stats.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/stats.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/sys.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/sys.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/tcp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/tcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/tcpip.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/tcpip.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/timeouts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/timeouts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/timers.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/timers.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/lwip/udp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/lwip/udp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="netif">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/etharp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/etharp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ethernet.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ethernet.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ethernetif.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ethernetif.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/lowpan6.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/lowpan6.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/lowpan6_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/lowpan6_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<VirtualDirectory Name="ppp">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/ccp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/ccp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/chap-md5.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/chap-md5.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/chap-new.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/chap-new.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/chap_ms.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/chap_ms.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/eap.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/eap.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/ecp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/ecp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/eui64.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/eui64.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/fsm.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/fsm.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/ipcp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/ipcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/ipv6cp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/ipv6cp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/lcp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/lcp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/magic.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/magic.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/mppe.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/mppe.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<VirtualDirectory Name="polarssl">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/polarssl/arc4.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/polarssl/arc4.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/polarssl/des.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/polarssl/des.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/polarssl/md4.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/polarssl/md4.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/polarssl/md5.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/polarssl/md5.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/polarssl/sha1.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/polarssl/sha1.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/ppp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/ppp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/pppapi.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/pppapi.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/pppcrypt.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/pppcrypt.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/pppdebug.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/pppdebug.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/pppoe.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/pppoe.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/pppol2tp.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/pppol2tp.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/pppos.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/pppos.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/ppp_impl.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/ppp_impl.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/ppp_opts.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/ppp_opts.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/upap.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/upap.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/ppp/vj.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/ppp/vj.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/netif/slipif.h">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/include/netif/slipif.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="posix">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/posix/errno.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/posix/netdb.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<VirtualDirectory Name="sys">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/include/posix/sys/socket.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="netif">
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/netif/ethernet.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/netif/ethernet.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/netif/ethernetif.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/netif/ethernetif.c" ExcludeProjConfig="">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/netif/lowpan6.c" ExcludeProjConfig="BuildSet">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/netif/slipif.c" ExcludeProjConfig="BuildSet">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/netif/wm_ethernet.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/netif/wm_ethernet.c" ExcludeProjConfig="">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<File Name="../../../../../../../src/network/lwip2.0.3/sys_arch.c">
|
||||
<File Name="../../../../../../../src/network/lwip2.1.3/sys_arch.c" ExcludeProjConfig="">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="api_wm">
|
||||
<File Name="../../../../../../../src/network/api_wm/tls_netconn.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../src/network/api_wm/tls_netconn.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
@ -3616,6 +3592,9 @@
|
||||
<File Name="../../../../../../../platform/drivers/adc/wm_polyfit.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../platform/drivers/adc/wm_adc_cal.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="cpu">
|
||||
<File Name="../../../../../../../platform/drivers/cpu/wm_cpu.c">
|
||||
@ -3953,13 +3932,13 @@
|
||||
<File Name="../../../../../../../include/net/wm_socket.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../include/net/wm_socket2.0.3.h">
|
||||
<File Name="../../../../../../../include/net/wm_socket2.1.3.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../include/net/wm_sockets.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../include/net/wm_sockets2.0.3.h">
|
||||
<File Name="../../../../../../../include/net/wm_sockets2.1.3.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
@ -3982,7 +3961,7 @@
|
||||
<File Name="../../../../../../../include/app/wm_netif.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../include/app/wm_netif2.0.3.h">
|
||||
<File Name="../../../../../../../include/app/wm_netif2.1.3.h">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../include/app/wm_ntp.h">
|
||||
@ -4151,15 +4130,15 @@
|
||||
<File Name="../../../../../../../demo/wm_slave_spi_demo.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../demo/wm_touchsensor_demo.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../demo/wm_avoid_copy_demo.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../demo/wm_lcd_demo.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
<File Name="../../../../../../../demo/wm_touchsensor_demo.c">
|
||||
<FileOption/>
|
||||
</File>
|
||||
</VirtualDirectory>
|
||||
<DebugSessions>
|
||||
<watchExpressions/>
|
||||
@ -4269,11 +4248,11 @@
|
||||
</AfterMake>
|
||||
</User>
|
||||
<Compiler>
|
||||
<Define>GCC_COMPILE=1;TLS_CONFIG_CPU_XT804=1</Define>
|
||||
<Define>GCC_COMPILE=1;TLS_CONFIG_CPU_XT804=1;NO_PERSISTENCE=1;USE_SELECT=1;HIGH_PERFORMANCE=1;USE_MBEDTLS=1</Define>
|
||||
<Undefine/>
|
||||
<Optim>Optimize more (-O2)</Optim>
|
||||
<DebugLevel>Maximum (-g3)</DebugLevel>
|
||||
<IncludePath>$(CDKPath)/CSKY/MinGW/csky-abiv2-elf-toolchain/csky-elfabiv2/include;$(ProjectPath);$(ProjectPath)/../../../../../../../demo;$(ProjectPath)/../../../../../../../include;$(ProjectPath)/../../../../../../../include/app;$(ProjectPath)/../../../../../../../include/arch/xt804;$(ProjectPath)/../../../../../../../include/arch/xt804/csi_core;$(ProjectPath)/../../../../../../../include/arch/xt804/csi_dsp;$(ProjectPath)/../../../../../../../include/bt;$(ProjectPath)/../../../../../../../include/driver;$(ProjectPath)/../../../../../../../include/net;$(ProjectPath)/../../../../../../../include/os;$(ProjectPath)/../../../../../../../include/platform;$(ProjectPath)/../../../../../../../include/wifi;$(ProjectPath)/../../../../../../../platform/common/params;$(ProjectPath)/../../../../../../../platform/drivers/spi;$(ProjectPath)/../../../../../../../platform/inc;$(ProjectPath)/../../../../../../../platform/sys;$(ProjectPath)/../../../../../../../src/app;$(ProjectPath)/../../../../../../../src/app/btapp;$(ProjectPath)/../../../../../../../src/app/cJSON;$(ProjectPath)/../../../../../../../src/app/dhcpserver;$(ProjectPath)/../../../../../../../src/app/dnsserver;$(ProjectPath)/../../../../../../../src/app/fatfs;$(ProjectPath)/../../../../../../../src/app/httpclient;$(ProjectPath)/../../../../../../../src/app/iperf;$(ProjectPath)/../../../../../../../src/app/libcoap/include;$(ProjectPath)/../../../../../../../src/app/libwebsockets-2.1-stable;$(ProjectPath)/../../../../../../../src/app/mDNS/mDNSCore;$(ProjectPath)/../../../../../../../src/app/mDNS/mDNSPosix;$(ProjectPath)/../../../../../../../src/app/mbedtls/include;$(ProjectPath)/../../../../../../../src/app/mbedtls/include/mbedtls;$(ProjectPath)/../../../../../../../src/app/mbedtls/ports;$(ProjectPath)/../../../../../../../src/app/mqtt;$(ProjectPath)/../../../../../../../src/app/oneshotconfig;$(ProjectPath)/../../../../../../../src/app/ota;$(ProjectPath)/../../../../../../../src/app/ping;$(ProjectPath)/../../../../../../../src/app/polarssl/include;$(ProjectPath)/../../../../../../../src/app/web;$(ProjectPath)/../../../../../../../src/app/wm_atcmd;$(ProjectPath)/../../../../../../../src/bt/host/;$(ProjectPath)/../../../../../../../src/bt/host/bta/include;$(ProjectPath)/../../../../../../../src/bt/host/btcore/include;$(ProjectPath)/../../../../../../../src/bt/host/btif/include;$(ProjectPath)/../../../../../../../src/bt/host/embdrv/sbc/decoder/include;$(ProjectPath)/../../../../../../../src/bt/host/embdrv/sbc/encoder/include;$(ProjectPath)/../../../../../../../src/bt/host/gki/common;$(ProjectPath)/../../../../../../../src/bt/host/gki/wm;$(ProjectPath)/../../../../../../../src/bt/host/hci/include;$(ProjectPath)/../../../../../../../src/bt/host/include;$(ProjectPath)/../../../../../../../src/bt/host/main;$(ProjectPath)/../../../../../../../src/bt/host/osi/include;$(ProjectPath)/../../../../../../../src/bt/host/osi/include/socket_utils;$(ProjectPath)/../../../../../../../src/bt/host/stack/;$(ProjectPath)/../../../../../../../src/bt/host/stack/bnep;$(ProjectPath)/../../../../../../../src/bt/host/stack/include;$(ProjectPath)/../../../../../../../src/bt/host/stack/smp;$(ProjectPath)/../../../../../../../src/bt/host/udrv/include;$(ProjectPath)/../../../../../../../src/bt/host/udrv/ulinux;$(ProjectPath)/../../../../../../../src/bt/host/vnd/ble;$(ProjectPath)/../../../../../../../src/bt/host/vnd/include;$(ProjectPath)/../../../../../../../src/network/api2.0.3;$(ProjectPath)/../../../../../../../src/network/lwip2.0.3/apps/httpd;$(ProjectPath)/../../../../../../../src/network/lwip2.0.3/apps/snmp;$(ProjectPath)/../../../../../../../src/network/lwip2.0.3/include;$(ProjectPath)/../../../../../../../src/network/lwip2.0.3/include/arch;$(ProjectPath)/../../../../../../../src/network/lwip2.0.3/include/lwip;$(ProjectPath)/../../../../../../../src/os/rtos/include</IncludePath>
|
||||
<IncludePath>$(CDKPath)/CSKY/MinGW/csky-abiv2-elf-toolchain/csky-elfabiv2/include;$(ProjectPath);$(ProjectPath)/../../../../../../../demo;$(ProjectPath)/../../../../../../../include;$(ProjectPath)/../../../../../../../include/app;$(ProjectPath)/../../../../../../../include/arch/xt804;$(ProjectPath)/../../../../../../../include/arch/xt804/csi_core;$(ProjectPath)/../../../../../../../include/arch/xt804/csi_dsp;$(ProjectPath)/../../../../../../../include/bt;$(ProjectPath)/../../../../../../../include/driver;$(ProjectPath)/../../../../../../../include/net;$(ProjectPath)/../../../../../../../include/os;$(ProjectPath)/../../../../../../../include/platform;$(ProjectPath)/../../../../../../../include/wifi;$(ProjectPath)/../../../../../../../platform/common/params;$(ProjectPath)/../../../../../../../platform/drivers/spi;$(ProjectPath)/../../../../../../../platform/inc;$(ProjectPath)/../../../../../../../platform/sys;$(ProjectPath)/../../../../../../../src/app;$(ProjectPath)/../../../../../../../src/app/btapp;$(ProjectPath)/../../../../../../../src/app/cJSON;$(ProjectPath)/../../../../../../../src/app/dhcpserver;$(ProjectPath)/../../../../../../../src/app/dnsserver;$(ProjectPath)/../../../../../../../src/app/fatfs;$(ProjectPath)/../../../../../../../src/app/httpclient;$(ProjectPath)/../../../../../../../src/app/iperf;$(ProjectPath)/../../../../../../../src/app/libcoap/include;$(ProjectPath)/../../../../../../../src/app/libwebsockets-2.1-stable;$(ProjectPath)/../../../../../../../src/app/mDNS/mDNSCore;$(ProjectPath)/../../../../../../../src/app/mDNS/mDNSPosix;$(ProjectPath)/../../../../../../../src/app/mbedtls/include;$(ProjectPath)/../../../../../../../src/app/mbedtls/include/mbedtls;$(ProjectPath)/../../../../../../../src/app/mbedtls/ports;$(ProjectPath)/../../../../../../../src/app/mqtt;$(ProjectPath)/../../../../../../../src/app/oneshotconfig;$(ProjectPath)/../../../../../../../src/app/ota;$(ProjectPath)/../../../../../../../src/app/ping;$(ProjectPath)/../../../../../../../src/app/polarssl/include;$(ProjectPath)/../../../../../../../src/app/web;$(ProjectPath)/../../../../../../../src/app/wm_atcmd;$(ProjectPath)/../../../../../../../src/bt/host/;$(ProjectPath)/../../../../../../../src/bt/host/bta/include;$(ProjectPath)/../../../../../../../src/bt/host/btcore/include;$(ProjectPath)/../../../../../../../src/bt/host/btif/include;$(ProjectPath)/../../../../../../../src/bt/host/embdrv/sbc/decoder/include;$(ProjectPath)/../../../../../../../src/bt/host/embdrv/sbc/encoder/include;$(ProjectPath)/../../../../../../../src/bt/host/gki/common;$(ProjectPath)/../../../../../../../src/bt/host/gki/wm;$(ProjectPath)/../../../../../../../src/bt/host/hci/include;$(ProjectPath)/../../../../../../../src/bt/host/include;$(ProjectPath)/../../../../../../../src/bt/host/main;$(ProjectPath)/../../../../../../../src/bt/host/osi/include;$(ProjectPath)/../../../../../../../src/bt/host/osi/include/socket_utils;$(ProjectPath)/../../../../../../../src/bt/host/stack/;$(ProjectPath)/../../../../../../../src/bt/host/stack/bnep;$(ProjectPath)/../../../../../../../src/bt/host/stack/include;$(ProjectPath)/../../../../../../../src/bt/host/stack/smp;$(ProjectPath)/../../../../../../../src/bt/host/udrv/include;$(ProjectPath)/../../../../../../../src/bt/host/udrv/ulinux;$(ProjectPath)/../../../../../../../src/bt/host/vnd/ble;$(ProjectPath)/../../../../../../../src/bt/host/vnd/include;$(ProjectPath)/../../../../../../../src/network/api_wm;$(ProjectPath)/../../../../../../../src/network/lwip2.1.3/apps/httpd;$(ProjectPath)/../../../../../../../src/network/lwip2.1.3/apps/snmp;$(ProjectPath)/../../../../../../../src/network/lwip2.1.3/include;$(ProjectPath)/../../../../../../../src/os/rtos/include;$(ProjectPath)/../../../../../../../src/app/POSIX/include;$(ProjectPath)/../../../../../../../src/app/POSIX/FreeRTOS-Plus-POSIX/include;$(ProjectPath)/../../../../../../../src/app/POSIX/FreeRTOS-Plus-POSIX/include/portable</IncludePath>
|
||||
<OtherFlags>-fdata-sections -c</OtherFlags>
|
||||
<Verbose>no</Verbose>
|
||||
<Ansi>no</Ansi>
|
||||
|
@ -18,14 +18,16 @@ ASRCS ?= $(wildcard *.S)
|
||||
|
||||
subdir_path := $(subst $(abspath $(TOP_DIR))/,,$(shell pwd))
|
||||
|
||||
CURRENT_DIR := $(notdir $(shell pwd))
|
||||
|
||||
SUBDIRS ?= $(patsubst %/,%,$(dir $(wildcard */Makefile)))
|
||||
|
||||
OBJS := $(CSRCS:%.c=$(OBJODIR)/$(subdir_path)/%.o) \
|
||||
$(ASRCS:%.S=$(OBJODIR)/$(subdir_path)/%.o) \
|
||||
$(CPPSRCS:%.cpp=$(OBJODIR)/$(subdir_path)/%.o)
|
||||
OBJS := $(CSRCS:%.c=$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o) \
|
||||
$(ASRCS:%.S=$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o) \
|
||||
$(CPPSRCS:%.cpp=$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o)
|
||||
|
||||
OBJS-DEPS := $(patsubst %.c, $(OBJODIR)/$(subdir_path)/%.o.d, $(CSRCS))
|
||||
OBJS-CPPDEPS := $(patsubst %.cpp, $(OBJODIR)/$(subdir_path)/%.o.d, $(CPPSRCS))
|
||||
OBJS-DEPS := $(patsubst %.c, $(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o.d, $(CSRCS))
|
||||
OBJS-CPPDEPS := $(patsubst %.cpp, $(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o.d, $(CPPSRCS))
|
||||
|
||||
OLIBS := $(GEN_LIBS:%=$(LIBODIR)/%)
|
||||
|
||||
@ -197,15 +199,15 @@ endif
|
||||
endif
|
||||
endif
|
||||
|
||||
$(OBJODIR)/$(subdir_path)/%.o: %.c
|
||||
$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o: %.c
|
||||
@mkdir -p $(OBJODIR)/$(subdir_path)
|
||||
$(CC) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) $(INCLUDES) $(CMACRO) -c "$<" -o "$@" -MMD -MD -MF "$(@:$(OBJODIR)/$(subdir_path)/%.o=$(OBJODIR)/$(subdir_path)/%.o.d)" -MT "$(@)"
|
||||
$(CC) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) $(INCLUDES) $(CMACRO) -c "$<" -o "$@" -MMD -MD -MF "$(@:$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o=$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o.d)" -MT "$(@)"
|
||||
|
||||
$(OBJODIR)/$(subdir_path)/%.o: %.cpp
|
||||
$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o: %.cpp
|
||||
@mkdir -p $(OBJODIR)/$(subdir_path)
|
||||
$(CPP) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) $(INCLUDES) $(CMACRO) -c "$<" -o "$@" -MMD -MD -MF "$(@:$(OBJODIR)/$(subdir_path)/%.o=$(OBJODIR)/$(subdir_path)/%.o.d)" -MT "$(@)"
|
||||
$(CPP) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CXXFLAGS)) $(COPTS_$(*F)) $(INCLUDES) $(CMACRO) -c "$<" -o "$@" -MMD -MD -MF "$(@:$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o=$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o.d)" -MT "$(@)"
|
||||
|
||||
$(OBJODIR)/$(subdir_path)/%.o: %.S
|
||||
$(OBJODIR)/$(subdir_path)/$(CURRENT_DIR)_%.o: %.S
|
||||
@mkdir -p $(OBJODIR)/$(subdir_path)
|
||||
$(ASM) $(ASMFLAGS) $(INCLUDES) $(CMACRO) -c "$<" -o "$@"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user