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/05 00:02:31 UTC

incubator-mynewt-core git commit: Split out shell transport out of base newtmgr package.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop d10ec6e7b -> 2b3154cc0


Split out shell transport out of base newtmgr package.


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

Branch: refs/heads/develop
Commit: 2b3154cc071942b14f14d4c1ba82ae11de2acb5a
Parents: d10ec6e
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Oct 4 16:59:09 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Oct 4 17:01:46 2016 -0700

----------------------------------------------------------------------
 apps/slinky/pkg.yml                             |  1 +
 apps/splitty/pkg.yml                            |  1 +
 mgmt/newtmgr/pkg.yml                            |  4 --
 mgmt/newtmgr/src/newtmgr.c                      | 54 ----------------
 mgmt/newtmgr/transport/ble/pkg.yml              |  1 +
 mgmt/newtmgr/transport/nmgr_shell/pkg.yml       | 34 ++++++++++
 .../transport/nmgr_shell/src/nmgr_shell.c       | 65 ++++++++++++++++++++
 7 files changed, 102 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2b3154cc/apps/slinky/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/slinky/pkg.yml b/apps/slinky/pkg.yml
index 0a0e65d..6bac81f 100644
--- a/apps/slinky/pkg.yml
+++ b/apps/slinky/pkg.yml
@@ -29,6 +29,7 @@ pkg.deps:
     - test/flash_test
     - libs/imgmgr
     - mgmt/newtmgr
+    - mgmt/newtmgr/transport/nmgr_shell
     - kernel/os
     - boot/bootutil
     - sys/shell

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2b3154cc/apps/splitty/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/splitty/pkg.yml b/apps/splitty/pkg.yml
index be359c1..bd28949 100644
--- a/apps/splitty/pkg.yml
+++ b/apps/splitty/pkg.yml
@@ -29,6 +29,7 @@ pkg.deps:
     - sys/console/full
     - libs/imgmgr
     - mgmt/newtmgr
+    - mgmt/newtmgr/transport/nmgr_shell
     - kernel/os
     - boot/bootutil
     - sys/shell

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2b3154cc/mgmt/newtmgr/pkg.yml
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/pkg.yml b/mgmt/newtmgr/pkg.yml
index 1bde967..a472cb9 100644
--- a/mgmt/newtmgr/pkg.yml
+++ b/mgmt/newtmgr/pkg.yml
@@ -24,13 +24,9 @@ pkg.homepage: "http://mynewt.apache.org/"
 pkg.keywords:
 
 pkg.deps:
-    - hw/hal
     - kernel/os
     - encoding/json
     - mgmt/newtmgr/nmgr_os
-    - libs/util
-    - sys/shell
-    - sys/reboot
 
 pkg.deps.NEWTMGR_BLE_HOST:
     - mgmt/newtmgr/transport/ble

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2b3154cc/mgmt/newtmgr/src/newtmgr.c
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/src/newtmgr.c b/mgmt/newtmgr/src/newtmgr.c
index 9b90296..46f3d30 100644
--- a/mgmt/newtmgr/src/newtmgr.c
+++ b/mgmt/newtmgr/src/newtmgr.c
@@ -25,14 +25,11 @@
 #include "os/os.h"
 #include "os/endian.h"
 
-#include "shell/shell.h"
 #include "newtmgr/newtmgr.h"
 #include "nmgr_os/nmgr_os.h"
 
 os_stack_t newtmgr_stack[OS_STACK_ALIGN(MYNEWT_VAL(NEWTMGR_STACK_SIZE))];
 
-struct nmgr_transport g_nmgr_shell_transport;
-
 struct os_mutex g_nmgr_group_list_lock;
 
 static struct os_eventq g_nmgr_evq;
@@ -609,45 +606,6 @@ nmgr_rx_req(struct nmgr_transport *nt, struct os_mbuf *req)
     return rc;
 }
 
