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