MYNEWT-534 Pkgs set dflt eventq in init function.
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/5c8e04f1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/5c8e04f1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/5c8e04f1 Branch: refs/heads/develop Commit: 5c8e04f162d5afc250c16274ed6c2e8943718fd5 Parents: 64c288f Author: Christopher Collins <[email protected]> Authored: Wed Feb 8 18:51:38 2017 -0800 Committer: Christopher Collins <[email protected]> Committed: Wed Feb 8 19:00:04 2017 -0800 ---------------------------------------------------------------------- mgmt/newtmgr/include/newtmgr/newtmgr.h | 1 - mgmt/newtmgr/src/newtmgr.c | 24 +++++------------------- net/nimble/host/src/ble_hs.c | 3 ++- net/oic/pkg.yml | 3 +++ net/oic/src/port/mynewt/adaptor.c | 9 ++++++++- sys/shell/src/shell.c | 3 ++- test/runtest/src/runtest.c | 16 ++++++++++++++++ test/runtest/src/runtest_nmgr.c | 8 -------- 8 files changed, 36 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/mgmt/newtmgr/include/newtmgr/newtmgr.h ---------------------------------------------------------------------- diff --git a/mgmt/newtmgr/include/newtmgr/newtmgr.h b/mgmt/newtmgr/include/newtmgr/newtmgr.h index 40a170e..50deb15 100644 --- a/mgmt/newtmgr/include/newtmgr/newtmgr.h +++ b/mgmt/newtmgr/include/newtmgr/newtmgr.h @@ -74,7 +74,6 @@ struct nmgr_transport { }; void nmgr_event_put(struct os_event *ev); -int nmgr_task_init(void); int nmgr_transport_init(struct nmgr_transport *nt, nmgr_transport_out_func_t output_func, nmgr_transport_get_mtu_func_t get_mtu_func); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/mgmt/newtmgr/src/newtmgr.c ---------------------------------------------------------------------- diff --git a/mgmt/newtmgr/src/newtmgr.c b/mgmt/newtmgr/src/newtmgr.c index 56214a2..5d37021 100644 --- a/mgmt/newtmgr/src/newtmgr.c +++ b/mgmt/newtmgr/src/newtmgr.c @@ -52,7 +52,6 @@ static struct nmgr_cbuf { struct os_eventq * mgmt_evq_get(void) { - os_eventq_ensure(&nmgr_evq, NULL); return nmgr_evq; } @@ -348,23 +347,6 @@ nmgr_rx_req(struct nmgr_transport *nt, struct os_mbuf *req) return rc; } -int -nmgr_task_init(void) -{ - int rc; - - rc = nmgr_os_groups_register(); - if (rc != 0) { - goto err; - } - - nmgr_cbuf_init(&nmgr_task_cbuf); - - return (0); -err: - return (rc); -} - void nmgr_pkg_init(void) { @@ -373,6 +355,10 @@ nmgr_pkg_init(void) /* Ensure this function only gets called by sysinit. */ SYSINIT_ASSERT_ACTIVE(); - rc = nmgr_task_init(); + rc = nmgr_os_groups_register(); SYSINIT_PANIC_ASSERT(rc == 0); + + nmgr_cbuf_init(&nmgr_task_cbuf); + + mgmt_evq_set(os_eventq_dflt_get()); } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/net/nimble/host/src/ble_hs.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_hs.c b/net/nimble/host/src/ble_hs.c index f526f5e..ae7b4f5 100644 --- a/net/nimble/host/src/ble_hs.c +++ b/net/nimble/host/src/ble_hs.c @@ -110,7 +110,6 @@ STATS_NAME_END(ble_hs_stats) static struct os_eventq * ble_hs_evq_get(void) { - os_eventq_ensure(&ble_hs_evq, &ble_hs_ev_start); return ble_hs_evq; } @@ -609,4 +608,6 @@ ble_hs_init(void) /* Configure the HCI transport to communicate with a host. */ ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL); + + ble_hs_evq_set(os_eventq_dflt_get()); } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/net/oic/pkg.yml ---------------------------------------------------------------------- diff --git a/net/oic/pkg.yml b/net/oic/pkg.yml index 43a8376..a982baa 100644 --- a/net/oic/pkg.yml +++ b/net/oic/pkg.yml @@ -48,3 +48,6 @@ pkg.cflags: - -DSECURE=0 - "-I@apache-mynewt-core/net/oic/src/port/mynewt" - "-I@apache-mynewt-core/net/oic/include/oic" + +pkg.init: + oc_init: 500 http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/net/oic/src/port/mynewt/adaptor.c ---------------------------------------------------------------------- diff --git a/net/oic/src/port/mynewt/adaptor.c b/net/oic/src/port/mynewt/adaptor.c index 7b6525a..0212592 100644 --- a/net/oic/src/port/mynewt/adaptor.c +++ b/net/oic/src/port/mynewt/adaptor.c @@ -18,6 +18,7 @@ */ #include <assert.h> #include <syscfg/syscfg.h> +#include <sysinit/sysinit.h> #include <os/os.h> #include <os/endian.h> #include <string.h> @@ -33,7 +34,6 @@ struct log oc_log; struct os_eventq * oc_evq_get(void) { - os_eventq_ensure(&oc_evq, NULL); return oc_evq; } @@ -147,3 +147,10 @@ oc_connectivity_init(void) return 0; } + +void +oc_init(void) +{ + SYSINIT_ASSERT_ACTIVE(); + oc_evq_set(os_eventq_dflt_get()); +} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/sys/shell/src/shell.c ---------------------------------------------------------------------- diff --git a/sys/shell/src/shell.c b/sys/shell/src/shell.c index f11086b..833b014 100644 --- a/sys/shell/src/shell.c +++ b/sys/shell/src/shell.c @@ -101,7 +101,6 @@ static uint16_t g_nlip_expected_len; static struct os_eventq * shell_evq_get(void) { - os_eventq_ensure(&shell_evq, NULL); return shell_evq; } @@ -607,4 +606,6 @@ shell_init(void) os_mqueue_init(&g_shell_nlip_mq, shell_event_data_in, NULL); console_init(shell_console_rx_cb); + + shell_evq_set(os_eventq_dflt_get()); } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/test/runtest/src/runtest.c ---------------------------------------------------------------------- diff --git a/test/runtest/src/runtest.c b/test/runtest/src/runtest.c index 3a68185..174e1c6 100644 --- a/test/runtest/src/runtest.c +++ b/test/runtest/src/runtest.c @@ -39,8 +39,22 @@ struct shell_cmd runtest_cmd_struct; struct mgmt_group runtest_nmgr_group; #endif +static struct os_eventq *run_evq; + extern int run_nmgr_register_group(); +static struct os_eventq * +run_evq_get(void) +{ + return run_evq; +} + +void +run_evq_set(struct os_eventq *evq) +{ + os_eventq_designate(&run_evq, evq, NULL); +} + /* * Package init routine to register newtmgr "run" commands */ @@ -60,4 +74,6 @@ runtest_init(void) rc = run_nmgr_register_group(); SYSINIT_PANIC_ASSERT(rc == 0); #endif + + run_evq_set(os_eventq_dflt_get()); } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/5c8e04f1/test/runtest/src/runtest_nmgr.c ---------------------------------------------------------------------- diff --git a/test/runtest/src/runtest_nmgr.c b/test/runtest/src/runtest_nmgr.c index 7281e99..3c02ee3 100644 --- a/test/runtest/src/runtest_nmgr.c +++ b/test/runtest/src/runtest_nmgr.c @@ -51,7 +51,6 @@ struct os_event run_test_event; char run_testname[RUNTEST_REQ_SIZE]; char run_token[RUNTEST_REQ_SIZE]; -static struct os_eventq *run_evq; struct runtest_evq_arg runtest_arg; os_event_fn *run_callback; @@ -61,13 +60,6 @@ run_evcb_set(os_event_fn *cb) run_callback = cb; } -static struct os_eventq * -run_evq_get(void) -{ - os_eventq_ensure(&run_evq, NULL); - return run_evq; -} - /* * package "run test" request from newtmgr and enqueue on default queue * of the application which is actually running the tests (e.g., mynewtsanity).
