mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 13:18:50 +08:00
Squashed commit of the following:
board/boarctl.c: Add support for the new BOARDIOC_ROMDISK command. This allows applications to create ROMFS block drivers without illegal direct calls to romdisk_register. include/sys/boardctl.h: Add basic definitions to support a ROM disk creation boardctl() command.
This commit is contained in:
parent
07edaa088c
commit
118d611a8b
4 changed files with 79 additions and 40 deletions
31
TODO
31
TODO
|
@ -17,7 +17,7 @@ nuttx/:
|
|||
(2) pthreads (sched/pthread, libs/libc/pthread)
|
||||
(0) Message Queues (sched/mqueue)
|
||||
(1) Work Queues (sched/wqueue)
|
||||
(9) Kernel/Protected Build
|
||||
(8) Kernel/Protected Build
|
||||
(3) C++ Support
|
||||
(5) Binary loaders (binfmt/)
|
||||
(17) Network (net/, drivers/net)
|
||||
|
@ -926,27 +926,6 @@ o Work Queues (sched/wqueue)
|
|||
o Kernel/Protected Build
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Title: NSH PARTITIONING.
|
||||
Description: There are issues with NSH in the NuttX kernel and protected
|
||||
build modes (where NuttX is built as a monolithic kernel and
|
||||
user code must trap into the protected kernel via syscalls).
|
||||
This can cause link failures in the kernel/protected build
|
||||
mode and must currently be disabled.
|
||||
|
||||
Many such issues have been fixed. Here are the known
|
||||
remaingin problems that must be fixed:
|
||||
|
||||
- apps/nshlib/nsh_romfsetc.c: The function nsh_romfsetc()
|
||||
calles romdisk_register() directly in order to register
|
||||
the application ROMFS file system. This logic needs to
|
||||
be redesigned. The best solution would simply to be to
|
||||
to create the romdisk in the board start-up logic. This
|
||||
would, however, have impacts to NuttX users.
|
||||
|
||||
Status: Open
|
||||
Priority: Medium/High -- the kernel build configuration is not fully fielded
|
||||
yet.
|
||||
|
||||
Title: apps/system PARTITIONING
|
||||
Description: Several of the USB device helper applications in apps/system
|
||||
violate OS/application partitioning and will fail on a kernel
|
||||
|
@ -2859,10 +2838,10 @@ o Other Applications & Tests (apps/examples/)
|
|||
These examples are simple demos and, hence, you could argue that
|
||||
it is not so bad that they violate the interface for the purpose
|
||||
of demonstration (although they do set a bad example because of
|
||||
this). But there is other non-compliant logic:
|
||||
this).
|
||||
|
||||
graphics/traveler/trv_romfs.c, nshlib/nsh_romfsetc.c
|
||||
|
||||
The NSH issue is listed under"Kernel/Protected Build" as well.
|
||||
These examples should, of course, use boardctl(BOARDIOC_ROMDISK)
|
||||
to create the ROM disk instead of calling romdisk_register()
|
||||
directly.
|
||||
Status: Open
|
||||
Priority: Medium.
|
||||
|
|
|
@ -2836,6 +2836,21 @@ config BOARDCTL_UNIQUEID_SIZE
|
|||
Provides the size of the memory buffer that must be provided by the
|
||||
caller of board_uniqueid() in which to receive the board unique ID.
|
||||
|
||||
config BOARDCTL_MKRD
|
||||
bool "Enable application space creation of RAM disks"
|
||||
default n
|
||||
select DRVR_MKRD
|
||||
depends on !DISABLE_MOUNTPOINT
|
||||
---help---
|
||||
Enables support for the BOARDIOC_MKRD boardctl() command.
|
||||
|
||||
config BOARDCTL_ROMDISK
|
||||
bool "Enable application space creation of ROM disks"
|
||||
default n
|
||||
depends on !DISABLE_MOUNTPOINT
|
||||
---help---
|
||||
Enables support for the BOARDIOC_MKRD boardctl() command.
|
||||
|
||||
config BOARDCTL_APP_SYMTAB
|
||||
bool "Enable application symbol table interfaces"
|
||||
default n
|
||||
|
|
|
@ -358,11 +358,11 @@ int boardctl(unsigned int cmd, uintptr_t arg)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DRVR_MKRD
|
||||
#ifdef CONFIG_BOARDCTL_MKRD
|
||||
/* CMD: BOARDIOC_MKRD
|
||||
* DESCRIPTION: Create a RAM disk
|
||||
* ARG: Pointer to read-only instance of struct boardioc_mkrd_s.
|
||||
* CONFIGURATION: CONFIG_DRVR_MKRD
|
||||
* CONFIGURATION: CONFIG_BOARDCTL_MKRD
|
||||
* DEPENDENCIES: None
|
||||
*/
|
||||
|
||||
|
@ -384,6 +384,32 @@ int boardctl(unsigned int cmd, uintptr_t arg)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_ROMDISK
|
||||
/* CMD: BOARDIOC_ROMDISK
|
||||
* DESCRIPTION: Reigster
|
||||
* ARG: Pointer to read-only instance of struct boardioc_romdisk_s.
|
||||
* CONFIGURATION: CONFIG_BOARDCTL_ROMDISK
|
||||
* DEPENDENCIES: None
|
||||
*/
|
||||
|
||||
case BOARDIOC_ROMDISK:
|
||||
{
|
||||
FAR const struct boardioc_romdisk_s *desc =
|
||||
(FAR const struct boardioc_romdisk_s *)arg;
|
||||
|
||||
if (desc == NULL)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = romdisk_register((int)desc->minor, desc->image, desc->nsectors,
|
||||
desc->sectsize);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_APP_SYMTAB
|
||||
/* CMD: BOARDIOC_APP_SYMTAB
|
||||
* DESCRIPTION: Select the application symbol table. This symbol table
|
||||
|
|
|
@ -99,7 +99,13 @@
|
|||
* CMD: BOARDIOC_MKRD
|
||||
* DESCRIPTION: Create a RAM disk
|
||||
* ARG: Pointer to read-only instance of struct boardioc_mkrd_s.
|
||||
* CONFIGURATION: CONFIG_DRVR_MKRD
|
||||
* CONFIGURATION: CONFIG_BOARDCTL_MKRD
|
||||
* DEPENDENCIES: None
|
||||
*
|
||||
* CMD: BOARDIOC_ROMDISK
|
||||
* DESCRIPTION: Reigster
|
||||
* ARG: Pointer to read-only instance of struct boardioc_romdisk_s.
|
||||
* CONFIGURATION: CONFIG_BOARDCTL_ROMDISK
|
||||
* DEPENDENCIES: None
|
||||
*
|
||||
* CMD: BOARDIOC_APP_SYMTAB
|
||||
|
@ -188,15 +194,16 @@
|
|||
#define BOARDIOC_RESET _BOARDIOC(0x0004)
|
||||
#define BOARDIOC_UNIQUEID _BOARDIOC(0x0005)
|
||||
#define BOARDIOC_MKRD _BOARDIOC(0x0006)
|
||||
#define BOARDIOC_APP_SYMTAB _BOARDIOC(0x0007)
|
||||
#define BOARDIOC_OS_SYMTAB _BOARDIOC(0x0008)
|
||||
#define BOARDIOC_BUILTINS _BOARDIOC(0x0009)
|
||||
#define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x000a)
|
||||
#define BOARDIOC_NX_START _BOARDIOC(0x000b)
|
||||
#define BOARDIOC_VNC_START _BOARDIOC(0x000c)
|
||||
#define BOARDIOC_NXTERM _BOARDIOC(0x000d)
|
||||
#define BOARDIOC_NXTERM_IOCTL _BOARDIOC(0x000e)
|
||||
#define BOARDIOC_TESTSET _BOARDIOC(0x000f)
|
||||
#define BOARDIOC_ROMDISK _BOARDIOC(0x0007)
|
||||
#define BOARDIOC_APP_SYMTAB _BOARDIOC(0x0008)
|
||||
#define BOARDIOC_OS_SYMTAB _BOARDIOC(0x0009)
|
||||
#define BOARDIOC_BUILTINS _BOARDIOC(0x000a)
|
||||
#define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x000b)
|
||||
#define BOARDIOC_NX_START _BOARDIOC(0x000c)
|
||||
#define BOARDIOC_VNC_START _BOARDIOC(0x000d)
|
||||
#define BOARDIOC_NXTERM _BOARDIOC(0x000e)
|
||||
#define BOARDIOC_NXTERM_IOCTL _BOARDIOC(0x000f)
|
||||
#define BOARDIOC_TESTSET _BOARDIOC(0x0010)
|
||||
|
||||
/* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support.
|
||||
* In this case, all commands not recognized by boardctl() will be forwarded
|
||||
|
@ -205,7 +212,7 @@
|
|||
* User defined board commands may begin with this value:
|
||||
*/
|
||||
|
||||
#define BOARDIOC_USER _BOARDIOC(0x0010)
|
||||
#define BOARDIOC_USER _BOARDIOC(0x0011)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
|
@ -213,7 +220,7 @@
|
|||
|
||||
/* Structures used with IOCTL commands */
|
||||
|
||||
#ifdef CONFIG_DRVR_MKRD
|
||||
#ifdef CONFIG_BOARDCTL_MKRD
|
||||
/* Describes the RAM disk to be created */
|
||||
|
||||
struct boardioc_mkrd_s
|
||||
|
@ -225,6 +232,18 @@ struct boardioc_mkrd_s
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_ROMDISK
|
||||
/* Describes the ROM disk image to be registered */
|
||||
|
||||
struct boardioc_romdisk_s
|
||||
{
|
||||
uint8_t minor; /* Minor device number of the RAM disk. */
|
||||
uint32_t nsectors; /* The number of sectors in the RAM disk */
|
||||
uint16_t sectsize; /* The size of one sector in bytes */
|
||||
FAR const uint8_t *image;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* In order to full describe a symbol table, a vector containing the address
|
||||
* of the symbol table and the number of elements in the symbol table is
|
||||
* required.
|
||||
|
|
Loading…
Reference in a new issue