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

VxWorks

开发平台:

C/C++

  1. /* usrScsi.c - SCSI initialization */
  2. /* Copyright 1992-1997 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. */
  7. /*
  8. DESCRIPTION
  9. This file is used to configure and initialize the VxWorks SCSI support.
  10. This file is included by usrConfig.c.
  11. MAKE NO CHANGES TO THIS FILE.
  12. All BSP specific code should be added to
  13. the sysLib.c file or a sysScsi.c file in the BSP directory.  Define the
  14. macro SYS_SCSI_CONFIG to generate the call to sysScsiConfig().
  15. See usrScsiConfig for more info on the SYS_SCSI_CONFIG macro.
  16. SEE ALSO: usrExtra.c
  17. NOMANUAL
  18. */
  19. /*******************************************************************************
  20. *
  21. * usrScsiConfig - configure SCSI peripherals
  22. *
  23. * This code configures the SCSI disks and other peripherals on a SCSI
  24. * controller chain.
  25. *
  26. * The macro SCSI_AUTO_CONFIG will include code to scan all possible device/lun
  27. * id's and to configure a scsiPhysDev structure for each device found.  Of
  28. * course this doesn't include final configuration for disk partitions,
  29. * floppy configuration parameters, or tape system setup.  All of these actions
  30. * must be performed by user code, either through sysScsiConfig(),
  31. * the startup script, or by the application program.
  32. *
  33. * The user may customize this code on a per BSP basis using the SYS_SCSI_CONFIG
  34. * macro.  If defined, then this routine will call the routine sysScsiConfig().
  35. * That routine is to be provided by the BSP, either in sysLib.c or sysScsi.c.
  36. * If SYS_SCSI_CONFIG is not defined, then sysScsiConfig() will not be called
  37. * as part of this routine.
  38. *
  39. * An example sysScsiConfig() routine can be found in target/src/config/usrScsi.c.
  40. * The example code contains sample configurations for a hard disk, a floppy
  41. * disk and a tape unit.
  42. *
  43. * RETURNS: OK or ERROR.
  44. *
  45. * SEE ALSO:
  46. * .pG "I/O System, Local File Systems"
  47. */
  48. STATUS usrScsiConfig (void)
  49.     {
  50.     /*
  51.      * initialize either the SCSI1 or SCSI2 interface; initialize SCSI2 when
  52.      * the SCSI2 interface is available.
  53.      */
  54. #ifndef INCLUDE_SCSI2
  55.     scsi1IfInit ();
  56. #else
  57.     scsi2IfInit ();
  58. #endif
  59.     if (sysScsiInit () != OK)
  60. {
  61. printf ("sysScsiInit() Failed, SCSI system not initializedn");
  62. return (ERROR);
  63. }
  64. #ifdef SCSI_AUTO_CONFIG
  65.     /* Optional auto-config of physical devices on SCSI bus */
  66.     taskDelay (sysClkRateGet () * 1); /* allow devices to reset */
  67.     printf ("Auto-configuring SCSI bus...nn");
  68.     scsiAutoConfig (pSysScsiCtrl);
  69.     scsiShow (pSysScsiCtrl);
  70.     printf ("n");
  71. #endif /* !SCSI_AUTO_CONFIG */
  72. #ifdef SYS_SCSI_CONFIG
  73.     /* Execute BSP configuration code, if any */
  74.     sysScsiConfig ();
  75. #endif
  76.     return (OK);
  77.     }