Main Page   File List   File Members  

usrConfig.c

00001 /* usrConfig.c - user-defined system configuration library */
00002 
00003 /* Copyright 1984-1998 Wind River Systems, Inc. */
00004 #include "copyright_wrs.h"
00005 
00006 /*
00007 modification history
00008 --------------------
00009 19f,10mar99,drm  Changing WINDMP to VXFUSION to reflect new product name.
00010 19e,08oct98,rlp  added support for UGL and HTML.
00011 19d,17sep98,ms   call cplusDemanglerInit if INCLUDE_CPLUS and INCLUDE_LOADER
00012 19c,17sep98,cym  added code to calculate proper IP address for PCSIM.
00013 19b,01sep98,drm  added code to initialize WindMP
00014 19a,10aug98,cym  added code to inform tornado when the NT simulator is up.
00015 18z,23apr98,yp   merged in TrueFFS support
00016 18y,22apr98,elp  created group 1 module when standalone (fixed SPR# 20301).
00017 18w,22apr98,hdn  added comment for tffsDrv().
00018 18t,17apr98,nps  added support for rBuffShow.
00019 18s,09mar98,sjw  merge in HTTP and JAVA changes for conflict resolution
00020 18r,18dec97,cth  replaced windview, timestamp initialization with windviewConfig
00021 18q,13nov97,cth  changed WV evtInstInit to wvLibInit2; removed connRtnSet, 
00022                  evtTaskInit; added include wvLib.h, rBuffLib.h
00023 18p,18aug97,nps  changed WV buffer initialization with the rBuff API.
00024 18x,06mar98,ms   changed copyright year from 1996 to 1998.
00025 18v,04feb98,jpd  fix unsigned/signed warning (usrRoot); updated copyright date.
00026 18u,25feb98,jgn  removed call to excShowInit(), it is called by excInit()
00027                  if needed (SPR #20625)
00028 18t,19jan98,hdn  changed a condition macro to include tffsDrv().
00029 18p,06jan98,cym  added SIMNT as processor not to clear bss.
00030 18s,23sep97,yp   added support for TFFS.
00031 18r,13aug97,cdp  add Thumb (ARM7TDMI_T) support;
00032                  'fix' unsigned/signed comparison in usrRoot.
00033 18q,26feb97,dat  added INCLUDE_USER_APPL and USER_APPL_INIT, spr 8071.
00034 18p,05feb97,cdp  remove ARM test hook (_func_armStartup).
00035 18o,12dec96,cdp  added _func_armStartup for ARM platforms.
00036 18n,13dec96,elp  changed syncLibInit() into symSyncLibInit().
00037 18m,18nov96,dds  SPR 2529: return status for sysScsiInit is now checked.
00038 18l,06nov96,ms   removed 17n hack to usrClock.
00039 18k,01nov96,hdn  added support for PCMCIA.
00040 18j,21oct96,hdn  changed paramerters for new LPT driver.
00041 18i,04oct96,elp  added INCLUDE_SYM_TBL_SYNC (SPR# 6775).
00042 18h,11jul96,tam  changed copyright year from 1995 to 1996.
00043 18l,19jul96,hdn  added support for ATA driver.
00044 18k,25jun96,jmb  Eliminated alternative WDB macro names (SPR #5707).
00045 18j,25jun96,dbt  Initialized _func_selWakeupListInit before tyLib (SPR #3314).
00046 18i,21jun96,jmb  update copyright. SPR #6364
00047 18h,21jun96,jmb  long modhist -- deleted entries prior to 1994.  SPR #6528
00048 18g,12mar96,tam  removed all #if (CPU == PPC403).
00049 18p,06jun96,ism  bumped copyright to 1996.
00050 18o,26jan96,ism  cleaned up vxsim/solaris version
00051 18f,02oct95,kvk  added sysHwInit2() for PPC603.
00052 18e,27sep95,tpr  removed #if (CPU_FAMILY != PPC) staff.
00053 18n,07nov95,srh  fixed C++ support comments.
00054 18m,29oct95,dat  fixed warnings about printf arguments
00055 18l,11oct95,jdi  doc: changed .pG to .tG.
00056 18k,10oct95,dat  new BSP revision id. Added WDB Banner printing
00057 18j,15jun95,ms   updated for new serial drivers.
00058 18i,09jun95,ms   cleaned up console initialization
00059 18h,30may95,p_m  added initialization of formatted I/O library.
00060                  replaced spyStop() by spyLibInit().
00061 18g,22may95,p_m  no longer initialize object format specific libraries if
00062                  loader is not included.
00063 18f,22may95,myz  modified new serial device initialization for x86 support
00064 18e,22may95,ms   added some WDB agent support
00065 18e,30oct95,ism  updated for SIMSPARCSOLARIS
00066 18d,28mar95,kkk  added scalability support, changed edata and end to arrays
00067                  (SPR #3917), changed baud rate to be a macro in configAll.h
00068 18g,25may95,yao  changed to bzero bss segment for PPC.
00069 18f,04apr95,caf  added PPC cache support.
00070 18e,03mar95,yao  added shsHwInit2 () for PPC403.
00071 18d,24feb95,caf  added PPC support.
00072 18c,20nov94,kdl  added hashLibInit() when using dosFs.
00073 18b,09nov94,jds  additions for scsi backward compatability ; scsi[12]IfInit()
00074 18a,04nov94,kdl  merge cleanup.
00075 17l,02aug94,tpr  added cacheEnable (BRANCH_CACHE) for the MC68060.
00076 17m,15oct94,hdn  added LPT driver.
00077 17o,20jul94,ms   changed INCLUDE_AOUT_HPPA to INCLUDE_SOM_COFF
00078 17n,02may94,ms   added VxSim HP hack to usrClock().
00079 17q,15mar94,smb  renamed tEvtTask parameters.
00080 17p,15feb94,smb  defined WV_MODE, EVTBUFFER_ADDRESS for wvInstInit().
00081 17o,12jan94,kdl  modified posix initialization; added queued signal init.
00082 */
00083 
00084 /*
00085 DESCRIPTION
00086 This library is the WRS-supplied configuration module for VxWorks.  It
00087 contains the root task, the primary system initialization routine, the
00088 network initialization routine, and the clock interrupt routine.
00089 
00090 The include file config.h includes a number of system-dependent parameters used
00091 in this file.
00092 
00093 In an effort to simplify the presentation of the configuration of vxWorks,
00094 this file has been split into smaller files.  These additional configuration
00095 source files are located in ../../src/config/usr[xxx].c and are #included into
00096 this file below.  This file contains the bulk of the code a customer is
00097 likely to customize.
00098 
00099 The module usrDepend.c contains checks that guard against unsupported
00100 configurations suchas INCLUDE_NFS without INCLUDE_RPC.  The module
00101 usrKernel.c contains the core initialization of the kernel which is rarely
00102 customized, but provided for information.  The module usrNetwork.c now
00103 contains all network initialization code.  Finally, the module usrExtra.c
00104 contains the conditional inclusion of the optional packages selected in
00105 configAll.h.
00106 
00107 The source code necessary for the configuration selected is entirely
00108 included in this file during compilation as part of a standard build in
00109 the board support package.  No other make is necessary.
00110 
00111 INCLUDE FILES:
00112 config.h
00113 
00114 SEE ALSO:
00115 .tG "Getting Started, Cross-Development"
00116 */
00117 
00118 #include "vxWorks.h"                    /* always first */
00119 #include "config.h"                     /* board support configuration header */
00120 #include "usrConfig.h"                  /* general configuration header */
00121 #include "usrDepend.c"                  /* include dependency rules */
00122 #include "usrKernel.c"                  /* kernel configuration */
00123 #include "usrExtra.c"                   /* conditionally included packages */
00124 #ifdef APS_BSP
00125 #include "epicsUsrConfig.c"             /* APS additions */
00126 #endif /* APS_BSP */
00127 
00128 #if CPU==SIMNT
00129 extern int simUpMutex;
00130 extern int win_ReleaseMutex(int hMutex);
00131 #endif
00132 
00133 #ifdef INCLUDE_HTTP
00134 #include "http/httpLib.h"               /* Wind Web Server interfaces */
00135 #endif
00136 
00137 /* global variables */
00138 
00139 int             consoleFd;              /* fd of initial console device */
00140 char            consoleName[20];        /* console device name, eg. "/tyCo/0" */
00141 SYMTAB_ID       statSymTbl;             /* system error status symbol table id*/
00142 SYMTAB_ID       standAloneSymTbl;       /* STANDALONE version symbol table id */
00143 SYMTAB_ID       sysSymTbl;              /* system symbol table id */
00144 BOOT_PARAMS     sysBootParams;          /* parameters from boot line */
00145 int             sysStartType;           /* type of boot (WARM, COLD, etc) */
00146 
00147 #ifdef INCLUDE_XRSIO_DRV /* DHT - Addition of serial driver */
00148 extern int xrinit( void );
00149 #endif
00150 
00151 /*******************************************************************************
00152 *
00153 * usrInit - user-defined system initialization routine
00154 *
00155 * This is the first C code executed after the system boots.  This routine is
00156 * called by the assembly language start-up routine sysInit() which is in the
00157 * sysALib module of the target-specific directory.  It is called with
00158 * interrupts locked out.  The kernel is not multitasking at this point.
00159 *
00160 * This routine starts by clearing BSS; thus all variables are initialized to 0,
00161 * as per the C specification.  It then initializes the hardware by calling
00162 * sysHwInit(), sets up the interrupt/exception vectors, and starts kernel
00163 * multitasking with usrRoot() as the root task.
00164 *
00165 * RETURNS: N/A
00166 *
00167 * SEE ALSO: kernelLib
00168 *
00169 * ARGSUSED0
00170 */
00171 
00172 void usrInit 
00173     (
00174     int startType
00175     )
00176     {
00177 #if     (CPU_FAMILY == SPARC)
00178     excWindowInit ();                           /* SPARC window management */
00179 #endif
00180 
00181     /* configure data and instruction cache if available and leave disabled */
00182 
00183 #ifdef  INCLUDE_CACHE_SUPPORT
00184     cacheLibInit (USER_I_CACHE_MODE, USER_D_CACHE_MODE);
00185 #endif  /* INCLUDE_CACHE_SUPPORT */
00186 
00187 #if     CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS
00188     /* don't assume bss variables are zero before this call */
00189 
00190     bzero (edata, end - edata);         /* zero out bss variables */
00191 #endif  /* CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS */
00192 
00193     sysStartType = startType;                   /* save type of system start */
00194 
00195     intVecBaseSet ((FUNCPTR *) VEC_BASE_ADRS);  /* set vector base table */
00196 
00197 #if (CPU_FAMILY == AM29XXX)
00198     excSpillFillInit ();                        /* am29k stack cache managemt */
00199 #endif
00200 
00201 #ifdef  INCLUDE_EXC_HANDLING
00202     excVecInit ();                              /* install exception vectors */
00203 #endif  /* INCLUDE_EXC_HANDLING */
00204 
00205     sysHwInit ();                               /* initialize system hardware */
00206 
00207     usrKernelInit ();                           /* configure the Wind kernel */
00208 
00209 #ifdef  INCLUDE_CACHE_SUPPORT
00210 #ifdef  USER_I_CACHE_ENABLE
00211     cacheEnable (INSTRUCTION_CACHE);            /* enable instruction cache */
00212 #endif  /* USER_I_CACHE_ENABLE */
00213 
00214 #ifdef  USER_D_CACHE_ENABLE
00215     cacheEnable (DATA_CACHE);                   /* enable data cache */
00216 #endif  /* USER_D_CACHE_ENABLE */
00217 
00218 #if (CPU == MC68060)
00219 #ifdef  USER_B_CACHE_ENABLE
00220     cacheEnable (BRANCH_CACHE);                 /* enable branch cache */
00221 #endif  /* USER_B_CACHE_ENABLE */
00222 #endif  /* (CPU == MC68060) */
00223 #endif  /* INCLUDE_CACHE_SUPPORT */
00224 
00225     /* start the kernel specifying usrRoot as the root task */
00226     *(UINT8 *)MV2100_SYS_STAT_REG2 |= MV2100_BD_FAIL;
00227     kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE,
00228 #ifdef  INCLUDE_WDB
00229                 (char *) FREE_RAM_ADRS + WDB_POOL_SIZE,
00230 #else
00231                 (char *) FREE_RAM_ADRS,
00232 #endif
00233                 sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL);
00234     }
00235 
00236 /*******************************************************************************
00237 *
00238 * usrRoot - the root task
00239 *
00240 * This is the first task to run under the multitasking kernel.  It performs
00241 * all final initialization and then starts other tasks.
00242 *
00243 * It initializes the I/O system, installs drivers, creates devices, and sets
00244 * up the network, etc., as necessary for a particular configuration.  It
00245 * may also create and load the system symbol table, if one is to be included.
00246 * It may then load and spawn additional tasks as needed.  In the default
00247 * configuration, it simply initializes the VxWorks shell.
00248 *
00249 * RETURNS: N/A
00250 */
00251 
00252 void usrRoot
00253     (
00254     char *      pMemPoolStart,          /* start of system memory partition */
00255     unsigned    memPoolSize             /* initial size of mem pool */
00256     )
00257     {
00258     char tyName [20];
00259     int  ix;
00260 
00261     /* Initialize the memory pool before initializing any other package.
00262      * The memory associated with the root task will be reclaimed at the
00263      * completion of its activities.
00264      */
00265     *(UINT8 *)MV2100_SYS_STAT_REG2 &= ~MV2100_BD_FAIL;
00266 
00267 #ifdef INCLUDE_MEM_MGR_FULL
00268     memInit (pMemPoolStart, memPoolSize);       /* initialize memory pool */
00269 #else
00270     memPartLibInit (pMemPoolStart, memPoolSize);/* initialize memory pool */
00271 #endif /* INCLUDE_MEM_MGR_FULL */
00272 
00273 #ifdef  INCLUDE_SHOW_ROUTINES 
00274     memShowInit ();                             /* initialize memShow routine */
00275 #endif  /* INCLUDE_SHOW_ROUTINES */
00276 
00277 #if     defined(INCLUDE_MMU_BASIC) || defined(INCLUDE_MMU_FULL)
00278     usrMmuInit ();                              /* initialize the mmu */
00279 #endif  /* defined(INCLUDE_MMU_BASIC) || defined(INCLUDE_MMU_FULL) */
00280 
00281     /* set up system timer */
00282 
00283     sysClkConnect ((FUNCPTR) usrClock, 0);      /* connect clock ISR */
00284     sysClkRateSet (60);                         /* set system clock rate */
00285     sysClkEnable ();                            /* start it */
00286 
00287     /* 
00288      * select sould be initialized after NFS and RPC for proper delete
00289      * hook order but _func_selWakeupListInit should be set 
00290      * before tyLib module (SPR #3314).
00291      */
00292 
00293 #ifdef  INCLUDE_SELECT
00294     _func_selWakeupListInit     = (FUNCPTR) selWakeupListInit;
00295 #endif  /* INCLUDE_SELECT */
00296 
00297     /* initialize I/O system */
00298 
00299 #ifdef  INCLUDE_IO_SYSTEM
00300     iosInit (NUM_DRIVERS, NUM_FILES, "/null");
00301 
00302     consoleFd = NONE;                           /* assume no console device */
00303 
00304 #ifdef  INCLUDE_TYCODRV_5_2
00305 #ifdef  INCLUDE_TTY_DEV
00306     if (NUM_TTY > 0)
00307         {
00308         tyCoDrv ();                             /* install console driver */
00309 
00310         for (ix = 0; ix < NUM_TTY; ix++)        /* create serial devices */
00311             {
00312             sprintf (tyName, "%s%d", "/tyCo/", ix);
00313 
00314             (void) tyCoDevCreate (tyName, ix, 512, 512);
00315 
00316             if (ix == CONSOLE_TTY)
00317                 strcpy (consoleName, tyName);   /* store console name */
00318             }
00319 
00320         consoleFd = open (consoleName, O_RDWR, 0);
00321 
00322         /* set baud rate */
00323 
00324         (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
00325         (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
00326         }
00327 #endif  /* INCLUDE_TTY_DEV */
00328 
00329 #else   /* !INCLUDE_TYCODRV_5_2 */
00330 #ifdef  INCLUDE_TTY_DEV
00331     if (NUM_TTY > 0)
00332         {
00333         ttyDrv();                               /* install console driver */
00334 
00335         for (ix = 0; ix < NUM_TTY; ix++)        /* create serial devices */
00336             {
00337 #if     (defined(INCLUDE_WDB) && (WDB_COMM_TYPE == WDB_COMM_SERIAL))
00338             if (ix == WDB_TTY_CHANNEL)          /* don't use WDBs channel */
00339                 continue;
00340 #endif
00341             sprintf (tyName, "%s%d", "/tyCo/", ix);
00342             (void) ttyDevCreate (tyName, sysSerialChanGet(ix), 512, 512);
00343 
00344             if (ix == CONSOLE_TTY)              /* init the tty console */
00345                 {
00346                 strcpy (consoleName, tyName);
00347                 consoleFd = open (consoleName, O_RDWR, 0);
00348                 (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
00349                 (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
00350                 }
00351             }
00352         }
00353 #endif  /* INCLUDE_TTY_DEV */
00354 
00355 #ifdef INCLUDE_PC_CONSOLE
00356     pcConDrv ();
00357     for (ix = 0; ix < N_VIRTUAL_CONSOLES; ix++)
00358         {
00359         sprintf (tyName, "%s%d", "/pcConsole/", ix);
00360         (void) pcConDevCreate (tyName,ix, 512, 512);
00361         if (ix == PC_CONSOLE)           /* init the console device */
00362             {
00363             strcpy (consoleName, tyName);
00364             consoleFd = open (consoleName, O_RDWR, 0);
00365             (void) ioctl (consoleFd, FIOBAUDRATE, CONSOLE_BAUD_RATE);
00366             (void) ioctl (consoleFd, FIOSETOPTIONS, OPT_TERMINAL);
00367             }
00368         }
00369 #endif  /* INCLUDE_PC_CONSOLE */
00370 
00371 #endif  /* !INCLUDE_TYCODRV_5_2 */
00372 
00373     ioGlobalStdSet (STD_IN,  consoleFd);
00374     ioGlobalStdSet (STD_OUT, consoleFd);
00375     ioGlobalStdSet (STD_ERR, consoleFd);
00376 #endif  /* INCLUDE_IO_SYSTEM */
00377 
00378     /* initialize symbol table facilities */
00379 
00380 #ifdef  INCLUDE_SYM_TBL
00381     hashLibInit ();                     /* initialize hash table package */
00382     symLibInit ();                      /* initialize symbol table package */
00383 #ifdef  INCLUDE_SHOW_ROUTINES 
00384     symShowInit ();                     /* initialize symbol table show */
00385 #endif  /* INCLUDE_SHOW_ROUTINES */
00386 #endif  /* INCLUDE_SYM_TBL */
00387 
00388 
00389     /* initialize exception handling */
00390 
00391 #if     defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK)
00392     excInit ();                         /* initialize exception handling */
00393 #endif  /* defined(INCLUDE_EXC_HANDLING) && defined(INCLUDE_EXC_TASK) */
00394 
00395 #ifdef  INCLUDE_LOGGING
00396     logInit (consoleFd, MAX_LOG_MSGS);  /* initialize logging */
00397 #endif  /* INCLUDE_LOGGING */
00398 
00399 #ifdef  INCLUDE_SIGNALS
00400     sigInit ();                         /* initialize signals */
00401 #endif  /* INCLUDE_SIGNALS */
00402 
00403     /* initialize debugging */
00404 
00405 #ifdef  INCLUDE_DEBUG
00406     dbgInit ();                         /* initialize debugging */
00407 #endif  /* INCLUDE_DEBUG */
00408 
00409 
00410     /* initialize pipe driver */
00411 
00412 #ifdef  INCLUDE_PIPES
00413     pipeDrv ();                         /* install pipe driver */
00414 #endif  /* INCLUDE_PIPES */
00415 
00416 
00417     /* initialize standard I/O package */
00418 
00419 #ifdef  INCLUDE_STDIO
00420     stdioInit ();                       /* initialize standard I/O library */
00421 #ifdef  INCLUDE_SHOW_ROUTINES
00422     stdioShowInit ();
00423 #endif  /* INCLUDE_SHOW_ROUTINES */
00424 #endif  /* INCLUDE_STDIO */
00425 
00426     /* initialize POSIX queued signals */
00427 
00428 #if defined(INCLUDE_POSIX_SIGNALS) && defined(INCLUDE_SIGNALS)
00429     sigqueueInit (NUM_SIGNAL_QUEUES); /* initialize queued signals */
00430 #endif
00431 
00432     /* initialize POSIX semaphores */
00433 
00434 #ifdef  INCLUDE_POSIX_SEM
00435     semPxLibInit ();                    
00436 #ifdef INCLUDE_SHOW_ROUTINES
00437     semPxShowInit ();
00438 #endif  /* INCLUDE_SHOW_POUTINES */
00439 #endif  /* INCLUDE_POSIX_SEM */
00440 
00441     /* initialize POSIX message queues */
00442 
00443 #ifdef INCLUDE_POSIX_MQ
00444     mqPxLibInit (MQ_HASH_SIZE);         
00445 #ifdef INCLUDE_SHOW_ROUTINES
00446     mqPxShowInit ();
00447 #endif  /* INCLUDE_SHOW_ROUTINES */
00448 #endif  /* INCLUDE_POSIX_MQ */
00449 
00450     /* initialize POSIX async I/O support */
00451 
00452 #ifdef INCLUDE_POSIX_AIO
00453     aioPxLibInit (MAX_LIO_CALLS);
00454 #ifdef INCLUDE_POSIX_AIO_SYSDRV
00455     aioSysInit (MAX_AIO_SYS_TASKS, AIO_TASK_PRIORITY, AIO_TASK_STACK_SIZE);
00456 #endif  /* INCLUDE_POSIX_AIO_SYSDRV */
00457 #endif  /* INCLUDE_POSIX_AIO */
00458 
00459     /* initialize filesystems and disk drivers */
00460 
00461 #ifdef  INCLUDE_DOSFS
00462     hashLibInit ();                     /* initialize hash table package */
00463     dosFsInit (NUM_DOSFS_FILES);        /* init dosFs filesystem */
00464 #endif  /* INCLUDE_DOSFS */
00465 
00466 #ifdef  INCLUDE_RAWFS
00467     rawFsInit (NUM_RAWFS_FILES);        /* init rawFs filesystem */
00468 #endif  /* INCLUDE_RAWFS */
00469 
00470 #ifdef  INCLUDE_RT11FS
00471     rt11FsInit (NUM_RT11FS_FILES);      /* init rt11Fs filesystem */
00472 #endif  /* INCLUDE_RT11FS */
00473 
00474 #ifdef  INCLUDE_RAMDRV
00475     ramDrv ();                          /* initialize ram disk driver */
00476 #endif  /* INCLUDE_RAMDRV */
00477 
00478 #ifdef  INCLUDE_SCSI
00479 
00480     /*
00481      * initialize either the SCSI1 or SCSI2 interface; initialize SCSI2 when 
00482      * the SCSI2 interface is available.
00483      */
00484 
00485 #ifndef INCLUDE_SCSI2
00486     scsi1IfInit ();
00487 #else
00488     scsi2IfInit ();
00489 #endif
00490 
00491     /* initialize SCSI controller */
00492     if (sysScsiInit () == OK)
00493         {
00494         usrScsiConfig ();                       /* configure SCSI peripherals */
00495         }
00496     else
00497         {
00498         printf ("sysScsiInit() Failed, SCSI system not initialized\n");
00499         }
00500 
00501 #endif  /* INCLUDE_SCSI */
00502 
00503 #ifdef  INCLUDE_FD
00504     fdDrv (FD_INT_VEC, FD_INT_LVL);     /* initialize floppy disk driver */
00505 #endif  /* INCLUDE_FD */
00506 
00507 #ifdef  INCLUDE_IDE
00508     ideDrv (IDE_INT_VEC, IDE_INT_LVL, IDE_CONFIG); /* init IDE disk driver */
00509 #endif  /* INCLUDE_IDE */
00510 
00511 #ifdef  INCLUDE_ATA
00512     {                                   /* initialize hard disk driver */
00513     IMPORT ATA_RESOURCE ataResources[];
00514     ATA_RESOURCE *pAtaResource;
00515 
00516     for (ix = 0; ix < ATA_MAX_CTRLS; ix++)
00517         {
00518         pAtaResource = &ataResources[ix];
00519         if (pAtaResource->ctrlType == IDE_LOCAL)
00520             ataDrv (ix, pAtaResource->drives, pAtaResource->intVector,
00521                     pAtaResource->intLevel, pAtaResource->configType,
00522                     pAtaResource->semTimeout, pAtaResource->wdgTimeout);
00523         }
00524     }
00525 #ifdef  INCLUDE_SHOW_ROUTINES
00526     ataShowInit ();                     /* install ATA/IDE show routine */
00527 #endif  /* INCLUDE_SHOW_ROUTINES */
00528 #endif  /* INCLUDE_ATA */
00529 
00530 #ifdef  INCLUDE_LPT
00531     {
00532     IMPORT LPT_RESOURCE lptResources[];
00533     lptDrv (LPT_CHANNELS, &lptResources[0]); /* init LPT parallel driver */
00534     }
00535 #endif  /* INCLUDE_LPT */
00536 
00537 #ifdef  INCLUDE_PCMCIA
00538 #ifdef  INCLUDE_SHOW_ROUTINES
00539     pcmciaShowInit ();                  /* install PCMCIA show routines */
00540 #endif  /* INCLUDE_SHOW_ROUTINES */
00541     pcmciaInit ();                      /* init PCMCIA Lib */
00542 #endif  /* INCLUDE_PCMCIA */
00543 
00544 #ifdef  INCLUDE_TFFS
00545     tffsDrv ();                         /* it should be after pcmciaInit() */
00546 #endif  /* INCLUDE_TFFS */
00547 
00548 #ifdef  INCLUDE_FORMATTED_IO
00549     fioLibInit ();                      /* initialize formatted I/O */
00550 #endif  /* INCLUDE_FORMATTED_IO */
00551 
00552     /* initialize floating point facilities */
00553 
00554 #ifdef  INCLUDE_FLOATING_POINT
00555     floatInit ();                       /* initialize floating point I/O */
00556 #endif  /* INCLUDE_FLOATING_POINT */
00557 
00558     /* install software floating point emulation (if applicable) */
00559 
00560 #ifdef  INCLUDE_SW_FP
00561     mathSoftInit ();                    /* use software emulation for fp math */
00562 #endif  /* INCLUDE_SW_FP */
00563 
00564     /* install hardware floating point support (if applicable) */
00565 
00566 #ifdef  INCLUDE_HW_FP
00567     mathHardInit ();                    /* do fppInit() & install hw fp math */
00568 
00569 #ifdef  INCLUDE_SHOW_ROUTINES 
00570     fppShowInit ();                     /* install hardware fp show routine */
00571 #endif  /* INCLUDE_SHOW_ROUTINES */
00572 #endif  /* INCLUDE_HW_FP */
00573 
00574     /* initialize performance monitoring tools */
00575 
00576 #ifdef  INCLUDE_SPY
00577     spyLibInit ();                      /* install task cpu utilization tool */
00578 #endif  /* INCLUDE_SPY */
00579 
00580 #ifdef  INCLUDE_TIMEX
00581     timexInit ();                       /* install function timing tool */
00582 #endif  /* INCLUDE_TIMEX */
00583 
00584 #ifdef  INCLUDE_ENV_VARS
00585     envLibInit (ENV_VAR_USE_HOOKS);     /* initialize environment variable */
00586 #endif  /* INCLUDE_ENV_VARS */
00587 
00588 #ifdef INCLUDE_NTPASSFS
00589     {
00590     extern int ntPassFsInit();
00591     extern int ntPassFsDevInit();
00592 
00593     ntPassFsInit(1);
00594     ntPassFsDevInit("host:");
00595     }
00596 #endif /* INCLUDE_NTPASSFS */
00597 
00598     /* initialize object module loader */
00599 
00600 #ifdef  INCLUDE_LOADER
00601     moduleLibInit ();                   /* initialize module manager */
00602 
00603 #if     defined(INCLUDE_AOUT)
00604     loadAoutInit ();                            /* use a.out format */
00605 #else   /* coff or ecoff */
00606 #if     defined(INCLUDE_ECOFF)
00607     loadEcoffInit ();                           /* use ecoff format */
00608 #else   /* ecoff */
00609 #if     defined(INCLUDE_COFF)
00610     loadCoffInit ();                            /* use coff format */
00611 #else   /* coff */
00612 #if     defined(INCLUDE_ELF)
00613     loadElfInit ();                             /* use elf format */
00614 #else
00615 #if     defined(INCLUDE_SOM_COFF)
00616     loadSomCoffInit ();
00617 #else
00618 #if     defined(INCLUDE_PECOFF)
00619     {
00620     extern int loadPecoffInit();
00621 
00622     loadPecoffInit ();
00623     }
00624 #endif
00625 #endif
00626 #endif
00627 #endif
00628 #endif
00629 #endif
00630 
00631 #endif  /* INCLUDE_LOADER */
00632 
00633     /* initialize wtx client to synchronize host and target symbol tables */
00634 #ifdef  INCLUDE_SYM_TBL_SYNC
00635     symSyncLibInit ();
00636 #endif /* INCLUDE_SYM_TBL_SYNC */
00637 
00638     /* initialize network */
00639 
00640 #ifdef  INCLUDE_NET_INIT
00641     usrBootLineInit (sysStartType);     /* crack the bootline */
00642     usrNetInit (BOOT_LINE_ADRS);        /* initialize network support */
00643 #ifdef APS_BSP
00644     epicsIncPort();
00645 #endif /* APS_BSP */
00646 #if CPU==SIMNT
00647     {
00648     extern int simProcnum;
00649     char ulipIP[] = "90.0.0.1";
00650 
00651     ulipIP[7] = '1'+simProcnum;
00652     routeAdd("0.0.0.0",ulipIP);
00653     }
00654 #endif  /* CPU==SIMNT */
00655 #endif  /* INCLUDE_NET_INIT */
00656 
00657 #ifdef  INCLUDE_PASSFS
00658     {
00659     extern STATUS passFsInit ();
00660     extern void *passFsDevInit ();
00661     char passName [256];
00662 
00663     if (passFsInit (1) == OK)
00664         {
00665         extern char vxsim_hostname[];
00666         extern char vxsim_cwd[];
00667 
00668         sprintf (passName, "%s:", vxsim_hostname);
00669         if (passFsDevInit (passName) == NULL)
00670             {
00671             printf ("passFsDevInit failed for <%s>\n", passName);
00672             }
00673         else
00674             {
00675             sprintf (passName, "%s:%s", vxsim_hostname, vxsim_cwd);
00676             ioDefPathSet (passName);
00677             }
00678         }
00679     else
00680         printf ("passFsInit failed\n");
00681     }
00682 #endif  /* INCLUDE_PASSFS */
00683 
00684 #ifdef  INCLUDE_DOS_DISK
00685     {
00686     char unixName [80];
00687     extern void unixDrv ();
00688     extern void unixDiskInit ();
00689     extern char *u_progname;  /* home of executable */
00690     char *pLastSlash;
00691 
00692     unixDrv ();
00693 
00694     pLastSlash = strrchr (u_progname, '/');
00695     pLastSlash = (pLastSlash == NULL) ? u_progname : (pLastSlash + 1);
00696     sprintf (unixName, "/tmp/%s%d.dos", pLastSlash, sysProcNumGet());
00697     unixDiskInit (unixName, "A:", 0);
00698     }
00699 #endif  /* INCLUDE_DOS_DISK */
00700 
00701     /* initialize shared memory objects */
00702 
00703 #ifdef INCLUDE_SM_OBJ                   /* unbundled shared memory objects */
00704     usrSmObjInit (BOOT_LINE_ADRS);
00705 #endif /* INCLUDE_SM_OBJ */
00706 
00707    /* initialize WindMP */
00708 
00709 #ifdef INCLUDE_VXFUSION                 /* unbundled VxFusion (distributed objects) */
00710     usrVxFusionInit (BOOT_LINE_ADRS);
00711 #ifdef INCLUDE_SHOW_ROUTINES
00712     {
00713     extern void msgQDistShowInit();
00714     extern void distNameShowInit ();
00715     extern void distIfShowInit ();
00716     extern void msgQDistGrpShowInit ();
00717 
00718     msgQDistShowInit();
00719     distNameShowInit ();
00720     distIfShowInit ();
00721     msgQDistGrpShowInit ();
00722     }
00723 #endif /* INCLUDE_SHOW_ROUTINES */
00724 #endif /* INCLUDE_WINDMP */
00725 
00726     /* write protect text segment & vector table only after bpattach () */
00727 
00728 #ifdef  INCLUDE_MMU_FULL                /* unbundled mmu product */
00729 #ifdef  INCLUDE_PROTECT_TEXT
00730     if (vmTextProtect () != OK)
00731         printf ("\nError protecting text segment. errno = %x\n", errno);
00732 #endif  /* INCLUDE_PROTECT_TEXT */
00733 
00734 #ifdef  INCLUDE_PROTECT_VEC_TABLE
00735     if (intVecTableWriteProtect () != OK)
00736         printf ("\nError protecting vector table. errno = %x\n", errno);
00737 #endif  /* INCLUDE_PROTECT_VEC_TABLE */
00738 #endif  /* INCLUDE_MMU_FULL */
00739 
00740     /* initialize select only after NFS and RPC for proper delete hook order */
00741 
00742 #ifdef  INCLUDE_SELECT
00743     selectInit ();
00744 #endif  /* INCLUDE_SELECT */
00745 
00746     /* create system and status symbol tables */
00747 
00748 #ifdef  INCLUDE_STANDALONE_SYM_TBL
00749     sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);
00750 
00751 #ifdef  INCLUDE_SYM_TBL_SYNC
00752     /* create a module (group 1) that is not synchronized (SPR# 20301) */
00753 
00754     moduleCreate ("vxWorks.sym", 
00755 #if (defined INCLUDE_AOUT)
00756                   MODULE_A_OUT,
00757 #elif ((defined INCLUDE_COFF) || (defined INCLUDE_ECOFF) || \
00758        (defined INCLUDE_SOMCOFF))
00759                   MODULE_ECOFF,
00760 #elif (defined INCLUDE_ELF)
00761                   MODULE_ELF,
00762 #endif /* INCLUDE_AOUT */
00763                   HIDDEN_MODULE|LOAD_NO_SYMBOLS);
00764 #endif /* INCLUDE_SYM_TBL_SYNC */
00765 
00766     printf ("\nAdding %ld symbols for standalone.\n", standTblSize);
00767 
00768     /* fill in from built in table*/
00769 
00770     for (ix = 0; (ULONG) ix < standTblSize; ix++)
00771 #if     (CPU == ARM7TDMI_T)
00772         thumbSymTblAdd (sysSymTbl, &(standTbl[ix]));
00773 #else
00774         symTblAdd (sysSymTbl, &(standTbl[ix]));
00775 #endif  /* CPU==ARM7TDMI_T `*/
00776 #endif  /* INCLUDE_STANDALONE_SYM_TBL */
00777 
00778 #ifdef  INCLUDE_NET_SYM_TBL
00779     sysSymTbl = symTblCreate (SYM_TBL_HASH_SIZE_LOG2, TRUE, memSysPartId);
00780 
00781     netLoadSymTbl ();                           /* fill in table from host */
00782 #endif  /* INCLUDE_NET_SYM_TBL */
00783 
00784 #ifdef  INCLUDE_STAT_SYM_TBL
00785     statSymTbl = symTblCreate (STAT_TBL_HASH_SIZE_LOG2, FALSE, memSysPartId);
00786 
00787     for (ix = 0; (ULONG)ix < statTblSize; ix ++) /* fill in from builtin table*/
00788         symTblAdd (statSymTbl, &(statTbl [ix]));
00789 #endif  /* INCLUDE_STAT_SYM_TBL */
00790 
00791 
00792     /* initialize C++ support library */
00793 
00794 #if     defined (INCLUDE_CPLUS) && defined (INCLUDE_CPLUS_MIN)
00795 #error  Define only one of INCLUDE_CPLUS or INCLUDE_CPLUS_MIN, not both
00796 #endif
00797 
00798 #ifdef  INCLUDE_CPLUS                   /* all standard C++ runtime support */
00799     cplusLibInit ();
00800 #ifdef  INCLUDE_LOADER
00801     cplusDemanglerInit ();
00802 #endif
00803 #endif
00804 
00805 #ifdef  INCLUDE_CPLUS_MIN               /* minimal C++ runtime support */
00806     cplusLibMinInit ();
00807 #ifdef  INCLUDE_LOADER
00808     cplusDemanglerInit ();
00809 #endif
00810 #endif
00811 
00812     /* initialize Wind Web Server */
00813 
00814 #ifdef INCLUDE_HTTP
00815     httpd ();
00816 #endif /* INCLUDE_HTTP */
00817 
00818 #ifdef   INCLUDE_RBUFF                  /* install rBuff support */
00819     rBuffLibInit();
00820 #ifdef  INCLUDE_SHOW_ROUTINES
00821     rBuffShowInit ();                   /* install rBuff show routine */
00822 #endif  /* INCLUDE_SHOW_ROUTINES */
00823 #endif /* INCLUDE_RBUFF */
00824 
00825 #ifdef INCLUDE_WINDVIEW
00826     windviewConfig ();
00827 #endif /* INCLUDE_WINDVIEW */
00828 
00829 
00830     /* initialize the WDB debug agent */
00831 
00832 #ifdef  INCLUDE_WDB
00833     wdbConfig();
00834 
00835 #ifdef  INCLUDE_WDB_BANNER
00836 #ifndef INCLUDE_SHELL
00837     /* short banner, like the bootPrintLogo banner */
00838     printf ("\n\n");
00839     printf ("%17s%s",     "","VxWorks\n\n");
00840     printf ("Copyright 1984-1998  Wind River Systems, Inc.\n\n");
00841     printf ("            CPU: %s\n", sysModel ());
00842     printf ("        VxWorks: " VXWORKS_VERSION "\n");
00843     printf ("    BSP version: " BSP_VERSION BSP_REV "\n");
00844     printf ("  Creation date: %s\n", __DATE__);
00845     printf ("            WDB: %s.\n\n",
00846             ((wdbRunsExternal () || wdbRunsTasking ()) ?
00847                  "Ready" : "Agent configuration failed") );
00848 #endif /*INCLUDE_SHELL*/
00849 
00850 #endif /*INCLUDE_WDB_BANNER*/
00851 
00852 #endif  /* INCLUDE_WDB */
00853 
00854     /* initialize interactive shell */
00855 
00856 #ifdef  INCLUDE_SHELL
00857 #ifdef  INCLUDE_SECURITY                        /* include shell security */
00858     if ((sysFlags & SYSFLG_NO_SECURITY) == 0)
00859         {
00860         loginInit ();                           /* initialize login table */
00861 #ifndef APS_BSP
00862         shellLoginInstall (loginPrompt, NULL);  /* install security program */
00863 #else /* APS_BSP */
00864         shellLoginInstall (apsLoginPrompt, NULL);       /* install security program */
00865 #endif /* APS_BSP */
00866 
00867         /* add additional users here as required */
00868 
00869         loginUserAdd (LOGIN_USER_NAME, LOGIN_PASSWORD); 
00870         }
00871 #endif  /* INCLUDE_SECURITY */
00872 
00873     printLogo ();                               /* print out the banner page */
00874 
00875     printf ("                               ");
00876     printf ("CPU: %s.  Processor #%d.\n", sysModel (), sysProcNumGet ());
00877     printf ("                              ");
00878     printf ("Memory Size: 0x%x.\n", (UINT)(sysMemTop () - (char *)LOCAL_MEM_LOCAL_ADRS));
00879     printf ("                             ");    
00880     printf ("BSP version " BSP_VERSION BSP_REV ".");
00881 #if defined(INCLUDE_WDB) && defined(INCLUDE_WDB_BANNER)
00882     printf ("\n                             ");
00883     printf ("WDB: %s.",
00884             ((wdbRunsExternal () || wdbRunsTasking ()) ?
00885                  "Ready" : "Agent configuration failed") );
00886 #endif /*INCLUDE_WDB && INCLUDE_WDB_BANNER*/
00887 #ifdef APS_BSP
00888     epicsUsrInit();
00889 #endif /* APS_BSP */
00890     printf ("\n\n");
00891 
00892 #ifdef INCLUDE_XRSIO_DRV /* DHT@SNS - Addition of serial driver */
00893         {
00894                 /* This needs to happen before the shell script runs so the 
00895                  * serial devices will be available for epics devices */
00896                 XrSioDrvInit(); /* Starts up the serial devices if possible */
00897         }
00898 #endif INCLUDE_XRSIO_DRV
00899 
00900 
00901 #ifdef  INCLUDE_STARTUP_SCRIPT                  /* run a startup script */
00902     if (sysBootParams.startupScript [0] != EOS)
00903         usrStartupScript (sysBootParams.startupScript);
00904 #endif  /* INCLUDE_STARTUP_SCRIPT */
00905 
00906     shellInit (SHELL_STACK_SIZE, TRUE);         /* create the shell */
00907 
00908 
00909     /* only include the simple demo if the shell is NOT included */
00910 
00911 #else
00912 #if defined(INCLUDE_DEMO)                       /* create demo w/o shell */
00913     taskSpawn ("demo", 20, 0, 2000, (FUNCPTR)usrDemo, 0,0,0,0,0,0,0,0,0,0);
00914 #endif                                          /* mips cpp no elif */
00915 
00916 #endif  /* INCLUDE_SHELL */
00917 
00918 #ifdef  INCLUDE_UGL
00919     usrUglInit ();
00920 #endif  /* INCLUDE_UGL */
00921 
00922 #if defined(INCLUDE_JAVA)
00923     javaConfig ();
00924 #endif  /* INCLUDE_JAVA */
00925 
00926 #ifdef INCLUDE_HTML
00927     usrHtmlInit ();
00928 #endif /* INCLUDE_HTML */
00929 
00930 #if CPU==SIMNT
00931     win_ReleaseMutex(simUpMutex);
00932 #endif
00933 
00934 #ifdef INCLUDE_USER_APPL
00935     /* Startup the user's application */
00936 
00937     USER_APPL_INIT;     /* must be a valid C statement or block */
00938 #endif
00939 
00940     }
00941 
00942 /*******************************************************************************
00943 *
00944 * usrClock - user-defined system clock interrupt routine
00945 *
00946 * This routine is called at interrupt level on each clock interrupt.
00947 * It is installed by usrRoot() with a sysClkConnect() call.
00948 * It calls all the other packages that need to know about clock ticks,
00949 * including the kernel itself.
00950 *
00951 * If the application needs anything to happen at the system clock interrupt
00952 * level, it can be added to this routine.
00953 *
00954 * RETURNS: N/A
00955 */
00956 
00957 void usrClock ()
00958 
00959     {
00960     tickAnnounce ();    /* announce system tick to kernel */
00961     }
00962 
00963 #ifdef  INCLUDE_DEMO
00964 
00965 /********************************************************************************
00966 * usrDemo - example application without shell
00967 *
00968 * This routine is spawned as a task at the end of usrRoot(), if INCLUDE_DEMO
00969 * is defined, and INCLUDE_SHELL is NOT defined in configAll.h or config.h.
00970 * It is intended to indicate how a shell-less application can be linked,
00971 * loaded, and ROMed.
00972 *
00973 * NOMANUAL
00974 */
00975 
00976 void usrDemo (void)
00977 
00978     {
00979     char string [40];
00980 
00981     printf ("VxWorks (for %s) version %s.\n", sysModel (), vxWorksVersion);
00982     printf ("Kernel: %s.\n", kernelVersion ());
00983     printf ("Made on %s.\n", creationDate);
00984 
00985     FOREVER
00986         {
00987         printf ("\nThis is a test.  Type something: ");
00988         fioRdString (STD_IN, string, sizeof (string));
00989         printf ("\nYou typed \"%s\".\n", string);
00990 
00991         if (strcmp (string, "0") == 0)
00992             memShow (0);
00993 
00994         if (strcmp (string, "1") == 0)
00995             memShow (1);
00996         }
00997     }
00998 
00999 #endif  /* INCLUDE_DEMO */
01000 
01001 
01002 /* Extra routine, defined in configNet.h, to dynamically  add devices
01003  * based on what is found during the driver's pci scanning, the drivers
01004  * call this once for each found device DHT@SNS */
01005   
01006 #ifdef ADD_SYS_END_DEV_TBL_ADD
01007         ADD_SYS_END_DEV_TBL_ADD
01008 #endif
01009 
01010 static char identusrConfig_c[]="@(#) $Name:  $ $Id: usrConfig.c,v 1.4 2002/08/28 20:02:35 thompson Exp $";

Generated on Tue Sep 17 13:03:01 2002 for MV2100 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002