usrConfig.c
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:43k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* usrConfig.c - user-defined system configuration library */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. #include "copyright_wrs.h"
  4. /*
  5. modification history
  6. --------------------
  7. 19w,15may02,sbs  changing default sys clock rate to a macro (SPR #1918)
  8. 19v,24apr02,j_s  make WDB Banner the same as in
  9.                  target/config/comps/src/usrWdbBanner.c (SPR #76099)
  10.  updated 2001 to 2002
  11. 19u,19apr02,pch  SPR 74348: Enable PPC Machine Check exception ASAP
  12. 19t,05apr02,hbh  Fixed SPR# 30368 and improved ntPassFs initialization.
  13. 19s,04mar02,pch  SPR 73609
  14. 19r,11feb02,jkf  SPR#73173, adding INCLUDE_DOSFS_MAIN init section.
  15. 19q,21jan02,sn   added INCLUDE_CTORS_DTORS
  16. 19p,10dec01,jlb  Change UGL to WindML product
  17. 19o,07dec01,wef  add USB initialization code.
  18. 19n,07dec01,sn   added INCLUDE_CPLUS_DEMANGLER
  19. 19m,08nov01,jmp  removed useless routeAdd() for SIMNT.
  20. 19l,31oct01,gls  added pthread code
  21. 19k,27oct01,dat  Adding trap for misaligned data section SPR 9006
  22. 19j,21sep01,aeg  updated initialization sequence of selectLib (SPR #31319).
  23. 19i,17sep01,pcm  added excShowInit() (SPR 7333), and lstLibInit () (SPR 20698)
  24. 19h,15may01,pch  Move call of usrAltivecInit() from sysLib.c to usrConfig.c,
  25.                  to fix an undefined reference when building bootrom.
  26. 19g,20jan99,dbs  change VXCOM to COM
  27. 19f,18dec98,dbs  add VXCOM as separate item
  28. 19e,06nov98,dbs  add DCOM init when INCLUDE_DCOM is set
  29. 19g,22feb01,scm  add fast dram support capabilities for XScale...
  30. 19f,16mar99,jpd  changed copyright yearfrom 1998 to 1999.
  31. 19e,13nov98,jpd  call usrMmuInit if INCLUDE_MMU_MPU defined; conditionally
  32.  add sysHwInit0() call before cacheLibInit(); added
  33.  INCLUDE_INITIAL_MEM_ALLOCATION
  34.     cdp  make Thumb support for ARM CPUs dependent on ARM_THUMB.
  35. 19j,27feb01,hk   update INCLUDE_WDB_BANNER copyright notice to cover 2001.
  36. 19i,08jun00,csi  Merginf usrConfig.c for vxfusion
  37. 19h,19apr00,zl   updated copyright year to 2000.
  38. 19g,02mar00,zl   merged SH support into T2.
  39. 01g,07mar01,sn   simplify job of host val by using creationDate (which
  40.                  is overridable) rather than __DATE__
  41. 19g,14oct99,jk   added conditional init code for sound driver support.
  42. 19i,30jul99,jkf  fixed SPR#4429. ideDrv, ataDrv, fdDrv, warn on ERROR.
  43. 19h,16mar99,jpd  changed copyright yearfrom 1998 to 1999.
  44. 19g,10mar99,drm  Changing WINDMP to VXFUSION to reflect new product name.
  45. 19f,13nov98,jpd  call usrMmuInit if INCLUDE_MMU_MPU defined; conditionally
  46.  add sysHwInit0() call before cacheLibInit(); added
  47.  INCLUDE_INITIAL_MEM_ALLOCATION
  48.     cdp  make Thumb support for ARM CPUs dependent on ARM_THUMB.
  49. 19e,08oct98,rlp  added support for UGL and HTML.
  50. 19d,17sep98,ms   call cplusDemanglerInit if INCLUDE_CPLUS and INCLUDE_LOADER
  51. 19c,17sep98,cym  added code to calculate proper IP address for PCSIM.
  52. 19b,01sep98,drm  added code to initialize WindMP
  53. 19a,10aug98,cym  added code to inform tornado when the NT simulator is up.
  54. 18z,23apr98,yp   merged in TrueFFS support
  55. 18y,22apr98,elp  created group 1 module when standalone (fixed SPR# 20301).
  56. 18w,22apr98,hdn  added comment for tffsDrv().
  57. 18t,17apr98,nps  added support for rBuffShow.
  58. 18s,09mar98,sjw  merge in HTTP and JAVA changes for conflict resolution
  59. 18r,18dec97,cth  replaced windview, timestamp initialization with windviewConfig
  60. 18q,13nov97,cth  changed WV evtInstInit to wvLibInit2; removed connRtnSet,
  61.  evtTaskInit; added include wvLib.h, rBuffLib.h
  62. 18p,18aug97,nps  changed WV buffer initialization with the rBuff API.
  63. 18x,06mar98,ms   changed copyright year from 1996 to 1998.
  64. 18v,04feb98,jpd  fix unsigned/signed warning (usrRoot); updated copyright date.
  65. 18u,25feb98,jgn  removed call to excShowInit(), it is called by excInit()
  66.                  if needed (SPR #20625)
  67. 18t,19jan98,hdn  changed a condition macro to include tffsDrv().
  68. 18p,06jan98,cym  added SIMNT as processor not to clear bss.
  69. 18s,23sep97,yp   added support for TFFS.
  70. 18r,13aug97,cdp  add Thumb (ARM7TDMI_T) support;
  71.                  'fix' unsigned/signed comparison in usrRoot.
  72. 18q,26feb97,dat  added INCLUDE_USER_APPL and USER_APPL_INIT, spr 8071.
  73. 18p,05feb97,cdp  remove ARM test hook (_func_armStartup).
  74. 18o,12dec96,cdp  added _func_armStartup for ARM platforms.
  75. 18n,13dec96,elp  changed syncLibInit() into symSyncLibInit().
  76. 18m,18nov96,dds  SPR 2529: return status for sysScsiInit is now checked.
  77. 18l,06nov96,ms   removed 17n hack to usrClock.
  78. 18k,01nov96,hdn  added support for PCMCIA.
  79. 18j,21oct96,hdn  changed paramerters for new LPT driver.
  80. 18i,04oct96,elp  added INCLUDE_SYM_TBL_SYNC (SPR# 6775).
  81. 18h,11jul96,tam  changed copyright year from 1995 to 1996.
  82. 18l,19jul96,hdn  added support for ATA driver.
  83. 18k,25jun96,jmb  Eliminated alternative WDB macro names (SPR #5707).
  84. 18j,25jun96,dbt  Initialized _func_selWakeupListInit before tyLib (SPR #3314).
  85. 18i,21jun96,jmb  update copyright. SPR #6364
  86. 18h,21jun96,jmb  long modhist -- deleted entries prior to 1994.  SPR #6528
  87. 18g,12mar96,tam  removed all #if (CPU == PPC403).
  88. 18p,06jun96,ism  bumped copyright to 1996.
  89. 18o,26jan96,ism  cleaned up vxsim/solaris version
  90. 18f,02oct95,kvk  added sysHwInit2() for PPC603.
  91. 18e,27sep95,tpr  removed #if (CPU_FAMILY != PPC) staff.
  92. 18n,07nov95,srh  fixed C++ support comments.
  93. 18m,29oct95,dat  fixed warnings about printf arguments
  94. 18l,11oct95,jdi  doc: changed .pG to .tG.
  95. 18k,10oct95,dat  new BSP revision id. Added WDB Banner printing
  96. 18j,15jun95,ms  updated for new serial drivers.
  97. 18i,09jun95,ms  cleaned up console initialization
  98. 18h,30may95,p_m  added initialization of formatted I/O library.
  99.  replaced spyStop() by spyLibInit().
  100. 18g,22may95,p_m  no longer initialize object format specific libraries if
  101.  loader is not included.
  102. 18f,22may95,myz  modified new serial device initialization for x86 support
  103. 18e,22may95,ms   added some WDB agent support
  104. 18e,30oct95,ism  updated for SIMSPARCSOLARIS
  105. 18d,28mar95,kkk  added scalability support, changed edata and end to arrays
  106.  (SPR #3917), changed baud rate to be a macro in configAll.h
  107. 18g,25may95,yao  changed to bzero bss segment for PPC.
  108. 18f,04apr95,caf  added PPC cache support.
  109. 18e,03mar95,yao  added shsHwInit2 () for PPC403.
  110. 18d,24feb95,caf  added PPC support.
  111. 18c,20nov94,kdl  added hashLibInit() when using dosFs.
  112. 18b,09nov94,jds  additions for scsi backward compatability ; scsi[12]IfInit()
  113. 18a,04nov94,kdl  merge cleanup.
  114. 17l,02aug94,tpr  added cacheEnable (BRANCH_CACHE) for the MC68060.
  115. 17m,15oct94,hdn  added LPT driver.
  116. 17o,20jul94,ms   changed INCLUDE_AOUT_HPPA to INCLUDE_SOM_COFF
  117. 17n,02may94,ms   added VxSim HP hack to usrClock().
  118. 17q,15mar94,smb  renamed tEvtTask parameters.
  119. 17p,15feb94,smb  defined WV_MODE, EVTBUFFER_ADDRESS for wvInstInit().
  120. 17o,12jan94,kdl  modified posix initialization; added queued signal init.
  121. */
  122. /*
  123. DESCRIPTION
  124. This library is the WRS-supplied configuration module for VxWorks.  It
  125. contains the root task, the primary system initialization routine, the
  126. network initialization routine, and the clock interrupt routine.
  127. The include file config.h includes a number of system-dependent parameters used
  128. in this file.
  129. In an effort to simplify the presentation of the configuration of vxWorks,
  130. this file has been split into smaller files.  These additional configuration
  131. source files are located in ../../src/config/usr[xxx].c and are #included into
  132. this file below.  This file contains the bulk of the code a customer is
  133. likely to customize.
  134. The module usrDepend.c contains checks that guard against unsupported
  135. configurations such as INCLUDE_NFS without INCLUDE_RPC.  The module
  136. usrKernel.c contains the core initialization of the kernel which is rarely
  137. customized, but provided for information.  The module usrNetwork.c now
  138. contains all network initialization code.  Finally, the module usrExtra.c
  139. contains the conditional inclusion of the optional packages selected in
  140. configAll.h.
  141. The source code necessary for the configuration selected is entirely
  142. included in this file during compilation as part of a standard build in
  143. the board support package.  No other make is necessary.
  144. INCLUDE FILES:
  145. config.h
  146. SEE ALSO:
  147. .tG "Getting Started, Cross-Development"
  148. */
  149. #include "vxWorks.h" /* always first */
  150. #include "config.h" /* board support configuration header */
  151. #include "usrConfig.h" /* general configuration header */
  152. #include "usrDepend.c" /* include dependency rules */
  153. #include "usrKernel.c" /* kernel configuration */
  154. #include "usrExtra.c" /* conditionally included packages */
  155. #if CPU==SIMNT
  156. extern int simUpMutex;
  157. extern int win_ReleaseMutex(int hMutex);
  158. #endif
  159. #ifdef INCLUDE_HTTP
  160. #include "http/httpLib.h" /* Wind Web Server interfaces */
  161. #endif
  162. #ifdef INCLUDE_COM
  163. extern int comLibInit ();
  164. #endif
  165. #ifdef INCLUDE_DCOM
  166. extern int dcomLibInit ();
  167. #endif
  168. /* defines - must be after include of usrDepend.c */
  169. #ifdef INCLUDE_WDB
  170. #define FREE_MEM_START_ADRS (FREE_RAM_ADRS + WDB_POOL_SIZE)
  171. #else
  172. #define FREE_MEM_START_ADRS FREE_RAM_ADRS
  173. #endif
  174. #ifdef INCLUDE_INITIAL_MEM_ALLOCATION
  175. #define MEM_POOL_START_ADRS 
  176.     (ROUND_UP(FREE_MEM_START_ADRS, (INITIAL_MEM_ALIGNMENT)) + 
  177.     (INITIAL_MEM_SIZE))
  178. #else /* INCLUDE_INITIAL_MEM_ALLOCATION */
  179. #define MEM_POOL_START_ADRS FREE_MEM_START_ADRS
  180. #endif /* INCLUDE_INITIAL_MEM_ALLOCATION */
  181. /* global variables */
  182. int consoleFd; /* fd of initial console device */
  183. char consoleName[20]; /* console device name, eg. "/tyCo/0" */
  184. SYMTAB_ID statSymTbl; /* system error status symbol table id*/
  185. SYMTAB_ID standAloneSymTbl; /* STANDALONE version symbol table id */
  186. SYMTAB_ID sysSymTbl; /* system symbol table id */
  187. BOOT_PARAMS sysBootParams; /* parameters from boot line */
  188. int sysStartType; /* type of boot (WARM, COLD, etc) */
  189. /* Two magic cookies used to detect data section misalignment */
  190. #define TRAP_VALUE_1 0x12348765
  191. #define TRAP_VALUE_2 0x5a5ac3c3
  192. LOCAL volatile UINT32 trapValue1 = TRAP_VALUE_1;
  193. LOCAL volatile UINT32 trapValue2 = TRAP_VALUE_2;
  194. /*******************************************************************************
  195. *
  196. * usrInit - user-defined system initialization routine
  197. *
  198. * This is the first C code executed after the system boots.  This routine is
  199. * called by the assembly language start-up routine sysInit() which is in the
  200. * sysALib module of the target-specific directory.  It is called with
  201. * interrupts locked out.  The kernel is not multitasking at this point.
  202. *
  203. * This routine starts by clearing BSS; thus all variables are initialized to 0,
  204. * as per the C specification.  It then initializes the hardware by calling
  205. * sysHwInit(), sets up the interrupt/exception vectors, and starts kernel
  206. * multitasking with usrRoot() as the root task.
  207. *
  208. * RETURNS: N/A
  209. *
  210. * SEE ALSO: kernelLib
  211. *
  212. * ARGSUSED0
  213. */
  214. void usrInit
  215.     (
  216.     int startType
  217.     )
  218.     {
  219.     /*
  220.      * This trap will catch improper loading of the data section.
  221.      * We check the magic cookie values to make sure the data section is
  222.      * in the expected memory location. We do not want
  223.      * to proceed further if the data segment is not correct.
  224.      *
  225.      * It should be easy to detect entry into the trap using an ICE, JTAG,
  226.      * or logic analyzer. Without the trap, the processor is likely to run
  227.      * away out of control.
  228.      *
  229.      * Data section misalignment can occur when there is a change in tool
  230.      * chain, build rules, compiler, host utilites,  etc. 
  231.      */
  232.     while (trapValue1 != TRAP_VALUE_1 || trapValue2 != TRAP_VALUE_2)
  233. {
  234. /* infinite loop */;
  235. }
  236.     
  237. #if (CPU_FAMILY == SPARC)
  238.     excWindowInit (); /* SPARC window management */
  239. #endif
  240. #ifdef INCLUDE_SYS_HW_INIT_0
  241.     /*
  242.      * Perform any BSP-specific initialisation that must be done before
  243.      * cacheLibInit() is called and/or BSS is cleared.
  244.      */
  245.     SYS_HW_INIT_0 ();
  246. #endif /* INCLUDE_SYS_HW_INIT_0 */
  247.     /* configure data and instruction cache if available and leave disabled */
  248. #ifdef  INCLUDE_CACHE_SUPPORT
  249.     /*
  250.      * SPR 73609:  If a cache is not to be enabled, don't require
  251.      * its mode to be defined.  Instead, default it to disabled.
  252.      */
  253. # if (!defined(USER_D_CACHE_ENABLE) && !defined(USER_D_CACHE_MODE))
  254. #  define USER_D_CACHE_MODE CACHE_DISABLED
  255. # endif /* !USER_D_CACHE_ENABLE && !USER_D_CACHE_MODE */
  256. # if (!defined(USER_I_CACHE_ENABLE) && !defined(USER_I_CACHE_MODE))
  257. #  define USER_I_CACHE_MODE CACHE_DISABLED
  258. # endif /* !USER_I_CACHE_ENABLE && !USER_I_CACHE_MODE */
  259.     cacheLibInit (USER_I_CACHE_MODE, USER_D_CACHE_MODE);
  260. #endif  /* INCLUDE_CACHE_SUPPORT */
  261. #if CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS
  262.     /* don't assume bss variables are zero before this call */
  263.     bzero (edata, end - edata); /* zero out bss variables */
  264. #endif /* CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS */
  265. #if (CPU_FAMILY == PPC)
  266.     /*
  267.      * Immediately after clearing the bss, ensure global stdin
  268.      * etc. are ERROR until set to real values.  This is used in
  269.      * target/src/arch/ppc/excArchLib.c to improve diagnosis of
  270.      * exceptions which occur before I/O is set up.
  271.      */
  272.     ioGlobalStdSet (STD_IN,  ERROR);
  273.     ioGlobalStdSet (STD_OUT, ERROR);
  274.     ioGlobalStdSet (STD_ERR, ERROR);
  275. #endif  /* CPU_FAMILY == PPC */
  276. #if 0
  277.     sysStartType = startType; /* save type of system start */
  278. #endif
  279.     sysStartType = BOOT_NORMAL; /* alwarys boot as normal */
  280.     intVecBaseSet ((FUNCPTR *) VEC_BASE_ADRS); /* set vector base table */
  281. #if (CPU_FAMILY == AM29XXX)
  282.     excSpillFillInit (); /* am29k stack cache managemt */
  283. #endif
  284. #ifdef  INCLUDE_EXC_HANDLING
  285. # if (CPU_FAMILY == PPC) && defined(INCLUDE_EXC_SHOW)
  286.     /*
  287.      * Do this ahead of excVecInit() to set up _func_excPanicHook, in case
  288.      * the enabling of Machine Check there allows a pending one to occur.
  289.      * excShowInit() will be called again later, harmlessly.
  290.      */
  291.     excShowInit ();
  292. # endif  /* CPU_FAMILY == PPC && defined(INCLUDE_EXC_SHOW) */
  293.     excVecInit (); /* install exception vectors */
  294. #endif  /* INCLUDE_EXC_HANDLING */
  295.     sysHwInit (); /* initialize system hardware */
  296.     usrKernelInit (); /* configure the Wind kernel */
  297. #ifdef INCLUDE_USB 
  298. #   ifdef INCLUDE_OHCI_PCI_INIT
  299.         sysUsbPciOhciInit ();
  300. #   endif
  301. #endif
  302. #ifdef  INCLUDE_CACHE_SUPPORT
  303. #ifdef  USER_I_CACHE_ENABLE
  304.     cacheEnable (INSTRUCTION_CACHE); /* enable instruction cache */
  305. #endif /* USER_I_CACHE_ENABLE */
  306. #ifdef USER_D_CACHE_ENABLE
  307.     cacheEnable (DATA_CACHE); /* enable data cache */
  308. #endif  /* USER_D_CACHE_ENABLE */
  309. #if (CPU == MC68060)
  310. #ifdef  USER_B_CACHE_ENABLE
  311.     cacheEnable (BRANCH_CACHE); /* enable branch cache */
  312. #endif /* USER_B_CACHE_ENABLE */
  313. #endif /* (CPU == MC68060) */
  314. #endif  /* INCLUDE_CACHE_SUPPORT */
  315.     /* start the kernel specifying usrRoot as the root task */
  316.     kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE,
  317. (char *) MEM_POOL_START_ADRS,
  318. sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL);
  319.     }
  320. /*******************************************************************************
  321. *
  322. * usrRoot - the root task
  323. *
  324. * This is the first task to run under the multitasking kernel.  It performs
  325. * all final initialization and then starts other tasks.
  326. *
  327. * It initializes the I/O system, installs drivers, creates devices, and sets
  328. * up the network, etc., as necessary for a particular configuration.  It
  329. * may also create and load the system symbol table, if one is to be included.
  330. * It may then load and spawn additional tasks as needed.  In the default
  331. * configuration, it simply initializes the VxWorks shell.
  332. *
  333. * RETURNS: N/A
  334. */
  335. void usrRoot
  336.     (
  337.     char * pMemPoolStart, /* start of system memory partition */
  338.     unsigned memPoolSize /* initial size of mem pool */
  339.     )
  340.     {
  341.     char tyName [20];
  342.     int  ix;
  343.     /* Initialize the memory pool before initializing any other package.
  344.      * The memory associated with the root task will be reclaimed at the
  345.      * completion of its activities.
  346.      */
  347. #ifdef INCLUDE_MEM_MGR_FULL
  348.     memInit (pMemPoolStart, memPoolSize); /* initialize memory pool */
  349. #else
  350.     memPartLibInit (pMemPoolStart, memPoolSize);/* initialize memory pool */
  351. #endif /* INCLUDE_MEM_MGR_FULL */
  352. #ifdef INCLUDE_SHOW_ROUTINES
  353.     memShowInit (); /* initialize memShow routine */
  354. #endif /* INCLUDE_SHOW_ROUTINES */
  355. #if defined(INCLUDE_MMU_BASIC) || defined(INCLUDE_MMU_FULL) || 
  356. defined(INCLUDE_MMU_MPU)
  357.     usrMmuInit (); /* initialize the mmu */
  358. #endif /* defined(INCLUDE_MMU_BASIC, INCLUDE_MMU_FULL, INCLUDE_MMU_MPU) */
  359.     /* set up system timer */
  360.     sysClkConnect ((FUNCPTR) usrClock, 0); /* connect clock ISR */
  361.     sysClkRateSet (SYS_CLK_RATE); /* set system clock rate */
  362.     sysClkEnable (); /* start it */
  363. #ifdef INCLUDE_FAST_DRAM
  364. /*
  365.  * make use of data cache as fast DRAM,
  366.  * establish parameters in config.h, MMU
  367.  * must be initialed before data cache is
  368.  * initialized as data ram...
  369.  */
  370.   cacheCreateInternalDataRAM((UINT32 *)FD_ORIGIN, FD_NUMLINES);
  371. #endif
  372.     /*
  373.      * The select library needs to be initialized before the tyLib module
  374.      * since the _func_selWakeupListInit FUNCPTR is required (SPR #3314).
  375.      * The installation of the select task delete hooks is performed
  376.      * later in usrRoot() after NFS and RPC have been initialized.
  377.      */
  378. #ifdef  INCLUDE_SELECT
  379.     selectInit (NUM_FILES);
  380. #endif /* INCLUDE_SELECT */
  381.     /* initialize I/O system */
  382. #ifdef  INCLUDE_IO_SYSTEM
  383.     iosInit (NUM_DRIVERS, NUM_FILES, "/null");
  384.     consoleFd = NONE;                           /* assume no console device */
  385. #ifdef  INCLUDE_TYCODRV_5_2
  386. #ifdef  INCLUDE_TTY_DEV
  387.     if (NUM_TTY > 0)
  388. {
  389. tyCoDrv (); /* install console driver */
  390. for (ix = 0; ix < NUM_TTY; ix++) /* create serial devices */
  391.     {
  392.     sprintf (tyName, "%s%d", "/tyCo/", ix);
  393.     (void) tyCoDevCreate (tyName, ix, 512, 512);
  394.     if (ix == CONSOLE_TTY)
  395. strcpy (consoleName, tyName); /* store console name */
  396.     }
  397. consoleFd = open (consoleName, O_RDWR, 0);
  398. /* set baud rate */
  399. (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
  400. (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
  401. }
  402. #endif /* INCLUDE_TTY_DEV */
  403. #else   /* !INCLUDE_TYCODRV_5_2 */
  404. #ifdef  INCLUDE_TTY_DEV
  405.     if (NUM_TTY > 0)
  406. {
  407. ttyDrv(); /* install console driver */
  408. for (ix = 0; ix < NUM_TTY; ix++) /* create serial devices */
  409.     {
  410. #if     (defined(INCLUDE_WDB) && (WDB_COMM_TYPE == WDB_COMM_SERIAL))
  411.     if (ix == WDB_TTY_CHANNEL) /* don't use WDBs channel */
  412. continue;
  413. #endif
  414.     sprintf (tyName, "%s%d", "/tyCo/", ix);
  415.     (void) ttyDevCreate (tyName, sysSerialChanGet(ix), 512, 512);
  416.     if (ix == CONSOLE_TTY) /* init the tty console */
  417. {
  418. strcpy (consoleName, tyName);
  419. consoleFd = open (consoleName, O_RDWR, 0);
  420. (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
  421. (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
  422. }
  423.     }
  424. }
  425. #endif  /* INCLUDE_TTY_DEV */
  426. #ifdef INCLUDE_PC_CONSOLE
  427.     pcConDrv ();
  428.     for (ix = 0; ix < N_VIRTUAL_CONSOLES; ix++)
  429. {
  430. sprintf (tyName, "%s%d", "/pcConsole/", ix);
  431. (void) pcConDevCreate (tyName,ix, 512, 512);
  432. if (ix == PC_CONSOLE) /* init the console device */
  433.     {
  434.     strcpy (consoleName, tyName);
  435.     consoleFd = open (consoleName, O_RDWR, 0);
  436.     (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
  437.     (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
  438.     }
  439. }
  440. #endif /* INCLUDE_PC_CONSOLE */
  441. #endif  /* !INCLUDE_TYCODRV_5_2 */
  442.     ioGlobalStdSet (STD_IN,  consoleFd);
  443.     ioGlobalStdSet (STD_OUT, consoleFd);
  444.     ioGlobalStdSet (STD_ERR, consoleFd);
  445. #endif  /* INCLUDE_IO_SYSTEM */
  446.     /* initialize symbol table facilities */
  447. #ifdef INCLUDE_SYM_TBL
  448.     hashLibInit (); /* initialize hash table package */
  449.     symLibInit (); /* initialize symbol table package */
  450. #ifdef  INCLUDE_SHOW_ROUTINES
  451.     symShowInit (); /* initialize symbol table show */
  452. #endif /* INCLUDE_SHOW_ROUTINES */
  453. #endif /* INCLUDE_SYM_TBL */
  454.     /* initialize exception handling */
  455. #if     defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK)
  456. #ifdef INCLUDE_EXC_SHOW
  457.     excShowInit ();
  458. #endif
  459.     excInit (); /* initialize exception handling */
  460. #endif  /* defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK) */
  461. #ifdef INCLUDE_LSTLIB
  462.     lstLibInit ();
  463. #endif
  464. #ifdef INCLUDE_LOGGING
  465.     logInit (consoleFd, MAX_LOG_MSGS); /* initialize logging */
  466. # ifdef INCLUDE_LOG_STARTUP
  467.     logMsg ("logging started to %s [%d], queue size %dn",
  468. consoleName, consoleFd, MAX_LOG_MSGS, 4,5,6);
  469.     taskDelay (2); /* allow time for message to be displayed */
  470. # endif /* INCLUDE_LOG_STARTUP */
  471. #endif /* INCLUDE_LOGGING */
  472. #ifdef INCLUDE_SIGNALS
  473.     sigInit (); /* initialize signals */
  474. #endif /* INCLUDE_SIGNALS */
  475.     /* initialize debugging */
  476. #ifdef INCLUDE_DEBUG
  477.     dbgInit (); /* initialize debugging */
  478. #endif /* INCLUDE_DEBUG */
  479.     /* initialize pipe driver */
  480. #ifdef INCLUDE_PIPES
  481.     pipeDrv (); /* install pipe driver */
  482. #endif /* INCLUDE_PIPES */
  483.     /* initialize standard I/O package */
  484. #ifdef INCLUDE_STDIO
  485.     stdioInit (); /* initialize standard I/O library */
  486. #ifdef  INCLUDE_SHOW_ROUTINES
  487.     stdioShowInit ();
  488. #endif  /* INCLUDE_SHOW_ROUTINES */
  489. #endif /* INCLUDE_STDIO */
  490.     /* initialize POSIX queued signals */
  491. #if defined(INCLUDE_POSIX_SIGNALS) && defined(INCLUDE_SIGNALS)
  492.     sigqueueInit (NUM_SIGNAL_QUEUES); /* initialize queued signals */
  493. #endif
  494.     /* initialize POSIX semaphores */
  495. #ifdef  INCLUDE_POSIX_SEM
  496.     semPxLibInit ();
  497. #ifdef INCLUDE_SHOW_ROUTINES
  498.     semPxShowInit ();
  499. #endif  /* INCLUDE_SHOW_POUTINES */
  500. #endif  /* INCLUDE_POSIX_SEM */
  501.     /* initialize POSIX threads */
  502. #ifdef INCLUDE_POSIX_PTHREADS
  503.     pthreadLibInit ();
  504. #endif  /* INCLUDE_POSIX_PTHREADS */
  505.     /* initialize POSIX message queues */
  506. #ifdef INCLUDE_POSIX_MQ
  507.     mqPxLibInit (MQ_HASH_SIZE);
  508. #ifdef INCLUDE_SHOW_ROUTINES
  509.     mqPxShowInit ();
  510. #endif  /* INCLUDE_SHOW_ROUTINES */
  511. #endif  /* INCLUDE_POSIX_MQ */
  512.     /* initialize POSIX async I/O support */
  513. #ifdef INCLUDE_POSIX_AIO
  514.     aioPxLibInit (MAX_LIO_CALLS);
  515. #ifdef INCLUDE_POSIX_AIO_SYSDRV
  516.     aioSysInit (MAX_AIO_SYS_TASKS, AIO_TASK_PRIORITY, AIO_TASK_STACK_SIZE);
  517. #endif  /* INCLUDE_POSIX_AIO_SYSDRV */
  518. #endif  /* INCLUDE_POSIX_AIO */
  519. #ifdef INCLUDE_CBIO /* init main CBIO module, cbioLib() */
  520.     cbioLibInit();
  521. #endif INCLUDE_CBIO
  522.     /* initialize filesystems and disk drivers */
  523. #ifdef INCLUDE_DOSFS_MAIN  /* dosFs2 file system initialization */
  524.     hashLibInit (); /* initialize hash table package */
  525.     /* First initialize the main dosFs module */
  526.     dosFsLibInit( 0 );
  527.     /* Initialize sub-modules */
  528.     /* ensure that at least one directory handler is defined */
  529. #   if ((!defined INCLUDE_DOSFS_DIR_VFAT) && 
  530.         (!defined INCLUDE_DOSFS_DIR_FIXED))
  531. #       define INCLUDE_DOSFS_DIR_VFAT  
  532. #   endif 
  533.     /* init VFAT (MS long file names) module */
  534. #   ifdef INCLUDE_DOSFS_DIR_VFAT
  535.     /* Sub-module: VFAT Directory Handler */
  536.     dosVDirLibInit();
  537. #   endif /* INCLUDE_DOSFS_DIR_VFAT */
  538.     /* init strict 8.3 and vxLongNames handler */
  539. #   ifdef INCLUDE_DOSFS_DIR_FIXED
  540.     /* Sub-module: Vintage 8.3 and VxLong Directory Handler */
  541.     dosDirOldLibInit();
  542. #   endif /* INCLUDE_DOSFS_DIR_FIXED */
  543.     /* Sub-module: FAT12/FAT16/FAT32 FAT Handler */
  544.     dosFsFatInit();
  545. #   ifdef INCLUDE_DOSFS_CHKDSK 
  546.     /* Sub-module: Consistency check handler */
  547.     dosChkLibInit();
  548. #   endif /* INCLUDE_DOSFS_CHKDSK */
  549. #   ifdef INCLUDE_DOSFS_FMT
  550.     /* Sub-module: Formatter */
  551.     dosFsFmtLibInit();           /* init dosFs scalable formatter */
  552. #   endif /* INCLUDE_DOSFS_FMT */
  553. #endif /* INCLUDE_DOSFS_MAIN */
  554.     /* dosFs1 legacy code, dosFsInit(), usrDosFsOld.c */
  555. #ifdef INCLUDE_DOSFS
  556.     hashLibInit (); /* initialize hash table package */
  557.     dosFsInit (NUM_DOSFS_FILES);  /* init dosFs filesystem */
  558. #endif /* INCLUDE_DOSFS */
  559. #ifdef INCLUDE_RAWFS
  560.     rawFsInit (NUM_RAWFS_FILES);  /* init rawFs filesystem */
  561. #endif /* INCLUDE_RAWFS */
  562. #ifdef INCLUDE_RT11FS
  563.     rt11FsInit (NUM_RT11FS_FILES);  /* init rt11Fs filesystem */
  564. #endif /* INCLUDE_RT11FS */
  565. #ifdef INCLUDE_RAMDRV
  566.     ramDrv (); /* initialize ram disk driver */
  567. #endif /* INCLUDE_RAMDRV */
  568.     /* initialize USB components */
  569. #ifdef INCLUDE_USB_INIT
  570.     usbInit ();  /* USB Host Stack Initialization */
  571. #endif
  572. #ifdef INCLUDE_UHCI_INIT
  573.     usrUsbHcdUhciAttach ();  /* UHCI Initialization */
  574. #endif
  575. #ifdef INCLUDE_OHCI_INIT
  576.     usrUsbHcdOhciAttach ();  /* OHCI Initialization */
  577. #endif
  578. #ifdef INCLUDE_USB_MOUSE_INIT
  579.     usrUsbMseInit ();  /* Mouse Driver Initialization */
  580. #endif
  581. #ifdef INCLUDE_USB_KEYBOARD_INIT
  582.     usrUsbKbdInit ();  /* Keyboard Driver Initialization */
  583. #endif
  584. #ifdef INCLUDE_USB_PRINTER_INIT
  585.     usrUsbPrnInit ();  /* Printer Driver Initialization */
  586. #endif
  587. #ifdef INCLUDE_USB_SPEAKER_INIT
  588.     usrUsbSpkrInit ();  /* Speaker Driver Initialization */
  589. #endif
  590. #ifdef INCDLUE_USB_AUDIO_DEMO
  591.     usrUsbAudioDemo ();  /* USB Audio Demo */
  592. #endif
  593. #ifdef INCLUDE_USB_MS_BULKONLY_INIT
  594.     usrUsbBulkDevInit();  /* Bulk Driver Initialization */
  595. #endif
  596. #ifdef INCLUDE_USB_MS_CBI_INIT
  597.     usrUsbCbiUfiDevInit ();  /* CBI Driver Initialization */
  598. #endif
  599. #ifdef INCLUDE_USB_PEGASUS_END_INIT
  600.     usrUsbPegasusEndInit ();  /* Pegasus Driver Initialization */
  601. #endif
  602. #ifdef INCLUDE_SCSI
  603.     /*
  604.      * initialize either the SCSI1 or SCSI2 interface; initialize SCSI2 when
  605.      * the SCSI2 interface is available.
  606.      */
  607. #ifndef INCLUDE_SCSI2
  608.     scsi1IfInit ();
  609. #else
  610.     scsi2IfInit ();
  611. #endif
  612.     /* initialize SCSI controller */
  613.     if (sysScsiInit () == OK)
  614. {
  615. usrScsiConfig (); /* configure SCSI peripherals */
  616.         }
  617.     else
  618.         {
  619. #ifdef INCLUDE_STDIO
  620.         printf ("sysScsiInit() Failed, SCSI system not initializedn");
  621. #endif  /* INCLUDE_STDIO */
  622.         }
  623. #endif /* INCLUDE_SCSI */
  624. #ifdef  INCLUDE_FD     /* initialize floppy disk driver */
  625.     if ((fdDrv (FD_INT_VEC, FD_INT_LVL)) == ERROR)
  626.      {
  627. #ifdef INCLUDE_STDIO
  628. printf ("fdDrv returned ERROR from usrRoot.n");
  629. #endif /* INCLUDE_STDIO */
  630. }
  631. #endif /* INCLUDE_FD */
  632. #ifdef  INCLUDE_IDE
  633.     /* init IDE disk driver */
  634.     if ((ideDrv (IDE_INT_VEC, IDE_INT_LVL, IDE_CONFIG)) == ERROR)
  635. {
  636. #ifdef INCLUDE_STDIO
  637. printf ("ideDrv returned ERROR from usrRoot.n");
  638. #endif /* INCLUDE_STDIO */
  639. }
  640. #endif  /* INCLUDE_IDE */
  641. #ifdef  INCLUDE_ATA
  642.     {                                   /* initialize hard disk driver */
  643.     IMPORT ATA_RESOURCE ataResources[];
  644.     ATA_RESOURCE *pAtaResource;
  645.     for (ix = 0; ix < ATA_MAX_CTRLS; ix++)
  646.         {
  647.         pAtaResource = &ataResources[ix];
  648.         if (pAtaResource->ctrlType == IDE_LOCAL)
  649.             if ((ataDrv (ix, pAtaResource->drives, pAtaResource->intVector,
  650.    pAtaResource->intLevel, pAtaResource->configType,
  651.                    pAtaResource->semTimeout, pAtaResource->wdgTimeout))
  652. == ERROR)
  653. {
  654. #ifdef INCLUDE_STDIO
  655. printf ("ataDrv returned ERROR from usrRoot.n");
  656. #endif /* INCLUDE_STDIO */
  657. }
  658.         }
  659.     }
  660. #ifdef  INCLUDE_SHOW_ROUTINES
  661.     ataShowInit ();                     /* install ATA/IDE show routine */
  662. #endif  /* INCLUDE_SHOW_ROUTINES */
  663. #endif  /* INCLUDE_ATA */
  664. #ifdef  INCLUDE_LPT
  665.     {
  666.     IMPORT LPT_RESOURCE lptResources[];
  667.     lptDrv (LPT_CHANNELS, &lptResources[0]); /* init LPT parallel driver */
  668.     }
  669. #endif  /* INCLUDE_LPT */
  670. #ifdef  INCLUDE_PCMCIA
  671. #ifdef  INCLUDE_SHOW_ROUTINES
  672.     pcmciaShowInit (); /* install PCMCIA show routines */
  673. #endif  /* INCLUDE_SHOW_ROUTINES */
  674.     pcmciaInit (); /* init PCMCIA Lib */
  675. #endif  /* INCLUDE_PCMCIA */
  676. #ifdef INCLUDE_TFFS
  677.     tffsDrv (); /* it should be after pcmciaInit() */
  678. #endif /* INCLUDE_TFFS */
  679. #ifdef  INCLUDE_FORMATTED_IO
  680.     fioLibInit (); /* initialize formatted I/O */
  681. #endif  /* INCLUDE_FORMATTED_IO */
  682.     /* initialize floating point facilities */
  683. #ifdef INCLUDE_FLOATING_POINT
  684.     floatInit (); /* initialize floating point I/O */
  685. #endif /* INCLUDE_FLOATING_POINT */
  686.     /* install software floating point emulation (if applicable) */
  687. #ifdef INCLUDE_SW_FP
  688.     mathSoftInit (); /* use software emulation for fp math */
  689. #endif /* INCLUDE_SW_FP */
  690.     /* install hardware floating point support (if applicable) */
  691. #ifdef INCLUDE_HW_FP
  692.     mathHardInit ();  /* do fppInit() & install hw fp math */
  693. #ifdef INCLUDE_SHOW_ROUTINES
  694.     fppShowInit (); /* install hardware fp show routine */
  695. #endif /* INCLUDE_SHOW_ROUTINES */
  696. #endif /* INCLUDE_HW_FP */
  697.     /* install dsp support (if applicable) */
  698. #ifdef INCLUDE_DSP
  699.     usrDspInit ();  /* do dspInit() */
  700. #endif /* INCLUDE_DSP */
  701.     /* initialize AltiVec library (if applicable) */
  702. #ifdef INCLUDE_ALTIVEC
  703.     usrAltivecInit ();
  704. #endif /* INCLUDE_ALTIVEC */
  705.     /* initialize performance monitoring tools */
  706. #ifdef INCLUDE_SPY
  707.     spyLibInit (); /* install task cpu utilization tool */
  708. #endif /* INCLUDE_SPY */
  709. #ifdef INCLUDE_TIMEX
  710.     timexInit (); /* install function timing tool */
  711. #endif /* INCLUDE_TIMEX */
  712. #ifdef  INCLUDE_ENV_VARS
  713.     envLibInit (ENV_VAR_USE_HOOKS); /* initialize environment variable */
  714. #endif /* INCLUDE_ENV_VARS */
  715. #ifdef INCLUDE_NTPASSFS
  716.     {
  717.     IMPORT int     ntPassFsInit();
  718.     IMPORT void *   ntPassFsDevInit();
  719.     IMPORT char     fullExePath[];
  720.     char     passName [MAX_FILENAME_LENGTH];
  721.     char *     defPathEnd;
  722.     
  723.     if (ntPassFsInit(1) == OK)
  724.      {
  725.      if (ntPassFsDevInit("host:") == NULL)
  726.          {
  727. #ifdef INCLUDE_STDIO
  728.     printf ("ntPassFsDevInit failed for host: n");
  729. #endif /* INCLUDE_STDIO */
  730.     }
  731. else
  732.     {
  733.          sprintf (passName, "host:%s", fullExePath);
  734.             /* Remove bootFile name at the end of the string */
  735.          defPathEnd = strrchr (passName, '\');
  736.          if (defPathEnd != NULL)
  737.      *defPathEnd = '';
  738.          ioDefPathSet (passName);
  739.     }
  740. }
  741.     else
  742.      {
  743. #ifdef INCLUDE_STDIO
  744. printf ("ntPassFsInit failedn");
  745. #endif /* INCLUDE_STDIO */
  746. }
  747.     }
  748. #endif /* INCLUDE_NTPASSFS */
  749.     /* initialize object module loader */
  750. #ifdef INCLUDE_LOADER
  751.     moduleLibInit (); /* initialize module manager */
  752. #if defined(INCLUDE_AOUT)
  753.     loadAoutInit (); /* use a.out format */
  754. #else /* coff or ecoff */
  755. #if defined(INCLUDE_ECOFF)
  756.     loadEcoffInit (); /* use ecoff format */
  757. #else /* ecoff */
  758. #if defined(INCLUDE_COFF)
  759.     loadCoffInit (); /* use coff format */
  760. #else   /* coff */
  761. #if defined(INCLUDE_ELF)
  762.     loadElfInit (); /* use elf format */
  763. #else
  764. #if defined(INCLUDE_SOM_COFF)
  765.     loadSomCoffInit ();
  766. #else
  767. #if defined(INCLUDE_PECOFF)
  768.     {
  769.     extern int loadPecoffInit();
  770.     loadPecoffInit ();
  771.     }
  772. #endif
  773. #endif
  774. #endif
  775. #endif
  776. #endif
  777. #endif
  778. #endif /* INCLUDE_LOADER */
  779.     /* initialize wtx client to synchronize host and target symbol tables */
  780. #ifdef INCLUDE_SYM_TBL_SYNC
  781.     symSyncLibInit ();
  782. #endif /* INCLUDE_SYM_TBL_SYNC */
  783.     /* initialize network */
  784. #ifdef  INCLUDE_NET_INIT
  785.     usrBootLineInit (sysStartType); /* crack the bootline */
  786. # if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
  787.     logMsg ("before usrNetInit()n", 1,2,3,4,5,6);
  788.     taskDelay (2); /* allow time for message to be displayed */
  789. # endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
  790.     usrNetInit (BOOT_LINE_ADRS); /* initialize network support */
  791. # if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
  792.     logMsg ("after usrNetInit()n", 1,2,3,4,5,6);
  793.     taskDelay (2); /* allow time for message to be displayed */
  794. # endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
  795. #endif /* INCLUDE_NET_INIT */
  796. #ifdef INCLUDE_PASSFS
  797.     {
  798.     extern STATUS passFsInit ();
  799.     extern void *passFsDevInit ();
  800.     char passName [256];
  801.     if (passFsInit (1) == OK)
  802. {
  803. extern char vxsim_hostname[];
  804. extern char vxsim_cwd[];
  805. sprintf (passName, "%s:", vxsim_hostname);
  806. if (passFsDevInit (passName) == NULL)
  807.     {
  808. #ifdef INCLUDE_STDIO
  809.     printf ("passFsDevInit failed for <%s>n", passName);
  810. #endif /* INCLUDE_STDIO */
  811.     }
  812. else
  813.     {
  814.     sprintf (passName, "%s:%s", vxsim_hostname, vxsim_cwd);
  815.     ioDefPathSet (passName);
  816.     }
  817. }
  818.     else
  819. #ifdef INCLUDE_STDIO
  820. printf ("passFsInit failedn");
  821. #endif /* INCLUDE_STDIO */
  822.     }
  823. #endif /* INCLUDE_PASSFS */
  824. #ifdef INCLUDE_DOS_DISK
  825.     {
  826.     char unixName [80];
  827.     extern void unixDrv ();
  828.     extern void unixDiskInit ();
  829.     extern char *u_progname;  /* home of executable */
  830.     char *pLastSlash;
  831.     unixDrv ();
  832.     pLastSlash = strrchr (u_progname, '/');
  833.     pLastSlash = (pLastSlash == NULL) ? u_progname : (pLastSlash + 1);
  834.     sprintf (unixName, "/tmp/%s%d.dos", pLastSlash, sysProcNumGet());
  835.     unixDiskInit (unixName, "A:", 0);
  836.     }
  837. #endif /* INCLUDE_DOS_DISK */
  838.     /* initialize shared memory objects */
  839. #ifdef INCLUDE_SM_OBJ /* unbundled shared memory objects */
  840.     usrSmObjInit (BOOT_LINE_ADRS);
  841. #endif /* INCLUDE_SM_OBJ */
  842.    /* initialize WindMP */
  843. #ifdef INCLUDE_VXFUSION /* unbundled VxFusion (distributed objects) */
  844.     usrVxFusionInit (BOOT_LINE_ADRS);
  845. #ifdef INCLUDE_SHOW_ROUTINES
  846.     {
  847.     extern void msgQDistShowInit();
  848.     extern void distNameShowInit ();
  849.     extern void distIfShowInit ();
  850.     extern void msgQDistGrpShowInit ();
  851.     msgQDistShowInit();
  852.     distNameShowInit ();
  853.     distIfShowInit ();
  854.     msgQDistGrpShowInit ();
  855.     }
  856. #endif /* INCLUDE_SHOW_ROUTINES */
  857. #endif /* INCLUDE_WINDMP */
  858.     /* write protect text segment & vector table only after bpattach () */
  859. #ifdef INCLUDE_MMU_FULL /* unbundled mmu product */
  860. #ifdef INCLUDE_PROTECT_TEXT
  861.     if (vmTextProtect () != OK)
  862. printf ("nError protecting text segment. errno = %xn", errno);
  863. #endif /* INCLUDE_PROTECT_TEXT */
  864. #ifdef INCLUDE_PROTECT_VEC_TABLE
  865.     if (intVecTableWriteProtect () != OK)
  866. printf ("nError protecting vector table. errno = %xn", errno);
  867. #endif /* INCLUDE_PROTECT_VEC_TABLE */
  868. #endif /* INCLUDE_MMU_FULL */
  869.     /* install select hook only after NFS/RPC for proper delete hook order */
  870. #ifdef INCLUDE_SELECT
  871.     selTaskDeleteHookAdd ();
  872. #endif /* INCLUDE_SELECT */
  873.     /* create system and status symbol tables */
  874. #ifdef  INCLUDE_STANDALONE_SYM_TBL
  875. # if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
  876.     logMsg ("before symTblCreate()n", 1,2,3,4,5,6);
  877.     taskDelay (2); /* allow time for message to be displayed */
  878. # endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
  879.     sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);
  880. #ifdef INCLUDE_SYM_TBL_SYNC
  881.     /* create a module (group 1) that is not synchronized (SPR# 20301) */
  882.     moduleCreate ("vxWorks.sym",
  883. #if (defined INCLUDE_AOUT)
  884.   MODULE_A_OUT,
  885. #elif ((defined INCLUDE_COFF) || (defined INCLUDE_ECOFF) || 
  886.        (defined INCLUDE_SOMCOFF))
  887.   MODULE_ECOFF,
  888. #elif (defined INCLUDE_ELF)
  889.   MODULE_ELF,
  890. #endif /* INCLUDE_AOUT */
  891.   HIDDEN_MODULE|LOAD_NO_SYMBOLS);
  892. #endif /* INCLUDE_SYM_TBL_SYNC */
  893.     printf ("nAdding %ld symbols for standalone.n", standTblSize);
  894.     /* fill in from built in table*/
  895.     for (ix = 0; (ULONG) ix < standTblSize; ix++)
  896. #if ((CPU_FAMILY == ARM) && ARM_THUMB)
  897. thumbSymTblAdd (sysSymTbl, &(standTbl[ix]));
  898. #else
  899. symTblAdd (sysSymTbl, &(standTbl[ix]));
  900. #endif /* CPU_FAMILY == ARM */
  901. # if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
  902.     logMsg ("sysSymTbl complete.n", 1,2,3,4,5,6);
  903.     taskDelay (2); /* allow time for message to be displayed */
  904. # endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
  905. #endif /* INCLUDE_STANDALONE_SYM_TBL */
  906. #ifdef  INCLUDE_NET_SYM_TBL
  907.     sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);
  908.     netLoadSymTbl (); /* fill in table from host */
  909. #endif /* INCLUDE_NET_SYM_TBL */
  910. #ifdef  INCLUDE_STAT_SYM_TBL
  911.     statSymTbl = symTblCreate (STAT_TBL_HASH_SIZE_LOG2, FALSE, memSysPartId);
  912.     for (ix = 0; (ULONG)ix < statTblSize; ix ++) /* fill in from builtin table*/
  913. symTblAdd (statSymTbl, &(statTbl [ix]));
  914. #endif /* INCLUDE_STAT_SYM_TBL */
  915.     /* initialize C++ support library */
  916. #if defined (INCLUDE_CPLUS) && defined (INCLUDE_CPLUS_MIN)
  917. #error Define only one of INCLUDE_CPLUS or INCLUDE_CPLUS_MIN, not both
  918. #endif
  919. #if defined (INCLUDE_CPLUS) || defined (INCLUDE_CPLUS_MIN)
  920. #ifndef INCLUDE_CTORS_DTORS
  921. #define INCLUDE_CTORS_DTORS
  922. #endif
  923. #endif
  924. #ifdef  INCLUDE_CTORS_DTORS 
  925.   /* 
  926.    * call compiler generated init functions (usually - but not necessarily -
  927.    * C++ related)
  928.    */
  929.    cplusCtorsLink ();
  930. #endif
  931. #ifdef INCLUDE_CPLUS /* all standard C++ runtime support */
  932.     cplusLibInit ();
  933. #endif
  934. #ifdef INCLUDE_CPLUS_MIN /* minimal C++ runtime support */
  935.     cplusLibMinInit ();
  936. #endif
  937. #ifdef INCLUDE_CPLUS_DEMANGLER
  938.     cplusDemanglerInit ();
  939. #endif
  940.     /* initialize COM/DCOM runtime support */
  941. #ifdef INCLUDE_COM
  942.     comLibInit ();
  943. #endif
  944. #ifdef INCLUDE_DCOM
  945.     dcomLibInit ();
  946. #endif
  947.     /* initialize Wind Web Server */
  948. #ifdef INCLUDE_HTTP
  949.     httpd ();
  950. #endif /* INCLUDE_HTTP */
  951. #ifdef   INCLUDE_RBUFF                  /* install rBuff support */
  952.     rBuffLibInit();
  953. #ifdef  INCLUDE_SHOW_ROUTINES
  954.     rBuffShowInit ();                   /* install rBuff show routine */
  955. #endif  /* INCLUDE_SHOW_ROUTINES */
  956. #endif /* INCLUDE_RBUFF */
  957. #ifdef INCLUDE_WINDVIEW
  958.     windviewConfig ();
  959. #endif /* INCLUDE_WINDVIEW */
  960.     /* initialize the WDB debug agent */
  961. #ifdef  INCLUDE_WDB
  962. # if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
  963.     logMsg ("before wdbConfig()n", 1,2,3,4,5,6);
  964.     taskDelay (2); /* allow time for message to be displayed */
  965. # endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
  966.     wdbConfig();
  967. # if defined(INCLUDE_LOGGING) && defined(INCLUDE_LOG_STARTUP)
  968.     logMsg ("after wdbConfig()n", 1,2,3,4,5,6);
  969.     taskDelay (2); /* allow time for message to be displayed */
  970. # endif /* INCLUDE_LOGGING && INCLUDE_LOG_STARTUP */
  971. #ifdef INCLUDE_WDB_BANNER
  972. #if (WDB_COMM_TYPE == WDB_COMM_NETWORK)
  973. #define WDB_COMM_TYPE_STR "WDB_COMM_NETWORK"
  974. #endif /* WDB_COMM_TYPE == WDB_COMM_NETWORK */
  975. #if (WDB_COMM_TYPE == WDB_COMM_SERIAL)
  976. #define WDB_COMM_TYPE_STR "WDB_COMM_SERIAL"
  977. #endif /* WDB_COMM_TYPE == WDB_COMM_SERIAL */
  978. #if (WDB_COMM_TYPE == WDB_COMM_TYCODRV_5_2)
  979. #define WDB_COMM_TYPE_STR "WDB_COMM_TYCODRV_5_2"
  980. #endif /* WDB_COMM_TYPE == WDB_COMM_TYCODRV_5_2 */
  981. #if (WDB_COMM_TYPE ==  WDB_COMM_NETROM)
  982. #define WDB_COMM_TYPE_STR "WDB_COMM_NETROM"
  983. #endif /* WDB_COMM_TYPE == WDB_COMM_NETROM */
  984. #if (WDB_COMM_TYPE ==  WDB_COMM_VTMD)
  985. #define WDB_COMM_TYPE_STR "WDB_COMM_VTMD"
  986. #endif /* WDB_COMM_TYPE == WDB_COMM_VTMD */
  987. #if (WDB_COMM_TYPE ==  WDB_COMM_END)
  988. #define WDB_COMM_TYPE_STR "WDB_COMM_END"
  989. #endif /* WDB_COMM_TYPE == WDB_COMM_END */
  990. #if (WDB_COMM_TYPE ==  WDB_COMM_CUSTOM)
  991. #define WDB_COMM_TYPE_STR "WDB_COMM_CUSTOM"
  992. #endif /* WDB_COMM_TYPE == WDB_COMM_CUSTOM */
  993. #if (WDB_COMM_TYPE ==  WDB_COMM_PIPE)
  994. #define WDB_COMM_TYPE_STR "WDB_COMM_PIPE"
  995. #endif /* WDB_COMM_TYPE == WDB_COMM_PIPE */
  996. #ifndef WDB_COMM_TYPE_STR
  997. #define WDB_COMM_TYPE_STR "Unknown"
  998. #endif /* WDB_COMM_TYPE_STR */
  999. #ifndef INCLUDE_SHELL
  1000.     /* WDB banner same as printed by usrWdbBanner */
  1001.     printf ("nn");
  1002.     printf ("%23snn", runtimeName);
  1003.     printf ("Copyright 1984-2002  Wind River Systems, Inc.nn");
  1004.     printf ("            CPU: %sn", sysModel ());
  1005.     printf ("   Runtime Name: %sn", runtimeName);
  1006.     printf ("Runtime Version: %sn", runtimeVersion);
  1007.     printf ("    BSP version: " BSP_VERSION BSP_REV "n");
  1008.     printf ("        Created: %sn", creationDate);
  1009.     printf ("  WDB Comm Type: %sn", WDB_COMM_TYPE_STR);
  1010.     printf ("            WDB: %s.nn",
  1011.     ((wdbRunsExternal () || wdbRunsTasking ()) ?
  1012.  "Ready" : "Agent configuration failed") );
  1013. #endif /*INCLUDE_SHELL*/
  1014. #endif /*INCLUDE_WDB_BANNER*/
  1015. #endif  /* INCLUDE_WDB */
  1016.     /* initialize interactive shell */
  1017. #ifdef  INCLUDE_SHELL
  1018. #ifdef INCLUDE_SECURITY /* include shell security */
  1019.     if ((sysFlags & SYSFLG_NO_SECURITY) == 0)
  1020. {
  1021.         loginInit (); /* initialize login table */
  1022.         shellLoginInstall (loginPrompt, NULL); /* install security program */
  1023. /* add additional users here as required */
  1024.         loginUserAdd (LOGIN_USER_NAME, LOGIN_PASSWORD);
  1025. }
  1026. #endif /* INCLUDE_SECURITY */
  1027.     printLogo (); /* print out the banner page */
  1028.     printf ("                               ");
  1029.     printf ("CPU: %s.  Processor #%d.n", sysModel (), sysProcNumGet ());
  1030.     printf ("                              ");
  1031. #ifdef HITACHI_SH_KERNEL_ON_SDRAM
  1032.     printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)FREE_RAM_ADRS));
  1033. #else /* HITACHI_SH_KERNEL_ON_SDRAM */
  1034.     printf ("Memory Size: 0x%x.", (UINT)(sysMemTop () - (char *)LOCAL_MEM_LOCAL_ADRS));
  1035. #endif /* HITACHI_SH_KERNEL_ON_SDRAM */
  1036.     printf ("  BSP version " BSP_VERSION BSP_REV ".");
  1037.     printf ("Runtime Name: %sn", runtimeName);
  1038.     printf ("Runtime Version: %sn", runtimeVersion);
  1039.     printf ("        Created: %sn", creationDate);
  1040. #if defined(INCLUDE_WDB) && defined(INCLUDE_WDB_BANNER)
  1041.     printf ("n                             ");
  1042.     printf ("WDB Comm Type: %s", WDB_COMM_TYPE_STR);
  1043.     printf ("n                            ");
  1044.     printf ("WDB: %s.",
  1045.     ((wdbRunsExternal () || wdbRunsTasking ()) ?
  1046.  "Ready" : "Agent configuration failed") );
  1047. #endif /*INCLUDE_WDB && INCLUDE_WDB_BANNER*/
  1048.     printf ("nn");
  1049. #ifdef INCLUDE_STARTUP_SCRIPT /* run a startup script */
  1050.     if (sysBootParams.startupScript [0] != EOS)
  1051. usrStartupScript (sysBootParams.startupScript);
  1052. #endif /* INCLUDE_STARTUP_SCRIPT */
  1053. printf("Shell inialize...rn");
  1054.     shellInit (SHELL_STACK_SIZE, TRUE); /* create the shell */
  1055.     /* only include the simple demo if the shell is NOT included */
  1056. #else
  1057. #if defined(INCLUDE_DEMO) /* create demo w/o shell */
  1058.     taskSpawn ("demo", 20, 0, 2000, (FUNCPTR)usrDemo, 0,0,0,0,0,0,0,0,0,0);
  1059. #endif /* mips cpp no elif */
  1060. #endif /* INCLUDE_SHELL */
  1061. #ifdef  INCLUDE_WINDML
  1062.     usrWindMlInit ();
  1063. #endif  /* INCLUDE_WINDML */
  1064. #if defined (INCLUDE_SOUND) && defined(INCLUDE_SB16)
  1065.     sb16Drv ();            /* install sound driver SB16 */
  1066.     sb16DevCreate ("/sound", 0x220, 5, 1, 5);
  1067. #endif /* INCLUDE_SOUND && INCLUDE_SB16 */
  1068. #if defined(INCLUDE_JAVA)
  1069.     javaConfig ();
  1070. #endif /* INCLUDE_JAVA */
  1071. #ifdef INCLUDE_HTML
  1072.     usrHtmlInit ();
  1073. #endif /* INCLUDE_HTML */
  1074. #if CPU==SIMNT
  1075.     win_ReleaseMutex(simUpMutex);
  1076. #endif
  1077. #ifdef INCLUDE_USER_APPL
  1078.     /* Startup the user's application */
  1079.     USER_APPL_INIT; /* must be a valid C statement or block */
  1080. #endif
  1081.     }
  1082. /*******************************************************************************
  1083. *
  1084. * usrClock - user-defined system clock interrupt routine
  1085. *
  1086. * This routine is called at interrupt level on each clock interrupt.
  1087. * It is installed by usrRoot() with a sysClkConnect() call.
  1088. * It calls all the other packages that need to know about clock ticks,
  1089. * including the kernel itself.
  1090. *
  1091. * If the application needs anything to happen at the system clock interrupt
  1092. * level, it can be added to this routine.
  1093. *
  1094. * RETURNS: N/A
  1095. */
  1096. void usrClock ()
  1097.     {
  1098.     tickAnnounce (); /* announce system tick to kernel */
  1099.     }
  1100. #ifdef INCLUDE_DEMO
  1101. /********************************************************************************
  1102. * usrDemo - example application without shell
  1103. *
  1104. * This routine is spawned as a task at the end of usrRoot(), if INCLUDE_DEMO
  1105. * is defined, and INCLUDE_SHELL is NOT defined in configAll.h or config.h.
  1106. * It is intended to indicate how a shell-less application can be linked,
  1107. * loaded, and ROMed.
  1108. *
  1109. * NOMANUAL
  1110. */
  1111. void usrDemo (void)
  1112.     {
  1113.     char string [40];
  1114.     printf ("VxWorks (for %s) version %s.n", sysModel (), vxWorksVersion);
  1115.     printf ("Kernel: %s.n", kernelVersion ());
  1116.     printf ("Made on %s.n", creationDate);
  1117.     FOREVER
  1118.         {
  1119.         printf ("nThis is a test.  Type something: ");
  1120.         fioRdString (STD_IN, string, sizeof (string));
  1121. printf ("nYou typed "%s".n", string);
  1122. if (strcmp (string, "0") == 0)
  1123.     memShow (0);
  1124. if (strcmp (string, "1") == 0)
  1125.     memShow (1);
  1126.         }
  1127.     }
  1128. #endif /* INCLUDE_DEMO */