source: rtems/cpukit/include/rtems/confdefs/iodrivers.h @ c36fae22

Last change on this file since c36fae22 was c36fae22, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 25, 2020 at 12:47:59 PM

config: Initialize IO drivers on demand

  • Property mode set to 100644
File size: 6.4 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSApplicationConfiguration
7 *
8 * @brief Evaluate IO Driver Configuration Options
9 */
10
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_TIMER_DRIVER
69  #include <rtems/btimer.h>
70#endif
71
72#ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
73  #include <rtems/rtc.h>
74#endif
75
76#ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
77  #include <rtems/watchdogdrv.h>
78#endif
79
80#ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
81  #include <rtems/framebuffer.h>
82#endif
83
84#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
85  #include <rtems/devnull.h>
86#endif
87
88#ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
89  #include <rtems/devzero.h>
90#endif
91
92#ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
93  #ifndef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
94    #define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
95  #endif
96
97  #include <libchip/ide_ctrl.h>
98#endif
99
100#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
101  #include <libchip/ata.h>
102#endif
103
104#ifndef CONFIGURE_MAXIMUM_DRIVERS
105  #define CONFIGURE_MAXIMUM_DRIVERS
106#endif
107
108#define NULL_DRIVER_TABLE_ENTRY { NULL, NULL, NULL, NULL, NULL, NULL }
109
110#ifdef __cplusplus
111extern "C" {
112#endif
113
114rtems_driver_address_table
115_IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
116  #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
117    CONFIGURE_BSP_PREREQUISITE_DRIVERS,
118  #endif
119  #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
120    CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
121  #endif
122  #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
123    CONSOLE_DRIVER_TABLE_ENTRY,
124  #endif
125  #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
126    RTC_DRIVER_TABLE_ENTRY,
127  #endif
128  #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
129    WATCHDOG_DRIVER_TABLE_ENTRY,
130  #endif
131  #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
132    DEVNULL_DRIVER_TABLE_ENTRY,
133  #endif
134  #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
135    DEVZERO_DRIVER_TABLE_ENTRY,
136  #endif
137  #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
138    IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
139  #endif
140  #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
141    ATA_DRIVER_TABLE_ENTRY,
142  #endif
143  #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
144    FRAME_BUFFER_DRIVER_TABLE_ENTRY,
145  #endif
146  #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
147    CONFIGURE_APPLICATION_EXTRA_DRIVERS,
148  #endif
149  #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) \
150    || ( !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) \
151      && !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) \
152      && !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) \
153      && !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) \
154      && !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) \
155      && !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) \
156      && !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) \
157      && !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) )
158    NULL_DRIVER_TABLE_ENTRY
159  #endif
160};
161
162const size_t _IO_Number_of_drivers =
163  RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
164
165RTEMS_SYSINIT_ITEM(
166  _IO_Initialize_all_drivers,
167  RTEMS_SYSINIT_DEVICE_DRIVERS,
168  RTEMS_SYSINIT_ORDER_MIDDLE
169);
170
171#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
172  #ifndef CONFIGURE_ATA_DRIVER_TASK_PRIORITY
173    #define CONFIGURE_ATA_DRIVER_TASK_PRIORITY ATA_DRIVER_TASK_DEFAULT_PRIORITY
174  #endif
175
176  rtems_task_priority rtems_ata_driver_task_priority
177    = CONFIGURE_ATA_DRIVER_TASK_PRIORITY;
178#endif
179
180#ifdef __cplusplus
181}
182#endif
183
184#endif /* CONFIGURE_APPLICATION_EXTRA_DRIVERS
185  || CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
186  || CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
187  || CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
188  || CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
189  || CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
190  || CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
191  || CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
192  || CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
193  || CONFIGURE_MAXIMUM_DRIVERS */
194
195#endif /* CONFIGURE_INIT */
196
197#endif /* _RTEMS_CONFDEFS_IODRIVERS_H */
Note: See TracBrowser for help on using the repository browser.