home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cdrom.zip / DDK / BASE / SRC / DEV / DASD / CDROM / ATAPI / atapips2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-10  |  4.4 KB  |  176 lines

  1. /*static char *SCCSID = "src/dev/dasd/ibm/ibm1s506/s506ps2.c, idsk, r207, 8.005p 93/03/18";*/
  2. /**************************************************************************
  3.  *
  4.  * SOURCE FILE NAME =  S506PS2.C
  5.  *
  6.  * DESCRIPTIVE NAME = IBM1S506.ADD - Adapter Driver for ST506/IDE DASD
  7.  *
  8.  *
  9.  * Copyright : COPYRIGHT IBM CORPORATION, 1991, 1992
  10.  *             LICENSED MATERIAL - PROGRAM PROPERTY OF IBM
  11.  *             REFER TO COPYRIGHT INSTRUCTION FORM#G120-2083
  12.  *             RESTRICTED MATERIALS OF IBM
  13.  *             IBM CONFIDENTIAL
  14.  *
  15.  * VERSION = V2.0
  16.  *
  17.  * DATE
  18.  *
  19.  * DESCRIPTION : Adapter Driver PS/2 IDE Port routines.
  20.  *
  21.  * Purpose:
  22.  *
  23.  *
  24.  *
  25.  *
  26.  *
  27.  * CHANGE ACTIVITY =
  28.  *   DATE      FLAG        APAR   CHANGE DESCRIPTION
  29.  *   --------  ----------  -----  --------------------------------------
  30.  *   mm/dd/yy  @Vnnnnn     XXXXX  XXXXXXX
  31.  *
  32.  ****************************************************************************/
  33.  
  34.  #define INCL_NOBASEAPI
  35.  #define INCL_NOPMAPI
  36.  #define INCL_NO_SCB
  37.  #define INCL_INITRP_ONLY
  38.  #define INCL_DOSERRORS
  39.  #include "os2.h"
  40.  #include "dos.h"
  41.  #include "bseerr.h"
  42.  #include "dskinit.h"
  43.  #include <scb.h>
  44.  #include <abios.h>
  45.  
  46.  #include "iorb.h"
  47.  #include "reqpkt.h"
  48.  #include "dhcalls.h"
  49.  #include "addcalls.h"
  50.  
  51.  #include "atapips2.h"
  52.  #include "atapicon.h"
  53.  #include "atapityp.h"
  54.  #include "atapiext.h"
  55.  #include "atapipro.h"
  56.  
  57. ///*------------------------------------*/
  58. ///*                                    */
  59. ///* SetPS2DiskLight                    */
  60. ///* ---------------                    */
  61. ///*                                    */
  62. ///*                                    */
  63. ///*------------------------------------*/
  64. //VOID NEAR SetPS2DiskLight( USHORT On )
  65. //{
  66. //  USHORT        Data;
  67. //
  68. //  LightCount += (( On ) ? 1 : -1 );
  69. //
  70. //  if ( (LightState == 0) != (LightCount == 0) )
  71. //  {
  72. //    DISABLE
  73. //
  74. //    LightState = (LightCount != 0);
  75. //
  76. //    inp( PS2_CTRL_PORT_A, Data )
  77. //    IODelay();
  78. //
  79. //    if ( LightState )
  80. //    {
  81. //      Data |= PS2_FIXED_DISK_LIGHT;
  82. //    }
  83. //    else
  84. //    {
  85. //      Data &= ~PS2_FIXED_DISK_LIGHT;
  86. //    }
  87. //    outp( PS2_CTRL_PORT_A, Data );
  88. //    IODelay();
  89. //
  90. //
  91. //    ENABLE
  92. //  }
  93. //}
  94.  
  95. /*------------------------------------*/
  96. /*                                    */
  97. /* SetupPS2IDEPort                    */
  98. /* ---------------                    */
  99. /*                                    */
  100. /*                                    */
  101. /*------------------------------------*/
  102.  
  103. VOID NEAR SetupPS2IDEPort( USHORT Enable )
  104. {
  105.   USHORT        Data;
  106.   USHORT        PS2_Setup_Reg;
  107.   USHORT        PS2_Planar_Pos;
  108.  
  109.   DISABLE
  110.  
  111.   /*--------------------------*/
  112.   /* Enable Planar Setup Mode */
  113.   /*--------------------------*/
  114.   inp( PS2_SETUP_REG, PS2_Setup_Reg );
  115.   IODelay();
  116.  
  117.   Data = ~PS2_DISABLE_PLANAR_SETUP;
  118.  
  119.   outp( PS2_SETUP_REG, Data );
  120.   IODelay();
  121.  
  122.   /*---------------------------------*/
  123.   /* Enable Fixed Disk POS Reg (103) */
  124.   /*---------------------------------*/
  125.   inp( PS2_PLANAR_POS_REG, PS2_Planar_Pos );
  126.   IODelay();
  127.  
  128.   PS2_Planar_Pos |= ENABLE_FIXED_POS;
  129.  
  130.   outp( PS2_PLANAR_POS_REG, PS2_Planar_Pos );
  131.   IODelay();
  132.  
  133.   /*-------------------------------------------------*/
  134.   /* Enable/Disable Integrated Fixed Disk Controller */
  135.   /*-------------------------------------------------*/
  136.   inp( PS2_FIXED_POS_REG, Data );
  137.   IODelay();
  138.  
  139.   /*-----------------------------------------------*/
  140.   /* Our engineers cant seem to figure out how     */
  141.   /* to share bits in 3F6/3F7 between the diskette */
  142.   /* and IDE controllers!                          */
  143.   /*-----------------------------------------------*/
  144.  
  145.   if ( Enable )
  146.   {
  147.     Data |= (ENABLE_FIXED_DRIVE | REG_3F7_TO_DSKT);
  148.     Data &= ~REG_3F6_TO_DSKT;
  149.   }
  150.   else
  151.   {
  152.     Data &= ~ENABLE_FIXED_DRIVE;
  153.  
  154.     /*--------------------------------------------------*/
  155.     /* Setting the 3F6/3F7 control bits on a Mod 30-286 */
  156.     /* causes the machine to reboot!                    */
  157.     /*--------------------------------------------------*/
  158.     if ( MachineID != MCHID_30286 )
  159.     {
  160.       Data |= (REG_3F6_TO_DSKT | REG_3F7_TO_DSKT);
  161.     }
  162.   }
  163.  
  164.   outp( PS2_FIXED_POS_REG, Data );
  165.   IODelay();
  166.  
  167.   /*---------------------------------------*/
  168.   /* Restore original Planar setup reg (94)*/
  169.   /*---------------------------------------*/
  170.   outp( PS2_SETUP_REG, PS2_Setup_Reg )
  171.   IODelay();
  172.  
  173.   ENABLE
  174. }
  175.  
  176.