<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Procyon AVRlib: IDE/ATA Interface Driver (ata.c)</title>
<link href="dox.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>IDE/ATA Interface Driver (ata.c)<br>
<small>
[<a class="el" href="group__driver__hw.html">Drivers (for external hardware)</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "<a class="code" href="ata_8h.html">ata.h</a>"</span>
</pre></div> <dl compact><dt><b>Overview</b></dt><dd>This library provides an interface from AVR processors to IDE/ATA devices. Such devices can include hard disks, CF memory cards, and PCMCIA disks and memory devices. The library supports automatic drive identification and sector-level reading and writing. Some minimal address decoding hardware is required to use this interface. For an example of interface hardware, see the Procyon MP3 Player docs here: <a href="http://hubbard.engr.scu.edu/embedded/procyonmp3/index.html.">http://hubbard.engr.scu.edu/embedded/procyonmp3/index.html.</a> Future revisions if this library may include a direct hardware-less interface option.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>This code is quite old and in some level of disrepair. Nonetheless, it works quite well. </dd></dl>
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><b>typeDriveInfo</b></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga19" doxytag="ata::DRIVE0"></a>
#define </td><td class="memItemRight" valign="bottom"><b>DRIVE0</b> 0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga20" doxytag="ata::STANDBY"></a>
#define </td><td class="memItemRight" valign="bottom"><b>STANDBY</b> 0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga21" doxytag="ata::SLEEP"></a>
#define </td><td class="memItemRight" valign="bottom"><b>SLEEP</b> 1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga22" doxytag="ata::IDLE"></a>
#define </td><td class="memItemRight" valign="bottom"><b>IDLE</b> 2</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga23" doxytag="ata::ATA_SR_BSY"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_BSY</b> 0x80</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga24" doxytag="ata::ATA_SR_DRDY"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_DRDY</b> 0x40</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga25" doxytag="ata::ATA_SR_DF"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_DF</b> 0x20</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga26" doxytag="ata::ATA_SR_DSC"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_DSC</b> 0x10</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga27" doxytag="ata::ATA_SR_DRQ"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_DRQ</b> 0x08</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga28" doxytag="ata::ATA_SR_CORR"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_CORR</b> 0x04</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga29" doxytag="ata::ATA_SR_IDX"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_IDX</b> 0x02</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga30" doxytag="ata::ATA_SR_ERR"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_SR_ERR</b> 0x01</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga31" doxytag="ata::ATA_ER_UNC"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_ER_UNC</b> 0x40</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga32" doxytag="ata::ATA_ER_MC"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_ER_MC</b> 0x20</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga33" doxytag="ata::ATA_ER_IDNF"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_ER_IDNF</b> 0x10</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga34" doxytag="ata::ATA_ER_MCR"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_ER_MCR</b> 0x08</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga35" doxytag="ata::ATA_ER_ABRT"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_ER_ABRT</b> 0x04</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga36" doxytag="ata::ATA_ER_TK0NF"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_ER_TK0NF</b> 0x02</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga37" doxytag="ata::ATA_ER_AMNF"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_ER_AMNF</b> 0x01</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga38" doxytag="ata::ATA_HEAD_USE_LBA"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_HEAD_USE_LBA</b> 0x40</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga39" doxytag="ata::ATA_CMD_READ"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_READ</b> 0x20</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga40" doxytag="ata::ATA_CMD_READNR"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_READNR</b> 0x21</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga41" doxytag="ata::ATA_CMD_WRITE"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_WRITE</b> 0x30</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga42" doxytag="ata::ATA_CMD_WRITENR"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_WRITENR</b> 0x31</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga43" doxytag="ata::ATA_CMD_IDENTIFY"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_IDENTIFY</b> 0xEC</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga44" doxytag="ata::ATA_CMD_RECALIBRATE"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_RECALIBRATE</b> 0x10</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga45" doxytag="ata::ATA_CMD_SPINDOWN"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_SPINDOWN</b> 0xE0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga46" doxytag="ata::ATA_CMD_SPINUP"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_SPINUP</b> 0xE1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga47" doxytag="ata::ATA_CMD_STANDBY_5SU"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_STANDBY_5SU</b> 0xE2</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga48" doxytag="ata::ATA_CMD_IDLE_5SU"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_IDLE_5SU</b> 0xE3</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga49" doxytag="ata::ATA_CMD_SLEEP"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_SLEEP</b> 0xE6</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga50" doxytag="ata::ATA_CMD_STANDBY_01SU"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_STANDBY_01SU</b> 0xF2</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga51" doxytag="ata::ATA_CMD_IDLE_01SU"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_CMD_IDLE_01SU</b> 0xF3</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga52" doxytag="ata::ATA_DISKPARM_CLYS"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_DISKPARM_CLYS</b> 0x03A6</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga53" doxytag="ata::ATA_DISKPARM_HEADS"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_DISKPARM_HEADS</b> 0x10</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga54" doxytag="ata::ATA_DISKPARM_SECTORS"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_DISKPARM_SECTORS</b> 0x11</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga55" doxytag="ata::ATA_IDENT_DEVICETYPE"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_DEVICETYPE</b> 0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga56" doxytag="ata::ATA_IDENT_CYLINDERS"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_CYLINDERS</b> 1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga57" doxytag="ata::ATA_IDENT_HEADS"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_HEADS</b> 3</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga58" doxytag="ata::ATA_IDENT_SECTORS"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_SECTORS</b> 6</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga59" doxytag="ata::ATA_IDENT_SERIAL"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_SERIAL</b> 10</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga60" doxytag="ata::ATA_IDENT_MODEL"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_MODEL</b> 27</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga61" doxytag="ata::ATA_IDENT_FIELDVALID"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_FIELDVALID</b> 53</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga62" doxytag="ata::ATA_IDENT_LBASECTORS"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_IDENT_LBASECTORS</b> 60</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga63" doxytag="ata::ATA_DISKMODE_SPINDOWN"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_DISKMODE_SPINDOWN</b> 0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga64" doxytag="ata::ATA_DISKMODE_SPINUP"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_DISKMODE_SPINUP</b> 1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga65" doxytag="ata::ATA_DISKMODE_SETTIMEOUT"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_DISKMODE_SETTIMEOUT</b> 2</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga66" doxytag="ata::ATA_DISKMODE_SLEEP"></a>
#define </td><td class="memItemRight" valign="bottom"><b>ATA_DISKMODE_SLEEP</b> 3</td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga0" doxytag="ata::ataInit"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataInit</b> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga1" doxytag="ata::ataDriveInit"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataDriveInit</b> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga2" doxytag="ata::ataDriveSelect"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataDriveSelect</b> (u08 DriveNo)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga3" doxytag="ata::ataSetDrivePowerMode"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataSetDrivePowerMode</b> (u08 DriveNo, u08 mode, u08 timeout)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga4" doxytag="ata::ataReadByte"></a>
u08 </td><td class="memItemRight" valign="bottom"><b>ataReadByte</b> (u08 reg)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga5" doxytag="ata::ataWriteByte"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataWriteByte</b> (u08 reg, u08 data)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga6" doxytag="ata::ataShowRegisters"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataShowRegisters</b> (unsigned char DriveNo)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga7" doxytag="ata::ataSWReset"></a>
u08 </td><td class="memItemRight" valign="bottom"><b>ataSWReset</b> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga8" doxytag="ata::ataDiskErr"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataDiskErr</b> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga9" doxytag="ata::ataPrintSector"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataPrintSector</b> (u08 *Buffer)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga10" doxytag="ata::ataReadDataBuffer"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataReadDataBuffer</b> (u08 *Buffer, u16 numBytes)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga11" doxytag="ata::ataWriteDataBuffer"></a>
void </td><td class="memItemRight" valign="bottom"><b>ataWriteDataBuffer</b> (u08 *Buffer, u16 numBytes)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga12" doxytag="ata::ataStatusWait"></a>
u08 </td><td class="memItemRight" valign="bottom"><b>ataStatusWait</b> (u08 mask, u08 waitStatus)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga13" doxytag="ata::ataReadSectorsCHS"></a>
unsigned char </td><td class="memItemRight" valign="bottom"><b>ataReadSectorsCHS</b> (unsigned char Drive, unsigned char Head, unsigned int Track, unsigned char Sector, unsigned int numsectors, unsigned char *Buffer)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga14" doxytag="ata::ataWriteSectorsCHS"></a>
unsigned char </td><td class="memItemRight" valign="bottom"><b>ataWriteSectorsCHS</b> (unsigned char Drive, unsigned char Head, unsigned int Track, unsigned char Sector, unsigned int numsectors, unsigned char *Buffer)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga15" doxytag="ata::ataReadSectorsLBA"></a>
unsigned char </td><td class="memItemRight" valign="bottom"><b>ataReadSectorsLBA</b> (unsigned char Drive, unsigned long lba, unsigned int numsectors, unsigned char *Buffer)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga16" doxytag="ata::ataWriteSectorsLBA"></a>
unsigned char </td><td class="memItemRight" valign="bottom"><b>ataWriteSectorsLBA</b> (unsigned char Drive, unsigned long lba, unsigned int numsectors, unsigned char *Buffer)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga17" doxytag="ata::ataReadSectors"></a>
unsigned char </td><td class="memItemRight" valign="bottom"><b>ataReadSectors</b> (unsigned char Drive, unsigned long lba, unsigned int numsectors, unsigned char *Buffer)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga18" doxytag="ata::ataWriteSectors"></a>
unsigned char </td><td class="memItemRight" valign="bottom"><b>ataWriteSectors</b> (unsigned char Drive, unsigned long lba, unsigned int numsectors, unsigned char *Buffer)</td></tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:09 2006 for Procyon AVRlib by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|