DIRECTORY Device USING [Type]; FloppyChannel: DEFINITIONS = BEGIN Handle: TYPE [2]; nullHandle: READONLY Handle; Density: TYPE = {single, double}; Drive: TYPE = CARDINAL; Format: TYPE = {IBM, Troy}; HeadCount: TYPE = [0..256); SectorCount: TYPE = [0..256); Attributes: TYPE = RECORD [ deviceType: Device.Type, numberOfCylinders: CARDINAL, numberOfHeads: HeadCount, maxSectorsPerTrack: SectorCount, formatLength: CARDINAL, ready: BOOLEAN, diskChange: BOOLEAN, twoSided: BOOLEAN]; Context: TYPE = RECORD [ protect: BOOLEAN, format: Format, density: Density, sectorLength: CARDINAL [0..1024)]; DiskAddress: TYPE = MACHINE DEPENDENT RECORD [ cylinder (0): CARDINAL, head (1: 0..7): HeadCount, sector (1: 8..15): SectorCount]; Status: TYPE = MACHINE DEPENDENT { goodCompletion, diskChange, notReady, cylinderError, deletedData, recordNotFound, headerError, dataError, dataLost, writeFault, otherError (LAST[CARDINAL])}; --reserve 16 bits for expansion Error: ERROR [type: ErrorType]; ErrorType: TYPE = {invalidDrive, invalidHandle}; GetNextDrive: PROCEDURE [lastDrive: Drive] RETURNS [nextDrive: Drive]; nullDrive: Drive = LAST[CARDINAL]; GetHandle: PROCEDURE [drive: Drive] RETURNS [handle: Handle]; InterpretHandle: PROCEDURE [handle: Handle] RETURNS [drive: Drive]; ReadSectors: PROCEDURE [handle: Handle, address: DiskAddress, buffer: LONG POINTER, count: CARDINAL _ 1, incrementDataPtr: BOOLEAN _ TRUE] RETURNS [status: Status, countDone: CARDINAL]; WriteSectors: PROCEDURE [handle: Handle, address: DiskAddress, buffer: LONG POINTER, count: CARDINAL _ 1, incrementDataPtr: BOOLEAN _ TRUE] RETURNS [status: Status, countDone: CARDINAL]; WriteDeletedSectors: PROCEDURE [handle: Handle, address: DiskAddress, buffer: LONG POINTER, count: CARDINAL _ 1, incrementDataPtr: BOOLEAN _ TRUE] RETURNS [status: Status, countDone: CARDINAL]; ReadID: PROCEDURE [handle: Handle, address: DiskAddress, buffer: LONG POINTER] RETURNS [status: Status]; Nop: PROCEDURE [handle: Handle] RETURNS [status: Status]; GetContext: PROCEDURE [handle: Handle] RETURNS [context: Context]; GetDeviceAttributes: PROCEDURE [handle: Handle] RETURNS [attributes: Attributes]; SetContext: PROCEDURE [handle: Handle, context: Context] RETURNS [ok: BOOLEAN]; FormatTracks: PROCEDURE [handle: FloppyChannel.Handle, start: FloppyChannel.DiskAddress, trackCount: CARDINAL] RETURNS[status: FloppyChannel.Status, countDone: CARDINAL]; END... 2FloppyChannel.mesa Copyright Σ 1981, 1982, 1985, 1987 by Xerox Corporation. All rights reserved. Tim Diebert: May 7, 1987 9:27:03 am PDT Basic serial read/write access to a floppy disk drive. TYPES Indicates what type of drive is connected to the controller. Number of cylinders available for recording on the drive connected to the controller. Number of read/write heads available for recording on the drive connected to the controller. Maximum number of sectors per track (based on context setting) Length in words of the buffer that the client must supply in order to format a track. Whether drive is ready (contains a diskette) Whether drive has gone from ready to not-ready (door open), or from not-ready to ready, one or more times since the last operation was performed. (If ready=TRUE) Whether diskette currently installed has data on both sides Software write protect available to the client. The actual write protect status is a logical OR of this variable and the physical signal being returned from the drive. Client's selection of the format type; either an IBM compatible format (which includes STAR), or the Xerox 850 (Troy) format. Selection of either FM (single density) or MFM (double density) recording. This is an available selection when formatting a new diskette. When accessng a previously recorded diskette, the client must provide the correct setting. Length in words of the sectors on the current track. The value must come from a valid set defined as {64, 128, 256, 512} for IBM format and {1022} for Troy format. must be IN [0..numberOfCylinders) must be IN [0..numberOfHeads) must be IN [1..{value depends on sectorLength}] operation has completed normally The disk drive has apparently gone from ready to not-ready (door open), or from not-ready to ready, one or more times since the last operation was performed. drive is not ready can't locate specified cylinder The sector contained a deleted data address mark. can't find record for specified disk address bad checksum in header bad checksum in data sector contained more data than expected (from context) disk is write-protected (hardware or from context) unexpected software or hardware problem ERRORS PROCEDURES The following procedures are used to gain access to a drive. Stateless enumerator of the drives on a system element. Begins with lastDrive equal to nullDrive and ends when nextDrive is returnsed as nullDrive. Gets a Handle for a drive. A handle is only valid for as long as the drive does not change state (i.e., go from ready to not-ready). Given a handle, returns the identity of the drive referred to by that drive. The following six drive-access procedures include seek, error retry, and wait for completion or error. Operations in a single call may not cross over from an IBM-format track 0 to the rest of the diskette; no check is made for this. Reads the specified number of sectors from the diskette beginning at the specified disk address. Writes the specified number of sectors with data address marks to the diskette beginning at the specified disk address. Writes the specified number of sectors with deleted data address marks to the diskette beginning at the specified disk address. Reads to first encountered record ID from the specified disk address. The value of sector in the disk address is ignored. Does a regular drive-access operation without data transfer and returns a valid status. Returns the current settings of the context. Returns attributes as defined above. Sets context as defined above and returns a BOOLEAN indicating whether the settings were accepted. Formats the specified tracks. ΚS˜codešœ™KšœO™OK™'—K˜šΟk ˜ Kšœœ˜—K˜KšΠln œ œ˜"˜Kšœ6™6K˜Kšœ™—˜Kšœœ˜Kšœ œ˜K˜Kšœ œ˜"K˜Kšœœœ˜K˜Kšœœœ˜K˜Kšœ œ ˜K˜Kšœ œ ˜—˜šœ œœ˜˜Kšœ<™<—šœœ˜KšœU™U—˜KšœP™PKšœ ™ —˜ Kšœ>™>—šœœ˜KšœU™U—šœœ˜Kšœ,™,—šœ œ˜Kšœ.™.KšœI™IKšœ™—šœ œ˜KšœK™KK˜——šœ œœ˜šœ œ˜KšœP™PKšœP™PKšœ™—˜KšœM™MKšœ/™/—˜KšœO™OKšœI™IKšœJ™J—šœœ ˜"KšœM™MKšœM™MKšœ™———˜š œ œœ œœ˜.šœœ˜Kšœ"™"—˜Kšœ™—˜ Kšœ/™/———˜šœœœ œ˜"˜Kšœ ™ —˜ Kšœ:™:KšœI™IKšœ™—˜ Kšœ™—˜Kšœ™—˜ Kšœ1™1—˜Kšœ,™,—˜ Kšœ™—˜ Kšœ™—˜ Kšœ7™7—˜ Kšœ2™2—šœ œœΟc˜=Kšœ'™'———˜Kšœ™K˜KšΟnœœ˜Kšœ œ!˜0K˜Kšœ ™ K˜Kšœ<™