Modify board_power_off() so that is is called only via boardctl()

This commit is contained in:
Gregory Nutt 2015-07-02 17:09:54 -06:00
parent 064b4923c6
commit 27ea02a85f
4 changed files with 62 additions and 45 deletions

View File

@ -2,6 +2,8 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <nuttx/board.h>
@ -17,14 +19,17 @@
* board due to some other constraints.
*
* Input Parameters:
* None
* status - Status information provided with the power off event.
*
* Returned Value:
* None
* 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.
*
****************************************************************************/
void board_power_off(void)
#ifdef CONFIG_BOARDCTL_POWEROFF
void board_power_off(int status)
{
uint16_t tx;
struct spi_dev_s *spi = up_spiinitialize(0);
@ -36,4 +41,8 @@ void board_power_off(void)
tx = (1 << 6) | (30 << 1);
SPI_SNDBLOCK(spi, &tx, 1);
return 0;
}
#endif

@ -1 +1 @@
Subproject commit ec14d18d72612c037efb5cb906628a665dba8a9d
Subproject commit 4bf3b9cd470e9be652cdd69dd4012b8f250dd9ea

View File

@ -234,6 +234,42 @@ int board_adc_setup(void);
int board_pwm_setup(void);
/****************************************************************************
* Name: board_power_off
*
* Description:
* Power off the board. This function may or may not be supported by a
* particular board architecture.
*
* Input Parameters:
* status - Status information provided with the power off event.
*
* 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_POWEROFF
int board_power_off(int status);
#endif
/****************************************************************************
* Name: board_ioctl
*
* Description:
* If CONFIG_LIB_BOARDCTL=y, boards may also select CONFIG_BOARDCTL_IOCTL=y
* enable board specific commands. In this case, all commands not
* recognized by boardctl() will be forwarded to the board-provided
* board_ioctl() function.
*
****************************************************************************/
#ifdef CONFIG_BOARDCTL_IOCTL
int board_ioctl(unsigned int cmd, uintptr_t arg);
#endif
/****************************************************************************
* Name: board_graphics_setup
*
@ -257,41 +293,6 @@ struct fb_vtable_s;
FAR struct fb_vtable_s *board_graphics_setup(unsigned int devno);
#endif
/****************************************************************************
* Name: board_ioctl
*
* Description:
* If CONFIG_LIB_BOARDCTL=y, boards may also select CONFIG_BOARDCTL_IOCTL=y
* enable board specific commands. In this case, all commands not
* recognized by boardctl() will be forwarded to the board-provided
* board_ioctl() function.
*
****************************************************************************/
#ifdef CONFIG_BOARDCTL_IOCTL
int board_ioctl(unsigned int cmd, uintptr_t arg);
#endif
/****************************************************************************
* Name: board_power_off
*
* Description:
* Power off the board. This function may or may not be supported by a
* particular board architecture.
*
* If this function returns, then it was not possible to power-off the
* board due to some constraints.
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
****************************************************************************/
void board_power_off(void);
/****************************************************************************
* Name: board_lcd_initialize, board_lcd_getdev, board_lcd_uninitialize
*

View File

@ -58,6 +58,12 @@
* CONFIGURATION: CONFIG_LIB_BOARDCTL
* DEPENDENCIES: Board logic must provide board_app_initialization
*
* CMD: BOARDIOC_POWEROFF
* DESCRIPTION: Power off the board
* ARG: Integer value providing power off status information
* CONFIGURATION: CONFIG_BOARDCTL_POWEROFF
* DEPENDENCIES: Board logic must provide board_power_off
*
* CMD: BOARDIOC_TSCTEST_SETUP
* DESCRIPTION: Touchscreen controller test configuration
* ARG: Touch controller device minor number
@ -91,11 +97,12 @@
*/
#define BOARDIOC_INIT _BOARDIOC(0x0001)
#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0002)
#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0003)
#define BOARDIOC_ADCTEST_SETUP _BOARDIOC(0x0004)
#define BOARDIOC_PWMTEST_SETUP _BOARDIOC(0x0005)
#define BOARDIOC_GRAPHICS_SETUP _BOARDIOC(0x0006)
#define BOARDIOC_POWEROFF _BOARDIOC(0x0002)
#define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0003)
#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0004)
#define BOARDIOC_ADCTEST_SETUP _BOARDIOC(0x0005)
#define BOARDIOC_PWMTEST_SETUP _BOARDIOC(0x0006)
#define BOARDIOC_GRAPHICS_SETUP _BOARDIOC(0x0007)
/* If CONFIG_BOARDCTL_IOCTL=y, then boad-specific commands will be support.
* In this case, all commands not recognized by boardctl() will be forwarded
@ -104,7 +111,7 @@
* User defined board commands may begin with this value:
*/
#define BOARDIOC_USER _BOARDIOC(0x0007)
#define BOARDIOC_USER _BOARDIOC(0x0008)
/****************************************************************************
* Public Type Definitions