-static uint16_t
-nmgr_shell_get_mtu(struct os_mbuf *m) {
-    return NMGR_MAX_MTU;
-}
-
-static int
-nmgr_shell_out(struct nmgr_transport *nt, struct os_mbuf *m)
-{
-    int rc;
-
-    rc = shell_nlip_output(m);
-    if (rc != 0) {
-        goto err;
-    }
-
-    return (0);
-err:
-    return (rc);
-}
-
-static int
-nmgr_shell_in(struct os_mbuf *m, void *arg)
-{
-    struct nmgr_transport *nt;
-    int rc;
-
-    nt = (struct nmgr_transport *) arg;
-
-    rc = os_mqueue_put(&nt->nt_imq, &g_nmgr_evq, m);
-    if (rc != 0) {
-        goto err;
-    }
-
-    return (0);
-err:
-    return (rc);
-}
-
-
 int
 nmgr_task_init(void)
 {
@@ -655,18 +613,6 @@ nmgr_task_init(void)
 
     os_eventq_init(&g_nmgr_evq);
 
-    rc = nmgr_transport_init(&g_nmgr_shell_transport, nmgr_shell_out,
-                             nmgr_shell_get_mtu);
-    if (rc != 0) {
-        goto err;
-    }
-
-    rc = shell_nlip_input_register(nmgr_shell_in,
-            (void *) &g_nmgr_shell_transport);
-    if (rc != 0) {
-        goto err;
-    }
-
     rc = os_task_init(&g_nmgr_task, "newtmgr", nmgr_task, NULL,
       MYNEWT_VAL(NEWTMGR_TASK_PRIO), OS_WAIT_FOREVER,
       newtmgr_stack, OS_STACK_ALIGN(MYNEWT_VAL(NEWTMGR_STACK_SIZE)));

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2b3154cc/mgmt/newtmgr/transport/ble/pkg.yml
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/transport/ble/pkg.yml b/mgmt/newtmgr/transport/ble/pkg.yml
index 45c71e1..27a0b10 100644
--- a/mgmt/newtmgr/transport/ble/pkg.yml
+++ b/mgmt/newtmgr/transport/ble/pkg.yml
@@ -27,6 +27,7 @@ pkg.keywords:
 
 pkg.deps:
     - kernel/os
+    - mgmt/newtmgr
     - net/nimble/host
 
 pkg.init_function: newtmgr_ble_pkg_init

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2b3154cc/mgmt/newtmgr/transport/nmgr_shell/pkg.yml
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/transport/nmgr_shell/pkg.yml b/mgmt/newtmgr/transport/nmgr_shell/pkg.yml
new file mode 100644
index 0000000..e56b2db
--- /dev/null
+++ b/mgmt/newtmgr/transport/nmgr_shell/pkg.yml
@@ -0,0 +1,34 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: mgmt/newtmgr/transport/nmgr_shell
+pkg.description: Newtmgr transport over shell
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+    - newtmgr
+    - shell
+
+pkg.deps:
+    - kernel/os
+    - sys/shell
+    - mgmt/newtmgr
+
+pkg.init_function: nmgr_shell_pkg_init
+pkg.init_stage: 5

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/2b3154cc/mgmt/newtmgr/transport/nmgr_shell/src/nmgr_shell.c
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/transport/nmgr_shell/src/nmgr_shell.c b/mgmt/newtmgr/transport/nmgr_shell/src/nmgr_shell.c
new file mode 100644
index 0000000..efd4952
--- /dev/null
+++ b/mgmt/newtmgr/transport/nmgr_shell/src/nmgr_shell.c
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include <inttypes.h>
+#include <assert.h>
+
+#include <shell/shell.h>
+#include <newtmgr/newtmgr.h>
+
+static struct nmgr_transport nmgr_shell_transport;
+
+static uint16_t
+nmgr_shell_get_mtu(struct os_mbuf *m)
+{
+    return NMGR_MAX_MTU;
+}
+
+static int
+nmgr_shell_out(struct nmgr_transport *nt, struct os_mbuf *m)
+{
+    int rc;
+
+    rc = shell_nlip_output(m);
+    if (rc != 0) {
+        goto err;
+    }
+
+    return (0);
+err:
+    return (rc);
+}
+
+static int
+nmgr_shell_in(struct os_mbuf *m, void *arg)
+{
+    return nmgr_rx_req(&nmgr_shell_transport, m);
+}
+
+void
+nmgr_shell_pkg_init(void)
+{
+    int rc;
+
+    rc = nmgr_transport_init(&nmgr_shell_transport, nmgr_shell_out,
+      nmgr_shell_get_mtu);
+    assert(rc == 0);
+
+    rc = shell_nlip_input_register(nmgr_shell_in, &nmgr_shell_transport);
+    assert(rc == 0);
+}