You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by st...@apache.org on 2016/09/29 01:34:13 UTC

[06/49] incubator-mynewt-core git commit: directory re-org

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/console/full/src/cons_tty.c
----------------------------------------------------------------------
diff --git a/sys/console/full/src/cons_tty.c b/sys/console/full/src/cons_tty.c
new file mode 100644
index 0000000..157ed48
--- /dev/null
+++ b/sys/console/full/src/cons_tty.c
@@ -0,0 +1,561 @@
+/**
+ * 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 "syscfg/syscfg.h"
+#include "sysinit/sysinit.h"
+#include "os/os.h"
+#include "uart/uart.h"
+#include "bsp/bsp.h"
+
+#include "console/console.h"
+#include "console/prompt.h"
+
+/** Indicates whether the previous line of output was completed. */
+int console_is_midline;
+
+#define CONSOLE_TX_BUF_SZ       32      /* IO buffering, must be power of 2 */
+#define CONSOLE_RX_BUF_SZ       128
+#define CONSOLE_RX_CHUNK        16
+
+#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
+#define CONSOLE_HIST_SZ         32
+#endif
+
+#define CONSOLE_DEL             0x7f    /* del character */
+#define CONSOLE_ESC             0x1b    /* esc character */
+#define CONSOLE_LEFT            'D'     /* esc-[-D emitted when moving left */
+#define CONSOLE_UP              'A'     /* esc-[-A moving up */
+#define CONSOLE_RIGHT           'C'     /* esc-[-C moving right */
+#define CONSOLE_DOWN            'B'     /* esc-[-B moving down */
+
+#define CONSOLE_HEAD_INC(cr)    (((cr)->cr_head + 1) & ((cr)->cr_size - 1))
+#define CONSOLE_TAIL_INC(cr)    (((cr)->cr_tail + 1) & ((cr)->cr_size - 1))
+
+typedef void (*console_write_char)(char);
+void console_print_prompt(void);
+
+struct console_ring {
+    uint8_t cr_head;
+    uint8_t cr_tail;
+    uint8_t cr_size;
+    uint8_t _pad;
+    uint8_t *cr_buf;
+};
+
+struct console_tty {
+    struct uart_dev *ct_dev;
+    struct console_ring ct_tx;
+    uint8_t ct_tx_buf[CONSOLE_TX_BUF_SZ]; /* must be after console_ring */
+    struct console_ring ct_rx;
+    uint8_t ct_rx_buf[CONSOLE_RX_BUF_SZ]; /* must be after console_ring */
+    console_rx_cb ct_rx_cb; /* callback that input is ready */
+    console_write_char ct_write_char;
+    uint8_t ct_echo_off:1;
+    uint8_t ct_esc_seq:2;
+} console_tty;
+
+#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
+struct console_hist {
+    uint8_t ch_head;
+    uint8_t ch_tail;
+    uint8_t ch_size;
+    uint8_t ch_curr;
+    uint8_t ch_buf[CONSOLE_HIST_SZ][CONSOLE_RX_BUF_SZ];
+} console_hist;
+#endif
+
+static void
+console_add_char(struct console_ring *cr, char ch)
+{
+    cr->cr_buf[cr->cr_head] = ch;
+    cr->cr_head = CONSOLE_HEAD_INC(cr);
+}
+
+static uint8_t
+console_pull_char(struct console_ring *cr)
+{
+    uint8_t ch;
+
+    ch = cr->cr_buf[cr->cr_tail];
+    cr->cr_tail = CONSOLE_TAIL_INC(cr);
+    return ch;
+}
+
+static int
+console_pull_char_head(struct console_ring *cr)
+{
+    if (cr->cr_head != cr->cr_tail) {
+        cr->cr_head = (cr->cr_head - 1) & (cr->cr_size - 1);
+        return 0;
+    } else {
+        return -1;
+    }
+}
+
+static void
+console_queue_char(char ch)
+{
+    struct console_tty *ct = &console_tty;
+    int sr;
+
+    OS_ENTER_CRITICAL(sr);
+    while (CONSOLE_HEAD_INC(&ct->ct_tx) == ct->ct_tx.cr_tail) {
+        /* TX needs to drain */
+        uart_start_tx(ct->ct_dev);
+        OS_EXIT_CRITICAL(sr);
+        if (os_started()) {
+            os_time_delay(1);
+        }
+        OS_ENTER_CRITICAL(sr);
+    }
+    console_add_char(&ct->ct_tx, ch);
+    OS_EXIT_CRITICAL(sr);
+}
+
+#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
+static void
+console_hist_init(void)
+{
+    struct console_hist *ch = &console_hist;
+
+    ch->ch_head = 0;
+    ch->ch_tail = 0;
+    ch->ch_curr = 0;
+    ch->ch_size = CONSOLE_HIST_SZ;
+}
+
+static void
+console_hist_add(struct console_ring *rx)
+{
+    struct console_hist *ch = &console_hist;
+    uint8_t *str = ch->ch_buf[ch->ch_head];
+    uint8_t tail;
+    uint8_t empty = 1;
+
+    tail = rx->cr_tail;
+    while (tail != rx->cr_head) {
+        *str = rx->cr_buf[tail];
+        if (*str != ' ' && *str != '\t' && *str != '\n') {
+            empty = 0;
+        }
+        if (*str == '\n') {
+            *str = '\0';
+            /* don't save empty history */
+            if (empty) {
+                return;
+            }
+            break;
+        }
+        str++;
+        tail = (tail + 1) % CONSOLE_RX_BUF_SZ;
+    }
+
+    ch->ch_head = (ch->ch_head + 1) & (ch->ch_size - 1);
+    ch->ch_curr = ch->ch_head;
+
+    /* buffer full, start overwriting old history */
+    if (ch->ch_head == ch->ch_tail) {
+        ch->ch_tail = (ch->ch_tail + 1) & (ch->ch_size - 1);
+    }
+}
+
+static int
+console_hist_move(struct console_ring *rx, uint8_t *tx_buf, uint8_t direction)
+{
+    struct console_hist *ch = &console_hist;
+    uint8_t *str = NULL;
+    int space = 0;
+    int i;
+    uint8_t limit = direction == CONSOLE_UP ? ch->ch_tail : ch->ch_head;
+
+    /* no more history to return in this direction */
+    if (ch->ch_curr == limit) {
+        return 0;
+    }
+
+    if (direction == CONSOLE_UP) {
+        ch->ch_curr = (ch->ch_curr - 1) & (ch->ch_size - 1);
+    } else {
+        ch->ch_curr = (ch->ch_curr + 1) & (ch->ch_size - 1);
+    }
+
+    /* consume all chars */
+    while (console_pull_char_head(rx) == 0) {
+        /* do nothing */
+    }
+
+    str = ch->ch_buf[ch->ch_curr];
+    for (i = 0; i < CONSOLE_RX_BUF_SZ; ++i) {
+        if (str[i] == '\0') {
+            break;
+        }
+        tx_buf[i] = str[i];
+        console_add_char(rx, str[i]);
+        space++;
+    }
+
+    return space;
+}
+#endif
+
+static void
+console_blocking_tx(char ch)
+{
+    struct console_tty *ct = &console_tty;
+
+    uart_blocking_tx(ct->ct_dev, ch);
+}
+
+/*
+ * Flush cnt characters from console output queue.
+ */
+static void
+console_tx_flush(struct console_tty *ct, int cnt)
+{
+    int i;
+    uint8_t byte;
+
+    for (i = 0; i < cnt; i++) {
+        if (ct->ct_tx.cr_head == ct->ct_tx.cr_tail) {
+            /*
+             * Queue is empty.
+             */
+            break;
+        }
+        byte = console_pull_char(&ct->ct_tx);
+        console_blocking_tx(byte);
+    }
+}
+
+void
+console_blocking_mode(void)
+{
+    struct console_tty *ct = &console_tty;
+    int sr;
+
+    OS_ENTER_CRITICAL(sr);
+    if (ct->ct_write_char) {
+        ct->ct_write_char = console_blocking_tx;
+
+        console_tx_flush(ct, CONSOLE_TX_BUF_SZ);
+    }
+    OS_EXIT_CRITICAL(sr);
+}
+
+void
+console_echo(int on)
+{
+    struct console_tty *ct = &console_tty;
+
+    ct->ct_echo_off = !on;
+}
+
+size_t
+console_file_write(void *arg, const char *str, size_t cnt)
+{
+    struct console_tty *ct = &console_tty;
+    int i;
+
+    if (!ct->ct_write_char) {
+        return cnt;
+    }
+    for (i = 0; i < cnt; i++) {
+        if (str[i] == '\n') {
+            ct->ct_write_char('\r');
+        }
+        ct->ct_write_char(str[i]);
+    }
+    if (cnt > 0) {
+        console_is_midline = str[cnt - 1] != '\n';
+    }
+    uart_start_tx(ct->ct_dev);
+    return cnt;
+}
+
+void
+console_write(const char *str, int cnt)
+{
+    console_file_write(NULL, str, cnt);
+}
+
+int
+console_read(char *str, int cnt, int *newline)
+{
+    struct console_tty *ct = &console_tty;
+    struct console_ring *cr = &ct->ct_rx;
+    int sr;
+    int i;
+    uint8_t ch;
+
+    *newline = 0;
+    OS_ENTER_CRITICAL(sr);
+    for (i = 0; i < cnt; i++) {
+        if (cr->cr_head == cr->cr_tail) {
+            break;
+        }
+
+        if ((i & (CONSOLE_RX_CHUNK - 1)) == (CONSOLE_RX_CHUNK - 1)) {
+            /*
+             * Make a break from blocking interrupts during the copy.
+             */
+            OS_EXIT_CRITICAL(sr);
+            OS_ENTER_CRITICAL(sr);
+        }
+
+        ch = console_pull_char(cr);
+        if (ch == '\n') {
+            *str = '\0';
+            *newline = 1;
+            break;
+        }
+        *str++ = ch;
+    }
+    OS_EXIT_CRITICAL(sr);
+    if (i > 0 || *newline) {
+        uart_start_rx(ct->ct_dev);
+    }
+    return i;
+}
+
+/*
+ * Interrupts disabled when console_tx_char/console_rx_char are called.
+ */
+static int
+console_tx_char(void *arg)
+{
+    struct console_tty *ct = (struct console_tty *)arg;
+    struct console_ring *cr = &ct->ct_tx;
+
+    if (cr->cr_head == cr->cr_tail) {
+        /*
+         * No more data.
+         */
+        return -1;
+    }
+    return console_pull_char(cr);
+}
+
+static int
+console_buf_space(struct console_ring *cr)
+{
+    int space;
+
+    space = (cr->cr_tail - cr->cr_head) & (cr->cr_size - 1);
+    return space - 1;
+}
+
+static int
+console_rx_char(void *arg, uint8_t data)
+{
+    struct console_tty *ct = (struct console_tty *)arg;
+    struct console_ring *tx = &ct->ct_tx;
+    struct console_ring *rx = &ct->ct_rx;
+    int tx_space = 0;
+    int i;
+#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
+    uint8_t tx_buf[CONSOLE_RX_BUF_SZ];
+#else
+    uint8_t tx_buf[3];
+#endif
+
+    if (CONSOLE_HEAD_INC(&ct->ct_rx) == ct->ct_rx.cr_tail) {
+        /*
+         * RX queue full. Reader must drain this.
+         */
+        if (ct->ct_rx_cb) {
+            ct->ct_rx_cb();
+        }
+        return -1;
+    }
+
+    /* echo */
+    switch (data) {
+    case '\r':
+    case '\n':
+        /*
+         * linefeed
+         */
+        tx_buf[0] = '\n';
+        tx_buf[1] = '\r';
+        tx_space = 2;
+        console_add_char(rx, '\n');
+#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
+        console_hist_add(rx);
+#endif
+        if (ct->ct_rx_cb) {
+            ct->ct_rx_cb();
+        }
+        break;
+    case CONSOLE_ESC:
+        ct->ct_esc_seq = 1;
+        goto out;
+    case '[':
+        if (ct->ct_esc_seq == 1) {
+            ct->ct_esc_seq = 2;
+            goto out;
+        } else {
+            goto queue_char;
+        }
+        break;
+    case CONSOLE_LEFT:
+        if (ct->ct_esc_seq == 2) {
+            goto backspace;
+        } else {
+            goto queue_char;
+        }
+        break;
+    case CONSOLE_UP:
+    case CONSOLE_DOWN:
+        if (ct->ct_esc_seq != 2) {
+            goto queue_char;
+        }
+#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
+        tx_space = console_hist_move(rx, tx_buf, data);
+        tx_buf[tx_space] = 0;
+        ct->ct_esc_seq = 0;
+        /*
+         * when moving up, stop on oldest history entry
+         * when moving down, let it delete input before leaving...
+         */
+        if (data == CONSOLE_UP && tx_space == 0) {
+            goto out;
+        }
+        if (!ct->ct_echo_off) {
+            /* HACK: clean line by backspacing up to maximum possible space */
+            for (i = 0; i < CONSOLE_TX_BUF_SZ; i++) {
+                if (console_buf_space(tx) < 3) {
+                    console_tx_flush(ct, 3);
+                }
+                console_add_char(tx, '\b');
+                console_add_char(tx, ' ');
+                console_add_char(tx, '\b');
+                uart_start_tx(ct->ct_dev);
+            }
+            if (tx_space == 0) {
+                goto out;
+            }
+        } else {
+            goto queue_char;
+        }
+        break;
+#else
+        ct->ct_esc_seq = 0;
+        goto out;
+#endif
+    case CONSOLE_RIGHT:
+        if (ct->ct_esc_seq == 2) {
+            data = ' '; /* add space */
+        }
+        goto queue_char;
+    case '\b':
+    case CONSOLE_DEL:
+backspace:
+        /*
+         * backspace
+         */
+        ct->ct_esc_seq = 0;
+        if (console_pull_char_head(rx) == 0) {
+            /*
+             * Only wipe out char if we can pull stuff off from head.
+             */
+            tx_buf[0] = '\b';
+            tx_buf[1] = ' ';
+            tx_buf[2] = '\b';
+            tx_space = 3;
+        } else {
+            goto out;
+        }
+        break;
+    default:
+queue_char:
+        tx_buf[0] = data;
+        tx_space = 1;
+        ct->ct_esc_seq = 0;
+        console_add_char(rx, data);
+        break;
+    }
+    if (!ct->ct_echo_off) {
+        if (console_buf_space(tx) < tx_space) {
+            console_tx_flush(ct, tx_space);
+        }
+        for (i = 0; i < tx_space; i++) {
+            console_add_char(tx, tx_buf[i]);
+        }
+        uart_start_tx(ct->ct_dev);
+    }
+out:
+    return 0;
+}
+
+int
+console_is_init(void)
+{
+    struct console_tty *ct = &console_tty;
+
+    return (ct->ct_dev != NULL);
+}
+
+int
+console_init(console_rx_cb rx_cb)
+{
+    struct console_tty *ct = &console_tty;
+    struct uart_conf uc = {
+        .uc_speed = CONSOLE_UART_SPEED,
+        .uc_databits = 8,
+        .uc_stopbits = 1,
+        .uc_parity = UART_PARITY_NONE,
+        .uc_flow_ctl = UART_FLOW_CTL_NONE,
+        .uc_tx_char = console_tx_char,
+        .uc_rx_char = console_rx_char,
+        .uc_cb_arg = ct
+    };
+
+    ct->ct_rx_cb = rx_cb;
+    if (!ct->ct_dev) {
+        ct->ct_tx.cr_size = CONSOLE_TX_BUF_SZ;
+        ct->ct_tx.cr_buf = ct->ct_tx_buf;
+        ct->ct_rx.cr_size = CONSOLE_RX_BUF_SZ;
+        ct->ct_rx.cr_buf = ct->ct_rx_buf;
+        ct->ct_write_char = console_queue_char;
+
+        ct->ct_dev = (struct uart_dev *)os_dev_open(CONSOLE_UART,
+          OS_TIMEOUT_NEVER, &uc);
+        if (!ct->ct_dev) {
+            return -1;
+        }
+        ct->ct_echo_off = ! MYNEWT_VAL(CONSOLE_ECHO);
+    }
+
+#if MYNEWT_VAL(CONSOLE_HIST_ENABLE)
+    console_hist_init();
+#endif
+
+    return 0;
+}
+
+void
+console_pkg_init(void)
+{
+    int rc;
+
+    rc = console_init(NULL);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/console/full/src/prompt.c
----------------------------------------------------------------------
diff --git a/sys/console/full/src/prompt.c b/sys/console/full/src/prompt.c
new file mode 100644
index 0000000..33e37c0
--- /dev/null
+++ b/sys/console/full/src/prompt.c
@@ -0,0 +1,49 @@
+/**
+ * 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 "console/console.h"
+#include "console/prompt.h"
+#include <syscfg/syscfg.h>
+
+/* console prompt, always followed by a space */
+static char console_prompt[] = " > ";
+static char do_prompt = MYNEWT_VAL(CONSOLE_PROMPT);
+
+
+/* set the prompt character, leave the space */
+void
+console_set_prompt(char p)
+{
+    do_prompt = 1;
+    console_prompt[1] = p;
+}
+
+void console_no_prompt(void) {
+    do_prompt = 0;
+}
+
+/* print the prompt to the console */
+void
+console_print_prompt(void)
+{
+    if (do_prompt) {
+        console_printf("%s", console_prompt);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/console/stub/include/console/console.h
----------------------------------------------------------------------
diff --git a/sys/console/stub/include/console/console.h b/sys/console/stub/include/console/console.h
new file mode 100644
index 0000000..99db457
--- /dev/null
+++ b/sys/console/stub/include/console/console.h
@@ -0,0 +1,71 @@
+/**
+ * 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.
+ */
+#ifndef __CONSOLE_H__
+#define __CONSOLE_H__
+
+#include <stdarg.h>
+
+typedef void (*console_rx_cb)(void);
+
+static int inline
+console_is_init(void)
+{
+    return 0;
+}
+
+static int inline
+console_init(console_rx_cb rxcb)
+{
+    return 0;
+}
+
+static int inline
+console_read(char *str, int cnt, int *newline)
+{
+    *newline = 0;
+    return 0;
+}
+
+static void inline
+console_blocking_mode(void)
+{
+}
+
+static void inline
+console_write(const char *str, int cnt)
+{
+}
+
+static void inline console_printf(const char *fmt, ...)
+    __attribute__ ((format (printf, 1, 2)));
+
+static void inline
+console_printf(const char *fmt, ...)
+{
+}
+
+static void inline
+console_echo(int on)
+{
+}
+
+#define console_is_midline  (0)
+
+#endif /* __CONSOLE__ */
+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/console/stub/include/console/prompt.h
----------------------------------------------------------------------
diff --git a/sys/console/stub/include/console/prompt.h b/sys/console/stub/include/console/prompt.h
new file mode 100644
index 0000000..a1d72c9
--- /dev/null
+++ b/sys/console/stub/include/console/prompt.h
@@ -0,0 +1,35 @@
+/**
+ * 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.
+ */
+
+#ifndef __CONSOLE_PROMPT_H__
+#define __CONSOLE_PROMPT_H__
+nclude/console/prompt.h
+
+#include <stdarg.h>
+
+/* print console prompt */
+void console_print_prompt(void);
+/* set the console prompt character */
+void console_set_prompt(char);
+
+
+extern char console_prompt[2];
+
+
+#endif /* __CONSOLE_PROMPT_H__ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/console/stub/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/console/stub/pkg.yml b/sys/console/stub/pkg.yml
new file mode 100644
index 0000000..4159e8c
--- /dev/null
+++ b/sys/console/stub/pkg.yml
@@ -0,0 +1,27 @@
+#
+# 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: sys/console/stub
+pkg.description: Stub for text-based IO interface.
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+
+pkg.deps:
+pkg.apis: console

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/coredump/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/coredump/pkg.yml b/sys/coredump/pkg.yml
index 3da1277..2c84751 100644
--- a/sys/coredump/pkg.yml
+++ b/sys/coredump/pkg.yml
@@ -26,5 +26,5 @@ pkg.keywords:
 
 pkg.deps:
     - hw/hal
-    - libs/bootutil
+    - boot/bootutil
     - libs/imgmgr

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/README.md
----------------------------------------------------------------------
diff --git a/sys/fcb/README.md b/sys/fcb/README.md
deleted file mode 100644
index 5d13ccd..0000000
--- a/sys/fcb/README.md
+++ /dev/null
@@ -1,58 +0,0 @@
-<!--
-#
-# 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.
-#
--->
-
-# Flash circular buffer
-
-# Overview
-
-Storage of elements in flash in FIFO fashion. Elements are appended to the of the area until storage space is exhausted. Then the oldest sector should be erased and that can be used in storing new entries.
-
-# API
-
-fcb_init()
-  - initialize fcb for a given array of flash sectors
-
-fcb_append()
-  - reserve space to store an element
-fcb_append_finish()
-  - storage of the element is finished; can calculate CRC for it
-
-fcb_walk(cb, sector)
-  - call cb for every element in the buffer. Or for every element in
-    a particular flash sector, if sector is specified
-fcb_getnext(elem)
-  - return element following elem
-
-fcb_rotate()
-  - erase oldest used sector, and make it current
-
-# Usage
-
-To add an element to circular buffer:
-1. call fcb_append() to get location; if this fails due to lack of space,
-   call fcb_rotate()
-2. use flash_area_write() to write contents
-3. call fcb_append_finish() when done
-
-To read contents of the circular buffer:
-1. call fcb_walk() with callback
-2. within callback: copy in data from the element using flash_area_read(),
-   call fcb_rotate() when all elements from a given sector have been read

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/include/fcb/fcb.h
----------------------------------------------------------------------
diff --git a/sys/fcb/include/fcb/fcb.h b/sys/fcb/include/fcb/fcb.h
deleted file mode 100644
index a6b3f88..0000000
--- a/sys/fcb/include/fcb/fcb.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * 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.
- */
-#ifndef __SYS_FCB_H_
-#define __SYS_FCB_H_
-
-/*
- * Flash circular buffer.
- */
-#include <inttypes.h>
-#include <limits.h>
-
-#include <hal/flash_map.h>
-
-#include <os/os_mutex.h>
-
-#define FCB_MAX_LEN	(CHAR_MAX | CHAR_MAX << 7) /* Max length of element */
-
-/*
- * Entry location is pointer to area (within fcb->f_sectors), and offset
- * within that area.
- */
-struct fcb_entry {
-    struct flash_area *fe_area;	/* ptr to area within fcb->f_sectors */
-    uint32_t fe_elem_off;	/* start of entry */
-    uint32_t fe_data_off;	/* start of data */
-    uint16_t fe_data_len;	/* size of data area */
-};
-
-struct fcb {
-    /* Caller of fcb_init fills this in */
-    uint32_t f_magic;		/* As placed on the disk */
-    uint8_t f_version;  	/* Current version number of the data */
-    uint8_t f_sector_cnt;	/* Number of elements in sector array */
-    uint8_t f_scratch_cnt;	/* How many sectors should be kept empty */
-    struct flash_area *f_sectors; /* Array of sectors, must be contiguous */
-
-    /* Flash circular buffer internal state */
-    struct os_mutex f_mtx;	/* Locking for accessing the FCB data */
-    struct flash_area *f_oldest;
-    struct fcb_entry f_active;
-    uint16_t f_active_id;
-    uint8_t f_align;		/* writes to flash have to aligned to this */
-};
-
-/*
- * Error codes.
- */
-#define FCB_OK		0
-#define FCB_ERR_ARGS	-1
-#define FCB_ERR_FLASH	-2
-#define FCB_ERR_NOVAR   -3
-#define FCB_ERR_NOSPACE	-4
-#define FCB_ERR_NOMEM	-5
-#define FCB_ERR_CRC	-6
-#define FCB_ERR_MAGIC   -7
-
-int fcb_init(struct fcb *fcb);
-
-/*
- * fcb_log is needed as the number of entries in a log
- */
-struct fcb_log {
-    struct fcb fl_fcb;
-    uint8_t fl_entries;
-};
-
-int log_fcb_init(struct fcb_log *fcblog, struct fcb *fcb, uint16_t entries);
-
-/*
- * fcb_append() appends an entry to circular buffer. When writing the
- * contents for the entry, use loc->fl_area and loc->fl_data_off with
- * flash_area_write(). When you're finished, call fcb_append_finish() with
- * loc as argument.
- */
-int fcb_append(struct fcb *, uint16_t len, struct fcb_entry *loc);
-int fcb_append_finish(struct fcb *, struct fcb_entry *append_loc);
-
-/*
- * Walk over all log entries in FCB, or entries in a given flash_area.
- * cb gets called for every entry. If cb wants to stop the walk, it should
- * return non-zero value.
- *
- * Entry data can be read using flash_area_read(), using
- * loc->fe_area, loc->fe_data_off, and loc->fe_data_len as arguments.
- */
-typedef int (*fcb_walk_cb)(struct fcb_entry *loc, void *arg);
-int fcb_walk(struct fcb *, struct flash_area *, fcb_walk_cb cb, void *cb_arg);
-int fcb_getnext(struct fcb *, struct fcb_entry *loc);
-
-/*
- * Erases the data from oldest sector.
- */
-int fcb_rotate(struct fcb *);
-
-/*
- * Start using the scratch block.
- */
-int fcb_append_to_scratch(struct fcb *);
-
-/*
- * How many sectors are unused.
- */
-int fcb_free_sector_cnt(struct fcb *fcb);
-
-/*
- * Whether FCB has any data.
- */
-int fcb_is_empty(struct fcb *fcb);
-
-int
-fcb_offset_last_n(struct fcb *fcb, uint8_t entries, uint32_t *last_n_off);
-
-/*
- * Clears FCB passed to it
- */
-int fcb_clear(struct fcb *fcb);
-
-#endif /* __SYS_FLASHVAR_H_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/fcb/pkg.yml b/sys/fcb/pkg.yml
deleted file mode 100644
index bba5355..0000000
--- a/sys/fcb/pkg.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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: sys/fcb
-pkg.description: Flash circular buffer.
-pkg.keywords:
-    - flash
-    - storage
-    - log
-
-pkg.deps:
-    - libs/os

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/src/fcb.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb.c b/sys/fcb/src/fcb.c
deleted file mode 100644
index fb85508..0000000
--- a/sys/fcb/src/fcb.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/**
- * 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 <limits.h>
-#include <stdlib.h>
-
-#include "fcb/fcb.h"
-#include "fcb_priv.h"
-#include "string.h"
-
-int
-fcb_init(struct fcb *fcb)
-{
-    struct flash_area *fap;
-    int rc;
-    int i;
-    int max_align = 1;
-    int align;
-    int oldest = -1, newest = -1;
-    struct flash_area *oldest_fap = NULL, *newest_fap = NULL;
-    struct fcb_disk_area fda;
-
-    if (!fcb->f_sectors || fcb->f_sector_cnt - fcb->f_scratch_cnt < 1) {
-        return FCB_ERR_ARGS;
-    }
-
-    /* Fill last used, first used */
-    for (i = 0; i < fcb->f_sector_cnt; i++) {
-        fap = &fcb->f_sectors[i];
-        align = flash_area_align(fap);
-        if (align > max_align) {
-            max_align = flash_area_align(fap);
-        }
-        rc = fcb_sector_hdr_read(fcb, fap, &fda);
-        if (rc <= 0) {
-            continue;
-        }
-        if (oldest < 0) {
-            oldest = newest = fda.fd_id;
-            oldest_fap = newest_fap = fap;
-            continue;
-        }
-        if (FCB_ID_GT(fda.fd_id, newest)) {
-            newest = fda.fd_id;
-            newest_fap = fap;
-        } else if (FCB_ID_GT(oldest, fda.fd_id)) {
-            oldest = fda.fd_id;
-            oldest_fap = fap;
-        }
-    }
-    if (oldest < 0) {
-        /*
-         * No initialized areas.
-         */
-        oldest_fap = newest_fap = &fcb->f_sectors[0];
-        rc = fcb_sector_hdr_init(fcb, oldest_fap, 0);
-        if (rc) {
-            return rc;
-        }
-        newest = oldest = 0;
-    }
-    fcb->f_align = max_align;
-    fcb->f_oldest = oldest_fap;
-    fcb->f_active.fe_area = newest_fap;
-    fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area);
-    fcb->f_active_id = newest;
-
-    while (1) {
-        rc = fcb_getnext_in_area(fcb, &fcb->f_active);
-        if (rc == FCB_ERR_NOVAR) {
-            rc = FCB_OK;
-            break;
-        }
-        if (rc != 0) {
-            break;
-        }
-    }
-    os_mutex_init(&fcb->f_mtx);
-    return rc;
-}
-
-int
-fcb_free_sector_cnt(struct fcb *fcb)
-{
-    int i;
-    struct flash_area *fa;
-
-    fa = fcb->f_active.fe_area;
-    for (i = 0; i < fcb->f_sector_cnt; i++) {
-        fa = fcb_getnext_area(fcb, fa);
-        if (fa == fcb->f_oldest) {
-            break;
-        }
-    }
-    return i;
-}
-
-int
-fcb_is_empty(struct fcb *fcb)
-{
-    return (fcb->f_active.fe_area == fcb->f_oldest &&
-      fcb->f_active.fe_elem_off == sizeof(struct fcb_disk_area));
-}
-
-/**
- * Length of an element is encoded in 1 or 2 bytes.
- * 1 byte for lengths < 128 bytes, and 2 bytes for < 16384.
- */
-int
-fcb_put_len(uint8_t *buf, uint16_t len)
-{
-    if (len < CHAR_MAX) {
-        buf[0] = len;
-        return 1;
-    } else if (len < FCB_MAX_LEN) {
-        buf[0] = (len & 0x7f) | 0x80;
-        buf[1] = len >> 7;
-        return 2;
-    } else {
-        return FCB_ERR_ARGS;
-    }
-}
-
-int
-fcb_get_len(uint8_t *buf, uint16_t *len)
-{
-    int rc;
-
-    if (buf[0] & 0x80) {
-        if (buf[0] == 0xff && buf[1] == 0xff) {
-            return FCB_ERR_NOVAR;
-        }
-        *len = (buf[0] & 0x7f) | (buf[1] << 7);
-        rc = 2;
-    } else {
-        *len = buf[0];
-        rc = 1;
-    }
-    return rc;
-}
-
-/**
- * Initialize erased sector for use.
- */
-int
-fcb_sector_hdr_init(struct fcb *fcb, struct flash_area *fap, uint16_t id)
-{
-    struct fcb_disk_area fda;
-    int rc;
-
-    fda.fd_magic = fcb->f_magic;
-    fda.fd_ver = fcb->f_version;
-    fda._pad = 0xff;
-    fda.fd_id = id;
-
-    rc = flash_area_write(fap, 0, &fda, sizeof(fda));
-    if (rc) {
-        return FCB_ERR_FLASH;
-    }
-    return 0;
-}
-
-/**
- * Checks whether FCB sector contains data or not.
- * Returns <0 in error.
- * Returns 0 if sector is unused;
- * Returns 1 if sector has data.
- */
-int
-fcb_sector_hdr_read(struct fcb *fcb, struct flash_area *fap,
-  struct fcb_disk_area *fdap)
-{
-    struct fcb_disk_area fda;
-    int rc;
-
-    if (!fdap) {
-        fdap = &fda;
-    }
-    rc = flash_area_read(fap, 0, fdap, sizeof(*fdap));
-    if (rc) {
-        return FCB_ERR_FLASH;
-    }
-    if (fdap->fd_magic == 0xffffffff) {
-        return 0;
-    }
-    if (fdap->fd_magic != fcb->f_magic) {
-        return FCB_ERR_MAGIC;
-    }
-    return 1;
-}
-
-/**
- * Finds n-th element offset
- * @param0 ptr to fcb
- * @param1 n number of entries to calculate offset before
- * @param2 ptr to the offset before to be returned
- * @return 0 on success; non-zero on failure
- */
-int
-fcb_offset_last_n(struct fcb *fcb, uint8_t entries, uint32_t *last_n_off)
-{
-    struct fcb_entry loc;
-    struct fcb_entry start;
-    int i;
-
-    i = 0;
-    memset(&loc, 0, sizeof(loc));
-    while (!fcb_getnext(fcb, &loc)) {
-        if (i == 0) {
-            /* Start from the beginning of fcb entries */
-            *last_n_off = loc.fe_elem_off;
-            start = loc;
-        }
-        /* Update last_n_off after n entries and keep updating */
-        if (i >= (entries - 1)) {
-            fcb_getnext(fcb, &start);
-            *last_n_off = start.fe_elem_off;
-        }
-        i++;
-    }
-
-    return 0;
-}
-
-/**
- * Clear fcb
- * @param fcb
- * @return 0 on success; non-zero on failure
- */
-int
-fcb_clear(struct fcb *fcb)
-{
-    int rc;
-
-    rc = 0;
-    while (!fcb_is_empty(fcb)) {
-        rc = fcb_rotate(fcb);
-        if (rc) {
-            break;
-        }
-    }
-    return rc;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/src/fcb_append.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_append.c b/sys/fcb/src/fcb_append.c
deleted file mode 100644
index c7f5ddc..0000000
--- a/sys/fcb/src/fcb_append.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * 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 <stddef.h>
-
-#include "fcb/fcb.h"
-#include "fcb_priv.h"
-
-static struct flash_area *
-fcb_new_area(struct fcb *fcb, int cnt)
-{
-    struct flash_area *fa;
-    struct flash_area *rfa;
-    int i;
-
-    rfa = NULL;
-    i = 0;
-    fa = fcb->f_active.fe_area;
-    do {
-        fa = fcb_getnext_area(fcb, fa);
-        if (!rfa) {
-            rfa = fa;
-        }
-        if (fa == fcb->f_oldest) {
-            return NULL;
-        }
-    } while (i++ < cnt);
-    return rfa;
-}
-
-/*
- * Take one of the scratch blocks into use, if at all possible.
- */
-int
-fcb_append_to_scratch(struct fcb *fcb)
-{
-    struct flash_area *fa;
-    int rc;
-
-    fa = fcb_new_area(fcb, 0);
-    if (!fa) {
-        return FCB_ERR_NOSPACE;
-    }
-    rc = fcb_sector_hdr_init(fcb, fa, fcb->f_active_id + 1);
-    if (rc) {
-        return rc;
-    }
-    fcb->f_active.fe_area = fa;
-    fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area);
-    fcb->f_active_id++;
-    return FCB_OK;
-}
-
-int
-fcb_append(struct fcb *fcb, uint16_t len, struct fcb_entry *append_loc)
-{
-    struct fcb_entry *active;
-    struct flash_area *fa;
-    uint8_t tmp_str[2];
-    int cnt;
-    int rc;
-
-    cnt = fcb_put_len(tmp_str, len);
-    if (cnt < 0) {
-        return cnt;
-    }
-    cnt = fcb_len_in_flash(fcb, cnt);
-    len = fcb_len_in_flash(fcb, len) + fcb_len_in_flash(fcb, FCB_CRC_SZ);
-
-    rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc && rc != OS_NOT_STARTED) {
-        return FCB_ERR_ARGS;
-    }
-    active = &fcb->f_active;
-    if (active->fe_elem_off + len + cnt > active->fe_area->fa_size) {
-        fa = fcb_new_area(fcb, fcb->f_scratch_cnt);
-        if (!fa || (fa->fa_size <
-            sizeof(struct fcb_disk_area) + len + cnt)) {
-            rc = FCB_ERR_NOSPACE;
-            goto err;
-        }
-        rc = fcb_sector_hdr_init(fcb, fa, fcb->f_active_id + 1);
-        if (rc) {
-            goto err;
-        }
-        fcb->f_active.fe_area = fa;
-        fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area);
-        fcb->f_active_id++;
-    }
-
-    rc = flash_area_write(active->fe_area, active->fe_elem_off, tmp_str, cnt);
-    if (rc) {
-        rc = FCB_ERR_FLASH;
-        goto err;
-    }
-    append_loc->fe_area = active->fe_area;
-    append_loc->fe_elem_off = active->fe_elem_off;
-    append_loc->fe_data_off = active->fe_elem_off + cnt;
-
-    active->fe_elem_off = append_loc->fe_data_off + len;
-
-    os_mutex_release(&fcb->f_mtx);
-
-    return FCB_OK;
-err:
-    os_mutex_release(&fcb->f_mtx);
-    return rc;
-}
-
-int
-fcb_append_finish(struct fcb *fcb, struct fcb_entry *loc)
-{
-    int rc;
-    uint8_t crc8;
-    uint32_t off;
-
-    rc = fcb_elem_crc8(fcb, loc, &crc8);
-    if (rc) {
-        return rc;
-    }
-    off = loc->fe_data_off + fcb_len_in_flash(fcb, loc->fe_data_len);
-
-    rc = flash_area_write(loc->fe_area, off, &crc8, sizeof(crc8));
-    if (rc) {
-        return FCB_ERR_FLASH;
-    }
-    return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/src/fcb_elem_info.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_elem_info.c b/sys/fcb/src/fcb_elem_info.c
deleted file mode 100644
index 58e5210..0000000
--- a/sys/fcb/src/fcb_elem_info.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * 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 <util/crc8.h>
-
-#include "fcb/fcb.h"
-#include "fcb_priv.h"
-
-/*
- * Given offset in flash area, fill in rest of the fcb_entry, and crc8 over
- * the data.
- */
-int
-fcb_elem_crc8(struct fcb *fcb, struct fcb_entry *loc, uint8_t *c8p)
-{
-    uint8_t tmp_str[FCB_TMP_BUF_SZ];
-    int cnt;
-    int blk_sz;
-    uint8_t crc8;
-    uint16_t len;
-    uint32_t off;
-    uint32_t end;
-    int rc;
-
-    if (loc->fe_elem_off + 2 > loc->fe_area->fa_size) {
-        return FCB_ERR_NOVAR;
-    }
-    rc = flash_area_read(loc->fe_area, loc->fe_elem_off, tmp_str, 2);
-    if (rc) {
-        return FCB_ERR_FLASH;
-    }
-
-    cnt = fcb_get_len(tmp_str, &len);
-    if (cnt < 0) {
-        return cnt;
-    }
-    loc->fe_data_off = loc->fe_elem_off + fcb_len_in_flash(fcb, cnt);
-    loc->fe_data_len = len;
-
-    crc8 = crc8_init();
-    crc8 = crc8_calc(crc8, tmp_str, cnt);
-
-    off = loc->fe_data_off;
-    end = loc->fe_data_off + len;
-    for (; off < end; off += blk_sz) {
-        blk_sz = end - off;
-        if (blk_sz > sizeof(tmp_str)) {
-            blk_sz = sizeof(tmp_str);
-        }
-
-        rc = flash_area_read(loc->fe_area, off, tmp_str, blk_sz);
-        if (rc) {
-            return FCB_ERR_FLASH;
-        }
-        crc8 = crc8_calc(crc8, tmp_str, blk_sz);
-    }
-    *c8p = crc8;
-
-    return 0;
-}
-
-int
-fcb_elem_info(struct fcb *fcb, struct fcb_entry *loc)
-{
-    int rc;
-    uint8_t crc8;
-    uint8_t fl_crc8;
-    uint32_t off;
-
-    rc = fcb_elem_crc8(fcb, loc, &crc8);
-    if (rc) {
-        return rc;
-    }
-    off = loc->fe_data_off + fcb_len_in_flash(fcb, loc->fe_data_len);
-
-    rc = flash_area_read(loc->fe_area, off, &fl_crc8, sizeof(fl_crc8));
-    if (rc) {
-        return FCB_ERR_FLASH;
-    }
-
-    if (fl_crc8 != crc8) {
-        return FCB_ERR_CRC;
-    }
-    return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/src/fcb_getnext.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_getnext.c b/sys/fcb/src/fcb_getnext.c
deleted file mode 100644
index be92979..0000000
--- a/sys/fcb/src/fcb_getnext.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * 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 <stddef.h>
-
-#include "fcb/fcb.h"
-#include "fcb_priv.h"
-
-int
-fcb_getnext_in_area(struct fcb *fcb, struct fcb_entry *loc)
-{
-    int rc;
-
-    rc = fcb_elem_info(fcb, loc);
-    if (rc == 0 || rc == FCB_ERR_CRC) {
-        do {
-            loc->fe_elem_off = loc->fe_data_off +
-              fcb_len_in_flash(fcb, loc->fe_data_len) +
-              fcb_len_in_flash(fcb, FCB_CRC_SZ);
-            rc = fcb_elem_info(fcb, loc);
-            if (rc != FCB_ERR_CRC) {
-                break;
-            }
-        } while (rc == FCB_ERR_CRC);
-    }
-    return rc;
-}
-
-struct flash_area *
-fcb_getnext_area(struct fcb *fcb, struct flash_area *fap)
-{
-    fap++;
-    if (fap >= &fcb->f_sectors[fcb->f_sector_cnt]) {
-        fap = &fcb->f_sectors[0];
-    }
-    return fap;
-}
-
-int
-fcb_getnext_nolock(struct fcb *fcb, struct fcb_entry *loc)
-{
-    int rc;
-
-    if (loc->fe_area == NULL) {
-        /*
-         * Find the first one we have in flash.
-         */
-        loc->fe_area = fcb->f_oldest;
-    }
-    if (loc->fe_elem_off == 0) {
-        /*
-         * If offset is zero, we serve the first entry from the area.
-         */
-        loc->fe_elem_off = sizeof(struct fcb_disk_area);
-        rc = fcb_elem_info(fcb, loc);
-        switch (rc) {
-        case 0:
-            return 0;
-        case FCB_ERR_CRC:
-            break;
-        default:
-            goto next_sector;
-        }
-    } else {
-        rc = fcb_getnext_in_area(fcb, loc);
-        if (rc == 0) {
-            return 0;
-        }
-        if (rc == FCB_ERR_NOVAR) {
-            goto next_sector;
-        }
-    }
-    while (rc == FCB_ERR_CRC) {
-        rc = fcb_getnext_in_area(fcb, loc);
-        if (rc == 0) {
-            return 0;
-        }
-
-        if (rc != FCB_ERR_CRC) {
-            /*
-             * Moving to next sector.
-             */
-next_sector:
-            if (loc->fe_area == fcb->f_active.fe_area) {
-                return FCB_ERR_NOVAR;
-            }
-            loc->fe_area = fcb_getnext_area(fcb, loc->fe_area);
-            loc->fe_elem_off = sizeof(struct fcb_disk_area);
-            rc = fcb_elem_info(fcb, loc);
-            switch (rc) {
-            case 0:
-                return 0;
-            case FCB_ERR_CRC:
-                break;
-            default:
-                goto next_sector;
-            }
-        }
-    }
-
-    return 0;
-}
-
-int
-fcb_getnext(struct fcb *fcb, struct fcb_entry *loc)
-{
-    int rc;
-
-    rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc && rc != OS_NOT_STARTED) {
-        return FCB_ERR_ARGS;
-    }
-    rc = fcb_getnext_nolock(fcb, loc);
-    os_mutex_release(&fcb->f_mtx);
-
-    return rc;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/src/fcb_priv.h
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_priv.h b/sys/fcb/src/fcb_priv.h
deleted file mode 100644
index b7a9e0b..0000000
--- a/sys/fcb/src/fcb_priv.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.
- */
-#ifndef __SYS_FCB_PRIV_H_
-#define __SYS_FCB_PRIV_H_
-
-#define FCB_CRC_SZ	sizeof(uint8_t)
-#define FCB_TMP_BUF_SZ	32
-
-#define FCB_ID_GT(a, b) (((int16_t)(a) - (int16_t)(b)) > 0)
-
-struct fcb_disk_area {
-    uint32_t fd_magic;
-    uint8_t  fd_ver;
-    uint8_t  _pad;
-    uint16_t fd_id;
-};
-
-int fcb_put_len(uint8_t *buf, uint16_t len);
-int fcb_get_len(uint8_t *buf, uint16_t *len);
-
-static inline int
-fcb_len_in_flash(struct fcb *fcb, uint16_t len)
-{
-    if (fcb->f_align <= 1) {
-        return len;
-    }
-    return (len + (fcb->f_align - 1)) & ~(fcb->f_align - 1);
-}
-
-int fcb_getnext_in_area(struct fcb *fcb, struct fcb_entry *loc);
-struct flash_area *fcb_getnext_area(struct fcb *fcb, struct flash_area *fap);
-int fcb_getnext_nolock(struct fcb *fcb, struct fcb_entry *loc);
-
-int fcb_elem_info(struct fcb *, struct fcb_entry *);
-int fcb_elem_crc8(struct fcb *, struct fcb_entry *loc, uint8_t *crc8p);
-
-int fcb_sector_hdr_init(struct fcb *, struct flash_area *fap, uint16_t id);
-int fcb_sector_hdr_read(struct fcb *, struct flash_area *fap,
-  struct fcb_disk_area *fdap);
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/src/fcb_rotate.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_rotate.c b/sys/fcb/src/fcb_rotate.c
deleted file mode 100644
index 7b6df58..0000000
--- a/sys/fcb/src/fcb_rotate.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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 "fcb/fcb.h"
-#include "fcb_priv.h"
-
-int
-fcb_rotate(struct fcb *fcb)
-{
-    struct flash_area *fap;
-    int rc = 0;
-
-    rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc && rc != OS_NOT_STARTED) {
-        return FCB_ERR_ARGS;
-    }
-
-    rc = flash_area_erase(fcb->f_oldest, 0, fcb->f_oldest->fa_size);
-    if (rc) {
-        rc = FCB_ERR_FLASH;
-        goto out;
-    }
-    if (fcb->f_oldest == fcb->f_active.fe_area) {
-        /*
-         * Need to create a new active area, as we're wiping the current.
-         */
-        fap = fcb_getnext_area(fcb, fcb->f_oldest);
-        rc = fcb_sector_hdr_init(fcb, fap, fcb->f_active_id + 1);
-        if (rc) {
-            goto out;
-        }
-        fcb->f_active.fe_area = fap;
-        fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area);
-        fcb->f_active_id++;
-    }
-    fcb->f_oldest = fcb_getnext_area(fcb, fcb->f_oldest);
-out:
-    os_mutex_release(&fcb->f_mtx);
-    return rc;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/src/fcb_walk.c
----------------------------------------------------------------------
diff --git a/sys/fcb/src/fcb_walk.c b/sys/fcb/src/fcb_walk.c
deleted file mode 100644
index e557262..0000000
--- a/sys/fcb/src/fcb_walk.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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 "fcb/fcb.h"
-#include "fcb_priv.h"
-
-/*
- * Call 'cb' for every element in flash circular buffer. If fap is specified,
- * only elements with that flash_area are reported.
- */
-int
-fcb_walk(struct fcb *fcb, struct flash_area *fap, fcb_walk_cb cb, void *cb_arg)
-{
-    struct fcb_entry loc;
-    int rc;
-
-    loc.fe_area = fap;
-    loc.fe_elem_off = 0;
-
-    rc = os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    if (rc && rc != OS_NOT_STARTED) {
-        return FCB_ERR_ARGS;
-    }
-    while ((rc = fcb_getnext_nolock(fcb, &loc)) != FCB_ERR_NOVAR) {
-        os_mutex_release(&fcb->f_mtx);
-        if (fap && loc.fe_area != fap) {
-            return 0;
-        }
-        rc = cb(&loc, cb_arg);
-        if (rc) {
-            return rc;
-        }
-        os_mutex_pend(&fcb->f_mtx, OS_WAIT_FOREVER);
-    }
-    os_mutex_release(&fcb->f_mtx);
-    return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/test/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/fcb/test/pkg.yml b/sys/fcb/test/pkg.yml
deleted file mode 100644
index 31a8669..0000000
--- a/sys/fcb/test/pkg.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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: sys/fcb/test
-pkg.type: unittest
-pkg.description: "FCB unit tests."
-pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
-pkg.homepage: "http://mynewt.apache.org/"
-pkg.keywords:
-
-pkg.deps: 
-    - libs/testutil
-    - sys/fcb
-
-pkg.deps.SELFTEST:
-    - libs/console/stub

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/fcb/test/src/fcb_test.c
----------------------------------------------------------------------
diff --git a/sys/fcb/test/src/fcb_test.c b/sys/fcb/test/src/fcb_test.c
deleted file mode 100644
index b172eb0..0000000
--- a/sys/fcb/test/src/fcb_test.c
+++ /dev/null
@@ -1,672 +0,0 @@
-/**
- * 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 <stdio.h>
-#include <string.h>
-
-#include "syscfg/syscfg.h"
-#include "os/os.h"
-#include "testutil/testutil.h"
-
-#include "fcb/fcb.h"
-#include "fcb/../../src/fcb_priv.h"
-
-static struct fcb test_fcb;
-
-static struct flash_area test_fcb_area[] = {
-    [0] = {
-        .fa_flash_id = 0,
-        .fa_off = 0,
-        .fa_size = 0x4000, /* 16K */
-    },
-    [1] = {
-        .fa_flash_id = 0,
-        .fa_off = 0x4000,
-        .fa_size = 0x4000
-    },
-    [2] = {
-        .fa_flash_id = 0,
-        .fa_off = 0x8000,
-        .fa_size = 0x4000
-    },
-    [3] = {
-        .fa_flash_id = 0,
-        .fa_off = 0xc000,
-        .fa_size = 0x4000
-    }
-};
-
-static void
-fcb_test_wipe(void)
-{
-    int i;
-    int rc;
-    struct flash_area *fap;
-
-    for (i = 0; i < sizeof(test_fcb_area) / sizeof(test_fcb_area[0]); i++) {
-        fap = &test_fcb_area[i];
-        rc = flash_area_erase(fap, 0, fap->fa_size);
-        TEST_ASSERT(rc == 0);
-    }
-}
-
-TEST_CASE(fcb_test_len)
-{
-    uint8_t buf[3];
-    uint16_t len;
-    uint16_t len2;
-    int rc;
-
-    for (len = 0; len < FCB_MAX_LEN; len++) {
-        rc = fcb_put_len(buf, len);
-        TEST_ASSERT(rc == 1 || rc == 2);
-
-        rc = fcb_get_len(buf, &len2);
-        TEST_ASSERT(rc == 1 || rc == 2);
-
-        TEST_ASSERT(len == len2);
-    }
-}
-
-TEST_CASE(fcb_test_init)
-{
-    int rc;
-    struct fcb *fcb;
-
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == FCB_ERR_ARGS);
-
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == FCB_ERR_ARGS);
-
-    fcb->f_sector_cnt = 2;
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-}
-
-static int
-fcb_test_empty_walk_cb(struct fcb_entry *loc, void *arg)
-{
-    TEST_ASSERT(0);
-    return 0;
-}
-
-TEST_CASE(fcb_test_empty_walk)
-{
-    int rc;
-    struct fcb *fcb;
-
-    fcb_test_wipe();
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    rc = fcb_walk(fcb, 0, fcb_test_empty_walk_cb, NULL);
-    TEST_ASSERT(rc == 0);
-}
-
-static uint8_t
-fcb_test_append_data(int msg_len, int off)
-{
-    return (msg_len ^ off);
-}
-
-static int
-fcb_test_data_walk_cb(struct fcb_entry *loc, void *arg)
-{
-    uint16_t len;
-    uint8_t test_data[128];
-    int rc;
-    int i;
-    int *var_cnt = (int *)arg;
-
-    len = loc->fe_data_len;
-
-    TEST_ASSERT(len == *var_cnt);
-
-    rc = flash_area_read(loc->fe_area, loc->fe_data_off, test_data, len);
-    TEST_ASSERT(rc == 0);
-
-    for (i = 0; i < len; i++) {
-        TEST_ASSERT(test_data[i] == fcb_test_append_data(len, i));
-    }
-    (*var_cnt)++;
-    return 0;
-}
-
-TEST_CASE(fcb_test_append)
-{
-    int rc;
-    struct fcb *fcb;
-    struct fcb_entry loc;
-    uint8_t test_data[128];
-    int i;
-    int j;
-    int var_cnt;
-
-    fcb_test_wipe();
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    for (i = 0; i < sizeof(test_data); i++) {
-        for (j = 0; j < i; j++) {
-            test_data[j] = fcb_test_append_data(i, j);
-        }
-        rc = fcb_append(fcb, i, &loc);
-        TEST_ASSERT_FATAL(rc == 0);
-        rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data, i);
-        TEST_ASSERT(rc == 0);
-        rc = fcb_append_finish(fcb, &loc);
-        TEST_ASSERT(rc == 0);
-    }
-
-    var_cnt = 0;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == sizeof(test_data));
-}
-
-TEST_CASE(fcb_test_append_too_big)
-{
-    struct fcb *fcb;
-    int rc;
-    int len;
-    struct fcb_entry elem_loc;
-
-    fcb_test_wipe();
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    /*
-     * Max element which fits inside sector is
-     * sector size - (disk header + crc + 1-2 bytes of length).
-     */
-    len = fcb->f_active.fe_area->fa_size;
-
-    rc = fcb_append(fcb, len, &elem_loc);
-    TEST_ASSERT(rc != 0);
-
-    len--;
-    rc = fcb_append(fcb, len, &elem_loc);
-    TEST_ASSERT(rc != 0);
-
-    len -= sizeof(struct fcb_disk_area);
-    rc = fcb_append(fcb, len, &elem_loc);
-    TEST_ASSERT(rc != 0);
-
-    len = fcb->f_active.fe_area->fa_size -
-      (sizeof(struct fcb_disk_area) + 1 + 2);
-    rc = fcb_append(fcb, len, &elem_loc);
-    TEST_ASSERT(rc == 0);
-
-    rc = fcb_append_finish(fcb, &elem_loc);
-    TEST_ASSERT(rc == 0);
-
-    rc = fcb_elem_info(fcb, &elem_loc);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(elem_loc.fe_data_len == len);
-}
-
-struct append_arg {
-    int *elem_cnts;
-};
-
-static int
-fcb_test_cnt_elems_cb(struct fcb_entry *loc, void *arg)
-{
-    struct append_arg *aa = (struct append_arg *)arg;
-    int idx;
-
-    idx = loc->fe_area - &test_fcb_area[0];
-    aa->elem_cnts[idx]++;
-    return 0;
-}
-
-TEST_CASE(fcb_test_append_fill)
-{
-    struct fcb *fcb;
-    int rc;
-    int i;
-    struct fcb_entry loc;
-    uint8_t test_data[128];
-    int elem_cnts[2] = {0, 0};
-    int aa_together_cnts[2];
-    struct append_arg aa_together = {
-        .elem_cnts = aa_together_cnts
-    };
-    int aa_separate_cnts[2];
-    struct append_arg aa_separate = {
-        .elem_cnts = aa_separate_cnts
-    };
-
-    fcb_test_wipe();
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    for (i = 0; i < sizeof(test_data); i++) {
-        test_data[i] = fcb_test_append_data(sizeof(test_data), i);
-    }
-
-    while (1) {
-        rc = fcb_append(fcb, sizeof(test_data), &loc);
-        if (rc == FCB_ERR_NOSPACE) {
-            break;
-        }
-        if (loc.fe_area == &test_fcb_area[0]) {
-            elem_cnts[0]++;
-        } else if (loc.fe_area == &test_fcb_area[1]) {
-            elem_cnts[1]++;
-        } else {
-            TEST_ASSERT(0);
-        }
-
-        rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data,
-          sizeof(test_data));
-        TEST_ASSERT(rc == 0);
-
-        rc = fcb_append_finish(fcb, &loc);
-        TEST_ASSERT(rc == 0);
-    }
-    TEST_ASSERT(elem_cnts[0] > 0);
-    TEST_ASSERT(elem_cnts[0] == elem_cnts[1]);
-
-    memset(&aa_together_cnts, 0, sizeof(aa_together_cnts));
-    rc = fcb_walk(fcb, NULL, fcb_test_cnt_elems_cb, &aa_together);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(aa_together.elem_cnts[0] == elem_cnts[0]);
-    TEST_ASSERT(aa_together.elem_cnts[1] == elem_cnts[1]);
-
-    memset(&aa_separate_cnts, 0, sizeof(aa_separate_cnts));
-    rc = fcb_walk(fcb, &test_fcb_area[0], fcb_test_cnt_elems_cb,
-      &aa_separate);
-    TEST_ASSERT(rc == 0);
-    rc = fcb_walk(fcb, &test_fcb_area[1], fcb_test_cnt_elems_cb,
-      &aa_separate);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(aa_separate.elem_cnts[0] == elem_cnts[0]);
-    TEST_ASSERT(aa_separate.elem_cnts[1] == elem_cnts[1]);
-
-}
-
-TEST_CASE(fcb_test_reset)
-{
-    struct fcb *fcb;
-    int rc;
-    int i;
-    struct fcb_entry loc;
-    uint8_t test_data[128];
-    int var_cnt;
-
-    fcb_test_wipe();
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    var_cnt = 0;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == 0);
-
-    rc = fcb_append(fcb, 32, &loc);
-    TEST_ASSERT(rc == 0);
-
-    /*
-     * No ready ones yet. CRC should not match.
-     */
-    var_cnt = 0;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == 0);
-
-    for (i = 0; i < sizeof(test_data); i++) {
-        test_data[i] = fcb_test_append_data(32, i);
-    }
-    rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data, 32);
-    TEST_ASSERT(rc == 0);
-
-    rc = fcb_append_finish(fcb, &loc);
-    TEST_ASSERT(rc == 0);
-
-    /*
-     * one entry
-     */
-    var_cnt = 32;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == 33);
-
-    /*
-     * Pretend reset
-     */
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    var_cnt = 32;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == 33);
-
-    rc = fcb_append(fcb, 33, &loc);
-    TEST_ASSERT(rc == 0);
-
-    for (i = 0; i < sizeof(test_data); i++) {
-        test_data[i] = fcb_test_append_data(33, i);
-    }
-    rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data, 33);
-    TEST_ASSERT(rc == 0);
-
-    rc = fcb_append_finish(fcb, &loc);
-    TEST_ASSERT(rc == 0);
-
-    var_cnt = 32;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == 34);
-
-    /*
-     * Add partial one, make sure that we survive reset then.
-     */
-    rc = fcb_append(fcb, 34, &loc);
-    TEST_ASSERT(rc == 0);
-
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    /*
-     * Walk should skip that.
-     */
-    var_cnt = 32;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == 34);
-
-    /* Add a 3rd one, should go behind corrupt entry */
-    rc = fcb_append(fcb, 34, &loc);
-    TEST_ASSERT(rc == 0);
-
-    for (i = 0; i < sizeof(test_data); i++) {
-        test_data[i] = fcb_test_append_data(34, i);
-    }
-    rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data, 34);
-    TEST_ASSERT(rc == 0);
-
-    rc = fcb_append_finish(fcb, &loc);
-    TEST_ASSERT(rc == 0);
-
-    /*
-     * Walk should skip corrupt entry, but report the next one.
-     */
-    var_cnt = 32;
-    rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(var_cnt == 35);
-}
-
-TEST_CASE(fcb_test_rotate)
-{
-    struct fcb *fcb;
-    int rc;
-    int old_id;
-    struct fcb_entry loc;
-    uint8_t test_data[128];
-    int elem_cnts[2] = {0, 0};
-    int cnts[2];
-    struct append_arg aa_arg = {
-        .elem_cnts = cnts
-    };
-
-    fcb_test_wipe();
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 2;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    old_id = fcb->f_active_id;
-    rc = fcb_rotate(fcb);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(fcb->f_active_id == old_id + 1);
-
-    /*
-     * Now fill up the
-     */
-    while (1) {
-        rc = fcb_append(fcb, sizeof(test_data), &loc);
-        if (rc == FCB_ERR_NOSPACE) {
-            break;
-        }
-        if (loc.fe_area == &test_fcb_area[0]) {
-            elem_cnts[0]++;
-        } else if (loc.fe_area == &test_fcb_area[1]) {
-            elem_cnts[1]++;
-        } else {
-            TEST_ASSERT(0);
-        }
-
-        rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data,
-          sizeof(test_data));
-        TEST_ASSERT(rc == 0);
-
-        rc = fcb_append_finish(fcb, &loc);
-        TEST_ASSERT(rc == 0);
-    }
-    TEST_ASSERT(elem_cnts[0] > 0 && elem_cnts[0] == elem_cnts[1]);
-
-    old_id = fcb->f_active_id;
-    rc = fcb_rotate(fcb);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(fcb->f_active_id == old_id); /* no new area created */
-
-    memset(cnts, 0, sizeof(cnts));
-    rc = fcb_walk(fcb, NULL, fcb_test_cnt_elems_cb, &aa_arg);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(aa_arg.elem_cnts[0] == elem_cnts[0] ||
-      aa_arg.elem_cnts[1] == elem_cnts[1]);
-    TEST_ASSERT(aa_arg.elem_cnts[0] == 0 || aa_arg.elem_cnts[1] == 0);
-
-    /*
-     * One sector is full. The other one should have one entry in it.
-     */
-    rc = fcb_append(fcb, sizeof(test_data), &loc);
-    TEST_ASSERT(rc == 0);
-
-    rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data,
-      sizeof(test_data));
-    TEST_ASSERT(rc == 0);
-
-    rc = fcb_append_finish(fcb, &loc);
-    TEST_ASSERT(rc == 0);
-
-    old_id = fcb->f_active_id;
-    rc = fcb_rotate(fcb);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(fcb->f_active_id == old_id);
-
-    memset(cnts, 0, sizeof(cnts));
-    rc = fcb_walk(fcb, NULL, fcb_test_cnt_elems_cb, &aa_arg);
-    TEST_ASSERT(rc == 0);
-    TEST_ASSERT(aa_arg.elem_cnts[0] == 1 || aa_arg.elem_cnts[1] == 1);
-    TEST_ASSERT(aa_arg.elem_cnts[0] == 0 || aa_arg.elem_cnts[1] == 0);
-}
-
-TEST_CASE(fcb_test_multiple_scratch)
-{
-    struct fcb *fcb;
-    int rc;
-    struct fcb_entry loc;
-    uint8_t test_data[128];
-    int elem_cnts[4];
-    int idx;
-    int cnts[4];
-    struct append_arg aa_arg = {
-        .elem_cnts = cnts
-    };
-
-    fcb_test_wipe();
-    fcb = &test_fcb;
-    memset(fcb, 0, sizeof(*fcb));
-    fcb->f_sector_cnt = 4;
-    fcb->f_scratch_cnt = 1;
-    fcb->f_sectors = test_fcb_area;
-
-    rc = fcb_init(fcb);
-    TEST_ASSERT(rc == 0);
-
-    /*
-     * Now fill up everything. We should be able to get 3 of the sectors
-     * full.
-     */
-    memset(elem_cnts, 0, sizeof(elem_cnts));
-    while (1) {
-        rc = fcb_append(fcb, sizeof(test_data), &loc);
-        if (rc == FCB_ERR_NOSPACE) {
-            break;
-        }
-        idx = loc.fe_area - &test_fcb_area[0];
-        elem_cnts[idx]++;
-
-        rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data,
-          sizeof(test_data));
-        TEST_ASSERT(rc == 0);
-
-        rc = fcb_append_finish(fcb, &loc);
-        TEST_ASSERT(rc == 0);
-    }
-
-    TEST_ASSERT(elem_cnts[0] > 0);
-    TEST_ASSERT(elem_cnts[0] == elem_cnts[1] && elem_cnts[0] == elem_cnts[2]);
-    TEST_ASSERT(elem_cnts[3] == 0);
-
-    /*
-     * Ask to use scratch block, then fill it up.
-     */
-    rc = fcb_append_to_scratch(fcb);
-    TEST_ASSERT(rc == 0);
-
-    while (1) {
-        rc = fcb_append(fcb, sizeof(test_data), &loc);
-        if (rc == FCB_ERR_NOSPACE) {
-            break;
-        }
-        idx = loc.fe_area - &test_fcb_area[0];
-        elem_cnts[idx]++;
-
-        rc = flash_area_write(loc.fe_area, loc.fe_data_off, test_data,
-          sizeof(test_data));
-        TEST_ASSERT(rc == 0);
-
-        rc = fcb_append_finish(fcb, &loc);
-        TEST_ASSERT(rc == 0);
-    }
-    TEST_ASSERT(elem_cnts[3] == elem_cnts[0]);
-
-    /*
-     * Rotate
-     */
-    rc = fcb_rotate(fcb);
-    TEST_ASSERT(rc == 0);
-
-    memset(&cnts, 0, sizeof(cnts));
-    rc = fcb_walk(fcb, NULL, fcb_test_cnt_elems_cb, &aa_arg);
-    TEST_ASSERT(rc == 0);
-
-    TEST_ASSERT(cnts[0] == 0);
-    TEST_ASSERT(cnts[1] > 0);
-    TEST_ASSERT(cnts[1] == cnts[2] && cnts[1] == cnts[3]);
-
-    rc = fcb_append_to_scratch(fcb);
-    TEST_ASSERT(rc == 0);
-    rc = fcb_append_to_scratch(fcb);
-    TEST_ASSERT(rc != 0);
-}
-
-TEST_SUITE(fcb_test_all)
-{
-    fcb_test_len();
-
-    fcb_test_init();
-
-    fcb_test_empty_walk();
-
-    fcb_test_append();
-
-    fcb_test_append_too_big();
-
-    fcb_test_append_fill();
-
-    fcb_test_reset();
-
-    fcb_test_rotate();
-
-    fcb_test_multiple_scratch();
-}
-
-#if MYNEWT_VAL(SELFTEST)
-
-int
-main(int argc, char **argv)
-{
-    tu_config.tc_print_results = 1;
-    tu_init();
-
-    fcb_test_all();
-
-    return tu_any_failed;
-}
-#endif
-

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/id/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/id/pkg.yml b/sys/id/pkg.yml
index 2795d49..055a98e 100644
--- a/sys/id/pkg.yml
+++ b/sys/id/pkg.yml
@@ -28,11 +28,12 @@ pkg.keywords:
 
 pkg.deps:
     - hw/hal
