1 | /* |
---|
2 | * Copyright (c) 2015 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_BSP_WORK_AREAS 000100 |
---|
30 | #define RTEMS_SYSINIT_BSP_START 000200 |
---|
31 | #define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000300 |
---|
32 | #define RTEMS_SYSINIT_DATA_STRUCTURES 000301 |
---|
33 | #define RTEMS_SYSINIT_USER_EXTENSIONS 000320 |
---|
34 | #define RTEMS_SYSINIT_CLASSIC_TASKS 000340 |
---|
35 | #define RTEMS_SYSINIT_CLASSIC_TIMER 000341 |
---|
36 | #define RTEMS_SYSINIT_IDLE_THREADS 000380 |
---|
37 | #define RTEMS_SYSINIT_BSP_LIBC 000400 |
---|
38 | #define RTEMS_SYSINIT_BEFORE_DRIVERS 000500 |
---|
39 | #define RTEMS_SYSINIT_BSP_PRE_DRIVERS 000600 |
---|
40 | #define RTEMS_SYSINIT_DEVICE_DRIVERS 000700 |
---|
41 | #define RTEMS_SYSINIT_BSP_POST_DRIVERS 000800 |
---|
42 | |
---|
43 | /* |
---|
44 | * The value of each order define must consist of exactly two hexadecimal |
---|
45 | * digits without a 0x-prefix. A 0x-prefix is concatenated with the module and |
---|
46 | * order values to form a proper integer literal. |
---|
47 | */ |
---|
48 | #define RTEMS_SYSINIT_ORDER_FIRST 00 |
---|
49 | #define RTEMS_SYSINIT_ORDER_MIDDLE 08 |
---|
50 | #define RTEMS_SYSINIT_ORDER_LAST 0f |
---|
51 | |
---|
52 | typedef void ( *rtems_sysinit_handler )( void ); |
---|
53 | |
---|
54 | typedef struct { |
---|
55 | rtems_sysinit_handler handler; |
---|
56 | } rtems_sysinit_item; |
---|
57 | |
---|
58 | /* The enum helps to detect typos in the module and order parameters */ |
---|
59 | #define _RTEMS_SYSINIT_INDEX_ITEM( handler, index ) \ |
---|
60 | enum { _Sysinit_##handler = index }; \ |
---|
61 | RTEMS_LINKER_ROSET_ITEM_ORDERED( \ |
---|
62 | _Sysinit, \ |
---|
63 | rtems_sysinit_item, \ |
---|
64 | handler, \ |
---|
65 | index \ |
---|
66 | ) = { handler } |
---|
67 | |
---|
68 | /* Create index from module and order */ |
---|
69 | #define _RTEMS_SYSINIT_ITEM( handler, module, order ) \ |
---|
70 | _RTEMS_SYSINIT_INDEX_ITEM( handler, 0x##module##order ) |
---|
71 | |
---|
72 | /* Perform parameter expansion */ |
---|
73 | #define RTEMS_SYSINIT_ITEM( handler, module, order ) \ |
---|
74 | _RTEMS_SYSINIT_ITEM( handler, module, order ) |
---|
75 | |
---|
76 | #ifdef __cplusplus |
---|
77 | } |
---|
78 | #endif /* __cplusplus */ |
---|
79 | |
---|
80 | #endif /* _RTEMS_SYSINIT_H */ |
---|