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

VxWorks

开发平台:

C/C++

  1. /* cvmeSqsys3.c - Cyclone Squall sys-3 module library */
  2. /* Copyright 1984-1993 Wind River Systems, Inc. */
  3. #include "copyright_wrs.h"
  4. /*
  5. modification history
  6. --------------------
  7. 01b,24jan95,jdi  doc tweak to sysScsiInit().
  8. 01a,03mar93,ccc  created.
  9. */
  10. /*
  11. DESCRIPTION
  12. This library contains routines to manipulate the Cyclone Squall sys-3
  13. module.  This library addresses initialization, plus the SCSI and
  14. LANCE ethernet functions of the Squall sys-3.
  15. */
  16. /* memory configuration table entries for SQSYS3 (82596 ethernet) */
  17. #define SQSYS3_MCON_C (UINT32) 0x00100002
  18. #define SQSYS3_MCON_D (UINT32) 0x00000000
  19. /*******************************************************************************
  20. *
  21. * sysSquallInit - initialize the Cyclone Squall sys-3 module hardware
  22. *
  23. * RETURNS: N/A
  24. *
  25. * NOMANUAL
  26. */
  27. void sysSquallInit (void)
  28.     {
  29.     }
  30. /******************************************************************************
  31. *
  32. * sys596Init - performs any additional board specific 82596 device init
  33. *
  34. * Set up the control table entries for the SQSYS3 Squall module.  In addition,
  35. * save these parameters in the Cyclone NVRAM area.
  36. *
  37. * NOMANUAL
  38. */
  39. void sys596Init
  40.     (
  41.     volatile int unit           /* ignored */
  42.     )
  43.     {
  44.     sysSquallCtrlTableSetup (SQSYS3_MCON_C, SQSYS3_MCON_D,
  45.      CVME960_VEC_XINT3, CVME960_VEC_XINT4,
  46.      LEVEL_TRIG, EDGE_TRIG);
  47.     sysSquallRamSet (SQSYS3_MCON_C, SQSYS3_MCON_D,
  48.      CVME960_VEC_XINT3, CVME960_VEC_XINT4,
  49.      LEVEL_TRIG, EDGE_TRIG);
  50.     }
  51. /******************************************************************************
  52. *
  53. * sys596Port - writes a command to the 82596 device PORT location
  54. *
  55. * There are 4 commands the device handles.
  56. *
  57. * NOMANUAL
  58. */
  59. void sys596Port
  60.     (
  61.     volatile int unit,  /* ignored */
  62.     int cmd,            /* the command to write */
  63.     UINT32 addr         /* address or NULL if PORT_RESET command */
  64.     )
  65.     {
  66.     volatile UINT32 *port;
  67.     port = (volatile UINT32 *) CVME960_EI_PORT;
  68.     *port = (cmd & 0x3) | (addr & 0xfffffffc);  /* requires two accesses */
  69.     *port = (cmd & 0x3) | (addr & 0xfffffffc);
  70.     }
  71. /******************************************************************************
  72. *
  73. * sys596ChanAtn - assert the Channel Attention signal to the 82596 device
  74. *
  75. * NOMANUAL
  76. */
  77. void sys596ChanAtn
  78.     (
  79.     volatile int unit /* ignored */
  80.     )
  81.     {
  82.     *CVME960_EI_CA = 1; /* write to the addr; data is ignored */
  83.     }
  84. /******************************************************************************
  85. *
  86. * sys596IntAck - acknowlege interrupts from the 82596 device
  87. *
  88. * Since the interrupts from the 82596 are falling-edge detected,
  89. * there is no need to acknowlege them.
  90. *
  91. * NOMANUAL
  92. */
  93. void sys596IntAck
  94.     (
  95.     volatile int unit    /* ignored */
  96.     )
  97.     {
  98.     }
  99. /******************************************************************************
  100. *
  101. * sys596IntEnable - enable interrupts from the 82596 device
  102. *
  103. * Enables 82596 Ethernet controller interrupts by setting the
  104. * appropriate bit in the 960's IMSK register.
  105. *
  106. * NOMANUAL
  107. */
  108. void sys596IntEnable
  109.     (
  110.     volatile int unit    /* ignored */
  111.     )
  112.     {
  113.     vxIMRSet (CVME960_MASK_XINT4);
  114.     }
  115. /******************************************************************************
  116. *
  117. * sys596IntDisable - disable interrupts from the 82596 device
  118. *
  119. * Disables 82596 Ethernet controller interrupts by clearing the
  120. * appropriate bit in the 960's IMSK register.
  121. *
  122. * NOMANUAL
  123. */
  124. void sys596IntDisable
  125.     (
  126.     volatile int unit    /* ignored */
  127.     )
  128.     {
  129.     vxIMRClear (CVME960_MASK_XINT4);
  130.     }
  131. #ifdef  INCLUDE_SCSI
  132. /******************************************************************************
  133. *
  134. * sysScsiInit - initialize NCR710 SCSI chip
  135. *
  136. * This routine creates and initializes an SIOP structure, enabling use of the
  137. * on-board SCSI port.  It also connects the proper interrupt service routine
  138. * to the desired vector, and enables the interrupt at the desired level.
  139. *
  140. * RETURNS: OK, or ERROR if the control structure is not created or the
  141. * interrupt service routine cannot be connected to the interrupt.
  142. */
  143. STATUS sysScsiInit ()
  144.     {
  145.     /* Local structure with a prefill for ncr710SetHwRegister */
  146.     static NCR710_HW_REGS hwRegs = CVME960_SIOP_HW_REGS;
  147.     if ((pSysScsiCtrl = (SCSI_CTRL *) ncr710CtrlCreate (CVME960_SIOP_BASE_ADRS,
  148.                                                         CVME960_SIOP_FREQ
  149.                                                         )) == NULL)
  150.     {
  151.     return (ERROR);
  152.     }
  153.         /* connect the SCSI controller's interrupt service routine */
  154.     if (intConnect ((VOIDFUNCPTR *)(INUM_TO_IVEC (INT_VEC_SCSI)),
  155.     ncr710Intr, (int) pSysScsiCtrl) == ERROR)
  156. {
  157.         return (ERROR);
  158.         }
  159.     vxIMRSet (CVME960_MASK_XINT3);
  160.     /* Set the good value in the registers of the SIOP coupled
  161.      * with the hardware implementation
  162.      * NO MUX HOST BUS/NO BURST ACCES/SNOOP :DEFAULT/ENABLE SYNC HOST BUS/
  163.      * BURST SIZE DEFAULT/OTHER :DEFAULT CONFIGURATION
  164.      */
  165.     if (ncr710SetHwRegister (pSysScsiCtrl, &hwRegs) == ERROR)
  166.        return(ERROR);
  167.     /* initialize SCSI controller with default parameters (user tunable) */
  168.     if (ncr710CtrlInit (pSysScsiCtrl, SCSI_DEF_CTRL_BUS_ID, NONE) == ERROR)
  169.         return (ERROR);
  170.     return (OK);
  171.     }
  172. #endif /* INCLUDE_SCSI */