179 | | = Components Of Rtems Sequenced Initialization API = |
180 | | |
181 | | |
182 | | # The rule of sort order |
183 | | |
184 | | # The definition of rtems Sysinit_Entry struct and its reference |
185 | | |
186 | | # The method of referencing the Sysinit_Entry struct |
187 | | |
188 | | ; Rule of sort order |
189 | | |
190 | | We use a combination of three domains to define the order of initialization sequence, the three |
191 | | domains are {subsystem, order, index}. Every domain is an key word to sort. |
192 | | |
193 | | Sort order API: |
194 | | /** |
195 | | * @brief the first domain is subsystem |
196 | | */ |
197 | | #define SYSINIT_CLASS_API 0001 |
198 | | /** |
199 | | * @brief the second domain is order like before,nomal,after |
200 | | */ |
201 | | #define SYSINIT_ORDER_BEFORE 0 |
202 | | #define SYSINIT_ORDER_NOMAL 1 |
203 | | #define SYSINIT_ORDER_AFTER 2 |
204 | | /** |
205 | | * @brief the third domain is index |
206 | | */ |
207 | | #define SYSINIT_INDEX_FIRST 0000 /* first*/ |
208 | | #define SYSINIT_INDEX_SECOND 0001 /* second*/ |
209 | | #define SYSINIT_INDEX_THIRD 0002 /* third*/ |
210 | | #define SYSINIT_INDEX_FOURTH 0003 /* fourth*/ |
211 | | #define SYSINIT_INDEX_FIFTH 0004 /* fifth*/ |
212 | | #define SYSINIT_INDEX_SIXTH 0005 /* sixth*/ |
213 | | #define SYSINIT_INDEX_SEVENTH 0006 /* seventh*/ |
214 | | #define SYSINIT_INDEX_EIGHTH 0007 /* eighth*/ |
215 | | #define SYSINIT_INDEX_NINTH 0008 /* ninth*/ |
216 | | #define SYSINIT_INDEX_TENTH 0009 /* tenth*/ |
217 | | #define SYSINIT_INDEX_ELEVENTH 0010 /* eleventh*/ |
218 | | #define SYSINIT_INDEX_TWELFTH 0011 /* twelfth */ |
219 | | |
220 | | ; The definition of rtems sysinit_core struct and its reference: |
221 | | |
222 | | The field of struct Sysinit_Entry will be extended in the futurn, now there is only one field filling in the struct. the field handler is the entry function of rtems sequenced initialization or termination. |
| 179 | = Components of the API = |
| 180 | |
| 181 | |
| 182 | We use a combination of three domains to define the order of initialization sequence, the two |
| 183 | domains are (group, index). Every domain is an key word to sort. |
| 184 | |
| 185 | The fields of Sysinit_Entry may be extended in the future, now there is only one field filling in the structure. The field handler is the entry function of RTEMS sequenced initialization or termination. |
245 | | #group "." #index |
246 | | |
| 208 | group "." index |
| 209 | |
| 210 | #define SYSINIT_MAKE_INDEX(i3, i2, i1, i0) \ |
| 211 | #i3 #i2 #i1 #i0 |
| 212 | |
| 213 | #define SYSINIT_INDEX_FIRST SYSINIT_MAKE_INDEX(0, 0, 0, 0) |
| 214 | #define SYSINIT_INDEX_MIDDLE SYSINIT_MAKE_INDEX(5, 0, 0, 0) |
| 215 | #define SYSINIT_INDEX_LAST SYSINIT_MAKE_INDEX(9, 9, 9, 9) |
| 216 | |
| 217 | #define SYSINIT_GROUP_FIRST "0000" |
| 218 | #define SYSINIT_GROUP_EVENT "0110" |
| 219 | #define SYSINIT_GROUP_SEMAPHORE "0120" |
| 220 | #define SYSINIT_GROUP_LAST "9999" |
| 221 | |