joost 94a398baf6 * Updated fpmake files to version 2.2.4-0 (including all dependencies) 16 years ago
..
examples 787c6101aa * Updated makefiles to version 2.2.4rc1 16 years ago
src 106e44853a Merged revisions 11017,11032-11033,11042,11044,11046-11047,11053,11060,11062,11064,11067,11075,11078,11080,11085,11089,11094,11096,11098,11103-11104,11106,11108-11109,11111,11114,11117,11122,11124,11126,11130-11131,11133,11136,11139-11141,11146-11147,11152-11154,11157,11159,11166-11167,11170,11173,11178,11181-11182,11184-11185,11187-11189,11195-11196,11199,11206-11209,11214-11215,11223,11225,11227,11232,11235,11239-11240,11249-11256,11258,11260,11264-11265,11271,11278,11280-11282,11286-11288,11292-11294,11297,11299-11300,11302,11304-11311,11313-11316,11318-11319,11324-11326,11328-11333,11335-11336,11339-11340,11346-11347,11349,11362,11369,11371-11375,11393-11396,11401,11411-11414,11420,11422,11427-11428,11465,11469-11470,11487-11488,11490,11518-11521,11523,11528,11535,11551,11553,11555,11557,11562,11564,11571,11588,11616,11619,11621-11622,11628,11664-11667,11669-11670,11673-11675,11679,11681,11683,11685-11686,11689-11692,11694-11696,11698,11701-11702,11705-11707,11712-11718,11723-11726,11728-11729,11733-11737,11747,11778,11780-11781,11785,11800,11810,11822,11831,11836,11848,11865,11872,11876-11878,11881-11883,11889,11891-11896,11899-11902,11920-11925,11931-11932,11935,11938,11941-11942,11986,11990,11992,12010-12011,12014,12018,12026 via svnmerge from 17 years ago
Makefile 787c6101aa * Updated makefiles to version 2.2.4rc1 16 years ago
Makefile.fpc 787c6101aa * Updated makefiles to version 2.2.4rc1 16 years ago
README 38acb34192 Merged revisions 9692,9694-9695,9697-9714,9720,9722,9729,9732-9733,9740,9745,9749-9750,9753-9757,9760-9766,9768-9770,9772-9774,9783,9786,9788,9814,9822,9825,9837-9850,9852,9855-9856,9863-9864,9867,9882,9891-9892,9897,9899-9900,9902-9904,9907-9911,9913,9915,9917,9920,9922-9937,9939-9974,9976-10005,10007-10012,10014-10046,10049-10051,10053-10067,10069-10071,10074,10079,10082,10084-10086,10091,10099-10100,10102-10103,10113-10114,10129-10130,10136 via svnmerge from 17 years ago
fpmake.pp 94a398baf6 * Updated fpmake files to version 2.2.4-0 (including all dependencies) 16 years ago

README

This directory contains some CD-ROM support routines for Free Pascal.

The routines are demonstrated by the 'getdiscid' and 'showcds' programs.
The latter shows the available CD-rom drives on the system, the former
calculates a disc-id and query for use with a freecddb server.

Unit cdrom
----------

The unit 'cdrom' implements a cross-platform interface for handling CD-roms.
Currently, it is implemented for Linux and Windows only.
The other units are support units, needed by various implementations.

The unit presents 2 calls:

Type
TTocEntry = Record
min, sec, frame : Integer
end;
PTocEntry = ^TTocEntry;

Function GetCDRomDevices(Var Devices : Array of string) : Integer;
Function ReadCDTOC(Device : String; Var CDTOC : Array of TTocEntry) : Integer;

The GetCDRomDevices call retrieves a list of available CD-ROM devices/drives
on the system. The algorithm used to detect these devices depends on the
system. The function returns the number of devices found, or a negative
number on error. The 'Devices' array is filled with strings that describe
the devices. For unix like systems, these are the device files (/dev/hdc
etc), for windows, these can be drive letters (D: etc) or ASPI Adaptor,
Target, lun IDs triples, for example ASPI[1;0;0].

