📄 usrconfig.c
字号:
cacheEnable (BRANCH_CACHE); /* enable branch cache */
#endif /* USER_B_CACHE_ENABLE */
#endif /* (CPU == MC68060) */
#endif /* INCLUDE_CACHE_SUPPORT */
DEBUG_PRINTSTR("calling kernelInit...\n");
/* start the kernel specifying usrRoot as the root task */
kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE,
(char *) MEM_POOL_START_ADRS,
sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL);
}
/*******************************************************************************
*
* usrRoot - the root task
*
* This is the first task to run under the multitasking kernel. It performs
* all final initialization and then starts other tasks.
*
* It initializes the I/O system, installs drivers, creates devices, and sets
* up the network, etc., as necessary for a particular configuration. It
* may also create and load the system symbol table, if one is to be included.
* It may then load and spawn additional tasks as needed. In the default
* configuration, it simply initializes the VxWorks shell.
*
* RETURNS: N/A
*/
void usrRoot
(
char * pMemPoolStart, /* start of system memory partition */
unsigned memPoolSize /* initial size of mem pool */
)
{
char tyName [20];
int ix;
DEBUG_PRINTSTR("entering usrRoot...\n");
taskSRInit(DEFAULT_SR);
/* Initialize the memory pool before initializing any other package.
* The memory associated with the root task will be reclaimed at the
* completion of its activities.
*/
#ifdef INCLUDE_MEM_MGR_FULL
memInit (pMemPoolStart, memPoolSize); /* initialize memory pool */
#else
memPartLibInit (pMemPoolStart, memPoolSize);/* initialize memory pool */
#endif /* INCLUDE_MEM_MGR_FULL */
#ifdef INCLUDE_SHOW_ROUTINES
memShowInit (); /* initialize memShow routine */
#endif /* INCLUDE_SHOW_ROUTINES */
#if defined(INCLUDE_MMU_BASIC) || defined(INCLUDE_MMU_FULL) || \
defined(INCLUDE_MMU_MPU)
usrMmuInit (); /* initialize the mmu */
#endif /* defined(INCLUDE_MMU_BASIC, INCLUDE_MMU_FULL, INCLUDE_MMU_MPU) */
/* set up system timer */
sysClkConnect ((FUNCPTR) usrClock, 0); /* connect clock ISR */
sysClkRateSet (SYS_CLK_RATE); /* set system clock rate */
sysClkEnable (); /* start it */
#ifdef INCLUDE_FAST_DRAM
/*
* make use of data cache as fast DRAM,
* establish parameters in config.h, MMU
* must be initialed before data cache is
* initialized as data ram...
*/
cacheCreateInternalDataRAM((UINT32 *)FD_ORIGIN, FD_NUMLINES);
#endif
/*
* The select library needs to be initialized before the tyLib module
* since the _func_selWakeupListInit FUNCPTR is required (SPR #3314).
* The installation of the select task delete hooks is performed
* later in usrRoot() after NFS and RPC have been initialized.
*/
#ifdef INCLUDE_SELECT
selectInit (NUM_FILES);
#endif /* INCLUDE_SELECT */
/* initialize I/O system */
#ifdef INCLUDE_IO_SYSTEM
iosInit (NUM_DRIVERS, NUM_FILES, "/null");
consoleFd = NONE; /* assume no console device */
#ifdef INCLUDE_TYCODRV_5_2
#ifdef INCLUDE_TTY_DEV
if (NUM_TTY > 0)
{
tyCoDrv (); /* install console driver */
for (ix = 0; ix < NUM_TTY; ix++) /* create serial devices */
{
sprintf (tyName, "%s%d", "/tyCo/", ix);
(void) tyCoDevCreate (tyName, ix, 512, 512);
if (ix == CONSOLE_TTY)
strcpy (consoleName, tyName); /* store console name */
}
consoleFd = open (consoleName, O_RDWR, 0);
/* set baud rate */
(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
(void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
}
#endif /* INCLUDE_TTY_DEV */
#else /* !INCLUDE_TYCODRV_5_2 */
#ifdef INCLUDE_TTY_DEV
if (NUM_TTY > 0)
{
ttyDrv(); /* install console driver */
for (ix = 0; ix < NUM_TTY; ix++) /* create serial devices */
{
#if (defined(INCLUDE_WDB) && (WDB_COMM_TYPE == WDB_COMM_SERIAL))
if (ix == WDB_TTY_CHANNEL) /* don't use WDBs channel */
continue;
#endif
sprintf (tyName, "%s%d", "/tyCo/", ix);
(void) ttyDevCreate (tyName, sysSerialChanGet(ix), 512, 512);
if (ix == CONSOLE_TTY) /* init the tty console */
{
strcpy (consoleName, tyName);
consoleFd = open (consoleName, O_RDWR, 0);
(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
(void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
}
}
}
#endif /* INCLUDE_TTY_DEV */
#ifdef INCLUDE_PC_CONSOLE
pcConDrv ();
for (ix = 0; ix < N_VIRTUAL_CONSOLES; ix++)
{
sprintf (tyName, "%s%d", "/pcConsole/", ix);
(void) pcConDevCreate (tyName,ix, 512, 512);
if (ix == PC_CONSOLE) /* init the console device */
{
strcpy (consoleName, tyName);
consoleFd = open (consoleName, O_RDWR, 0);
(void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
(void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
}
}
#endif /* INCLUDE_PC_CONSOLE */
#endif /* !INCLUDE_TYCODRV_5_2 */
ioGlobalStdSet (STD_IN, consoleFd);
ioGlobalStdSet (STD_OUT, consoleFd);
ioGlobalStdSet (STD_ERR, consoleFd);
#endif /* INCLUDE_IO_SYSTEM */
/*----------------------------------------------------------------------
!AFTER THIS POINT, CONSOLE SHOULD BE WORKING!
----------------------------------------------------------------------*/
/* initialize symbol table facilities */
#ifdef INCLUDE_SYM_TBL
hashLibInit (); /* initialize hash table package */
symLibInit (); /* initialize symbol table package */
#ifdef INCLUDE_SHOW_ROUTINES
symShowInit (); /* initialize symbol table show */
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_SYM_TBL */
/* initialize exception handling */
#if defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK)
#ifdef INCLUDE_EXC_SHOW
excShowInit ();
#endif
excInit (); /* initialize exception handling */
#endif /* defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK) */
#ifdef INCLUDE_LSTLIB
lstLibInit ();
#endif
#ifdef INCLUDE_LOGGING
logInit (consoleFd, MAX_LOG_MSGS); /* initialize logging */
# ifdef INCLUDE_LOG_STARTUP
logMsg ("logging started to %s [%d], queue size %d\n",
consoleName, consoleFd, MAX_LOG_MSGS, 4,5,6);
taskDelay (2); /* allow time for message to be displayed */
# endif /* INCLUDE_LOG_STARTUP */
#endif /* INCLUDE_LOGGING */
/*----------------------------------------------------------------------
!AFTER THIS POINT, YOU CAN USE LOGMSG!
----------------------------------------------------------------------*/
#ifdef INCLUDE_SIGNALS
sigInit (); /* initialize signals */
#endif /* INCLUDE_SIGNALS */
/* initialize debugging */
#ifdef INCLUDE_DEBUG
dbgInit (); /* initialize debugging */
#endif /* INCLUDE_DEBUG */
/* initialize pipe driver */
#ifdef INCLUDE_PIPES
pipeDrv (); /* install pipe driver */
#endif /* INCLUDE_PIPES */
/* initialize standard I/O package */
#ifdef INCLUDE_STDIO
stdioInit (); /* initialize standard I/O library */
#ifdef INCLUDE_SHOW_ROUTINES
stdioShowInit ();
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_STDIO */
/*----------------------------------------------------------------------
!AFTER THIS POINT, YOU CAN USE STDIO ROUTINES(PRINTF, VSPRINTF ETC)!
----------------------------------------------------------------------*/
/* initialize POSIX queued signals */
#if defined(INCLUDE_POSIX_SIGNALS) && defined(INCLUDE_SIGNALS)
sigqueueInit (NUM_SIGNAL_QUEUES); /* initialize queued signals */
#endif
/* initialize POSIX semaphores */
#ifdef INCLUDE_POSIX_SEM
semPxLibInit ();
#ifdef INCLUDE_SHOW_ROUTINES
semPxShowInit ();
#endif /* INCLUDE_SHOW_POUTINES */
#endif /* INCLUDE_POSIX_SEM */
/* initialize POSIX threads */
#ifdef INCLUDE_POSIX_PTHREADS
pthreadLibInit ();
#endif /* INCLUDE_POSIX_PTHREADS */
/* initialize POSIX message queues */
#ifdef INCLUDE_POSIX_MQ
mqPxLibInit (MQ_HASH_SIZE);
#ifdef INCLUDE_SHOW_ROUTINES
mqPxShowInit ();
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_POSIX_MQ */
/* initialize POSIX async I/O support */
#ifdef INCLUDE_POSIX_AIO
aioPxLibInit (MAX_LIO_CALLS);
#ifdef INCLUDE_POSIX_AIO_SYSDRV
aioSysInit (MAX_AIO_SYS_TASKS, AIO_TASK_PRIORITY, AIO_TASK_STACK_SIZE);
#endif /* INCLUDE_POSIX_AIO_SYSDRV */
#endif /* INCLUDE_POSIX_AIO */
#ifdef INCLUDE_CBIO /* init main CBIO module, cbioLib() */
cbioLibInit();
#endif INCLUDE_CBIO
/* initialize filesystems and disk drivers */
#ifdef INCLUDE_DOSFS_MAIN /* dosFs2 file system initialization */
hashLibInit (); /* initialize hash table package */
/* First initialize the main dosFs module */
dosFsLibInit( 0 );
/* Initialize sub-modules */
/* ensure that at least one directory handler is defined */
# if ((!defined INCLUDE_DOSFS_DIR_VFAT) && \
(!defined INCLUDE_DOSFS_DIR_FIXED))
# define INCLUDE_DOSFS_DIR_VFAT
# endif
/* init VFAT (MS long file names) module */
# ifdef INCLUDE_DOSFS_DIR_VFAT
/* Sub-module: VFAT Directory Handler */
dosVDirLibInit();
# endif /* INCLUDE_DOSFS_DIR_VFAT */
/* init strict 8.3 and vxLongNames handler */
# ifdef INCLUDE_DOSFS_DIR_FIXED
/* Sub-module: Vintage 8.3 and VxLong Directory Handler */
dosDirOldLibInit();
# endif /* INCLUDE_DOSFS_DIR_FIXED */
/* Sub-module: FAT12/FAT16/FAT32 FAT Handler */
dosFsFatInit();
# ifdef INCLUDE_DOSFS_CHKDSK
/* Sub-module: Consistency check handler */
dosChkLibInit();
# endif /* INCLUDE_DOSFS_CHKDSK */
# ifdef INCLUDE_DOSFS_FMT
/* Sub-module: Formatter */
dosFsFmtLibInit(); /* init dosFs scalable formatter */
# endif /* INCLUDE_DOSFS_FMT */
#endif /* INCLUDE_DOSFS_MAIN */
/* dosFs1 legacy code, dosFsInit(), usrDosFsOld.c */
#ifdef INCLUDE_DOSFS
hashLibInit (); /* initialize hash table package */
dosFsInit (NUM_DOSFS_FILES); /* init dosFs filesystem */
#endif /* INCLUDE_DOSFS */
#ifdef INCLUDE_RAWFS
rawFsInit (NUM_RAWFS_FILES); /* init rawFs filesystem */
#endif /* INCLUDE_RAWFS */
#ifdef INCLUDE_RT11FS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -