NOLIST ; This file is part of picide, ATA(PI) interface to PIC18 family MCUs. ; Copyright (C) 2004-5 Toby Thain, toby@telegraphics.com.au ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA LIST ;Class| | code | FR | SC | SN | CY | DH | ;-----+--------------------------------------+-------+----+----+----+----+----| ; 1 | Acknowledge media chge | O | DBh | | | | | D | ; 1 | Boot - post-boot | O | DCh | | | | | D | ; 1 | Boot - pre-boot | O | DDh | | | | | D | ; 1 | Check power mode | O |98h E5h| | y | | | D | ; 1 | Door lock | O | DEh | | | | | D | ; 1 | Door unlock | O | DFh | | | | | D | ; 1 | Execute drive diagnostic | M | 90h | | | | | D*| ; 2 | Format track | M | 50h | * | y | | y | y | ; 1 | Identify drive | O | ECh | | | | | D | #define IDE_CMD_IDENTIFYDRIVE 0xec ; 1 | Idle | O |97h E3h| | y | | | D | #define IDE_CMD_IDLE 0x97 ; 1 | Idle immediate | O |95h E1h| | | | | D | ; 1 | Initialize drive parameters | M | 91h | | y | | | y | #define IDE_CMD_INITDRIVEPARAMS 0x91 ; 1 | NOP | O | 00h | | | | | y | ; 1 | Read buffer | O | E4h | | | | | D | ; 1 | Read DMA (w/retry) | O | C8h | | y | y | y | y | ; 1 | Read DMA (w/o retry) | O | C9h | | y | y | y | y | ; 1 | Read long (w/retry) | M | 22 | | y | y | y | y | ; 1 | Read long (w/o retry) | M | 23 | | y | y | y | y | ; 1 | Read multiple | O | C4h | | y | y | y | y | ; 1 | Read sector(s) (w/retry) | M | 20 | | y | y | y | y | #define IDE_CMD_READ 0x20 ; 1 | Read sector(s) (w/o retry) | M | 21 | | y | y | y | y | ; 1 | Read verify sector(s) (w/retry) | M | 40 | | y | y | y | y | ; 1 | Read verify sector(s) (w/o retry)| M | 41 | | y | y | y | y | ; 1 | Recalibrate | M | 1xh | | | | | D | ; 1 | Seek | M | 7xh | | | y | y | y | ; 1 | Set features | O | EFh | y | | | | D | ; 1 | Set multiple mode | O | C6h | | y | | | D | ; 1 | Sleep | O |99h E6h| | | | | D | ; 1 | Standby | O |96h E2h| | y | | | D | ; 1 | Standby immediate | O |94h E0h| | | | | D | ; 2 | Write buffer | O | E8h | | | | | D | ; 3 | Write DMA (w/retry) | O | CAh | | y | y | y | y | ; 3 | Write DMA (w/o retry) | O | CBh | | y | y | y | y | ; 2 | Write long (w/retry) | M | 32 | * | y | y | y | y | ; 2 | Write long (w/o retry) | M | 33 | * | y | y | y | y | ; 3 | Write multiple | O | C5h | * | y | y | y | y | ; 3 | Write same | O | E9h | y | y | y | y | y | ; 2 | Write sector(s) (w/retry) | M | 30 | * | y | y | y | y | #define IDE_CMD_WRITE 0x30 ; 2 | Write sector(s) (w/o retry) | M | 31 | * | y | y | y | y | ; 3 | Write verify | O | 3Ch | * | y | y | y | y | #define IDE_CMD_SMARTENABLE 0xb0 #define IDE_CMD_ATAPI_PACKET 0xa0 #define IDE_CMD_ATAPI_IDDEV 0xa1 #define IDE_DRVHEAD_LBA b'11100000' ; default LBA mode/drive select bits in the drive/head reg ;#define IDE_DRVHEAD_CHS b'10100000' #define IDE_DEVICE1 b'00010000' #define IDE_DEVICE0 0 #define DEVBIT 4 ; our error codes, not drive generated ones ; pass these back to high level callers #define NO_ERR 0 #define TIMEOUT_ERR -1 ; we weren't going to wait *forever* #define NODATA_ERR -2 ; drive didn't want to transfer data as expected #define ABORT_ERR -3 #define ATAPI_RETRY -4 ; command should be retried (ATAPI) ; our device types #define DEV_UNKNOWN 0 #define DEV_ATA 1 #define DEV_ATAPI 3 #define DEV_NONE 5