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
/
cdnec.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-18
|
5KB
|
129 lines
/*static char *SCCSID = "@(#)cdnec.c 6.17 92/05/04";*/
#define SCCSID "@(#)cdnec.c 6.17 92/05/04"
/************************************************************************/
/* */
/* Driver Name: OS2CDROM.DMD - OS/2 CD-ROM Device Manager */
/* ----------------------------------------- */
/* */
/* Source File Name: CDNEC.C */
/* */
/* Descriptive Name: Vendor unique command processing for NEC */
/* SCSI-2 CD-ROM Drives */
/* */
/* Function: */
/* */
/* */
/*----------------------------------------------------------------------*/
/* */
/* Copyright (C) 1992 IBM Corporation */
/* */
/* DISCLAIMER OF WARRANTIES. The following [enclosed] code is */
/* provided to you solely for the purpose of assisting you in */
/* the development of your applications. The code is provided */
/* "AS IS", without warranty of any kind. IBM shall not be liable */
/* for any damages arising out of your use of this code, even if */
/* they have been advised of the possibility of such damages. */
/* */
/*----------------------------------------------------------------------*/
/* */
/* Change Log */
/* */
/* Mark Date Programmer Comment */
/* ---- ---- ---------- ------- */
/* @nnnn mm/dd/yy NNN */
/* */
/* */
/************************************************************************/
#include "cdh.h"
#include "necdb.h"
/*------------------------------------------------------------------------
;
;** NEC_GetLastSessionAddr - Get address of last session on multisession
; disk
;
; This routine returns the address of the last session of a multisession
; photo CD disk.
;
; USHORT NEC_GetLastSessionAddr(NPUNITCB pUnitCB, ULONG FAR * session_addr)
;
; ENTRY: pUnitCB - Pointer to UnitCB
; session_addr - Pointer to returned session addr
;
; RETURN: USHORT - Packet status word
;
; if the STERR bit is on, then the disk
; is not a multisession disk and the
; session_addr field is not valid
;
; if the STERR bit is NOT set, then the
; disk is a multi-session disk and the
; session addr field is valid
;
;
; EFFECTS:
;
------------------------------------------------------------------------*/
USHORT NEC_GetLastSessionAddr (pUnitCB, session_addr)
NPUNITCB pUnitCB;
ULONG FAR *session_addr;
{
USHORT rc;
NPIORB_CDB pIORB;
NEC_DATA_PointInfo NEAR *pCDBData;
union AddressType ul_LBA;
ULONG LBA;
NEC_BuildCDB_GetLastSession (pUnitCB, (NPIORB_CDB FAR *) &pIORB);
pCDBData = (NEC_DATA_PointInfo NEAR *) pIORB->CDB_data;
rc = SubmitIORB_Wait(pUnitCB, pIORB);
if (rc == STDON)
{
rc = STDON + STERR;
/* If type photo CD in both point entries, and address of last */
/* session not zero, then multisession disc. */
if ( (pCDBData->point_data[0].control == NEC_PHOTO_CD) &&
(pCDBData->point_data[1].control == NEC_PHOTO_CD) )
{
if ( (pCDBData->point_data[1].imin != 0) ||
(pCDBData->point_data[1].isec != 0) ||
(pCDBData->point_data[1].iframe != 0) )
{
ul_LBA.ul_redbook.frame =
BCDtoBinary(pCDBData->point_data[1].iframe);
ul_LBA.ul_redbook.sec =
BCDtoBinary(pCDBData->point_data[1].isec);
ul_LBA.ul_redbook.min =
BCDtoBinary(pCDBData->point_data[1].imin);
ul_LBA.ul_redbook.zero = 0;
LBA = (RedBookToHSG (ul_LBA.dword) ) + 150;
*session_addr = LBA;
rc = STDON;
}
}
}
FreeIORB (pUnitCB, pIORB);
return (rc);
}