mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
drivers: Merge the common driver initialization into one place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
ea614090cd
commit
c96c96a399
@@ -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
|
||||
|
||||
@@ -22,30 +22,10 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched_note.h>
|
||||
#include <nuttx/mm/iob.h>
|
||||
#include <nuttx/drivers/drivers.h>
|
||||
#include <nuttx/fs/loop.h>
|
||||
#include <nuttx/net/loopback.h>
|
||||
#include <nuttx/net/tun.h>
|
||||
#include <nuttx/net/telnet.h>
|
||||
#include <nuttx/syslog/ramlog.h>
|
||||
#include <nuttx/syslog/syslog.h>
|
||||
#include <nuttx/syslog/syslog_console.h>
|
||||
#include <nuttx/serial/pty.h>
|
||||
#include <nuttx/crypto/crypto.h>
|
||||
#include <nuttx/power/pm.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#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 */
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user