You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/10/07 20:40:12 UTC

[2/7] incubator-mynewt-core git commit: mgmt; export API to schedule callbacks to take place in mgmt task ctx.

mgmt; export API to schedule callbacks to take place in mgmt task ctx.


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/0780cf0c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0780cf0c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0780cf0c

Branch: refs/heads/develop
Commit: 0780cf0c6e3172437a4e64a8a75ec90a37d5b9b8
Parents: cce0cc3
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Oct 7 08:29:59 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Oct 7 13:21:22 2016 -0700

----------------------------------------------------------------------
 mgmt/mgmt/include/mgmt/mgmt.h |  7 +++++--
 mgmt/mgmt/src/mgmt.c          | 10 ++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0780cf0c/mgmt/mgmt/include/mgmt/mgmt.h
----------------------------------------------------------------------
diff --git a/mgmt/mgmt/include/mgmt/mgmt.h b/mgmt/mgmt/include/mgmt/mgmt.h
index 24bf2e7..f87d57b 100644
--- a/mgmt/mgmt/include/mgmt/mgmt.h
+++ b/mgmt/mgmt/include/mgmt/mgmt.h
@@ -86,13 +86,16 @@ struct mgmt_group {
     (__group)->mg_handlers_count = (sizeof((__handlers)) / \
             sizeof(struct mgmt_handler));
 
-extern struct os_eventq *mgmt_evq;
-
 int mgmt_group_register(struct mgmt_group *group);
 void mgmt_jbuf_setoerr(struct mgmt_jbuf *njb, int errcode);
 const struct mgmt_handler *mgmt_find_handler(uint16_t group_id,
   uint16_t handler_id);
 
+struct os_event;
+struct os_eventq;
+void mgmt_cb_init(struct os_event *ev, void (*func)(struct os_event *));
+extern struct os_eventq *g_mgmt_evq;
+
 #ifdef __cplusplus
 }
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0780cf0c/mgmt/mgmt/src/mgmt.c
----------------------------------------------------------------------
diff --git a/mgmt/mgmt/src/mgmt.c b/mgmt/mgmt/src/mgmt.c
index aacf814..be77279 100644
--- a/mgmt/mgmt/src/mgmt.c
+++ b/mgmt/mgmt/src/mgmt.c
@@ -16,6 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+#include <string.h>
+
 #include <os/os.h>
 
 #include "mgmt/mgmt.h"
@@ -146,3 +148,11 @@ mgmt_jbuf_setoerr(struct mgmt_jbuf *njb, int errcode)
     json_encode_object_entry(&njb->mjb_enc, "rc", &jv);
     json_encode_object_finish(&njb->mjb_enc);
 }
+
+void
+mgmt_cb_init(struct os_event *ev, void (*func)(struct os_event *))
+{
+    memset(ev, 0, sizeof(*ev));
+    ev->ev_type = OS_EVENT_T_CB;
+    ev->ev_arg = func;
+}