source: rtems-docs/bsp-howto/ide_controller.rst @ 969e60e

5
Last change on this file since 969e60e was cb0f55a, checked in by Sebastian Huber <sebastian.huber@…>, on 04/26/18 at 07:05:20

Update due to BSP source reorganization

This patch is a part of the BSP source reorganization.

Close #3285.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. COMMENT: COPYRIGHT (c) 1988-2002.
4.. COMMENT: On-Line Applications Research Corporation (OAR).
5.. COMMENT: All rights reserved.
6
7IDE Controller Driver
8*********************
9
10.. warning::
11
12   The ATA/IDE Drivers are out of date and should not be used for new BSPs.
13   The preferred alternative is to port the ATA/SATA/SCSI/NVMe support from
14   FreeBSD to RTEMS using the `libbsd <https://git.rtems.org/rtems-libbsd>`_.
15   Ask on the mailing list if you plan to write a driver for an ATA/IDE device.
16
17Introduction
18============
19
20The IDE Controller driver is responsible for providing an interface to an IDE
21Controller.  The capabilities provided by this driver are:
22
23- Read IDE Controller register
24
25- Write IDE Controller register
26
27- Read data block through IDE Controller Data Register
28
29- Write data block through IDE Controller Data Register
30
31The reference implementation for an IDE Controller driver can be found in
32``bsps/shared/dev/ide``. This driver is based on the libchip
33concept and allows to work with any of the IDE Controller chips simply by
34appropriate configuration of BSP. Drivers for a particular IDE Controller chips
35locate in the following directories: drivers for well-known IDE Controller
36chips locate into ``bsps/shared/dev/ide``
37and drivers for custom IDE
38Controller chips (for example, implemented on FPGA) locate into
39``bsps/${RTEMS_CPU}/${RTEMS_BSP/ata``.  There is a README file in these
40directories for each supported IDE Controller chip. Each of these README
41explains how to configure a BSP for that particular IDE Controller chip.
42
43Initialization
44==============
45
46IDE Controller chips used by a BSP are statically configured into
47``IDE_Controller_Table``. The ``ide_controller_initialize`` routine is
48responsible for initialization of all configured IDE controller chips.
49Initialization order of the chips based on the order the chips are defined in
50the ``IDE_Controller_Table``.
51
52The following actions are performed by the IDE Controller driver initialization
53routine:
54
55.. code-block:: c
56
57    rtems_device_driver ide_controller_initialize(
58      rtems_device_major_number  major,
59      rtems_device_minor_number  minor_arg,
60      void                      *arg
61    )
62    {
63      for each IDE Controller chip configured in IDE_Controller_Table
64        if (BSP dependent probe(if exists) AND device probe for this IDE chip
65            indicates it is present)
66          perform initialization of the particular chip
67          register device with configured name for this chip
68    }
69
70Read IDE Controller Register
71============================
72
73The ``ide_controller_read_register`` routine reads the content of the IDE
74Controller chip register. IDE Controller chip is selected via the minor
75number. This routine is not allowed to be called from an application.
76
77.. code-block:: c
78
79    void ide_controller_read_register(
80      rtems_device_minor_number  minor,
81      unsigned32                 reg,
82      unsigned32                *value
83    )
84    {
85      get IDE Controller chip configuration information from
86      IDE_Controller_Table by minor number
87
88      invoke read register routine for the chip
89    }
90
91Write IDE Controller Register
92=============================
93
94The ``ide_controller_write_register`` routine writes IDE Controller chip
95register with specified value. IDE Controller chip is selected via the minor
96number. This routine is not allowed to be called from an application.
97
98.. code-block:: c
99
100    void ide_controller_write_register(
101      rtems_device_minor_number minor,
102      unsigned32                reg,
103      unsigned32                value
104    )
105    {
106      get IDE Controller chip configuration information from
107      IDE_Controller_Table by minor number
108
109      invoke write register routine for the chip
110    }
111
112Read Data Block Through IDE Controller Data Register
113====================================================
114
115The ``ide_controller_read_data_block`` provides multiple consequent read of the
116IDE Controller Data Register. IDE Controller chip is selected via the minor
117number. The same functionality may be achieved via separate multiple calls of
118``ide_controller_read_register`` routine but ``ide_controller_read_data_block``
119allows to escape functions call overhead. This routine is not allowed to be
120called from an application.
121
122.. code-block:: c
123
124    void ide_controller_read_data_block(
125      rtems_device_minor_number  minor,
126      unsigned16                 block_size,
127      blkdev_sg_buffer          *bufs,
128      uint32_t                  *cbuf,
129      uint32_t                  *pos
130    )
131    {
132      get IDE Controller chip configuration information from
133      IDE_Controller_Table by minor number
134
135      invoke read data block routine for the chip
136    }
137
138Write Data Block Through IDE Controller Data Register
139=====================================================
140
141The ``ide_controller_write_data_block`` provides multiple consequent write into
142the IDE Controller Data Register. IDE Controller chip is selected via the minor
143number. The same functionality may be achieved via separate multiple calls of
144``ide_controller_write_register`` routine but
145``ide_controller_write_data_block`` allows to escape functions call
146overhead. This routine is not allowed to be called from an application.
147
148.. code-block:: c
149
150    void ide_controller_write_data_block(
151      rtems_device_minor_number  minor,
152      unsigned16                 block_size,
153      blkdev_sg_buffer          *bufs,
154      uint32_t                  *cbuf,
155      uint32_t                  *pos
156    )
157    {
158      get IDE Controller chip configuration information from
159      IDE_Controller_Table by minor number
160
161      invoke write data block routine for the chip
162    }
Note: See TracBrowser for help on using the repository browser.