2
* Copyright (c) 2009 Jiri Svoboda
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
9
* - Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* - Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
* - The name of the author may not be used to endorse or promote products
15
* derived from this software without specific prior written permission.
17
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
#include <sys/types.h>
39
#include <fibril_sync.h>
54
/** ATA Command Register Block. */
60
uint8_t sector_number;
62
uint8_t cylinder_high;
89
uint8_t drive_address;
95
uint8_t device_control;
101
DCR_SRST = 0x04, /**< Software Reset */
102
DCR_nIEN = 0x02 /**< Interrupt Enable (negated) */
106
SR_BSY = 0x80, /**< Busy */
107
SR_DRDY = 0x40, /**< Drive Ready */
108
SR_DWF = 0x20, /**< Drive Write Fault */
109
SR_DSC = 0x10, /**< Drive Seek Complete */
110
SR_DRQ = 0x08, /**< Data Request */
111
SR_CORR = 0x04, /**< Corrected Data */
112
SR_IDX = 0x02, /**< Index */
113
SR_ERR = 0x01 /**< Error */
116
enum drive_head_bits {
121
ER_BBK = 0x80, /**< Bad Block Detected */
122
ER_UNC = 0x40, /**< Uncorrectable Data Error */
123
ER_MC = 0x20, /**< Media Changed */
124
ER_IDNF = 0x10, /**< ID Not Found */
125
ER_MCR = 0x08, /**< Media Change Request */
126
ER_ABRT = 0x04, /**< Aborted Command */
127
ER_TK0NF = 0x02, /**< Track 0 Not Found */
128
ER_AMNF = 0x01 /**< Address Mark Not Found */
132
CMD_IDENTIFY_DRIVE = 0xEC,
133
CMD_READ_SECTORS = 0x20,
134
CMD_WRITE_SECTORS = 0x30
145
dev_handle_t dev_handle;