configs/boardctl.c: Add support for board_app_finalinitialize()

This commit is contained in:
ligd 2018-08-28 15:34:31 -06:00 committed by Gregory Nutt
parent 8343f0f55a
commit 289af9a0fb
4 changed files with 55 additions and 8 deletions

View File

@ -2360,6 +2360,14 @@ config LIB_BOARDCTL
if LIB_BOARDCTL
config BOARDCTL_FINALINIT
bool "Enable board app final init"
default n
---help---
Enables support for the BOARDIOC_FINALINIT boardctl() command.
Architecture specific logic must provide board_app_finalinitialize()
interface.
config BOARDCTL_POWEROFF
bool "Enable power off interfaces"
default n

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/boardctl.c
*
* Copyright (C) 2015-2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2015-2017, 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -276,6 +276,22 @@ int boardctl(unsigned int cmd, uintptr_t arg)
}
break;
#ifdef CONFIG_BOARDCTL_FINALINIT
/* CMD: BOARDIOC_FINALINIT
* DESCRIPTION: Perform one-time application initialization after
* start-up script.
* ARG: The argument has no meaning
* CONFIGURATION: CONFIG_BOARDCTL_FINALINIT
* DEPENDENCIES: Board logic must provide board_app_finalinitialize
*/
case BOARDIOC_FINALINIT:
{
ret = board_app_finalinitialize(arg);
}
break;
#endif
#ifdef CONFIG_BOARDCTL_POWEROFF
/* CMD: BOARDIOC_POWEROFF
* DESCRIPTION: Power off the board

View File

@ -163,6 +163,28 @@ void board_initialize(void);
int board_app_initialize(uintptr_t arg);
/****************************************************************************
* Name: board_app_finalinitialize
*
* Description:
* Perform application specific initialization. This function is never
* called directly from application code, but only indirectly via the
* (non-standard) boardctl() interface using the command
* BOARDIOC_FINALINIT.
*
* Input Parameters:
* arg - The argument has no meaning.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/
#ifdef CONFIG_BOARDCTL_FINALINIT
int board_app_finalinitialize(uintptr_t arg);
#endif
/****************************************************************************
* Name: board_power_off
*

View File

@ -117,13 +117,14 @@
*/
#define BOARDIOC_INIT _BOARDIOC(0x0001)
#define BOARDIOC_POWEROFF _BOARDIOC(0x0002)
#define BOARDIOC_RESET _BOARDIOC(0x0003)
#define BOARDIOC_UNIQUEID _BOARDIOC(0x0004)
#define BOARDIOC_APP_SYMTAB _BOARDIOC(0x0005)
#define BOARDIOC_OS_SYMTAB _BOARDIOC(0x0006)
#define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x0007)
#define BOARDIOC_NX_START _BOARDIOC(0x0008)
#define BOARDIOC_FINALINIT _BOARDIOC(0x0002)
#define BOARDIOC_POWEROFF _BOARDIOC(0x0003)
#define BOARDIOC_RESET _BOARDIOC(0x0004)
#define BOARDIOC_UNIQUEID _BOARDIOC(0x0005)
#define BOARDIOC_APP_SYMTAB _BOARDIOC(0x0006)
#define BOARDIOC_OS_SYMTAB _BOARDIOC(0x0007)
#define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x0008)
#define BOARDIOC_NX_START _BOARDIOC(0x0009)
/* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support.
* In this case, all commands not recognized by boardctl() will be forwarded