diff --git a/APP_Framework/Framework/connection/wifi/Make.defs b/APP_Framework/Framework/connection/wifi/Make.defs new file mode 100755 index 000000000..cf51e4a1d --- /dev/null +++ b/APP_Framework/Framework/connection/wifi/Make.defs @@ -0,0 +1,7 @@ +############################################################################ +# APP_Framework/Framework/connection/zigbee/Make.defs +############################################################################ +ifneq ($(CONFIG_CONNECTION_ADAPTER_WIFI),) +CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/connection/wifi +endif +include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/connection/wifi/*/Make.defs) diff --git a/APP_Framework/Framework/connection/wifi/Makefile b/APP_Framework/Framework/connection/wifi/Makefile index 2930fd977..cfa6cac9f 100644 --- a/APP_Framework/Framework/connection/wifi/Makefile +++ b/APP_Framework/Framework/connection/wifi/Makefile @@ -1,3 +1,12 @@ +include $(KERNEL_ROOT)/.config +ifeq ($(CONFIG_ADD_NUTTX_FETURES),y) + include $(APPDIR)/Make.defs + CSRCS += adapter_wifi.c + include $(APPDIR)/Application.mk + +endif + +ifeq ($(CONFIG_ADD_XIZI_FETURES),y) SRC_FILES := adapter_wifi.c ifeq ($(CONFIG_ADAPTER_HFA21_WIFI),y) @@ -9,3 +18,4 @@ ifeq ($(CONFIG_ADAPTER_ESP07S_WIFI),y) endif include $(KERNEL_ROOT)/compiler.mk +endif diff --git a/APP_Framework/Framework/connection/wifi/adapter_wifi.c b/APP_Framework/Framework/connection/wifi/adapter_wifi.c index 039f96598..fe5461d71 100644 --- a/APP_Framework/Framework/connection/wifi/adapter_wifi.c +++ b/APP_Framework/Framework/connection/wifi/adapter_wifi.c @@ -100,6 +100,7 @@ int AdapterWifiInit(void) } /******************wifi TEST*********************/ +#ifdef ADD_XIZI_FETURES int AdapterWifiTest(void) { char cmd[64]; @@ -107,29 +108,28 @@ int AdapterWifiTest(void) struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME); - #ifdef ADAPTER_HFA21_DRIVER_EXT_PORT static BusType ch438_pin; ch438_pin = PinBusInitGet(); - struct PinParam pin_cfg; - int ret = 0; + struct PinParam pin_cfg; + int ret = 0; - struct BusConfigureInfo configure_info; - configure_info.configure_cmd = OPE_CFG; - configure_info.private_data = (void *)&pin_cfg; + struct BusConfigureInfo configure_info; + configure_info.configure_cmd = OPE_CFG; + configure_info.private_data = (void *)&pin_cfg; pin_cfg.cmd = GPIO_CONFIG_MODE; pin_cfg.pin = 22; pin_cfg.mode = GPIO_CFG_OUTPUT; - ret = BusDrvConfigure(ch438_pin->owner_driver, &configure_info); + ret = BusDrvConfigure(ch438_pin->owner_driver, &configure_info); struct PinStat pin_stat; - struct BusBlockWriteParam write_param; - struct BusBlockReadParam read_param; - write_param.buffer = (void *)&pin_stat; - - pin_stat.val = GPIO_HIGH; + struct BusBlockWriteParam write_param; + struct BusBlockReadParam read_param; + write_param.buffer = (void *)&pin_stat; + + pin_stat.val = GPIO_HIGH; pin_stat.pin = 22; BusDevWriteData(ch438_pin->owner_haldev, &write_param); @@ -155,7 +155,6 @@ int AdapterWifiTest(void) PrivClose(pin_fd); #endif - AdapterDeviceOpen(adapter); // AdapterDeviceControl(adapter, OPE_INT, &baud_rate); @@ -182,8 +181,8 @@ int AdapterWifiTest(void) AdapterDeviceRecv(adapter, wifi_recv_msg, 128); PrivTaskDelay(1000); } - } +#endif #ifdef ADD_RTTHREAD_FETURES MSH_CMD_EXPORT(AdapterWifiTest,a wifi adpter sample); @@ -195,8 +194,7 @@ SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHE int wifiopen(void) { struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME); - - AdapterDeviceOpen(adapter); + return AdapterDeviceOpen(adapter); } #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, wifiopen, wifiopen, open adapter wifi ); @@ -204,8 +202,7 @@ SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHE int wificlose(void) { struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME); - - AdapterDeviceClose(adapter); + return AdapterDeviceClose(adapter); } #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_PARAM_NUM(0)|SHELL_CMD_DISABLE_RETURN, wificlose, wificlose, close adapter wifi ); @@ -215,12 +212,12 @@ int wifisetup(int argc, char *argv[]) struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME); struct WifiParam param; memset(¶m,0,sizeof(struct WifiParam)); - strncpy(param.wifi_ssid, argv[1], strlen(argv[1])); - strncpy(param.wifi_pwd, argv[2], strlen(argv[2])); + strncpy((char *)param.wifi_ssid, argv[1], strlen(argv[1])); + strncpy((char *)param.wifi_pwd, argv[2], strlen(argv[2])); adapter->adapter_param = ¶m; - AdapterDeviceSetUp(adapter); + return AdapterDeviceSetUp(adapter); } #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifisetup, wifisetup, setup adapter wifi ); @@ -234,7 +231,7 @@ int wifiaddrset(int argc, char *argv[]) AdapterDeviceSetAddr(adapter, ip, gateway, netmask); AdapterDevicePing(adapter, "36.152.44.95");///< ping www.baidu.com - AdapterDeviceNetstat(adapter); + return AdapterDeviceNetstat(adapter); } #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(4)|SHELL_CMD_DISABLE_RETURN, wifiaddrset, wifiaddrset, addrset adapter wifi); @@ -243,7 +240,7 @@ int wifiping(int argc, char *argv[]) { struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME); printf("ping %s\n",argv[1]); - AdapterDevicePing(adapter, argv[1]); + return AdapterDevicePing(adapter, argv[1]); } #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3), wifiping, wifiping, wifiping adapter ); @@ -264,7 +261,7 @@ int wificonnect(int argc, char *argv[]) adapter->socket.protocal = SOCKET_PROTOCOL_UDP; } - AdapterDeviceConnect(adapter, net_role, ip, port, ip_type); + return AdapterDeviceConnect(adapter, net_role, ip, port, ip_type); } #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(4)|SHELL_CMD_DISABLE_RETURN, wificonnect, wificonnect, wificonnect adapter); @@ -279,6 +276,7 @@ int wifisend(int argc, char *argv[]) AdapterDeviceSend(adapter, wifi_msg, len); PrivTaskDelay(1000); } + return 0; } #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifisend, wifisend, wifisend adapter wifi information); @@ -297,3 +295,117 @@ int wifirecv(int argc, char *argv[]) #ifdef ADD_XIZI_FETURES SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN)|SHELL_CMD_PARAM_NUM(3)|SHELL_CMD_DISABLE_RETURN, wifirecv, wifirecv, wifirecv adapter wifi information); #endif + +#ifdef ADD_NUTTX_FETURES + +enum +{ + APT_WIFI_PARAM_IP, + APT_WIFI_PARAM_PORT, + APT_WIFI_PARAM_SSID, + APT_WIFI_PARAM_PWD, + APT_WIFI_PARAM_GW, + APT_WIFI_PARAM_SERVER, + APT_WIFI_PARAM_MASK, + APT_WIFI_PARAM_PING, + APT_WIFI_PARAM_NUM +}; + +#define APT_WIFI_PARAM_LEN 20 + +char wifi_param[APT_WIFI_PARAM_NUM][APT_WIFI_PARAM_LEN] = {0}; + +#define CHECK_RET(__func) \ +ret = __func; \ +if(ret != 0){ \ + printf("%s %d failed\n", __func__, __LINE__); \ + AdapterDeviceClose(adapter); \ + return ret; \ +}; + +void AdapterWifiGetParam(int argc, char *argv[]) +{ + int i, j; + char *param_str[] = {"ip", "port", "ssid", "pwd", "gw", "server", "mask", "ping"}; + char *default_str[] = + {"192.168.137.34", "12345", "test", "tttttttt", "192.168.137.71", "192.168.137.1", "255.255.255.0", "220.181.38.251"}; + + for(i = 0; i < APT_WIFI_PARAM_NUM; i ++) + { + memset(wifi_param[i], 0, APT_WIFI_PARAM_LEN); + strcpy(wifi_param[i], default_str[i]); + } + + for(i = 0; i < argc; i ++) + { + for(j = 0; j < APT_WIFI_PARAM_NUM; j ++) + { + if(strncmp(argv[i], param_str[j], strlen(param_str[j])) == 0) + { + printf("wifi %d: %s\n", j, argv[i] + strlen(param_str[j]) + 1); + strcpy(wifi_param[j], argv[i] + strlen(param_str[j]) + 1); + } + } + } + + printf("--- wifi parameter ---\n"); + for(i = 0; i < APT_WIFI_PARAM_NUM; i ++) + { + printf("%7.7s = %s\n", param_str[i], wifi_param[i]); + } + printf("----------------------\n"); +} + + +int AdapterWifiTest(int argc, char *argv[]) +{ + int i, ret; + + struct Adapter* adapter = AdapterDeviceFindByName(ADAPTER_WIFI_NAME); + AdapterWifiGetParam(argc, argv); + + enum NetRoleType net_role = CLIENT; + enum IpType ip_type = IPV4; + struct WifiParam param; + memset(¶m, 0, sizeof(struct WifiParam)); + strncpy((char *)param.wifi_ssid, wifi_param[APT_WIFI_PARAM_SSID], strlen(wifi_param[APT_WIFI_PARAM_SSID])); + strncpy((char *)param.wifi_pwd, wifi_param[APT_WIFI_PARAM_PWD], strlen(wifi_param[APT_WIFI_PARAM_PWD])); + + adapter->adapter_param = ¶m; + + CHECK_RET(AdapterDeviceOpen(adapter)); + CHECK_RET(AdapterDeviceSetUp(adapter)); + + CHECK_RET(AdapterDeviceSetAddr(adapter, wifi_param[APT_WIFI_PARAM_IP], wifi_param[APT_WIFI_PARAM_GW], + wifi_param[APT_WIFI_PARAM_MASK])); + + CHECK_RET(AdapterDeviceNetstat(adapter)); + + adapter->socket.protocal = SOCKET_PROTOCOL_TCP; + CHECK_RET(AdapterDeviceConnect(adapter, net_role, wifi_param[APT_WIFI_PARAM_SERVER], + wifi_param[APT_WIFI_PARAM_PORT], ip_type)); + + const char *wifi_msg = "Wifi Test"; + for(i = 0; i < 10; i++) + { + AdapterDeviceSend(adapter, wifi_msg, strlen(wifi_msg)); + PrivTaskDelay(4000); + } + + char wifi_recv_msg[128]; + for(i = 0; i < 10; i ++) + { + AdapterDeviceRecv(adapter, wifi_recv_msg, 128); + PrivTaskDelay(1000); + } + +// printf("ping %s\n", wifi_param[APT_WIFI_PARAM_PING]); +// +// CHECK_RET(AdapterDevicePing(adapter, wifi_param[APT_WIFI_PARAM_PING])); +// AdapterDeviceDisconnect(adapter, NULL); + ret = AdapterDeviceClose(adapter); + return ret; +} + +#endif + diff --git a/APP_Framework/Framework/connection/wifi/esp07s_wifi/Kconfig b/APP_Framework/Framework/connection/wifi/esp07s_wifi/Kconfig index a54223b9b..354d80907 100755 --- a/APP_Framework/Framework/connection/wifi/esp07s_wifi/Kconfig +++ b/APP_Framework/Framework/connection/wifi/esp07s_wifi/Kconfig @@ -13,7 +13,7 @@ if ADD_XIZI_FETURES default "/dev/uart2_dev2" depends on !ADAPTER_ESP07S_DRIVER_EXTUART - if ADAPTER_ESP07S_DRIVER_EXTUART + if ADAPTER_ESP07S_DRIVER_EXTUART config ADAPTER_ESP07S_DRIVER string "ESP07S device extra uart driver path" default "/dev/extuart_dev6" @@ -25,7 +25,24 @@ if ADD_XIZI_FETURES endif if ADD_NUTTX_FETURES + config ADAPTER_ESP07S_DRIVER_EXTUART + bool "Using extra uart to support wifi" + default n + config ADAPTER_ESP07S_DRIVER + string "ESP07S device uart driver path" + default "/dev/uart2_dev2" + depends on !ADAPTER_ESP07S_DRIVER_EXTUART + + if ADAPTER_ESP07S_DRIVER_EXTUART + config ADAPTER_ESP07S_DRIVER + string "ESP07S device extra uart driver path" + default "/dev/extuart_dev6" + + config ADAPTER_ESP07S_DRIVER_EXT_PORT + int "if ESP07S device using extuart, choose port" + default "6" + endif endif if ADD_RTTHREAD_FETURES diff --git a/APP_Framework/Framework/connection/wifi/esp07s_wifi/Makefile b/APP_Framework/Framework/connection/wifi/esp07s_wifi/Makefile index e0ce0a8ac..53493604e 100755 --- a/APP_Framework/Framework/connection/wifi/esp07s_wifi/Makefile +++ b/APP_Framework/Framework/connection/wifi/esp07s_wifi/Makefile @@ -1,3 +1,13 @@ +include $(KERNEL_ROOT)/.config +ifeq ($(CONFIG_ADD_NUTTX_FETURES),y) + include $(APPDIR)/Make.defs + CSRCS += esp07s_wifi.c + include $(APPDIR)/Application.mk + +endif + +ifeq ($(CONFIG_ADD_XIZI_FETURES),y) SRC_FILES := esp07s_wifi.c include $(KERNEL_ROOT)/compiler.mk +endif diff --git a/APP_Framework/Framework/connection/wifi/esp07s_wifi/esp07s_wifi.c b/APP_Framework/Framework/connection/wifi/esp07s_wifi/esp07s_wifi.c index b634f7d6e..36c943b73 100755 --- a/APP_Framework/Framework/connection/wifi/esp07s_wifi/esp07s_wifi.c +++ b/APP_Framework/Framework/connection/wifi/esp07s_wifi/esp07s_wifi.c @@ -25,6 +25,11 @@ #define LEN_PARA_BUF 128 +#ifdef ADD_NUTTX_FETURES +#define EOK 0 +#define x_err_t int +#endif + static int Esp07sWifiSetDown(struct Adapter *adapter_at); /** @@ -116,7 +121,7 @@ static int Esp07sWifiOpen(struct Adapter *adapter) AtSetReplyEndChar(adapter->agent,'O','K'); - ADAPTER_DEBUG("Esp07sWifi open done\n"); + ADAPTER_DEBUG("Esp07sWifi open done\n"); return 0; } @@ -196,13 +201,13 @@ static int Esp07sWifiSetUp(struct Adapter *adapter) } PrivTaskDelay(2000); /* config as softAP+station mode */ - ret = AtCmdConfigAndCheck(agent, "AT+CWMODE=3\r\n", "OK"); + ret = AtCmdConfigAndCheck(agent, "AT+CWMODE=3\r\n", "OK"); if(ret < 0) { printf("%s %d cmd[AT+CWMODE=3] config failed!\n",__func__,__LINE__); return -1; } PrivTaskDelay(2000); - /* connect the router */ + /* connect the router */ memset(cmd,0,sizeof(cmd)); strncpy(cmd,"AT+CWJAP=",strlen("AT+CWJAP=")); strncat(cmd,"\"",1); @@ -222,7 +227,7 @@ static int Esp07sWifiSetUp(struct Adapter *adapter) return -1; } - /* check the wifi ip address */ + /* check the wifi ip address */ ATReplyType reply = CreateATReply(256); if (NULL == reply) { printf("%s %d at_create_resp failed!\n",__func__,__LINE__); @@ -291,7 +296,7 @@ static int Esp07sWifiSetAddr(struct Adapter *adapter, const char *ip, const char strncat(cmd,"\"",1); strcat(cmd,"\r\n"); - ret = AtCmdConfigAndCheck(adapter->agent, cmd, "OK"); + ret = AtCmdConfigAndCheck(adapter->agent, cmd, "OK"); if(ret < 0) { printf("%s %d cmd[%s] config ip failed!\n",__func__,__LINE__,cmd); return -1; @@ -339,7 +344,7 @@ static int Esp07sWifiNetstat(struct Adapter *adapter) int ret = 0; char *result = NULL; - /* check the wifi ip address */ + /* check the wifi ip address */ ATReplyType reply = CreateATReply(256); if (NULL == reply) { printf("%s %d at_create_resp failed!\n",__func__,__LINE__); @@ -359,7 +364,7 @@ static int Esp07sWifiNetstat(struct Adapter *adapter) goto __exit; } printf("[%s]\n", result); - + __exit: DeleteATReply(reply); @@ -380,7 +385,7 @@ static int Esp07sWifiConnect(struct Adapter *adapter, enum NetRoleType net_role, int ret = EOK; char cmd[LEN_PARA_BUF]; struct ATAgent *agent = adapter->agent; - + memset(cmd,0,sizeof(cmd)); if(adapter->socket.protocal == SOCKET_PROTOCOL_TCP && net_role == CLIENT) //esp07s as tcp client to connect server { @@ -397,13 +402,13 @@ static int Esp07sWifiConnect(struct Adapter *adapter, enum NetRoleType net_role, strncat(cmd, port, strlen(port)); strcat(cmd,"\r\n"); - ret = AtCmdConfigAndCheck(agent, cmd, "OK"); + ret = AtCmdConfigAndCheck(agent, cmd, "OK"); if(ret < 0) { printf("%s %d tcp connect [%s] failed!\n",__func__,__LINE__,ip); return -1; } - } - else if(adapter->socket.protocal == SOCKET_PROTOCOL_UDP) + } + else if(adapter->socket.protocal == SOCKET_PROTOCOL_UDP) { //e.g. AT+CIPSTART="UDP","192.168.3.116",8080,2233,0 UDP protocol, server IP, port,local port,udp mode strncpy(cmd,"AT+CIPSTART=",strlen("AT+CIPSTART=")); @@ -422,7 +427,7 @@ static int Esp07sWifiConnect(struct Adapter *adapter, enum NetRoleType net_role, strncat(cmd, "0", 1); ///< udp transparent transmission mode must be 0 strcat(cmd,"\r\n"); - ret = AtCmdConfigAndCheck(agent, cmd, "OK"); + ret = AtCmdConfigAndCheck(agent, cmd, "OK"); if(ret < 0) { printf("%s %d udp connect [%s] failed!\n",__func__,__LINE__,ip); return -1; @@ -455,17 +460,17 @@ static int Esp07sWifiDisconnect(struct Adapter *adapter) memset(cmd,0,sizeof(cmd)); /* step1: stop transparent transmission mode */ - ATOrderSend(agent, REPLY_TIME_OUT, NULL, "+++\r\n"); + ATOrderSend(agent, REPLY_TIME_OUT, NULL, "+++\r\n"); /* step2: exit transparent transmission mode */ - ret = AtCmdConfigAndCheck(agent, "AT+CIPMODE=0\r\n", "OK"); + ret = AtCmdConfigAndCheck(agent, "AT+CIPMODE=0\r\n", "OK"); if(ret < 0) { printf("%s %d cmd[AT+CIPMODE=0] exit failed!\n",__func__,__LINE__); return -1; } /* step3: disconnect */ - ret = AtCmdConfigAndCheck(agent, "AT+CIPCLOSE\r\n", "OK"); + ret = AtCmdConfigAndCheck(agent, "AT+CIPCLOSE\r\n", "OK"); if(ret < 0) { printf("%s %d cmd [AT+CIPCLOSE] disconnect failed!\n",__func__,__LINE__); return -1; @@ -490,7 +495,7 @@ static int Esp07sWifiIoctl(struct Adapter *adapter, int cmd, void *args) case CONFIG_WIFI_RESTORE: /* resore wifi */ ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "AT+RESTORE\r\n"); break; - case CONFIG_WIFI_BAUDRATE: + case CONFIG_WIFI_BAUDRATE: /* step1: config mcu uart*/ baud_rate = *((uint32_t *)args); @@ -525,14 +530,14 @@ static int Esp07sWifiIoctl(struct Adapter *adapter, int cmd, void *args) strncat(at_cmd, ",", 1); strncat(at_cmd, "8", 1); strncat(at_cmd, ",", 1); - strncat(at_cmd, "1", 1); + strncat(at_cmd, "1", 1); strncat(at_cmd, ",", 1); strncat(at_cmd, "0", 1); strncat(at_cmd, ",", 1); strncat(at_cmd, "3", 1); strcat(at_cmd,"\r\n"); - ret = AtCmdConfigAndCheck(adapter->agent, at_cmd, "OK"); + ret = AtCmdConfigAndCheck(adapter->agent, at_cmd, "OK"); if(ret < 0) { printf("%s %d cmd [%s] config uart failed!\n",__func__,__LINE__,at_cmd); ret = -1; @@ -541,7 +546,7 @@ static int Esp07sWifiIoctl(struct Adapter *adapter, int cmd, void *args) break; default: ret = -1; - break; + break; } return ret; @@ -572,7 +577,7 @@ static const struct IpProtocolDone esp07s_wifi_done = AdapterProductInfoType Esp07sWifiAttach(struct Adapter *adapter) { struct AdapterProductInfo *product_info = PrivMalloc(sizeof(struct AdapterProductInfo)); - if (!product_info) + if (!product_info) { printf("Esp07sWifiAttach Attach malloc product_info error\n"); PrivFree(product_info); @@ -584,4 +589,4 @@ AdapterProductInfoType Esp07sWifiAttach(struct Adapter *adapter) product_info->model_done = (void *)&esp07s_wifi_done; return product_info; -} \ No newline at end of file +} diff --git a/Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong/configs/wifinsh/defconfig b/Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong/configs/wifinsh/defconfig new file mode 100755 index 000000000..a03e3c01f --- /dev/null +++ b/Ubiquitous/Nuttx_Fusion_XiUOS/aiit_board/xidatong/configs/wifinsh/defconfig @@ -0,0 +1,54 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +CONFIG_ADD_NUTTX_FETURES=y +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="xidatong" +CONFIG_ARCH_BOARD_XIDATONG=y +CONFIG_ARCH_CHIP="imxrt" +CONFIG_ARCH_CHIP_IMXRT=y +CONFIG_ARCH_CHIP_MIMXRT1052CVL5B=y +CONFIG_ARCH_INTERRUPTSTACK=10240 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_ARMV7M_USEBASEPRI=y +CONFIG_BOARD_LOOPSPERMSEC=104926 +CONFIG_BUILTIN=y +CONFIG_CLOCK_MONOTONIC=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_IMXRT_GPIO_IRQ=y +CONFIG_IMXRT_GPIO3_0_15_IRQ=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_IMXRT_LPUART1=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LPUART1_SERIAL_CONSOLE=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_RAM_SIZE=524288 +CONFIG_RAM_START=0x20200000 +CONFIG_RAW_BINARY=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=14 +CONFIG_START_MONTH=3 +CONFIG_SYSTEM_NSH=y +CONFIG_DEV_GPIO=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_READLINE_CMD_HISTORY_LEN=100 +CONFIG_READLINE_CMD_HISTORY_LINELEN=120 +CONFIG_READLINE_TABCOMPLETION=y +CONFIG_FS_ROMFS=y +CONFIG_NSH_ROMFSETC=y +CONFIG_NSH_ARCHROMFS=y +CONFIG_BOARDCTL_RESET=y +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/Kconfig b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/Kconfig index 1e689be28..a482d7db1 100644 --- a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/Kconfig +++ b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/Kconfig @@ -676,6 +676,10 @@ config NSH_DISABLE_ADAPTER_BLUETOOTH_TEST bool "Disable hc08 AdapterBlueToothTest." default n +config NSH_DISABLE_ADAPTER_WIFI_TEST + bool "Disable esp07s AdapterWIFITest." + default n + config NSH_DISABLE_K210_FFT bool "Disable the K210 fft device." default n diff --git a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh.h b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh.h index 771b8b4de..cfa6b1afc 100644 --- a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh.h +++ b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh.h @@ -22,7 +22,7 @@ * @file nsh.h * @brief nuttx source code * https://github.com/apache/incubator-nuttx-apps -* @version 10.2.0 +* @version 10.2.0 * @author AIIT XUOS Lab * @date 2022-03-17 */ @@ -1506,6 +1506,10 @@ int nsh_foreach_var(FAR struct nsh_vtbl_s *vtbl, nsh_foreach_var_t cb, int cmd_AdapterBlueToothTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif +#if defined(CONFIG_ADAPTER_ESP07S_WIFI) && !defined(CONFIG_NSH_DISABLE_ADAPTER_WIFI_TEST) + int cmd_AdapterWifiTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); +#endif + #if defined(CONFIG_K210_FFT_TEST) && !defined(CONFIG_NSH_DISABLE_K210_FFT) int cmd_fft(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv); #endif diff --git a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_Applicationscmd.c b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_Applicationscmd.c index 961c524c8..34fb18629 100644 --- a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_Applicationscmd.c +++ b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_Applicationscmd.c @@ -283,6 +283,17 @@ int cmd_recvzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } #endif +#if defined(CONFIG_ADAPTER_ESP07S_WIFI) && !defined(CONFIG_NSH_DISABLE_ADAPTER_WIFI_TEST) +extern int AdapterWifiTest(int argc, char *argv[]); +int cmd_AdapterWifiTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + nsh_output(vtbl, "Hello, world!\n"); + FrameworkInit(); + AdapterWifiTest(argc, argv); + return OK; +} +#endif + #if (defined(CONFIG_ADAPTER_LORA_SX1278) || defined(CONFIG_ADAPTER_LORA_E220)) && !defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST) extern int AdapterLoraTest(void); int cmd_AdapterLoraTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) diff --git a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_command.c b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_command.c index 6526c2b70..acc04fb15 100644 --- a/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_command.c +++ b/Ubiquitous/Nuttx_Fusion_XiUOS/app_match_nuttx/apps/nshlib/nsh_command.c @@ -22,7 +22,7 @@ * @file nsh_command.c * @brief nuttx source code * https://github.com/apache/incubator-nuttx-apps -* @version 10.2.0 +* @version 10.2.0 * @author AIIT XUOS Lab * @date 2022-03-17 */ @@ -678,6 +678,10 @@ static const struct cmdmap_s g_cmdmap[] = { "AdapterBlueToothTest", cmd_AdapterBlueToothTest, 1, 1, "[BlueTooth hc08 test.]" }, #endif +#if defined(CONFIG_ADAPTER_ESP07S_WIFI) && !defined(CONFIG_NSH_DISABLE_ADAPTER_WIFI_TEST) + { "wifitest", cmd_AdapterWifiTest, 1, 8, "[WIFI test.]" }, +#endif + #if defined(CONFIG_K210_FFT_TEST) && !defined(CONFIG_NSH_DISABLE_K210_FFT) { "fft", cmd_fft, 1, 1, "[K210 fft function.]" }, #endif