mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
Add support for a BOARDIOC_RESET boardctl() command. Enable configuration options to support BOARDIOC_RESET for ARMv6-M and ARMv7-M
This commit is contained in:
@@ -159,6 +159,10 @@ config ARCH_HAVE_POWEROFF
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config ARCH_HAVE_RESET
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
config ARCH_USE_MMU
|
config ARCH_USE_MMU
|
||||||
bool "Enable MMU"
|
bool "Enable MMU"
|
||||||
default n
|
default n
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ config ARCH_CORTEXM0
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
select ARCH_HAVE_IRQPRIO
|
select ARCH_HAVE_IRQPRIO
|
||||||
|
select ARCH_HAVE_RESET
|
||||||
|
|
||||||
config ARCH_CORTEXM3
|
config ARCH_CORTEXM3
|
||||||
bool
|
bool
|
||||||
@@ -240,6 +241,7 @@ config ARCH_CORTEXM3
|
|||||||
select ARCH_HAVE_IRQPRIO
|
select ARCH_HAVE_IRQPRIO
|
||||||
select ARCH_HAVE_RAMVECTORS
|
select ARCH_HAVE_RAMVECTORS
|
||||||
select ARCH_HAVE_HIPRI_INTERRUPT
|
select ARCH_HAVE_HIPRI_INTERRUPT
|
||||||
|
select ARCH_HAVE_RESET
|
||||||
|
|
||||||
config ARCH_CORTEXM4
|
config ARCH_CORTEXM4
|
||||||
bool
|
bool
|
||||||
@@ -247,6 +249,7 @@ config ARCH_CORTEXM4
|
|||||||
select ARCH_HAVE_IRQPRIO
|
select ARCH_HAVE_IRQPRIO
|
||||||
select ARCH_HAVE_RAMVECTORS
|
select ARCH_HAVE_RAMVECTORS
|
||||||
select ARCH_HAVE_HIPRI_INTERRUPT
|
select ARCH_HAVE_HIPRI_INTERRUPT
|
||||||
|
select ARCH_HAVE_RESET
|
||||||
|
|
||||||
config ARCH_CORTEXM7
|
config ARCH_CORTEXM7
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -42,19 +42,21 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "nvic.h"
|
#include "nvic.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Public functions
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Types
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public functions
|
* Name: up_systemreset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Internal, Cortex-M0 reset logic.
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_systemreset(void)
|
void up_systemreset(void)
|
||||||
@@ -76,3 +78,32 @@ 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
|
||||||
|
|
||||||
|
|||||||
@@ -42,19 +42,21 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <nuttx/board.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "nvic.h"
|
#include "nvic.h"
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Public functions
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Types
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public functions
|
* Name: up_systemreset
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Internal, Cortex-M0 reset logic.
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_systemreset(void)
|
void up_systemreset(void)
|
||||||
@@ -77,3 +79,31 @@ 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
|
||||||
|
|||||||
@@ -56,8 +56,8 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static jmp_buf sim_abort;
|
static jmp_buf g_simabort;
|
||||||
static int retcode = EXIT_SUCCESS;
|
static int g_exitcode = EXIT_SUCCESS;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Global Functions
|
* Global Functions
|
||||||
@@ -83,7 +83,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
|
|
||||||
/* Then start NuttX */
|
/* Then start NuttX */
|
||||||
|
|
||||||
if (setjmp(sim_abort) == 0)
|
if (setjmp(g_simabort) == 0)
|
||||||
{
|
{
|
||||||
os_start();
|
os_start();
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ int main(int argc, char **argv, char **envp)
|
|||||||
/* Restore the original terminal mode and return the exit code */
|
/* Restore the original terminal mode and return the exit code */
|
||||||
|
|
||||||
simuart_teriminate();
|
simuart_teriminate();
|
||||||
return retcode;
|
return g_exitcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -117,8 +117,8 @@ void up_assert(const uint8_t *filename, int line)
|
|||||||
|
|
||||||
/* Exit the simulation */
|
/* Exit the simulation */
|
||||||
|
|
||||||
retcode = EXIT_FAILURE;
|
g_exitcode = EXIT_FAILURE;
|
||||||
longjmp(sim_abort, 1);
|
longjmp(g_simabort, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -143,8 +143,8 @@ int board_power_off(int status)
|
|||||||
{
|
{
|
||||||
/* Save the return code and exit the simulation */
|
/* Save the return code and exit the simulation */
|
||||||
|
|
||||||
retcode = status;
|
g_exitcode = status;
|
||||||
longjmp(sim_abort, 1);
|
longjmp(g_simabort, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule configs updated: 3da43c3250...5711543356
+26
-1
@@ -156,7 +156,9 @@ int board_app_initialize(void);
|
|||||||
* particular board architecture.
|
* particular board architecture.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* status - Status information provided with the power off event.
|
* 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_power_off.
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -169,6 +171,29 @@ int board_app_initialize(void);
|
|||||||
int board_power_off(int status);
|
int board_power_off(int status);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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);
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: board_tsc_setup
|
* Name: board_tsc_setup
|
||||||
*
|
*
|
||||||
|
|||||||
+13
-6
@@ -64,6 +64,12 @@
|
|||||||
* CONFIGURATION: CONFIG_BOARDCTL_POWEROFF
|
* CONFIGURATION: CONFIG_BOARDCTL_POWEROFF
|
||||||
* DEPENDENCIES: Board logic must provide board_power_off
|
* DEPENDENCIES: Board logic must provide board_power_off
|
||||||
*
|
*
|
||||||
|
* CMD: BOARDIOC_RESET
|
||||||
|
* DESCRIPTION: Reset the board
|
||||||
|
* ARG: Integer value providing power off status information
|
||||||
|
* CONFIGURATION: CONFIG_BOARDCTL_RESET
|
||||||
|
* DEPENDENCIES: Board logic must provide board_reset
|
||||||
|
*
|
||||||
* CMD: BOARDIOC_TSCTEST_SETUP
|
* CMD: BOARDIOC_TSCTEST_SETUP
|
||||||
* DESCRIPTION: Touchscreen controller test configuration
|
* DESCRIPTION: Touchscreen controller test configuration
|
||||||
* ARG: Touch controller device minor number
|
* ARG: Touch controller device minor number
|
||||||
@@ -98,11 +104,12 @@
|
|||||||
|
|
||||||
#define BOARDIOC_INIT _BOARDIOC(0x0001)
|
#define BOARDIOC_INIT _BOARDIOC(0x0001)
|
||||||
#define BOARDIOC_POWEROFF _BOARDIOC(0x0002)
|
#define BOARDIOC_POWEROFF _BOARDIOC(0x0002)
|
||||||
#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0003)
|
#define BOARDIOC_RESET _BOARDIOC(0x0003)
|
||||||
#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0004)
|
#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0004)
|
||||||
#define BOARDIOC_ADCTEST_SETUP _BOARDIOC(0x0005)
|
#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0005)
|
||||||
#define BOARDIOC_PWMTEST_SETUP _BOARDIOC(0x0006)
|
#define BOARDIOC_ADCTEST_SETUP _BOARDIOC(0x0006)
|
||||||
#define BOARDIOC_GRAPHICS_SETUP _BOARDIOC(0x0007)
|
#define BOARDIOC_PWMTEST_SETUP _BOARDIOC(0x0007)
|
||||||
|
#define BOARDIOC_GRAPHICS_SETUP _BOARDIOC(0x0008)
|
||||||
|
|
||||||
/* If CONFIG_BOARDCTL_IOCTL=y, then boad-specific commands will be support.
|
/* If CONFIG_BOARDCTL_IOCTL=y, then boad-specific commands will be support.
|
||||||
* In this case, all commands not recognized by boardctl() will be forwarded
|
* In this case, all commands not recognized by boardctl() will be forwarded
|
||||||
@@ -111,7 +118,7 @@
|
|||||||
* User defined board commands may begin with this value:
|
* User defined board commands may begin with this value:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BOARDIOC_USER _BOARDIOC(0x0008)
|
#define BOARDIOC_USER _BOARDIOC(0x0009)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Definitions
|
* Public Type Definitions
|
||||||
|
|||||||
Reference in New Issue
Block a user