WikiPendium

(beta)

FdcCommands

WikiPendium :: RecentChanges :: RecentlyCommented :: UserSettings :: You are ec2-3-12-150-250.us-east-2.compute.amazonaws.com

FDC Commands


FDC commands are bytes, that are written in the Command Register (available when AA=00). Commands can be written only when no other one is being executed. 11 commands of 4 types are available, and each of them takes parameters into specific bits as follows:

Type Command Command byte details Action performed by the FloppyDrive
1 Restore 0 0 0 0 H V R R Look for the very first track of the disk.
1 Seek 0 0 0 1 H V R R Look for a specific track (target track must be first specified in the FDC Data Register).
1 Step 0 0 1 U H V R R Move the head one step towards the same way (in or out) as the last Step command executed.
1 Step In 0 1 0 U H V R R Move the head one step in (towards the center of the disk) to the next track.
1 Step Out 0 1 1 U H V R R Move the head one step outwards (away from the center of the disk) to the previous track.
2 Read Sector 1 0 0 M H E 0 0 Read one sector (or multiple sectors) from disk
2 Write Sector 1 0 1 M H E P A Write one sector (or multiple sectors) to disk
3 Read Address 1 1 0 0 H E 0 0 Read one ID
3 Read Track 1 1 1 0 H E 0 0 Read one full track from disk
3 Write Track 1 1 1 1 H E P 0 Write one full track to disk
4 Force Interrupt 1 1 0 1 I I I I Launch an interrupt



Type 1 commands: Restore, Seek, Step, Step In & Step Out


These commands are used to move the head before reading or writing data on disk. Before launching any Seek command, the target track to reach has to be written in the Data Register.

Parameters

The target track of the Seek command has to be written in the FDC Data Register.
Bits of the command byte have the folowing meaning:

Bit Meaning
#0 & #1: RR Seek Rate (time between two impulse). See below for details.
#2: V Verify Flag. If V=1 the track number is compared with the ID written on disk after every move.
#3: H Wait for the Spin Up sequence. If H=1, the Spin Up sequence is respected even if the motor is already on (the Spin Up sequence waits for 6 full rotations of the disk to be achieved, which is about 1 second).
#4 U Update the Track Register when moving the head. If U=0, the Track Register is not updated.

Values for the Seek Rate bits are detailed below:

Value Step time value
RR=00 2 milliseconds
RR=01 3 milliseconds
RR=10 5 milliseconds
RR=11 6 milliseconds



Type 2 commands: Read Sector & Write Sector


These commands give read or write access to the sectors of the disk.

Parameters

When the M bit is set to 1, the first sector to be accessed (i.e. to be read or written) must have been specified in the FDC Sector Register. The number of sectors to be read can't be specified, and sectors are accessed (read or written) until the end of the track, unless an interrupt is raised with the Force Interrupt command (see below). When the end of the track is reached, an Record Not Found error is specified in the FdcStatus Register (bit #4).

Bit Meaning
#0: A Choose Data Address Mark type to be written. These can be normal or nul.
#1: P Pre-compensation. Usefull to insure more secure data write on inner tracks of the disk.
#2: E Wait for potential oscillations of the mechanics to stop. If E=1, 30 milliseconds are waited before the command is started, otherwise the command starts immediately.
#3: H If H=1, the Spin Up sequence is respected even if motor is already on.
#4: M Multiple read or write. If M=0, only one sector is read (or written, depending on the command) at once. If M=1, multiple sectors will be read (or written) until the end of the track (unless interrupted by the user, see the Force Interrupt command below) and the Sector Register will be updated.



Type 3 commands: Read Address, Read Track & Write Track


The Read Address command reads a 6-byte ID field. Every sector has an ID field. It specifies its track number, disk side, sector number, sector size and two CRCs.
The Read Track command reads a whole track, including specific data that is usually written between sectors when the disk is formated.
The Write Track command is usefull to format a disk, i.e. initialize it so that data can be stored and retreived afterwards.

Parameters

The meaning of parameters are the same as for type 2 FDC commands:

#1: P Pre-compensation. See Above for details.
#2: E Wait for potential oscillations of the mechanics to stop. See above for details.
#3: H Force respect of the Spin Up sequence. See above for details.

Returned ID structure


Byte Contents
#1 Track number
#2 Side number
#3 Sector number
#4 Sector size
#5 CRC byte #1
#6 CRC byte #2

Caveats

Be warned that the DMA only writes 16 bytes data at once. If less than 16 bytes are read from disk, they stay in the DMA chip until enough data is read to fill the 16 bytes buffer. Thus, you have to read at least 3 IDs (18 bytes) before the DMA writes anything into memory. When actually reading 3 IDs, only the first 16 bytes will be written into memory, and 2 bytes are kept in the DMA chip. You have to read at least 8 IDs to get all the data out of the DMA buffer into memory.



Type 4 command: Force Interrupt


The Force Interrupt command is used to launch interrupts on various conditions.

Parameters

The four IIII bits specify the conditions that lead to the FDC/DMA interrupt to be raised. The two lower bits have no signification for the WD 1772, so they should be cleared to 0.

Value Meaning
IIII=0100 Raise the FDC/DMA interrupt on each index impulse. This can be usefull to calculate the speed of the motor.
IIII=1000 Raise the FDC/DMA interrupt immediately. Any currently running command is stopped.
IIII=0000 Stop any currently running command. No interrupt is launched.

Comments

The FDC/DMA interrupt is the 8th interrupt (out of 16) controled by the MFP?. Its bit is #5 in GPIP 0x00FFFA01. The interrupt vector is thus usually located at 0x0000011C but this address may vary, depending on the VR? register value at 0x00FFFA17. As all MFP? interrupts, the FDC/DMA interrupt routine is executed in IPL? 6 priority level.

Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]