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

[34/59] [abbrv] [partial] incubator-mynewt-core git commit: Remove non-Apache-compatible Nordic SDK files.

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.c
deleted file mode 100644
index 845b919..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.c
+++ /dev/null
@@ -1,851 +0,0 @@
-/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-#include "nrf_drv_uart.h"
-#include "nrf_assert.h"
-#include "nordic_common.h"
-#include "nrf_drv_common.h"
-#include "nrf_gpio.h"
-#include "app_util_platform.h"
-
-// This set of macros makes it possible to exclude parts of code, when one type
-// of supported peripherals is not used.
-#ifdef NRF51
-#define UART_IN_USE
-#elif defined(NRF52)
-#if (UART_EASY_DMA_SUPPORT == 1)
-#define UARTE_IN_USE
-#endif
-#if (UART_LEGACY_SUPPORT == 1)
-#define UART_IN_USE
-#endif
-#endif
-
-
-#if (defined(UARTE_IN_USE) && defined(UART_IN_USE))
-    // UARTE and UART combined
-    #define CODE_FOR_UARTE(code) if (m_cb.use_easy_dma) { code }
-    #define CODE_FOR_UART(code)   else { code }
-#elif (defined(UARTE_IN_USE) && !defined(UART_IN_USE))
-    // UARTE only
-    #define CODE_FOR_UARTE(code) { code }
-    #define CODE_FOR_UART(code)
-#elif (!defined(UARTE_IN_USE) && defined(UART_IN_USE))
-    // UART only
-    #define CODE_FOR_UARTE(code)
-    #define CODE_FOR_UART(code) { code }
-#else
-    #error "Wrong configuration."
-#endif
-
-#ifndef IS_EASY_DMA_RAM_ADDRESS
-    #define IS_EASY_DMA_RAM_ADDRESS(addr) (((uint32_t)addr & 0xFFFF0000) == 0x20000000)
-#endif
-
-#define TX_COUNTER_ABORT_REQ_VALUE 256
-
-typedef struct
-{
-    void                   * p_context;
-    nrf_uart_event_handler_t handler;
-    uint8_t          const * p_tx_buffer;
-    uint8_t                * p_rx_buffer;
-    uint8_t                * p_rx_secondary_buffer;
-    volatile uint16_t        tx_counter;
-    uint8_t                  tx_buffer_length;
-    uint8_t                  rx_buffer_length;
-    uint8_t                  rx_secondary_buffer_length;
-    volatile uint8_t         rx_counter;
-    bool                     rx_enabled;
-    nrf_drv_state_t          state;
-#if (defined(UARTE_IN_USE) && defined(UART_IN_USE))
-    bool                     use_easy_dma;
-#endif
-} uart_control_block_t;
-
-static uart_control_block_t m_cb;
-static const nrf_drv_uart_config_t m_default_config = NRF_DRV_UART_DEFAULT_CONFIG;
-
-__STATIC_INLINE void apply_config(nrf_drv_uart_config_t const * p_config)
-{
-    nrf_gpio_pin_set(p_config->pseltxd);
-    nrf_gpio_cfg_output(p_config->pseltxd);
-    nrf_gpio_cfg_input(p_config->pselrxd, NRF_GPIO_PIN_NOPULL);
-
-    CODE_FOR_UARTE
-    (
-        nrf_uarte_baudrate_set(NRF_UARTE0, (nrf_uarte_baudrate_t)p_config->baudrate);
-        nrf_uarte_configure(NRF_UARTE0, (nrf_uarte_parity_t)p_config->parity,
-                            (nrf_uarte_hwfc_t)p_config->hwfc);
-        nrf_uarte_txrx_pins_set(NRF_UARTE0, p_config->pseltxd, p_config->pselrxd);
-        if (p_config->hwfc == NRF_UART_HWFC_ENABLED)
-        {
-            nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL);
-            nrf_gpio_pin_set(p_config->pselrts);
-            nrf_gpio_cfg_output(p_config->pselrts);
-            nrf_uarte_hwfc_pins_set(NRF_UARTE0, p_config->pselrts, p_config->pselcts);
-        }
-    )
-    CODE_FOR_UART
-    (
-        nrf_uart_baudrate_set(NRF_UART0, p_config->baudrate);
-        nrf_uart_configure(NRF_UART0, p_config->parity, p_config->hwfc);
-        nrf_uart_txrx_pins_set(NRF_UART0, p_config->pseltxd, p_config->pselrxd);
-        if (p_config->hwfc == NRF_UART_HWFC_ENABLED)
-        {
-            nrf_gpio_cfg_input(p_config->pselcts, NRF_GPIO_PIN_NOPULL);
-            nrf_gpio_pin_set(p_config->pselrts);
-            nrf_gpio_cfg_output(p_config->pselrts);
-            nrf_uart_hwfc_pins_set(NRF_UART0, p_config->pselrts, p_config->pselcts);
-        }
-    )
-}
-
-__STATIC_INLINE void interrupts_enable(uint8_t interrupt_priority)
-{
-    CODE_FOR_UARTE
-    (
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX);
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX);
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR);
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO);
-        nrf_uarte_int_enable(NRF_UARTE0, NRF_UARTE_INT_ENDRX_MASK |
-                                         NRF_UARTE_INT_ENDTX_MASK |
-                                         NRF_UARTE_INT_ERROR_MASK |
-                                         NRF_UARTE_INT_RXTO_MASK);
-    )
-    CODE_FOR_UART
-    (
-        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY);
-        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXTO);
-        nrf_uart_int_enable(NRF_UART0, NRF_UART_INT_MASK_TXDRDY |
-                                       NRF_UART_INT_MASK_RXTO);
-    )
-    nrf_drv_common_irq_enable(UART0_IRQn, interrupt_priority);
-}
-
-__STATIC_INLINE void interrupts_disable(void)
-{
-    CODE_FOR_UARTE
-    (
-        nrf_uarte_int_disable(NRF_UARTE0, NRF_UARTE_INT_ENDRX_MASK |
-                                          NRF_UARTE_INT_ENDTX_MASK |
-                                          NRF_UARTE_INT_ERROR_MASK |
-                                          NRF_UARTE_INT_RXTO_MASK);
-    )
-    CODE_FOR_UART
-    (
-        nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY |
-                                        NRF_UART_INT_MASK_TXDRDY |
-                                        NRF_UART_INT_MASK_ERROR  |
-                                        NRF_UART_INT_MASK_RXTO);
-    )
-    nrf_drv_common_irq_disable(UART0_IRQn);
-}
-
-__STATIC_INLINE void pins_to_default(void)
-{
-    /* Reset pins to default states */
-    uint32_t txd;
-    uint32_t rxd;
-    uint32_t rts;
-    uint32_t cts;
-
-    CODE_FOR_UARTE
-    (
-        txd = nrf_uarte_tx_pin_get(NRF_UARTE0);
-        rxd = nrf_uarte_rx_pin_get(NRF_UARTE0);
-        rts = nrf_uarte_rts_pin_get(NRF_UARTE0);
-        cts = nrf_uarte_cts_pin_get(NRF_UARTE0);
-        nrf_uarte_txrx_pins_disconnect(NRF_UARTE0);
-        nrf_uarte_hwfc_pins_disconnect(NRF_UARTE0);
-    )
-    CODE_FOR_UART
-    (
-        txd = nrf_uart_tx_pin_get(NRF_UART0);
-        rxd = nrf_uart_rx_pin_get(NRF_UART0);
-        rts = nrf_uart_rts_pin_get(NRF_UART0);
-        cts = nrf_uart_cts_pin_get(NRF_UART0);
-        nrf_uart_txrx_pins_disconnect(NRF_UART0);
-        nrf_uart_hwfc_pins_disconnect(NRF_UART0);
-    )
-
-    nrf_gpio_cfg_default(txd);
-    nrf_gpio_cfg_default(rxd);
-
-    if (cts != NRF_UART_PSEL_DISCONNECTED)
-    {
-        nrf_gpio_cfg_default(cts);
-    }
-
-    if (rts != NRF_UART_PSEL_DISCONNECTED)
-    {
-        nrf_gpio_cfg_default(rts);
-    }
-
-}
-
-__STATIC_INLINE void uart_enable(void)
-{
-    CODE_FOR_UARTE(nrf_uarte_enable(NRF_UARTE0);)
-    CODE_FOR_UART(nrf_uart_enable(NRF_UART0););
-}
-
-__STATIC_INLINE void uart_disable(void)
-{
-    CODE_FOR_UARTE(nrf_uarte_disable(NRF_UARTE0);)
-    CODE_FOR_UART(nrf_uart_disable(NRF_UART0););
-}
-
-ret_code_t nrf_drv_uart_init(nrf_drv_uart_config_t const * p_config,
-                             nrf_uart_event_handler_t      event_handler)
-{
-    if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config;
-    }
-#if (defined(UARTE_IN_USE) && defined(UART_IN_USE))
-    m_cb.use_easy_dma = p_config->use_easy_dma;
-#endif
-    apply_config(p_config);
-
-    m_cb.handler = event_handler;
-    m_cb.p_context = p_config->p_context;
-
-    if (m_cb.handler)
-    {
-        interrupts_enable(p_config->interrupt_priority);
-    }
-
-    uart_enable();
-    m_cb.rx_buffer_length = 0;
-    m_cb.rx_secondary_buffer_length = 0;
-    m_cb.tx_buffer_length = 0;
-    m_cb.state = NRF_DRV_STATE_INITIALIZED;
-    m_cb.rx_enabled = false;
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_uart_uninit(void)
-{
-    uart_disable();
-
-    if (m_cb.handler)
-    {
-        interrupts_disable();
-    }
-
-    pins_to_default();
-
-    m_cb.state = NRF_DRV_STATE_UNINITIALIZED;
-    m_cb.handler = NULL;
-}
-
-#if defined(UART_IN_USE)
-__STATIC_INLINE void tx_byte(void)
-{
-    nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY);
-    uint8_t txd = m_cb.p_tx_buffer[m_cb.tx_counter];
-    m_cb.tx_counter++;
-    nrf_uart_txd_set(NRF_UART0, txd);
-}
-
-__STATIC_INLINE ret_code_t nrf_drv_uart_tx_for_uart()
-{
-    ret_code_t err_code = NRF_SUCCESS;
-    
-    nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY);
-    nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTTX);
-
-    tx_byte();
-
-    if (m_cb.handler == NULL)
-    {
-        while (m_cb.tx_counter < (uint16_t) m_cb.tx_buffer_length)
-        {
-            while (!nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY) &&
-                    m_cb.tx_counter != TX_COUNTER_ABORT_REQ_VALUE)
-            {
-            }
-            if (m_cb.tx_counter != TX_COUNTER_ABORT_REQ_VALUE)
-            {
-                tx_byte();
-            }
-        }
-
-        if (m_cb.tx_counter == TX_COUNTER_ABORT_REQ_VALUE)
-        {
-            err_code = NRF_ERROR_FORBIDDEN;
-        }
-        else
-        {
-            while (!nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY))
-            {
-            }
-            nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPTX);
-        }
-        m_cb.tx_buffer_length = 0;
-    }
-    
-    return err_code;
-}
-#endif
-
-#if defined(UARTE_IN_USE)
-__STATIC_INLINE ret_code_t nrf_drv_uart_tx_for_uarte()
-{    
-    ret_code_t err_code = NRF_SUCCESS;
-    
-    nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX);
-    nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED);
-    nrf_uarte_tx_buffer_set(NRF_UARTE0, m_cb.p_tx_buffer, m_cb.tx_buffer_length);
-    nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STARTTX);
-
-    if (m_cb.handler == NULL)
-    {
-        bool endtx;
-        bool txstopped;
-        do
-        {
-            endtx     = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX);
-            txstopped = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED);
-        }
-        while ((!endtx) && (!txstopped));
-
-        if (txstopped)
-        {
-            err_code = NRF_ERROR_FORBIDDEN;
-        }
-        m_cb.tx_buffer_length = 0;
-    }
-    
-    return err_code;
-}
-#endif
-
-ret_code_t nrf_drv_uart_tx(uint8_t const * const p_data, uint8_t length)
-{
-    ASSERT(m_cb.state == NRF_DRV_STATE_INITIALIZED);
-    ASSERT(length>0);
-    ASSERT(p_data);
-
-    CODE_FOR_UARTE
-    (
-        // EasyDMA requires that transfer buffers are placed in DataRAM,
-        // signal error if the are not.
-        if (!IS_EASY_DMA_RAM_ADDRESS(p_data))
-        {
-            return NRF_ERROR_INVALID_ADDR;
-        }
-    )
-
-    if (nrf_drv_uart_tx_in_progress())
-    {
-        return NRF_ERROR_BUSY;
-    }
-    m_cb.tx_buffer_length = length;
-    m_cb.p_tx_buffer      = p_data;
-    m_cb.tx_counter       = 0;
-
-    CODE_FOR_UARTE
-    (
-        return nrf_drv_uart_tx_for_uarte();
-    )
-    CODE_FOR_UART
-    (
-        return nrf_drv_uart_tx_for_uart();
-    )
-}
-
-bool nrf_drv_uart_tx_in_progress(void)
-{
-    return (m_cb.tx_buffer_length != 0);
-}
-
-#if defined(UART_IN_USE)
-__STATIC_INLINE void rx_enable(void)
-{
-    nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR);
-    nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY);
-    nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTRX);
-}
-
-__STATIC_INLINE void rx_byte(void)
-{
-    if (!m_cb.rx_buffer_length)
-    {
-        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY);
-        // Byte received when buffer is not set - data lost.
-        (void) nrf_uart_rxd_get(NRF_UART0);
-        return;
-    }
-    nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXDRDY);
-    m_cb.p_rx_buffer[m_cb.rx_counter] = nrf_uart_rxd_get(NRF_UART0);
-    m_cb.rx_counter++;
-}
-
-__STATIC_INLINE ret_code_t nrf_drv_uart_rx_for_uart(uint8_t * p_data, uint8_t length, bool second_buffer)
-{
-    if ((!m_cb.rx_enabled) && (!second_buffer))
-    {
-        rx_enable();
-    }
-    if (m_cb.handler == NULL)
-    {
-        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXTO);
-        
-        bool rxrdy;
-        bool rxto;
-        bool error;
-        do
-        {
-            do
-            {
-                error = nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_ERROR);
-                rxrdy = nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXDRDY);
-                rxto  = nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXTO);
-            } while ((!rxrdy) && (!rxto) && (!error));
-
-            if (error || rxto)
-            {
-                break;
-            }
-            rx_byte();
-        } while (m_cb.rx_buffer_length > m_cb.rx_counter);
-
-        m_cb.rx_buffer_length = 0;
-        if (error)
-        {
-            return NRF_ERROR_INTERNAL;
-        }
-
-        if (rxto)
-        {
-            return NRF_ERROR_FORBIDDEN;
-        }
-
-        if (m_cb.rx_enabled)
-        {
-            nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTRX);
-        }
-        else
-        {
-            // Skip stopping RX if driver is forced to be enabled.
-            nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX);
-        }
-    }
-    else
-    {
-        nrf_uart_int_enable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR);
-    }
-    return NRF_SUCCESS;
-}
-#endif
-
-#if defined(UARTE_IN_USE)
-__STATIC_INLINE ret_code_t nrf_drv_uart_rx_for_uarte(uint8_t * p_data, uint8_t length, bool second_buffer)
-{
-    nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX);
-    nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO);
-    nrf_uarte_rx_buffer_set(NRF_UARTE0, p_data, length);
-    if (!second_buffer)
-    {
-        nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STARTRX);
-    }
-    else
-    {
-        nrf_uarte_shorts_enable(NRF_UARTE0, NRF_UARTE_SHORT_ENDRX_STARTRX);
-    }
-
-    if (m_cb.handler == NULL)
-    {
-        bool endrx;
-        bool rxto;
-        bool error;
-        do {
-            endrx  = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX);
-            rxto   = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_RXTO);
-            error  = nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ERROR);
-        }while ((!endrx) && (!rxto) && (!error));
-
-        m_cb.rx_buffer_length = 0;
-
-        if (error)
-        {
-            return NRF_ERROR_INTERNAL;
-        }
-
-        if (rxto)
-        {
-            return NRF_ERROR_FORBIDDEN;
-        }
-    }
-    else
-    {
-        nrf_uarte_int_enable(NRF_UARTE0, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK);
-    }
-    return NRF_SUCCESS;
-}
-#endif
-
-ret_code_t nrf_drv_uart_rx(uint8_t * p_data, uint8_t length)
-{
-    ASSERT(m_cb.state == NRF_DRV_STATE_INITIALIZED);
-    ASSERT(length>0);
-
-    CODE_FOR_UARTE
-    (
-        // EasyDMA requires that transfer buffers are placed in DataRAM,
-        // signal error if the are not.
-        if (!IS_EASY_DMA_RAM_ADDRESS(p_data))
-        {
-            return NRF_ERROR_INVALID_ADDR;
-        }
-    )
-
-    bool second_buffer = false;
-
-    if (m_cb.handler)
-    {
-        CODE_FOR_UARTE
-        (
-            nrf_uarte_int_disable(NRF_UARTE0, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK);
-        )
-        CODE_FOR_UART
-        (
-            nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR);
-        )
-    }
-    if (m_cb.rx_buffer_length != 0)
-    {
-        if (m_cb.rx_secondary_buffer_length != 0)
-        {
-            if (m_cb.handler)
-            {
-                CODE_FOR_UARTE
-                (
-                    nrf_uarte_int_enable(NRF_UARTE0, NRF_UARTE_INT_ERROR_MASK | NRF_UARTE_INT_ENDRX_MASK);
-                )
-                CODE_FOR_UART
-                (
-                    nrf_uart_int_enable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR);
-                )
-            }
-            return NRF_ERROR_BUSY;
-        }
-        second_buffer = true;
-    }
-
-    if (!second_buffer)
-    {
-        m_cb.rx_buffer_length = length;
-        m_cb.p_rx_buffer      = p_data;
-        m_cb.rx_counter       = 0;
-        m_cb.rx_secondary_buffer_length = 0;
-    }
-    else
-    {
-        m_cb.p_rx_secondary_buffer = p_data;
-        m_cb.rx_secondary_buffer_length = length;
-    }
-
-    CODE_FOR_UARTE
-    (
-        return nrf_drv_uart_rx_for_uarte(p_data, length, second_buffer);
-    )
-    CODE_FOR_UART
-    (
-        return nrf_drv_uart_rx_for_uart(p_data, length, second_buffer);
-    )
-}
-
-void nrf_drv_uart_rx_enable(void)
-{
-    //Easy dma mode does not support enabling receiver without setting up buffer.
-    CODE_FOR_UARTE
-    (
-        ASSERT(false);
-    )
-    CODE_FOR_UART
-    (
-        if (!m_cb.rx_enabled)
-        {
-            rx_enable();
-            m_cb.rx_enabled = true;
-        }
-    )
-}
-
-void nrf_drv_uart_rx_disable(void)
-{
-    //Easy dma mode does not support enabling receiver without setting up buffer.
-    CODE_FOR_UARTE
-    (
-        ASSERT(false);
-    )
-    CODE_FOR_UART
-    (
-        nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX);
-        m_cb.rx_enabled = false;
-    )
-}
-
-uint32_t nrf_drv_uart_errorsrc_get(void)
-{
-    uint32_t errsrc;
-    CODE_FOR_UARTE
-    (
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR);
-        errsrc = nrf_uarte_errorsrc_get_and_clear(NRF_UARTE0);
-    )
-    CODE_FOR_UART
-    (
-        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR);
-        errsrc = nrf_uart_errorsrc_get_and_clear(NRF_UART0);
-    )
-    return errsrc;
-}
-
-__STATIC_INLINE void rx_done_event(uint8_t bytes, uint8_t * p_data)
-{
-    nrf_drv_uart_event_t event;
-
-    event.type             = NRF_DRV_UART_EVT_RX_DONE;
-    event.data.rxtx.bytes  = bytes;
-    event.data.rxtx.p_data = p_data;
-
-    m_cb.handler(&event,m_cb.p_context);
-}
-
-__STATIC_INLINE void tx_done_event(uint8_t bytes)
-{
-    nrf_drv_uart_event_t event;
-
-    event.type             = NRF_DRV_UART_EVT_TX_DONE;
-    event.data.rxtx.bytes  = bytes;
-    event.data.rxtx.p_data = (uint8_t *)m_cb.p_tx_buffer;
-
-    m_cb.tx_buffer_length = 0;
-
-    m_cb.handler(&event,m_cb.p_context);
-}
-
-void nrf_drv_uart_tx_abort(void)
-{
-    CODE_FOR_UARTE
-    (
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED);
-        nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STOPTX);
-        if (m_cb.handler == NULL)
-        {
-            while(!nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_TXSTOPPED));
-        }
-    )
-    CODE_FOR_UART
-    (
-        nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPTX);
-        if (m_cb.handler)
-        {
-            tx_done_event(m_cb.tx_counter);
-        }
-        else
-        {
-            m_cb.tx_counter       = TX_COUNTER_ABORT_REQ_VALUE;
-        }
-    )
-}
-
-void nrf_drv_uart_rx_abort(void)
-{
-    CODE_FOR_UARTE
-    (
-        nrf_uarte_task_trigger(NRF_UARTE0, NRF_UARTE_TASK_STOPRX);
-    )
-    CODE_FOR_UART
-    (
-        nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR);
-        nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX);
-    )
-}
-
-
-#if defined(UART_IN_USE)
-__STATIC_INLINE void uart_irq_handler()
-{
-    if (nrf_uart_int_enable_check(NRF_UART0, NRF_UART_INT_MASK_ERROR) &&
-        nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_ERROR))
-    {
-        nrf_drv_uart_event_t event;
-        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_ERROR);
-        nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR);
-        if (!m_cb.rx_enabled)
-        {
-            nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX);
-        }
-        event.type                   = NRF_DRV_UART_EVT_ERROR;
-        event.data.error.error_mask  = nrf_uart_errorsrc_get_and_clear(NRF_UART0);
-        event.data.error.rxtx.bytes  = m_cb.rx_buffer_length;
-        event.data.error.rxtx.p_data = m_cb.p_rx_buffer;
-
-        //abort transfer
-        m_cb.rx_buffer_length = 0;
-        m_cb.rx_secondary_buffer_length = 0;
-
-        m_cb.handler(&event,m_cb.p_context);
-    }
-    else if (nrf_uart_int_enable_check(NRF_UART0, NRF_UART_INT_MASK_RXDRDY) &&
-             nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXDRDY))
-    {
-        rx_byte();
-        if (m_cb.rx_buffer_length == m_cb.rx_counter)
-        {
-            if (m_cb.rx_secondary_buffer_length)
-            {
-                uint8_t * p_data     = m_cb.p_rx_buffer;
-                uint8_t   rx_counter = m_cb.rx_counter;
-                
-                //Switch to secondary buffer.
-                m_cb.rx_buffer_length = m_cb.rx_secondary_buffer_length;
-                m_cb.p_rx_buffer = m_cb.p_rx_secondary_buffer;
-                m_cb.rx_secondary_buffer_length = 0;
-                m_cb.rx_counter = 0;
-                rx_done_event(rx_counter, p_data);
-            }
-            else
-            {
-                if (!m_cb.rx_enabled)
-                {
-                    nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STOPRX);
-                }
-                nrf_uart_int_disable(NRF_UART0, NRF_UART_INT_MASK_RXDRDY | NRF_UART_INT_MASK_ERROR);
-                m_cb.rx_buffer_length = 0;
-                rx_done_event(m_cb.rx_counter, m_cb.p_rx_buffer);
-            }
-        }
-    }
-
-    if (nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY))
-    {
-        if (m_cb.tx_counter < (uint16_t) m_cb.tx_buffer_length)
-        {
-            tx_byte();
-        }
-        else
-        {
-            nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_TXDRDY);
-            if (m_cb.tx_buffer_length)
-            {
-                tx_done_event(m_cb.tx_buffer_length);
-            }
-        }
-    }
-
-    if (nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_RXTO))
-    {
-        nrf_uart_event_clear(NRF_UART0, NRF_UART_EVENT_RXTO);
-
-        // RXTO event may be triggered as a result of abort call. In th
-        if (m_cb.rx_enabled)
-        {
-            nrf_uart_task_trigger(NRF_UART0, NRF_UART_TASK_STARTRX);
-        }
-        if (m_cb.rx_buffer_length)
-        {
-            m_cb.rx_buffer_length = 0;
-            rx_done_event(m_cb.rx_counter, m_cb.p_rx_buffer);
-        }
-    }
-}
-#endif
-
-#if defined(UARTE_IN_USE)
-__STATIC_INLINE void uarte_irq_handler()
-{
-    if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ERROR))
-    {
-        nrf_drv_uart_event_t event;
-
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ERROR);
-
-        event.type                   = NRF_DRV_UART_EVT_ERROR;
-        event.data.error.error_mask  = nrf_uarte_errorsrc_get_and_clear(NRF_UARTE0);
-        event.data.error.rxtx.bytes  = nrf_uarte_rx_amount_get(NRF_UARTE0);
-        event.data.error.rxtx.p_data = m_cb.p_rx_buffer;
-
-        //abort transfer
-        m_cb.rx_buffer_length = 0;
-        m_cb.rx_secondary_buffer_length = 0;
-
-        m_cb.handler(&event,m_cb.p_context);
-    }
-    else if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX))
-    {
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDRX);
-        uint8_t amount = nrf_uarte_rx_amount_get(NRF_UARTE0);
-        // If the transfer was stopped before completion, amount of transfered bytes
-        // will not be equal to the buffer length. Interrupted trunsfer is ignored.
-        if (amount == m_cb.rx_buffer_length)
-        {
-            if (m_cb.rx_secondary_buffer_length)
-            {
-                uint8_t * p_data = m_cb.p_rx_buffer;
-                nrf_uarte_shorts_disable(NRF_UARTE0, NRF_UARTE_SHORT_ENDRX_STARTRX);
-                m_cb.rx_buffer_length = m_cb.rx_secondary_buffer_length;
-                m_cb.p_rx_buffer = m_cb.p_rx_secondary_buffer;
-                m_cb.rx_secondary_buffer_length = 0;
-                rx_done_event(amount, p_data);
-            }
-            else
-            {
-                m_cb.rx_buffer_length = 0;
-                rx_done_event(amount, m_cb.p_rx_buffer);
-            }
-        }
-    }
-
-    if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_RXTO))
-    {
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_RXTO);
-        if (m_cb.rx_buffer_length)
-        {
-            m_cb.rx_buffer_length = 0;
-            rx_done_event(nrf_uarte_rx_amount_get(NRF_UARTE0), m_cb.p_rx_buffer);
-        }
-    }
-
-    if (nrf_uarte_event_check(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX))
-    {
-        nrf_uarte_event_clear(NRF_UARTE0, NRF_UARTE_EVENT_ENDTX);
-        if (m_cb.tx_buffer_length)
-        {
-            tx_done_event(nrf_uarte_tx_amount_get(NRF_UARTE0));
-        }
-    }
-}
-#endif
-
-void UART0_IRQHandler(void)
-{
-    CODE_FOR_UARTE
-    (
-        uarte_irq_handler();
-    )
-    CODE_FOR_UART
-    (
-        uart_irq_handler();
-    )
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.h
deleted file mode 100644
index 0aec80f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/uart/nrf_drv_uart.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-/**@file
- * @addtogroup nrf_uart UART driver and HAL
- * @ingroup nrf_drivers
- * @brief UART API.
- * @details The UART driver provides APIs for utilizing the UART peripheral.
- *
- * @defgroup nrf_drv_uart UART driver
- * @{
- * @ingroup  nrf_uart
- *
- * @brief    UART driver.
- */
-
-#ifndef NRF_DRV_UART_H
-#define NRF_DRV_UART_H
-
-#include "nrf_uart.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef NRF52
-#include "nrf_uarte.h"
-#endif
-
-#include "sdk_errors.h"
-#include "nrf_drv_config.h"
-
-/**
- * @brief Types of UART driver events.
- */
-typedef enum
-{
-    NRF_DRV_UART_EVT_TX_DONE, ///< Requested TX transfer completed.
-    NRF_DRV_UART_EVT_RX_DONE, ///< Requested RX transfer completed.
-    NRF_DRV_UART_EVT_ERROR,   ///< Error reported by UART peripheral.
-} nrf_drv_uart_evt_type_t;
-
-/**@brief Structure for UART configuration. */
-typedef struct
-{
-    uint32_t            pseltxd;            ///< TXD pin number.
-    uint32_t            pselrxd;            ///< RXD pin number.
-    uint32_t            pselcts;            ///< CTS pin number.
-    uint32_t            pselrts;            ///< RTS pin number.
-    void *              p_context;          ///< Context passed to interrupt handler.
-    nrf_uart_hwfc_t     hwfc;               ///< Flow control configuration.
-    nrf_uart_parity_t   parity;             ///< Parity configuration.
-    nrf_uart_baudrate_t baudrate;           ///< Baudrate.
-    uint8_t             interrupt_priority; ///< Interrupt priority.
-#ifdef NRF52
-    bool                use_easy_dma;
-#endif
-} nrf_drv_uart_config_t;
-
-/**@brief UART default configuration. */
-#ifdef NRF52
-#if !UART_LEGACY_SUPPORT
-#define DEFAULT_CONFIG_USE_EASY_DMA true
-#elif !UART_EASY_DMA_SUPPORT
-#define DEFAULT_CONFIG_USE_EASY_DMA false
-#else
-#define DEFAULT_CONFIG_USE_EASY_DMA UART0_CONFIG_USE_EASY_DMA
-#endif
-#define NRF_DRV_UART_DEFAULT_CONFIG                                                   \
-    {                                                                                 \
-        .pseltxd            = UART0_CONFIG_PSEL_TXD,                                  \
-        .pselrxd            = UART0_CONFIG_PSEL_RXD,                                  \
-        .pselcts            = UART0_CONFIG_PSEL_CTS,                                  \
-        .pselrts            = UART0_CONFIG_PSEL_RTS,                                  \
-        .p_context          = NULL,                                                   \
-        .hwfc               = UART0_CONFIG_HWFC,                                      \
-        .parity             = UART0_CONFIG_PARITY,                                    \
-        .baudrate           = UART0_CONFIG_BAUDRATE,                                  \
-        .interrupt_priority = UART0_CONFIG_IRQ_PRIORITY,                              \
-        .use_easy_dma       = DEFAULT_CONFIG_USE_EASY_DMA                             \
-    }
-#else
-#define NRF_DRV_UART_DEFAULT_CONFIG                                                   \
-    {                                                                                 \
-        .pseltxd            = UART0_CONFIG_PSEL_TXD,                                  \
-        .pselrxd            = UART0_CONFIG_PSEL_RXD,                                  \
-        .pselcts            = UART0_CONFIG_PSEL_CTS,                                  \
-        .pselrts            = UART0_CONFIG_PSEL_RTS,                                  \
-        .p_context          = NULL,                                                   \
-        .hwfc               = UART0_CONFIG_HWFC,                                      \
-        .parity             = UART0_CONFIG_PARITY,                                    \
-        .baudrate           = UART0_CONFIG_BAUDRATE,                                  \
-        .interrupt_priority = UART0_CONFIG_IRQ_PRIORITY                               \
-    }
-#endif
-
-/**@brief Structure for UART transfer completion event. */
-typedef struct
-{
-    uint8_t * p_data; ///< Pointer to memory used for transfer.
-    uint8_t   bytes;  ///< Number of bytes transfered.
-} nrf_drv_uart_xfer_evt_t;
-
-/**@brief Structure for UART error event. */
-typedef struct
-{
-    nrf_drv_uart_xfer_evt_t rxtx;      ///< Transfer details includes number of bytes transfered.
-    uint32_t                error_mask;///< Mask of error flags that generated the event.
-} nrf_drv_uart_error_evt_t;
-
-/**@brief Structure for UART event. */
-typedef struct
-{
-    nrf_drv_uart_evt_type_t type;      ///< Event type.
-    union
-    {
-        nrf_drv_uart_xfer_evt_t  rxtx; ///< Data provided for transfer completion events.
-        nrf_drv_uart_error_evt_t error;///< Data provided for error event.
-    } data;
-} nrf_drv_uart_event_t;
-
-/**
- * @brief UART interrupt event handler.
- *
- * @param[in] p_event     Pointer to event structure. Event is allocated on the stack so it is available
- *                        only within the context of the event handler.
- * @param[in] p_context   Context passed to interrupt handler, set on initialization.
- */
-typedef void (*nrf_uart_event_handler_t)(nrf_drv_uart_event_t * p_event, void * p_context);
-
-/**
- * @brief Function for initializing the UART driver.
- *
- * This function configures and enables UART. After this function GPIO pins are controlled by UART.
- *
- * @param[in] p_config       Initial configuration. Default configuration used if NULL.
- * @param[in] event_handler  Event handler provided by the user. If not provided driver works in
- *                           blocking mode.
- *
- * @retval    NRF_SUCCESS             If initialization was successful.
- * @retval    NRF_ERROR_INVALID_STATE If driver is already initialized.
- */
-ret_code_t nrf_drv_uart_init(nrf_drv_uart_config_t const * p_config,
-                             nrf_uart_event_handler_t      event_handler);
-
-/**
- * @brief Function for uninitializing  the UART driver.
- */
-void nrf_drv_uart_uninit(void);
-
-/**
- * @brief Function for getting the address of a specific UART task.
- *
- * @param[in] task Task.
- *
- * @return    Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_uart_task_t task);
-
-/**
- * @brief Function for getting the address of a specific UART event.
- *
- * @param[in] event Event.
- *
- * @return    Event address.
- */
-__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_uart_event_t event);
-
-/**
- * @brief Function for sending data over UART.
- *
- * If an event handler was provided in nrf_drv_uart_init() call, this function
- * returns immediately and the handler is called when the transfer is done.
- * Otherwise, the transfer is performed in blocking mode, i.e. this function
- * returns when the transfer is finished. Blocking mode is not using interrupt so
- * there is no context switching inside the function.
- *
- * @note Peripherals using EasyDMA (i.e. UARTE) require that the transfer buffers
- *       are placed in the Data RAM region. If they are not and UARTE instance is
- *       used, this function will fail with error code NRF_ERROR_INVALID_ADDR.
- *
- * @param[in] p_data Pointer to data.
- * @param[in] length Number of bytes to send.
- *
- * @retval    NRF_SUCCESS            If initialization was successful.
- * @retval    NRF_ERROR_BUSY         If driver is already transferring.
- * @retval    NRF_ERROR_FORBIDDEN    If the transfer was aborted from a different context
- *                                   (blocking mode only, also see @ref nrf_drv_uart_rx_disable).
- * @retval    NRF_ERROR_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only).
- */
-ret_code_t nrf_drv_uart_tx(uint8_t const * const p_data, uint8_t length);
-
-/**
- * @brief Function for checking if UART is currently transmitting.
- *
- * @retval true  If UART is transmitting.
- * @retval false If UART is not transmitting.
- */
-bool nrf_drv_uart_tx_in_progress(void);
-
-/**
- * @brief Function for aborting any ongoing transmission.
- * @note @ref NRF_DRV_UART_EVT_TX_DONE event will be generated in non-blocking mode. Event will
- *       contain number of bytes sent until abort was called. If Easy DMA is not used event will be
- *       called from the function context. If Easy DMA is used it will be called from UART interrupt
- *       context.
- */
-void nrf_drv_uart_tx_abort(void);
-
-/**
- * @brief Function for receiving data over UART.
- *
- * If an event handler was provided in the nrf_drv_uart_init() call, this function
- * returns immediately and the handler is called when the transfer is done.
- * Otherwise, the transfer is performed in blocking mode, i.e. this function
- * returns when the transfer is finished. Blocking mode is not using interrupt so
- * there is no context switching inside the function.
- * The receive buffer pointer is double buffered in non-blocking mode. The secondary
- * buffer can be set immediately after starting the transfer and will be filled
- * when the primary buffer is full. The double buffering feature allows 
- * receiving data continuously.
- *
- * @note Peripherals using EasyDMA (i.e. UARTE) require that the transfer buffers
- *       are placed in the Data RAM region. If they are not and UARTE instance is
- *       used, this function will fail with error code NRF_ERROR_INVALID_ADDR.
- * @param[in] p_data Pointer to data.
- * @param[in] length Number of bytes to receive.
- *
- * @retval    NRF_SUCCESS If initialization was successful.
- * @retval    NRF_ERROR_BUSY If the driver is already receiving
- *                           (and the secondary buffer has already been set
- *                           in non-blocking mode).
- * @retval    NRF_ERROR_FORBIDDEN If the transfer was aborted from a different context
- *                               (blocking mode only, also see @ref nrf_drv_uart_rx_disable).
- * @retval    NRF_ERROR_INTERNAL If UART peripheral reported an error.
- * @retval    NRF_ERROR_INVALID_ADDR If p_data does not point to RAM buffer (UARTE only).
- */
-ret_code_t nrf_drv_uart_rx(uint8_t * p_data, uint8_t length);
-
-/**
- * @brief Function for enabling receiver.
- *
- * UART has 6 byte long RX FIFO and it will be used to store incoming data. If user will not call
- * UART receive function before FIFO is filled, overrun error will encounter. Enabling receiver
- * without specifying RX buffer is supported only in UART mode (without Easy DMA). Receiver must be
- * explicitly closed by the user @sa nrf_drv_uart_rx_disable. Function asserts if mode is wrong.
- */
-void nrf_drv_uart_rx_enable(void);
-
-/**
- * @brief Function for disabling receiver.
- *
- * Function must be called to close the receiver after it has been explicitly enabled by
- * @sa nrf_drv_uart_rx_enable. Feature is supported only in UART mode (without Easy DMA). Function
- * asserts if mode is wrong.
- */
-void nrf_drv_uart_rx_disable(void);
-
-/**
- * @brief Function for aborting any ongoing reception.
- * @note @ref NRF_DRV_UART_EVT_RX_DONE event will be generated in non-blocking mode. Event will
- *       contain number of bytes received until abort was called. If Easy DMA is not used event will be
- *       called from the function context. If Easy DMA is used it will be called from UART interrupt
- *       context.
- */
-void nrf_drv_uart_rx_abort(void);
-
-/**
- * @brief Function for reading error source mask. Mask contains values from @ref nrf_uart_error_mask_t.
- * @note Function should be used in blocking mode only. In case of non-blocking mode error event is
- *       generated. Function clears error sources after reading.
- *
- * @retval    Mask of reported errors.
- */
-uint32_t nrf_drv_uart_errorsrc_get(void);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-__STATIC_INLINE uint32_t nrf_drv_uart_task_address_get(nrf_uart_task_t task)
-{
-    return nrf_uart_task_address_get(NRF_UART0, task);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_uart_event_address_get(nrf_uart_event_t event)
-{
-    return nrf_uart_event_address_get(NRF_UART0, event);
-}
-#endif //SUPPRESS_INLINE_IMPLEMENTATION
-#ifdef __cplusplus
-}
-#endif
-
-#endif //NRF_DRV_UART_H
-/** @} */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.c
deleted file mode 100644
index bfd684f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-#include "nrf_drv_wdt.h"
-#include "nrf_drv_common.h"
-#include "nrf_error.h"
-#include "nrf_assert.h"
-#include "nrf_wdt.h"
-#include "app_util_platform.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-/**@brief WDT event handler. */
-static nrf_wdt_event_handler_t m_wdt_event_handler;
-
-/**@brief WDT state. */
-static nrf_drv_state_t m_state;
-
-/**@brief WDT alloc table. */
-static uint32_t m_alloc_index;
-
-static const nrf_drv_wdt_config_t m_default_config = NRF_DRV_WDT_DEAFULT_CONFIG;
-
-/**@brief WDT interrupt handler. */
-void WDT_IRQHandler(void)
-{
-    if (nrf_wdt_int_enable_check(NRF_WDT_INT_TIMEOUT_MASK) == true)
-    {
-        nrf_wdt_event_clear(NRF_WDT_EVENT_TIMEOUT);
-        m_wdt_event_handler();
-    }
-}
-
-
-ret_code_t nrf_drv_wdt_init(nrf_drv_wdt_config_t const * p_config,
-                            nrf_wdt_event_handler_t     wdt_event_handler)
-{
-    ASSERT(wdt_event_handler != NULL);
-    m_wdt_event_handler = wdt_event_handler;
-
-    if (m_state == NRF_DRV_STATE_UNINITIALIZED)
-    {
-        m_state = NRF_DRV_STATE_INITIALIZED;
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_STATE; // WDT already initialized
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config;
-    }
-
-    nrf_wdt_behaviour_set(p_config->behaviour);
-    nrf_wdt_reload_value_set((p_config->reload_value * 32768) / 1000);
-
-    nrf_drv_common_irq_enable(WDT_IRQn, p_config->interrupt_priority);
-
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_wdt_enable(void)
-{
-    ASSERT(m_alloc_index != 0);
-    ASSERT(m_state == NRF_DRV_STATE_INITIALIZED);
-    nrf_wdt_int_enable(NRF_WDT_INT_TIMEOUT_MASK);
-    nrf_wdt_task_trigger(NRF_WDT_TASK_START);
-    m_state = NRF_DRV_STATE_POWERED_ON;
-}
-
-
-void nrf_drv_wdt_feed(void)
-{
-    ASSERT(m_state == NRF_DRV_STATE_POWERED_ON);
-    for(uint32_t i = 0; i < m_alloc_index; i++)
-    {
-        nrf_wdt_reload_request_set((nrf_wdt_rr_register_t)(NRF_WDT_RR0 + i));
-    }
-}
-
-ret_code_t nrf_drv_wdt_channel_alloc(nrf_drv_wdt_channel_id * p_channel_id)
-{
-    ret_code_t result;
-    ASSERT(p_channel_id);
-    ASSERT(m_state == NRF_DRV_STATE_INITIALIZED);
-
-    CRITICAL_REGION_ENTER();
-    if (m_alloc_index < NRF_WDT_CHANNEL_NUMBER)
-    {
-        *p_channel_id = (nrf_drv_wdt_channel_id)(NRF_WDT_RR0 + m_alloc_index);
-        m_alloc_index++;
-        nrf_wdt_reload_request_enable(*p_channel_id);
-        result = NRF_SUCCESS;
-    }
-    else
-    {
-        result = NRF_ERROR_NO_MEM;
-    }
-    CRITICAL_REGION_EXIT();
-    return result;
-}
-
-void nrf_drv_wdt_channel_feed(nrf_drv_wdt_channel_id channel_id)
-{
-    ASSERT(m_state == NRF_DRV_STATE_POWERED_ON);
-    nrf_wdt_reload_request_set(channel_id);
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.h
deleted file mode 100644
index 7d3779c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/wdt/nrf_drv_wdt.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-/**@file
- * @addtogroup nrf_wdt WDT HAL and driver
- * @ingroup nrf_drivers
- * @brief Watchdog timer (WDT) APIs.
- * @details The WDT HAL provides basic APIs for accessing the registers of the watchdog timer. 
- * The WDT driver provides APIs on a higher level.
- * @defgroup lib_driver_wdt WDT driver
- * @{
- * @ingroup  nrf_wdt
- *
- * @brief    Driver for managing the watchdog timer (WDT).
- */
-
-#ifndef NRF_DRV_WDT_H__
-#define NRF_DRV_WDT_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "sdk_errors.h"
-#include "nrf_wdt.h"
-#include "nrf_drv_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Struct for WDT initialization. */
-typedef struct
-{
-    nrf_wdt_behaviour_t    behaviour;          /**< WDT behaviour when CPU in sleep/halt mode. */
-    uint32_t               reload_value;       /**< WDT reload value in ms. */
-    uint8_t                interrupt_priority; /**< WDT interrupt priority */
-} nrf_drv_wdt_config_t;
-
-/**@brief WDT event handler function type. */
-typedef void (*nrf_wdt_event_handler_t)(void);
-
-/**@brief WDT channel id type. */
-typedef nrf_wdt_rr_register_t nrf_drv_wdt_channel_id;
-
-#define NRF_DRV_WDT_DEAFULT_CONFIG                     \
-    {                                                  \
-        .behaviour          = WDT_CONFIG_BEHAVIOUR,    \
-        .reload_value       = WDT_CONFIG_RELOAD_VALUE, \
-        .interrupt_priority = WDT_CONFIG_IRQ_PRIORITY, \
-    }
-/**
- * @brief This function initializes watchdog.
- *
- * @param[in] p_config          Initial configuration. Default configuration used if NULL.
- * @param[in] wdt_event_handler specifies event handler provided by user.
- *
- * @note Function asserts if wdt_event_handler is NULL.
- *
- * @return    NRF_SUCCESS on success, NRF_ERROR_INVALID_STATE if module ws already initialized.
- */
-ret_code_t nrf_drv_wdt_init(nrf_drv_wdt_config_t const * p_config,
-                            nrf_wdt_event_handler_t     wdt_event_handler);
-
-/**
- * @brief This function allocate watchdog channel.
- *
- * @note This function can not be called after nrf_drv_wdt_start(void).
- *
- * @param[out] p_channel_id      ID of granted channel.
- *
- * @return    NRF_SUCCESS on success, otherwise an error code.
- */
-ret_code_t nrf_drv_wdt_channel_alloc(nrf_drv_wdt_channel_id * p_channel_id);
-
-/**
- * @brief This function starts watchdog.
- *
- * @note After calling this function the watchdog is started, so the user needs to feed all allocated
- *       watchdog channels to avoid reset. At least one watchdog channel has to be allocated.
- */
-void nrf_drv_wdt_enable(void);
-
-/**
- * @brief This function feeds the watchdog.
- *
- * @details Function feeds all allocated watchdog channels.
- */
-void nrf_drv_wdt_feed(void);
-
-/**
- * @brief This function feeds the invidual watchdog channel.
- *
- * @param[in] channel_id      ID of watchdog channel.
- */
-void nrf_drv_wdt_channel_feed(nrf_drv_wdt_channel_id channel_id);
-
-/**@brief Function for returning a requested task address for the wdt driver module.
- *
- * @param[in]  task                One of the peripheral tasks.
- *
- * @retval     Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_wdt_ppi_task_addr(nrf_wdt_task_t task)
-{
-    return nrf_wdt_task_address_get(task);
-}
-
-/**@brief Function for returning a requested event address for the wdt driver module.
- *
- * @param[in]  event               One of the peripheral events.
- *
- * @retval     Event address
- */
-__STATIC_INLINE uint32_t nrf_drv_wdt_ppi_event_addr(nrf_wdt_event_t event)
-{
-    return nrf_wdt_event_address_get(event);
-}
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/** @} */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h
deleted file mode 100644
index b8ca3d4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
- 
-/** @file
- *
- * @defgroup memory_pool_internal Memory Pool Internal
- * @{
- * @ingroup memory_pool
- *
- * @brief Memory pool internal definitions
- */
- 
-#ifndef MEM_POOL_INTERNAL_H__
-#define MEM_POOL_INTERNAL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TX_BUF_SIZE       4u    /**< TX buffer size in bytes. */
-#define RX_BUF_SIZE       32u   /**< RX buffer size in bytes. */
-
-#define RX_BUF_QUEUE_SIZE 8u    /**< RX buffer element size. */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // MEM_POOL_INTERNAL_H__
- 
-/** @} */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.c
deleted file mode 100644
index 2bb696f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.c
+++ /dev/null
@@ -1,382 +0,0 @@
-/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-#include "bootloader.h"
-#include "bootloader_types.h"
-#include "bootloader_util.h"
-#include "bootloader_settings.h"
-#include "dfu.h"
-#include "dfu_transport.h"
-#include "nrf.h"
-#include "app_error.h"
-#include "nrf_sdm.h"
-#include "nrf_mbr.h"
-#include "nordic_common.h"
-#include "crc16.h"
-#include "pstorage.h"
-#include "app_scheduler.h"
-#include "nrf_delay.h"
-#include "sdk_common.h"
-
-#define IRQ_ENABLED             0x01                    /**< Field identifying if an interrupt is enabled. */
-#define MAX_NUMBER_INTERRUPTS   32                      /**< Maximum number of interrupts available. */
-
-/**@brief Enumeration for specifying current bootloader status.
- */
-typedef enum
-{
-    BOOTLOADER_UPDATING,                                /**< Bootloader status for indicating that an update is in progress. */
-    BOOTLOADER_SETTINGS_SAVING,                         /**< Bootloader status for indicating that saving of bootloader settings is in progress. */
-    BOOTLOADER_COMPLETE,                                /**< Bootloader status for indicating that all operations for the update procedure has completed and it is safe to reset the system. */
-    BOOTLOADER_TIMEOUT,                                 /**< Bootloader status field for indicating that a timeout has occured and current update process should be aborted. */
-    BOOTLOADER_RESET,                                   /**< Bootloader status field for indicating that a reset has been requested and current update process should be aborted. */
-} bootloader_status_t;
-
-static pstorage_handle_t        m_bootsettings_handle;  /**< Pstorage handle to use for registration and identifying the bootloader module on subsequent calls to the pstorage module for load and store of bootloader setting in flash. */
-static bootloader_status_t      m_update_status;        /**< Current update status for the bootloader module to ensure correct behaviour when updating settings and when update completes. */
-
-/**@brief   Function for handling callbacks from pstorage module.
- *
- * @details Handles pstorage results for clear and storage operation. For detailed description of
- *          the parameters provided with the callback, please refer to \ref pstorage_ntf_cb_t.
- */
-static void pstorage_callback_handler(pstorage_handle_t * p_handle,
-                                      uint8_t             op_code,
-                                      uint32_t            result,
-                                      uint8_t           * p_data,
-                                      uint32_t            data_len)
-{
-    // If we are in BOOTLOADER_SETTINGS_SAVING state and we receive an PSTORAGE_STORE_OP_CODE
-    // response then settings has been saved and update has completed.
-    if ((m_update_status == BOOTLOADER_SETTINGS_SAVING) && (op_code == PSTORAGE_STORE_OP_CODE))
-    {
-        m_update_status = BOOTLOADER_COMPLETE;
-    }
-
-    APP_ERROR_CHECK(result);
-}
-
-
-/**@brief   Function for waiting for events.
- *
- * @details This function will place the chip in low power mode while waiting for events from
- *          the SoftDevice or other peripherals. When interrupted by an event, it will call the
- *          @ref app_sched_execute function to process the received event. This function will return
- *          when the final state of the firmware update is reached OR when a tear down is in
- *          progress.
- */
-static void wait_for_events(void)
-{
-    for (;;)
-    {
-        // Wait in low power state for any events.
-        uint32_t err_code = sd_app_evt_wait();
-        APP_ERROR_CHECK(err_code);
-
-        // Event received. Process it from the scheduler.
-        app_sched_execute();
-
-        if ((m_update_status == BOOTLOADER_COMPLETE) ||
-            (m_update_status == BOOTLOADER_TIMEOUT)  ||
-            (m_update_status == BOOTLOADER_RESET))
-        {
-            // When update has completed or a timeout/reset occured we will return.
-            return;
-        }
-    }
-}
-
-
-bool bootloader_app_is_valid(uint32_t app_addr)
-{
-    const bootloader_settings_t * p_bootloader_settings;
-
-    // There exists an application in CODE region 1.
-    if (*((uint32_t *)app_addr) == EMPTY_FLASH_MASK)
-    {
-        return false;
-    }
-
-    bool success = false;
-
-    bootloader_util_settings_get(&p_bootloader_settings);
-
-    // The application in CODE region 1 is flagged as valid during update.
-    if (p_bootloader_settings->bank_0 == BANK_VALID_APP)
-    {
-        uint16_t image_crc = 0;
-
-        // A stored crc value of 0 indicates that CRC checking is not used.
-        if (p_bootloader_settings->bank_0_crc != 0)
-        {
-            image_crc = crc16_compute((uint8_t *)DFU_BANK_0_REGION_START,
-                                      p_bootloader_settings->bank_0_size,
-                                      NULL);
-        }
-
-        success = (image_crc == p_bootloader_settings->bank_0_crc);
-    }
-
-    return success;
-}
-
-
-static void bootloader_settings_save(bootloader_settings_t * p_settings)
-{
-    uint32_t err_code = pstorage_clear(&m_bootsettings_handle, sizeof(bootloader_settings_t));
-    APP_ERROR_CHECK(err_code);
-
-    err_code = pstorage_store(&m_bootsettings_handle,
-                              (uint8_t *)p_settings,
-                              sizeof(bootloader_settings_t),
-                              0);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-void bootloader_dfu_update_process(dfu_update_status_t update_status)
-{
-    static bootloader_settings_t  settings;
-    const bootloader_settings_t * p_bootloader_settings;
-
-    bootloader_util_settings_get(&p_bootloader_settings);
-
-    if (update_status.status_code == DFU_UPDATE_APP_COMPLETE)
-    {
-        settings.bank_0_crc  = update_status.app_crc;
-        settings.bank_0_size = update_status.app_size;
-        settings.bank_0      = BANK_VALID_APP;
-        settings.bank_1      = BANK_INVALID_APP;
-
-        m_update_status      = BOOTLOADER_SETTINGS_SAVING;
-        bootloader_settings_save(&settings);
-    }
-    else if (update_status.status_code == DFU_UPDATE_SD_COMPLETE)
-    {
-        settings.bank_0_crc     = update_status.app_crc;
-        settings.bank_0_size    = update_status.sd_size + 
-                                  update_status.bl_size + 
-                                  update_status.app_size;
-        settings.bank_0         = BANK_VALID_SD;
-        settings.bank_1         = BANK_INVALID_APP;
-        settings.sd_image_size  = update_status.sd_size;
-        settings.bl_image_size  = update_status.bl_size;
-        settings.app_image_size = update_status.app_size;
-        settings.sd_image_start = update_status.sd_image_start;
-
-        m_update_status         = BOOTLOADER_SETTINGS_SAVING;
-        bootloader_settings_save(&settings);
-    }
-    else if (update_status.status_code == DFU_UPDATE_BOOT_COMPLETE)
-    {
-        settings.bank_0         = p_bootloader_settings->bank_0;
-        settings.bank_0_crc     = p_bootloader_settings->bank_0_crc;
-        settings.bank_0_size    = p_bootloader_settings->bank_0_size;
-        settings.bank_1         = BANK_VALID_BOOT;
-        settings.sd_image_size  = update_status.sd_size;
-        settings.bl_image_size  = update_status.bl_size;
-        settings.app_image_size = update_status.app_size;
-
-        m_update_status         = BOOTLOADER_SETTINGS_SAVING;
-        bootloader_settings_save(&settings);
-    }
-    else if (update_status.status_code == DFU_UPDATE_SD_SWAPPED)
-    {
-        if (p_bootloader_settings->bank_0 == BANK_VALID_SD)
-        {
-            settings.bank_0_crc     = 0;
-            settings.bank_0_size    = 0;
-            settings.bank_0         = BANK_INVALID_APP;
-        }
-        // This handles cases where SoftDevice was not updated, hence bank0 keeps its settings.
-        else
-        {
-            settings.bank_0         = p_bootloader_settings->bank_0;
-            settings.bank_0_crc     = p_bootloader_settings->bank_0_crc;
-            settings.bank_0_size    = p_bootloader_settings->bank_0_size;
-        }
-
-        settings.bank_1         = BANK_INVALID_APP;
-        settings.sd_image_size  = 0;
-        settings.bl_image_size  = 0;
-        settings.app_image_size = 0;
-
-        m_update_status         = BOOTLOADER_SETTINGS_SAVING;
-        bootloader_settings_save(&settings);
-    }
-    else if (update_status.status_code == DFU_TIMEOUT)
-    {
-        // Timeout has occurred. Close the connection with the DFU Controller.
-        uint32_t err_code = dfu_transport_close();
-        APP_ERROR_CHECK(err_code);
-
-        m_update_status = BOOTLOADER_TIMEOUT;
-    }
-    else if (update_status.status_code == DFU_BANK_0_ERASED)
-    {
-        settings.bank_0_crc  = 0;
-        settings.bank_0_size = 0;
-        settings.bank_0      = BANK_INVALID_APP;
-        settings.bank_1      = p_bootloader_settings->bank_1;
-
-        bootloader_settings_save(&settings);
-    }
-    else if (update_status.status_code == DFU_RESET)
-    {
-        m_update_status = BOOTLOADER_RESET;
-    }
-    else
-    {
-        // No implementation needed.
-    }
-}
-
-
-uint32_t bootloader_init(void)
-{
-    uint32_t                err_code;
-    pstorage_module_param_t storage_params = {.cb = pstorage_callback_handler};
-
-    err_code = pstorage_init();
-    VERIFY_SUCCESS(err_code);
-
-    m_bootsettings_handle.block_id = BOOTLOADER_SETTINGS_ADDRESS;
-    err_code = pstorage_register(&storage_params, &m_bootsettings_handle);
-
-    return err_code;
-}
-
-
-uint32_t bootloader_dfu_start(void)
-{
-    uint32_t err_code;
-
-    // Clear swap if banked update is used.
-    err_code = dfu_init(); 
-    VERIFY_SUCCESS(err_code);
-
-    err_code = dfu_transport_update_start();
-
-    wait_for_events();
-
-    return err_code;
-}
-
-
-/**@brief Function for disabling all interrupts before jumping from bootloader to application.
- */
-static void interrupts_disable(void)
-{
-    uint32_t interrupt_setting_mask;
-    uint32_t irq = 0; // We start from first interrupt, i.e. interrupt 0.
-
-    // Fetch the current interrupt settings.
-    interrupt_setting_mask = NVIC->ISER[0];
-
-    for (; irq < MAX_NUMBER_INTERRUPTS; irq++)
-    {
-        if (interrupt_setting_mask & (IRQ_ENABLED << irq))
-        {
-            // The interrupt was enabled, and hence disable it.
-            NVIC_DisableIRQ((IRQn_Type)irq);
-        }
-    }
-}
-
-
-void bootloader_app_start(uint32_t app_addr)
-{
-    // If the applications CRC has been checked and passed, the magic number will be written and we
-    // can start the application safely.
-    uint32_t err_code = sd_softdevice_disable();
-    APP_ERROR_CHECK(err_code);
-
-    interrupts_disable();
-
-    err_code = sd_softdevice_vector_table_base_set(CODE_REGION_1_START);
-    APP_ERROR_CHECK(err_code);
-
-    bootloader_util_app_start(CODE_REGION_1_START);
-}
-
-
-bool bootloader_dfu_sd_in_progress(void)
-{
-    const bootloader_settings_t * p_bootloader_settings;
-
-    bootloader_util_settings_get(&p_bootloader_settings);
-
-    if (p_bootloader_settings->bank_0 == BANK_VALID_SD ||
-        p_bootloader_settings->bank_1 == BANK_VALID_BOOT)
-    {
-        return true;
-    }
-
-    return false;
-}
-
-
-uint32_t bootloader_dfu_sd_update_continue(void)
-{
-    uint32_t err_code;
-
-    if ((dfu_sd_image_validate() == NRF_SUCCESS) &&
-        (dfu_bl_image_validate() == NRF_SUCCESS))
-    {
-        return NRF_SUCCESS;
-    }
-
-    // Ensure that flash operations are not executed within the first 100 ms seconds to allow
-    // a debugger to be attached.
-    nrf_delay_ms(100);
-
-    err_code = dfu_sd_image_swap();
-    APP_ERROR_CHECK(err_code);
-
-    err_code = dfu_sd_image_validate();
-    APP_ERROR_CHECK(err_code);
-
-    err_code = dfu_bl_image_swap();
-    APP_ERROR_CHECK(err_code);
-
-    return err_code;
-}
-
-
-uint32_t bootloader_dfu_sd_update_finalize(void)
-{
-    dfu_update_status_t update_status = {DFU_UPDATE_SD_SWAPPED, };
-
-    bootloader_dfu_update_process(update_status);
-
-    wait_for_events();
-
-    return NRF_SUCCESS;
-}
-
-
-void bootloader_settings_get(bootloader_settings_t * const p_settings)
-{
-    const bootloader_settings_t *  p_bootloader_settings;
-
-    bootloader_util_settings_get(&p_bootloader_settings);
-
-    p_settings->bank_0         = p_bootloader_settings->bank_0;
-    p_settings->bank_0_crc     = p_bootloader_settings->bank_0_crc;
-    p_settings->bank_0_size    = p_bootloader_settings->bank_0_size;
-    p_settings->bank_1         = p_bootloader_settings->bank_1;
-    p_settings->sd_image_size  = p_bootloader_settings->sd_image_size;
-    p_settings->bl_image_size  = p_bootloader_settings->bl_image_size;
-    p_settings->app_image_size = p_bootloader_settings->app_image_size;
-    p_settings->sd_image_start = p_bootloader_settings->sd_image_start;
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.h
deleted file mode 100644
index 44ee6f0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
- 
-/**@file
- *
- * @defgroup nrf_bootloader Bootloader API.
- * @{     
- *
- * @brief Bootloader module interface.
- */
-
-#ifndef BOOTLOADER_H__
-#define BOOTLOADER_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "bootloader_types.h"
-#include <dfu_types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for initializing the Bootloader.
- * 
- * @retval     NRF_SUCCESS If bootloader was succesfully initialized. 
- */
-uint32_t bootloader_init(void);
-
-/**@brief Function for validating application region in flash.
- * 
- * @param[in]  app_addr      Address to the region in flash where the application is stored.
- * 
- * @retval     true          If Application region is valid.
- * @retval     false         If Application region is not valid.
- */
-bool bootloader_app_is_valid(uint32_t app_addr);
-
-/**@brief Function for starting the Device Firmware Update.
- * 
- * @retval     NRF_SUCCESS If new application image was successfully transferred.
- */
-uint32_t bootloader_dfu_start(void);
-
-/**@brief Function for exiting bootloader and booting into application.
- *
- * @details This function will disable SoftDevice and all interrupts before jumping to application.
- *          The SoftDevice vector table base for interrupt forwarding will be set the application
- *          address.
- *
- * @param[in]  app_addr      Address to the region where the application is stored.
- */
-void bootloader_app_start(uint32_t app_addr);
-
-/**@brief Function for retrieving the bootloader settings.
- *
- * @param[out] p_settings    A copy of the current bootloader settings is returned in the structure
- *                           provided.
- */
-void bootloader_settings_get(bootloader_settings_t * const p_settings);
-
-/**@brief Function for processing DFU status update.
- *
- * @param[in]  update_status DFU update status.
- */
-void bootloader_dfu_update_process(dfu_update_status_t update_status);
-
-/**@brief Function getting state of SoftDevice update in progress.
- *        After a successfull SoftDevice transfer the system restarts in orderto disable SoftDevice
- *        and complete the update.
- *
- * @retval     true          A SoftDevice update is in progress. This indicates that second stage 
- *                           of a SoftDevice update procedure can be initiated.
- * @retval     false         No SoftDevice update is in progress.
- */
-bool bootloader_dfu_sd_in_progress(void);
-
-/**@brief Function for continuing the Device Firmware Update of a SoftDevice.
- * 
- * @retval     NRF_SUCCESS If the final stage of SoftDevice update was successful. 
- */
-uint32_t bootloader_dfu_sd_update_continue(void);
-
-/**@brief Function for finalizing the Device Firmware Update of a SoftDevice.
- * 
- * @retval     NRF_SUCCESS If the final stage of SoftDevice update was successful. 
- */
-uint32_t bootloader_dfu_sd_update_finalize(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BOOTLOADER_H__
-
-/**@} */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.c
deleted file mode 100644
index bdb20ce..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
-#include "bootloader_settings.h"
-#include <stdint.h>
-#include <dfu_types.h>
-
-#if defined ( __CC_ARM )
-
-uint8_t  m_boot_settings[CODE_PAGE_SIZE]    __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used));                 /**< This variable reserves a codepage for bootloader specific settings, to ensure the compiler doesn't locate any code or variables at his location. */
-uint32_t m_uicr_bootloader_start_address    __attribute__((at(NRF_UICR_BOOT_START_ADDRESS))) = BOOTLOADER_REGION_START;             /**< This variable makes the linker script write the bootloader start address to the UICR register. This value will be written in the HEX file and thus written to UICR when the bootloader is flashed into the chip. */
-
-#elif defined ( __GNUC__ )
-
-uint8_t m_boot_settings[CODE_PAGE_SIZE] __attribute__ ((section(".bootloaderSettings")));                                           /**< This variable reserves a codepage for bootloader specific settings, to ensure the compiler doesn't locate any code or variables at his location. */
-volatile uint32_t m_uicr_bootloader_start_address  __attribute__ ((section(".uicrBootStartAddress"))) = BOOTLOADER_REGION_START;    /**< This variable ensures that the linker script will write the bootloader start address to the UICR register. This value will be written in the HEX file and thus written to UICR when the bootloader is flashed into the chip. */
-
-#elif defined ( __ICCARM__ )
-
-__no_init uint8_t m_boot_settings[CODE_PAGE_SIZE] @ BOOTLOADER_SETTINGS_ADDRESS;                                                    /**< This variable reserves a codepage for bootloader specific settings, to ensure the compiler doesn't locate any code or variables at his location. */
-__root    const uint32_t m_uicr_bootloader_start_address @ NRF_UICR_BOOT_START_ADDRESS = BOOTLOADER_REGION_START;                   /**< This variable ensures that the linker script will write the bootloader start address to the UICR register. This value will be written in the HEX file and thus written to UICR when the bootloader is flashed into the chip. */
-
-#endif
-
-#if defined ( NRF52 )
-#if defined ( __CC_ARM )
-
-uint8_t m_mbr_params_page[CODE_PAGE_SIZE]   __attribute__((at(BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS))) __attribute__((used));          /**< This variable reserves a codepage for mbr parameters, to ensure the compiler doesn't locate any code or variables at his location. */
-uint32_t m_uicr_mbr_params_page_address     __attribute__((at(NRF_UICR_MBR_PARAMS_PAGE_ADDRESS))) 
-                                                = BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS;                                               /**< This variable makes the linker script write the mbr parameters page address to the UICR register. This value will be written in the HEX file and thus written to the UICR when the bootloader is flashed into the chip */
-
-#elif defined (__GNUC__ )
-
-uint8_t m_mbr_params_page[CODE_PAGE_SIZE]           __attribute__ ((section(".mbrParamsPage")));                                    /**< This variable reserves a codepage for mbr parameters, to ensure the compiler doesn't locate any code or variables at his location. */
-volatile uint32_t m_uicr_mbr_params_page_address    __attribute__ ((section(".uicrMbrParamsPageAddress")))
-                                                = BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS;                                               /**< This variable makes the linker script write the mbr parameters page address to the UICR register. This value will be written in the HEX file and thus written to the UICR when the bootloader is flashed into the chip */
-
-#elif defined (__ICCARM__ )
-
-__no_init uint8_t m_mbr_params_page[CODE_PAGE_SIZE]     @ BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS;                                       /**< This variable reserves a codepage for bootloader specific settings, to ensure the compiler doesn't locate any code or variables at his location. */
-__root    const uint32_t m_uicr_mbr_params_page_address @ NRF_UICR_MBR_PARAMS_PAGE_ADDRESS = BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS;    /**< This variable ensures that the linker script will write the bootloader start address to the UICR register. This value will be written in the HEX file and thus written to UICR when the bootloader is flashed into the chip. */
-
-#endif
-#endif //defined ( NRF52 )
-
-
-void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings)
-{
-    // Read only pointer to bootloader settings in flash. 
-    bootloader_settings_t const * const p_bootloader_settings =
-        (bootloader_settings_t *)&m_boot_settings[0];        
-
-    *pp_bootloader_settings = p_bootloader_settings;
-}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.h
deleted file mode 100644
index c55cf21..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_settings.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
-
- /**@file
- *
- * @defgroup nrf_bootloader_settings Bootloader settings API.
- * @{     
- *  
- * @brief Bootloader settings module interface.
- */
- 
-#ifndef BOOTLOADER_SETTINGS_H__
-#define BOOTLOADER_SETTINGS_H__
-
-#include <stdint.h>
-#include "bootloader_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for getting the bootloader settings.
- * 
- * @param[out] pp_bootloader_settings Bootloader settings. 
- */
-void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BOOTLOADER_SETTINGS_H__
-
-/**@} */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_types.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_types.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_types.h
deleted file mode 100644
index c062c9a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_types.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
- 
-/**@file
- *
- * @defgroup nrf_bootloader_types Types and definitions.
- * @{     
- *  
- * @ingroup nrf_bootloader
- * 
- * @brief Bootloader module type and definitions.
- */
- 
-#ifndef BOOTLOADER_TYPES_H__
-#define BOOTLOADER_TYPES_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BOOTLOADER_DFU_START 0xB1
-
-#define BOOTLOADER_SVC_APP_DATA_PTR_GET 0x02
-
-/**@brief DFU Bank state code, which indicates wether the bank contains: A valid image, invalid image, or an erased flash.
-  */
-typedef enum
-{
-    BANK_VALID_APP   = 0x01,
-    BANK_VALID_SD    = 0xA5,
-    BANK_VALID_BOOT  = 0xAA,
-    BANK_ERASED      = 0xFE,
-    BANK_INVALID_APP = 0xFF,
-} bootloader_bank_code_t;
-
-/**@brief Structure holding bootloader settings for application and bank data.
- */
-typedef struct
-{
-    bootloader_bank_code_t bank_0;          /**< Variable to store if bank 0 contains a valid application. */
-    uint16_t               bank_0_crc;      /**< If bank is valid, this field will contain a valid CRC of the total image. */
-    bootloader_bank_code_t bank_1;          /**< Variable to store if bank 1 has been erased/prepared for new image. Bank 1 is only used in Banked Update scenario. */
-    uint32_t               bank_0_size;     /**< Size of active image in bank0 if present, otherwise 0. */
-    uint32_t               sd_image_size;   /**< Size of SoftDevice image in bank0 if bank_0 code is BANK_VALID_SD. */
-    uint32_t               bl_image_size;   /**< Size of Bootloader image in bank0 if bank_0 code is BANK_VALID_SD. */
-    uint32_t               app_image_size;  /**< Size of Application image in bank0 if bank_0 code is BANK_VALID_SD. */
-    uint32_t               sd_image_start;  /**< Location in flash where SoftDevice image is stored for SoftDevice update. */
-} bootloader_settings_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BOOTLOADER_TYPES_H__ 
-
-/**@} */