| @@ -71,6 +71,7 @@ enum sysinit_sub_id { | |||||
| SI_SUB_HAL = 0x0010, /* Early HAL init */ | SI_SUB_HAL = 0x0010, /* Early HAL init */ | ||||
| SI_SUB_GPIO = 0x0030, /* Early GPIO */ | SI_SUB_GPIO = 0x0030, /* Early GPIO */ | ||||
| SI_SUB_USB = 0x0300, /* USB */ | |||||
| SI_SUB_CONSOLE = 0x0700, /* Setup console/debug prints */ | SI_SUB_CONSOLE = 0x0700, /* Setup console/debug prints */ | ||||
| SI_SUB_COPYRIGHT = 0x0800, /* start of when printf works */ | SI_SUB_COPYRIGHT = 0x0800, /* start of when printf works */ | ||||
| @@ -93,7 +94,8 @@ enum sysinit_elem_order { | |||||
| SI_ORDER_SEVENTH = 0x0006, /* seventh*/ | SI_ORDER_SEVENTH = 0x0006, /* seventh*/ | ||||
| SI_ORDER_EIGHTH = 0x0007, /* eighth*/ | SI_ORDER_EIGHTH = 0x0007, /* eighth*/ | ||||
| SI_ORDER_MIDDLE = 0x1000, /* somewhere in the middle */ | SI_ORDER_MIDDLE = 0x1000, /* somewhere in the middle */ | ||||
| SI_ORDER_ANY = 0xffff /* last*/ | |||||
| SI_ORDER_ANY = 0xfffe, /* second to last */ | |||||
| SI_ORDER_LAST = 0xffff /* last*/ | |||||
| }; | }; | ||||
| typedef void (*sysinit_cfunc_t)(const void *); | typedef void (*sysinit_cfunc_t)(const void *); | ||||
| @@ -105,14 +107,16 @@ struct sysinit { | |||||
| }; | }; | ||||
| #define SYSINIT(uniquifier, subsystem, order, func, udata) \ | #define SYSINIT(uniquifier, subsystem, order, func, udata) \ | ||||
| CTASSERT((subsystem & 0xffff) == subsystem); \ | |||||
| CTASSERT((order & 0xffff) == order); \ | |||||
| CTASSERT(((subsystem) & 0xffff) == (subsystem)); \ | |||||
| CTASSERT(((order) & 0xffff) == (order)); \ | |||||
| static const struct sysinit uniquifier ## _sys_init = { \ | static const struct sysinit uniquifier ## _sys_init = { \ | ||||
| .si_subsys_order = MAKE_SUBORDER((subsystem), (order)), \ | .si_subsys_order = MAKE_SUBORDER((subsystem), (order)), \ | ||||
| .si_func = (func), \ | .si_func = (func), \ | ||||
| .si_udata = (udata), \ | .si_udata = (udata), \ | ||||
| }; \ | }; \ | ||||
| DATA_SET(sysinit_set,uniquifier ## _sys_init) | DATA_SET(sysinit_set,uniquifier ## _sys_init) | ||||
| #define SYSINIT_VF(uniquifier, subsystem, order, func) \ | |||||
| SYSINIT(uniquifier, (subsystem), (order), (void (*)(const void *))(func), NULL) | |||||
| void sysinit_run(void); | void sysinit_run(void); | ||||