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/28 00:43:34 UTC

[08/51] [abbrv] [partial] incubator-mynewt-core git commit: directory re-org, part 1

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/include/uart/uart.h
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/include/uart/uart.h b/hw/drivers/uart/include/uart/uart.h
new file mode 100644
index 0000000..e889722
--- /dev/null
+++ b/hw/drivers/uart/include/uart/uart.h
@@ -0,0 +1,139 @@
+/**
+ * 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 __DRIVERS_UART_H_
+#define __DRIVERS_UART_H_
+
+#include <inttypes.h>
+#include <os/os_dev.h>
+
+struct uart_dev;
+
+/*
+ * Function prototype for UART driver to ask for more data to send.
+ * Driver must call this with interrupts disabled.
+ *
+ * @param arg		This is uc_cb_arg passed in uart_conf in
+ *			os_dev_open().
+ *
+ * @return		Byte value to send next, -1 if no more data to send.
+ */
+typedef int (*uart_tx_char)(void *arg);
+
+/*
+ * Function prototype for UART driver to report that transmission is
+ * complete. This should be called when transmission of last byte is
+ * finished.
+ * Driver must call this with interrupts disabled.
+ *
+ * @param arg		This is uc_cb_arg passed in uart_conf in
+ *			os_dev_open().
+ */
+typedef void (*uart_tx_done)(void *arg);
+
+/*
+ * Function prototype for UART driver to report incoming byte of data.
+ * Driver must call this with interrupts disabled.
+ *
+ * @param arg		This is uc_cb_arg passed in uart_conf in
+ *			os_dev_open().
+ * @param byte		Received byte
+ *
+ * @return		0 on success; -1 if data could not be received.
+ *			Note that returning -1 triggers flow control (if
+ *			configured), and user must call uart_start_rx() to
+ *			start receiving more data again.
+ */
+typedef int (*uart_rx_char)(void *arg, uint8_t byte);
+
+struct uart_driver_funcs {
+    void (*uf_start_tx)(struct uart_dev *);
+    void (*uf_start_rx)(struct uart_dev *);
+    void (*uf_blocking_tx)(struct uart_dev *, uint8_t);
+};
+
+struct uart_dev {
+    struct os_dev ud_dev;
+    struct uart_driver_funcs ud_funcs;
+    void *ud_priv;
+};
+
+/*
+ * ***Note that these enum values must match what hw/hal/hal_uart.h***
+ */
+enum uart_parity {
+    UART_PARITY_NONE = 0,       /* no parity */
+    UART_PARITY_ODD = 1,        /* odd parity bit */
+    UART_PARITY_EVEN = 2        /* even parity bit */
+};
+
+enum uart_flow_ctl {
+    UART_FLOW_CTL_NONE = 0,     /* no flow control */
+    UART_FLOW_CTL_RTS_CTS = 1   /* RTS/CTS */
+};
+
+struct uart_conf {
+    uint32_t uc_speed;          /* baudrate in bps */
+    uint8_t uc_databits;        /* number of data bits */
+    uint8_t uc_stopbits;        /* number of stop bits */
+    enum uart_parity uc_parity;
+    enum uart_flow_ctl uc_flow_ctl;
+    uart_tx_char uc_tx_char;
+    uart_rx_char uc_rx_char;
+    uart_tx_done uc_tx_done;
+    void *uc_cb_arg;
+};
+
+/*
+ * Tell driver that more data has been queued, and that the driver should
+ * start asking for it.
+ *
+ * @param dev		Uart device in question
+ */
+static inline void
+uart_start_tx(struct uart_dev *dev)
+{
+    dev->ud_funcs.uf_start_tx(dev);
+}
+
+/*
+ * Tell driver that previous report on RX buffer shortage is now done,
+ * and that app is ready to receive more data.
+ *
+ * @param dev		Uart device in question
+ */
+static inline void
+uart_start_rx(struct uart_dev *dev)
+{
+    dev->ud_funcs.uf_start_rx(dev);
+}
+
+/*
+ * Blocking transmit. ***Note that this should only be used with console.
+ * And only when MCU is about to restart, to write final log messages***
+ *
+ * @param dev		Uart device in question
+ */
+static inline void
+uart_blocking_tx(struct uart_dev *dev, uint8_t byte)
+{
+    dev->ud_funcs.uf_blocking_tx(dev, byte);
+}
+
+#endif /* __DRIVERS_UART_H_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/pkg.yml b/hw/drivers/uart/pkg.yml
new file mode 100644
index 0000000..2dcab3e
--- /dev/null
+++ b/hw/drivers/uart/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: hw/drivers/uart
+pkg.description: UART driver interfaces
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+pkg.deps:
+pkg.req_apis: 
+    - UART_HW_IMPL

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/src/uart.c
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/src/uart.c b/hw/drivers/uart/src/uart.c
new file mode 100644
index 0000000..f736fe1
--- /dev/null
+++ b/hw/drivers/uart/src/uart.c
@@ -0,0 +1,18 @@
+/**
+ * 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.
+ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/uart_bitbang/include/uart_bitbang/uart_bitbang.h
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/uart_bitbang/include/uart_bitbang/uart_bitbang.h b/hw/drivers/uart/uart_bitbang/include/uart_bitbang/uart_bitbang.h
new file mode 100644
index 0000000..23e2f80
--- /dev/null
+++ b/hw/drivers/uart/uart_bitbang/include/uart_bitbang/uart_bitbang.h
@@ -0,0 +1,32 @@
+/*
+ * 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 __UART_BITBANG_H__
+#define __UART_BITBANG_H__
+
+struct uart_bitbang_conf {
+    int ubc_rxpin;
+    int ubc_txpin;
+    uint32_t ubc_cputimer_freq;
+};
+
+struct os_dev;
+int uart_bitbang_init(struct os_dev *, void *);
+
+#endif /* __UART_BITBANG_H__ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/uart_bitbang/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/uart_bitbang/pkg.yml b/hw/drivers/uart/uart_bitbang/pkg.yml
new file mode 100644
index 0000000..a3ac136
--- /dev/null
+++ b/hw/drivers/uart/uart_bitbang/pkg.yml
@@ -0,0 +1,29 @@
+#
+# 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: hw/drivers/uart/uart_bitbang
+pkg.description: Async UART port with a bitbanger.
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+pkg.apis:
+   - UART_HW_IMPL
+pkg.deps:
+   - hw/hal
+   - hw/drivers/uart

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c b/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c
new file mode 100644
index 0000000..c20682e
--- /dev/null
+++ b/hw/drivers/uart/uart_bitbang/src/uart_bitbang.c
@@ -0,0 +1,346 @@
+/*
+ * 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 <string.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include <hal/hal_gpio.h>
+#include <hal/hal_uart.h>
+#include <hal/hal_cputime.h>
+
+#include <os/os.h>
+#include <os/os_dev.h>
+
+#include <uart/uart.h>
+
+#include "uart_bitbang/uart_bitbang.h"
+
+/*
+ * Async UART as a bitbanger.
+ * Cannot run very fast, as it relies on cputimer to time sampling and
+ * bit tx start times.
+ */
+struct uart_bitbang {
+    int ub_bittime;             /* number of cputimer ticks per bit */
+    struct {
+        int pin;                /* RX pin */
+        struct cpu_timer timer;
+        uint32_t start;         /* cputime when byte rx started */
+        uint8_t byte;           /* receiving this byte */
+        uint8_t bits;           /* how many bits we've seen */
+        int false_irq;
+    } ub_rx;
+    struct {
+        int pin;                /* TX pin */
+        struct cpu_timer timer;
+        uint32_t start;         /* cputime when byte tx started */
+        uint8_t byte;           /* byte being transmitted */
+        uint8_t bits;           /* how many bits have been sent */
+    } ub_tx;
+
+    uint8_t ub_open:1;
+    uint8_t ub_rx_stall:1;
+    uint8_t ub_txing:1;
+    uint32_t ub_cputimer_freq;
+    hal_uart_rx_char ub_rx_func;
+    hal_uart_tx_char ub_tx_func;
+    hal_uart_tx_done ub_tx_done;
+    void *ub_func_arg;
+};
+
+/*
+ * Bytes start with START bit (0) followed by 8 data bits and then the
+ * STOP bit (1). STOP bit should be configurable. Data bits are sent LSB first.
+ */
+static void
+uart_bitbang_tx_timer(void *arg)
+{
+    struct uart_bitbang *ub = (struct uart_bitbang *)arg;
+    uint32_t next = 0;
+    int data;
+
+    if (!ub->ub_txing || ub->ub_tx.bits > 9) {
+        if (ub->ub_tx.bits > 9) {
+            if (ub->ub_tx_done) {
+                ub->ub_tx_done(ub->ub_func_arg);
+            }
+        }
+        data = ub->ub_tx_func(ub->ub_func_arg);
+        if (data < 0) {
+            ub->ub_txing = 0;
+            return;
+        } else {
+            ub->ub_tx.byte = data;
+        }
+        /*
+         * Start bit
+         */
+        hal_gpio_write(ub->ub_tx.pin, 0);
+        ub->ub_tx.start = cputime_get32();
+        next = ub->ub_tx.start + ub->ub_bittime;
+        ub->ub_txing = 1;
+        ub->ub_tx.bits = 0;
+    } else {
+        if (ub->ub_tx.bits++ < 8) {
+            hal_gpio_write(ub->ub_tx.pin, ub->ub_tx.byte & 0x01);
+            ub->ub_tx.byte = ub->ub_tx.byte >> 1;
+            next = ub->ub_tx.start + (ub->ub_bittime * (ub->ub_tx.bits + 1));
+        } else {
+            /*
+             * STOP bit.
+             */
+            hal_gpio_write(ub->ub_tx.pin, 1);
+            next = ub->ub_tx.start + (ub->ub_bittime * 10);
+        }
+    }
+    cputime_timer_start(&ub->ub_tx.timer, next);
+}
+
+static void
+uart_bitbang_rx_timer(void *arg)
+{
+    struct uart_bitbang *ub = (struct uart_bitbang *)arg;
+    int val;
+
+    val = hal_gpio_read(ub->ub_rx.pin);
+
+    if (val) {
+        ub->ub_rx.byte = 0x80 | (ub->ub_rx.byte >> 1);
+    } else {
+        ub->ub_rx.byte = (ub->ub_rx.byte >> 1);
+    }
+    if (ub->ub_rx.bits == 7) {
+        val = ub->ub_rx_func(ub->ub_func_arg, ub->ub_rx.byte);
+        if (val) {
+            ub->ub_rx_stall = 1;
+        } else {
+            /*
+             * Re-enable GPIO IRQ after we've sampled last bit. STOP bit
+             * is ignored.
+             */
+            hal_gpio_irq_enable(ub->ub_rx.pin);
+        }
+    } else {
+        ub->ub_rx.bits++;
+        cputime_timer_start(&ub->ub_rx.timer,
+          ub->ub_rx.start + (ub->ub_bittime * (ub->ub_rx.bits + 1)) +
+          (ub->ub_bittime >> 1));
+    }
+}
+
+/*
+ * Byte RX starts when we get transition from high to low.
+ * We disable RX irq after we've seen start until end of RX of one byte.
+ */
+static void
+uart_bitbang_isr(void *arg)
+{
+    struct uart_bitbang *ub = (struct uart_bitbang *)arg;
+    uint32_t time;
+
+    time = cputime_get32();
+    if (ub->ub_rx.start - time < (9 * ub->ub_bittime)) {
+        ++ub->ub_rx.false_irq;
+        return;
+    }
+    ub->ub_rx.start = time;
+    ub->ub_rx.byte = 0;
+    ub->ub_rx.bits = 0;
+
+    /*
+     * We try to sample in the middle of a bit. First sample is taken
+     * 1.5 bittimes after beginning of start bit.
+     */
+    cputime_timer_start(&ub->ub_rx.timer, time +
+      ub->ub_bittime + (ub->ub_bittime >> 1));
+
+    hal_gpio_irq_disable(ub->ub_rx.pin);
+}
+
+static void
+uart_bitbang_blocking_tx(struct uart_dev *dev, uint8_t data)
+{
+    struct uart_bitbang *ub;
+    int i;
+    uint32_t start, next;
+
+    ub = (struct uart_bitbang *)dev->ud_priv;
+    if (!ub->ub_open) {
+        return;
+    }
+    hal_gpio_write(ub->ub_tx.pin, 0);
+    start = cputime_get32();
+    next = start + ub->ub_bittime;
+    while (cputime_get32() < next);
+    for (i = 0; i < 8; i++) {
+        hal_gpio_write(ub->ub_tx.pin, data & 0x01);
+        data = data >> 1;
+        next = start + (ub->ub_bittime * i + 1);
+        while (cputime_get32() < next);
+    }
+    next = start + (ub->ub_bittime * 10);
+    hal_gpio_write(ub->ub_tx.pin, 1);
+    while (cputime_get32() < next);
+}
+
+static void
+uart_bitbang_start_tx(struct uart_dev *dev)
+{
+    struct uart_bitbang *ub;
+    int sr;
+
+    ub = (struct uart_bitbang *)dev->ud_priv;
+    if (!ub->ub_open) {
+        return;
+    }
+    if (!ub->ub_txing) {
+        OS_ENTER_CRITICAL(sr);
+        uart_bitbang_tx_timer(ub);
+        OS_EXIT_CRITICAL(sr);
+    }
+}
+
+static void
+uart_bitbang_start_rx(struct uart_dev *dev)
+{
+    struct uart_bitbang *ub;
+    int sr;
+    int rc;
+
+    ub = (struct uart_bitbang *)dev->ud_priv;
+    if (ub->ub_rx_stall) {
+        rc = ub->ub_rx_func(ub->ub_func_arg, ub->ub_rx.byte);
+        if (rc == 0) {
+            OS_ENTER_CRITICAL(sr);
+            ub->ub_rx_stall = 0;
+            OS_EXIT_CRITICAL(sr);
+
+            /*
+             * Start looking for start bit again.
+             */
+            hal_gpio_irq_enable(ub->ub_rx.pin);
+        }
+    }
+}
+
+static int
+uart_bitbang_config(struct uart_bitbang *ub, int32_t baudrate, uint8_t databits,
+  uint8_t stopbits, enum hal_uart_parity parity,
+  enum hal_uart_flow_ctl flow_ctl)
+{
+    if (databits != 8 || parity != HAL_UART_PARITY_NONE ||
+      flow_ctl != HAL_UART_FLOW_CTL_NONE) {
+        return -1;
+    }
+
+    assert(ub->ub_rx.pin != ub->ub_tx.pin); /* make sure it's initialized */
+
+    if (baudrate > 19200) {
+        return -1;
+    }
+    ub->ub_bittime = ub->ub_cputimer_freq / baudrate;
+
+    cputime_timer_init(&ub->ub_rx.timer, uart_bitbang_rx_timer, ub);
+    cputime_timer_init(&ub->ub_tx.timer, uart_bitbang_tx_timer, ub);
+
+    if (hal_gpio_init_out(ub->ub_tx.pin, 1)) {
+        return -1;
+    }
+
+    if (hal_gpio_irq_init(ub->ub_rx.pin, uart_bitbang_isr, ub,
+        GPIO_TRIG_FALLING, GPIO_PULL_UP)) {
+        return -1;
+    }
+    hal_gpio_irq_enable(ub->ub_rx.pin);
+
+    ub->ub_open = 1;
+    return 0;
+}
+
+static int
+uart_bitbang_open(struct os_dev *odev, uint32_t wait, void *arg)
+{
+    struct uart_dev *dev = (struct uart_dev *)odev;
+    struct uart_bitbang *ub;
+    struct uart_conf *uc;
+
+    ub = (struct uart_bitbang *)dev->ud_priv;
+    uc = (struct uart_conf *)arg;
+
+    ub->ub_rx_func = uc->uc_rx_char;
+    ub->ub_tx_func = uc->uc_tx_char;
+    ub->ub_tx_done = uc->uc_tx_done;
+    ub->ub_func_arg = uc->uc_cb_arg;
+
+    if (uart_bitbang_config(ub, uc->uc_speed, uc->uc_databits,
+        uc->uc_stopbits, uc->uc_parity, uc->uc_flow_ctl)) {
+        return OS_EINVAL;
+    }
+    return OS_OK;
+}
+
+static int
+uart_bitbang_close(struct os_dev *odev)
+{
+    struct uart_dev *dev = (struct uart_dev *)odev;
+    struct uart_bitbang *ub;
+    int sr;
+
+    ub = (struct uart_bitbang *)dev->ud_priv;
+    OS_ENTER_CRITICAL(sr);
+    hal_gpio_irq_disable(ub->ub_rx.pin);
+    hal_gpio_irq_release(ub->ub_rx.pin);
+    ub->ub_open = 0;
+    ub->ub_txing = 0;
+    ub->ub_rx_stall = 0;
+    cputime_timer_stop(&ub->ub_tx.timer);
+    cputime_timer_stop(&ub->ub_rx.timer);
+    OS_EXIT_CRITICAL(sr);
+    return OS_OK;
+}
+
+int
+uart_bitbang_init(struct os_dev *odev, void *arg)
+{
+    struct uart_dev *dev = (struct uart_dev *)odev;
+    struct uart_bitbang *ub;
+    struct uart_bitbang_conf *ubc;
+
+    ub = (struct uart_bitbang *)os_malloc(sizeof(struct uart_bitbang));
+    if (!ub) {
+        return OS_ENOMEM;
+    }
+    memset(ub, 0, sizeof(*ub));
+
+    ubc = (struct uart_bitbang_conf *)arg;
+    ub->ub_rx.pin = ubc->ubc_rxpin;
+    ub->ub_tx.pin = ubc->ubc_txpin;
+    ub->ub_cputimer_freq = ubc->ubc_cputimer_freq;
+
+    OS_DEV_SETHANDLERS(odev, uart_bitbang_open, uart_bitbang_close);
+
+    dev->ud_funcs.uf_start_tx = uart_bitbang_start_tx;
+    dev->ud_funcs.uf_start_rx = uart_bitbang_start_rx;
+    dev->ud_funcs.uf_blocking_tx = uart_bitbang_blocking_tx;
+    dev->ud_priv = ub;
+
+    return OS_OK;
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/uart_hal/include/uart_hal/uart_hal.h
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/uart_hal/include/uart_hal/uart_hal.h b/hw/drivers/uart/uart_hal/include/uart_hal/uart_hal.h
new file mode 100644
index 0000000..702e91d
--- /dev/null
+++ b/hw/drivers/uart/uart_hal/include/uart_hal/uart_hal.h
@@ -0,0 +1,26 @@
+/**
+ * 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 __DRIVERS_UART_HAL_H_
+#define __DRIVERS_UART_HAL_H_
+
+struct os_dev;
+int uart_hal_init(struct os_dev *, void *);
+
+#endif /* __DRIVERS_UART_HAL_H_ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/uart_hal/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/uart_hal/pkg.yml b/hw/drivers/uart/uart_hal/pkg.yml
new file mode 100644
index 0000000..63523ef
--- /dev/null
+++ b/hw/drivers/uart/uart_hal/pkg.yml
@@ -0,0 +1,29 @@
+#
+# 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: hw/drivers/uart/uart_hal
+pkg.description: UART driver using HAL
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+pkg.apis:
+    - UART_HW_IMPL
+pkg.deps:
+    - hw/hal
+    - hw/drivers/uart

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/hw/drivers/uart/uart_hal/src/uart_hal.c
----------------------------------------------------------------------
diff --git a/hw/drivers/uart/uart_hal/src/uart_hal.c b/hw/drivers/uart/uart_hal/src/uart_hal.c
new file mode 100644
index 0000000..5617f6b
--- /dev/null
+++ b/hw/drivers/uart/uart_hal/src/uart_hal.c
@@ -0,0 +1,143 @@
+/**
+ * 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 <ctype.h>
+#include <assert.h>
+#include <string.h>
+
+#include <os/os.h>
+#include <os/os_dev.h>
+#include <hal/hal_uart.h>
+
+#include <uart/uart.h>
+
+#include "uart_hal/uart_hal.h"
+
+struct uart_hal_priv {
+    int unit;
+};
+
+static void
+uart_hal_start_tx(struct uart_dev *dev)
+{
+    struct uart_hal_priv *priv;
+
+    priv = dev->ud_priv;
+    assert(priv);
+
+    hal_uart_start_tx(priv->unit);
+}
+
+static void
+uart_hal_start_rx(struct uart_dev *dev)
+{
+    struct uart_hal_priv *priv;
+
+    priv = dev->ud_priv;
+
+    hal_uart_start_rx(priv->unit);
+}
+
+static void
+uart_hal_blocking_tx(struct uart_dev *dev, uint8_t byte)
+{
+    struct uart_hal_priv *priv;
+
+    priv = dev->ud_priv;
+
+    hal_uart_blocking_tx(priv->unit, byte);
+}
+
+static int
+uart_hal_open(struct os_dev *odev, uint32_t wait, void *arg)
+{
+    struct uart_hal_priv *priv;
+    struct uart_conf *uc;
+    int rc;
+
+    priv = ((struct uart_dev *)odev)->ud_priv;
+
+    uc = (struct uart_conf *)arg;
+    if (!uc) {
+        return OS_EINVAL;
+    }
+    if (odev->od_flags & OS_DEV_F_STATUS_OPEN) {
+        return OS_EBUSY;
+    }
+    hal_uart_init_cbs(priv->unit, uc->uc_tx_char, uc->uc_tx_done,
+      uc->uc_rx_char, uc->uc_cb_arg);
+
+    rc = hal_uart_config(priv->unit, uc->uc_speed, uc->uc_databits,
+      uc->uc_stopbits, uc->uc_parity, uc->uc_flow_ctl);
+    if (rc) {
+        return OS_EINVAL;
+    }
+    return OS_OK;
+}
+
+static int
+uart_hal_close(struct os_dev *odev)
+{
+    struct uart_hal_priv *priv;
+    int rc;
+
+    priv = ((struct uart_dev *)odev)->ud_priv;
+
+    rc = hal_uart_close(priv->unit);
+    if (rc) {
+        return OS_EINVAL;
+    }
+    return OS_OK;
+}
+
+/*
+ * Arg points to BSP specific UART configuration.
+ */
+int
+uart_hal_init(struct os_dev *odev, void *arg)
+{
+    struct uart_dev *dev;
+    struct uart_hal_priv *priv;
+    char ch;
+
+    priv = os_malloc(sizeof(struct uart_hal_priv));
+    if (!priv) {
+        return OS_ENOMEM;
+    }
+    priv->unit = -1;
+
+    ch = odev->od_name[strlen(odev->od_name) - 1];
+    if (!isdigit(ch)) {
+        return OS_EINVAL;
+    }
+    priv->unit = ch - '0';
+
+    dev = (struct uart_dev *)odev;
+
+    OS_DEV_SETHANDLERS(odev, uart_hal_open, uart_hal_close);
+
+    dev->ud_funcs.uf_start_tx = uart_hal_start_tx;
+    dev->ud_funcs.uf_start_rx = uart_hal_start_rx;
+    dev->ud_funcs.uf_blocking_tx = uart_hal_blocking_tx;
+    dev->ud_priv = priv;
+
+    hal_uart_init(priv->unit, arg);
+
+    return OS_OK;
+}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/bootutil/pkg.yml
----------------------------------------------------------------------
diff --git a/libs/bootutil/pkg.yml b/libs/bootutil/pkg.yml
index 77599f8..390610a 100644
--- a/libs/bootutil/pkg.yml
+++ b/libs/bootutil/pkg.yml
@@ -27,7 +27,7 @@ pkg.keywords:
 
 pkg.deps: 
     - hw/hal
-    - libs/mbedtls
+    - crypto/mbedtls
     - libs/os 
 
 pkg.syscfg_defs:

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/console/full/pkg.yml
----------------------------------------------------------------------
diff --git a/libs/console/full/pkg.yml b/libs/console/full/pkg.yml
index 80242ca..d6b95d7 100644
--- a/libs/console/full/pkg.yml
+++ b/libs/console/full/pkg.yml
@@ -26,7 +26,7 @@ pkg.keywords:
 pkg.deps:
     - hw/hal
     - libs/os
-    - drivers/uart
+    - hw/drivers/uart
 pkg.apis: console
 
 pkg.init_function: console_pkg_init

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/inet_def_service/include/inet_def_service/inet_def_service.h
----------------------------------------------------------------------
diff --git a/libs/inet_def_service/include/inet_def_service/inet_def_service.h b/libs/inet_def_service/include/inet_def_service/inet_def_service.h
deleted file mode 100644
index 6b219fe..0000000
--- a/libs/inet_def_service/include/inet_def_service/inet_def_service.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 __INET_DEF_SERVICE_H__
-#define __INET_DEF_SERVICE_H__
-
-int inet_def_service_init(uint8_t prio, os_stack_t *stack, uint16_t stack_sz);
-
-#endif /* __INET_DEF_SERVICE_H__ */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/inet_def_service/pkg.yml
----------------------------------------------------------------------
diff --git a/libs/inet_def_service/pkg.yml b/libs/inet_def_service/pkg.yml
deleted file mode 100644
index 7fb9ff2..0000000
--- a/libs/inet_def_service/pkg.yml
+++ /dev/null
@@ -1,35 +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: libs/inet_def_service
-pkg.description: INET services chargen, discard and echo
-pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
-pkg.homepage: "http://mynewt.apache.org/"
-pkg.keywords:
-    - socket
-    - inet
-    - test
-
-pkg.deps:
-    - sys/mn_socket
-    - libs/os
-    - libs/util
-
-pkg.reqs:
-    - console

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/inet_def_service/src/inet_def_service.c
----------------------------------------------------------------------
diff --git a/libs/inet_def_service/src/inet_def_service.c b/libs/inet_def_service/src/inet_def_service.c
deleted file mode 100644
index fd756bf..0000000
--- a/libs/inet_def_service/src/inet_def_service.c
+++ /dev/null
@@ -1,333 +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 <assert.h>
-#include <string.h>
-
-#include <os/os.h>
-#include <os/endian.h>
-#include <mn_socket/mn_socket.h>
-#include <console/console.h>
-
-#include "inet_def_service/inet_def_service.h"
-
-#define ECHO_PORT       7
-#define DISCARD_PORT    9
-#define CHARGEN_PORT    19
-
-enum inet_def_type {
-    INET_DEF_ECHO = 0,
-    INET_DEF_DISCARD,
-    INET_DEF_CHARGEN,
-    INET_DEF_MAXTYPE
-};
-
-#define INET_DEF_FROM_EVENT_TYPE(a) ((a) - OS_EVENT_T_PERUSER)
-#define INET_EVENT_TYPE_FROM_DEF(a) ((a) + OS_EVENT_T_PERUSER)
-
-#define CHARGEN_WRITE_SZ     512
-static const char chargen_pattern[] = "1234567890";
-#define CHARGEN_PATTERN_SZ   (sizeof(chargen_pattern) - 1)
-
-static struct os_task inet_def_task;
-static struct os_eventq inet_def_evq;
-
-/*
- * UDP service.
- */
-struct inet_def_udp {
-    struct os_event ev;                 /* Datagram RX reported via event */
-    struct mn_socket *socket;
-    uint32_t pkt_cnt;
-};
-
-/*
- * Connected TCP socket.
- */
-struct inet_def_tcp {
-    struct os_event ev;                 /* Data RX reported with this event */
-    SLIST_ENTRY(inet_def_tcp) list;
-    struct mn_socket *socket;
-    int closed;
-};
-
-/*
- * TCP service.
- */
-struct inet_def_listen {
-    struct mn_socket *socket;
-    uint32_t conn_cnt;
-};
-
-static struct inet_def {
-    struct inet_def_listen tcp_service[INET_DEF_MAXTYPE];
-    struct inet_def_udp udp_service[INET_DEF_MAXTYPE];
-    SLIST_HEAD(, inet_def_tcp) tcp_conns; /* List of connected TCP sockets */
-} inet_def;
-
-/*
- * UDP socket callbacks. Called in context of IP stack task.
- */
-static void
-inet_def_udp_readable(void *arg, int err)
-{
-    struct inet_def_udp *idu = (struct inet_def_udp *)arg;
-
-    os_eventq_put(&inet_def_evq, &idu->ev);
-}
-
-static const union mn_socket_cb inet_udp_cbs = {
-    .socket.readable = inet_def_udp_readable,
-};
-
-/*
- * TCP socket callbacks. Called in context of IP stack task.
- */
-static void
-inet_def_tcp_readable(void *arg, int err)
-{
-    struct inet_def_tcp *idt = (struct inet_def_tcp *)arg;
-
-    if (err) {
-        idt->closed = 1;
-        /*
-         * No locking here. Assuming new connection notifications, as well as
-         * close notifications arrive in context of a single task.
-         */
-        SLIST_REMOVE(&inet_def.tcp_conns, idt, inet_def_tcp, list);
-    }
-    os_eventq_put(&inet_def_evq, &idt->ev);
-}
-
-static const union mn_socket_cb inet_tcp_cbs = {
-    .socket.readable = inet_def_tcp_readable,
-    .socket.writable = inet_def_tcp_readable /* we want the same behavior */
-};
-
-/*
- * Callback for new connection for TCP listen socket.
- */
-static int inet_def_newconn(void *arg, struct mn_socket *new)
-{
-    struct inet_def_listen *idl = (struct inet_def_listen *)arg;
-    struct inet_def_tcp *idt;
-    enum inet_def_type type;
-
-    idt = (struct inet_def_tcp *)os_malloc(sizeof(*idt));
-    if (!idt) {
-        return -1;
-    }
-
-    memset(idt, 0, sizeof(*idt));
-    idt->socket = new;
-
-    /*
-     * Event type tells what type of service this connection belongs to.
-     * Ev_arg says whether it's TCP or UDP.
-     */
-    type = idl - &inet_def.tcp_service[0];
-    idt->ev.ev_type = INET_EVENT_TYPE_FROM_DEF(type);
-    idt->ev.ev_arg = (void *)MN_SOCK_STREAM;
-    mn_socket_set_cbs(new, idt, &inet_tcp_cbs);
-    SLIST_INSERT_HEAD(&inet_def.tcp_conns, idt, list);
-
-    if (type == INET_DEF_CHARGEN) {
-        /*
-         * Start transmitting right away.
-         */
-        os_eventq_put(&inet_def_evq, &idt->ev);
-    }
-    return 0;
-}
-
-static const union mn_socket_cb inet_listen_cbs =  {
-    .listen.newconn = inet_def_newconn,
-};
-
-static int
-inet_def_create_srv(enum inet_def_type idx, uint16_t port)
-{
-    struct mn_socket *ms;
-    struct mn_sockaddr_in msin;
-
-    memset(&msin, 0, sizeof(msin));
-    msin.msin_len = sizeof(msin);
-    msin.msin_family = MN_AF_INET;
-    msin.msin_port = htons(port);
-
-    /*
-     * Create TCP listen socket for service.
-     */
-    if (mn_socket(&ms, MN_PF_INET, MN_SOCK_STREAM, 0)) {
-        goto err;
-    }
-    inet_def.tcp_service[idx].socket = ms;
-    mn_socket_set_cbs(ms, &inet_def.tcp_service[idx], &inet_listen_cbs);
-
-    if (mn_bind(ms, (struct mn_sockaddr *)&msin)) {
-        goto err;
-    }
-    if (mn_listen(ms, 1)) {
-        goto err;
-    }
-
-    /*
-     * Create UDP socket for service.
-     */
-    if (mn_socket(&ms, MN_PF_INET, MN_SOCK_DGRAM, 0)) {
-        goto err;
-    }
-    inet_def.udp_service[idx].socket = ms;
-    mn_socket_set_cbs(ms, &inet_def.udp_service[idx], &inet_udp_cbs);
-
-    if (mn_bind(ms, (struct mn_sockaddr *)&msin)) {
-        goto err;
-    }
-
-    return 0;
-err:
-    if (inet_def.tcp_service[idx].socket) {
-        mn_close(inet_def.tcp_service[idx].socket);
-        inet_def.tcp_service[idx].socket = NULL;
-    }
-    if (inet_def.udp_service[idx].socket) {
-        mn_close(inet_def.udp_service[idx].socket);
-        inet_def.udp_service[idx].socket = NULL;
-    }
-    return -1;
-}
-
-static void
-inet_def_srv(void *arg)
-{
-    struct inet_def_udp *idu;
-    struct inet_def_tcp *idt;
-    struct mn_socket *sock;
-    struct os_event *ev;
-    struct mn_sockaddr_in msin;
-    struct os_mbuf *m;
-    enum inet_def_type type;
-    int rc;
-    int off;
-    int loop_cnt;
-
-    inet_def_create_srv(INET_DEF_ECHO, ECHO_PORT);
-    inet_def_create_srv(INET_DEF_DISCARD, DISCARD_PORT);
-    inet_def_create_srv(INET_DEF_CHARGEN, CHARGEN_PORT);
-
-    while (1) {
-        /*
-         * Wait here. When event comes, check what type of socket got it,
-         * and then act on it.
-         */
-        ev = os_eventq_get(&inet_def_evq);
-        type = INET_DEF_FROM_EVENT_TYPE(ev->ev_type);
-        idt = (struct inet_def_tcp *)ev;
-        idu = (struct inet_def_udp *)ev;
-        if ((int)ev->ev_arg == MN_SOCK_DGRAM) {
-            sock = idu->socket;
-        } else {
-            sock = idt->socket;
-        }
-        switch (type) {
-        case INET_DEF_ECHO:
-            while (mn_recvfrom(sock, &m, (struct mn_sockaddr *)&msin) == 0) {
-                console_printf("echo %d bytes\n", OS_MBUF_PKTLEN(m));
-                rc = mn_sendto(sock, m, (struct mn_sockaddr *)&msin);
-                if (rc) {
-                    console_printf("  failed: %d!!!!\n", rc);
-                    os_mbuf_free_chain(m);
-                }
-            }
-            break;
-        case INET_DEF_DISCARD:
-            while (mn_recvfrom(sock, &m, NULL) == 0) {
-                console_printf("discard %d bytes\n", OS_MBUF_PKTLEN(m));
-                os_mbuf_free_chain(m);
-            }
-            break;
-        case INET_DEF_CHARGEN:
-            while (mn_recvfrom(sock, &m, NULL) == 0) {
-                os_mbuf_free_chain(m);
-            }
-            if ((int)ev->ev_arg == MN_SOCK_STREAM && idt->closed) {
-                /*
-                 * Don't try to send tons of data to a closed socket.
-                 */
-                break;
-            }
-            loop_cnt = 0;
-            do {
-                m = os_msys_get(CHARGEN_WRITE_SZ, 0);
-                if (m) {
-                    for (off = 0;
-                         OS_MBUF_TRAILINGSPACE(m) >= CHARGEN_PATTERN_SZ;
-                         off += CHARGEN_PATTERN_SZ) {
-                        os_mbuf_copyinto(m, off, chargen_pattern,
-                          CHARGEN_PATTERN_SZ);
-                    }
-                    console_printf("chargen %d bytes\n", m->om_len);
-                    rc = mn_sendto(sock, m, NULL); /* assumes TCP for now */
-                    if (rc) {
-                        os_mbuf_free_chain(m);
-                        if (rc != MN_ENOBUFS && rc != MN_EAGAIN) {
-                            console_write("  sendto fail!!! %d\n", rc);
-                        }
-                        break;
-                    }
-                } else {
-                    /*
-                     * Mbuf shortage. Wait for them to appear.
-                     */
-                    os_time_delay(1);
-                }
-                loop_cnt++;
-            } while (loop_cnt < 32);
-            break;
-        default:
-            assert(0);
-            break;
-        }
-        if ((int)ev->ev_arg == MN_SOCK_STREAM && idt->closed) {
-            /*
-             * Remote end has closed the connection, as indicated in the
-             * callback. Close the socket and free the memory.
-             */
-            mn_socket_set_cbs(idt->socket, NULL, NULL);
-            os_eventq_remove(&inet_def_evq, &idt->ev);
-            mn_close(idt->socket);
-            os_free(idt);
-        }
-    }
-}
-
-int
-inet_def_service_init(uint8_t prio, os_stack_t *stack, uint16_t stack_sz)
-{
-    int i;
-
-    os_eventq_init(&inet_def_evq);
-    SLIST_INIT(&inet_def.tcp_conns);
-    for (i = 0; i < 3; i++) {
-        inet_def.udp_service[i].ev.ev_type = INET_EVENT_TYPE_FROM_DEF(i);
-        inet_def.udp_service[i].ev.ev_arg = (void *)MN_SOCK_DGRAM;
-    }
-    return os_task_init(&inet_def_task, "inet_def_task",
-      inet_def_srv, NULL, prio, OS_WAIT_FOREVER, stack, stack_sz);
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/mbedtls/LICENSE
----------------------------------------------------------------------
diff --git a/libs/mbedtls/LICENSE b/libs/mbedtls/LICENSE
deleted file mode 100644
index 546a8e6..0000000
--- a/libs/mbedtls/LICENSE
+++ /dev/null
@@ -1,2 +0,0 @@
-Unless specifically indicated otherwise in a file, files are licensed
-under the Apache 2.0 license, as can be found in: apache-2.0.txt

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/mbedtls/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/libs/mbedtls/apache-2.0.txt b/libs/mbedtls/apache-2.0.txt
deleted file mode 100644
index d645695..0000000
--- a/libs/mbedtls/apache-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/mbedtls/include/.gitignore
----------------------------------------------------------------------
diff --git a/libs/mbedtls/include/.gitignore b/libs/mbedtls/include/.gitignore
deleted file mode 100644
index bf67d02..0000000
--- a/libs/mbedtls/include/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-*.sln
-*.vcxproj
-mbedtls/check_config

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/mbedtls/include/mbedtls/aes.h
----------------------------------------------------------------------
diff --git a/libs/mbedtls/include/mbedtls/aes.h b/libs/mbedtls/include/mbedtls/aes.h
deleted file mode 100644
index a36e825..0000000
--- a/libs/mbedtls/include/mbedtls/aes.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/**
- * \file aes.h
- *
- * \brief AES block cipher
- *
- *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
- *  SPDX-License-Identifier: Apache-2.0
- *
- *  Licensed 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.
- *
- *  This file is part of mbed TLS (https://tls.mbed.org)
- */
-#ifndef MBEDTLS_AES_H
-#define MBEDTLS_AES_H
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include <stddef.h>
-#include <stdint.h>
-
-/* padlock.c and aesni.c rely on these values! */
-#define MBEDTLS_AES_ENCRYPT     1
-#define MBEDTLS_AES_DECRYPT     0
-
-#define MBEDTLS_ERR_AES_INVALID_KEY_LENGTH                -0x0020  /**< Invalid key length. */
-#define MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH              -0x0022  /**< Invalid data input length. */
-
-#if !defined(MBEDTLS_AES_ALT)
-// Regular implementation
-//
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief          AES context structure
- *
- * \note           buf is able to hold 32 extra bytes, which can be used:
- *                 - for alignment purposes if VIA padlock is used, and/or
- *                 - to simplify key expansion in the 256-bit case by
- *                 generating an extra round key
- */
-typedef struct
-{
-    int nr;                     /*!<  number of rounds  */
-    uint32_t *rk;               /*!<  AES round keys    */
-    uint32_t buf[68];           /*!<  unaligned data    */
-}
-mbedtls_aes_context;
-
-/**
- * \brief          Initialize AES context
- *
- * \param ctx      AES context to be initialized
- */
-void mbedtls_aes_init( mbedtls_aes_context *ctx );
-
-/**
- * \brief          Clear AES context
- *
- * \param ctx      AES context to be cleared
- */
-void mbedtls_aes_free( mbedtls_aes_context *ctx );
-
-/**
- * \brief          AES key schedule (encryption)
- *
- * \param ctx      AES context to be initialized
- * \param key      encryption key
- * \param keybits  must be 128, 192 or 256
- *
- * \return         0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
- */
-int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned char *key,
-                    unsigned int keybits );
-
-/**
- * \brief          AES key schedule (decryption)
- *
- * \param ctx      AES context to be initialized
- * \param key      decryption key
- * \param keybits  must be 128, 192 or 256
- *
- * \return         0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
- */
-int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned char *key,
-                    unsigned int keybits );
-
-/**
- * \brief          AES-ECB block encryption/decryption
- *
- * \param ctx      AES context
- * \param mode     MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
- * \param input    16-byte input block
- * \param output   16-byte output block
- *
- * \return         0 if successful
- */
-int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
-                    int mode,
-                    const unsigned char input[16],
-                    unsigned char output[16] );
-
-#if defined(MBEDTLS_CIPHER_MODE_CBC)
-/**
- * \brief          AES-CBC buffer encryption/decryption
- *                 Length should be a multiple of the block
- *                 size (16 bytes)
- *
- * \note           Upon exit, the content of the IV is updated so that you can
- *                 call the function same function again on the following
- *                 block(s) of data and get the same result as if it was
- *                 encrypted in one call. This allows a "streaming" usage.
- *                 If on the other hand you need to retain the contents of the
- *                 IV, you should either save it manually or use the cipher
- *                 module instead.
- *
- * \param ctx      AES context
- * \param mode     MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
- * \param length   length of the input data
- * \param iv       initialization vector (updated after use)
- * \param input    buffer holding the input data
- * \param output   buffer holding the output data
- *
- * \return         0 if successful, or MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
- */
-int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
-                    int mode,
-                    size_t length,
-                    unsigned char iv[16],
-                    const unsigned char *input,
-                    unsigned char *output );
-#endif /* MBEDTLS_CIPHER_MODE_CBC */
-
-#if defined(MBEDTLS_CIPHER_MODE_CFB)
-/**
- * \brief          AES-CFB128 buffer encryption/decryption.
- *
- * Note: Due to the nature of CFB you should use the same key schedule for
- * both encryption and decryption. So a context initialized with
- * mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
- *
- * \note           Upon exit, the content of the IV is updated so that you can
- *                 call the function same function again on the following
- *                 block(s) of data and get the same result as if it was
- *                 encrypted in one call. This allows a "streaming" usage.
- *                 If on the other hand you need to retain the contents of the
- *                 IV, you should either save it manually or use the cipher
- *                 module instead.
- *
- * \param ctx      AES context
- * \param mode     MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
- * \param length   length of the input data
- * \param iv_off   offset in IV (updated after use)
- * \param iv       initialization vector (updated after use)
- * \param input    buffer holding the input data
- * \param output   buffer holding the output data
- *
- * \return         0 if successful
- */
-int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
-                       int mode,
-                       size_t length,
-                       size_t *iv_off,
-                       unsigned char iv[16],
-                       const unsigned char *input,
-                       unsigned char *output );
-
-/**
- * \brief          AES-CFB8 buffer encryption/decryption.
- *
- * Note: Due to the nature of CFB you should use the same key schedule for
- * both encryption and decryption. So a context initialized with
- * mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
- *
- * \note           Upon exit, the content of the IV is updated so that you can
- *                 call the function same function again on the following
- *                 block(s) of data and get the same result as if it was
- *                 encrypted in one call. This allows a "streaming" usage.
- *                 If on the other hand you need to retain the contents of the
- *                 IV, you should either save it manually or use the cipher
- *                 module instead.
- *
- * \param ctx      AES context
- * \param mode     MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
- * \param length   length of the input data
- * \param iv       initialization vector (updated after use)
- * \param input    buffer holding the input data
- * \param output   buffer holding the output data
- *
- * \return         0 if successful
- */
-int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
-                    int mode,
-                    size_t length,
-                    unsigned char iv[16],
-                    const unsigned char *input,
-                    unsigned char *output );
-#endif /*MBEDTLS_CIPHER_MODE_CFB */
-
-#if defined(MBEDTLS_CIPHER_MODE_CTR)
-/**
- * \brief               AES-CTR buffer encryption/decryption
- *
- * Warning: You have to keep the maximum use of your counter in mind!
- *
- * Note: Due to the nature of CTR you should use the same key schedule for
- * both encryption and decryption. So a context initialized with
- * mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
- *
- * \param ctx           AES context
- * \param length        The length of the data
- * \param nc_off        The offset in the current stream_block (for resuming
- *                      within current cipher stream). The offset pointer to
- *                      should be 0 at the start of a stream.
- * \param nonce_counter The 128-bit nonce and counter.
- * \param stream_block  The saved stream-block for resuming. Is overwritten
- *                      by the function.
- * \param input         The input data stream
- * \param output        The output data stream
- *
- * \return         0 if successful
- */
-int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
-                       size_t length,
-                       size_t *nc_off,
-                       unsigned char nonce_counter[16],
-                       unsigned char stream_block[16],
-                       const unsigned char *input,
-                       unsigned char *output );
-#endif /* MBEDTLS_CIPHER_MODE_CTR */
-
-/**
- * \brief           Internal AES block encryption function
- *                  (Only exposed to allow overriding it,
- *                  see MBEDTLS_AES_ENCRYPT_ALT)
- *
- * \param ctx       AES context
- * \param input     Plaintext block
- * \param output    Output (ciphertext) block
- */
-void mbedtls_aes_encrypt( mbedtls_aes_context *ctx,
-                          const unsigned char input[16],
-                          unsigned char output[16] );
-
-/**
- * \brief           Internal AES block decryption function
- *                  (Only exposed to allow overriding it,
- *                  see MBEDTLS_AES_DECRYPT_ALT)
- *
- * \param ctx       AES context
- * \param input     Ciphertext block
- * \param output    Output (plaintext) block
- */
-void mbedtls_aes_decrypt( mbedtls_aes_context *ctx,
-                          const unsigned char input[16],
-                          unsigned char output[16] );
-
-#ifdef __cplusplus
-}
-#endif
-
-#else  /* MBEDTLS_AES_ALT */
-#include "aes_alt.h"
-#endif /* MBEDTLS_AES_ALT */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief          Checkup routine
- *
- * \return         0 if successful, or 1 if the test failed
- */
-int mbedtls_aes_self_test( int verbose );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* aes.h */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/mbedtls/include/mbedtls/aesni.h
----------------------------------------------------------------------
diff --git a/libs/mbedtls/include/mbedtls/aesni.h b/libs/mbedtls/include/mbedtls/aesni.h
deleted file mode 100644
index b1b7f1c..0000000
--- a/libs/mbedtls/include/mbedtls/aesni.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * \file aesni.h
- *
- * \brief AES-NI for hardware AES acceleration on some Intel processors
- *
- *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
- *  SPDX-License-Identifier: Apache-2.0
- *
- *  Licensed 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.
- *
- *  This file is part of mbed TLS (https://tls.mbed.org)
- */
-#ifndef MBEDTLS_AESNI_H
-#define MBEDTLS_AESNI_H
-
-#include "aes.h"
-
-#define MBEDTLS_AESNI_AES      0x02000000u
-#define MBEDTLS_AESNI_CLMUL    0x00000002u
-
-#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) &&  \
-    ( defined(__amd64__) || defined(__x86_64__) )   &&  \
-    ! defined(MBEDTLS_HAVE_X86_64)
-#define MBEDTLS_HAVE_X86_64
-#endif
-
-#if defined(MBEDTLS_HAVE_X86_64)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief          AES-NI features detection routine
- *
- * \param what     The feature to detect
- *                 (MBEDTLS_AESNI_AES or MBEDTLS_AESNI_CLMUL)
- *
- * \return         1 if CPU has support for the feature, 0 otherwise
- */
-int mbedtls_aesni_has_support( unsigned int what );
-
-/**
- * \brief          AES-NI AES-ECB block en(de)cryption
- *
- * \param ctx      AES context
- * \param mode     MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
- * \param input    16-byte input block
- * \param output   16-byte output block
- *
- * \return         0 on success (cannot fail)
- */
-int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
-                     int mode,
-                     const unsigned char input[16],
-                     unsigned char output[16] );
-
-/**
- * \brief          GCM multiplication: c = a * b in GF(2^128)
- *
- * \param c        Result
- * \param a        First operand
- * \param b        Second operand
- *
- * \note           Both operands and result are bit strings interpreted as
- *                 elements of GF(2^128) as per the GCM spec.
- */
-void mbedtls_aesni_gcm_mult( unsigned char c[16],
-                     const unsigned char a[16],
-                     const unsigned char b[16] );
-
-/**
- * \brief           Compute decryption round keys from encryption round keys
- *
- * \param invkey    Round keys for the equivalent inverse cipher
- * \param fwdkey    Original round keys (for encryption)
- * \param nr        Number of rounds (that is, number of round keys minus one)
- */
-void mbedtls_aesni_inverse_key( unsigned char *invkey,
-                        const unsigned char *fwdkey, int nr );
-
-/**
- * \brief           Perform key expansion (for encryption)
- *
- * \param rk        Destination buffer where the round keys are written
- * \param key       Encryption key
- * \param bits      Key size in bits (must be 128, 192 or 256)
- *
- * \return          0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
- */
-int mbedtls_aesni_setkey_enc( unsigned char *rk,
-                      const unsigned char *key,
-                      size_t bits );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MBEDTLS_HAVE_X86_64 */
-
-#endif /* MBEDTLS_AESNI_H */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/mbedtls/include/mbedtls/arc4.h
----------------------------------------------------------------------
diff --git a/libs/mbedtls/include/mbedtls/arc4.h b/libs/mbedtls/include/mbedtls/arc4.h
deleted file mode 100644
index 5fc5395..0000000
--- a/libs/mbedtls/include/mbedtls/arc4.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * \file arc4.h
- *
- * \brief The ARCFOUR stream cipher
- *
- *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
- *  SPDX-License-Identifier: Apache-2.0
- *
- *  Licensed 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.
- *
- *  This file is part of mbed TLS (https://tls.mbed.org)
- */
-#ifndef MBEDTLS_ARC4_H
-#define MBEDTLS_ARC4_H
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include <stddef.h>
-
-#if !defined(MBEDTLS_ARC4_ALT)
-// Regular implementation
-//
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief          ARC4 context structure
- */
-typedef struct
-{
-    int x;                      /*!< permutation index */
-    int y;                      /*!< permutation index */
-    unsigned char m[256];       /*!< permutation table */
-}
-mbedtls_arc4_context;
-
-/**
- * \brief          Initialize ARC4 context
- *
- * \param ctx      ARC4 context to be initialized
- */
-void mbedtls_arc4_init( mbedtls_arc4_context *ctx );
-
-/**
- * \brief          Clear ARC4 context
- *
- * \param ctx      ARC4 context to be cleared
- */
-void mbedtls_arc4_free( mbedtls_arc4_context *ctx );
-
-/**
- * \brief          ARC4 key schedule
- *
- * \param ctx      ARC4 context to be setup
- * \param key      the secret key
- * \param keylen   length of the key, in bytes
- */
-void mbedtls_arc4_setup( mbedtls_arc4_context *ctx, const unsigned char *key,
-                 unsigned int keylen );
-
-/**
- * \brief          ARC4 cipher function
- *
- * \param ctx      ARC4 context
- * \param length   length of the input data
- * \param input    buffer holding the input data
- * \param output   buffer for the output data
- *
- * \return         0 if successful
- */
-int mbedtls_arc4_crypt( mbedtls_arc4_context *ctx, size_t length, const unsigned char *input,
-                unsigned char *output );
-
-#ifdef __cplusplus
-}
-#endif
-
-#else  /* MBEDTLS_ARC4_ALT */
-#include "arc4_alt.h"
-#endif /* MBEDTLS_ARC4_ALT */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief          Checkup routine
- *
- * \return         0 if successful, or 1 if the test failed
- */
-int mbedtls_arc4_self_test( int verbose );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* arc4.h */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0216c73e/libs/mbedtls/include/mbedtls/asn1.h
----------------------------------------------------------------------
diff --git a/libs/mbedtls/include/mbedtls/asn1.h b/libs/mbedtls/include/mbedtls/asn1.h
deleted file mode 100644
index 082832c..0000000
--- a/libs/mbedtls/include/mbedtls/asn1.h
+++ /dev/null
@@ -1,342 +0,0 @@
-/**
- * \file asn1.h
- *
- * \brief Generic ASN.1 parsing
- *
- *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
- *  SPDX-License-Identifier: Apache-2.0
- *
- *  Licensed 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.
- *
- *  This file is part of mbed TLS (https://tls.mbed.org)
- */
-#ifndef MBEDTLS_ASN1_H
-#define MBEDTLS_ASN1_H
-
-#if !defined(MBEDTLS_CONFIG_FILE)
-#include "config.h"
-#else
-#include MBEDTLS_CONFIG_FILE
-#endif
-
-#include <stddef.h>
-
-#if defined(MBEDTLS_BIGNUM_C)
-#include "bignum.h"
-#endif
-
-/**
- * \addtogroup asn1_module
- * \{
- */
-
-/**
- * \name ASN1 Error codes
- * These error codes are OR'ed to X509 error codes for
- * higher error granularity.
- * ASN1 is a standard to specify data structures.
- * \{
- */
-#define MBEDTLS_ERR_ASN1_OUT_OF_DATA                      -0x0060  /**< Out of data when parsing an ASN1 data structure. */
-#define MBEDTLS_ERR_ASN1_UNEXPECTED_TAG                   -0x0062  /**< ASN1 tag was of an unexpected value. */
-#define MBEDTLS_ERR_ASN1_INVALID_LENGTH                   -0x0064  /**< Error when trying to determine the length or invalid length. */
-#define MBEDTLS_ERR_ASN1_LENGTH_MISMATCH                  -0x0066  /**< Actual length differs from expected length. */
-#define MBEDTLS_ERR_ASN1_INVALID_DATA                     -0x0068  /**< Data is invalid. (not used) */
-#define MBEDTLS_ERR_ASN1_ALLOC_FAILED                     -0x006A  /**< Memory allocation failed */
-#define MBEDTLS_ERR_ASN1_BUF_TOO_SMALL                    -0x006C  /**< Buffer too small when writing ASN.1 data structure. */
-
-/* \} name */
-
-/**
- * \name DER constants
- * These constants comply with DER encoded the ANS1 type tags.
- * DER encoding uses hexadecimal representation.
- * An example DER sequence is:\n
- * - 0x02 -- tag indicating INTEGER
- * - 0x01 -- length in octets
- * - 0x05 -- value
- * Such sequences are typically read into \c ::mbedtls_x509_buf.
- * \{
- */
-#define MBEDTLS_ASN1_BOOLEAN                 0x01
-#define MBEDTLS_ASN1_INTEGER                 0x02
-#define MBEDTLS_ASN1_BIT_STRING              0x03
-#define MBEDTLS_ASN1_OCTET_STRING            0x04
-#define MBEDTLS_ASN1_NULL                    0x05
-#define MBEDTLS_ASN1_OID                     0x06
-#define MBEDTLS_ASN1_UTF8_STRING             0x0C
-#define MBEDTLS_ASN1_SEQUENCE                0x10
-#define MBEDTLS_ASN1_SET                     0x11
-#define MBEDTLS_ASN1_PRINTABLE_STRING        0x13
-#define MBEDTLS_ASN1_T61_STRING              0x14
-#define MBEDTLS_ASN1_IA5_STRING              0x16
-#define MBEDTLS_ASN1_UTC_TIME                0x17
-#define MBEDTLS_ASN1_GENERALIZED_TIME        0x18
-#define MBEDTLS_ASN1_UNIVERSAL_STRING        0x1C
-#define MBEDTLS_ASN1_BMP_STRING              0x1E
-#define MBEDTLS_ASN1_PRIMITIVE               0x00
-#define MBEDTLS_ASN1_CONSTRUCTED             0x20
-#define MBEDTLS_ASN1_CONTEXT_SPECIFIC        0x80
-/* \} name */
-/* \} addtogroup asn1_module */
-
-/** Returns the size of the binary string, without the trailing \\0 */
-#define MBEDTLS_OID_SIZE(x) (sizeof(x) - 1)
-
-/**
- * Compares an mbedtls_asn1_buf structure to a reference OID.
- *
- * Only works for 'defined' oid_str values (MBEDTLS_OID_HMAC_SHA1), you cannot use a
- * 'unsigned char *oid' here!
- */
-#define MBEDTLS_OID_CMP(oid_str, oid_buf)                                   \
-        ( ( MBEDTLS_OID_SIZE(oid_str) != (oid_buf)->len ) ||                \
-          memcmp( (oid_str), (oid_buf)->p, (oid_buf)->len) != 0 )
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \name Functions to parse ASN.1 data structures
- * \{
- */
-
-/**
- * Type-length-value structure that allows for ASN1 using DER.
- */
-typedef struct mbedtls_asn1_buf
-{
-    int tag;                /**< ASN1 type, e.g. MBEDTLS_ASN1_UTF8_STRING. */
-    size_t len;             /**< ASN1 length, in octets. */
-    unsigned char *p;       /**< ASN1 data, e.g. in ASCII. */
-}
-mbedtls_asn1_buf;
-
-/**
- * Container for ASN1 bit strings.
- */
-typedef struct mbedtls_asn1_bitstring
-{
-    size_t len;                 /**< ASN1 length, in octets. */
-    unsigned char unused_bits;  /**< Number of unused bits at the end of the string */
-    unsigned char *p;           /**< Raw ASN1 data for the bit string */
-}
-mbedtls_asn1_bitstring;
-
-/**
- * Container for a sequence of ASN.1 items
- */
-typedef struct mbedtls_asn1_sequence
-{
-    mbedtls_asn1_buf buf;                   /**< Buffer containing the given ASN.1 item. */
-    struct mbedtls_asn1_sequence *next;    /**< The next entry in the sequence. */
-}
-mbedtls_asn1_sequence;
-
-/**
- * Container for a sequence or list of 'named' ASN.1 data items
- */
-typedef struct mbedtls_asn1_named_data
-{
-    mbedtls_asn1_buf oid;                   /**< The object identifier. */
-    mbedtls_asn1_buf val;                   /**< The named value. */
-    struct mbedtls_asn1_named_data *next;  /**< The next entry in the sequence. */
-    unsigned char next_merged;      /**< Merge next item into the current one? */
-}
-mbedtls_asn1_named_data;
-
-/**
- * \brief       Get the length of an ASN.1 element.
- *              Updates the pointer to immediately behind the length.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param len   The variable that will receive the value
- *
- * \return      0 if successful, MBEDTLS_ERR_ASN1_OUT_OF_DATA on reaching
- *              end of data, MBEDTLS_ERR_ASN1_INVALID_LENGTH if length is
- *              unparseable.
- */
-int mbedtls_asn1_get_len( unsigned char **p,
-                  const unsigned char *end,
-                  size_t *len );
-
-/**
- * \brief       Get the tag and length of the tag. Check for the requested tag.
- *              Updates the pointer to immediately behind the tag and length.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param len   The variable that will receive the length
- * \param tag   The expected tag
- *
- * \return      0 if successful, MBEDTLS_ERR_ASN1_UNEXPECTED_TAG if tag did
- *              not match requested tag, or another specific ASN.1 error code.
- */
-int mbedtls_asn1_get_tag( unsigned char **p,
-                  const unsigned char *end,
-                  size_t *len, int tag );
-
-/**
- * \brief       Retrieve a boolean ASN.1 tag and its value.
- *              Updates the pointer to immediately behind the full tag.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param val   The variable that will receive the value
- *
- * \return      0 if successful or a specific ASN.1 error code.
- */
-int mbedtls_asn1_get_bool( unsigned char **p,
-                   const unsigned char *end,
-                   int *val );
-
-/**
- * \brief       Retrieve an integer ASN.1 tag and its value.
- *              Updates the pointer to immediately behind the full tag.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param val   The variable that will receive the value
- *
- * \return      0 if successful or a specific ASN.1 error code.
- */
-int mbedtls_asn1_get_int( unsigned char **p,
-                  const unsigned char *end,
-                  int *val );
-
-/**
- * \brief       Retrieve a bitstring ASN.1 tag and its value.
- *              Updates the pointer to immediately behind the full tag.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param bs    The variable that will receive the value
- *
- * \return      0 if successful or a specific ASN.1 error code.
- */
-int mbedtls_asn1_get_bitstring( unsigned char **p, const unsigned char *end,
-                        mbedtls_asn1_bitstring *bs);
-
-/**
- * \brief       Retrieve a bitstring ASN.1 tag without unused bits and its
- *              value.
- *              Updates the pointer to the beginning of the bit/octet string.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param len   Length of the actual bit/octect string in bytes
- *
- * \return      0 if successful or a specific ASN.1 error code.
- */
-int mbedtls_asn1_get_bitstring_null( unsigned char **p, const unsigned char *end,
-                             size_t *len );
-
-/**
- * \brief       Parses and splits an ASN.1 "SEQUENCE OF <tag>"
- *              Updated the pointer to immediately behind the full sequence tag.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param cur   First variable in the chain to fill
- * \param tag   Type of sequence
- *
- * \return      0 if successful or a specific ASN.1 error code.
- */
-int mbedtls_asn1_get_sequence_of( unsigned char **p,
-                          const unsigned char *end,
-                          mbedtls_asn1_sequence *cur,
-                          int tag);
-
-#if defined(MBEDTLS_BIGNUM_C)
-/**
- * \brief       Retrieve a MPI value from an integer ASN.1 tag.
- *              Updates the pointer to immediately behind the full tag.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param X     The MPI that will receive the value
- *
- * \return      0 if successful or a specific ASN.1 or MPI error code.
- */
-int mbedtls_asn1_get_mpi( unsigned char **p,
-                  const unsigned char *end,
-                  mbedtls_mpi *X );
-#endif /* MBEDTLS_BIGNUM_C */
-
-/**
- * \brief       Retrieve an AlgorithmIdentifier ASN.1 sequence.
- *              Updates the pointer to immediately behind the full
- *              AlgorithmIdentifier.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param alg   The buffer to receive the OID
- * \param params The buffer to receive the params (if any)
- *
- * \return      0 if successful or a specific ASN.1 or MPI error code.
- */
-int mbedtls_asn1_get_alg( unsigned char **p,
-                  const unsigned char *end,
-                  mbedtls_asn1_buf *alg, mbedtls_asn1_buf *params );
-
-/**
- * \brief       Retrieve an AlgorithmIdentifier ASN.1 sequence with NULL or no
- *              params.
- *              Updates the pointer to immediately behind the full
- *              AlgorithmIdentifier.
- *
- * \param p     The position in the ASN.1 data
- * \param end   End of data
- * \param alg   The buffer to receive the OID
- *
- * \return      0 if successful or a specific ASN.1 or MPI error code.
- */
-int mbedtls_asn1_get_alg_null( unsigned char **p,
-                       const unsigned char *end,
-                       mbedtls_asn1_buf *alg );
-
-/**
- * \brief       Find a specific named_data entry in a sequence or list based on
- *              the OID.
- *
- * \param list  The list to seek through
- * \param oid   The OID to look for
- * \param len   Size of the OID
- *
- * \return      NULL if not found, or a pointer to the existing entry.
- */
-mbedtls_asn1_named_data *mbedtls_asn1_find_named_data( mbedtls_asn1_named_data *list,
-                                       const char *oid, size_t len );
-
-/**
- * \brief       Free a mbedtls_asn1_named_data entry
- *
- * \param entry The named data entry to free
- */
-void mbedtls_asn1_free_named_data( mbedtls_asn1_named_data *entry );
-
-/**
- * \brief       Free all entries in a mbedtls_asn1_named_data list
- *              Head will be set to NULL
- *
- * \param head  Pointer to the head of the list of named data entries to free
- */
-void mbedtls_asn1_free_named_data_list( mbedtls_asn1_named_data **head );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* asn1.h */