All architectures: Add logic to automatically register /dev/ptmx a boot time

This commit is contained in:
Gregory Nutt 2016-07-15 11:54:41 -06:00
parent 9ecd558002
commit d3b3c71d97
11 changed files with 265 additions and 32 deletions

View File

@ -51,6 +51,7 @@
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include <arch/board/board.h>
@ -228,22 +229,10 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
/* Initialize the HW crypto and /dev/crypto */
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
#if defined(CONFIG_CRYPTO)
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0
#if defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#endif
/* Initialize the Random Number Generator (RNG) */
#ifdef CONFIG_DEV_RANDOM
up_rnginitialize();
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
@ -253,6 +242,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */

View File

@ -50,6 +50,8 @@
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include <arch/board/board.h>
@ -258,6 +260,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
@ -265,6 +273,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */

View File

@ -51,6 +51,8 @@
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include "up_arch.h"
#include "up_internal.h"
@ -184,6 +186,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
@ -191,6 +199,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */

View File

@ -51,6 +51,8 @@
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include <arch/board/board.h>
@ -186,6 +188,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
@ -193,6 +201,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */

View File

@ -45,14 +45,18 @@
#include <rgmp/string.h>
#include <rgmp/arch/arch.h>
#include <nuttx/sched.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <stdio.h>
#include <stdlib.h>
#include <arch/irq.h>
#include <arch/arch.h>
#include <nuttx/sched.h>
#include <nuttx/kmalloc.h>
#include <nuttx/arch.h>
#include <nuttx/serial/pty.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/crypto/crypto.h>
#include "task/task.h"
#include "sched/sched.h"
#include "group/group.h"
@ -85,23 +89,56 @@ static inline void up_switchcontext(struct tcb_s *ctcb, struct tcb_s *ntcb)
void up_initialize(void)
{
extern pidhash_t g_pidhash[];
extern void vdev_init(void);
extern void nuttx_arch_init(void);
extern pidhash_t g_pidhash[];
extern void vdev_init(void);
extern void nuttx_arch_init(void);
// initialize the current_task to g_idletcb
current_task = g_pidhash[PIDHASH(0)].tcb;
/* Initialize the current_task to g_idletcb */
// OS memory alloc system is ready
use_os_kmalloc = 1;
current_task = g_pidhash[PIDHASH(0)].tcb;
// rgmp vdev init
vdev_init();
/* OS memory alloc system is ready */
nuttx_arch_init();
use_os_kmalloc = 1;
// enable interrupt
local_irq_enable();
/* rgmp vdev init */
vdev_init();
nuttx_arch_init();
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
*/
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
/* Enable interrupt */
local_irq_enable();
}
void up_idle(void)
@ -251,6 +288,7 @@ void up_release_stack(struct tcb_s *dtcb, uint8_t ttype)
* hold the blocked task TCB.
*
****************************************************************************/
void up_block_task(struct tcb_s *tcb, tstate_t task_state)
{
/* Verify that the context switch can be performed */

View File

@ -44,7 +44,6 @@
#include <arch/arch.h>
#include <nuttx/sched.h>
void nuttx_arch_init(void)
{
extern void e1000_mod_init(void);
@ -57,7 +56,6 @@ void nuttx_arch_init(void)
// setup e1000
e1000_mod_init();
#endif
}
void nuttx_arch_exit(void)

View File

@ -51,6 +51,8 @@
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include "up_arch.h"
#include "up_internal.h"
@ -178,6 +180,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
@ -185,6 +193,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */

View File

@ -52,6 +52,8 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include "up_internal.h"
@ -168,6 +170,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
@ -175,6 +183,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#if defined(CONFIG_FS_FAT) && !defined(CONFIG_DISABLE_MOUNTPOINT)
up_registerblockdevice(); /* Our FAT ramdisk at /dev/ram0 */
#endif

View File

@ -51,6 +51,8 @@
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include <arch/board/board.h>
@ -186,6 +188,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
@ -193,6 +201,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */

View File

@ -51,6 +51,8 @@
#include <nuttx/net/telnet.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include <arch/board/board.h>
@ -186,6 +188,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on only minimal OS initialization.
@ -193,6 +201,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */

View File

@ -50,6 +50,8 @@
#include <nuttx/net/tun.h>
#include <nuttx/syslog/syslog.h>
#include <nuttx/syslog/syslog_console.h>
#include <nuttx/serial/pty.h>
#include <nuttx/crypto/crypto.h>
#include <arch/board/board.h>
@ -183,6 +185,12 @@ void up_initialize(void)
ramlog_consoleinit();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1)
/* Register the master pseudo-terminal multiplexor device */
(void)ptmx_register();
#endif
/* Early initialization of the system logging device. Some SYSLOG channel
* can be initialized early in the initialization sequence because they
* depend on minimal OS initialization.
@ -190,6 +198,22 @@ void up_initialize(void)
syslog_initialize(SYSLOG_INIT_EARLY);
#if defined(CONFIG_CRYPTO)
/* Initialize the HW crypto and /dev/crypto */
up_cryptoinitialize();
#endif
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_CRYPTO_CRYPTODEV)
devcrypto_register();
#endif
#ifdef CONFIG_DEV_RANDOM
/* Initialize the Random Number Generator (RNG) */
up_rnginitialize();
#endif
#ifndef CONFIG_NETDEV_LATEINIT
/* Initialize the network */