1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// ide.h
|
4 |
|
|
//
|
5 |
|
|
// IDE Interface Driver Tables for RedBoot
|
6 |
|
|
//
|
7 |
|
|
//==========================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//==========================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): msalter
|
43 |
|
|
// Contributors: msalter
|
44 |
|
|
// Date: 2001-07-06
|
45 |
|
|
// Purpose:
|
46 |
|
|
// Description:
|
47 |
|
|
//
|
48 |
|
|
// This code is part of RedBoot (tm).
|
49 |
|
|
//
|
50 |
|
|
//####DESCRIPTIONEND####
|
51 |
|
|
//
|
52 |
|
|
//==========================================================================
|
53 |
|
|
|
54 |
|
|
#ifndef CYGONCE_REDBOOT_IDE_H
|
55 |
|
|
#define CYGONCE_REDBOOT_IDE_H
|
56 |
|
|
|
57 |
|
|
// IDE Register Indices
|
58 |
|
|
#define IDE_REG_DATA 0
|
59 |
|
|
#define IDE_REG_ERROR 1
|
60 |
|
|
#define IDE_REG_FEATURES 1
|
61 |
|
|
#define IDE_REG_COUNT 2
|
62 |
|
|
#define IDE_REG_REASON 2 // ATAPI
|
63 |
|
|
#define IDE_REG_LBALOW 3
|
64 |
|
|
#define IDE_REG_LBAMID 4
|
65 |
|
|
#define IDE_REG_LBAHI 5
|
66 |
|
|
#define IDE_REG_DEVICE 6
|
67 |
|
|
#define IDE_REG_STATUS 7
|
68 |
|
|
#define IDE_REG_COMMAND 7
|
69 |
|
|
|
70 |
|
|
#define IDE_STAT_BSY 0x80
|
71 |
|
|
#define IDE_STAT_DRDY 0x40
|
72 |
|
|
#define IDE_STAT_SERVICE 0x10
|
73 |
|
|
#define IDE_STAT_DRQ 0x08
|
74 |
|
|
#define IDE_STAT_CORR 0x04
|
75 |
|
|
#define IDE_STAT_ERR 0x01
|
76 |
|
|
|
77 |
|
|
#define IDE_REASON_REL 0x04
|
78 |
|
|
#define IDE_REASON_IO 0x02
|
79 |
|
|
#define IDE_REASON_COD 0x01
|
80 |
|
|
|
81 |
|
|
//
|
82 |
|
|
// Drive ID offsets of interest
|
83 |
|
|
//
|
84 |
|
|
#define IDE_DEVID_GENCONFIG 0
|
85 |
|
|
#define IDE_DEVID_SERNO 20
|
86 |
|
|
#define IDE_DEVID_MODEL 54
|
87 |
|
|
#define IDE_DEVID_LBA_CAPACITY 120
|
88 |
|
|
|
89 |
|
|
struct ide_priv {
|
90 |
|
|
cyg_uint8 controller;
|
91 |
|
|
cyg_uint8 drive;
|
92 |
|
|
cyg_uint16 flags;
|
93 |
|
|
};
|
94 |
|
|
|
95 |
|
|
/* flag values */
|
96 |
|
|
#define IDE_DEV_PRESENT 1 // Device is present
|
97 |
|
|
#define IDE_DEV_PACKET 2 // Supports packet interface
|
98 |
|
|
#define IDE_DEV_ADDR48 3 // Supports 48bit addressing
|
99 |
|
|
|
100 |
|
|
#define CDROM_SECTOR_SIZE 2048
|
101 |
|
|
#define SECTORS_PER_CDROM_SECTOR (CDROM_SECTOR_SIZE/SECTOR_SIZE)
|
102 |
|
|
|
103 |
|
|
#endif // CYGONCE_REDBOOT_IDE_H
|