change Nuttx to Nuttx_Fusion_XiUOS

This commit is contained in:
wgzAIIT
2022-03-30 18:11:09 +08:00
parent 5951468186
commit 408e9f2292
234 changed files with 11 additions and 11 deletions
@@ -0,0 +1,207 @@
############################################################################
# apps/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
export APPDIR = $(CURDIR)
include $(APPDIR)/Make.defs
include $(APPDIR)/../../../APP_Framework/Make.defs
# Symbol table for loadable apps.
SYMTABSRC = symtab_apps.c
SYMTABOBJ = $(SYMTABSRC:.c=$(OBJEXT))
# Build targets
# We first remove libapps.a before letting the other rules add objects to it
# so that we ensure libapps.a does not contain objects from prior build
all:
$(RM) $(BIN)
$(MAKE) $(BIN)
.PHONY: import install dirlinks export .depdirs preconfig depend clean distclean
.PHONY: context clean_context context_all register register_all
.PRECIOUS: $(BIN)
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),all)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),install)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),context)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),register)))
$(foreach SDIR, $(CONFIGURED_APPS), $(eval $(call SDIR_template,$(SDIR),depend)))
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),clean)))
$(foreach SDIR, $(CLEANDIRS), $(eval $(call SDIR_template,$(SDIR),distclean)))
$(MKDEP): $(TOPDIR)/tools/mkdeps.c
$(HOSTCC) $(HOSTINCLUDES) $(HOSTCFLAGS) $< -o $@
$(INCDIR): $(TOPDIR)/tools/incdir.c
$(HOSTCC) $(HOSTINCLUDES) $(HOSTCFLAGS) $< -o $@
IMPORT_TOOLS = $(MKDEP) $(INCDIR)
# In the KERNEL build, we must build and install all of the modules. No
# symbol table is needed
ifeq ($(CONFIG_BUILD_KERNEL),y)
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
.import: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) $(MAKE) install
import: $(IMPORT_TOOLS)
$(Q) $(MAKE) context TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) register TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) depend TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
else
# In FLAT and protected modes, the modules have already been created. A
# symbol table is required.
ifeq ($(CONFIG_BUILD_LOADABLE),)
$(BIN): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) for app in ${CONFIGURED_APPS}; do \
$(MAKE) -C "$${app}" archive ; \
done
else
$(SYMTABSRC): $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_all)
$(Q) for app in ${CONFIGURED_APPS}; do \
$(MAKE) -C "$${app}" archive ; \
done
$(Q) $(MAKE) install
$(Q) $(APPDIR)$(DELIM)tools$(DELIM)mksymtab.sh $(BINDIR) >$@.tmp
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
$(SYMTABOBJ): %$(OBJEXT): %.c
$(call COMPILE, -fno-lto $<, $@)
$(BIN): $(SYMTABOBJ)
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
$(call ARCHIVE_ADD, "${shell cygpath -w $(BIN)}", $^)
else
$(call ARCHIVE_ADD, $(BIN), $^)
endif
endif # !CONFIG_BUILD_LOADABLE
install: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_install)
# Link nuttx
HEAD_OBJ += $(wildcard $(APPDIR)$(DELIM)import$(DELIM)startup$(DELIM)*$(OBJEXT))
HEAD_OBJ += $(wildcard $(APPDIR)$(DELIM)builtin$(DELIM)*$(OBJEXT))
.import: $(BIN) install
$(Q) echo "LD: nuttx"
$(Q) $(LD) --entry=__start $(LDFLAGS) $(LDLIBPATH) $(EXTRA_LIBPATHS) \
-L$(APPDIR)$(DELIM)import$(DELIM)scripts -T$(LDNAME) \
-o nuttx$(EXEEXT) $(HEAD_OBJ) $(EXTRA_OBJS) $(LDSTARTGROUP) \
$(BIN) $(LDLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
ifeq ($(CONFIG_INTELHEX_BINARY),y)
$(Q) echo "CP: nuttx.hex"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx$(EXEEXT) nuttx.hex
endif
ifeq ($(CONFIG_RAW_BINARY),y)
$(Q) echo "CP: nuttx.bin"
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx$(EXEEXT) nuttx.bin
endif
$(call POSTBUILD, $(APPDIR))
import: $(IMPORT_TOOLS)
$(Q) $(MAKE) context TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) register TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) depend TOPDIR="$(APPDIR)$(DELIM)import"
$(Q) $(MAKE) .import TOPDIR="$(APPDIR)$(DELIM)import"
endif # CONFIG_BUILD_KERNEL
dirlinks:
$(Q) $(MAKE) -C platform dirlinks
context_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_context)
register_all: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_register)
context:
$(Q) $(MAKE) context_all
$(Q) $(MAKE) register_all
Kconfig:
$(foreach SDIR, $(CONFIGDIRS), $(call MAKE_template,$(SDIR),preconfig))
$(Q) $(MKKCONFIG)
preconfig: Kconfig
export:
ifneq ($(EXPORTDIR),)
ifneq ($(BUILTIN_REGISTRY),)
$(Q) mkdir -p "${EXPORTDIR}"/registry || exit 1; \
for f in "${BUILTIN_REGISTRY}"/*.bdat "${BUILTIN_REGISTRY}"/*.pdat ; do \
[ -f "$${f}" ] && cp -f "$${f}" "${EXPORTDIR}"/registry ; \
done
endif
endif
.depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
.depend: Makefile .depdirs
$(Q) touch $@
depend: .depend
clean_context:
$(Q) $(MAKE) -C platform clean_context
$(Q) $(MAKE) -C builtin clean_context
clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
$(call CLEAN)
distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) ( if exist external ( \
echo ********************************************************" \
echo * The external directory/link must be removed manually *" \
echo ********************************************************" \
)
else
$(Q) ( if [ -e external ]; then \
echo "********************************************************"; \
echo "* The external directory/link must be removed manually *"; \
echo "********************************************************"; \
fi; \
)
endif
$(call DELFILE, .depend)
$(call DELFILE, $(SYMTABSRC))
$(call DELFILE, $(SYMTABOBJ))
$(call DELFILE, $(BIN))
$(call DELFILE, Kconfig)
$(call DELDIR, $(BINDIR))
$(call CLEAN)
@@ -0,0 +1,608 @@
/****************************************************************************
* apps/examples/sx127x_demo/sx127x_demo.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/**
* @file sx127x_demo.c
* @brief nuttx source code
* https://github.com/apache/incubator-nuttx-apps
* @version 10.2.0
* @author AIIT XUOS Lab
* @date 2022-03-17
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <debug.h>
#include <poll.h>
#include <fcntl.h>
#include <nuttx/wireless/lpwan/sx127x.h>
#include <nuttx/input/buttons.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifdef CONFIG_ADAPTER_SX1278_DRIVER
# define DEV_NAME CONFIG_ADAPTER_SX1278_DRIVER
#else
# define DEV_NAME "/dev/sx127x"
#endif
#define TX_BUFFER_MAX 255
/****************************************************************************
* Private Types
****************************************************************************/
enum app_mode_e
{
APP_MODE_RX = 0,
APP_MODE_TX = 1,
APP_MODE_RXTX = 2,
APP_MODE_SCAN = 3
};
enum app_modulation_e
{
APP_MODULATION_LORA = 0,
APP_MODULATION_FSK = 1,
APP_MODULATION_OOK = 2,
};
/* Application arguments */
struct args_s
{
uint32_t frequency;
int16_t interval;
int16_t time;
uint8_t app_mode;
uint8_t modulation;
uint8_t datalen;
int8_t power;
};
/****************************************************************************
* Private Data
****************************************************************************/
struct args_s g_args;
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: sx127x_help
****************************************************************************/
static void sx127x_help(FAR struct args_s *args)
{
printf("Usage: sx127x [OPTIONS]\n\n");
printf(" [-m modulation] modulation scheme (default=0)\n");
printf(" 0 - LORA\n");
printf(" 1 - FSK\n");
printf(" 2 - OOK\n");
printf(" [-f frequency Hz] RF frequency (default=%d)\n",
CONFIG_EXAMPLES_SX127X_RFFREQ);
printf(" [-i interval sec] radio access time interval (default=%d)\n",
CONFIG_EXAMPLES_SX127X_INTERVAL);
printf(" [-l datalen] data length for TX (default=%d)\n",
CONFIG_EXAMPLES_SX127X_TXDATA);
printf(" [-d time sec] demo time, 0 if infinity (default=%d)\n",
CONFIG_EXAMPLES_SX127X_TIME);
printf(" [-r/-t/-x/-s] select app mode (default=r)\n");
printf(" r - RX\n");
printf(" t - TX\n");
printf(" x - RX/TX (not supported yet)\n");
printf(" s - SCAN\n");
printf(" [-p power dBm] TX power (default=%d)\n",
CONFIG_EXAMPLES_SX127X_TXPOWER);
printf(" [-h] print this message\n");
}
/****************************************************************************
* Name: arg_string
****************************************************************************/
static int arg_string(FAR char **arg, FAR char **value)
{
FAR char *ptr = *arg;
if (ptr[2] == '\0')
{
*value = arg[1];
return 2;
}
else
{
*value = &ptr[2];
return 1;
}
}
/****************************************************************************
* Name: arg_decimal
****************************************************************************/
static int arg_decimal(FAR char **arg, FAR int *value)
{
FAR char *string;
int ret;
ret = arg_string(arg, &string);
*value = atoi(string);
return ret;
}
/****************************************************************************
* Name: parse_args
****************************************************************************/
static void parse_args(FAR struct args_s *args, int argc, FAR char **argv)
{
FAR char *ptr;
int index;
int nargs;
int i_value;
for (index = 1; index < argc; )
{
ptr = argv[index];
if (ptr[0] != '-')
{
printf("Invalid options format: %s\n", ptr);
exit(0);
}
switch (ptr[1])
{
/* Interval between RX/TX operations */
case 'i':
{
nargs = arg_decimal(&argv[index], &i_value);
index += nargs;
args->interval = i_value;
break;
}
/* Demo time */
case 'd':
{
nargs = arg_decimal(&argv[index], &i_value);
index += nargs;
args->time = i_value;
break;
}
/* Data length for TX */
case 'l':
{
nargs = arg_decimal(&argv[index], &i_value);
index += nargs;
args->datalen = i_value;
break;
}
/* Modem RF frequency */
case 'f':
{
nargs = arg_decimal(&argv[index], &i_value);
index += nargs;
args->frequency = i_value;
break;
}
/* Modem modulation scheme */
case 'm':
{
nargs = arg_decimal(&argv[index], &i_value);
index += nargs;
args->modulation = i_value;
break;
}
/* Modem TX power */
case 'p':
{
nargs = arg_decimal(&argv[index], &i_value);
index += nargs;
args->power = i_value;
break;
}
/* RX mode */
case 'r':
{
args->app_mode = APP_MODE_RX;
index += 1;
break;
}
/* TX mode */
case 't':
{
args->app_mode = APP_MODE_TX;
index += 1;
break;
}
/* RX-TX mode */
case 'x':
{
args->app_mode = APP_MODE_RXTX;
index += 1;
break;
}
/* Scan mode */
case 's':
{
args->app_mode = APP_MODE_SCAN;
index += 1;
break;
}
/* Print help message */
case 'h':
{
sx127x_help(args);
exit(0);
}
/* Unsupported option */
default:
{
printf("Unsupported option: %s\n", ptr);
sx127x_help(args);
exit(1);
}
}
}
}
/****************************************************************************
* Name: validate_args
****************************************************************************/
static int validate_args(FAR struct args_s *args)
{
int ret = OK;
/* TODO */
return ret;
}
/****************************************************************************
* Name: print_hex
****************************************************************************/
static void print_hex(uint8_t *data, int len)
{
int i;
if (len == 0)
{
printf("empty buffer!\n");
}
else
{
for (i = 0 ; i < len ; i += 1)
{
printf("0x%02x ", data[i]);
if ((i + 1) % 10 == 0)
{
printf("\n");
}
}
}
printf("\n");
}
/****************************************************************************
* Name: modulation_set
****************************************************************************/
static int modulation_set(int fd, uint8_t modulation)
{
int ret = OK;
switch (modulation)
{
case APP_MODULATION_LORA:
{
printf("LORA modulation\n");
modulation = SX127X_MODULATION_LORA;
ret = ioctl(fd, SX127XIOC_MODULATIONSET,
(unsigned long)&modulation);
if (ret < 0)
{
printf("failed change modulation %d!\n", ret);
goto errout;
}
break;
}
case APP_MODULATION_FSK:
{
printf("FSK modulation\n");
modulation = SX127X_MODULATION_FSK;
ret = ioctl(fd, SX127XIOC_MODULATIONSET,
(unsigned long)&modulation);
if (ret < 0)
{
printf("failed change modulation %d!\n", ret);
goto errout;
}
break;
}
case APP_MODULATION_OOK:
{
printf("OOK modulation\n");
modulation = SX127X_MODULATION_OOK;
ret = ioctl(fd, SX127XIOC_MODULATIONSET,
(unsigned long)&modulation);
if (ret < 0)
{
printf("failed change modulation %d!\n", ret);
goto errout;
}
break;
}
default:
{
printf("Unsupported app modulation %d!\n", modulation);
goto errout;
}
}
errout:
return ret;
}
/****************************************************************************
* Public Functions
****************************************************************************/
int main(int argc, FAR char *argv[])
{
#ifdef CONFIG_LPWAN_SX127X_RXSUPPORT
struct sx127x_read_hdr_s data;
#endif
struct sx127x_chanscan_ioc_s chanscan;
struct args_s *args;
struct timespec tstart;
struct timespec tnow;
uint8_t buffer[TX_BUFFER_MAX];
uint8_t opmode;
uint8_t i;
int ret;
int fd;
/* Initialize buffer with data */
for (i = 0; i < TX_BUFFER_MAX; i += 1)
{
buffer[i] = i;
}
/* Initialize variables */
args = &g_args;
args->app_mode = APP_MODE_RX;
args->modulation = APP_MODULATION_LORA;
args->frequency = CONFIG_EXAMPLES_SX127X_RFFREQ;
args->power = CONFIG_EXAMPLES_SX127X_TXPOWER;
args->interval = CONFIG_EXAMPLES_SX127X_INTERVAL;
args->time = CONFIG_EXAMPLES_SX127X_TIME;
args->datalen = CONFIG_EXAMPLES_SX127X_TXDATA;
/* Parse the command line */
parse_args(args, argc, argv);
/* Validate arguments */
ret = validate_args(args);
if (ret != OK)
{
printf("sx127x_main: validate arguments failed!\n");
goto errout;
}
printf("Start sx127x_demo\n");
/* Open device */
fd = open(DEV_NAME, O_RDWR);
if (fd < 0)
{
int errcode = errno;
printf("ERROR: Failed to open device %s: %d\n", DEV_NAME, errcode);
goto errout;
}
/* Get start time */
clock_gettime(CLOCK_REALTIME, &tstart);
while (1)
{
switch (args->app_mode)
{
#ifdef CONFIG_LPWAN_SX127X_TXSUPPORT
/* Transmit some data */
case APP_MODE_TX:
{
printf("\nSend %d bytes\n", args->datalen);
ret = write(fd, buffer, args->datalen);
if (ret < 0)
{
printf("write failed %d!\n", ret);
goto errout;
}
break;
}
#endif
#ifdef CONFIG_LPWAN_SX127X_RXSUPPORT
/* Receive data */
case APP_MODE_RX:
{
printf("Waiting for data\n");
ret = read(fd, &data, sizeof(struct sx127x_read_hdr_s));
if (ret < 0)
{
printf("Read failed %d!\n", ret);
goto errout;
}
printf("\nReceived:\n");
printf("SNR = %d\n", data.snr);
printf("RSSI = %d\n", data.rssi);
printf("len = %d\n", data.datalen);
print_hex(data.data, data.datalen);
printf("\n");
break;
}
#endif
/* Send some data and wait for response */
case APP_MODE_RXTX:
{
printf("TODO: APP RXTX\n");
break;
}
/* Scan channel */
case APP_MODE_SCAN:
{
/* TODO: Configure this from command line */
chanscan.freq = args->frequency;
chanscan.rssi_thr = -30;
chanscan.stime = 2;
chanscan.free = false;
chanscan.rssi_max = 0;
ret = ioctl(fd, SX127XIOC_CHANSCAN, (unsigned long)&chanscan);
if (ret < 0)
{
printf("failed chanscan %d!\n", ret);
goto errout;
}
printf("freq = %" PRId32 " max = %d min = %d free = %d\n",
chanscan.freq,
chanscan.rssi_max, chanscan.rssi_min, chanscan.free);
break;
}
default:
{
printf("Unsupported app mode!\n");
goto errout;
}
}
printf("wait %d sec ...\n", args->interval);
sleep(args->interval);
if (args->time > 0)
{
/* Get time now */
clock_gettime(CLOCK_REALTIME, &tnow);
if (tnow.tv_sec - tstart.tv_sec >= args->time)
{
printf("Timeout - force exit!\n");
goto errout;
}
}
}
errout:
close(fd);
return 0;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,116 @@
############################################################################
# apps/nshlib/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(APPDIR)/Make.defs
# NSH Library
CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_script.c nsh_system.c
CSRCS += nsh_command.c nsh_fscmds.c nsh_ddcmd.c nsh_proccmds.c nsh_mmcmds.c
CSRCS += nsh_timcmds.c nsh_envcmds.c nsh_syscmds.c nsh_dbgcmds.c nsh_Applicationscmd.c
ifeq ($(CONFIG_FILE_STREAM),y)
CSRCS += nsh_session.c
ifeq ($(CONFIG_NSH_CONSOLE_LOGIN),y)
CSRCS += nsh_login.c
endif
else
CSRCS += nsh_stdsession.c
ifeq ($(CONFIG_NSH_CONSOLE_LOGIN),y)
CSRCS += nsh_stdlogin.c
endif
endif
CSRCS += nsh_fsutils.c
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
CSRCS += nsh_builtin.c
endif
ifeq ($(CONFIG_NSH_FILE_APPS),y)
CSRCS += nsh_fileapps.c
endif
ifeq ($(CONFIG_NSH_VARS),y)
CSRCS += nsh_vars.c
endif
ifeq ($(CONFIG_NSH_ROMFSETC),y)
CSRCS += nsh_romfsetc.c
endif
ifeq ($(CONFIG_NET),y)
CSRCS += nsh_netcmds.c
ifeq ($(CONFIG_NET_ROUTE),y)
CSRCS += nsh_routecmds.c
endif
endif
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += nsh_mntcmds.c
endif
ifeq ($(CONFIG_MODULE),y)
ifneq ($(CONFIG_NSH_DISABLE_MODCMDS),y)
CSRCS += nsh_modcmds.c
endif
endif
ifeq ($(CONFIG_NSH_CONSOLE),y)
CSRCS += nsh_consolemain.c
endif
ifneq ($(CONFIG_NSH_DISABLE_PRINTF),y)
CSRCS += nsh_printf.c
endif
ifeq ($(CONFIG_NSH_TELNET),y)
CSRCS += nsh_telnetd.c
ifeq ($(CONFIG_NSH_TELNET_LOGIN),y)
CSRCS += nsh_telnetlogin.c
endif
endif
ifneq ($(CONFIG_NSH_DISABLESCRIPT),y)
CSRCS += nsh_test.c
endif
ifeq ($(CONFIG_USBDEV),y)
CSRCS += nsh_usbconsole.c
endif
ifeq ($(CONFIG_NSH_ALTCONDEV),y)
CSRCS += nsh_altconsole.c
endif
ifeq ($(CONFIG_NSH_USBDEV_TRACE),y)
CSRCS += nsh_usbtrace.c
endif
ifeq ($(CONFIG_NETUTILS_CODECS),y)
CSRCS += nsh_codeccmd.c
endif
ifeq ($(CONFIG_NSH_LOGIN_PASSWD),y)
CSRCS += nsh_passwdcmds.c
endif
include $(APPDIR)/Application.mk
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,294 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file nsh_Applicationscmd.c
* @brief nsh cmd function support
* @version 1.0
* @author AIIT XUOS Lab
* @date 2022.03.17
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <libgen.h>
#include <errno.h>
#include <debug.h>
#include "nsh.h"
#include "nsh_console.h"
extern int FrameworkInit(void);
/****************************************************************************
* Name: cmd_Hcho1os
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_HCHO_TB600B_WQ_HCHO1OS) && !defined(CONFIG_NSH_DISABLE_HCHO_TB600B_WQ_HCHO1OS)
extern void HchoTb600bHcho1os(void);
int cmd_Hcho1os(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
HchoTb600bHcho1os();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_Tvoc10
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_TVOC_TB600B_TVOC10) && !defined(CONFIG_NSH_DISABLE_TB600B_TVOC10)
extern void TvocTb600bTvoc10(void);
int cmd_Tvoc10(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
TvocTb600bTvoc10();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_Iaq10
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_IAQ) && !defined(CONFIG_NSH_DISABLE_TB600B_IAQ10)
extern void IaqTb600bIaq10(void);
int cmd_Iaq10(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
IaqTb600bIaq10();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_As830
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_CH4_AS830) && !defined(CONFIG_NSH_DISABLE_CH4_AS830)
extern void Ch4As830(void);
int cmd_As830(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
Ch4As830();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_Co2Zg09
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_CO2_ZG09) && !defined(CONFIG_NSH_DISABLE_CO2ZG09)
extern void Co2Zg09(void);
int cmd_Co2Zg09(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
Co2Zg09();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_Pm10Ps5308
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_PM1_0_PS5308) && !defined(CONFIG_NSH_DISABLE_PM1_0PS5308)
extern void Pm10Ps5308(void);
int cmd_Pm10Ps5308(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
Pm10Ps5308();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_Pm25Ps5308
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_PM2_5_PS5308) && !defined(CONFIG_NSH_DISABLE_PM2_5PS5308)
extern void Pm25Ps5308(void);
int cmd_Pm25Ps5308(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
Pm25Ps5308();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_Pm10Ps5308
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_PM10_PS5308) && !defined(CONFIG_NSH_DISABLE_PM10PS5308)
extern void Pm100Ps5308(void);
int cmd_Pm100Ps5308(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
Pm100Ps5308();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_VoiceD124
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_VOICE_D124) && !defined(CONFIG_NSH_DISABLE_VOICED124)
extern void VoiceD124(void);
int cmd_VoiceD124(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
VoiceD124();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_TempHs300x
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_TEMPERATURE_HS300X) && !defined(CONFIG_NSH_DISABLE_TEMPHS300X)
extern void TempHs300x(void);
int cmd_TempHs300x(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
TempHs300x();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_HumiHs300x
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_HUMIDITY_HS300X) && !defined(CONFIG_NSH_DISABLE_HUMIHS300X)
extern void HumiHs300x(void);
int cmd_HumiHs300x(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
HumiHs300x();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_WindDirectionQsFx
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_WINDDIRECTION_QS_FX) && !defined(CONFIG_NSH_DISABLE_QS_FX)
extern void WindDirectionQsFx(void);
int cmd_WindDirectionQsFx(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
WindDirectionQsFx();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_WindSpeedQsFs
****************************************************************************/
#if defined(CONFIG_APPLICATION_SENSOR_WINDSPEED_QS_FS) && !defined(CONFIG_NSH_DISABLE_QS_FS)
extern void WindSpeedQsFs(void);
int cmd_WindSpeedQsFs(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
WindSpeedQsFs();
return OK;
}
#endif
/****************************************************************************
* Name: cmd_openzigbee
****************************************************************************/
#if defined(CONFIG_CONNECTION_ADAPTER_ZIGBEE) && !defined(CONFIG_NSH_DISABLE_OPENZIGBEE)
extern int openzigbee(void);
int cmd_openzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
openzigbee();
return OK;
}
#endif
#if defined(CONFIG_CONNECTION_ADAPTER_ZIGBEE) && !defined(CONFIG_NSH_DISABLE_SENDZIGBEE)
extern int sendzigbee(int argc, char *argv[]);
int cmd_sendzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
sendzigbee(argc,argv);
return OK;
}
#endif
#if defined(CONFIG_CONNECTION_ADAPTER_ZIGBEE) && !defined(CONFIG_NSH_DISABLE_RECVZIGBEE)
extern int recvzigbee(void);
int cmd_recvzigbee(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
recvzigbee();
return OK;
}
#endif
#if defined(CONFIG_ADAPTER_SX1278) && !defined(CONFIG_NSH_DISABLE_ADAPTER_LORATEST)
extern int AdapterLoraTest(void);
int cmd_AdapterLoraTest(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, world!\n");
FrameworkInit();
AdapterLoraTest();
return OK;
}
#endif
#if defined(CONFIG_K210_FFT_TEST) && !defined(CONFIG_NSH_DISABLE_K210_FFT)
extern void nuttx_k210_fft_test(void);
int cmd_fft(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{
nsh_output(vtbl, "Hello, fft!\n");
nuttx_k210_fft_test();
return OK;
}
#endif
File diff suppressed because it is too large Load Diff