(an algorithm mapping these to drive letters would be appreciated)

The ReadCDTOC call retrieves the table of contents of a CD in the CD-rom
drive (Device) This returns the number of tracks on the CD-ROM. On return,
The CDTOC array will be filled with the length of the tracks, and the frame
number, manipulated to be usable in a disc ID calculation. There will be one
extra entry at the end of the array, describing the lead-out.

unit discid
-----------

The DISCID unit calculates a DISC-ID as needed by a freecddb server to
query for the contents of a disc.

Function CDDBDiscID(Const CDTOC : Array of TTocEntry; Count : Integer) : integer ;

The count is the number of tracks, the array should contain Count+1
elements, the last one being the lead out. The output of the ReadCDToc
function can be used as input for this function.

Function GetCDDBQueryString(Const Tracks : Array of TTocEntry; Count : Integer) : String;

This function returns a query string as expected by a freecddb server.
It consists of the disc id, number of tracks, and the frame fields of the
TCDToc records in the tracks array.

unit lincd
----------

Essentially translation of the linux/cdrom.h include file, plus 2 functions

Function IsCDDevice(Device : String) : Boolean;

Returns True if the device file is a cdrom.

Function DetectCd : String;

Detects the first cd in the system; it does this by checking a number of
well-known common device files; the first once for which IsCDDevice returns
True is returned. Note that this can take some time.

unit major
----------

Definitions of the major device numbers under linux. used by the lincd unit.

unit wincd
----------
Some CD-routines. Essentially the low-level counterpart of the cd-rom unit.
The unit tries to use the windows ASPI layer to detect cd-roms. If the layer
is not present, the common IOCTL or SPTI interfaces are used.

TCDAccessMethod = (camNone,camASPI,camSPTI,camIOCTL);

Determines which access method is used.

Records used in the low-level calls:

TTOCTrack = packed record
rsvd,
ADR,
trackNumber,
rsvd2 : Byte;
addr : Array[0..3] of byte;
end;

TTOC = packed Record
toclen : word;
firsttrack,
lastTrack : byte;
toctrack: Array[0..99] of TTocTrack;
end;

Const
AccessMethodNames : Array[TCDAccessMethod] of string
= ('None','ASPI','SPTI','IOCTL');

Function GetCDAccessMethod : TCDAccessMethod;

Returns the current CD-rom detection method.

Procedure SetCDAccessMethod (Value : TCDAccessMethod);

Sets the current CD-rom detection method.

Function ReadTOC(Device : String; Var TOC : TTOc) : Integer;

Reads the CD-Rom devices. Device is a drive letter, or if ASPI is used
a string of the form [Aid,TgID,LunID] (Adapter ID, Target ID, LUN id)

Function EnumCDDrives(Var Drives : Array of String) : Integer;

Returns the CD-ROM drive letters of the system, or strings describing ASPI
drives.

Function GetNumDrives : Integer;

Returns the number of drives.

NOTE: A function mapping an ASPI triple to a drive letter would be
appreciated.

unit Wnaspi32:
--------------

Low-level ASPI unit. Contains all structures, plus the following:

TSendASPI32Command = function( LPSRB : Pointer ) : DWORD; cdecl;
TGetASPI32SupportInfo = function : DWORD; cdecl;

SendASPI32Command : TSendASPI32Command = nil;
GetASPI32SupportInfo : TGetASPI32SupportInfo = nil;

These procedural variables map to the actual API calls. They are only valid
and usable if ASPILoaded returns TRUE.

Function ASPILoaded : Boolean;

Returns TRUE if ASPI is available and loaded.

Procedure CheckASPI;

Checks whether ASPI is available. After calling this it is possible to use
the ASPIAvailable function. This procedure is called in the initialization
section of the unit.

procedure UnloadASPI;

Unloads the ASPI library if it was loaded. This procedure is called in the
finalization section of the unit.

scsidefs.pp
-----------

Bare translation of the scsidefs.h windows SDK header.

cdromioctl.pp
-------------

This unit contains some records and constants defined in window's
cdromioctl.h


Michael.