RTEMS
iodrivers.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
11 /*
12  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _RTEMS_CONFDEFS_IODRIVERS_H
37 #define _RTEMS_CONFDEFS_IODRIVERS_H
38 
39 #ifndef __CONFIGURATION_TEMPLATE_h
40 #error "Do not include this file directly, use <rtems/confdefs.h> instead"
41 #endif
42 
43 #ifdef CONFIGURE_INIT
44 
45 #if defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) \
46  || defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) \
47  || defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) \
48  || defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) \
49  || defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) \
50  || defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) \
51  || defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) \
52  || defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) \
53  || defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) \
54  || CONFIGURE_MAXIMUM_DRIVERS > 0
55 
56 #include <rtems/ioimpl.h>
57 #include <rtems/sysinit.h>
58 
59 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
60  #if defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) \
61  || defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER)
62  #error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER, CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER, and CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER are mutually exclusive"
63  #endif
64 
65  #include <rtems/console.h>
66 #endif
67 
68 #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
69  #include <rtems/rtc.h>
70 #endif
71 
72 #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
73  #include <rtems/watchdogdrv.h>
74 #endif
75 
76 #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
77  #include <rtems/framebuffer.h>
78 #endif
79 
80 #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
81  #include <rtems/devnull.h>
82 #endif
83 
84 #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
85  #include <rtems/devzero.h>
86 #endif
87 
88 #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
89  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
90  #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
91  #endif
92 
93  #include <libchip/ide_ctrl.h>
94 #endif
95 
96 #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
97  #include <libchip/ata.h>
98 #endif
99 
100 #ifndef CONFIGURE_MAXIMUM_DRIVERS
101  #define CONFIGURE_MAXIMUM_DRIVERS
102 #endif
103 
104 #define NULL_DRIVER_TABLE_ENTRY { NULL, NULL, NULL, NULL, NULL, NULL }
105 
106 #ifdef __cplusplus
107 extern "C" {
108 #endif
109 
111 _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
112  #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
114  #endif
115  #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
117  #endif
118  #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
119  CONSOLE_DRIVER_TABLE_ENTRY,
120  #endif
121  #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
122  RTC_DRIVER_TABLE_ENTRY,
123  #endif
124  #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
125  WATCHDOG_DRIVER_TABLE_ENTRY,
126  #endif
127  #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
128  DEVNULL_DRIVER_TABLE_ENTRY,
129  #endif
130  #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
131  DEVZERO_DRIVER_TABLE_ENTRY,
132  #endif
133  #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
134  IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
135  #endif
136  #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
137  ATA_DRIVER_TABLE_ENTRY,
138  #endif
139  #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
140  FRAME_BUFFER_DRIVER_TABLE_ENTRY,
141  #endif
142  #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
144  #endif
145  #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) \
146  || ( !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) \
147  && !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) \
148  && !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) \
149  && !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) \
150  && !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) \
151  && !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) \
152  && !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) \
153  && !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) )
154  NULL_DRIVER_TABLE_ENTRY
155  #endif
156 };
157 
158 const size_t _IO_Number_of_drivers =
159  RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
160 
161 RTEMS_SYSINIT_ITEM(
162  _IO_Initialize_all_drivers,
163  RTEMS_SYSINIT_DEVICE_DRIVERS,
164  RTEMS_SYSINIT_ORDER_MIDDLE
165 );
166 
167 #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
168  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
169  #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
170  #endif
171 
172  rtems_task_priority rtems_ata_driver_task_priority
174 #endif
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #endif /* CONFIGURE_APPLICATION_EXTRA_DRIVERS
181  || CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
182  || CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
183  || CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
184  || CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
185  || CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
186  || CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
187  || CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
188  || CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
189  || CONFIGURE_MAXIMUM_DRIVERS */
190 
191 #endif /* CONFIGURE_INIT */
192 
193 #endif /* _RTEMS_CONFDEFS_IODRIVERS_H */
#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY
This configuration option is an integer define.
Definition: appl-config.h:1645
#define CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
This configuration option is an initializer define.
Definition: appl-config.h:1625
uint32_t rtems_task_priority
%
Definition: tasks.h:94
This structure contains the device driver entries.
Definition: io.h:134
#define CONFIGURE_MAXIMUM_DRIVERS
This configuration option is an integer define.
Definition: appl-config.h:1716
#define CONFIGURE_BSP_PREREQUISITE_DRIVERS
This configuration option is an initializer define.
Definition: appl-config.h:480
#define RTEMS_ARRAY_SIZE(_array)
Returns the element count of the specified array.
Definition: basedefs.h:459
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS
This configuration option is an initializer define.
Definition: appl-config.h:1252