source: rtems-docs/bsp_howto/ide_controller.rst @ a1c7180

4.115
Last change on this file since a1c7180 was 6d7a4d2, checked in by Chris Johns <chrisj@…>, on 06/17/16 at 05:05:41

Update the BSP howto.

Closes #2590.

  • Property mode set to 100644
File size: 5.4 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
10Introduction
11============
12
13The IDE Controller driver is responsible for providing an interface to an IDE
14Controller.  The capabilities provided by this driver are:
15
16- Read IDE Controller register
17
18- Write IDE Controller register
19
20- Read data block through IDE Controller Data Register
21
22- Write data block through IDE Controller Data Register
23
24The reference implementation for an IDE Controller driver can be found in
25``$RTEMS_SRC_ROOT/c/src/libchip/ide``. This driver is based on the libchip
26concept and allows to work with any of the IDE Controller chips simply by
27appropriate configuration of BSP. Drivers for a particular IDE Controller chips
28locate in the following directories: drivers for well-known IDE Controller
29chips locate into ``$RTEMS_SRC_ROOT/c/src/libchip/ide``, drivers for IDE
30Controller chips integrated with CPU locate into
31``$RTEMS_SRC_ROOT/c/src/lib/libcpu/myCPU`` and drivers for custom IDE
32Controller chips (for example, implemented on FPGA) locate into
33``$RTEMS_SRC_ROOT/c/src/lib/libbsp/myBSP``.  There is a README file in these
34directories for each supported IDE Controller chip. Each of these README
35explains how to configure a BSP for that particular IDE Controller chip.
36
37Initialization
38==============
39
40IDE Controller chips used by a BSP are statically configured into
41``IDE_Controller_Table``. The ``ide_controller_initialize`` routine is
42responsible for initialization of all configured IDE controller chips.
43Initialization order of the chips based on the order the chips are defined in
44the ``IDE_Controller_Table``.
45
46The following actions are performed by the IDE Controller driver initialization
47routine:
48
49.. code-block:: c
50
51    rtems_device_driver ide_controller_initialize(
52      rtems_device_major_number  major,
53      rtems_device_minor_number  minor_arg,
54      void                      *arg
55    )
56    {
57      for each IDE Controller chip configured in IDE_Controller_Table
58        if (BSP dependent probe(if exists) AND device probe for this IDE chip
59            indicates it is present)
60          perform initialization of the particular chip
61          register device with configured name for this chip
62    }
63
64Read IDE Controller Register
65============================
66
67The ``ide_controller_read_register`` routine reads the content of the IDE
68Controller chip register. IDE Controller chip is selected via the minor
69number. This routine is not allowed to be called from an application.
70
71.. code-block:: c
72
73    void ide_controller_read_register(
74      rtems_device_minor_number  minor,
75      unsigned32                 reg,
76      unsigned32                *value
77    )
78    {
79      get IDE Controller chip configuration information from
80      IDE_Controller_Table by minor number
81
82      invoke read register routine for the chip
83    }
84
85Write IDE Controller Register
86=============================
87
88The ``ide_controller_write_register`` routine writes IDE Controller chip
89register with specified value. IDE Controller chip is selected via the minor
90number. This routine is not allowed to be called from an application.
91
92.. code-block:: c
93
94    void ide_controller_write_register(
95      rtems_device_minor_number minor,
96      unsigned32                reg,
97      unsigned32                value
98    )
99    {
100      get IDE Controller chip configuration information from
101      IDE_Controller_Table by minor number
102
103      invoke write register routine for the chip
104    }
105
106Read Data Block Through IDE Controller Data Register
107====================================================
108
109The ``ide_controller_read_data_block`` provides multiple consequent read of the
110IDE Controller Data Register. IDE Controller chip is selected via the minor
111number. The same functionality may be achieved via separate multiple calls of
112``ide_controller_read_register`` routine but ``ide_controller_read_data_block``
113allows to escape functions call overhead. This routine is not allowed to be
114called from an application.
115
116.. code-block:: c
117
118    void ide_controller_read_data_block(
119      rtems_device_minor_number  minor,
120      unsigned16                 block_size,
121      blkdev_sg_buffer          *bufs,
122      uint32_t                  *cbuf,
123      uint32_t                  *pos
124    )
125    {
126      get IDE Controller chip configuration information from
127      IDE_Controller_Table by minor number
128
129      invoke read data block routine for the chip
130    }
131
132Write Data Block Through IDE Controller Data Register
133=====================================================
134
135The ``ide_controller_write_data_block`` provides multiple consequent write into
136the IDE Controller Data Register. IDE Controller chip is selected via the minor
137number. The same functionality may be achieved via separate multiple calls of
138``ide_controller_write_register`` routine but
139``ide_controller_write_data_block`` allows to escape functions call
140overhead. This routine is not allowed to be called from an application.
141
142.. code-block:: c
143
144    void ide_controller_write_data_block(
145      rtems_device_minor_number  minor,
146      unsigned16                 block_size,
147      blkdev_sg_buffer          *bufs,
148      uint32_t                  *cbuf,
149      uint32_t                  *pos
150    )
151    {
152      get IDE Controller chip configuration information from
153      IDE_Controller_Table by minor number
154
155      invoke write data block routine for the chip
156    }
Note: See TracBrowser for help on using the repository browser.