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

4.104.114.84.9
Last change on this file since ee4f57d was ee4f57d, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 23, 2004 at 9:59:52 AM

2004-03-23 Ralf Corsepius <ralf_corsepius@…>

  • libchip/ide/ata.c, libchip/ide/ata_internal.h, libchip/ide/ide_controller.c, libchip/ide/ide_ctrl_cfg.h, libchip/ide/ide_ctrl_io.h, libchip/network/cs8900.c, libchip/network/dec21140.c, libchip/network/elnk.c, libchip/network/if_fxp.c, libchip/network/open_eth.c, libchip/network/open_eth.h, libchip/network/sonic.c, libchip/network/sonic.h, libchip/rtc/icm7170.c, libchip/rtc/icm7170.h, libchip/rtc/icm7170_reg.c, libchip/rtc/icm7170_reg2.c, libchip/rtc/icm7170_reg4.c, libchip/rtc/icm7170_reg8.c, libchip/rtc/m48t08.c, libchip/rtc/m48t08.h, libchip/rtc/m48t08_reg.c, libchip/rtc/m48t08_reg2.c, libchip/rtc/m48t08_reg4.c, libchip/rtc/m48t08_reg8.c, libchip/rtc/rtc.h, libchip/serial/mc68681.c, libchip/serial/mc68681.h, libchip/serial/mc68681_reg.c, libchip/serial/mc68681_reg2.c, libchip/serial/mc68681_reg4.c, libchip/serial/mc68681_reg8.c, libchip/serial/ns16550.c, libchip/serial/ns16550_p.h, libchip/serial/serial.h, libchip/serial/z85c30.c, libchip/serial/z85c30.h, libchip/serial/z85c30_p.h, libchip/serial/z85c30_reg.c, libchip/shmdr/addlq.c, libchip/shmdr/cnvpkt.c, libchip/shmdr/dump.c, libchip/shmdr/fatal.c, libchip/shmdr/getlq.c, libchip/shmdr/init.c, libchip/shmdr/initlq.c, libchip/shmdr/intr.c, libchip/shmdr/poll.c, libchip/shmdr/send.c, libchip/shmdr/shm_driver.h: Convert to using c99 fixed-size types.
  • Property mode set to 100644
File size: 6.4 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          0x80  /* Interface CRC error on */
78                                               /* UDMA data transfer */
79#define IDE_REGISTER_ERROR_UNC           0x40  /* Uncorrectable data error */
80#define IDE_REGISTER_ERROR_WP            0x40  /* Write protect */
81#define IDE_REGISTER_ERROR_MC            0x20  /* Media changed */
82#define IDE_REGISTER_ERROR_IDNF          0x10  /* Sector ID not found */
83#define IDE_REGISTER_ERROR_MCR           0x08  /* Media change requested */
84#define IDE_REGISTER_ERROR_ABRT          0x04  /* Aborted command */
85#define IDE_REGISTER_ERROR_NM            0x02  /* No media */
86#define IDE_REGISTER_ERROR_AMNF          0x01  /* Address mark not found */
87                                               /* --obsolette in ATA-4 */
88#define IDE_REGISTER_ERROR_MED           0x01  /* Media error is detected */
89
90/*
91 * ide_controller_read_data_block --
92 *     Read data block via controller's data register
93 *
94 * PARAMETERS:
95 *     minor      - minor number of controller
96 *     block_size - number of bytes to read
97 *     bufs       - set of buffers to store data
98 *     cbuf       - number of current buffer from the set
99 *     pos        - position inside current buffer 'cbuf'
100 *
101 * RETURNS:
102 *     NONE
103 */
104void
105ide_controller_read_data_block(rtems_device_minor_number  minor,
106                               uint16_t                   block_size,
107                               blkdev_sg_buffer          *bufs,
108                               uint32_t            *cbuf,
109                               uint32_t            *pos);
110
111/*
112 * ide_controller_write_data_block --
113 *     Write data block via controller's data register
114 *
115 * PARAMETERS:
116 *     minor      - minor number of controller
117 *     block_size - number of bytes to write
118 *     bufs       - set of buffers which store data
119 *     cbuf       - number of current buffer from the set
120 *     pos        - position inside current buffer 'cbuf'
121 *
122 * RETURNS:
123 *     NONE
124 */
125void
126ide_controller_write_data_block(rtems_device_minor_number  minor,
127                                uint16_t                   block_size,
128                                blkdev_sg_buffer          *bufs,
129                               uint32_t             *cbuf,
130                               uint32_t             *pos);
131
132/*
133 * ide_controller_read_register --
134 *     Read controller's register
135 *
136 * PARAMETERS:
137 *     minor - minor number of controller
138 *     reg   - register to read
139 *     value - placeholder for result
140 *
141 * RETURNS
142 *     NONE
143 */
144void
145ide_controller_read_register(rtems_device_minor_number  minor,
146                             int                        reg, 
147                             uint16_t                  *value);
148
149/*
150 * ide_controller_write_register --
151 *     Write controller's register
152 *
153 * PARAMETERS:
154 *     minor - minor number of controller
155 *     reg   - register to write
156 *     value - value to write
157 *
158 * RETURNS:
159 *     NONE
160 */
161void
162ide_controller_write_register(rtems_device_minor_number minor,
163                              int reg, uint16_t   value);
164
165/*
166 * ide_controller_config_io_speed --
167 *     Set controller's speed of IO operations
168 *
169 * PARAMETERS:
170 *     minor         - minor number of controller
171 *     modes_avaible - speeds available
172 *
173 * RETURNS:
174 *     RTEMS_SUCCESSFUL on success, or error code if
175 *     error occured
176 */
177rtems_status_code
178ide_controller_config_io_speed(int minor, uint8_t   modes_avaible);
179
180#ifdef __cplusplus
181}
182#endif
183
184
185#endif /* __IDE_CTRL_IO_H__ */
Note: See TracBrowser for help on using the repository browser.