RTEMS
sysinit.h
1 /*
2  * Copyright (c) 2015, 2020 embedded brains GmbH. All rights reserved.
3  *
4  * embedded brains GmbH
5  * Dornierstr. 4
6  * 82178 Puchheim
7  * Germany
8  * <rtems@embedded-brains.de>
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
15 #ifndef _RTEMS_SYSINIT_H
16 #define _RTEMS_SYSINIT_H
17 
18 #include <rtems/linkersets.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif /* __cplusplus */
23 
24 /*
25  * The value of each module define must consist of exactly six hexadecimal
26  * digits without a 0x-prefix. A 0x-prefix is concatenated with the module and
27  * order values to form a proper integer literal.
28  */
29 #define RTEMS_SYSINIT_RECORD 000100
30 #define RTEMS_SYSINIT_BSP_EARLY 000140
31 #define RTEMS_SYSINIT_MEMORY 000180
32 #define RTEMS_SYSINIT_DIRTY_MEMORY 0001c0
33 #define RTEMS_SYSINIT_ZERO_MEMORY 0001e0
34 #define RTEMS_SYSINIT_ISR_STACK 000200
35 #define RTEMS_SYSINIT_PER_CPU_DATA 000220
36 #define RTEMS_SYSINIT_SBRK 000240
37 #define RTEMS_SYSINIT_WORKSPACE 000260
38 #define RTEMS_SYSINIT_MALLOC 000280
39 #define RTEMS_SYSINIT_BSP_START 000300
40 #define RTEMS_SYSINIT_CPU_COUNTER 000400
41 #define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000500
42 #define RTEMS_SYSINIT_MP_EARLY 000600
43 #define RTEMS_SYSINIT_DATA_STRUCTURES 000700
44 #define RTEMS_SYSINIT_STACK_ALLOCATOR 000780
45 #define RTEMS_SYSINIT_MP 000800
46 #define RTEMS_SYSINIT_USER_EXTENSIONS 000900
47 #define RTEMS_SYSINIT_CLASSIC_TASKS 000a00
48 #define RTEMS_SYSINIT_CLASSIC_TASKS_MP 000a80
49 #define RTEMS_SYSINIT_CLASSIC_TIMER 000b00
50 #define RTEMS_SYSINIT_CLASSIC_SIGNAL_MP 000c00
51 #define RTEMS_SYSINIT_CLASSIC_EVENT_MP 000d00
52 #define RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE 000e00
53 #define RTEMS_SYSINIT_CLASSIC_MESSAGE_QUEUE_MP 000e80
54 #define RTEMS_SYSINIT_CLASSIC_SEMAPHORE 000f00
55 #define RTEMS_SYSINIT_CLASSIC_SEMAPHORE_MP 000f80
56 #define RTEMS_SYSINIT_CLASSIC_PARTITION 001000
57 #define RTEMS_SYSINIT_CLASSIC_PARTITION_MP 001080
58 #define RTEMS_SYSINIT_CLASSIC_REGION 001100
59 #define RTEMS_SYSINIT_CLASSIC_DUAL_PORTED_MEMORY 001200
60 #define RTEMS_SYSINIT_CLASSIC_RATE_MONOTONIC 001300
61 #define RTEMS_SYSINIT_CLASSIC_BARRIER 001400
62 #define RTEMS_SYSINIT_POSIX_SIGNALS 001500
63 #define RTEMS_SYSINIT_POSIX_THREADS 001600
64 #define RTEMS_SYSINIT_POSIX_MESSAGE_QUEUE 001700
65 #define RTEMS_SYSINIT_POSIX_SEMAPHORE 001800
66 #define RTEMS_SYSINIT_POSIX_TIMER 001900
67 #define RTEMS_SYSINIT_POSIX_SHM 001a00
68 #define RTEMS_SYSINIT_POSIX_KEYS 001b00
69 #define RTEMS_SYSINIT_POSIX_CLEANUP 001c00
70 #define RTEMS_SYSINIT_IDLE_THREADS 001d00
71 #define RTEMS_SYSINIT_LIBIO 001e00
72 #define RTEMS_SYSINIT_USER_ENVIRONMENT 001e80
73 #define RTEMS_SYSINIT_ROOT_FILESYSTEM 001f00
74 #define RTEMS_SYSINIT_DRVMGR 002000
75 #define RTEMS_SYSINIT_MP_SERVER 002100
76 #define RTEMS_SYSINIT_BSP_PRE_DRIVERS 002200
77 #define RTEMS_SYSINIT_DRVMGR_LEVEL_1 002300
78 #define RTEMS_SYSINIT_DEVICE_DRIVERS 002400
79 #define RTEMS_SYSINIT_DRVMGR_LEVEL_2 002500
80 #define RTEMS_SYSINIT_DRVMGR_LEVEL_3 002600
81 #define RTEMS_SYSINIT_DRVMGR_LEVEL_4 002700
82 #define RTEMS_SYSINIT_MP_FINALIZE 002800
83 #define RTEMS_SYSINIT_CLASSIC_USER_TASKS 002900
84 #define RTEMS_SYSINIT_POSIX_USER_THREADS 002a00
85 #define RTEMS_SYSINIT_STD_FILE_DESCRIPTORS 002b00
86 #define RTEMS_SYSINIT_LAST ffffff
87 
88 /*
89  * The value of each order define must consist of exactly two hexadecimal
90  * digits without a 0x-prefix. A 0x-prefix is concatenated with the module and
91  * order values to form a proper integer literal.
92  */
93 #define RTEMS_SYSINIT_ORDER_FIRST 00
94 #define RTEMS_SYSINIT_ORDER_SECOND 01
95 #define RTEMS_SYSINIT_ORDER_THIRD 02
96 #define RTEMS_SYSINIT_ORDER_FOURTH 03
97 #define RTEMS_SYSINIT_ORDER_FIFTH 04
98 #define RTEMS_SYSINIT_ORDER_SIXTH 05
99 #define RTEMS_SYSINIT_ORDER_SEVENTH 06
100 #define RTEMS_SYSINIT_ORDER_EIGHTH 07
101 #define RTEMS_SYSINIT_ORDER_NINETH 08
102 #define RTEMS_SYSINIT_ORDER_TENTH 09
103 #define RTEMS_SYSINIT_ORDER_MIDDLE 80
104 #define RTEMS_SYSINIT_ORDER_LAST_BUT_9 f6
105 #define RTEMS_SYSINIT_ORDER_LAST_BUT_8 f7
106 #define RTEMS_SYSINIT_ORDER_LAST_BUT_7 f8
107 #define RTEMS_SYSINIT_ORDER_LAST_BUT_6 f9
108 #define RTEMS_SYSINIT_ORDER_LAST_BUT_5 fa
109 #define RTEMS_SYSINIT_ORDER_LAST_BUT_4 fb
110 #define RTEMS_SYSINIT_ORDER_LAST_BUT_3 fc
111 #define RTEMS_SYSINIT_ORDER_LAST_BUT_2 fd
112 #define RTEMS_SYSINIT_ORDER_LAST_BUT_1 fe
113 #define RTEMS_SYSINIT_ORDER_LAST ff
114 
115 typedef void ( *rtems_sysinit_handler )( void );
116 
117 typedef struct {
118  rtems_sysinit_handler handler;
120 
121 /* The enum helps to detect typos in the module and order parameters */
122 #define _RTEMS_SYSINIT_INDEX_ITEM( handler, index ) \
123  enum { _Sysinit_##handler = index }; \
124  RTEMS_LINKER_ROSET_ITEM_ORDERED( \
125  _Sysinit, \
126  rtems_sysinit_item, \
127  handler, \
128  index \
129  ) = { handler }
130 
131 /* Create index from module and order */
132 #define _RTEMS_SYSINIT_ITEM( handler, module, order ) \
133  _RTEMS_SYSINIT_INDEX_ITEM( handler, 0x##module##order )
134 
135 /* Perform parameter expansion */
136 #define RTEMS_SYSINIT_ITEM( handler, module, order ) \
137  _RTEMS_SYSINIT_ITEM( handler, module, order )
138 
143 void _Sysinit_Verbose( void );
144 
145 #ifdef __cplusplus
146 }
147 #endif /* __cplusplus */
148 
149 #endif /* _RTEMS_SYSINIT_H */