Repository: incubator-mynewt-core Updated Branches: refs/heads/sterly_refactor 93d29b847 -> f0e3b9a0f
initialize os device structure properly. add primary and secondary init phases. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/f0e3b9a0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f0e3b9a0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f0e3b9a0 Branch: refs/heads/sterly_refactor Commit: f0e3b9a0f4b26806345a6101dfff39d61f52e4a1 Parents: 93d29b8 Author: Sterling Hughes <[email protected]> Authored: Mon Aug 1 11:07:25 2016 -0700 Committer: Sterling Hughes <[email protected]> Committed: Mon Aug 1 11:07:25 2016 -0700 ---------------------------------------------------------------------- libs/os/include/os/os_dev.h | 4 +++- libs/os/src/os.c | 6 ++++++ libs/os/src/os_dev.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f0e3b9a0/libs/os/include/os/os_dev.h ---------------------------------------------------------------------- diff --git a/libs/os/include/os/os_dev.h b/libs/os/include/os/os_dev.h index 7c3dc09..850eee1 100644 --- a/libs/os/include/os/os_dev.h +++ b/libs/os/include/os/os_dev.h @@ -31,7 +31,9 @@ struct os_dev; * by the Mynewt kernel. * */ -#define OS_DEV_INIT_KERNEL (1) +#define OS_DEV_INIT_PRIMARY (1) +#define OS_DEV_INIT_SECONDARY (2) +#define OS_DEV_INIT_KERNEL (3) #define OS_DEV_INIT_F_CRITICAL (1 << 0) http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f0e3b9a0/libs/os/src/os.c ---------------------------------------------------------------------- diff --git a/libs/os/src/os.c b/libs/os/src/os.c index 25d9d08..961d7a0 100644 --- a/libs/os/src/os.c +++ b/libs/os/src/os.c @@ -112,6 +112,12 @@ os_init(void) err = os_arch_os_init(); assert(err == OS_OK); + + err = (os_error_t) os_dev_initialize_all(OS_DEV_INIT_PRIMARY); + assert(err == OS_OK); + + err = (os_error_t) os_dev_initialize_all(OS_DEV_INIT_SECONDARY); + assert(err == OS_OK); } /** http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f0e3b9a0/libs/os/src/os_dev.c ---------------------------------------------------------------------- diff --git a/libs/os/src/os_dev.c b/libs/os/src/os_dev.c index b99b4db..979db39 100644 --- a/libs/os/src/os_dev.c +++ b/libs/os/src/os_dev.c @@ -23,7 +23,8 @@ #include <string.h> -static STAILQ_HEAD(, os_dev) g_os_dev_list; +static STAILQ_HEAD(, os_dev) g_os_dev_list = + STAILQ_HEAD_INITIALIZER(g_os_dev_list); static int os_dev_init(struct os_dev *dev, char *name, uint8_t stage,
