RTEMS 6.1-rc5
Loading...
Searching...
No Matches
iodrivers.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
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_EXTRA_DRIVERS)
64#define _CONFIGURE_HAS_IO_DRIVERS
65#endif
66
67#if defined(_CONFIGURE_HAS_IO_DRIVERS) || \
68 defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) || \
69 CONFIGURE_MAXIMUM_DRIVERS > 0
70
71#include <rtems/ioimpl.h>
72#include <rtems/sysinit.h>
73
74#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
75 #if defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) \
76 || defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER)
77 #error "CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER, CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER, and CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER are mutually exclusive"
78 #endif
79
80 #include <rtems/console.h>
81#endif
82
83#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
84 #include <rtems/rtc.h>
85#endif
86
87#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
88 #include <rtems/watchdogdrv.h>
89#endif
90
91#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
92 #include <rtems/framebuffer.h>
93#endif
94
95#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
96 #include <rtems/devnull.h>
97#endif
98
99#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
100 #include <rtems/devzero.h>
101#endif
102
103#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
104 #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
105 #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
106 #endif
107
108 #include <libchip/ide_ctrl.h>
109#endif
110
111#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
112 #include <libchip/ata.h>
113#endif
114
115#ifndef CONFIGURE_MAXIMUM_DRIVERS
116 #define CONFIGURE_MAXIMUM_DRIVERS
117#endif
118
119#define NULL_DRIVER_TABLE_ENTRY { NULL, NULL, NULL, NULL, NULL, NULL }
120
121#ifdef __cplusplus
122extern "C" {
123#endif
124
126_IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
127 #ifdef _CONFIGURE_BSP_PREREQUISITE_DRIVERS
128 _CONFIGURE_BSP_PREREQUISITE_DRIVERS,
129 #endif
130 #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
132 #endif
133 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
134 CONSOLE_DRIVER_TABLE_ENTRY,
135 #endif
136 #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
137 RTC_DRIVER_TABLE_ENTRY,
138 #endif
139 #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
141 #endif
142 #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
143 DEVNULL_DRIVER_TABLE_ENTRY,
144 #endif
145 #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
146 DEVZERO_DRIVER_TABLE_ENTRY,
147 #endif
148 #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
149 IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
150 #endif
151 #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
152 ATA_DRIVER_TABLE_ENTRY,
153 #endif
154 #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
156 #endif
157 #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
159 #endif
160 #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) || \
161 !defined(_CONFIGURE_HAS_IO_DRIVERS)
162 NULL_DRIVER_TABLE_ENTRY
163 #endif
164};
165
166const size_t _IO_Number_of_drivers =
167 RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
168
171 RTEMS_SYSINIT_DEVICE_DRIVERS,
172 RTEMS_SYSINIT_ORDER_MIDDLE
173);
174
175#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
176 #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
177 #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
178 #endif
179
180 rtems_task_priority rtems_ata_driver_task_priority
182#endif
183
184#ifdef __cplusplus
185}
186#endif
187
188#endif /* _CONFIGURE_HAS_IO_DRIVERS) ||
189 CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER ||
190 CONFIGURE_MAXIMUM_DRIVERS */
191
192
193/*
194 * If any flavor of console driver is configured, then configure the post
195 * driver hook which opens /dev/console as stdin, stdout, and stderr.
196 *
197 * NOTE: This also results in an atexit() handler being registered to close
198 * /dev/console.
199 */
200#if defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) || \
201 defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER) || \
202 defined(CONFIGURE_APPLICATION_NEEDS_SIMPLE_TASK_CONSOLE_DRIVER)
203
204 #include <rtems/libio.h>
205
207 rtems_libio_post_driver,
208 RTEMS_SYSINIT_STD_FILE_DESCRIPTORS,
209 RTEMS_SYSINIT_ORDER_MIDDLE
210 );
211#endif
212
213#endif /* CONFIGURE_INIT */
214
215#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.
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