From fdd515ee991245b6cd501227ceaf81db7d204937 Mon Sep 17 00:00:00 2001 From: Bill Gatliff Date: Tue, 26 Mar 2019 06:57:23 -0600 Subject: [PATCH] configs/omnibusf4: Add board_ioctl() which is needed only if CONFIG_BOARDCTL_IOCTL=y is selected; Update NSH configuration to enable board IOCTLs and DFU mode reset. --- configs/omnibusf4/nsh/defconfig | 3 +- configs/omnibusf4/src/Makefile | 3 + configs/omnibusf4/src/stm32_appinit.c | 2 +- configs/omnibusf4/src/stm32_ioctl.c | 91 +++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 configs/omnibusf4/src/stm32_ioctl.c diff --git a/configs/omnibusf4/nsh/defconfig b/configs/omnibusf4/nsh/defconfig index f65113c166..65c48146a3 100644 --- a/configs/omnibusf4/nsh/defconfig +++ b/configs/omnibusf4/nsh/defconfig @@ -20,6 +20,8 @@ CONFIG_ARCH_CHIP_STM32=y CONFIG_ARCH_CHIP_STM32F405RG=y CONFIG_ARCH_STACKDUMP=y CONFIG_ARMV7M_LAZYFPU=y +CONFIG_BOARDCTL_IOCTL=y +CONFIG_BOARDCTL_RESET=y CONFIG_BOARDCTL_USBDEVCTRL=y CONFIG_BOARD_LOOPSPERMSEC=16717 CONFIG_BUILTIN=y @@ -32,7 +34,6 @@ CONFIG_DEV_URANDOM=y CONFIG_DEV_ZERO=y CONFIG_DISABLE_POLL=y CONFIG_DRIVERS_VIDEO=y -CONFIG_EXAMPLES_DFU=y CONFIG_EXAMPLES_HELLO=y CONFIG_EXAMPLES_HELLOXX=y CONFIG_EXAMPLES_LEDS=y diff --git a/configs/omnibusf4/src/Makefile b/configs/omnibusf4/src/Makefile index a9d5fbf7cb..f54a5c67e2 100644 --- a/configs/omnibusf4/src/Makefile +++ b/configs/omnibusf4/src/Makefile @@ -70,6 +70,9 @@ CSRCS += stm32_appinit.c ifeq ($(CONFIG_BOARDCTL_RESET),y) CSRCS += stm32_reset.c endif +ifeq ($(CONFIG_BOARDCTL_IOCTL),y) +CSRCS += stm32_ioctl.c +endif endif ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y) diff --git a/configs/omnibusf4/src/stm32_appinit.c b/configs/omnibusf4/src/stm32_appinit.c index a42434e17c..93db30e3a5 100644 --- a/configs/omnibusf4/src/stm32_appinit.c +++ b/configs/omnibusf4/src/stm32_appinit.c @@ -2,7 +2,7 @@ * config/omnibusf4/src/stm32_appinit.c * * Copyright (C) 2019 Bill Gatliff. All rights reserved. - * Copyright (C) 2012, 2014, 2016, 20018 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Bill Gatliff * Author: Gregory Nutt * diff --git a/configs/omnibusf4/src/stm32_ioctl.c b/configs/omnibusf4/src/stm32_ioctl.c new file mode 100644 index 0000000000..4304b96d00 --- /dev/null +++ b/configs/omnibusf4/src/stm32_ioctl.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * config/omnibusf4/src/stm32_appinit.c + * + * Copyright (C) 2019 Bill Gatliff. All rights reserved. + * Copyright (C) 2019 Gregory Nutt. All rights reserved. + * Author: Bill Gatliff + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include "omnibusf4.h" + +#ifdef CONFIG_BOARDCTL_IOCTL + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_ioctl + * + * Description: + * The "landing site" for much of the boardctl() interface. Generic board- + * control functions invoked via ioctl() get routed through here. + * + * Since we don't do anything unusual at the moment, this function + * accomplishes nothing except avoid a missing-function linker error if + * CONFIG_BOARDCTL_IOCTL is selected. + * + * Input Parameters: + * cmd - IOCTL command being requested. + * arg - Arguments for the IOCTL. + * + * Returned Value: + * we don't yet support any boardctl IOCTLs. This function always returns + * -ENOTTY which is the standard IOCTL return value when a command is not + * supported + * + ****************************************************************************/ + +int board_ioctl(unsigned int cmd, uintptr_t arg) +{ + switch (cmd) + { + default: + return -ENOTTY; + } + + return OK; +} + +#endif /* CONFIG_BOARDCTL_IOCTL */