www.pudn.com > S3c2410bsp.zip > usrConfig.c
/* usrConfig.c - user-defined system configuration library */
/* Copyright 1984-2002 Wind River Systems, Inc. */
#include "copyright_wrs.h"
#include "vxWorks.h"
#include "config.h"
#include "usrConfig.h"
#include "usrDepend.c"
#include "usrKernel.c"
#include "usrExtra.c"
#if CPU==SIMNT
extern int simUpMutex;
extern int win_ReleaseMutex(int hMutex);
#endif
#ifdef INCLUDE_HTTP
#include "http/httpLib.h"
#endif
#ifdef INCLUDE_COM
extern int comLibInit ();
#endif
#ifdef INCLUDE_DCOM
extern int dcomLibInit ();
#endif
#ifdef INCLUDE_WDB
#define FREE_MEM_START_ADRS (FREE_RAM_ADRS + WDB_POOL_SIZE)
#else
#define FREE_MEM_START_ADRS FREE_RAM_ADRS
#endif
#ifdef INCLUDE_INITIAL_MEM_ALLOCATION
#define MEM_POOL_START_ADRS \
(ROUND_UP(FREE_MEM_START_ADRS, (INITIAL_MEM_ALIGNMENT)) + \
(INITIAL_MEM_SIZE))
#else /* INCLUDE_INITIAL_MEM_ALLOCATION */
#define MEM_POOL_START_ADRS FREE_MEM_START_ADRS
#endif /* INCLUDE_INITIAL_MEM_ALLOCATION */
int consoleFd; /* fd of initial console device */
char consoleName[20]; /* console device name, eg. "/tyCo/0" */
SYMTAB_ID statSymTbl; /* system error status symbol table id*/
SYMTAB_ID standAloneSymTbl; /* STANDALONE version symbol table id */
SYMTAB_ID sysSymTbl; /* system symbol table id */
BOOT_PARAMS sysBootParams; /* parameters from boot line */
int sysStartType; /* type of boot (WARM, COLD, etc) */
/* Two magic cookies used to detect data section misalignment */
#define TRAP_VALUE_1 0x12348765
#define TRAP_VALUE_2 0x5a5ac3c3
LOCAL volatile UINT32 trapValue1 = TRAP_VALUE_1;
LOCAL volatile UINT32 trapValue2 = TRAP_VALUE_2;
/*******************************************************************************
*
* usrInit - user-defined system initialization routine
*
* This is the first C code executed after the system boots. This routine is
* called by the assembly language start-up routine sysInit() which is in the
* sysALib module of the target-specific directory. It is called with
* interrupts locked out. The kernel is not multitasking at this point.
*
* This routine starts by clearing BSS; thus all variables are initialized to 0,
* as per the C specification. It then initializes the hardware by calling
* sysHwInit(), sets up the interrupt/exception vectors, and starts kernel
* multitasking with usrRoot() as the root task.
*
* RETURNS: N/A
*
* SEE ALSO: kernelLib
*
* ARGSUSED0
*/
void usrInit
(
int startType
)
{
while (trapValue1 != TRAP_VALUE_1 || trapValue2 != TRAP_VALUE_2)
{
}
#if (CPU_FAMILY == SPARC)
excWindowInit (); /* SPARC window management */
#endif
#ifdef INCLUDE_SYS_HW_INIT_0
SYS_HW_INIT_0 ();
#endif /* INCLUDE_SYS_HW_INIT_0 */
/* configure data and instruction cache if available and leave disabled */
#ifdef INCLUDE_CACHE_SUPPORT
/*
* SPR 73609: If a cache is not to be enabled, don't require
* its mode to be defined. Instead, default it to disabled.
*/
# if (!defined(USER_D_CACHE_ENABLE) && !defined(USER_D_CACHE_MODE))
# define USER_D_CACHE_MODE CACHE_DISABLED
# endif /* !USER_D_CACHE_ENABLE && !USER_D_CACHE_MODE */
# if (!defined(USER_I_CACHE_ENABLE) && !defined(USER_I_CACHE_MODE))
# define USER_I_CACHE_MODE CACHE_DISABLED
# endif /* !USER_I_CACHE_ENABLE && !USER_I_CACHE_MODE */
cacheLibInit (USER_I_CACHE_MODE, USER_D_CACHE_MODE);
#endif /* INCLUDE_CACHE_SUPPORT */
#if CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS
/* don't assume bss variables are zero before this call */
bzero (edata, end - edata); /* zero out bss variables */
#endif /* CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS */
#if (CPU_FAMILY == PPC)
/*
* Immediately after clearing the bss, ensure global stdin
* etc. are ERROR until set to real values. This is used in
* target/src/arch/ppc/excArchLib.c to improve diagnosis of
* exceptions which occur before I/O is set up.
*/
ioGlobalStdSet (STD_IN, ERROR);
ioGlobalStdSet (STD_OUT, ERROR);
ioGlobalStdSet (STD_ERR, ERROR);
#endif /* CPU_FAMILY == PPC */
sysStartType = startType; /* save type of system start */
intVecBaseSet ((FUNCPTR *) VEC_BASE_ADRS); /* set vector base table */
#if (CPU_FAMILY == AM29XXX)
excSpillFillInit (); /* am29k stack cache managemt */
#endif
#ifdef INCLUDE_EXC_HANDLING
# if (CPU_FAMILY == PPC) && defined(INCLUDE_EXC_SHOW)
/*
* Do this ahead of excVecInit() to set up _func_excPanicHook, in case
* the enabling of Machine Check there allows a pending one to occur.
* excShowInit() will be called again later, harmlessly.
*/
excShowInit ();
# endif /* CPU_FAMILY == PPC && defined(INCLUDE_EXC_SHOW) */
excVecInit (); /* install exception vectors */
#endif /* INCLUDE_EXC_HANDLING */
sysHwInit (); /* initialize system hardware */
usrKernelInit (); /* configure the Wind kernel */
#ifdef INCLUDE_USB
# ifdef INCLUDE_OHCI_PCI_INIT
sysUsbPciOhciInit ();
# endif
#endif
#ifdef INCLUDE_CACHE_SUPPORT
#ifdef USER_I_CACHE_ENABLE
cacheEnable (INSTRUCTION_CACHE); /* enable instruction cache */
#endif /* USER_I_CACHE_ENABLE */
#ifdef USER_D_CACHE_ENABLE
cacheEnable (DATA_CACHE); /* enable data cache */
#endif /* USER_D_CACHE_ENABLE */
#if (CPU == MC68060)
#ifdef USER_B_CACHE_ENABLE
cacheEnable (BRANCH_CACHE); /* enable branch cache */
#endif /* USER_B_CACHE_ENABLE */
#endif /* (CPU == MC68060) */
#endif /* INCLUDE_CACHE_SUPPORT */
/* 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
*
*
* RETURNS: N/A
*/
void usrRoot
(
char * pMemPoolStart,
unsigned memPoolSize
)
{
char tyName [20];
int ix;
#ifdef INCLUDE_MEM_MGR_FULL
memInit (pMemPoolStart, memPoolSize);
#else
memPartLibInit (pMemPoolStart, memPoolSize);
#endif /* INCLUDE_MEM_MGR_FULL */
#ifdef INCLUDE_SHOW_ROUTINES
memShowInit ();
#endif /* INCLUDE_SHOW_ROUTINES */
#if defined(INCLUDE_MMU_BASIC) || defined(INCLUDE_MMU_FULL) || \
defined(INCLUDE_MMU_MPU)
usrMmuInit ();
#endif /* defined(INCLUDE_MMU_BASIC, INCLUDE_MMU_FULL, INCLUDE_MMU_MPU) */
sysClkConnect ((FUNCPTR) usrClock, 0);
sysClkRateSet (SYS_CLK_RATE);
sysClkEnable ();
#ifdef INCLUDE_FAST_DRAM
cacheCreateInternalDataRAM((UINT32 *)FD_ORIGIN, FD_NUMLINES);
#endif
#ifdef INCLUDE_SELECT
selectInit (NUM_FILES);
#endif /* INCLUDE_SELECT */
#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 ();
for (ix = 0; ix < NUM_TTY; ix++)
{
sprintf (tyName, "%s%d", "/tyCo/", ix);
(void) tyCoDevCreate (tyName, ix, 512, 512);
if (ix == CONSOLE_TTY)
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 */
#else /* !INCLUDE_TYCODRV_5_2 */
#ifdef INCLUDE_TTY_DEV
if (NUM_TTY > 0)
{
ttyDrv();
for (ix = 0; ix < NUM_TTY; ix++)
{
#if (defined(INCLUDE_WDB) && (WDB_COMM_TYPE == WDB_COMM_SERIAL))
if (ix == WDB_TTY_CHANNEL)
continue;
#endif
sprintf (tyName, "%s%d", "/tyCo/", ix);
(void) ttyDevCreate (tyName, sysSerialChanGet(ix), 512, 512);
if (ix == CONSOLE_TTY)
{
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)
{
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 */
#ifdef INCLUDE_SYM_TBL
hashLibInit ();
symLibInit ();
#ifdef INCLUDE_SHOW_ROUTINES
symShowInit ();
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_SYM_TBL */
#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);
# ifdef INCLUDE_LOG_STARTUP
logMsg ("logging started to %s [%d], queue size %d\n",
consoleName, consoleFd, MAX_LOG_MSGS, 4,5,6);
taskDelay (2);
# endif /* INCLUDE_LOG_STARTUP */
#endif /* INCLUDE_LOGGING */
#ifdef INCLUDE_SIGNALS
sigInit ();
#endif /* INCLUDE_SIGNALS */
#ifdef INCLUDE_DEBUG
dbgInit ();
#endif /* INCLUDE_DEBUG */
#ifdef INCLUDE_PIPES
pipeDrv ();
#endif /* INCLUDE_PIPES */
#ifdef INCLUDE_STDIO
stdioInit ();
#ifdef INCLUDE_SHOW_ROUTINES
stdioShowInit ();
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_STDIO */
#if defined(INCLUDE_POSIX_SIGNALS) && defined(INCLUDE_SIGNALS)
sigqueueInit (NUM_SIGNAL_QUEUES);
#endif
#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
cbioLibInit();
#endif INCLUDE_CBIO
#ifdef INCLUDE_DOSFS_MAIN
hashLibInit ();
dosFsLibInit( 0 );
# if ((!defined INCLUDE_DOSFS_DIR_VFAT) && \
(!defined INCLUDE_DOSFS_DIR_FIXED))
# define INCLUDE_DOSFS_DIR_VFAT
# endif
# ifdef INCLUDE_DOSFS_DIR_VFAT
dosVDirLibInit();
# endif /* INCLUDE_DOSFS_DIR_VFAT */
# ifdef INCLUDE_DOSFS_DIR_FIXED
dosDirOldLibInit();
# endif /* INCLUDE_DOSFS_DIR_FIXED */
dosFsFatInit();
# ifdef INCLUDE_DOSFS_CHKDSK
dosChkLibInit();
# endif /* INCLUDE_DOSFS_CHKDSK */
# ifdef INCLUDE_DOSFS_FMT
dosFsFmtLibInit(); /* init dosFs scalable formatter */
# endif /* INCLUDE_DOSFS_FMT */
#endif /* INCLUDE_DOSFS_MAIN */
#ifdef INCLUDE_DOSFS
hashLibInit ();
dosFsInit (NUM_DOSFS_FILES);
#endif /* INCLUDE_DOSFS */
#ifdef INCLUDE_RAWFS
rawFsInit (NUM_RAWFS_FILES);
#endif /* INCLUDE_RAWFS */
#ifdef INCLUDE_RT11FS
rt11FsInit (NUM_RT11FS_FILES);
#endif /* INCLUDE_RT11FS */
#ifdef INCLUDE_RAMDRV
ramDrv ();
#endif /* INCLUDE_RAMDRV */
/* initialize USB components */
#ifdef INCLUDE_USB_INIT
usbInit (); /* USB Host Stack Initialization */
#endif
#ifdef INCLUDE_UHCI_INIT
usrUsbHcdUhciAttach (); /* UHCI Initialization */
#endif
#ifdef INCLUDE_OHCI_INIT
usrUsbHcdOhciAttach (); /* OHCI Initialization */
#endif
#ifdef INCLUDE_USB_MOUSE_INIT
usrUsbMseInit (); /* Mouse Driver Initialization */
#endif
#ifdef INCLUDE_USB_KEYBOARD_INIT
usrUsbKbdInit (); /* Keyboard Driver Initialization */
#endif
#ifdef INCLUDE_USB_PRINTER_INIT
usrUsbPrnInit (); /* Printer Driver Initialization */
#endif
#ifdef INCLUDE_USB_SPEAKER_INIT
usrUsbSpkrInit (); /* Speaker Driver Initialization */
#endif
#ifdef INCDLUE_USB_AUDIO_DEMO
usrUsbAudioDemo (); /* USB Audio Demo */
#endif
#ifdef INCLUDE_USB_MS_BULKONLY_INIT
usrUsbBulkDevInit(); /* Bulk Driver Initialization */
#endif
#ifdef INCLUDE_USB_MS_CBI_INIT
usrUsbCbiUfiDevInit (); /* CBI Driver Initialization */
#endif
#ifdef INCLUDE_USB_PEGASUS_END_INIT
usrUsbPegasusEndInit (); /* Pegasus Driver Initialization */
#endif
#ifdef INCLUDE_SCSI
/*
* initialize either the SCSI1 or SCSI2 interface; initialize SCSI2 when
* the SCSI2 interface is available.
*/
#ifndef INCLUDE_SCSI2
scsi1IfInit ();
#else
scsi2IfInit ();
#endif
/* initialize SCSI controller */
if (sysScsiInit () == OK)
{
usrScsiConfig (); /* configure SCSI peripherals */
}
else
{
#ifdef INCLUDE_STDIO
printf ("sysScsiInit() Failed, SCSI system not initialized\n");
#endif /* INCLUDE_STDIO */
}
#endif /* INCLUDE_SCSI */
#ifdef INCLUDE_FD /* initialize floppy disk driver */
if ((fdDrv (FD_INT_VEC, FD_INT_LVL)) == ERROR)
{
#ifdef INCLUDE_STDIO
printf ("fdDrv returned ERROR from usrRoot.\n");
#endif /* INCLUDE_STDIO */
}
#endif /* INCLUDE_FD */
#ifdef INCLUDE_IDE
/* init IDE disk driver */
if ((ideDrv (IDE_INT_VEC, IDE_INT_LVL, IDE_CONFIG)) == ERROR)
{
#ifdef INCLUDE_STDIO
printf ("ideDrv returned ERROR from usrRoot.\n");
#endif /* INCLUDE_STDIO */
}
#endif /* INCLUDE_IDE */
#ifdef INCLUDE_ATA
{ /* initialize hard disk driver */
IMPORT ATA_RESOURCE ataResources[];
ATA_RESOURCE *pAtaResource;
for (ix = 0; ix < ATA_MAX_CTRLS; ix++)
{
pAtaResource = &ataResources[ix];
if (pAtaResource->ctrlType == IDE_LOCAL)
if ((ataDrv (ix, pAtaResource->drives, pAtaResource->intVector,
pAtaResource->intLevel, pAtaResource->configType,
pAtaResource->semTimeout, pAtaResource->wdgTimeout))
== ERROR)
{
#ifdef INCLUDE_STDIO
printf ("ataDrv returned ERROR from usrRoot.\n");
#endif /* INCLUDE_STDIO */
}
}
}
#ifdef INCLUDE_SHOW_ROUTINES
ataShowInit (); /* install ATA/IDE show routine */
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_ATA */
#ifdef INCLUDE_LPT
{
IMPORT LPT_RESOURCE lptResources[];
lptDrv (LPT_CHANNELS, &lptResources[0]); /* init LPT parallel driver */
}
#endif /* INCLUDE_LPT */
#ifdef INCLUDE_PCMCIA
#ifdef INCLUDE_SHOW_ROUTINES
pcmciaShowInit (); /* install PCMCIA show routines */
#endif /* INCLUDE_SHOW_ROUTINES */
pcmciaInit (); /* init PCMCIA Lib */
#endif /* INCLUDE_PCMCIA */
#ifdef INCLUDE_TFFS
tffsDrv (); /* it should be after pcmciaInit() */
#endif /* INCLUDE_TFFS */
#ifdef INCLUDE_FORMATTED_IO
fioLibInit (); /* initialize formatted I/O */
#endif /* INCLUDE_FORMATTED_IO */
/* initialize floating point facilities */
#ifdef INCLUDE_FLOATING_POINT
floatInit (); /* initialize floating point I/O */
#endif /* INCLUDE_FLOATING_POINT */
/* install software floating point emulation (if applicable) */
#ifdef INCLUDE_SW_FP
mathSoftInit (); /* use software emulation for fp math */
#endif /* INCLUDE_SW_FP */
/* install hardware floating point support (if applicable) */
#ifdef INCLUDE_HW_FP
mathHardInit (); /* do fppInit() & install hw fp math */
#ifdef INCLUDE_SHOW_ROUTINES
fppShowInit (); /* install hardware fp show routine */
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_HW_FP */
/* install dsp support (if applicable) */
#ifdef INCLUDE_DSP
usrDspInit (); /* do dspInit() */
#endif /* INCLUDE_DSP */
/* initialize AltiVec library (if applicable) */
#ifdef INCLUDE_ALTIVEC
usrAltivecInit ();
#endif /* INCLUDE_ALTIVEC */
/* initialize performance monitoring tools */
#ifdef INCLUDE_SPY
spyLibInit (); /* install task cpu utilization tool */
#endif /* INCLUDE_SPY */
#ifdef INCLUDE_TIMEX
timexInit (); /* install function timing tool */
#endif /* INCLUDE_TIMEX */
#ifdef INCLUDE_ENV_VARS
envLibInit (ENV_VAR_USE_HOOKS); /* initialize environment variable */
#endif /* INCLUDE_ENV_VARS */
#ifdef INCLUDE_NTPASSFS
{
IMPORT int ntPassFsInit();
IMPORT void * ntPassFsDevInit();
IMPORT char fullExePath[];
char passName [MAX_FILENAME_LENGTH];
char * defPathEnd;
if (ntPassFsInit(1) == OK)
{
if (ntPassFsDevInit("host:") == NULL)
{
#ifdef INCLUDE_STDIO
printf ("ntPassFsDevInit failed for host: \n");
#endif /* INCLUDE_STDIO */
}
else
{
sprintf (passName, "host:%s", fullExePath);
/* Remove bootFile name at the end of the string */
defPathEnd = strrchr (passName, '\\');
if (defPathEnd != NULL)
*defPathEnd = '\0';
ioDefPathSet (passName);
}
}
else
{
#ifdef INCLUDE_STDIO
printf ("ntPassFsInit failed\n");
#endif /* INCLUDE_STDIO */
}
}
#endif /* INCLUDE_NTPASSFS */
/* initialize object module loader */
#ifdef INCLUDE_LOADER
moduleLibInit (); /* initialize module manager */
#if defined(INCLUDE_AOUT)
loadAoutInit (); /* use a.out format */
#else /* coff or ecoff */
#if defined(INCLUDE_ECOFF)
loadEcoffInit (); /* use ecoff format */
#else /* ecoff */
#if defined(INCLUDE_COFF)
loadCoffInit (); /* use coff format */
#else /* coff */
#if defined(INCLUDE_ELF)
loadElfInit (); /* use elf format */
#else
#if defined(INCLUDE_SOM_COFF)
loadSomCoffInit ();
#else
#if defined(INCLUDE_PECOFF)
{
extern int loadPecoffInit();
loadPecoffInit ();
}
#endif
#endif
#endif
#endif
#endif
#endif
#endif /* INCLUDE_LOADER */
/* initialize network */
#ifdef INCLUDE_NET_INIT
usrBootLineInit (sysStartType); /* crack the bootline */
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
logMsg ("before usrNetInit()\n", 1,2,3,4,5,6);
taskDelay (2); /* allow time for message to be displayed */
# endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
usrNetInit (BOOT_LINE_ADRS); /* initialize network support */
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
logMsg ("after usrNetInit()\n", 1,2,3,4,5,6);
taskDelay (2); /* allow time for message to be displayed */
# endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
#endif /* INCLUDE_NET_INIT */
#ifdef INCLUDE_PASSFS
{
extern STATUS passFsInit ();
extern void *passFsDevInit ();
char passName [256];
if (passFsInit (1) == OK)
{
extern char vxsim_hostname[];
extern char vxsim_cwd[];
sprintf (passName, "%s:", vxsim_hostname);
if (passFsDevInit (passName) == NULL)
{
#ifdef INCLUDE_STDIO
printf ("passFsDevInit failed for <%s>\n", passName);
#endif /* INCLUDE_STDIO */
}
else
{
sprintf (passName, "%s:%s", vxsim_hostname, vxsim_cwd);
ioDefPathSet (passName);
}
}
else
#ifdef INCLUDE_STDIO
printf ("passFsInit failed\n");
#endif /* INCLUDE_STDIO */
}
#endif /* INCLUDE_PASSFS */
#ifdef INCLUDE_DOS_DISK
{
char unixName [80];
extern void unixDrv ();
extern void unixDiskInit ();
extern char *u_progname; /* home of executable */
char *pLastSlash;
unixDrv ();
pLastSlash = strrchr (u_progname, '/');
pLastSlash = (pLastSlash == NULL) ? u_progname : (pLastSlash + 1);
sprintf (unixName, "/tmp/%s%d.dos", pLastSlash, sysProcNumGet());
unixDiskInit (unixName, "A:", 0);
}
#endif /* INCLUDE_DOS_DISK */
/* initialize shared memory objects */
#ifdef INCLUDE_SM_OBJ /* unbundled shared memory objects */
usrSmObjInit (BOOT_LINE_ADRS);
#endif /* INCLUDE_SM_OBJ */
/* initialize WindMP */
#ifdef INCLUDE_VXFUSION /* unbundled VxFusion (distributed objects) */
usrVxFusionInit (BOOT_LINE_ADRS);
#ifdef INCLUDE_SHOW_ROUTINES
{
extern void msgQDistShowInit();
extern void distNameShowInit ();
extern void distIfShowInit ();
extern void msgQDistGrpShowInit ();
msgQDistShowInit();
distNameShowInit ();
distIfShowInit ();
msgQDistGrpShowInit ();
}
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_WINDMP */
/* write protect text segment & vector table only after bpattach () */
#ifdef INCLUDE_MMU_FULL /* unbundled mmu product */
#ifdef INCLUDE_PROTECT_TEXT
if (vmTextProtect () != OK)
printf ("\nError protecting text segment. errno = %x\n", errno);
#endif /* INCLUDE_PROTECT_TEXT */
#ifdef INCLUDE_PROTECT_VEC_TABLE
if (intVecTableWriteProtect () != OK)
printf ("\nError protecting vector table. errno = %x\n", errno);
#endif /* INCLUDE_PROTECT_VEC_TABLE */
#endif /* INCLUDE_MMU_FULL */
/* install select hook only after NFS/RPC for proper delete hook order */
#ifdef INCLUDE_SELECT
selTaskDeleteHookAdd ();
#endif /* INCLUDE_SELECT */
/* create system and status symbol tables */
#ifdef INCLUDE_STANDALONE_SYM_TBL
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
logMsg ("before symTblCreate()\n", 1,2,3,4,5,6);
taskDelay (2); /* allow time for message to be displayed */
# endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);
printf ("\nAdding %ld symbols for standalone.\n", standTblSize);
/* fill in from built in table*/
for (ix = 0; (ULONG) ix < standTblSize; ix++)
#if ((CPU_FAMILY == ARM) && ARM_THUMB)
thumbSymTblAdd (sysSymTbl, &(standTbl[ix]));
#else
symTblAdd (sysSymTbl, &(standTbl[ix]));
#endif /* CPU_FAMILY == ARM */
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
logMsg ("sysSymTbl complete.\n", 1,2,3,4,5,6);
taskDelay (2); /* allow time for message to be displayed */
# endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
#endif /* INCLUDE_STANDALONE_SYM_TBL */
#ifdef INCLUDE_NET_SYM_TBL
sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);
netLoadSymTbl (); /* fill in table from host */
#endif /* INCLUDE_NET_SYM_TBL */
#ifdef INCLUDE_STAT_SYM_TBL
statSymTbl = symTblCreate (STAT_TBL_HASH_SIZE_LOG2, FALSE, memSysPartId);
for (ix = 0; (ULONG)ix < statTblSize; ix ++) /* fill in from builtin table*/
symTblAdd (statSymTbl, &(statTbl [ix]));
#endif /* INCLUDE_STAT_SYM_TBL */
#ifdef INCLUDE_SYM_TBL_SYNC
/* initialize wtx client to synchronize host and target symbol tables */
symSyncLibInit ();
#endif /* INCLUDE_SYM_TBL_SYNC */
/* initialize C++ support library */
#if defined (INCLUDE_CPLUS) && defined (INCLUDE_CPLUS_MIN)
#error Define only one of INCLUDE_CPLUS or INCLUDE_CPLUS_MIN, not both
#endif
#if defined (INCLUDE_CPLUS) || defined (INCLUDE_CPLUS_MIN)
#ifndef INCLUDE_CTORS_DTORS
#define INCLUDE_CTORS_DTORS
#endif
#endif
#ifdef INCLUDE_CTORS_DTORS
/*
* call compiler generated init functions (usually - but not necessarily -
* C++ related)
*/
cplusCtorsLink ();
#endif
#ifdef INCLUDE_CPLUS /* all standard C++ runtime support */
cplusLibInit ();
#endif
#ifdef INCLUDE_CPLUS_MIN /* minimal C++ runtime support */
cplusLibMinInit ();
#endif
#ifdef INCLUDE_CPLUS_DEMANGLER
cplusDemanglerInit ();
#endif
/* initialize COM/DCOM runtime support */
#ifdef INCLUDE_COM
comLibInit ();
#endif
#ifdef INCLUDE_DCOM
dcomLibInit ();
#endif
/* initialize Wind Web Server */
#ifdef INCLUDE_HTTP
httpd ();
#endif /* INCLUDE_HTTP */
#ifdef INCLUDE_RBUFF /* install rBuff support */
rBuffLibInit();
#ifdef INCLUDE_SHOW_ROUTINES
rBuffShowInit (); /* install rBuff show routine */
#endif /* INCLUDE_SHOW_ROUTINES */
#endif /* INCLUDE_RBUFF */
#ifdef INCLUDE_WINDVIEW
windviewConfig ();
#endif /* INCLUDE_WINDVIEW */
/* initialize the WDB debug agent */
#ifdef INCLUDE_WDB
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
logMsg ("before wdbConfig()\n", 1,2,3,4,5,6);
taskDelay (2); /* allow time for message to be displayed */
# endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
wdbConfig();
# if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
logMsg ("after wdbConfig()\n", 1,2,3,4,5,6);
taskDelay (2); /* allow time for message to be displayed */
# endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
#ifdef INCLUDE_WDB_BANNER
#if (WDB_COMM_TYPE == WDB_COMM_NETWORK)
#define WDB_COMM_TYPE_STR "WDB_COMM_NETWORK"
#endif /* WDB_COMM_TYPE == WDB_COMM_NETWORK */
#if (WDB_COMM_TYPE == WDB_COMM_SERIAL)
#define WDB_COMM_TYPE_STR "WDB_COMM_SERIAL"
#endif /* WDB_COMM_TYPE == WDB_COMM_SERIAL */
#if (WDB_COMM_TYPE == WDB_COMM_TYCODRV_5_2)
#define WDB_COMM_TYPE_STR "WDB_COMM_TYCODRV_5_2"
#endif /* WDB_COMM_TYPE == WDB_COMM_TYCODRV_5_2 */
#if (WDB_COMM_TYPE == WDB_COMM_NETROM)
#define WDB_COMM_TYPE_STR "WDB_COMM_NETROM"
#endif /* WDB_COMM_TYPE == WDB_COMM_NETROM */
#if (WDB_COMM_TYPE == WDB_COMM_VTMD)
#define WDB_COMM_TYPE_STR "WDB_COMM_VTMD"
#endif /* WDB_COMM_TYPE == WDB_COMM_VTMD */
#if (WDB_COMM_TYPE == WDB_COMM_END)
#define WDB_COMM_TYPE_STR "WDB_COMM_END"
#endif /* WDB_COMM_TYPE == WDB_COMM_END */
#if (WDB_COMM_TYPE == WDB_COMM_CUSTOM)
#define WDB_COMM_TYPE_STR "WDB_COMM_CUSTOM"
#endif /* WDB_COMM_TYPE == WDB_COMM_CUSTOM */
#if (WDB_COMM_TYPE == WDB_COMM_PIPE)
#define WDB_COMM_TYPE_STR "WDB_COMM_PIPE"
#endif /* WDB_COMM_TYPE == WDB_COMM_PIPE */
#ifndef WDB_COMM_TYPE_STR
#define WDB_COMM_TYPE_STR "Unknown"
#endif /* WDB_COMM_TYPE_STR */
#ifndef INCLUDE_SHELL
/* WDB banner same as printed by usrWdbBanner */
printf ("\n\n");
printf ("%23s\n\n", runtimeName);
printf ("Copyright 1984-2002 Wind River Systems, Inc.\n\n");
printf (" CPU: %s\n", sysModel ());
printf (" Runtime Name: %s\n", runtimeName);
printf ("Runtime Version: %s\n", runtimeVersion);
printf (" BSP version: " BSP_VERSION BSP_REV "\n");
printf (" Created: %s\n", creationDate);
printf (" WDB Comm Type: %s\n", WDB_COMM_TYPE_STR);
printf (" WDB: %s.\n\n",
((wdbRunsExternal () || wdbRunsTasking ()) ?
"Ready" : "Agent configuration failed") );
#endif /*INCLUDE_SHELL*/
#endif /*INCLUDE_WDB_BANNER*/
#endif /* INCLUDE_WDB */
/* initialize interactive shell */
#ifdef INCLUDE_SHELL
#ifdef INCLUDE_SECURITY /* include shell security */
if ((sysFlags & SYSFLG_NO_SECURITY) == 0)
{
loginInit (); /* initialize login table */
shellLoginInstall (loginPrompt, NULL); /* install security program */
/* add additional users here as required */
loginUserAdd (LOGIN_USER_NAME, LOGIN_PASSWORD);
}
#endif /* INCLUDE_SECURITY */
printLogo (); /* print out the banner page */
printf (" ");
printf ("CPU: %s. Processor #%d.\n", sysModel (), sysProcNumGet ());
printf (" ");
#ifdef HITACHI_SH_KERNEL_ON_SDRAM
printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)FREE_RAM_ADRS));
#else /* HITACHI_SH_KERNEL_ON_SDRAM */
printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)LOCAL_MEM_LOCAL_ADRS));
#endif /* HITACHI_SH_KERNEL_ON_SDRAM */
printf (" BSP version " BSP_VERSION BSP_REV ".");
#if defined(INCLUDE_WDB) && defined(INCLUDE_WDB_BANNER)
printf ("\n ");
printf ("WDB Comm Type: %s", WDB_COMM_TYPE_STR);
printf ("\n ");
printf ("WDB: %s.",
((wdbRunsExternal () || wdbRunsTasking ()) ?
"Ready" : "Agent configuration failed") );
#endif /*INCLUDE_WDB && INCLUDE_WDB_BANNER*/
printf ("\n\n");
#ifdef INCLUDE_STARTUP_SCRIPT /* run a startup script */
if (sysBootParams.startupScript [0] != EOS)
usrStartupScript (sysBootParams.startupScript);
#endif /* INCLUDE_STARTUP_SCRIPT */
shellInit (SHELL_STACK_SIZE, TRUE); /* create the shell */
/* only include the simple demo if the shell is NOT included */
#else
#if defined(INCLUDE_DEMO) /* create demo w/o shell */
taskSpawn ("demo", 20, 0, 2000, (FUNCPTR)usrDemo, 0,0,0,0,0,0,0,0,0,0);
#endif /* mips cpp no elif */
#endif /* INCLUDE_SHELL */
#ifdef INCLUDE_WINDML
usrWindMlInit ();
#endif /* INCLUDE_WINDML */
#if defined (INCLUDE_SOUND) && defined(INCLUDE_SB16)
sb16Drv (); /* install sound driver SB16 */
sb16DevCreate ("/sound", 0x220, 5, 1, 5);
#endif /* INCLUDE_SOUND && INCLUDE_SB16 */
#if defined(INCLUDE_JAVA)
javaConfig ();
#endif /* INCLUDE_JAVA */
#ifdef INCLUDE_HTML
usrHtmlInit ();
#endif /* INCLUDE_HTML */
#if CPU==SIMNT
win_ReleaseMutex(simUpMutex);
#endif
#ifdef INCLUDE_USER_APPL
/* Startup the user's application */
USER_APPL_INIT; /* must be a valid C statement or block */
#endif
}
/*******************************************************************************
*
* usrClock - user-defined system clock interrupt routine
*
* This routine is called at interrupt level on each clock interrupt.
* It is installed by usrRoot() with a sysClkConnect() call.
* It calls all the other packages that need to know about clock ticks,
* including the kernel itself.
*
* If the application needs anything to happen at the system clock interrupt
* level, it can be added to this routine.
*
* RETURNS: N/A
*/
void usrClock ()
{
tickAnnounce (); /* announce system tick to kernel */
}
#ifdef INCLUDE_DEMO
/********************************************************************************
* usrDemo - example application without shell
*
* This routine is spawned as a task at the end of usrRoot(), if INCLUDE_DEMO
* is defined, and INCLUDE_SHELL is NOT defined in configAll.h or config.h.
* It is intended to indicate how a shell-less application can be linked,
* loaded, and ROMed.
*
* NOMANUAL
*/
void usrDemo (void)
{
char string [40];
printf ("VxWorks (for %s) version %s.\n", sysModel (), vxWorksVersion);
printf ("Kernel: %s.\n", kernelVersion ());
printf ("Made on %s.\n", creationDate);
FOREVER
{
printf ("\nThis is a test. Type something: ");
fioRdString (STD_IN, string, sizeof (string));
printf ("\nYou typed \"%s\".\n", string);
if (strcmp (string, "0") == 0)
memShow (0);
if (strcmp (string, "1") == 0)
memShow (1);
}
}
#endif /* INCLUDE_DEMO */