mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Modify board_power_off() so that is is called only via boardctl()
This commit is contained in:
@@ -1667,6 +1667,10 @@ config LIB_BOARDCTL
|
||||
|
||||
if LIB_BOARDCTL
|
||||
|
||||
config BOARDCTL_POWEROFF
|
||||
bool "Enable power off command"
|
||||
default n
|
||||
|
||||
config BOARDCTL_TSCTEST
|
||||
bool "Enable touchscreen test interfaces"
|
||||
default n
|
||||
|
||||
+18
-1
@@ -94,9 +94,26 @@ int boardctl(unsigned int cmd, uintptr_t arg)
|
||||
*/
|
||||
|
||||
case BOARDIOC_INIT:
|
||||
ret = board_app_initialize();
|
||||
{
|
||||
ret = board_app_initialize();
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_POWEROFF
|
||||
/* 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
|
||||
*/
|
||||
|
||||
case BOARDIOC_POWEROFF:
|
||||
{
|
||||
ret = board_power_off((int)arg);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_TSCTEST
|
||||
/* CMD: BOARDIOC_TSCTEST_SETUP
|
||||
* DESCRIPTION: Touchscreen controller test configuration
|
||||
|
||||
@@ -79,6 +79,7 @@ CONFIG_ARCH_CHIP_CALYPSO=y
|
||||
# CONFIG_ARCH_CHIP_KL is not set
|
||||
# CONFIG_ARCH_CHIP_LM is not set
|
||||
# CONFIG_ARCH_CHIP_TIVA is not set
|
||||
# CONFIG_ARCH_CHIP_LPC11XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC17XX is not set
|
||||
# CONFIG_ARCH_CHIP_LPC214X is not set
|
||||
# CONFIG_ARCH_CHIP_LPC2378 is not set
|
||||
@@ -87,6 +88,7 @@ CONFIG_ARCH_CHIP_CALYPSO=y
|
||||
# CONFIG_ARCH_CHIP_NUC1XX is not set
|
||||
# CONFIG_ARCH_CHIP_SAMA5 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMD is not set
|
||||
# CONFIG_ARCH_CHIP_SAML is not set
|
||||
# CONFIG_ARCH_CHIP_SAM34 is not set
|
||||
# CONFIG_ARCH_CHIP_SAMV7 is not set
|
||||
# CONFIG_ARCH_CHIP_STM32 is not set
|
||||
@@ -214,7 +216,13 @@ CONFIG_NSH_MMCSDMINOR=0
|
||||
#
|
||||
# Board-Specific Options
|
||||
#
|
||||
# CONFIG_LIB_BOARDCTL is not set
|
||||
CONFIG_LIB_BOARDCTL=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
# CONFIG_BOARDCTL_TSCTEST is not set
|
||||
# CONFIG_BOARDCTL_ADCTEST is not set
|
||||
# CONFIG_BOARDCTL_PWMTEST is not set
|
||||
# CONFIG_BOARDCTL_GRAPHICS is not set
|
||||
# CONFIG_BOARDCTL_IOCTL is not set
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
@@ -439,6 +447,7 @@ CONFIG_OTHER_SERIAL_CONSOLE=y
|
||||
# CONFIG_FS_SMARTFS is not set
|
||||
# CONFIG_FS_BINFS is not set
|
||||
# CONFIG_FS_PROCFS is not set
|
||||
# CONFIG_FS_UNIONFS is not set
|
||||
|
||||
#
|
||||
# System Logging
|
||||
@@ -557,7 +566,6 @@ CONFIG_EXAMPLES_NSH=y
|
||||
# CONFIG_EXAMPLES_NX is not set
|
||||
# CONFIG_EXAMPLES_NXTERM is not set
|
||||
# CONFIG_EXAMPLES_NXFFS is not set
|
||||
# CONFIG_EXAMPLES_NXFLAT is not set
|
||||
# CONFIG_EXAMPLES_NXHELLO is not set
|
||||
# CONFIG_EXAMPLES_NXIMAGE is not set
|
||||
# CONFIG_EXAMPLES_NXLINES is not set
|
||||
@@ -577,7 +585,6 @@ CONFIG_EXAMPLES_NSH=y
|
||||
# CONFIG_EXAMPLES_SMART is not set
|
||||
# CONFIG_EXAMPLES_TCPECHO is not set
|
||||
# CONFIG_EXAMPLES_TELNETD is not set
|
||||
# CONFIG_EXAMPLES_THTTPD is not set
|
||||
# CONFIG_EXAMPLES_TIFF is not set
|
||||
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
|
||||
# CONFIG_EXAMPLES_WEBSERVER is not set
|
||||
@@ -609,8 +616,6 @@ CONFIG_EXAMPLES_NSH=y
|
||||
# CONFIG_NETUTILS_FTPC is not set
|
||||
# CONFIG_NETUTILS_JSON is not set
|
||||
# CONFIG_NETUTILS_SMTP is not set
|
||||
# CONFIG_NETUTILS_THTTPD is not set
|
||||
# CONFIG_NETUTILS_PPPD is not set
|
||||
|
||||
#
|
||||
# FreeModBus
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
/* no libboard.a otherwise */
|
||||
/***************************************************************************
|
||||
* Included Files
|
||||
***************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
/***************************************************************************
|
||||
* Public Functions
|
||||
***************************************************************************/
|
||||
|
||||
/* Application initialization stub for boardctl() */
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
int board_app_initialize(void)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
|
||||
@@ -216,7 +216,13 @@ CONFIG_NSH_MMCSDMINOR=0
|
||||
#
|
||||
# Board-Specific Options
|
||||
#
|
||||
# CONFIG_LIB_BOARDCTL is not set
|
||||
CONFIG_LIB_BOARDCTL=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
# CONFIG_BOARDCTL_TSCTEST is not set
|
||||
# CONFIG_BOARDCTL_ADCTEST is not set
|
||||
# CONFIG_BOARDCTL_PWMTEST is not set
|
||||
# CONFIG_BOARDCTL_GRAPHICS is not set
|
||||
# CONFIG_BOARDCTL_IOCTL is not set
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
/* no libboard.a otherwise */
|
||||
/***************************************************************************
|
||||
* Included Files
|
||||
***************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
/***************************************************************************
|
||||
* Public Functions
|
||||
***************************************************************************/
|
||||
|
||||
/* Application initialization stub for boardctl() */
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
int board_app_initialize(void)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
|
||||
@@ -218,7 +218,13 @@ CONFIG_NSH_MMCSDMINOR=0
|
||||
# Board-Specific Options
|
||||
#
|
||||
CONFIG_COMPALE99_LCD_SSD1783=y
|
||||
# CONFIG_LIB_BOARDCTL is not set
|
||||
CONFIG_LIB_BOARDCTL=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
# CONFIG_BOARDCTL_TSCTEST is not set
|
||||
# CONFIG_BOARDCTL_ADCTEST is not set
|
||||
# CONFIG_BOARDCTL_PWMTEST is not set
|
||||
# CONFIG_BOARDCTL_GRAPHICS is not set
|
||||
# CONFIG_BOARDCTL_IOCTL is not set
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
|
||||
@@ -217,7 +217,13 @@ CONFIG_NSH_MMCSDMINOR=0
|
||||
# Board-Specific Options
|
||||
#
|
||||
CONFIG_COMPALE99_LCD_SSD1783=y
|
||||
# CONFIG_LIB_BOARDCTL is not set
|
||||
CONFIG_LIB_BOARDCTL=y
|
||||
CONFIG_BOARDCTL_POWEROFF=y
|
||||
# CONFIG_BOARDCTL_TSCTEST is not set
|
||||
# CONFIG_BOARDCTL_ADCTEST is not set
|
||||
# CONFIG_BOARDCTL_PWMTEST is not set
|
||||
# CONFIG_BOARDCTL_GRAPHICS is not set
|
||||
# CONFIG_BOARDCTL_IOCTL is not set
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
@@ -698,6 +704,7 @@ CONFIG_EXAMPLES_NXHELLO_DEFAULT_COLORS=y
|
||||
# Example Font Configuration
|
||||
#
|
||||
CONFIG_EXAMPLES_NXHELLO_DEFAULT_FONT=y
|
||||
# CONFIG_EXAMPLES_NXHELLO_EXTERNINIT is not set
|
||||
CONFIG_EXAMPLES_NXIMAGE=y
|
||||
CONFIG_EXAMPLES_NXIMAGE_VPLANE=0
|
||||
CONFIG_EXAMPLES_NXIMAGE_DEVNO=0
|
||||
@@ -717,6 +724,7 @@ CONFIG_EXAMPLES_NXLINES_DEFAULT_COLORS=y
|
||||
CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4
|
||||
CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=2
|
||||
CONFIG_EXAMPLES_NXLINES_BPP=16
|
||||
# CONFIG_EXAMPLES_NXLINES_EXTERNINIT is not set
|
||||
CONFIG_EXAMPLES_NXTEXT=y
|
||||
|
||||
#
|
||||
@@ -739,6 +747,7 @@ CONFIG_EXAMPLES_NXTEXT_DEFAULT_COLORS=y
|
||||
# CONFIG_EXAMPLES_NXTEXT_DEFAULT_FONT is not set
|
||||
CONFIG_EXAMPLES_NXTEXT_BGFONTID=14
|
||||
CONFIG_EXAMPLES_NXTEXT_PUFONTID=0
|
||||
# CONFIG_EXAMPLES_NXTEXT_EXTERNINIT is not set
|
||||
# CONFIG_EXAMPLES_OSTEST is not set
|
||||
# CONFIG_EXAMPLES_PIPE is not set
|
||||
# CONFIG_EXAMPLES_PPPD is not set
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
/* no libboard.a otherwise */
|
||||
/***************************************************************************
|
||||
* Included Files
|
||||
***************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
/***************************************************************************
|
||||
* Public Functions
|
||||
***************************************************************************/
|
||||
|
||||
/* Application initialization stub for boardctl() */
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
int board_app_initialize(void)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,64 +0,0 @@
|
||||
/************************************************************************************
|
||||
* configs/vsn/include/power.h
|
||||
*
|
||||
* Copyright (C) 2011 Uros Platise. All rights reserved
|
||||
*
|
||||
* Authors: Uros Platise <uros.platise@isotel.eu>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_VSN_INCLUDE_POWER_H
|
||||
#define __ARCH_BOARD_POWER_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/* Perform system reset on board level */
|
||||
|
||||
void board_power_reboot(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_BOARD_POWER_H */
|
||||
+294
-157
File diff suppressed because it is too large
Load Diff
+11
-3
@@ -49,13 +49,12 @@
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/** Initialize Board
|
||||
/* Initialize Board
|
||||
*
|
||||
* All STM32 architectures must provide the following entry point. This entry point
|
||||
* is called early in the initialization -- after all memory has been configured
|
||||
* and mapped but before any devices have been initialized.
|
||||
*
|
||||
**/
|
||||
*/
|
||||
|
||||
void stm32_boardinitialize(void)
|
||||
{
|
||||
@@ -87,3 +86,12 @@ void stm32_boardinitialize(void)
|
||||
board_led_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Application initialization stub for boardctl() */
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
int board_app_initialize(void)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
||||
|
||||
+8
-13
@@ -73,15 +73,6 @@ void board_power_init(void)
|
||||
stm32_configgpio(GPIO_PCLR);
|
||||
}
|
||||
|
||||
void board_power_reboot(void)
|
||||
{
|
||||
/* low-level board reset (not just MCU reset)
|
||||
* if external power is present, stimulate power-off as board
|
||||
* will wake-up immediately, if power is not present, set an alarm
|
||||
* before power off the board.
|
||||
*/
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_power_off
|
||||
*
|
||||
@@ -92,16 +83,19 @@ void board_power_reboot(void)
|
||||
* 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
|
||||
int board_power_off(int status)
|
||||
{
|
||||
/* Check if external supply is not present, otherwise return */
|
||||
/* Check if external supply is not present, otherwise return
|
||||
* notifying that it is not possible to power-off the board
|
||||
* REVISIT
|
||||
*/
|
||||
@@ -119,3 +113,4 @@ void board_power_off(void)
|
||||
stm32_gpiowrite(GPIO_PCLR, true);
|
||||
for (;;);
|
||||
}
|
||||
#endif
|
||||
|
||||
+13
-19
@@ -35,11 +35,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/** \file
|
||||
* \author Uros Platise
|
||||
* \brief VSN Sensor Interface
|
||||
*
|
||||
* Public interface:
|
||||
/* Public interface:
|
||||
* - sif_init(): should be called just once after system starts, to
|
||||
* initialize internal data structures, device driver and hardware
|
||||
* - individual starts() and stops() that control gpio, usart, i2c, ...
|
||||
@@ -66,32 +62,30 @@
|
||||
* - Complete internal states and updateing is made via the struct
|
||||
* vsn_sif_s, which is also accessible thru the ioctl() with
|
||||
* SNP Message descriptor.
|
||||
**/
|
||||
*/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <semaphore.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/time.h>
|
||||
#include <nuttx/progmem.h>
|
||||
|
||||
#include <nuttx/i2c.h>
|
||||
#include <nuttx/sensors/lis331dl.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/wireless/cc1101.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <semaphore.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/time.h>
|
||||
#include <nuttx/progmem.h>
|
||||
#include <nuttx/i2c.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/sensors/lis331dl.h>
|
||||
#include <nuttx/wireless/cc1101.h>
|
||||
|
||||
#include "vsn.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Declarations and Structures
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user