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 | |
---|
7 | IDE Controller Driver |
---|
8 | ##################### |
---|
9 | |
---|
10 | Introduction |
---|
11 | ============ |
---|
12 | |
---|
13 | The IDE Controller driver is responsible for providing an interface to an IDE |
---|
14 | Controller. 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 | |
---|
24 | The 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 |
---|
26 | concept and allows to work with any of the IDE Controller chips simply by |
---|
27 | appropriate configuration of BSP. Drivers for a particular IDE Controller chips |
---|
28 | locate in the following directories: drivers for well-known IDE Controller |
---|
29 | chips locate into ``$RTEMS_SRC_ROOT/c/src/libchip/ide``, drivers for IDE |
---|
30 | Controller chips integrated with CPU locate into |
---|
31 | ``$RTEMS_SRC_ROOT/c/src/lib/libcpu/myCPU`` and drivers for custom IDE |
---|
32 | Controller chips (for example, implemented on FPGA) locate into |
---|
33 | ``$RTEMS_SRC_ROOT/c/src/lib/libbsp/myBSP``. There is a README file in these |
---|
34 | directories for each supported IDE Controller chip. Each of these README |
---|
35 | explains how to configure a BSP for that particular IDE Controller chip. |
---|
36 | |
---|
37 | Initialization |
---|
38 | ============== |
---|
39 | |
---|
40 | IDE Controller chips used by a BSP are statically configured into |
---|
41 | ``IDE_Controller_Table``. The ``ide_controller_initialize`` routine is |
---|
42 | responsible for initialization of all configured IDE controller chips. |
---|
43 | Initialization order of the chips based on the order the chips are defined in |
---|
44 | the ``IDE_Controller_Table``. |
---|
45 | |
---|
46 | The following actions are performed by the IDE Controller driver initialization |
---|
47 | routine: |
---|
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 | |
---|
64 | Read IDE Controller Register |
---|
65 | ============================ |
---|
66 | |
---|
67 | The ``ide_controller_read_register`` routine reads the content of the IDE |
---|
68 | Controller chip register. IDE Controller chip is selected via the minor |
---|
69 | number. 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 | |
---|
85 | Write IDE Controller Register |
---|
86 | ============================= |
---|
87 | |
---|
88 | The ``ide_controller_write_register`` routine writes IDE Controller chip |
---|
89 | register with specified value. IDE Controller chip is selected via the minor |
---|
90 | number. 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 | |
---|
106 | Read Data Block Through IDE Controller Data Register |
---|
107 | ==================================================== |
---|
108 | |
---|
109 | The ``ide_controller_read_data_block`` provides multiple consequent read of the |
---|
110 | IDE Controller Data Register. IDE Controller chip is selected via the minor |
---|
111 | number. The same functionality may be achieved via separate multiple calls of |
---|
112 | ``ide_controller_read_register`` routine but ``ide_controller_read_data_block`` |
---|
113 | allows to escape functions call overhead. This routine is not allowed to be |
---|
114 | called 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 | |
---|
132 | Write Data Block Through IDE Controller Data Register |
---|
133 | ===================================================== |
---|
134 | |
---|
135 | The ``ide_controller_write_data_block`` provides multiple consequent write into |
---|
136 | the IDE Controller Data Register. IDE Controller chip is selected via the minor |
---|
137 | number. 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 |
---|
140 | overhead. 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 | } |
---|