init: add SYS_INIT()

This is to be used by subsystem that don't really want to create a
device but rather only want to be initialized automatically during the
kernel init sequence. It is just a wrapper around DEVICE_INIT(), and
thus still uses a device object, but it hides that fact and can be
replaced in the future without changing its model.

It can be used when a device created does not have objects associated
with it, but only an init function, and also when the device name
(DEVICE_INIT(<dev_name>, ...) does not matter.

Change-Id: I5488f430a6fb757cdcb499ef352775dc67aa0565
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-01-28 14:56:48 -05:00 committed by Anas Nashif
commit 629e1dd861

View file

@ -38,6 +38,9 @@ extern "C" {
#define _SYS_INIT_LEVEL_MICROKERNEL 3 #define _SYS_INIT_LEVEL_MICROKERNEL 3
#define _SYS_INIT_LEVEL_APPLICATION 4 #define _SYS_INIT_LEVEL_APPLICATION 4
#define SYS_INIT(init_fn, level, prio) \
DEVICE_INIT(sys_init_##init_fn, "", init_fn, NULL, NULL, level, prio)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif