You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/02/09 03:00:24 UTC
[1/3] incubator-mynewt-core git commit: MYNEWT-534 Don't set pkg dflt
eventq in apps.
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 4719b3f50 -> eb3204502
MYNEWT-534 Don't set pkg dflt eventq in apps.
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/eb320450
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/eb320450
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/eb320450
Branch: refs/heads/develop
Commit: eb32045028fb38d873534e1af905eaea67882fa6
Parents: 5c8e04f
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Feb 8 18:59:25 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Feb 8 19:00:04 2017 -0800
----------------------------------------------------------------------
apps/bleprph_oic/src/main.c | 6 +-----
apps/slinky_oic/src/main.c | 1 -
2 files changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/eb320450/apps/bleprph_oic/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleprph_oic/src/main.c b/apps/bleprph_oic/src/main.c
index 5899964..d6624b8 100755
--- a/apps/bleprph_oic/src/main.c
+++ b/apps/bleprph_oic/src/main.c
@@ -356,13 +356,9 @@ main(void)
/* Initialize the OIC */
log_register("oic", &oc_log, &log_console_handler, NULL, LOG_SYSLEVEL);
-
- ble_hs_evq_set(os_eventq_dflt_get());
-
oc_main_init((oc_handler_t *)&omgr_oc_handler);
- mgmt_evq_set(os_eventq_dflt_get());
-
oc_ble_coap_gatt_srv_init();
+
ble_hs_cfg.reset_cb = bleprph_on_reset;
ble_hs_cfg.sync_cb = bleprph_on_sync;
ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/eb320450/apps/slinky_oic/src/main.c
----------------------------------------------------------------------
diff --git a/apps/slinky_oic/src/main.c b/apps/slinky_oic/src/main.c
index 41595ae..2f8df31 100755
--- a/apps/slinky_oic/src/main.c
+++ b/apps/slinky_oic/src/main.c
@@ -244,7 +244,6 @@ init_tasks(void)
TASK2_PRIO, OS_WAIT_FOREVER, pstack, TASK2_STACK_SIZE);
oc_main_init((oc_handler_t *)&omgr_oc_handler);
- mgmt_evq_set(os_eventq_dflt_get());
}
/**
[3/3] incubator-mynewt-core git commit: MYNEWT-534 os - Move start ev
when evq reassigned.
Posted by cc...@apache.org.
MYNEWT-534 os - Move start ev when evq reassigned.
If an application wants a package to use an event queue other than the
main event queue, it calls the package-specific evq-set function. When
this happens, the package's start event (if any) needs to be moved from
the previous queue to the new one.
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/64c288f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/64c288f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/64c288f6
Branch: refs/heads/develop
Commit: 64c288f6a4f4ce188305f0d66c719a1467a39948
Parents: 4719b3f
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Feb 8 18:49:46 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Feb 8 19:00:04 2017 -0800
----------------------------------------------------------------------
kernel/os/include/os/os_eventq.h | 2 --
kernel/os/src/os.c | 2 +-
kernel/os/src/os_eventq.c | 47 ++++++++++++++++++++---------------
3 files changed, 28 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/64c288f6/kernel/os/include/os/os_eventq.h
----------------------------------------------------------------------
diff --git a/kernel/os/include/os/os_eventq.h b/kernel/os/include/os/os_eventq.h
index 092e724..2ae779c 100644
--- a/kernel/os/include/os/os_eventq.h
+++ b/kernel/os/include/os/os_eventq.h
@@ -56,8 +56,6 @@ void os_eventq_remove(struct os_eventq *, struct os_event *);
struct os_eventq *os_eventq_dflt_get(void);
void os_eventq_designate(struct os_eventq **dst, struct os_eventq *val,
struct os_event *start_ev);
-void os_eventq_ensure(struct os_eventq **evq, struct os_event *start_ev);
-
#ifdef __cplusplus
}
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/64c288f6/kernel/os/src/os.c
----------------------------------------------------------------------
diff --git a/kernel/os/src/os.c b/kernel/os/src/os.c
index 754dcea..cbf8b62 100644
--- a/kernel/os/src/os.c
+++ b/kernel/os/src/os.c
@@ -132,7 +132,6 @@ os_main(void *arg)
{
int (*fn)(int argc, char **argv) = arg;
- os_eventq_init(os_eventq_dflt_get());
#if !MYNEWT_VAL(SELFTEST)
fn(0, NULL);
#else
@@ -175,6 +174,7 @@ os_init(int (*main_fn)(int argc, char **arg))
TAILQ_INIT(&g_callout_list);
STAILQ_INIT(&g_os_task_list);
+ os_eventq_init(os_eventq_dflt_get());
/* Initialize device list. */
os_dev_reset();
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/64c288f6/kernel/os/src/os_eventq.c
----------------------------------------------------------------------
diff --git a/kernel/os/src/os_eventq.c b/kernel/os/src/os_eventq.c
index d5be9ae..626d560 100644
--- a/kernel/os/src/os_eventq.c
+++ b/kernel/os/src/os_eventq.c
@@ -289,32 +289,39 @@ os_eventq_dflt_get(void)
return &os_eventq_main;
}
+/**
+ * Reassigns an event queue pointer to the specified value. This function is
+ * used for configuring a package to use a particular event queue. A package's
+ * event queue can generally be reassigned repeatedly. If the package has a
+ * startup event, the event is moved from the current queue (if any) to the
+ * specified queue.
+ *
+ * @param cur_evq Points to the eventq pointer to reassign.
+ * *cur_evq should be NULL if the package's
+ * eventq has not been assigned yet.
+ * @param new_evq The eventq that the package should be
+ * associated with.
+ * @param start_ev The package's startup event, if any. If this
+ * is non-NULL, the event gets removed from
+ * the current queue (if set), and enqueued to
+ * the new eventq.
+ */
void
-os_eventq_designate(struct os_eventq **dst, struct os_eventq *val,
+os_eventq_designate(struct os_eventq **cur_evq,
+ struct os_eventq *new_evq,
struct os_event *start_ev)
{
- *dst = val;
- if (start_ev != NULL) {
- os_eventq_put(*dst, start_ev);
- }
-}
+ struct os_eventq *prev_evq;
-void
-os_eventq_ensure(struct os_eventq **evq, struct os_event *start_ev)
-{
- struct os_eventq *eventq_dflt;
+ prev_evq = *cur_evq;
+ *cur_evq = new_evq;
- if (*evq == NULL) {
- eventq_dflt = os_eventq_dflt_get();
- if (eventq_dflt != NULL) {
- os_eventq_designate(evq, eventq_dflt, start_ev);
+ if (start_ev != NULL) {
+ if (start_ev->ev_queued) {
+ assert(prev_evq != NULL);
+ os_eventq_remove(prev_evq, start_ev);
}
-
- /* The system is misconfigured if there is still no parent eventq. The
- * application should have explicitly specified a parent queue for each
- * package, or indicated a default.
- */
- assert(*evq != NULL);
+ os_eventq_put(new_evq, start_ev);
}
}
[2/3] incubator-mynewt-core git commit: MYNEWT-534 Pkgs set dflt
eventq in init function.
Posted by cc...@apache.org.
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 <cc...@apache.org>
Authored: Wed Feb 8 18:51:38 2017 -0800
Committer: Christopher Collins <cc...@apache.org>
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).