RTEMS 6.3
Loading...
Searching...
No Matches
iodrivers.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11
12/*
13 * Copyright (C) 2020 embedded brains GmbH & Co. KG
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _RTEMS_CONFDEFS_IODRIVERS_H
38#define _RTEMS_CONFDEFS_IODRIVERS_H
39
40#ifndef __CONFIGURATION_TEMPLATE_h
41#error "Do not include this file directly, use <rtems/confdefs.h> instead"
42#endif
43
44#ifdef CONFIGURE_INIT
45
46#include <rtems/confdefs/bsp.h>
47
48#if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
49 defined(CONFIGURE_BSP_PREREQUISITE_DRIVERS)
50#define _CONFIGURE_BSP_PREREQUISITE_DRIVERS CONFIGURE_BSP_PREREQUISITE_DRIVERS
51#endif
52
53#if defined(_CONFIGURE_BSP_PREREQUISITE_DRIVERS) || \
54 defined(CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS) || \
55 defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) || \
56 defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) || \
57 defined(CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER) || \
58 defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) || \
59 defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) || \
60 defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) || \
61 defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) || \
62 defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) || \
63 defined(CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER) || \
64 defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
65#define _CONFIGURE_HAS_IO_DRIVERS
66#endif
67
68#if defined(_CONFIGURE_HAS_IO_DRIVERS) || \
69 defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) || \
70 CONFIGURE_MAXIMUM_DRIVERS > 0
71
72#include <rtems/ioimpl.h>
73#include <rtems/sysinit.h>
74
75#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
76 #if defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) \
77 || defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER)
78 #error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER, CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER, and CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER are mutually exclusive"
79 #endif
80
81 #include <rtems/console.h>
82#endif
83
84#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
85 #include <rtems/rtc.h>
86#endif
87
88#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
89 #include <rtems/watchdogdrv.h>
90#endif
91
92#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
93 #include <rtems/framebuffer.h>
94#endif
95
96#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
97 #include <rtems/devnull.h>
98#endif
99
100#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
101 #include <rtems/devzero.h>
102#endif
103
104#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
105 #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
106 #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
107 #endif
108
109 #include <libchip/ide_ctrl.h>
110#endif
111
112#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
113 #include <libchip/ata.h>
114#endif
115
116#ifdef CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER
117 #include <rtems/libi2c.h>
118#endif
119
120#ifndef CONFIGURE_MAXIMUM_DRIVERS
121 #define CONFIGURE_MAXIMUM_DRIVERS
122#endif
123
124#define NULL_DRIVER_TABLE_ENTRY { NULL, NULL, NULL, NULL, NULL, NULL }
125
126#ifdef __cplusplus
127extern "C" {
128#endif
129
131_IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
132 #ifdef _CONFIGURE_BSP_PREREQUISITE_DRIVERS
133 _CONFIGURE_BSP_PREREQUISITE_DRIVERS,
134 #endif
135 #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
137 #endif
138 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
139 CONSOLE_DRIVER_TABLE_ENTRY,
140 #endif
141 #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
142 RTC_DRIVER_TABLE_ENTRY,
143 #endif
144 #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
146 #endif
147 #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
148 DEVNULL_DRIVER_TABLE_ENTRY,
149 #endif
150 #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
151 DEVZERO_DRIVER_TABLE_ENTRY,
152 #endif
153 #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
154 IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
155 #endif
156 #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
157 ATA_DRIVER_TABLE_ENTRY,
158 #endif
159 #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
161 #endif
162 #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
164 #endif
165 #ifdef CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER
166 RTEMS_LIBI2C_DRIVER_TABLE_ENTRY,
167 #endif
168 #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) || \
169 !defined(_CONFIGURE_HAS_IO_DRIVERS)
170 NULL_DRIVER_TABLE_ENTRY
171 #endif
172};
173
174const size_t _IO_Number_of_drivers =
175 RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
176
179 RTEMS_SYSINIT_DEVICE_DRIVERS,
180 RTEMS_SYSINIT_ORDER_MIDDLE
181);
182
183#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
184 #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
185 #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
186 #endif
187
188 rtems_task_priority rtems_ata_driver_task_priority
190#endif
191
192#ifdef __cplusplus
193}
194#endif
195
196#endif /* _CONFIGURE_HAS_IO_DRIVERS) ||
197 CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER ||
198 CONFIGURE_MAXIMUM_DRIVERS */
199
200
201/*
202 * If any flavor of console driver is configured, then configure the post
203 * driver hook which opens /dev/console as stdin, stdout, and stderr.
204 *
205 * NOTE: This also results in an atexit() handler being registered to close
206 * /dev/console.
207 */
208#if defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) || \
209 defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) || \
210 defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER)
211
212 #include <rtems/libio.h>
213
215 rtems_libio_post_driver,
216 RTEMS_SYSINIT_STD_FILE_DESCRIPTORS,
217 RTEMS_SYSINIT_ORDER_MIDDLE
218 );
219#endif
220
221#endif /* CONFIGURE_INIT */
222
223#endif /* _RTEMS_CONFDEFS_IODRIVERS_H */
This header file evaluates configuration options related to the BSP configuration.
Console Driver for all Boards.
Real-Time Clock Driver Interface.
RTEMS /dev/null Device Driver.
RTEMS /dev/zero Device Driver.
Frame Buffer Device Driver for all Boards.
#define FRAME_BUFFER_DRIVER_TABLE_ENTRY
Definition framebuffer.h:64
#define RTEMS_ARRAY_SIZE(_array)
Gets the element count of the array.
Definition basedefs.h:244
uint32_t rtems_task_priority
This integer type represents task priorities of the Classic API.
Definition types.h:257
#define RTEMS_SYSINIT_ITEM(handler, module, order)
Creates the system initialization item associated with the handler, module, and order.
Definition sysinit.h:204
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS
This configuration option is an initializer define.
Definition appl-config.h:1213
#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY
This configuration option is an integer define.
Definition appl-config.h:1637
#define CONFIGURE_MAXIMUM_DRIVERS
This configuration option is an integer define.
Definition appl-config.h:1736
#define CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
This configuration option is an initializer define.
Definition appl-config.h:1614
void _IO_Initialize_all_drivers(void)
Initialization of all device drivers.
Definition io.c:47
This header file provides interfaces used by the I/O Manager implementation.
Legacy I2C Library.
Basic IO API.
This structure contains the device driver entries.
Definition io.h:140
This header file provides the API of the System Initialization Support.
#define WATCHDOG_DRIVER_TABLE_ENTRY
Definition watchdogdrv.h:49