From 6499ec3e94522a672f3dd52b40af3af05db04e88 Mon Sep 17 00:00:00 2001 From: Bill Gatliff Date: Mon, 25 Mar 2019 10:44:49 -0600 Subject: [PATCH] configs/omnibusf4/src/stm32_reset: Add boardctl() reset logic. --- configs/omnibusf4/src/Makefile | 3 ++ configs/omnibusf4/src/stm32_reset.c | 73 +++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 configs/omnibusf4/src/stm32_reset.c diff --git a/configs/omnibusf4/src/Makefile b/configs/omnibusf4/src/Makefile index 175e918e3e..a9d5fbf7cb 100644 --- a/configs/omnibusf4/src/Makefile +++ b/configs/omnibusf4/src/Makefile @@ -67,6 +67,9 @@ endif ifeq ($(CONFIG_LIB_BOARDCTL),y) CSRCS += stm32_appinit.c +ifeq ($(CONFIG_BOARDCTL_RESET),y) +CSRCS += stm32_reset.c +endif endif ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y) diff --git a/configs/omnibusf4/src/stm32_reset.c b/configs/omnibusf4/src/stm32_reset.c new file mode 100644 index 0000000000..86c1024e5e --- /dev/null +++ b/configs/omnibusf4/src/stm32_reset.c @@ -0,0 +1,73 @@ +/**************************************************************************** + * configs/omnibusf4/src/stm32_reset.c + * + * Copyright (C) 2019 Bill Gatliff. All rights reserved. + * Copyright (C) 2011-2012, 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 "stm32_dfumode.h" + +#ifdef CONFIG_BOARDCTL_RESET + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +int board_reset(int mode) +{ + if (mode == 0) + { + /* Normal reset */ + + up_systemreset(); + } + else + { + /* DFU reset */ + + stm32_dfumode(); + } +} + +#endif /* CONFIG_BOARDCTL_RESET */ +