Public Member Functions |
| tcDspAta (void *apAddress, int anDevice) |
| This constructor is used to open an ATA interface at the specified address.
|
virtual | ~tcDspAta () |
| Default destructor.
|
virtual int | write (void *apAddr, void *apData, int anBytes) |
| This routine writes an arbitrary amount of data to an ATA device at a specified offset from the start of the device.
|
virtual int | write (unsigned int anSector, unsigned int anOffset, void *apData, int anBytes) |
| Sector-based version of the write method.
|
virtual int | read (void *apStartAddr, void *apBuffer, int anBytes) |
| This routine reads an arbitrary amount of data from an ATA device from the specified offset position.
|
virtual int | read (unsigned int anSector, unsigned int anOffset, void *apBuffer, int anBytes) |
| Sector-based version of the read method.
|
virtual bool | reset (void) |
| This routine performs a soft reset of the ATA device.
|
tuAtaSr | get_status (void) |
| This routine gets the current value of the ATA status register.
|
double | get_size (void) |
| This routine returns the size of the device in KB (using the getSizeKB method in the tcDspStorageBase base class).
|
tuAtaErr | get_error (void) |
| This routine gets the current value of the ATA error register.
|
| tcDspStorageBase () |
| This constructor is used to initialize storage base class.
|
virtual | ~tcDspStorageBase () |
| Default Destructor.
|
virtual bool | erase (unsigned int anSector) |
| This routine provides a default erase method.
|
virtual void | registerISRCallback (tfIsrCallback afCallback, void *apUserArg) |
| This method is used to register a callback that is activated whenever the device changes state.
|
virtual void * | getAddress (unsigned int anSector, unsigned int anOffset) |
| This routine uses the device's sector map to compute an offset address from a supplied sector and offset.
|
virtual unsigned int | getSize (unsigned int anSector) |
| This routine uses the device's sector map to determine the size of the specified sector.
|
virtual unsigned int | getSector (void *apAddr) |
| This routine uses the device's sector map to compute a sector from a from a supplied offset address.
|
virtual double | getDeviceSizeKB (void) |
| This routine returns the size of the device in kilobytes.
|
const tsSectorMap * | getMap (int &anNumSectors) |
| This routine returns a pointer to access the device's sector map.
|
virtual bool | getMediaPresent () |
Protected Member Functions |
bool | initialize (void) |
| This routine initializes the ATA device, and returns true if successful.
|
void | select_device (int anDevice) |
| This routine configures the drive/head register for the specified device (always in LBA mode).
|
void | identify (unsigned short *apIdBuffer) |
| This routine reads device identity data into the supplied buffer.
|
bool | read_sector (unsigned int anBlock) |
| This routine reads the specified LBA block of the device into the page buffer.
|
bool | write_sector (unsigned int anBlock) |
| This routine writes the current contents of the page buffer to the specified LBA block of the device.
|
void | send_command (unsigned char anCmd) |
| This routine sends a new command to the ATA command register.
|
bool | ready (void) |
| This routine reads the current ATA status and returns a boolean indicating whether or not the device is ready.
|
bool | busy (void) |
| This routine reads the current ATA status and returns a boolean indicating whether or not the device is busy.
|
bool | drq (void) |
| This routine reads the current ATA status and returns a boolean indicating whether or not the device is requesting data.
|
bool | ata_err (void) |
| This routine reads the current ATA status and returns a boolean indicating whether or not the device is reporting an error.
|
bool | wait_for_drq (bool aDrq, int aTimeout) |
| This routine waits till the drq flag is set or a timeout expires.
|
bool | wait_for_busy (bool aBusy, int aTimeout) |
| This routine waits till the busy flag is set or a timeout expires.
|
Additional Inherited Members |
typedef void(* | tfIsrCallback )(bool, void *) |
| prototype for the ISR callback
|
static int | readDispatch (unsigned int anSector, unsigned int anOffset, char *apBuffer, unsigned int anLength, void *apInstance) |
| Static dispatch routine to allow the read method to be registered as a callback.
|
static int | writeDispatch (unsigned int anSector, unsigned int anOffset, char *apData, unsigned int anBytes, void *apInstance) |
| Static dispatch routine to allow the write method to be registered as a callback.
|
unsigned int | mnTxBytes |
| Count of bytes written (debug)
|
unsigned int | mnRxBytes |
| Count of bytes read (debug)
|
The tcDspAta class is used for low-level reading and writing to ATA storage devices such as disk drives or CompactFlash cards.
Filesystems and data cache must be provided at a higher level, although these routines may be used for simple read/write access to a device.
- See also:
- tcDspAta Page
int tcDspAta::write |
( |
void * |
apAddr, |
|
|
void * |
apData, |
|
|
int |
anBytes |
|
) |
| |
|
virtual |
This routine writes an arbitrary amount of data to an ATA device at a specified offset from the start of the device.
The routine handles preservation of data when only a partial sector is written. The data does not have to be sector aligned, although writing aligned, full sectors is most efficient.
- Parameters:
-
[in] | apAddr | Pointer to the offset position on the ATA device. |
[in] | apData | A buffer containing the data to be written. |
[in] | anBytes | Size of the data to be written in bytes. |
- Returns:
- The number of bytes successfully written.
- See also:
- DspAta.h
Implements MityDSP::tcDspStorageBase.