arch/ and config/ files: All board interfaces (those starting with board_) must be defined in board-specific logic. Otherwise, they cannot be customized of specialized usage by different boards. The board_reset() interface was defined in architecture-specific logic that only called up_systemreset(). That is useless!
This change removes the board_reset() implementation from the architecture-specific code and re-implements in the src/ directory of each board that has CONFIG_BOARDCTL_RESET enabled. That is the correct functional partitioning.
This commit is contained in:
parent
101f3bddec
commit
3e6c196ffa
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv6-m/up_systemreset.c
|
* arch/arm/src/armv6-m/up_systemreset.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
* Darcy Gong
|
* Darcy Gong
|
||||||
*
|
*
|
||||||
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
@ -79,31 +80,3 @@ void up_systemreset(void)
|
|||||||
for (; ; );
|
for (; ; );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: board_reset
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Reset board. This function may or may not be supported by a
|
|
||||||
* particular board architecture.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* status - Status information provided with the reset event. This
|
|
||||||
* meaning of this status information is board-specific. If not used by
|
|
||||||
* a board, the value zero may be provided in calls to board_reset.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* If this function returns, then it was not possible to power-off the
|
|
||||||
* board due to some constraints. The return value int this case is a
|
|
||||||
* board-specific reason for the failure to shutdown.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_BOARDCTL_RESET
|
|
||||||
int board_reset(int status)
|
|
||||||
{
|
|
||||||
up_systemreset();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv7-m/up_systemreset.c
|
* arch/arm/src/armv7-m/up_systemreset.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
* Darcy Gong
|
* Darcy Gong
|
||||||
*
|
*
|
||||||
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
@ -79,31 +80,3 @@ void up_systemreset(void)
|
|||||||
|
|
||||||
for (; ; );
|
for (; ; );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: board_reset
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Reset board. This function may or may not be supported by a
|
|
||||||
* particular board architecture.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* status - Status information provided with the reset event. This
|
|
||||||
* meaning of this status information is board-specific. If not used by
|
|
||||||
* a board, the value zero may be provided in calls to board_reset.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* If this function returns, then it was not possible to power-off the
|
|
||||||
* board due to some constraints. The return value int this case is a
|
|
||||||
* board-specific reason for the failure to shutdown.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_BOARDCTL_RESET
|
|
||||||
int board_reset(int status)
|
|
||||||
{
|
|
||||||
up_systemreset();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -331,10 +331,6 @@ void up_pminitialize(void);
|
|||||||
# define up_pminitialize()
|
# define up_pminitialize()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_CORTEXM0) || defined(CONFIG_ARCH_ARMV7M)
|
|
||||||
void up_systemreset(void) noreturn_function;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Interrupt handling *******************************************************/
|
/* Interrupt handling *******************************************************/
|
||||||
|
|
||||||
void up_irqinitialize(void);
|
void up_irqinitialize(void);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/moxart/moxart_systemreset.c
|
* arch/arm/src/moxart/moxart_systemreset.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2015, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Anton D. Kachalov <mouse@mayc.ru>
|
* Author: Anton D. Kachalov <mouse@mayc.ru>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
@ -79,29 +80,3 @@ void up_systemreset(void)
|
|||||||
for (; ; );
|
for (; ; );
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: board_reset
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Reset board. This function may or may not be supported by a
|
|
||||||
* particular board architecture.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* status - Status information provided with the reset event. This
|
|
||||||
* meaning of this status information is board-specific. If not used by
|
|
||||||
* a board, the value zero may be provided in calls to board_reset.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* If this function returns, then it was not possible to power-off the
|
|
||||||
* board due to some constraints. The return value int this case is a
|
|
||||||
* board-specific reason for the failure to shutdown.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_BOARDCTL_RESET
|
|
||||||
int board_reset(int status)
|
|
||||||
{
|
|
||||||
up_systemreset();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
#include <arch/samv7/chip.h>
|
#include <arch/samv7/chip.h>
|
||||||
|
|
||||||
|
@ -261,8 +261,6 @@ void up_pminitialize(void);
|
|||||||
# define up_pminitialize()
|
# define up_pminitialize()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void up_systemreset(void) noreturn_function;
|
|
||||||
|
|
||||||
/* Interrupt handling *******************************************************/
|
/* Interrupt handling *******************************************************/
|
||||||
|
|
||||||
void up_irqinitialize(void);
|
void up_irqinitialize(void);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# configs/freedom-k66f/src/Makefile
|
# configs/freedom-k66f/src/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2016-2017, 2019 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
# David Sidrane <david_s5@nscdg.com>
|
# David Sidrane <david_s5@nscdg.com>
|
||||||
#
|
#
|
||||||
@ -51,6 +51,9 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||||
CSRCS += k66_appinit.c k66_bringup.c
|
CSRCS += k66_appinit.c k66_bringup.c
|
||||||
|
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||||
|
CSRCS += k66_reset.c
|
||||||
|
endif
|
||||||
else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
|
else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
|
||||||
CSRCS += k66_bringup.c
|
CSRCS += k66_bringup.c
|
||||||
endif
|
endif
|
||||||
|
78
configs/freedom-k66f/src/k66_reset.c
Normal file
78
configs/freedom-k66f/src/k66_reset.c
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* config/fredom-k66f/src/k66_reset.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <arch.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARDCTL_RESET
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_reset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Reset board. Support for this function is required by board-level
|
||||||
|
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* status - Status information provided with the reset event. This
|
||||||
|
* meaning of this status information is board-specific. If not
|
||||||
|
* used by a board, the value zero may be provided in calls to
|
||||||
|
* board_reset().
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* If this function returns, then it was not possible to power-off the
|
||||||
|
* board due to some constraints. The return value int this case is a
|
||||||
|
* board-specific reason for the failure to shutdown.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_reset(int status)
|
||||||
|
{
|
||||||
|
up_systemreset();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BOARDCTL_RESET */
|
@ -40,6 +40,9 @@ CSRCS = lc823450_boot.c lc823450_mux.c
|
|||||||
|
|
||||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||||
CSRCS += lc823450_appinit.c lc823450_bringup.c
|
CSRCS += lc823450_appinit.c lc823450_bringup.c
|
||||||
|
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||||
|
CSRCS += lc823450_reset.c
|
||||||
|
endif
|
||||||
else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
|
else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
|
||||||
CSRCS += lc823450_bringup.c
|
CSRCS += lc823450_bringup.c
|
||||||
endif
|
endif
|
||||||
|
78
configs/lc823450-xgevk/src/lc823450_reset.c
Normal file
78
configs/lc823450-xgevk/src/lc823450_reset.c
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* configs/lc823450-xgevk/src/lc823450_reset.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <arch.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARDCTL_RESET
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_reset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Reset board. Support for this function is required by board-level
|
||||||
|
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* status - Status information provided with the reset event. This
|
||||||
|
* meaning of this status information is board-specific. If not
|
||||||
|
* used by a board, the value zero may be provided in calls to
|
||||||
|
* board_reset().
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* If this function returns, then it was not possible to power-off the
|
||||||
|
* board due to some constraints. The return value int this case is a
|
||||||
|
* board-specific reason for the failure to shutdown.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_reset(int status)
|
||||||
|
{
|
||||||
|
up_systemreset();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BOARDCTL_RESET */
|
@ -38,8 +38,11 @@
|
|||||||
ASRCS =
|
ASRCS =
|
||||||
CSRCS = moxart_boot.c
|
CSRCS = moxart_boot.c
|
||||||
|
|
||||||
ifeq ($(CONFIG_NSH_LIBRARY),y)
|
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||||
CSRCS += moxart_appinit.c
|
CSRCS += moxart_appinit.c
|
||||||
|
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||||
|
CSRCS += moxart_reset.c
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(TOPDIR)/configs/Board.mk
|
include $(TOPDIR)/configs/Board.mk
|
||||||
|
78
configs/moxa/src/moxart_reset.c
Normal file
78
configs/moxa/src/moxart_reset.c
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* config/moxa/src/moxart_reset.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <arch.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARDCTL_RESET
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_reset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Reset board. Support for this function is required by board-level
|
||||||
|
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* status - Status information provided with the reset event. This
|
||||||
|
* meaning of this status information is board-specific. If not
|
||||||
|
* used by a board, the value zero may be provided in calls to
|
||||||
|
* board_reset().
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* If this function returns, then it was not possible to power-off the
|
||||||
|
* board due to some constraints. The return value int this case is a
|
||||||
|
* board-specific reason for the failure to shutdown.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_reset(int status)
|
||||||
|
{
|
||||||
|
up_systemreset();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BOARDCTL_RESET */
|
@ -1,7 +1,7 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# configs/stm32f4discovery/src/Makefile
|
# configs/stm32f4discovery/src/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011-2013, 2015-2016, 2018 Gregory Nutt. All rights
|
# Copyright (C) 2011-2013, 2015-2016, 2018-2019 Gregory Nutt. All rights
|
||||||
# reserved.
|
# reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
#
|
#
|
||||||
@ -139,6 +139,9 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||||
CSRCS += stm32_appinit.c
|
CSRCS += stm32_appinit.c
|
||||||
|
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||||
|
CSRCS += stm32_reset.c
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y)
|
ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y)
|
||||||
|
78
configs/stm32f4discovery/src/stm32_reset.c
Normal file
78
configs/stm32f4discovery/src/stm32_reset.c
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* config/stm32f4discovery/src/stm32_reset.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* 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 <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <arch.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOARDCTL_RESET
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: board_reset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Reset board. Support for this function is required by board-level
|
||||||
|
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* status - Status information provided with the reset event. This
|
||||||
|
* meaning of this status information is board-specific. If not
|
||||||
|
* used by a board, the value zero may be provided in calls to
|
||||||
|
* board_reset().
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* If this function returns, then it was not possible to power-off the
|
||||||
|
* board due to some constraints. The return value int this case is a
|
||||||
|
* board-specific reason for the failure to shutdown.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int board_reset(int status)
|
||||||
|
{
|
||||||
|
up_systemreset();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BOARDCTL_RESET */
|
@ -98,6 +98,7 @@
|
|||||||
|
|
||||||
#include <arch/arch.h>
|
#include <arch/arch.h>
|
||||||
|
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
#include <nuttx/cache.h>
|
#include <nuttx/cache.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -189,6 +190,18 @@ EXTERN volatile bool g_rtc_enabled;
|
|||||||
|
|
||||||
void up_initialize(void);
|
void up_initialize(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_systemreset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* The function up_systemreset() will reset the MCU. Optional!
|
||||||
|
* Availability of this function is dependent upon the architecture
|
||||||
|
* support.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void up_systemreset(void) noreturn_function;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_idle
|
* Name: up_idle
|
||||||
*
|
*
|
||||||
|
@ -245,13 +245,14 @@ int board_power_off(int status);
|
|||||||
* Name: board_reset
|
* Name: board_reset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Reset board. This function may or may not be supported by a
|
* Reset board. Support for this function is required by board-level
|
||||||
* particular board architecture.
|
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* status - Status information provided with the reset event. This
|
* status - Status information provided with the reset event. This
|
||||||
* meaning of this status information is board-specific. If not used by
|
* meaning of this status information is board-specific. If not
|
||||||
* a board, the value zero may be provided in calls to board_reset.
|
* used by a board, the value zero may be provided in calls to
|
||||||
|
* board_reset().
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* If this function returns, then it was not possible to power-off the
|
* If this function returns, then it was not possible to power-off the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user