⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ata_8h-source.html

📁 ATMEL的AVR单片机库文件
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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: ata.h Source File</title><link href="dox.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.6 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>ata.h</h1><a href="ata_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*! \file ata.h \brief IDE-ATA hard disk interface driver. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name    : 'ata.h'</span>00005 <span class="comment">// Title        : IDE-ATA interface driver for hard disks</span>00006 <span class="comment">// Author       : Pascal Stang</span>00007 <span class="comment">// Date         : 11/22/2000</span>00008 <span class="comment">// Revised      : 12/29/2000</span>00009 <span class="comment">// Version      : 0.3</span>00010 <span class="comment">// Target MCU   : ATmega103 (should work for Atmel AVR Series)</span>00011 <span class="comment">// Editor Tabs  : 4</span>00012 <span class="comment">//</span>00013 <span class="comment">// NOTE: This code is currently below version 1.0, and therefore is considered</span>00014 <span class="comment">// to be lacking in some functionality or documentation, or may not be fully</span>00015 <span class="comment">// tested.  Nonetheless, you can expect most functions to work.</span>00016 <span class="comment">//</span>00017 <span class="comment">// This code is distributed under the GNU Public License</span>00018 <span class="comment">//      which can be found at http://www.gnu.org/licenses/gpl.txt</span>00019 <span class="comment">//</span>00020 <span class="comment">//*****************************************************************************</span>00021 00022 00023 <span class="preprocessor">#ifndef ATA_H</span>00024 <span class="preprocessor"></span><span class="preprocessor">#define ATA_H</span>00025 <span class="preprocessor"></span>00026 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00027 <span class="preprocessor">#include "<a class="code" href="ataconf_8h.html">ataconf.h</a>"</span>00028 00029 <span class="comment">// constants</span>00030 <span class="preprocessor">#define DRIVE0      0</span>00031 <span class="preprocessor"></span>00032 <span class="preprocessor">#define STANDBY     0</span>00033 <span class="preprocessor"></span><span class="preprocessor">#define SLEEP       1</span>00034 <span class="preprocessor"></span><span class="preprocessor">#define IDLE        2</span>00035 <span class="preprocessor"></span>00036 <span class="comment">// ATA status register bits</span>00037 <span class="preprocessor">#define ATA_SR_BSY      0x80</span>00038 <span class="preprocessor"></span><span class="preprocessor">#define ATA_SR_DRDY     0x40</span>00039 <span class="preprocessor"></span><span class="preprocessor">#define ATA_SR_DF       0x20</span>00040 <span class="preprocessor"></span><span class="preprocessor">#define ATA_SR_DSC      0x10</span>00041 <span class="preprocessor"></span><span class="preprocessor">#define ATA_SR_DRQ      0x08</span>00042 <span class="preprocessor"></span><span class="preprocessor">#define ATA_SR_CORR     0x04</span>00043 <span class="preprocessor"></span><span class="preprocessor">#define ATA_SR_IDX      0x02</span>00044 <span class="preprocessor"></span><span class="preprocessor">#define ATA_SR_ERR      0x01</span>00045 <span class="preprocessor"></span>00046 <span class="comment">// ATA error register bits</span>00047 <span class="preprocessor">#define ATA_ER_UNC      0x40</span>00048 <span class="preprocessor"></span><span class="preprocessor">#define ATA_ER_MC       0x20</span>00049 <span class="preprocessor"></span><span class="preprocessor">#define ATA_ER_IDNF     0x10</span>00050 <span class="preprocessor"></span><span class="preprocessor">#define ATA_ER_MCR      0x08</span>00051 <span class="preprocessor"></span><span class="preprocessor">#define ATA_ER_ABRT     0x04</span>00052 <span class="preprocessor"></span><span class="preprocessor">#define ATA_ER_TK0NF    0x02</span>00053 <span class="preprocessor"></span><span class="preprocessor">#define ATA_ER_AMNF     0x01</span>00054 <span class="preprocessor"></span>00055 <span class="comment">// ATA head register bits</span>00056 <span class="preprocessor">#define ATA_HEAD_USE_LBA    0x40</span>00057 <span class="preprocessor"></span><span class="comment">/*</span>00058 <span class="comment">// ATA registers</span>00059 <span class="comment">#define ATA_REG_BASE        0x8000</span>00060 <span class="comment">#define ATA_REG_DATAL       0x00</span>00061 <span class="comment">#define ATA_REG_ERROR       0x01</span>00062 <span class="comment">#define ATA_REG_SECCOUNT    0x02</span>00063 <span class="comment">#define ATA_REG_STARTSEC    0x03</span>00064 <span class="comment">#define ATA_REG_CYLLO       0x04</span>00065 <span class="comment">#define ATA_REG_CYLHI       0x05</span>00066 <span class="comment">#define ATA_REG_HDDEVSEL    0x06</span>00067 <span class="comment">#define ATA_REG_CMDSTATUS1  0x07</span>00068 <span class="comment">#define ATA_REG_CMDSTATUS2  0x08</span>00069 <span class="comment">#define ATA_REG_ACTSTATUS   0x09</span>00070 <span class="comment"></span>00071 <span class="comment">#define ATA_REG_DATAH       0x10</span>00072 <span class="comment">*/</span>00073 <span class="comment">// ATA commands</span>00074 <span class="preprocessor">#define ATA_CMD_READ            0x20</span>00075 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_READNR          0x21</span>00076 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_WRITE           0x30</span>00077 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_WRITENR         0x31</span>00078 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_IDENTIFY        0xEC</span>00079 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_RECALIBRATE     0x10</span>00080 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_SPINDOWN        0xE0    // spin down disk immediately</span>00081 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_SPINUP          0xE1    // spin up disk immediately</span>00082 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_STANDBY_5SU     0xE2    // spin down disk and set auto-power-down timer (sectorcount*5sec)</span>00083 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_IDLE_5SU        0xE3    // keep disk spinning and set auto-power-down timer (sectorcount*5sec)</span>00084 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_SLEEP           0xE6    // sleep disk (wakeup only on HW or SW reset)</span>00085 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_STANDBY_01SU    0xF2    // spin down disk and set auto-power-down timer (sectorcount*0.1sec)</span>00086 <span class="preprocessor"></span><span class="preprocessor">#define ATA_CMD_IDLE_01SU       0xF3    // keep disk spinning and set auto-power-down timer (sectorcount*0.1sec)</span>00087 <span class="preprocessor"></span>00088 00089 <span class="comment">// ATA CHS disk parameters (examples, now we autodetect)</span>00090 <span class="preprocessor">#define ATA_DISKPARM_CLYS       0x03A6  // number of cylinders per platter</span>00091 <span class="preprocessor"></span><span class="preprocessor">#define ATA_DISKPARM_HEADS      0x10    // number of heads (usable plater sides)</span>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -