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