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 / cdchinon.c < prev    next >
C/C++ Source or Header  |  1996-06-18  |  5KB  |  117 lines

  1. /*static char *SCCSID = "@(#)cdchinon.c  6.17 92/05/04";*/
  2. #define SCCSID  "@(#)cdchinon.c  6.17 92/05/04"
  3.  
  4. /************************************************************************/
  5. /*                                                                      */
  6. /* Driver Name: OS2CDROM.DMD - OS/2 CD-ROM Device Manager               */
  7. /*              -----------------------------------------               */
  8. /*                                                                      */
  9. /* Source File Name: CDCHINON.C                                         */
  10. /*                                                                      */
  11. /* Descriptive Name: Vendor unique command processing for Chinon        */
  12. /*                   SCSI-2 CD-ROM Drives                               */
  13. /*                                                                      */
  14. /* Function:                                                            */
  15. /*                                                                      */
  16. /*                                                                      */
  17. /*----------------------------------------------------------------------*/
  18. /*                                                                      */
  19. /* Copyright (C) 1992 IBM Corporation                                   */
  20. /*                                                                      */
  21. /* DISCLAIMER OF WARRANTIES.  The following [enclosed] code is          */
  22. /* provided to you solely for the purpose of assisting you in           */
  23. /* the development of your applications. The code is provided           */
  24. /* "AS IS", without warranty of any kind. IBM shall not be liable       */
  25. /* for any damages arising out of your use of this code, even if        */
  26. /* they have been advised of the possibility of such damages.           */
  27. /*                                                                      */
  28. /*----------------------------------------------------------------------*/
  29. /*                                                                      */
  30. /* Change Log                                                           */
  31. /*                                                                      */
  32. /* Mark    Date      Programmer  Comment                                */
  33. /* ----    ----      ----------  -------                                */
  34. /* @nnnn   mm/dd/yy  NNN                                                */
  35. /*                                                                      */
  36. /*                                                                      */
  37. /************************************************************************/
  38.  
  39. #include "cdh.h"
  40. #include "cdchinon.h"
  41.  
  42.  
  43. /*------------------------------------------------------------------------
  44. ;
  45. ;** Chinon_GetLastSessionAddr - Get address of last session on multisession
  46. ;                               disk
  47. ;
  48. ;   This routine returns the address of the last session of a multisession
  49. ;   photo CD disk.  This routine should only be called is the drive is
  50. ;   a Chinon 535.
  51. ;
  52. ;   USHORT Chinon_GetLastSessionAddr(NPUNITCB pUnitCB, ULONG FAR * session_addr)
  53. ;
  54. ;   ENTRY:    pUnitCB          - Pointer to UnitCB
  55. ;             session_addr     - Pointer to returned session addr
  56. ;
  57. ;   RETURN:   USHORT           - Packet status word
  58. ;
  59. ;                                if the STERR bit is on, then the disk
  60. ;                                  is not a multisession disk and the
  61. ;                                  session_addr field is not valid
  62. ;
  63. ;                                if the STERR bit is NOT set, then the
  64. ;                                  disk is a multi-session disk and the
  65. ;                                  session addr field is valid
  66. ;
  67. ;
  68. ;   EFFECTS:
  69. ;
  70. ------------------------------------------------------------------------*/
  71. USHORT Chinon_GetLastSessionAddr (pUnitCB, session_addr)
  72.  
  73. NPUNITCB pUnitCB;
  74. ULONG    FAR *session_addr;
  75.  
  76. {
  77.    USHORT rc;
  78.    NPIORB_CDB pIORB;
  79.    struct CHINON_LastSessionData NEAR *pCDBData;
  80.    union ULONGB  ul_LBA;
  81.  
  82.    Chinon_BuildCDB_GetLastSession (pUnitCB, (NPIORB_CDB FAR *) &pIORB);
  83.  
  84.    pCDBData = (struct CHINON_LastSessionData NEAR *) pIORB->CDB_data;
  85.  
  86.    rc = SubmitIORB_Wait(pUnitCB, pIORB);
  87.  
  88.    if (rc == STDON)
  89.    {
  90.  
  91.       /* If zero returned in data fields, then not multisession */
  92.  
  93.       if (pCDBData->LBA.dword == 0)
  94.       {
  95.          rc = STDON + STERR;
  96.       }
  97.       else
  98.       {
  99.          ul_LBA.ulbytes.byte_3 =  pCDBData->LBA.ulbytes.byte_0;
  100.          ul_LBA.ulbytes.byte_2 =  pCDBData->LBA.ulbytes.byte_1;
  101.          ul_LBA.ulbytes.byte_1 =  pCDBData->LBA.ulbytes.byte_2;
  102.          ul_LBA.ulbytes.byte_0 =  pCDBData->LBA.ulbytes.byte_3;
  103.  
  104.          *session_addr = ul_LBA.dword;
  105.       }
  106.  
  107.    }
  108.    FreeIORB (pUnitCB, pIORB);
  109.    return (rc);
  110. }
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.