-    - libs/os
+    - kernel/os
     - libs/util
     - sys/config
+    - encoding/base64
 pkg.deps.ID_CLI:
-    - libs/shell
+    - sys/shell
 pkg.req_apis.ID_CLI:
     - console
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/id/src/id.c
----------------------------------------------------------------------
diff --git a/sys/id/src/id.c b/sys/id/src/id.c
index 36eac5a..c58a652 100644
--- a/sys/id/src/id.c
+++ b/sys/id/src/id.c
@@ -25,7 +25,7 @@
 #include "hal/hal_bsp.h"
 #include "os/os.h"
 #include "config/config.h"
-#include "util/base64.h"
+#include "base64/base64.h"
 
 #include "id/id.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/log/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/log/pkg.yml b/sys/log/pkg.yml
index bd57e84..b931e43 100644
--- a/sys/log/pkg.yml
+++ b/sys/log/pkg.yml
@@ -25,13 +25,13 @@ pkg.keywords:
     - logging
 
 pkg.deps:
-    - libs/os
+    - kernel/os
     - libs/util
 pkg.deps.LOG_FCB:
     - hw/hal
-    - sys/fcb
+    - fs/fcb
 pkg.deps.LOG_CLI:
-    - libs/shell
+    - sys/shell
 
 pkg.req_apis.LOG_NEWTMGR:
     - newtmgr

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/mn_socket/include/mn_socket/arch/sim/native_sock.h
----------------------------------------------------------------------
diff --git a/sys/mn_socket/include/mn_socket/arch/sim/native_sock.h b/sys/mn_socket/include/mn_socket/arch/sim/native_sock.h
deleted file mode 100644
index 66e8016..0000000
--- a/sys/mn_socket/include/mn_socket/arch/sim/native_sock.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * 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.
- */
-
-#ifndef __NATIVE_SOCK_H_
-#define __NATIVE_SOCK_H_
-
-int native_sock_init(void);
-
-#endif /* __NATIVE_SOCK_H_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/mn_socket/include/mn_socket/mn_socket.h
----------------------------------------------------------------------
diff --git a/sys/mn_socket/include/mn_socket/mn_socket.h b/sys/mn_socket/include/mn_socket/mn_socket.h
deleted file mode 100644
index 47c54fb..0000000
--- a/sys/mn_socket/include/mn_socket/mn_socket.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/**
- * 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.
- */
-#ifndef __SYS_MN_SOCKET_H_
-#define __SYS_MN_SOCKET_H_
-
-#include <inttypes.h>
-
-/*
- * Address/protocol family.
- */
-#define MN_AF_INET              4
-#define MN_PF_INET              MN_AF_INET
-#define MN_AF_INET6             6
-#define MN_PF_INET6             MN_AF_INET6
-
-/*
- * Socket types
- */
-#define MN_SOCK_STREAM          1
-#define MN_SOCK_DGRAM           2
-
-/*
- * Error codes from mn_socket interface.
- */
-#define MN_EAFNOSUPPORT         1
-#define MN_EPROTONOSUPPORT      2
-#define MN_ENOBUFS              3
-#define MN_EINVAL               4
-#define MN_ENOTCONN             5
-#define MN_ECONNABORTED         6
-#define MN_EDESTADDRREQ         7
-#define MN_EADDRINUSE           8
-#define MN_ETIMEDOUT            9
-#define MN_EAGAIN               10
-#define MN_EUNKNOWN             11
-#define MN_EADDRNOTAVAIL        12
-
-/*
- * Multicast macros
- */
-#define MN_IN_MULTICAST(a)                                              \
-    ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000)
-
-#define MN_IN6_IS_ADDR_MULTICAST(a)                                     \
-    ((a)->s_addr[0] == 0xff)
-
-struct mn_socket;
-struct mn_socket_ops;
-struct mn_sock_cb;
-struct os_mbuf;
-
-struct mn_socket {
-    const union mn_socket_cb *ms_cbs;          /* filled in by user */
-    void *ms_cb_arg;                           /* filled in by user */
-    const struct mn_socket_ops *ms_ops;        /* filled in by mn_socket */
-};
-
-/*
- * Callbacks. Socket callbacks are for sockets which exchange
- * data. Listen callback is for TCP listen sockets.
- */
-union mn_socket_cb {
-    struct {
-        void (*readable)(void *cb_arg, int err);
-        void (*writable)(void *cb_arg, int err);
-    } socket;
-    struct {
-        int (*newconn)(void *cb_arg, struct mn_socket *new);
-    } listen;
-};
-
-struct mn_sockaddr {
-    uint8_t msa_len;
-    uint8_t msa_family;
-    char    msa_data[2];
-};
-
-struct mn_in_addr {
-    uint32_t s_addr;
-};
-
-struct mn_sockaddr_in {
-    uint8_t msin_len;
-    uint8_t msin_family;
-    uint16_t msin_port;
-    struct mn_in_addr msin_addr;
-};
-
-struct mn_in6_addr {
-    uint8_t s_addr[16];
-};
-
-struct mn_sockaddr_in6 {
-    uint8_t msin6_len;
-    uint8_t msin6_family;
-    uint16_t msin6_port;
-    uint32_t msin6_flowinfo;
-    struct mn_in6_addr msin6_addr;
-    uint32_t msin6_scope_id;
-};
-
-extern const uint32_t nm_in6addr_any[4];
-
-/*
- * Structure for multicast join/leave
- */
-struct mn_mreq {
-    uint8_t mm_idx;			/* interface index */
-    uint8_t mm_family;			/* address family */
-    union {
-        struct mn_in_addr v4;
-        struct mn_in6_addr v6;
-    } mm_addr;
-};
-
-#define MN_SO_LEVEL                     0xfe
-
-#define MN_MCAST_JOIN_GROUP             1
-#define MN_MCAST_LEAVE_GROUP            2
-#define MN_MCAST_IF                     3
-
-/*
- * Socket calls.
- *
- * mn_connect() for TCP is asynchronous. Once connection has been established,
- * socket callback (*writable) will be called.
- *
- * mn_sendto() is asynchronous as well. If it fails due to buffer shortage,
- * socket provider should call (*writable) when more data can be sent.
- *
- * mn_recvfrom() returns immediatelly if no data is available. If data arrives,
- * the callback (*readable) will be called. Once that happens, owner of the
- * socket should keep calling mn_recvfrom() until it has drained all the
- * data from the socket.
- *
- * If remote end closes the socket, socket callback (*readable) will be
- * called.
- */
-int mn_socket(struct mn_socket **, uint8_t domain, uint8_t type, uint8_t proto);
-int mn_bind(struct mn_socket *, struct mn_sockaddr *);
-int mn_connect(struct mn_socket *, struct mn_sockaddr *);
-int mn_listen(struct mn_socket *, uint8_t qlen);
-
-int mn_recvfrom(struct mn_socket *, struct os_mbuf **,
-  struct mn_sockaddr *from);
-int mn_sendto(struct mn_socket *, struct os_mbuf *, struct mn_sockaddr *to);
-
-int mn_getsockopt(struct mn_socket *, uint8_t level, uint8_t optname,
-  void *optval);
-int mn_setsockopt(struct mn_socket *, uint8_t level, uint8_t optname,
-  void *optval);
-
-int mn_getsockname(struct mn_socket *, struct mn_sockaddr *);
-int mn_getpeername(struct mn_socket *, struct mn_sockaddr *);
-
-int mn_close(struct mn_socket *);
-
-#define mn_socket_set_cbs(sock, cb_arg, cbs)                            \
-    do {                                                                \
-        (sock)->ms_cbs = (cbs);                                         \
-        (sock)->ms_cb_arg = (cb_arg);                                   \
-    } while (0)
-
-/*
- * Address conversion
- */
-int mn_inet_pton(int af, const char *src, void *dst);
-const char *mn_inet_ntop(int af, const void *src, void *dst, int len);
-
-/*
- * Info about interfaces.
- */
-#define MN_ITF_NAME_MAX    8
-
-/*
- * Interface flags
- */
-#define MN_ITF_F_UP        1
-#define MN_ITF_F_MULTICAST 2
-
-struct mn_itf {
-    char mif_name[MN_ITF_NAME_MAX];
-    uint8_t mif_idx;
-    uint8_t mif_flags;
-};
-
-struct mn_itf_addr {
-    uint8_t mifa_family;
-    uint8_t mifa_plen;
-    union {
-        struct mn_in_addr v4;
-        struct mn_in6_addr v6;
-    } mifa_addr;
-};
-
-/*
- * Iterate through interfaces, and their addresses
- */
-int mn_itf_getnext(struct mn_itf *);
-int mn_itf_addr_getnext(struct mn_itf *, struct mn_itf_addr *);
-
-#endif /* __SYS_MN_SOCKET_H_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/mn_socket/include/mn_socket/mn_socket_ops.h
----------------------------------------------------------------------
diff --git a/sys/mn_socket/include/mn_socket/mn_socket_ops.h b/sys/mn_socket/include/mn_socket/mn_socket_ops.h
deleted file mode 100644
index 39f11c1..0000000
--- a/sys/mn_socket/include/mn_socket/mn_socket_ops.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.
- */
-#ifndef __SYS_MN_SOCKET_OPS_H_
-#define __SYS_MN_SOCKET_OPS_H_
-
-#include <inttypes.h>
-
-/*
- * Interface for socket providers.
- * - mso_create() creates a socket, memory allocation has to be done by
- *   the socket provider.
- * - mso_close() closes the socket, memory should be freed. User should not
- *   be using the socket pointer once it has been closed.
- */
-struct mn_socket_ops {
-    int (*mso_create)(struct mn_socket **, uint8_t domain, uint8_t type,
-      uint8_t protocol);
-    int (*mso_close)(struct mn_socket *);
-
-    int (*mso_bind)(struct mn_socket *, struct mn_sockaddr *);
-    int (*mso_connect)(struct mn_socket *, struct mn_sockaddr *);
-    int (*mso_listen)(struct mn_socket *, uint8_t qlen);
-
-    int (*mso_sendto)(struct mn_socket *, struct os_mbuf *,
-      struct mn_sockaddr *to);
-    int (*mso_recvfrom)(struct mn_socket *, struct os_mbuf **,
-      struct mn_sockaddr *from);
-
-    int (*mso_getsockopt)(struct mn_socket *, uint8_t level, uint8_t name,
-      void *val);
-    int (*mso_setsockopt)(struct mn_socket *, uint8_t level, uint8_t name,
-      void *val);
-
-    int (*mso_getsockname)(struct mn_socket *, struct mn_sockaddr *);
-    int (*mso_getpeername)(struct mn_socket *, struct mn_sockaddr *);
-
-    int (*mso_itf_getnext)(struct mn_itf *);
-    int (*mso_itf_addr_getnext)(struct mn_itf *, struct mn_itf_addr *);
-};
-
-int mn_socket_ops_reg(const struct mn_socket_ops *ops);
-
-static inline void
-mn_socket_writable(struct mn_socket *s, int error)
-{
-    if (s->ms_cbs && s->ms_cbs->socket.writable) {
-        s->ms_cbs->socket.writable(s->ms_cb_arg, error);
-    }
-}
-
-static inline void
-mn_socket_readable(struct mn_socket *s, int error)
-{
-    if (s->ms_cbs && s->ms_cbs->socket.readable) {
-        s->ms_cbs->socket.readable(s->ms_cb_arg, error);
-    }
-}
-
-static inline int
-mn_socket_newconn(struct mn_socket *s, struct mn_socket *new)
-{
-    if (s->ms_cbs && s->ms_cbs->listen.newconn) {
-        return s->ms_cbs->listen.newconn(s->ms_cb_arg, new);
-    } else {
-        return -1;
-    }
-}
-
-#endif /* __SYS_MN_SOCKET_OPS_H_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/6a7432f4/sys/mn_socket/pkg.yml
----------------------------------------------------------------------
diff --git a/sys/mn_socket/pkg.yml b/sys/mn_socket/pkg.yml
deleted file mode 100644
index 4242b46..0000000
--- a/sys/mn_socket/pkg.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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: sys/mn_socket
-pkg.description: Socket interface for Mynewt.
-pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
-pkg.homepage: "http://mynewt.apache.org/"
-pkg.keywords:
-    - socket
-    - IP
-
-pkg.deps:
-    - libs/os
-    - libs/util