source: rtems/c/src/libchip/ide/ide_ctrl_io.h @ 7357f566

4.104.115
Last change on this file since 7357f566 was 7357f566, checked in by Chris Johns <chrisj@…>, on 10/08/09 at 07:25:15

2009-10-08 Chris Johns <chrisj@…>

  • libchip/ide/ata.c, c/src/libchip/ide/ata_internal.h: Remove the multiblock support from the ATA driver. Multiblock at the disk level should not be a global policy as a disk may have more than one partition with different block sizes. An IDE driver could decide to use the feature with DMA but this a driver specific design choice. Fixed bugs relating to variable block sizes and large block transfer.
  • c/src/libchip/ide/ide_controller.c, c/src/libchip/ide/ide_ctrl_cfg.h, c/src/libchip/ide/ide_ctrl_io.h: Changed the block size to 32bits so blocks of 64K or bigger can be transfered in a single driver call.
  • Property mode set to 100644
File size: 6.6 KB
Line 
1/*
2 * ide_ctrl_io.h
3 *
4 * LibChip library IDE controller header file - IO operations defined for
5 * IDE controllers.
6 *
7 * Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
8 * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 *
14 * $Id$
15 */
16#ifndef __IDE_CTRL_IO_H__
17#define __IDE_CTRL_IO_H__
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <rtems/blkdev.h>
24
25/* Command Block Registers */
26#define IDE_REGISTER_DATA               0
27#define IDE_REGISTER_ERROR              1
28#define IDE_REGISTER_FEATURES           IDE_REGISTER_ERROR
29#define IDE_REGISTER_SECTOR_COUNT       2
30#define IDE_REGISTER_SECTOR_NUMBER      3
31#define IDE_REGISTER_LBA0               IDE_REGISTER_SECTOR_NUMBER
32#define IDE_REGISTER_CYLINDER_LOW       4
33#define IDE_REGISTER_LBA1               IDE_REGISTER_CYLINDER_LOW
34#define IDE_REGISTER_CYLINDER_HIGH      5
35#define IDE_REGISTER_LBA2               IDE_REGISTER_CYLINDER_HIGH
36#define IDE_REGISTER_DEVICE_HEAD        6
37#define IDE_REGISTER_LBA3               IDE_REGISTER_DEVICE_HEAD
38#define IDE_REGISTER_STATUS             7
39#define IDE_REGISTER_COMMAND            IDE_REGISTER_STATUS
40
41/*  Control Block Registers */
42#define IDE_REGISTER_ALTERNATE_STATUS   6
43#define IDE_REGISTER_DEVICE_CONTROL     IDE_REGISTER_ALTERNATE_STATUS
44
45/* offsets used to access  registers */
46#define IDE_REGISTER_DEVICE_CONTROL_OFFSET   8
47#define IDE_REGISTER_ALTERNATE_STATUS_OFFSET IDE_REGISTER_DEVICE_CONTROL_OFFSET
48#define IDE_REGISTER_DATA_BYTE               9
49#define IDE_REGISTER_DATA_WORD               10
50
51/*
52 * Registers bits
53 */
54#define IDE_REGISTER_STATUS_BSY          0x80  /* Busy bit */
55#define IDE_REGISTER_STATUS_DRDY         0x40  /* Device ready */
56#define IDE_REGISTER_STATUS_DF           0x20  /* Device fault */
57#define IDE_REGISTER_STATUS_DSC          0x10  /* Device seek complete-- */
58                                               /* obsolete */
59#define IDE_REGISTER_STATUS_DRQ          0x08  /* Data request */
60#define IDE_REGISTER_STATUS_CORR         0x04  /* Corrected data-- */
61                                               /* vendor specific--obsolete */
62#define IDE_REGISTER_STATUS_IDX          0x02  /* Index-- */
63                                                /* vendor specific--obsolete */
64#define IDE_REGISTER_STATUS_ERR          0x01  /* Error */
65
66#define IDE_REGISTER_DEVICE_CONTROL_SRST 0x04  /* Host software reset bit */
67#define IDE_REGISTER_DEVICE_CONTROL_nIEN 0x02  /* Negated interrupt enable */
68
69#define IDE_REGISTER_DEVICE_HEAD_L       0x40  /* LBA mode bit */
70#define IDE_REGISTER_DEVICE_HEAD_DEV     0x10  /* Device0/Device1 bit */
71#define IDE_REGISTER_DEVICE_HEAD_DEV_POS 4     /* Dev0/Dev1 bit position */
72#define IDE_REGISTER_DEVICE_HEAD_HS      0x0f  /* Head/LBA24_27 bits */
73#define IDE_REGISTER_LBA3_L              0x40
74#define IDE_REGISTER_LBA3_DEV            0x10
75#define IDE_REGISTER_LBA3_LBA            0x0f
76
77#define IDE_REGISTER_ERROR_ICRC          (1 << 7) /* Interface CRC error on */
78                                                  /* UDMA data transfer */
79#define IDE_REGISTER_ERROR_UNC           (1 << 6) /* Uncorrectable data error */
80#if CCJ_COULD_NOT_FIND_THIS_ERROR
81#define IDE_REGISTER_ERROR_WP            (1 << 6) /* Write protect */
82#endif
83#define IDE_REGISTER_ERROR_MC            (1 << 5) /* Media changed */
84#define IDE_REGISTER_ERROR_IDNF          (1 << 4) /* Sector ID not found */
85#define IDE_REGISTER_ERROR_MCR           (1 << 3) /* Media change requested */
86                                                  /* obsolette */
87#define IDE_REGISTER_ERROR_ABRT          (1 << 2) /* Aborted command */
88#define IDE_REGISTER_ERROR_NM            (1 << 1) /* No media, End of Media. */
89#define IDE_REGISTER_ERROR_AMNF          (1 << 0) /* Address mark not found */
90                                                  /* --obsolette in ATA-4 */
91#define IDE_REGISTER_ERROR_MED           (1 << 0) /* Media error is detected */
92
93/*
94 * ide_controller_read_data_block --
95 *     Read data block via controller's data register
96 *
97 * PARAMETERS:
98 *     minor      - minor number of controller
99 *     block_size - number of bytes to read
100 *     bufs       - set of buffers to store data
101 *     cbuf       - number of current buffer from the set
102 *     pos        - position inside current buffer 'cbuf'
103 *
104 * RETURNS:
105 *     NONE
106 */
107void
108ide_controller_read_data_block(rtems_device_minor_number  minor,
109                               uint32_t                   block_size,
110                               rtems_blkdev_sg_buffer    *bufs,
111                               uint32_t                  *cbuf,
112                               uint32_t                  *pos);
113
114/*
115 * ide_controller_write_data_block --
116 *     Write data block via controller's data register
117 *
118 * PARAMETERS:
119 *     minor      - minor number of controller
120 *     block_size - number of bytes to write
121 *     bufs       - set of buffers which store data
122 *     cbuf       - number of current buffer from the set
123 *     pos        - position inside current buffer 'cbuf'
124 *
125 * RETURNS:
126 *     NONE
127 */
128void
129ide_controller_write_data_block(rtems_device_minor_number  minor,
130                                uint32_t                   block_size,
131                                rtems_blkdev_sg_buffer    *bufs,
132                                uint32_t                  *cbuf,
133                                uint32_t                  *pos);
134
135/*
136 * ide_controller_read_register --
137 *     Read controller's register
138 *
139 * PARAMETERS:
140 *     minor - minor number of controller
141 *     reg   - register to read
142 *     value - placeholder for result
143 *
144 * RETURNS
145 *     NONE
146 */
147void
148ide_controller_read_register(rtems_device_minor_number  minor,
149                             int                        reg,
150                             uint16_t                  *value);
151
152/*
153 * ide_controller_write_register --
154 *     Write controller's register
155 *
156 * PARAMETERS:
157 *     minor - minor number of controller
158 *     reg   - register to write
159 *     value - value to write
160 *
161 * RETURNS:
162 *     NONE
163 */
164void
165ide_controller_write_register(rtems_device_minor_number minor,
166                              int reg, uint16_t   value);
167
168/*
169 * ide_controller_config_io_speed --
170 *     Set controller's speed of IO operations
171 *
172 * PARAMETERS:
173 *     minor           - minor number of controller
174 *     modes_available - speeds available
175 *
176 * RETURNS:
177 *     RTEMS_SUCCESSFUL on success, or error code if
178 *     error occured
179 */
180rtems_status_code
181ide_controller_config_io_speed(int minor, uint16_t modes_available);
182
183#ifdef __cplusplus
184}
185#endif
186
187
188#endif /* __IDE_CTRL_IO_H__ */
Note: See TracBrowser for help on using the repository browser.