From c96c96a3994af517152ca99119339a46f632a685 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 11 Mar 2022 22:52:32 +0800 Subject: [PATCH] drivers: Merge the common driver initialization into one place Signed-off-by: Xiang Xiao --- arch/arm/src/common/arm_initialize.c | 101 +------------ arch/arm/src/common/arm_internal.h | 12 -- arch/arm/src/eoss3/eoss3_serial.c | 1 - arch/arm/src/imx6/imx_enet.c | 2 +- arch/arm/src/imx6/imx_enet.h | 22 --- arch/arm/src/imxrt/imxrt_lpspi.c | 1 - arch/arm/src/nrf52/nrf52_pminitialize.c | 6 +- arch/arm/src/s32k1xx/s32k1xx_pminitialize.c | 5 - arch/arm/src/stm32/stm32_pminitialize.c | 5 - arch/arm/src/stm32f7/stm32_pminitialize.c | 5 - arch/arm/src/stm32h7/stm32_pminitialize.c | 5 - arch/arm/src/stm32l4/stm32l4_pminitialize.c | 5 - arch/avr/src/common/up_initialize.c | 92 +----------- arch/avr/src/common/up_internal.h | 4 - arch/ceva/src/common/up_idle.c | 3 - arch/ceva/src/common/up_initialize.c | 99 ------------- arch/ceva/src/common/up_internal.h | 24 --- arch/hc/src/common/up_initialize.c | 92 +----------- arch/hc/src/common/up_internal.h | 6 - arch/mips/src/common/mips_initialize.c | 91 ------------ arch/mips/src/common/mips_internal.h | 4 - arch/misoc/src/lm32/lm32.h | 18 --- arch/misoc/src/lm32/lm32_allocateheap.c | 16 -- arch/misoc/src/lm32/lm32_initialize.c | 21 --- arch/misoc/src/minerva/minerva.h | 18 --- arch/misoc/src/minerva/minerva_allocateheap.c | 16 -- arch/misoc/src/minerva/minerva_initialize.c | 21 --- arch/or1k/src/common/up_initialize.c | 92 ------------ arch/or1k/src/common/up_internal.h | 8 - arch/renesas/src/common/up_initialize.c | 96 +----------- arch/renesas/src/common/up_internal.h | 8 - arch/risc-v/src/common/riscv_initialize.c | 63 -------- arch/risc-v/src/common/riscv_internal.h | 4 - arch/risc-v/src/esp32c3/esp32c3_irq.h | 6 - .../risc-v/src/esp32c3/esp32c3_pminitialize.c | 4 - arch/risc-v/src/rv32m1/rv32m1_serial.c | 1 - arch/sim/src/sim/up_initialize.c | 112 +------------- arch/sim/src/sim/up_internal.h | 6 - arch/sparc/src/common/up_initialize.c | 122 +-------------- arch/sparc/src/common/up_internal.h | 11 -- arch/x86/src/common/up_initialize.c | 91 ------------ arch/x86/src/common/up_internal.h | 8 - arch/x86_64/src/common/up_initialize.c | 94 ------------ arch/x86_64/src/common/up_internal.h | 5 - arch/xtensa/src/common/xtensa.h | 2 - arch/xtensa/src/common/xtensa_initialize.c | 96 ------------ arch/xtensa/src/esp32/esp32_pminitialize.c | 6 +- arch/z16/src/common/z16_initialize.c | 91 ------------ arch/z16/src/common/z16_internal.h | 4 - arch/z80/src/common/z80_initialize.c | 88 ----------- arch/z80/src/common/z80_internal.h | 6 - .../lpc4088-devkit/src/lpc17_40_userleds.c | 2 +- .../src/lpc17_40_userleds.c | 2 +- .../lx_cpu/src/lpc17_40_userleds.c | 2 +- .../lpc17xx_40xx/mbed/src/lpc17_40_userleds.c | 1 - .../open1788/src/lpc17_40_userleds.c | 2 +- boards/arm/stm32/axoloti/src/stm32_userleds.c | 1 - .../arm/stm32/mikroe-stm32f4/src/stm32_pm.c | 6 - .../olimex-stm32-e407/src/stm32_userleds.c | 3 +- .../olimex-stm32-h407/src/stm32_userleds.c | 3 +- boards/arm/stm32/omnibusf4/src/stm32_pm.c | 7 - boards/arm/stm32/stm3210e-eval/src/stm32_pm.c | 6 - .../arm/stm32/stm32f4discovery/src/stm32_pm.c | 7 - .../stm32/stm32vldiscovery/src/stm32_leds.c | 1 - drivers/Makefile | 2 + drivers/drivers_initialize.c | 139 ++++++++++++++++++ drivers/efuse/efuse.c | 1 - include/nuttx/drivers/drivers.h | 20 +++ sched/init/nx_start.c | 15 +- 69 files changed, 189 insertions(+), 1750 deletions(-) create mode 100644 drivers/drivers_initialize.c diff --git a/arch/arm/src/common/arm_initialize.c b/arch/arm/src/common/arm_initialize.c index 75be389044..cf34c5c868 100644 --- a/arch/arm/src/common/arm_initialize.c +++ b/arch/arm/src/common/arm_initialize.c @@ -22,23 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include "arm_arch.h" @@ -49,7 +34,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_color_intstack + * Name: arm_color_intstack * * Description: * Set the interrupt stack to a value so that later we can determine how @@ -58,7 +43,7 @@ ****************************************************************************/ #if defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3 -static inline void up_color_intstack(void) +static inline void arm_color_intstack(void) { #ifdef CONFIG_SMP uint32_t *ptr = (uint32_t *)arm_intstack_alloc(); @@ -75,7 +60,7 @@ static inline void up_color_intstack(void) } } #else -# define up_color_intstack() +# define arm_color_intstack() #endif /**************************************************************************** @@ -101,13 +86,9 @@ static inline void up_color_intstack(void) void up_initialize(void) { - /* Initialize global variables */ - - CURRENT_REGS = NULL; - /* Colorize the interrupt stack */ - up_color_intstack(); + arm_color_intstack(); /* Add any extra memory fragments to the memory manager */ @@ -136,92 +117,18 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER arm_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined (CONFIG_LWL_CONSOLE) - lwlconsole_init(); -#elif defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ arm_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - #if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST) /* Initialize USB -- device and/or host */ diff --git a/arch/arm/src/common/arm_internal.h b/arch/arm/src/common/arm_internal.h index 52a576e5c9..6066daa1fb 100644 --- a/arch/arm/src/common/arm_internal.h +++ b/arch/arm/src/common/arm_internal.h @@ -445,14 +445,6 @@ void arm_serialinit(void); void arm_earlyserialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - -#ifdef CONFIG_LWL_CONSOLE -void lwlconsole_init(void); -#endif - /* DMA **********************************************************************/ #ifdef CONFIG_ARCH_DMA @@ -475,10 +467,6 @@ void arm_addregion(void); # define arm_addregion() #endif -/* Watchdog timer ***********************************************************/ - -void arm_wdtinit(void); - /* Networking ***************************************************************/ /* Defined in board/xyz_network.c for board-specific Ethernet diff --git a/arch/arm/src/eoss3/eoss3_serial.c b/arch/arm/src/eoss3/eoss3_serial.c index 737cd3ec12..2387a281af 100644 --- a/arch/arm/src/eoss3/eoss3_serial.c +++ b/arch/arm/src/eoss3/eoss3_serial.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/arm/src/imx6/imx_enet.c b/arch/arm/src/imx6/imx_enet.c index c75941f90d..204d649173 100644 --- a/arch/arm/src/imx6/imx_enet.c +++ b/arch/arm/src/imx6/imx_enet.c @@ -2668,7 +2668,7 @@ int imx_netinitialize(int intf) } /**************************************************************************** - * Name: up_netinitialize + * Name: arm_netinitialize * * Description: * Initialize the first network interface. If there are more than one diff --git a/arch/arm/src/imx6/imx_enet.h b/arch/arm/src/imx6/imx_enet.h index 68d1f2f82c..90a9b9f02e 100644 --- a/arch/arm/src/imx6/imx_enet.h +++ b/arch/arm/src/imx6/imx_enet.h @@ -54,28 +54,6 @@ extern "C" #define EXTERN extern #endif -/**************************************************************************** - * Function: up_netinitialize - * - * Description: - * Initialize the first network interface. If there are more than one - * interface in the chip, then board-specific logic will have to provide - * this function to determine which, if any, Ethernet controllers should - * be initialized. Also prototyped in up_internal.h. - * - * Input Parameters: - * None - * - * Returned Value: - * OK on success; Negated errno on failure. - * - * Assumptions: - * Called very early in the initialization sequence. - * - ****************************************************************************/ - -void up_netinitialize(void); - /**************************************************************************** * Function: imx_phy_boardinitialize * diff --git a/arch/arm/src/imxrt/imxrt_lpspi.c b/arch/arm/src/imxrt/imxrt_lpspi.c index 6275109316..c8c3eff0e0 100644 --- a/arch/arm/src/imxrt/imxrt_lpspi.c +++ b/arch/arm/src/imxrt/imxrt_lpspi.c @@ -61,7 +61,6 @@ #include #include #include -#include #include diff --git a/arch/arm/src/nrf52/nrf52_pminitialize.c b/arch/arm/src/nrf52/nrf52_pminitialize.c index edd3c22ffc..08246d0cdc 100644 --- a/arch/arm/src/nrf52/nrf52_pminitialize.c +++ b/arch/arm/src/nrf52/nrf52_pminitialize.c @@ -23,7 +23,8 @@ ****************************************************************************/ #include -#include + +#include "arm_internal.h" /**************************************************************************** * Public Functions @@ -49,7 +50,4 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } diff --git a/arch/arm/src/s32k1xx/s32k1xx_pminitialize.c b/arch/arm/src/s32k1xx/s32k1xx_pminitialize.c index 096d6bbc20..173bb524a6 100644 --- a/arch/arm/src/s32k1xx/s32k1xx_pminitialize.c +++ b/arch/arm/src/s32k1xx/s32k1xx_pminitialize.c @@ -24,8 +24,6 @@ #include -#include - #include "arm_internal.h" #ifdef CONFIG_PM @@ -54,9 +52,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } #endif /* CONFIG_PM */ diff --git a/arch/arm/src/stm32/stm32_pminitialize.c b/arch/arm/src/stm32/stm32_pminitialize.c index 1dcd6f4ee4..2e46ab7bd7 100644 --- a/arch/arm/src/stm32/stm32_pminitialize.c +++ b/arch/arm/src/stm32/stm32_pminitialize.c @@ -24,8 +24,6 @@ #include -#include - #include "arm_internal.h" #include "stm32_pm.h" @@ -55,9 +53,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } #endif /* CONFIG_PM */ diff --git a/arch/arm/src/stm32f7/stm32_pminitialize.c b/arch/arm/src/stm32f7/stm32_pminitialize.c index 05af5bd1ae..90d44f1a38 100644 --- a/arch/arm/src/stm32f7/stm32_pminitialize.c +++ b/arch/arm/src/stm32f7/stm32_pminitialize.c @@ -24,8 +24,6 @@ #include -#include - #include "arm_internal.h" #include "stm32_pm.h" @@ -55,9 +53,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } #endif /* CONFIG_PM */ diff --git a/arch/arm/src/stm32h7/stm32_pminitialize.c b/arch/arm/src/stm32h7/stm32_pminitialize.c index baae5fb8bc..b0a8b110ca 100644 --- a/arch/arm/src/stm32h7/stm32_pminitialize.c +++ b/arch/arm/src/stm32h7/stm32_pminitialize.c @@ -24,8 +24,6 @@ #include -#include - #include "arm_internal.h" #include "stm32_pm.h" @@ -55,9 +53,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } #endif /* CONFIG_PM */ diff --git a/arch/arm/src/stm32l4/stm32l4_pminitialize.c b/arch/arm/src/stm32l4/stm32l4_pminitialize.c index 034a0c8ee2..77d78f7e73 100644 --- a/arch/arm/src/stm32l4/stm32l4_pminitialize.c +++ b/arch/arm/src/stm32l4/stm32l4_pminitialize.c @@ -24,8 +24,6 @@ #include -#include - #include "arm_internal.h" #include "stm32l4_pm.h" @@ -55,9 +53,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } #endif /* CONFIG_PM */ diff --git a/arch/avr/src/common/up_initialize.c b/arch/avr/src/common/up_initialize.c index 05a913b0dc..dbbf85c032 100644 --- a/arch/avr/src/common/up_initialize.c +++ b/arch/avr/src/common/up_initialize.c @@ -22,22 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include #include #include "up_arch.h" @@ -129,10 +115,6 @@ static inline void up_color_intstack(void) void up_initialize(void) { - /* Initialize global variables */ - - g_current_regs = NULL; - /* Colorize the interrupt stack */ up_color_intstack(); @@ -164,90 +146,18 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB */ up_usbinitialize(); diff --git a/arch/avr/src/common/up_internal.h b/arch/avr/src/common/up_internal.h index 593c1fcffb..6918f90cfd 100644 --- a/arch/avr/src/common/up_internal.h +++ b/arch/avr/src/common/up_internal.h @@ -140,10 +140,6 @@ void up_earlyserialinit(void); void up_serialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - /* Defined in chip/xxx_ethernet.c */ #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) diff --git a/arch/ceva/src/common/up_idle.c b/arch/ceva/src/common/up_idle.c index da86dfc3b1..21f65e1141 100644 --- a/arch/ceva/src/common/up_idle.c +++ b/arch/ceva/src/common/up_idle.c @@ -163,8 +163,5 @@ void weak_function up_cpu_normal(void) #ifdef CONFIG_PM void up_pminitialize(void) { - /* Then initialize the power management subsystem proper */ - - pm_initialize(); } #endif diff --git a/arch/ceva/src/common/up_initialize.c b/arch/ceva/src/common/up_initialize.c index c2476b0ccf..2974a43a1e 100644 --- a/arch/ceva/src/common/up_initialize.c +++ b/arch/ceva/src/common/up_initialize.c @@ -22,30 +22,10 @@ * Included Files ****************************************************************************/ -#include - -#include - #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include #include "up_arch.h" #include "up_internal.h" -#include "chip.h" /**************************************************************************** * Private Functions @@ -96,10 +76,6 @@ static inline void up_color_intstack(void) void up_initialize(void) { - /* Initialize global variables */ - - CURRENT_REGS = NULL; - /* Colorize the interrupt stack */ up_color_intstack(); @@ -126,93 +102,18 @@ void up_initialize(void) up_dma_initialize(); #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_SCHED_INSTRUMENTATION_BUFFER) && \ - defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined (CONFIG_ARM_LWL_CONSOLE) - lwlconsole_init(); -#elif defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - #if defined(CONFIG_USBDEV) || defined(CONFIG_USBHOST) /* Initialize USB -- device and/or host */ diff --git a/arch/ceva/src/common/up_internal.h b/arch/ceva/src/common/up_internal.h index 3f73246135..2ded122561 100644 --- a/arch/ceva/src/common/up_internal.h +++ b/arch/ceva/src/common/up_internal.h @@ -248,8 +248,6 @@ void up_cpu_normal(void); /* Interrupt handling *******************************************************/ -void up_irqinitialize(void); - /* Interrupt acknowledge and dispatch */ uint32_t *up_doirq(int irq, uint32_t *regs); @@ -261,10 +259,6 @@ int up_hardfault(int irq, FAR void *context, FAR void *arg); void up_svcall_handler(void); -/* System timer *************************************************************/ - -void up_timer_initialize(void); - /* Low level serial output **************************************************/ #ifdef USE_SERIALDRIVER @@ -279,20 +273,6 @@ void up_earlyserialinit(void); # define up_earlyserialinit() #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#else -# define rpmsg_serialinit() -#endif - -/* Defined in drivers/lowconsole.c */ - -#ifdef CONFIG_DEV_LOWCONSOLE -void lowconsole_init(void); -#else -# define lowconsole_init() -#endif - /* DMA **********************************************************************/ #ifdef CONFIG_ARCH_DMA @@ -307,10 +287,6 @@ void up_addregion(void); # define up_addregion() #endif -/* Watchdog timer ***********************************************************/ - -void up_wdtinit(void); - /* Networking ***************************************************************/ #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) diff --git a/arch/hc/src/common/up_initialize.c b/arch/hc/src/common/up_initialize.c index 133a0ea54f..28b9399b03 100644 --- a/arch/hc/src/common/up_initialize.c +++ b/arch/hc/src/common/up_initialize.c @@ -22,22 +22,9 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include "up_arch.h" #include "up_internal.h" @@ -65,10 +52,6 @@ void up_initialize(void) { - /* Initialize global variables */ - - g_current_regs = NULL; - /* Add any extra memory fragments to the memory manager */ up_addregion(); @@ -96,93 +79,20 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB */ up_usbinitialize(); - board_autoled_on(LED_IRQSENABLED); } diff --git a/arch/hc/src/common/up_internal.h b/arch/hc/src/common/up_internal.h index 5f59ea1740..72fa526340 100644 --- a/arch/hc/src/common/up_internal.h +++ b/arch/hc/src/common/up_internal.h @@ -157,10 +157,6 @@ void up_earlyserialinit(void); void up_serialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - void up_lowputc(char ch); void up_lowputs(const char *str); @@ -178,8 +174,6 @@ void up_addregion(void); void weak_function up_dma_initialize(void); #endif -void up_wdtinit(void); - #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) void up_netinitialize(void); #else diff --git a/arch/mips/src/common/mips_initialize.c b/arch/mips/src/common/mips_initialize.c index c433c5a525..8c8ee2dd8b 100644 --- a/arch/mips/src/common/mips_initialize.c +++ b/arch/mips/src/common/mips_initialize.c @@ -22,23 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include "mips_arch.h" @@ -67,10 +52,6 @@ void up_initialize(void) { - /* Initialize global variables */ - - CURRENT_REGS = NULL; - /* Add any extra memory fragments to the memory manager */ up_addregion(); @@ -98,90 +79,18 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB -- device and/or host */ up_usbinitialize(); diff --git a/arch/mips/src/common/mips_internal.h b/arch/mips/src/common/mips_internal.h index 1abdb59731..297ad6220c 100644 --- a/arch/mips/src/common/mips_internal.h +++ b/arch/mips/src/common/mips_internal.h @@ -244,10 +244,6 @@ void up_earlyserialinit(void); void up_serialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - /* Network */ #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) diff --git a/arch/misoc/src/lm32/lm32.h b/arch/misoc/src/lm32/lm32.h index 77a0e671a3..e21b6515a9 100644 --- a/arch/misoc/src/lm32/lm32.h +++ b/arch/misoc/src/lm32/lm32.h @@ -104,12 +104,6 @@ extern uint32_t g_idle_topstack; void lm32_board_initialize(void); -/* Memory allocation ********************************************************/ - -#if CONFIG_MM_REGIONS > 1 -void lm32_add_region(void); -#endif - /* Context switching ********************************************************/ void lm32_copystate(uint32_t *dest, uint32_t *src); @@ -123,18 +117,6 @@ uint32_t *lm32_doirq(int irq, uint32_t *regs); int lm32_swint(int irq, FAR void *context, FAR void *arg); -/* Rpmsg serial *************************************************************/ - -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#else -# define rpmsg_serialinit() -#endif - -/* System timer *************************************************************/ - -void lm32_timer_initialize(void); - /* Signal handling **********************************************************/ void lm32_sigdeliver(void); diff --git a/arch/misoc/src/lm32/lm32_allocateheap.c b/arch/misoc/src/lm32/lm32_allocateheap.c index 429751dfa1..84b4e0494c 100644 --- a/arch/misoc/src/lm32/lm32_allocateheap.c +++ b/arch/misoc/src/lm32/lm32_allocateheap.c @@ -70,19 +70,3 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) *heap_start = (FAR void *)g_idle_topstack; *heap_size = CONFIG_RAM_END - g_idle_topstack; } - -/**************************************************************************** - * Name: lm32_add_region - * - * Description: - * Memory may be added in non-contiguous chunks. Additional chunks are - * added by calling this function. - * - ****************************************************************************/ - -#if CONFIG_MM_REGIONS > 1 -void lm32_add_region(void) -{ -#warning Missing logic -} -#endif diff --git a/arch/misoc/src/lm32/lm32_initialize.c b/arch/misoc/src/lm32/lm32_initialize.c index 98c73b35e3..58ed160273 100644 --- a/arch/misoc/src/lm32/lm32_initialize.c +++ b/arch/misoc/src/lm32/lm32_initialize.c @@ -22,26 +22,9 @@ * Included Files ****************************************************************************/ -#include - -#include - #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include #include "misoc.h" -#include "lm32.h" /**************************************************************************** * Public Functions @@ -53,10 +36,6 @@ void up_initialize(void) misoc_serial_initialize(); -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - #if 0 /* REVISIT */ /* Initialize the network cores */ diff --git a/arch/misoc/src/minerva/minerva.h b/arch/misoc/src/minerva/minerva.h index b1abe95530..ad17d2d36f 100644 --- a/arch/misoc/src/minerva/minerva.h +++ b/arch/misoc/src/minerva/minerva.h @@ -104,12 +104,6 @@ extern uint32_t g_idle_topstack; void minerva_board_initialize(void); -/* Memory allocation ********************************************************/ - -#if CONFIG_MM_REGIONS > 1 -void minerva_add_region(void); -#endif - /* Context switching ********************************************************/ void minerva_copystate(uint32_t * dest, uint32_t * src); @@ -123,18 +117,6 @@ uint32_t *minerva_doirq(int irq, uint32_t * regs); int minerva_swint(int irq, FAR void *context, FAR void *arg); -/* Rpmsg serial *************************************************************/ - -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#else -# define rpmsg_serialinit() -#endif - -/* System timer *************************************************************/ - -void minerva_timer_initialize(void); - /* Signal handling **********************************************************/ void minerva_sigdeliver(void); diff --git a/arch/misoc/src/minerva/minerva_allocateheap.c b/arch/misoc/src/minerva/minerva_allocateheap.c index 315c5d9e13..b33040386f 100644 --- a/arch/misoc/src/minerva/minerva_allocateheap.c +++ b/arch/misoc/src/minerva/minerva_allocateheap.c @@ -58,19 +58,3 @@ void up_allocate_heap(FAR void **heap_start, size_t * heap_size) *heap_start = (FAR void *)g_idle_topstack; *heap_size = CONFIG_RAM_END - g_idle_topstack; } - -/**************************************************************************** - * Name: minerva_add_region - * - * Description: - * Memory may be added in non-contiguous chunks. Additional chunks are - * added by calling this function. - * - ****************************************************************************/ - -#if CONFIG_MM_REGIONS > 1 -void minerva_add_region(void) -{ -# warning Missing logic -} -#endif diff --git a/arch/misoc/src/minerva/minerva_initialize.c b/arch/misoc/src/minerva/minerva_initialize.c index 11d3d8f941..0dde267468 100644 --- a/arch/misoc/src/minerva/minerva_initialize.c +++ b/arch/misoc/src/minerva/minerva_initialize.c @@ -22,26 +22,9 @@ * Included Files ****************************************************************************/ -#include - -#include - #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include #include "misoc.h" -#include "minerva.h" /**************************************************************************** * Public Functions @@ -53,10 +36,6 @@ void up_initialize(void) misoc_serial_initialize(); -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - /* Initialize the network cores */ #ifdef CONFIG_MISOC_ETHERNET diff --git a/arch/or1k/src/common/up_initialize.c b/arch/or1k/src/common/up_initialize.c index e2903060f3..bef341cf7d 100644 --- a/arch/or1k/src/common/up_initialize.c +++ b/arch/or1k/src/common/up_initialize.c @@ -22,28 +22,12 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include - #include -#include "up_arch.h" #include "up_internal.h" /**************************************************************************** @@ -157,10 +141,6 @@ static inline void up_color_intstack(void) void up_initialize(void) { - /* Initialize global variables */ - - CURRENT_REGS = NULL; - /* Colorize the interrupt stack */ up_color_intstack(); @@ -192,92 +172,20 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ up_serialinit(); -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - /* Print OpenRISC CPU information */ or1k_print_cpuinfo(); -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB -- device and/or host */ up_usbinitialize(); diff --git a/arch/or1k/src/common/up_internal.h b/arch/or1k/src/common/up_internal.h index 6c18457024..7467267016 100644 --- a/arch/or1k/src/common/up_internal.h +++ b/arch/or1k/src/common/up_internal.h @@ -279,10 +279,6 @@ void up_serialinit(void); void up_earlyserialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - /* DMA **********************************************************************/ #ifdef CONFIG_ARCH_DMA @@ -305,10 +301,6 @@ void up_addregion(void); # define up_addregion() #endif -/* Watchdog timer ***********************************************************/ - -void up_wdtinit(void); - /* Networking ***************************************************************/ /* Defined in board/xyz_network.c for board-specific Ethernet diff --git a/arch/renesas/src/common/up_initialize.c b/arch/renesas/src/common/up_initialize.c index 21d788d8f7..7050372c1c 100644 --- a/arch/renesas/src/common/up_initialize.c +++ b/arch/renesas/src/common/up_initialize.c @@ -22,22 +22,9 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include "up_arch.h" #include "up_internal.h" @@ -65,10 +52,6 @@ void up_initialize(void) { - /* Initialize global variables */ - - g_current_regs = NULL; - #ifdef CONFIG_PM /* Initialize the power management subsystem. This MCU-specific function * must be called *very* early in the initialization sequence *before* any @@ -79,97 +62,20 @@ void up_initialize(void) up_pminitialize(); #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). NOTE that the naming implies that the console is a - * serial driver. That is usually the case, however, if no UARTs are - * enabled, the console could also be provided through some other device, - * such as an LCD. - * Architecture-specific logic will have to detect that case. - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB */ up_usbinitialize(); - board_autoled_on(LED_IRQSENABLED); } diff --git a/arch/renesas/src/common/up_internal.h b/arch/renesas/src/common/up_internal.h index 517108a3ec..da00a773d3 100644 --- a/arch/renesas/src/common/up_internal.h +++ b/arch/renesas/src/common/up_internal.h @@ -164,14 +164,6 @@ void up_consoleinit(void); void up_serialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - -/* Defined in xyz_watchdog.c */ - -void up_wdtinit(void); - /* Defined in board/xyz_lcd.c */ #ifdef CONFIG_SLCD_CONSOLE diff --git a/arch/risc-v/src/common/riscv_initialize.c b/arch/risc-v/src/common/riscv_initialize.c index bcf07ba26b..f7ebfe1e64 100644 --- a/arch/risc-v/src/common/riscv_initialize.c +++ b/arch/risc-v/src/common/riscv_initialize.c @@ -22,21 +22,10 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include - #include -#include "sched/sched.h" #include "riscv_arch.h" #include "riscv_internal.h" @@ -111,63 +100,11 @@ void up_initialize(void) riscv_pminitialize(); #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER riscv_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - board_autoled_on(LED_IRQSENABLED); } diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h index 000727adbe..f64216e7ac 100644 --- a/arch/risc-v/src/common/riscv_internal.h +++ b/arch/risc-v/src/common/riscv_internal.h @@ -225,10 +225,6 @@ void riscv_serialinit(void); void riscv_earlyserialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - /* Exception Handler ********************************************************/ void riscv_fault(int irq, uintptr_t *regs); diff --git a/arch/risc-v/src/esp32c3/esp32c3_irq.h b/arch/risc-v/src/esp32c3/esp32c3_irq.h index 8f0d0dac02..54cd41003c 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_irq.h +++ b/arch/risc-v/src/esp32c3/esp32c3_irq.h @@ -41,12 +41,6 @@ #define ESP32C3_INT_PRIO_DEF 1 -/**************************************************************************** - * Name: up_irqinitialize - ****************************************************************************/ - -void up_irqinitialize(void); - /**************************************************************************** * Name: esp32c3_bind_irq * diff --git a/arch/risc-v/src/esp32c3/esp32c3_pminitialize.c b/arch/risc-v/src/esp32c3/esp32c3_pminitialize.c index 4625d9010a..ee25f78114 100644 --- a/arch/risc-v/src/esp32c3/esp32c3_pminitialize.c +++ b/arch/risc-v/src/esp32c3/esp32c3_pminitialize.c @@ -23,7 +23,6 @@ ****************************************************************************/ #include -#include #include "esp32c3_pm.h" @@ -43,9 +42,6 @@ void riscv_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } #endif /* CONFIG_PM */ diff --git a/arch/risc-v/src/rv32m1/rv32m1_serial.c b/arch/risc-v/src/rv32m1/rv32m1_serial.c index df50c51ba4..c7cb8a177a 100644 --- a/arch/risc-v/src/rv32m1/rv32m1_serial.c +++ b/arch/risc-v/src/rv32m1/rv32m1_serial.c @@ -36,7 +36,6 @@ #include #include #include -#include #ifdef CONFIG_SERIAL_TERMIOS # include diff --git a/arch/sim/src/sim/up_initialize.c b/arch/sim/src/sim/up_initialize.c index 1d32e124db..7b64098aba 100644 --- a/arch/sim/src/sim/up_initialize.c +++ b/arch/sim/src/sim/up_initialize.c @@ -22,30 +22,13 @@ * Included Files ****************************************************************************/ -#include - -#include -#include - #include #include -#include -#include -#include -#include #include #include -#include -#include -#include #include -#include -#include -#include #include #include -#include -#include #include "up_internal.h" @@ -206,19 +189,6 @@ static int up_loop_task(int argc, FAR char **argv) return 0; } -static void up_loop_init(void) -{ - int ret; - - /* Use loop_task to simulate the IRQ */ - - ret = kthread_create("loop_task", 1, - CONFIG_DEFAULT_TASK_STACKSIZE, - up_loop_task, NULL); - - DEBUGASSERT(ret > 0); -} - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -245,70 +215,10 @@ static void up_loop_init(void) void up_initialize(void) { -#ifdef CONFIG_PM - /* Initialize the power management subsystem. This MCU-specific function - * must be called *very* early in the initialization sequence *before* any - * other device drivers are initialized (since they may attempt to register - * with the power management subsystem). - */ - - pm_initialize(); -#endif - - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - /* Register some tty-port to access tty-port on sim platform */ up_uartinit(); -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #if defined(CONFIG_FS_FAT) && !defined(CONFIG_DISABLE_MOUNTPOINT) up_registerblockdevice(); /* Our FAT ramdisk at /dev/ram0 */ #endif @@ -323,24 +233,6 @@ void up_initialize(void) usrsock_init(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - #if defined(CONFIG_FS_SMARTFS) && defined(CONFIG_MTD_SMART) && \ (defined(CONFIG_SPI_FLASH) || defined(CONFIG_QSPI_FLASH)) up_init_smartfs(); @@ -351,5 +243,7 @@ void up_initialize(void) audio_register("pcm0c", sim_audio_initialize(false)); #endif - up_loop_init(); + kthread_create("loop_task", SCHED_PRIORITY_MIN, + CONFIG_DEFAULT_TASK_STACKSIZE, + up_loop_task, NULL); } diff --git a/arch/sim/src/sim/up_internal.h b/arch/sim/src/sim/up_internal.h index 3784cc4493..bdcf87bbf4 100644 --- a/arch/sim/src/sim/up_internal.h +++ b/arch/sim/src/sim/up_internal.h @@ -189,12 +189,6 @@ int up_init_ipi(int irq); void up_timer_update(void); #endif -/* rpmsg_serialinit *********************************************************/ - -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - /* up_uart.c ****************************************************************/ void up_uartinit(void); diff --git a/arch/sparc/src/common/up_initialize.c b/arch/sparc/src/common/up_initialize.c index 6b95e999bc..2c75598a77 100644 --- a/arch/sparc/src/common/up_initialize.c +++ b/arch/sparc/src/common/up_initialize.c @@ -22,23 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include #include #include "up_arch.h" @@ -140,10 +125,6 @@ static inline void up_color_intstack(void) void up_initialize(void) { - /* Initialize global variables */ - - g_current_regs = NULL; - /* Colorize the interrupt stack */ up_color_intstack(); @@ -152,10 +133,6 @@ void up_initialize(void) up_addregion(); - /* Initialize the interrupt subsystem */ - - up_irqinitialize(); - #ifdef CONFIG_ARCH_DMA /* Initialize the DMA subsystem if the weak function up_dma_initialize has * been brought into the build @@ -169,109 +146,12 @@ void up_initialize(void) } #endif -#ifdef CONFIG_MM_IOB - /* Initialize IO buffering */ - - iob_initialize(); -#endif - - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_SCHED_INSTRUMENTATION_BUFFER) && \ - defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_DEV_LOWCONSOLE) - lowconsole_init(); -#elif defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#elif defined(CONFIG_RAMLOG_CONSOLE) - ramlog_consoleinit(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - (void)ptmx_register(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - -#ifndef CONFIG_NETDEV_LATEINIT - /* Initialize the network */ - - up_netinitialize(); -#endif - -#ifdef CONFIG_NETDEV_LOOPBACK - /* Initialize the local loopback device */ - - (void)localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - (void)tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - (void)telnet_initialize(); -#endif - /* Initialize USB */ up_usbinitialize(); diff --git a/arch/sparc/src/common/up_internal.h b/arch/sparc/src/common/up_internal.h index 9b5bf2e361..9812cbc73c 100644 --- a/arch/sparc/src/common/up_internal.h +++ b/arch/sparc/src/common/up_internal.h @@ -183,14 +183,6 @@ void up_copystate(uint32_t *dest, uint32_t *src); void up_lowputs(const char *str); -/* Defined in drivers/lowconsole.c */ - -#ifdef CONFIG_DEV_LOWCONSOLE -void lowconsole_init(void); -#else -# define lowconsole_init() -#endif - /* Debug */ #ifdef CONFIG_ARCH_STACKDUMP @@ -217,7 +209,6 @@ void up_sigdeliver(void); /* IRQs */ -void up_irqinitialize(void); bool up_pending_irq(int irq); void up_clrpend_irq(int irq); @@ -241,8 +232,6 @@ void up_lowputc(char ch); void up_earlyserialinit(void); void up_serialinit(void); -void rpmsg_serialinit(void); - /* Network */ #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) diff --git a/arch/x86/src/common/up_initialize.c b/arch/x86/src/common/up_initialize.c index d90c91ba25..4c197627d7 100644 --- a/arch/x86/src/common/up_initialize.c +++ b/arch/x86/src/common/up_initialize.c @@ -22,23 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include "up_arch.h" @@ -67,10 +52,6 @@ void up_initialize(void) { - /* Initialize global variables */ - - g_current_regs = NULL; - /* Add any extra memory fragments to the memory manager */ up_addregion(); @@ -98,90 +79,18 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB -- device and/or host */ up_usbinitialize(); diff --git a/arch/x86/src/common/up_internal.h b/arch/x86/src/common/up_internal.h index 83f5a75a07..f841387f29 100644 --- a/arch/x86/src/common/up_internal.h +++ b/arch/x86/src/common/up_internal.h @@ -201,14 +201,6 @@ void up_earlyserialinit(void); void up_serialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - -/* Defined in xyz_watchdog.c */ - -void up_wdtinit(void); - /* Defined in board/up_network.c */ #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) diff --git a/arch/x86_64/src/common/up_initialize.c b/arch/x86_64/src/common/up_initialize.c index 8d29988ca6..d8141249cf 100644 --- a/arch/x86_64/src/common/up_initialize.c +++ b/arch/x86_64/src/common/up_initialize.c @@ -22,28 +22,10 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include -#include "sched/sched.h" #include "up_arch.h" #include "up_internal.h" @@ -101,10 +83,6 @@ static void up_calibratedelay(void) void up_initialize(void) { - /* Initialize global variables */ - - g_current_regs = NULL; - /* Add any extra memory fragments to the memory manager */ up_addregion(); @@ -132,90 +110,18 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER up_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB -- device and/or host */ up_usbinitialize(); diff --git a/arch/x86_64/src/common/up_internal.h b/arch/x86_64/src/common/up_internal.h index 222d642f24..f50a058ee6 100644 --- a/arch/x86_64/src/common/up_internal.h +++ b/arch/x86_64/src/common/up_internal.h @@ -189,7 +189,6 @@ void x86_64_boardinitialize(void); void up_copystate(uint64_t *dest, uint64_t *src); void up_savestate(uint64_t *regs); void up_decodeirq(uint64_t *regs); -void up_irqinitialize(void); #ifdef CONFIG_ARCH_DMA void weak_function up_dmainitialize(void); #endif @@ -218,10 +217,6 @@ void up_addregion(void); void up_earlyserialinit(void); void up_serialinit(void); -/* Defined in xyz_watchdog.c */ - -void up_wdtinit(void); - /* Defined in xyz_timerisr.c */ void x86_64_timer_calibrate_freq(void); diff --git a/arch/xtensa/src/common/xtensa.h b/arch/xtensa/src/common/xtensa.h index b3baf522cd..43d59af3e4 100644 --- a/arch/xtensa/src/common/xtensa.h +++ b/arch/xtensa/src/common/xtensa.h @@ -320,8 +320,6 @@ void up_lowputc(char ch); void xtensa_earlyserialinit(void); void xtensa_serialinit(void); -void rpmsg_serialinit(void); - /* Network */ #if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT) diff --git a/arch/xtensa/src/common/xtensa_initialize.c b/arch/xtensa/src/common/xtensa_initialize.c index 5db6872553..a8f98f1fbe 100644 --- a/arch/xtensa/src/common/xtensa_initialize.c +++ b/arch/xtensa/src/common/xtensa_initialize.c @@ -22,23 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include "xtensa.h" @@ -99,17 +84,8 @@ static inline void xtensa_color_intstack(void) void up_initialize(void) { - int i; - xtensa_color_intstack(); - /* Initialize global variables */ - - for (i = 0; i < CONFIG_SMP_NCPUS; i++) - { - g_current_regs[i] = NULL; - } - /* Add any extra memory fragments to the memory manager */ xtensa_add_region(); @@ -143,90 +119,18 @@ void up_initialize(void) } #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER xtensa_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - /* Initialize USB -- device and/or host */ up_usbinitialize(); diff --git a/arch/xtensa/src/esp32/esp32_pminitialize.c b/arch/xtensa/src/esp32/esp32_pminitialize.c index f0402022cc..7b04937e47 100644 --- a/arch/xtensa/src/esp32/esp32_pminitialize.c +++ b/arch/xtensa/src/esp32/esp32_pminitialize.c @@ -23,8 +23,8 @@ ****************************************************************************/ #include -#include +#include "xtensa.h" #include "esp32_pm.h" #ifdef CONFIG_PM @@ -46,10 +46,6 @@ void xtensa_pminitialize(void) /* Initialize RTC parameters */ esp32_pminit(); - - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); } #endif /* CONFIG_PM */ diff --git a/arch/z16/src/common/z16_initialize.c b/arch/z16/src/common/z16_initialize.c index 08406f4e79..41ea700ca5 100644 --- a/arch/z16/src/common/z16_initialize.c +++ b/arch/z16/src/common/z16_initialize.c @@ -22,23 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include "z16_arch.h" @@ -78,10 +63,6 @@ volatile FAR chipreg_t *g_current_regs; void up_initialize(void) { - /* Initialize global variables */ - - g_current_regs = NULL; - #if CONFIG_MM_REGIONS > 1 /* Add any extra memory fragments to the memory manager */ @@ -98,89 +79,17 @@ void up_initialize(void) up_pminitialize(); #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER z16_serialinit(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ z16_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - board_autoled_on(LED_IRQSENABLED); } diff --git a/arch/z16/src/common/z16_internal.h b/arch/z16/src/common/z16_internal.h index ca72a213ca..bd3c34998c 100644 --- a/arch/z16/src/common/z16_internal.h +++ b/arch/z16/src/common/z16_internal.h @@ -148,10 +148,6 @@ void z16_serialinit(void); void z16_earlyserialinit(void); #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#endif - /* Defined in xyz_irq.c */ void z16_ack_irq(int irq); diff --git a/arch/z80/src/common/z80_initialize.c b/arch/z80/src/common/z80_initialize.c index ba560d9c44..a66cb9d142 100644 --- a/arch/z80/src/common/z80_initialize.c +++ b/arch/z80/src/common/z80_initialize.c @@ -22,24 +22,8 @@ * Included Files ****************************************************************************/ -#include - -#include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include "chip/switch.h" @@ -97,89 +81,17 @@ void up_initialize(void) z80_mmu_initialize(); #endif - /* Register devices */ - -#if defined(CONFIG_DEV_NULL) - devnull_register(); /* Standard /dev/null */ -#endif - -#if defined(CONFIG_DEV_RANDOM) - devrandom_register(); /* Standard /dev/random */ -#endif - -#if defined(CONFIG_DEV_URANDOM) - devurandom_register(); /* Standard /dev/urandom */ -#endif - -#if defined(CONFIG_DEV_ZERO) - devzero_register(); /* Standard /dev/zero */ -#endif - -#if defined(CONFIG_DEV_LOOP) - loop_register(); /* Standard /dev/loop */ -#endif - -#if defined(CONFIG_DRIVER_NOTE) - note_register(); /* Non-standard /dev/note */ -#endif - /* Initialize the serial device driver */ #ifdef USE_SERIALDRIVER z80_serial_initialize(); #endif -#ifdef CONFIG_RPMSG_UART - rpmsg_serialinit(); -#endif - - /* Initialize the console device driver (if it is other than the standard - * serial driver). - */ - -#if defined(CONFIG_CONSOLE_SYSLOG) - syslog_console_init(); -#endif - -#ifdef CONFIG_PSEUDOTERM_SUSV1 - /* Register the master pseudo-terminal multiplexor device */ - - ptmx_register(); -#endif - -#if defined(CONFIG_CRYPTO) - /* Initialize the HW crypto and /dev/crypto */ - - up_cryptoinitialize(); -#endif - -#ifdef CONFIG_CRYPTO_CRYPTODEV - devcrypto_register(); -#endif - #ifndef CONFIG_NETDEV_LATEINIT /* Initialize the network */ up_netinitialize(); #endif -#ifdef CONFIG_NET_LOOPBACK - /* Initialize the local loopback device */ - - localhost_initialize(); -#endif - -#ifdef CONFIG_NET_TUN - /* Initialize the TUN device */ - - tun_initialize(); -#endif - -#ifdef CONFIG_NETDEV_TELNET - /* Initialize the Telnet session factory */ - - telnet_initialize(); -#endif - board_autoled_on(LED_IRQSENABLED); } diff --git a/arch/z80/src/common/z80_internal.h b/arch/z80/src/common/z80_internal.h index d9fa7d18ee..226b17ddfa 100644 --- a/arch/z80/src/common/z80_internal.h +++ b/arch/z80/src/common/z80_internal.h @@ -105,12 +105,6 @@ void z80_serial_initialize(void); # define z80_serial_initialize() #endif -#ifdef CONFIG_RPMSG_UART -void rpmsg_serialinit(void); -#else -# define rpmsg_serialinit() -#endif - /* Architecture specific hook into the timer interrupt handler */ #ifdef CONFIG_ARCH_TIMERHOOK diff --git a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_userleds.c b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_userleds.c index 74488220bc..b8ca9421d8 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_userleds.c +++ b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_userleds.c @@ -28,8 +28,8 @@ #include #include +#include #include -#include #include "chip.h" #include "arm_arch.h" diff --git a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_userleds.c b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_userleds.c index 32183123fc..2c79fe1055 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_userleds.c +++ b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_userleds.c @@ -28,8 +28,8 @@ #include #include +#include #include -#include #include "chip.h" #include "arm_arch.h" diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_userleds.c b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_userleds.c index 765c12be51..de567f26a7 100644 --- a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_userleds.c +++ b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_userleds.c @@ -28,8 +28,8 @@ #include #include +#include #include -#include #include "chip.h" #include "arm_arch.h" diff --git a/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_userleds.c b/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_userleds.c index 735af9d7f8..de5a5e88ee 100644 --- a/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_userleds.c +++ b/boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_userleds.c @@ -29,7 +29,6 @@ #include #include -#include #include #include "chip.h" diff --git a/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_userleds.c b/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_userleds.c index 4e7b6de46b..d940232f61 100644 --- a/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_userleds.c +++ b/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_userleds.c @@ -28,8 +28,8 @@ #include #include +#include #include -#include #include "chip.h" #include "arm_arch.h" diff --git a/boards/arm/stm32/axoloti/src/stm32_userleds.c b/boards/arm/stm32/axoloti/src/stm32_userleds.c index d7ae3eda60..10839c51d2 100644 --- a/boards/arm/stm32/axoloti/src/stm32_userleds.c +++ b/boards/arm/stm32/axoloti/src/stm32_userleds.c @@ -29,7 +29,6 @@ #include #include -#include #include #include "chip.h" diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_pm.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_pm.c index 5a8858ba12..3606f2b5d2 100644 --- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_pm.c +++ b/boards/arm/stm32/mikroe-stm32f4/src/stm32_pm.c @@ -24,8 +24,6 @@ #include -#include - #include "arm_internal.h" #include "stm32_pm.h" #include "mikroe-stm32f4.h" @@ -56,10 +54,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); - #if defined(CONFIG_ARCH_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) /* Initialize the buttons to wake up the system from low power modes */ diff --git a/boards/arm/stm32/olimex-stm32-e407/src/stm32_userleds.c b/boards/arm/stm32/olimex-stm32-e407/src/stm32_userleds.c index 5972fef9e0..79ec22bb4b 100644 --- a/boards/arm/stm32/olimex-stm32-e407/src/stm32_userleds.c +++ b/boards/arm/stm32/olimex-stm32-e407/src/stm32_userleds.c @@ -27,8 +27,9 @@ #include #include #include + +#include #include -#include #include "chip.h" #include "arm_arch.h" diff --git a/boards/arm/stm32/olimex-stm32-h407/src/stm32_userleds.c b/boards/arm/stm32/olimex-stm32-h407/src/stm32_userleds.c index 3c09ccb7e9..0c4798e0d3 100644 --- a/boards/arm/stm32/olimex-stm32-h407/src/stm32_userleds.c +++ b/boards/arm/stm32/olimex-stm32-h407/src/stm32_userleds.c @@ -27,8 +27,9 @@ #include #include #include + +#include #include -#include #include "chip.h" #include "arm_arch.h" diff --git a/boards/arm/stm32/omnibusf4/src/stm32_pm.c b/boards/arm/stm32/omnibusf4/src/stm32_pm.c index 18bab418bd..2d6e8ef2a3 100644 --- a/boards/arm/stm32/omnibusf4/src/stm32_pm.c +++ b/boards/arm/stm32/omnibusf4/src/stm32_pm.c @@ -24,9 +24,6 @@ #include -#include -#include - #include "arm_internal.h" #include "stm32_pm.h" #include "omnibusf4.h" @@ -57,10 +54,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); - #if defined(CONFIG_ARCH_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) /* Initialize the buttons to wake up the system from low power modes */ diff --git a/boards/arm/stm32/stm3210e-eval/src/stm32_pm.c b/boards/arm/stm32/stm3210e-eval/src/stm32_pm.c index d3f26a017e..e01ff24d0a 100644 --- a/boards/arm/stm32/stm3210e-eval/src/stm32_pm.c +++ b/boards/arm/stm32/stm3210e-eval/src/stm32_pm.c @@ -24,8 +24,6 @@ #include -#include - #include "arm_internal.h" #include "stm32_pm.h" #include "stm3210e-eval.h" @@ -56,10 +54,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); - #if defined(CONFIG_ARCH_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) /* Initialize the buttons to wake up the system from low power modes */ diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_pm.c b/boards/arm/stm32/stm32f4discovery/src/stm32_pm.c index b10656e2e6..5e41b42a06 100644 --- a/boards/arm/stm32/stm32f4discovery/src/stm32_pm.c +++ b/boards/arm/stm32/stm32f4discovery/src/stm32_pm.c @@ -24,9 +24,6 @@ #include -#include -#include - #include "arm_internal.h" #include "stm32_pm.h" #include "stm32f4discovery.h" @@ -57,10 +54,6 @@ void arm_pminitialize(void) { - /* Then initialize the NuttX power management subsystem proper */ - - pm_initialize(); - #if defined(CONFIG_ARCH_IDLE_CUSTOM) && defined(CONFIG_PM_BUTTONS) /* Initialize the buttons to wake up the system from low power modes */ diff --git a/boards/arm/stm32/stm32vldiscovery/src/stm32_leds.c b/boards/arm/stm32/stm32vldiscovery/src/stm32_leds.c index 4b3aaee50c..7c373da534 100644 --- a/boards/arm/stm32/stm32vldiscovery/src/stm32_leds.c +++ b/boards/arm/stm32/stm32vldiscovery/src/stm32_leds.c @@ -29,7 +29,6 @@ #include #include -#include #include #include "chip.h" diff --git a/drivers/Makefile b/drivers/Makefile index d6b53242be..bfe6cf15f8 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -20,6 +20,8 @@ include $(TOPDIR)/Make.defs +CSRCS = drivers_initialize.c + # Include support for various drivers. Each Make.defs file will add its # files to the source file list, add its DEPPATH info, and will add # the appropriate paths to the VPATH variable diff --git a/drivers/drivers_initialize.c b/drivers/drivers_initialize.c new file mode 100644 index 0000000000..755af2fbbb --- /dev/null +++ b/drivers/drivers_initialize.c @@ -0,0 +1,139 @@ +/**************************************************************************** + * drivers/drivers_initialize.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: drivers_initialize + * + * Description: + * drivers_initialize will be called once during OS initialization after + * the basic OS services have been initialized. + * + * drivers_initialize is called after the OS initialized but before the + * user initialization logic has been started and before the libraries + * have been initialized. OS services and driver services are available. + * + ****************************************************************************/ + +void drivers_initialize(void) +{ +#ifdef CONFIG_PM + /* Initialize power management subsystem proper */ + + pm_initialize(); +#endif + + /* Register devices */ + + syslog_initialize(); + +#if defined(CONFIG_DEV_NULL) + devnull_register(); /* Standard /dev/null */ +#endif + +#if defined(CONFIG_DEV_RANDOM) + devrandom_register(); /* Standard /dev/random */ +#endif + +#if defined(CONFIG_DEV_URANDOM) + devurandom_register(); /* Standard /dev/urandom */ +#endif + +#if defined(CONFIG_DEV_ZERO) + devzero_register(); /* Standard /dev/zero */ +#endif + +#if defined(CONFIG_DEV_LOOP) + loop_register(); /* Standard /dev/loop */ +#endif + +#if defined(CONFIG_DRIVER_NOTE) + note_register(); /* Non-standard /dev/note */ +#endif + + /* Initialize the serial device driver */ + +#ifdef CONFIG_RPMSG_UART + rpmsg_serialinit(); +#endif + + /* Initialize the console device driver (if it is other than the standard + * serial driver). + */ + +#if defined(CONFIG_LWL_CONSOLE) + lwlconsole_init(); +#elif defined(CONFIG_CONSOLE_SYSLOG) + syslog_console_init(); +#endif + +#ifdef CONFIG_PSEUDOTERM_SUSV1 + /* Register the master pseudo-terminal multiplexor device */ + + ptmx_register(); +#endif + +#if defined(CONFIG_CRYPTO) + /* Initialize the HW crypto and /dev/crypto */ + + up_cryptoinitialize(); +#endif + +#ifdef CONFIG_CRYPTO_CRYPTODEV + devcrypto_register(); +#endif + +#ifdef CONFIG_NET_LOOPBACK + /* Initialize the local loopback device */ + + localhost_initialize(); +#endif + +#ifdef CONFIG_NET_TUN + /* Initialize the TUN device */ + + tun_initialize(); +#endif + +#ifdef CONFIG_NETDEV_TELNET + /* Initialize the Telnet session factory */ + + telnet_initialize(); +#endif +} diff --git a/drivers/efuse/efuse.c b/drivers/efuse/efuse.c index 65d6342728..ffb57b75da 100644 --- a/drivers/efuse/efuse.c +++ b/drivers/efuse/efuse.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include diff --git a/include/nuttx/drivers/drivers.h b/include/nuttx/drivers/drivers.h index cfbf640ede..c1bc04beae 100644 --- a/include/nuttx/drivers/drivers.h +++ b/include/nuttx/drivers/drivers.h @@ -43,6 +43,16 @@ extern "C" #define EXTERN extern #endif +/**************************************************************************** + * Name: drivers_initialize + * + * Description: + * Initialize chip and board independent general driver + * + ****************************************************************************/ + +void drivers_initialize(void); + /**************************************************************************** * Name: devnull_register * @@ -217,6 +227,16 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, void lwlconsole_init(void); +/**************************************************************************** + * Name: rpmsg_serialinit + * + * Description: + * Register rpmsg serial driver + * + ****************************************************************************/ + +void rpmsg_serialinit(void); + #undef EXTERN #if defined(__cplusplus) } diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index 074cafde13..7938ce38de 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -39,8 +39,8 @@ #include #include #include -#include #include +#include #include #include @@ -648,6 +648,10 @@ void nx_start(void) binfmt_initialize(); #endif + /* Initialize common drivers */ + + drivers_initialize(); + /* Initialize Hardware Facilities *****************************************/ /* The processor specific details of running the operating system @@ -698,15 +702,6 @@ void nx_start(void) } } - /* Start SYSLOG ***********************************************************/ - - /* Late initialization of the system logging device. Some SYSLOG channel - * must be initialized late in the initialization sequence because it may - * depend on having IDLE task file structures setup. - */ - - syslog_initialize(); - #ifdef CONFIG_SMP /* Start all CPUs *********************************************************/