1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | #if HAVE_CONFIG_H1 |
15 | #include "config.h" |
16 | #endif |
17 | |
18 | #include <rtems/system.h> |
19 | #include <rtems/config.h> |
20 | #include <rtems/io.h> |
21 | #include <rtems/score/isr.h> |
22 | #include <rtems/score/thread.h> |
23 | #include <rtems/score/wkspace.h> |
24 | |
25 | #include <string.h> |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | void _IO_Manager_initialization(void) |
37 | { |
38 | uint32_t index; |
39 | rtems_driver_address_table *driver_table; |
40 | uint32_t drivers_in_table; |
41 | uint32_t number_of_drivers; |
42 | |
43 | driver_table = Configuration.Device_driver_table; |
44 | drivers_in_table = Configuration.number_of_device_drivers; |
45 | number_of_drivers = Configuration.maximum_drivers; |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | if ( number_of_drivers <= drivers_in_table ) |
52 | number_of_drivers = drivers_in_table; |
53 | |
54 | |
55 | |
56 | |
57 | |
58 | |
59 | if ( number_of_drivers == drivers_in_table ) { |
60 | _IO_Driver_address_table = driver_table; |
61 | _IO_Number_of_drivers = number_of_drivers; |
62 | return; |
63 | } |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 | _IO_Driver_address_table = (rtems_driver_address_table *) |
71 | _Workspace_Allocate_or_fatal_error( |
72 | sizeof( rtems_driver_address_table ) * ( number_of_drivers ) |
73 | ); |
74 | _IO_Number_of_drivers = number_of_drivers; |
75 | |
76 | memset( |
77 | _IO_Driver_address_table, 0, |
78 | sizeof( rtems_driver_address_table ) * ( number_of_drivers ) |
79 | ); |
80 | |
81 | for ( index = 0 ; index < drivers_in_table ; index++ ) |
82 | _IO_Driver_address_table[index] = driver_table[index]; |
83 | number_of_drivers = drivers_in_table; |
| Value stored to 'number_of_drivers' is never read |
84 | } |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | |
93 | |
94 | |
95 | |
96 | void _IO_Initialize_all_drivers( void ) |
97 | { |
98 | rtems_device_major_number major; |
99 | |
100 | for ( major=0 ; major < _IO_Number_of_drivers ; major ++ ) |
101 | (void) rtems_io_initialize( major, 0, NULL((void*)0) ); |
102 | } |