dioscuri.module.ata
Class ATADrive

java.lang.Object
  extended by dioscuri.module.ata.ATADrive

public class ATADrive
extends java.lang.Object

A class representing a ATA drive and parameters.


Field Summary
protected  Atpi atpi
           
protected  boolean containsDisk
           
protected  int currentCylinder
           
protected  int currentHead
           
protected  int currentSector
           
protected  int deviceNum
           
protected  ATADriveType driveType
           
protected  int features
           
protected  int hdNumber
           
protected  int[] idDrive
           
protected  int ioLightCounter
           
protected  boolean isMaster
           
protected  boolean isWriteProtected
           
protected  char[] modelNo
           
protected  int sectorCount
           
protected  int statusbarId
           
protected  int totalNumCylinders
           
protected  int totalNumHeads
           
protected  int totalNumSectors
           
protected  ATATranslationType translationType
           
 
Constructor Summary
ATADrive(ATADriveType theDriveType, ATA parent, boolean enabled)
          Class Constructor with input parameter IDE drive type.
ATADrive(ATADriveType theDriveType, ATA parent, boolean enabled, int cdromCount)
           
 
Method Summary
 int calculateLogicalAddress()
           
 boolean calculateLogicalAddress(int sector)
           
protected  boolean containsDisk()
          Checks the existence of a disk in drive
 void decrementSectorCount()
           
 Atpi getAtpi()
           
 CDROM getCdRom()
           
 ATADriveController getControl()
          Get the control.
 int getCurrentCylinder()
           
 int getCurrentHead()
           
 int getCurrentSector()
           
protected  long getDiskCapacity()
          Get the total capacity of the disk in bytes.
protected  long getDiskImageSize()
          Get size in bytes of the disk image.
protected  ATADriveType getDriveType()
          Get type of drive
 int getFeatures()
           
 int[] getIdDrive()
           
 int getIoLightCounter()
           
 char[] getModelNo()
           
 int getSectorCount()
           
 SenseInfo getSenseInfo()
           
 int getTotalNumCylinders()
           
 int getTotalNumHeads()
           
 int getTotalNumSectors()
           
 ATATranslationType getTranslationType()
           
 void incrementAddress()
           
 void incrementSectorCount()
           
 boolean isMaster()
           
 void loadImage(java.io.File imageFile)
          Load disk image.
 byte[] readData(byte[] diskBuffer, int offset, int totalBytes)
          Reads Data from disk image.
protected  boolean reset()
          Reset drive All geometry parameters for sector selection are reset.
 void setAtpi(Atpi atpi)
           
 void setCdRom(CDROM cdRom)
           
 void setCurrentCylinder(int currentCylinder)
           
 void setCurrentHead(int currentHead)
           
 void setCurrentSector(int currentSector)
           
 void setDiskCapacity(int theTotalNumCylinders, int theTotalNumHeads, int theTotalNumSectors, int theNumSectorsPerBlock)
          Set the disk capacity, by input of the number of cylinders, the number of heads, the number of sectors and the number of sectors per block.
protected  void setDriveType(ATADriveType type)
          Sets type of drive.
 void setFeatures(int features)
           
 void setIdDrive(int index, int idDrive)
           
 void setIoLightCounter(int ioLightCounter)
           
 void setIsMaster(boolean isMaster)
          Sets if the disk is a master (true) or a slave (false).
 void setMaster(boolean isMaster)
           
 void setSectorCount(int sectorCount)
           
 void setTotalNumCylinders(int totalNumCylinders)
           
 void setTotalNumHeads(int totalNumHeads)
           
 void setTranslationType(ATATranslationType translationType)
           
 void setWriteProtected(boolean isProtected)
          Set if the disk is write protected.
 java.lang.String toString()
          Provides the string representation of the class.
 void writeData(byte[] diskBuffer, int offset, int totalBytes)
          Writes data to the disk image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

driveType

protected ATADriveType driveType

hdNumber

protected int hdNumber

idDrive

protected int[] idDrive

modelNo

protected char[] modelNo

currentHead

protected int currentHead

currentCylinder

protected int currentCylinder

currentSector

protected int currentSector

totalNumHeads

protected int totalNumHeads

totalNumCylinders

protected int totalNumCylinders

totalNumSectors

protected int totalNumSectors

sectorCount

protected int sectorCount

isMaster

protected boolean isMaster

containsDisk

protected boolean containsDisk

isWriteProtected

protected boolean isWriteProtected

ioLightCounter

protected int ioLightCounter

statusbarId

protected int statusbarId

features

protected int features

atpi

protected Atpi atpi

translationType

protected ATATranslationType translationType

deviceNum

protected int deviceNum
Constructor Detail

ATADrive

public ATADrive(ATADriveType theDriveType,
                ATA parent,
                boolean enabled)
Class Constructor with input parameter IDE drive type.

Parameters:
theDriveType -
parent -
enabled -

ATADrive

public ATADrive(ATADriveType theDriveType,
                ATA parent,
                boolean enabled,
                int cdromCount)
Parameters:
theDriveType -
parent -
enabled -
cdromCount -
Method Detail

calculateLogicalAddress

public boolean calculateLogicalAddress(int sector)
Parameters:
sector -
Returns:
-

