1 | DRIVER MANAGER |
---|
2 | ============== |
---|
3 | |
---|
4 | See documentation in Aeroflex Gaisler Driver manual. |
---|
5 | |
---|
6 | |
---|
7 | INITIALIZATION |
---|
8 | ============== |
---|
9 | The Driver Manager can be intialized in two different ways: |
---|
10 | 1. during RTEMS startup |
---|
11 | 2. started by user, typically in the Init task |
---|
12 | |
---|
13 | The driver manager is initalized during RTEMS startup in the |
---|
14 | rtems_initialize_device_drivers() function when RTEMS is |
---|
15 | configured with driver manager support. |
---|
16 | |
---|
17 | When RTEMS is not configured with the driver manager, the manager |
---|
18 | may still be initialized by the user after system startup, typically |
---|
19 | from the Init() task. |
---|
20 | |
---|
21 | The main difference between the two ways is when interrupt |
---|
22 | is enabled. Interrupt is enabled for the first time by RTEMS when |
---|
23 | the Init task is started. This means, for the first case, that |
---|
24 | drivers can not use interrupt services until after the |
---|
25 | initialization phase is over and the user request services from |
---|
26 | the drivers. For the second case of initialization, this means |
---|
27 | that driver must take extra care during initalization when interrupt |
---|
28 | is enabled so that spurious interrupts are not generated and that the |
---|
29 | system does not hang in an infinite IRQ loop. |
---|
30 | |
---|
31 | Most of the problems above are solved for the two methods by |
---|
32 | specifying in which initialization levels IRQ handling is done. |
---|
33 | See Level 1 and Level 2 below. |
---|
34 | |
---|
35 | Other differences is that IRQ, System Clock Timer, debug Console |
---|
36 | and Console can be initalized by the help of the driver manager |
---|
37 | when initialized during start up. Between Level0 and Level1 the |
---|
38 | RTEMS I/O Manager drivers are initialized. The LEON3 BSP has |
---|
39 | therefore two different versions of the basic drivers. |
---|
40 | |
---|
41 | |
---|
42 | LEVEL0 |
---|
43 | ------ |
---|
44 | The level of uninitialized devices that have been united with a |
---|
45 | driver. |
---|
46 | |
---|
47 | |
---|
48 | LEVEL1 - FIND/RESET/IRQ Clear |
---|
49 | ----------------------------- |
---|
50 | The driver is for the first time informed of the presence of a |
---|
51 | device. Only basic initialization. |
---|
52 | |
---|
53 | - Find all hardware needed for IRQ, Console, Timer and hardware |
---|
54 | that need to be reset. |
---|
55 | - Reset hardware, so that interrupts are not generated by mistake |
---|
56 | when enabled later on. |
---|
57 | - Init low level non-interrupt (polling-mode) services needed by |
---|
58 | drivers init LEVEL2 and onwards, such as |
---|
59 | * Debug UART console for printk() |
---|
60 | * Timer API (non-IRQ) |
---|
61 | * GPIO (non-IRQ) |
---|
62 | * Special non-main memory configuration, washing |
---|
63 | - Register IRQ controller at BSP IRQ library |
---|
64 | - Register Timer for system clock |
---|
65 | - Register Console UART |
---|
66 | |
---|
67 | During this intialization level interrupts may not be registered, |
---|
68 | enabled or disabled at the IRQ controller. But, all IRQ sources |
---|
69 | should be cleared to avoid spurious interrupts later on. |
---|
70 | |
---|
71 | |
---|
72 | AFTER LEVEL1 - if initialized during startup |
---|
73 | -------------------------------------------- |
---|
74 | The statically configured drivers are initialized as normally by RTEMS. The |
---|
75 | hardware was found in LEVEL1. |
---|
76 | |
---|
77 | CONFIGURE_BSP_PREREQUISITE_DRIVERS may initialize IRQ driver, or |
---|
78 | IRQ lib initialized when IRQ controller was registered during LEVEL1. |
---|
79 | |
---|
80 | |
---|
81 | LEVEL2 |
---|
82 | ------ |
---|
83 | Initialize other device drivers than IRQ, Timer, console: |
---|
84 | - ISR can be registered, enabled, disabled at IRQ controller |
---|
85 | (IRQ is still masked by CPU interrupt level if initialized during |
---|
86 | RTEMS startup) |
---|
87 | - Timer API that does not require IRQ can be used |
---|
88 | - printf() can be used |
---|
89 | |
---|
90 | For standard peripherals this is the first initialization. |
---|
91 | |
---|
92 | |
---|
93 | LEVEL3 |
---|
94 | ------ |
---|
95 | Initialize drivers that require features/APIs provided by drivers |
---|
96 | in LEVEL2. |
---|
97 | |
---|
98 | Such features may involve services that require IRQ to be implemented. |
---|
99 | |
---|
100 | |
---|
101 | LEVEL4 |
---|
102 | ------ |
---|
103 | Unused extra level. |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | LEVEL INACTIVE - NOT ENABLED DEVICES |
---|
108 | ------------------------------------ |
---|
109 | List of devices that experienced: |
---|
110 | - no driver found for device (not united) |
---|
111 | - ignored (not united with a driver, forced by user) |
---|
112 | - an error was reported by device driver during initialization |
---|