RTEMS 6.1-rc2
Loading...
Searching...
No Matches
inittask.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
15/*
16 * Copyright (C) 2020 embedded brains GmbH & Co. KG
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in the
25 * documentation and/or other materials provided with the distribution.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef _RTEMS_CONFDEFS_INITTASK_H
41#define _RTEMS_CONFDEFS_INITTASK_H
42
43#ifndef __CONFIGURATION_TEMPLATE_h
44#error "Do not include this file directly, use <rtems/confdefs.h> instead"
45#endif
46
47#ifdef CONFIGURE_INIT
48
49#define _CONFIGURE_ASSERT_NOT_NULL( _type, _value ) \
50 ( ( _value ) != NULL ? ( _value ) : \
51 ( _type ) sizeof( int[ ( _value ) != NULL ? 1 : -1 ] ) )
52
53#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
54
57#include <rtems/rtems/object.h>
59#include <rtems/sysinit.h>
60
61#ifndef CONFIGURE_INIT_TASK_ATTRIBUTES
62 #define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_DEFAULT_ATTRIBUTES
63#endif
64
65#ifndef CONFIGURE_INIT_TASK_INITIAL_MODES
66 #ifdef RTEMS_SMP
67 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
68 #else
69 #define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_NO_PREEMPT
70 #endif
71#endif
72
73#ifndef CONFIGURE_INIT_TASK_NAME
74 #define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'U', 'I', '1', ' ' )
75#endif
76
77#ifndef CONFIGURE_INIT_TASK_PRIORITY
78 #define CONFIGURE_INIT_TASK_PRIORITY 1
79#endif
80
81#ifdef __cplusplus
82extern "C" {
83#endif
84
85#ifndef CONFIGURE_INIT_TASK_ENTRY_POINT
87 #define CONFIGURE_INIT_TASK_ENTRY_POINT Init
88
89 #ifndef CONFIGURE_INIT_TASK_ARGUMENTS
90 extern const char *bsp_boot_cmdline;
91 #define CONFIGURE_INIT_TASK_ARGUMENTS \
92 ( (rtems_task_argument) &bsp_boot_cmdline )
93 #endif
94#endif
95
96#ifndef CONFIGURE_INIT_TASK_ARGUMENTS
97 #define CONFIGURE_INIT_TASK_ARGUMENTS 0
98#endif
99
100/*
101 * Ignore the following warnings from g++ and clang in the uses of
102 * _CONFIGURE_ASSERT_NOT_NULL() below:
103 *
104 * warning: the address of 'void Init()' will never be NULL [-Waddress]
105 *
106 * warning: comparison of function 'Init' not equal to a null pointer is always
107 * true [-Wtautological-pointer-compare]
108 */
109#pragma GCC diagnostic push
110#pragma GCC diagnostic ignored "-Waddress"
111#pragma GCC diagnostic ignored "-Wpragmas"
112#pragma GCC diagnostic ignored "-Wtautological-pointer-compare"
113
114#ifdef CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
115
116#ifdef CONFIGURE_INIT_TASK_STACK_SIZE
117 #error "CONFIGURE_INIT_TASK_STACK_SIZE and CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE are mutually exclusive"
118#endif
119
122 CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE_IS_TOO_SMALL
123);
124
125static RTEMS_SECTION( ".rtemsstack.userinit" )
127char _RTEMS_tasks_User_task_storage[ CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE ];
128
130 {
133 _RTEMS_tasks_User_task_storage,
134 sizeof( _RTEMS_tasks_User_task_storage ),
136 NULL,
139 },
140 _CONFIGURE_ASSERT_NOT_NULL(
143 ),
145};
146
149 RTEMS_SYSINIT_CLASSIC_USER_TASKS,
150 RTEMS_SYSINIT_ORDER_MIDDLE
151);
152
153#else /* CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE */
154
155#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
156 #define CONFIGURE_INIT_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
157#elif CONFIGURE_INIT_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
158 #error "CONFIGURE_INIT_TASK_STACK_SIZE must be greater than or equal to CONFIGURE_MINIMUM_TASK_STACK_SIZE"
159#endif
160
161#if CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE
162 #define _CONFIGURE_INIT_TASK_STACK_EXTRA \
163 ( CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE )
164#endif
165
171 _CONFIGURE_ASSERT_NOT_NULL(
174 ),
177};
178
181 RTEMS_SYSINIT_CLASSIC_USER_TASKS,
182 RTEMS_SYSINIT_ORDER_MIDDLE
183);
184
185#endif /* CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE */
186
187#pragma GCC diagnostic pop
188
189#ifdef __cplusplus
190}
191#endif
192
193#endif /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
194
195#ifndef _CONFIGURE_INIT_TASK_STACK_EXTRA
196 #define _CONFIGURE_INIT_TASK_STACK_EXTRA 0
197#endif
198
199#endif /* CONFIGURE_INIT */
200
201#endif /* _RTEMS_CONFDEFS_INITTASK_H */
This header file evaluates configuration options related to the per-CPU configuration.
#define RTEMS_SECTION(_section)
Instructs the compiler to place the variable or function in the section.
Definition: basedefs.h:411
#define RTEMS_STATIC_ASSERT(_cond, _msg)
It is defined if a static analysis run is performed.
Definition: basedefs.h:841
rtems_task(* rtems_task_entry)(rtems_task_argument)
This type defines the task entry point of an RTEMS task.
Definition: tasks.h:239
#define RTEMS_TASK_STORAGE_ALIGNMENT
This compile time constant defines the recommended alignment of a task storage area in bytes.
Definition: tasks.h:365
void rtems_task
This type defines the return type of task entry points.
Definition: tasks.h:230
CPU_Uint32ptr rtems_task_argument
This integer type represents task argument values.
Definition: tasks.h:100
#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_INIT_TASK_PRIORITY
This configuration option is an integer define.
Definition: appl-config.h:1062
#define CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
This configuration option is an integer define.
Definition: appl-config.h:978
#define CONFIGURE_INIT_TASK_NAME
This configuration option is an integer define.
Definition: appl-config.h:1042
#define CONFIGURE_INIT_TASK_ARGUMENTS
This configuration option is an integer define.
Definition: appl-config.h:903
#define CONFIGURE_INIT_TASK_ATTRIBUTES
This configuration option is an integer define.
Definition: appl-config.h:921
#define CONFIGURE_INIT_TASK_STACK_SIZE
This configuration option is an integer define.
Definition: appl-config.h:1101
#define CONFIGURE_INIT_TASK_INITIAL_MODES
This configuration option is an integer define.
Definition: appl-config.h:1020
#define CONFIGURE_INIT_TASK_ENTRY_POINT
This configuration option is an initializer define.
Definition: appl-config.h:1001
#define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE
This configuration option is an integer define.
Definition: appl-config.h:3007
#define CONFIGURE_MINIMUM_TASK_STACK_SIZE
This configuration option is an integer define.
Definition: appl-config.h:3271
const char * bsp_boot_cmdline
Global pointer to the command line of boot_card().
Definition: bootcard.c:44
const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table
Initialization table for the first user task.
Definition: taskinitdefault.c:43
void _RTEMS_tasks_Construct_user_task(void)
Constructs and starts the Classic API initialization task using rtems_task_construct() and the config...
Definition: taskconstructuser.c:46
void _RTEMS_tasks_Initialize_user_task(void)
Creates and starts the Classic API initialization task using rtems_task_create() and the configuratio...
Definition: taskinitusers.c:47
const RTEMS_tasks_User_task_config _RTEMS_tasks_User_task_config
This structure provides the configuration of the Classic API initialization task.
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
This header file provides the Object Services API.
Definition: cpu.h:277
This structure provides the configuration to construct and start the Classic API initialization task.
Definition: tasksdata.h:96
This structure defines the properties of the Classic API user initialization task.
Definition: tasks.h:249
This header file provides the API of the System Initialization Support.
This header file provides data structures used by the implementation and the Application Configuratio...
This header file evaluates configuration options related to the thread configuration.