calculateLogicalAddress

public int calculateLogicalAddress()
Returns:
-

incrementAddress

public void incrementAddress()

reset

protected boolean reset()
Reset drive All geometry parameters for sector selection are reset.

Returns:
-

getControl

public ATADriveController getControl()
Get the control.

Returns:
the control

getSenseInfo

public SenseInfo getSenseInfo()
Returns:
-

containsDisk

protected boolean containsDisk()
Checks the existence of a disk in drive

Returns:
boolean true if drive contains a disk, false otherwise

getDriveType

protected ATADriveType getDriveType()
Get type of drive

Returns:
int drive type

setDriveType

protected void setDriveType(ATADriveType type)
Sets type of drive.

Parameters:
type -

getDiskCapacity

protected long getDiskCapacity()
Get the total capacity of the disk in bytes.

Returns:
the total capacity of the disk in bytes.

setDiskCapacity

public void setDiskCapacity(int theTotalNumCylinders,
                            int theTotalNumHeads,
                            int theTotalNumSectors,
                            int theNumSectorsPerBlock)
Set the disk capacity, by input of the number of cylinders, the number of heads, the number of sectors and the number of sectors per block.

Parameters:
theTotalNumCylinders - the total number of cylinders
theTotalNumHeads - the total number of heads
theTotalNumSectors - the total number of sectors
theNumSectorsPerBlock - the number of sectors per block

getDiskImageSize

protected long getDiskImageSize()
Get size in bytes of the disk image. Returns -1 if drive is empty.

Returns:
int size of disk image, or -1 if no disk image available

setIsMaster

public void setIsMaster(boolean isMaster)
Sets if the disk is a master (true) or a slave (false).

Parameters:
isMaster - true for master, false for slave

setWriteProtected

public void setWriteProtected(boolean isProtected)
Set if the disk is write protected.

Parameters:
isProtected - true for write protected, false for not writed protected

readData

public byte[] readData(byte[] diskBuffer,
                       int offset,
                       int totalBytes)
                throws java.io.IOException
Reads Data from disk image.

Parameters:
offset - the offset
totalBytes - the total number of bytes
diskBuffer - the disk buffer
Returns:
-
Throws:
java.io.IOException

writeData

public void writeData(byte[] diskBuffer,
                      int offset,
                      int totalBytes)
               throws java.io.IOException
Writes data to the disk image.

Parameters:
offset - the offset
totalBytes - the total number of bytes
diskBuffer - the disk buffer
Throws:
java.io.IOException

loadImage

public void loadImage(java.io.File imageFile)
               throws StorageDeviceException
Load disk image.

Parameters:
imageFile - The disk image file
Throws:
StorageDeviceException

toString

public java.lang.String toString()
Provides the string representation of the class.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of the class

isMaster

public boolean isMaster()
Returns:
-

setMaster

public void setMaster(boolean isMaster)
Parameters:
isMaster -

getCurrentHead

public int getCurrentHead()
Returns:
-

setCurrentHead

public void setCurrentHead(int currentHead)
Parameters:
currentHead -

getCurrentCylinder

public int getCurrentCylinder()
Returns:
-

setCurrentCylinder

public void setCurrentCylinder(int currentCylinder)
Parameters:
currentCylinder -

getCurrentSector

public int getCurrentSector()
Returns:
-

setCurrentSector

public void setCurrentSector(int currentSector)
Parameters:
currentSector -

getTotalNumSectors

public int getTotalNumSectors()
Returns:
-

getAtpi

public Atpi getAtpi()
Returns:
-

setAtpi

public void setAtpi(Atpi atpi)
Parameters:
atpi -

getIoLightCounter

public int getIoLightCounter()
Returns:
-

setIoLightCounter

public void setIoLightCounter(int ioLightCounter)
Parameters:
ioLightCounter -

getTotalNumHeads

public int getTotalNumHeads()
Returns:
-

setTotalNumHeads

public void setTotalNumHeads(int totalNumHeads)
Parameters:
totalNumHeads -

getTotalNumCylinders

public int getTotalNumCylinders()
Returns:
-

setTotalNumCylinders

public void setTotalNumCylinders(int totalNumCylinders)
Parameters:
totalNumCylinders -

incrementSectorCount

public void incrementSectorCount()

decrementSectorCount

public void decrementSectorCount()

getSectorCount

public int getSectorCount()
Returns:
-

setSectorCount

public void setSectorCount(int sectorCount)
Parameters:
sectorCount -

getFeatures

public int getFeatures()
Returns:
-

setFeatures

public void setFeatures(int features)
Parameters:
features -

getIdDrive

public int[] getIdDrive()
Returns:
-

setIdDrive

public void setIdDrive(int index,
                       int idDrive)
Parameters:
index -
idDrive -

getModelNo

public char[] getModelNo()
Returns:
-

getCdRom

public CDROM getCdRom()
Returns:
-

setCdRom

public void setCdRom(CDROM cdRom)
Parameters:
cdRom -

getTranslationType

public ATATranslationType getTranslationType()
Returns:
-

setTranslationType

public void setTranslationType(ATATranslationType translationType)
Parameters:
translationType -