home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cdrom.zip / DDK / BASE / SRC / DEV / DASD / CDROM / OS2CDROM / cddata.c < prev    next >
C/C++ Source or Header  |  1996-06-18  |  6KB  |  145 lines

  1. /**************************************************************************
  2.  *
  3.  * SOURCE FILE NAME = CDDATA.C
  4.  *
  5.  * DESCRIPTIVE NAME = Static/Initialization data for CD-ROM Device Mgr
  6.  *
  7.  * Copyright : COPYRIGHT IBM CORPORATION, 1991, 1992
  8.  *             LICENSED MATERIAL - PROGRAM PROPERTY OF IBM
  9.  *             REFER TO COPYRIGHT INSTRUCTION FORM#G120-2083
  10.  *             RESTRICTED MATERIALS OF IBM
  11.  *             IBM CONFIDENTIAL
  12.  *
  13.  * VERSION = V2.0
  14.  *
  15.  * DATE
  16.  *
  17.  * DESCRIPTION
  18.  *
  19.  *
  20.  * FUNCTIONS
  21.  *
  22.  * ENTRY POINTS:
  23.  *
  24.  * DEPENDENCIES:
  25.  *
  26.  * NOTES
  27.  *
  28.  *
  29.  * STRUCTURES
  30.  *
  31.  * EXTERNAL REFERENCES
  32.  *
  33.  * EXTERNAL FUNCTIONS
  34.  *
  35.  * CHANGE ACTIVITY =
  36.  *  DATE      FLAG        APAR   CHANGE DESCRIPTION
  37.  *  --------  ----------  -----  --------------------------------------
  38.  *  mm/dd/yy  @Vr.mpppxx  xxxxx  xxxxxxx
  39.  ****************************************************************************/
  40.  
  41. #define INCL_NOBASEAPI
  42. #define INCL_NOPMAPI
  43. #define INCL_ERROR_H
  44.  
  45. #include "os2.h"
  46. #include "misc.h"
  47. #include "cddefs.h"
  48. #include "strat2.h"
  49. #include "reqpkt.h"
  50. #include "iorb.h"
  51. #include "scsi.h"
  52. #include "cdbscsi.h"
  53. #include "cdgencb.h"
  54.  
  55. /*
  56. **  GLOBAL DATA
  57. **  -----------
  58. **  1. Static data
  59. **  2. Dynamic data allocated at init time:
  60. **     - UnitCB
  61. **  3. Dynamic data allocated at run time:
  62. **     - IORB
  63. **  4. Static init data discarded after init time
  64. */
  65.  
  66. #define MAXADAPTERDRIVERS       32         /* Max adapter device drivers     */
  67.  
  68.  
  69. PFN             Device_Help=0L;            /* far ptr to devhelp function    */
  70. PBYTE           pSysInfoSeg=0L;            /* Pointer to sys info seg        */
  71. PVOID           pDataSeg=0L;               /* virt ptr of our data segment   */
  72. ULONG           ppDataSeg=0L;              /* phys addr of our data segment  */
  73. ULONG           plDataSeg=0L;              /* linear addr of our data seg    */
  74. USHORT          ScratchBufSem=0;           /* Semaphore for ScratchBuffer    */
  75. USHORT          CDFlags=0;                 /* Global driver flags            */
  76.  
  77. NPUNITCB        UnitCB_Head=0;             /* near ptr to first UnitCB       */
  78.  
  79. NPBYTE          pNextFreeCB=0;             /* ptr to next free control blk   */
  80.  
  81. USHORT          NumDrivers=0;              /* number of adapter drivers      */
  82. USHORT          NumUnitCBs=0;              /* number of unit control blocks  */
  83. USHORT          NumCDROMDrives=0;          /* number of CD-ROM drives        */
  84. USHORT          FirstDriveNumber=0;        /* First CD-ROM drive number      */
  85. USHORT          NumAdapters=0;             /* number of adapters             */
  86. USHORT          CD_NumReqsInProgress=0;    /* num requests in progress       */
  87. USHORT          CD_NumReqsWaiting=0;       /* num requests on waiting queues */
  88. USHORT          TraceFlags=0;              /* Trace Flags                    */
  89. NPBYTE          pCDTraceBuf=0;             /* pointer to internal trace buffer*/
  90. NPBYTE          pCDTraceHead=0;            /* pointer to head of trace buffer */
  91. NPBYTE          pCDTraceEnd=0;             /* pointer to end of trace buffer */
  92.  
  93. NPBYTE          CB_FreeList=0;             /* Control Block Free List for    */
  94.                                            /*  IORBs and CWAs                */
  95.  
  96. USHORT          PoolSem=0;                 /* Pool semaphore                 */
  97. USHORT          PoolSize=0;                /* Size of control block pool     */
  98. USHORT          FreePoolSpace=0;           /* Free space left in pool        */
  99. USHORT          CodeBreakAddress=0;        /* end of code segment address    */
  100. USHORT          DataBreakAddress=0;        /* end of data segment address    */
  101.  
  102. NPBPB InitBPBArray[MAX_DRIVE_LETTERS]={0}; /*BPB array returned in INIT packet*/
  103.  
  104. BPB  DefaultBPB = {2048, 1, 0, 0, 0, 0, 0xF0, 0, 0xFFFF, 1, 0, 270000L, 0};
  105.  
  106. UCHAR  volume_id_string[] = "CD001";
  107.  
  108. /*
  109. ** Default CDB Passthru IORB
  110. */
  111. IORB_CDB  default_iorb_cdb = {
  112.  
  113.    sizeof(IORB_ADAPTER_PASSTHRU),            /* IORB Length                */
  114.    0,                                        /* Unit Identifier            */
  115.    IOCC_ADAPTER_PASSTHRU,                    /* Command Code               */
  116.    IOCM_EXECUTE_CDB,                         /* Command Modifier           */
  117.    IORB_ASYNC_POST + IORB_REQ_STATUSBLOCK,   /* Request Control Flags      */
  118.    0,                                        /* Status                     */
  119.    0,                                        /* Error Code                 */
  120.    0,                                        /* Cmd completion timeout (s) */
  121.    sizeof(SCSI_STATUS_BLOCK),                /* Status block length        */
  122.    0,                                        /* Status block               */
  123.    0,                                        /* Reserved, MBZ              */
  124.    0,                                        /* Pointer to next IORB       */
  125.    0,                                        /* Notification Address       */
  126.    0,                                        /* For use by DM              */
  127.    0,                                        /* For use by ADD             */
  128.  
  129.    1,                                        /* Count of S/G list elements */
  130.    0,                                        /* far ptr to S/G List        */
  131.    0,                                        /* physical addr of S/G List  */
  132.    0,                                        /* Length of CDB              */
  133.    0,                                        /* Pointer to CDB             */
  134.    0,                                        /* phys ptr to SCB            */
  135.    0                                         /* Flags                      */
  136. };
  137.  
  138. /*
  139. **  UnitCBs are allocated after all static data
  140. */
  141. UNITCB          FirstUnitCB[1]={0};     /* First UnitCB allocated here       */
  142.  
  143. USHORT          CBPool[24*KB]={0};      /* Pool for Control blocks           */
  144.  
  145.