RTEMS 6.1-rc2
Loading...
Searching...
No Matches
percpu.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
20/*
21 * Copyright (C) 2018, 2020 embedded brains GmbH & Co. KG
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the above copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
36 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGE.
43 */
44
45#ifndef _RTEMS_CONFDEFS_PERCPU_H
46#define _RTEMS_CONFDEFS_PERCPU_H
47
48#ifndef __CONFIGURATION_TEMPLATE_h
49#error "Do not include this file directly, use <rtems/confdefs.h> instead"
50#endif
51
52#ifdef CONFIGURE_INIT
53
54#include <rtems/confdefs/bsp.h>
55#include <rtems/score/context.h>
56#include <rtems/score/percpu.h>
57#include <rtems/score/smp.h>
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63/* Ensure that _CONFIGURE_MAXIMUM_PROCESSORS > 1 only in SMP configurations */
64#if defined(CONFIGURE_MAXIMUM_PROCESSORS) && defined(RTEMS_SMP)
65 #define _CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_MAXIMUM_PROCESSORS
66#else
67 #define _CONFIGURE_MAXIMUM_PROCESSORS 1
68#endif
69
70#ifdef RTEMS_SMP
72 _CONFIGURE_MAXIMUM_PROCESSORS;
73
75 _Per_CPU_Information[ _CONFIGURE_MAXIMUM_PROCESSORS ];
76#endif
77
78/* Interrupt stack configuration */
79
80#ifndef CONFIGURE_INTERRUPT_STACK_SIZE
81 #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
82 defined(BSP_INTERRUPT_STACK_SIZE)
83 #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
84 #else
85 #define CONFIGURE_INTERRUPT_STACK_SIZE CPU_STACK_MINIMUM_SIZE
86 #endif
87#endif
88
89#if CONFIGURE_INTERRUPT_STACK_SIZE % CPU_INTERRUPT_STACK_ALIGNMENT != 0
90 #error "CONFIGURE_INTERRUPT_STACK_SIZE fails to meet the CPU port interrupt stack alignment"
91#endif
92
94 _ISR_Stack_size,
96);
97
98#define _CONFIGURE_INTERRUPT_STACK_AREA_SIZE \
99 ( CONFIGURE_INTERRUPT_STACK_SIZE * _CONFIGURE_MAXIMUM_PROCESSORS )
100
101char _ISR_Stack_area_begin[ _CONFIGURE_INTERRUPT_STACK_AREA_SIZE ]
102RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
103RTEMS_SECTION( ".rtemsstack.interrupt" );
104
108 + _CONFIGURE_INTERRUPT_STACK_AREA_SIZE
109);
110
111/* Thread stack size configuration */
112
113#ifndef CONFIGURE_MINIMUM_TASK_STACK_SIZE
114 #define CONFIGURE_MINIMUM_TASK_STACK_SIZE CPU_STACK_MINIMUM_SIZE
115#endif
116
117#ifndef CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
118 #define CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE \
119 ( 2 * CONFIGURE_MINIMUM_TASK_STACK_SIZE )
120#endif
121
122/* Idle thread configuration */
123
124#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE
125 #if !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && \
126 defined(BSP_IDLE_TASK_STACK_SIZE)
127 #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE
128 #else
129 #define CONFIGURE_IDLE_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
130 #endif
131#endif
132
133#if CONFIGURE_IDLE_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
134 #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than CONFIGURE_MINIMUM_TASK_STACK_SIZE"
135#endif
136
138
139#if defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
140 !defined(CONFIGURE_IDLE_TASK_BODY)
141 #error "If you define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION, then you must define CONFIGURE_IDLE_TASK_BODY as well"
142#endif
143
144#if !defined(CONFIGURE_IDLE_TASK_BODY) && \
145 !defined(CONFIGURE_DISABLE_BSP_SETTINGS) && defined(BSP_IDLE_TASK_BODY)
146 #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
147#endif
148
149#ifdef CONFIGURE_IDLE_TASK_BODY
151#endif
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* CONFIGURE_INIT */
158
159#endif /* _RTEMS_CONFDEFS_PERCPU_H */
This header file provides the interfaces of the Context Handler.
This header file evaluates configuration options related to the BSP configuration.
#define RTEMS_SYMBOL_NAME(_name)
Maps the name to the associated symbol name.
Definition: basedefs.h:861
#define RTEMS_SECTION(_section)
Instructs the compiler to place the variable or function in the section.
Definition: basedefs.h:411
#define RTEMS_ALIGNED(_alignment)
Instructs the compiler in a declaration or definition to enforce the alignment.
Definition: basedefs.h:157
#define RTEMS_DEFINE_GLOBAL_SYMBOL(_name, _value)
Defines a global symbol with the name and value.
Definition: basedefs.h:1015
#define CONFIGURE_INTERRUPT_STACK_SIZE
This configuration option is an integer define.
Definition: appl-config.h:2861
#define CONFIGURE_IDLE_TASK_STACK_SIZE
This configuration option is an integer define.
Definition: appl-config.h:3592
#define CONFIGURE_IDLE_TASK_BODY
This configuration option is an initializer define.
Definition: appl-config.h:3508
const char _ISR_Stack_area_end[]
The interrupt stack area end.
char _ISR_Stack_area_begin[]
The interrupt stack area begin.
CPU_STRUCTURE_ALIGNMENT Per_CPU_Control_envelope _Per_CPU_Information[]
Set of Per CPU Core Information.
Definition: asm.h:171
#define _SMP_Processor_configured_maximum
The configured processor maximum.
Definition: smp.h:68
void *(* Thread_Idle_body)(uintptr_t)
The idle thread body type.
Definition: threadidledata.h:64
const Thread_Idle_body _Thread_Idle_body
The idle thread body.
Definition: threadidledefault.c:44
const size_t _Thread_Idle_stack_size
The idle thread stack size in bytes.
This header file provides the interfaces of the Per-CPU Information.
This header file provides interfaces of the SMP Support which are used by the implementation and the ...
Definition: percpu.h:650