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

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

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/1_0_0_b1_dev c85f10582 -> a1481cb22


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/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h
deleted file mode 100644
index 25be634..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.h
+++ /dev/null
@@ -1,615 +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.
- *
- */
-#ifndef _CONN_MW_BLE_GAP_H
-#define _CONN_MW_BLE_GAP_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Handles @ref sd_ble_gap_address_set command request and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf,
-                                     uint32_t rx_buf_len,
-                                     uint8_t * const p_tx_buf,
-                                     uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_address_get command request and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf,
-                                     uint32_t rx_buf_len,
-                                     uint8_t * const p_tx_buf,
-                                     uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_adv_data_set command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf,
-                                      uint32_t              rx_buf_len,
-                                      uint8_t       * const p_tx_buf,
-                                      uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_adv_start command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf,
-                                   uint32_t              rx_buf_len,
-                                   uint8_t       * const p_tx_buf,
-                                   uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_adv_stop command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_conn_param_update command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf,
-                                           uint32_t              rx_buf_len,
-                                           uint8_t       * const p_tx_buf,
-                                           uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_disconnect command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf,
-                                    uint32_t              rx_buf_len,
-                                    uint8_t       * const p_tx_buf,
-                                    uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_tx_power_set command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf,
-                                      uint32_t              rx_buf_len,
-                                      uint8_t       * const p_tx_buf,
-                                      uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_appearance_set command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t       * const p_tx_buf,
-                                        uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_appearance_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t       * const p_tx_buf,
-                                        uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_ppcp_set command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_ppcp_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_device_name_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf,
-                                         uint32_t              rx_buf_len,
-                                         uint8_t       * const p_tx_buf,
-                                         uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_device_name_set command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf,
-                                         uint32_t              rx_buf_len,
-                                         uint8_t       * const p_tx_buf,
-                                         uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_authenticate command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf,
-                                      uint32_t              rx_buf_len,
-                                      uint8_t       * const p_tx_buf,
-                                      uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_sec_params_reply command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf,
-                                          uint32_t              rx_buf_len,
-                                          uint8_t       * const p_tx_buf,
-                                          uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_auth_key_reply command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t       * const p_tx_buf,
-                                        uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_sec_info_reply command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t       * const p_tx_buf,
-                                        uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_conn_sec_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf,
-                                      uint32_t              rx_buf_len,
-                                      uint8_t       * const p_tx_buf,
-                                      uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_rssi_start command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf,
-                                    uint32_t              rx_buf_len,
-                                    uint8_t       * const p_tx_buf,
-                                    uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_rssi_stop command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf,
-                                   uint32_t              rx_buf_len,
-                                   uint8_t       * const p_tx_buf,
-                                   uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_rssi_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_connect command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_connect_cancel command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t * const       p_tx_buf,
-                                        uint32_t * const      p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_scan_start command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf,
-                                    uint32_t              rx_buf_len,
-                                    uint8_t * const       p_tx_buf,
-                                    uint32_t * const      p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_scan_stop command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf,
-                                    uint32_t              rx_buf_len,
-                                    uint8_t * const       p_tx_buf,
-                                    uint32_t * const      p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_encrypt command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-
-uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t       * const p_tx_buf,
-                                 uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_keypress_notify command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-
-uint32_t conn_mw_ble_gap_keypress_notify(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_lesc_dhkey_reply command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-
-uint32_t conn_mw_ble_gap_lesc_dhkey_reply(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_lesc_oob_data_set command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-
-uint32_t conn_mw_ble_gap_lesc_oob_data_set(uint8_t const * const p_rx_buf,
-                                           uint32_t              rx_buf_len,
-                                           uint8_t       * const p_tx_buf,
-                                           uint32_t      * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_gap_lesc_oob_data_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-
-uint32_t conn_mw_ble_gap_lesc_oob_data_get(uint8_t const * const p_rx_buf,
-                                           uint32_t              rx_buf_len,
-                                           uint8_t       * const p_tx_buf,
-                                           uint32_t      * const p_tx_buf_len);
-/**@brief allocates instance in m_conn_keys_table[] for storage of encryption keys.
- *
- * @param[in]     conn_handle         conn_handle
- * @param[out]    p_index             pointer to the index of allocated instance
- *
- * @retval NRF_SUCCESS                great success.
- * @retval NRF_ERROR_NO_MEM           no free instance available.
- */
-uint32_t conn_mw_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index);
-
-/**@brief release instance identified by a connection handle.
- *
- * @param[in]     conn_handle         conn_handle
- *
- * @retval NRF_SUCCESS                great success
- * @retval NRF_ERROR_NOT_FOUND        instance with conn_handle not found
- */
-uint32_t conn_mw_ble_gap_sec_context_destroy(uint16_t conn_handle);
-
-/**@brief finds index of instance identified by a connection handle in m_conn_keys_table[].
- *
- * @param[in]     conn_handle         conn_handle
- *
- * @retval NRF_SUCCESS                great success
- * @retval NRF_ERROR_NOT_FOUND        instance with conn_handle not found
- */
-uint32_t conn_mw_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_CONN_MW_BLE_GAP_H


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

Posted by cc...@apache.org.
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/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c
deleted file mode 100644
index 6016a0b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.c
+++ /dev/null
@@ -1,523 +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.
- *
- */
-#include "ble_gattc_struct_serialization.h"
-#include "ble_struct_serialization.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "ble_gattc.h"
-#include "cond_field_serialization.h"
-#include <string.h>
-
-uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct,
-                                                       uint8_t * const    p_buf,
-                                                       uint32_t           buf_len,
-                                                       uint32_t * const   p_index)
-{
-    ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read =
-        (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&(p_read->count), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_read->value_len), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint32_t                   i;
-    ble_gattc_handle_value_t * p_handle_value = &p_read->handle_value[0];
-
-    for (i = 0; i < p_read->count; i++)
-    {
-        err_code = uint16_t_enc(&(p_handle_value->handle), p_buf, buf_len, p_index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index);
-        memcpy(&p_buf[*p_index], p_handle_value->p_value, p_read->value_len);
-        *p_index += p_read->value_len;
-
-        p_handle_value++;
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf,
-                                                       uint32_t              buf_len,
-                                                       uint32_t * const      p_index,
-                                                       uint32_t * const      p_struct_size,
-                                                       void * const          p_void_struct)
-{
-    ble_gattc_evt_char_val_by_uuid_read_rsp_t * p_read =
-        (ble_gattc_evt_char_val_by_uuid_read_rsp_t *) p_void_struct;
-    uint32_t err_code = NRF_SUCCESS;
-    uint16_t value_len;
-    uint16_t count;
-    uint32_t i;
-
-    SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &count);
-    uint16_dec(p_buf, buf_len, p_index, &value_len);
-
-    uint32_t total_struct_size = *p_struct_size;
-
-    //calculate the size of the struct
-    *p_struct_size  = offsetof(ble_gattc_evt_char_val_by_uuid_read_rsp_t, handle_value[0]);
-    *p_struct_size += sizeof(((ble_gattc_evt_char_val_by_uuid_read_rsp_t *)0)->handle_value[0]) * count;
-    *p_struct_size += value_len * count;
-
-    if (p_read)
-    {
-        p_read->value_len = value_len;
-        p_read->count     = count;
-
-        ble_gattc_handle_value_t * p_handle_value;
-        uint8_t *                  p_value;
-
-        SER_ASSERT_LENGTH_LEQ(*p_struct_size, total_struct_size);
-
-        p_value = (uint8_t *)&p_read->handle_value[count];
-
-        for (i = 0; i < count; i++)
-        {
-            p_handle_value          = (ble_gattc_handle_value_t *)&p_read->handle_value[i];
-            p_handle_value->p_value = p_value;
-
-            SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index);
-            uint16_dec(p_buf, buf_len, p_index, &(p_handle_value->handle));
-
-            SER_ASSERT_LENGTH_LEQ(p_read->value_len, buf_len - *p_index);
-            memcpy(p_handle_value->p_value, &p_buf[*p_index], p_read->value_len);
-            *p_index += p_read->value_len;
-
-            p_value += value_len;
-        }
-    }
-    else
-    {
-        *p_index += count * (value_len + 2);
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct,
-                                                uint8_t * const    p_buf,
-                                                uint32_t           buf_len,
-                                                uint32_t * const   p_index)
-{
-    ble_gattc_evt_char_vals_read_rsp_t * p_read =
-        (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct;
-    uint32_t error_code = NRF_SUCCESS;
-
-    //Encode len
-    error_code = uint16_t_enc(&(p_read->len), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    //Encode values
-    SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_read->values, p_read->len);
-    *p_index += p_read->len;
-
-    return error_code;
-}
-
-uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf,
-                                                uint32_t              buf_len,
-                                                uint32_t * const      p_index,
-                                                void * const          p_void_struct)
-{
-    ble_gattc_evt_char_vals_read_rsp_t * p_read =
-        (ble_gattc_evt_char_vals_read_rsp_t *) p_void_struct;
-    uint32_t error_code = NRF_SUCCESS;
-
-    //Decode len
-    SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &(p_read->len));
-
-    //Decode values
-    SER_ASSERT_LENGTH_LEQ(p_read->len, buf_len - *p_index);
-    memcpy(p_read->values, &p_buf[*p_index], p_read->len);
-    *p_index += p_read->len;
-
-    return error_code;
-}
-
-uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index)
-{
-    ble_gattc_handle_range_t * p_range  = (ble_gattc_handle_range_t *) p_void_struct;
-    uint32_t                   err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&(p_range->start_handle), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_range->end_handle), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_struct)
-{
-    ble_gattc_handle_range_t * p_range  = (ble_gattc_handle_range_t *) p_void_struct;
-    uint32_t                   err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &(p_range->start_handle));
-    uint16_dec(p_buf, buf_len, p_index, &(p_range->end_handle));
-
-    return err_code;
-}
-
-
-uint32_t ble_gattc_service_t_enc(void const * const p_void_struct,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    uint32_t              error_code = NRF_SUCCESS;
-    ble_gattc_service_t * p_service  = (ble_gattc_service_t *) p_void_struct;
-
-    error_code = ble_uuid_t_enc(&(p_service->uuid), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    error_code = ble_gattc_handle_range_t_enc(&(p_service->handle_range), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    return error_code;
-}
-
-uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_struct)
-{
-    uint32_t              error_code = NRF_SUCCESS;
-    ble_gattc_service_t * p_service  = (ble_gattc_service_t *) p_void_struct;
-
-    error_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_service->uuid));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    error_code = ble_gattc_handle_range_t_dec(p_buf, buf_len, p_index, &(p_service->handle_range));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    return error_code;
-}
-
-uint32_t ble_gattc_include_t_enc(void const * const p_void_struct,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    uint32_t              error_code = NRF_SUCCESS;
-    ble_gattc_include_t * p_include  = (ble_gattc_include_t *) p_void_struct;
-
-    error_code = uint16_t_enc(&(p_include->handle), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    error_code = ble_gattc_service_t_enc(&(p_include->included_srvc), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    return error_code;
-}
-
-uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_struct)
-{
-    uint32_t              error_code = NRF_SUCCESS;
-    ble_gattc_include_t * p_include  = (ble_gattc_include_t *) p_void_struct;
-
-    error_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_include->handle));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    error_code = ble_gattc_service_t_dec(p_buf, buf_len, p_index, &(p_include->included_srvc));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    return error_code;
-}
-
-uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct,
-                                          uint8_t * const    p_buf,
-                                          uint32_t           buf_len,
-                                          uint32_t * const   p_index)
-{
-    uint32_t                       error_code = NRF_SUCCESS;
-    uint32_t                       i;
-    ble_gattc_evt_rel_disc_rsp_t * p_rsp = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct;
-
-    error_code = uint16_t_enc(&(p_rsp->count), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes;
-
-    for (i = 0; i < p_rsp->count; i++)
-    {
-        error_code = ble_gattc_include_t_enc(p_include, p_buf, buf_len, p_index);
-        SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-        p_include++;
-    }
-
-    return error_code;
-}
-
-uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf,
-                                          uint32_t              buf_len,
-                                          uint32_t * const      p_index,
-                                          void * const          p_void_struct)
-{
-    uint32_t                       error_code = NRF_SUCCESS;
-    ble_gattc_evt_rel_disc_rsp_t * p_rsp      = (ble_gattc_evt_rel_disc_rsp_t *) p_void_struct;
-    uint16_t                       include_count;
-    uint32_t                       i;
-
-    error_code = uint16_t_dec(p_buf, buf_len, p_index, &include_count);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    p_rsp->count = include_count;
-
-    ble_gattc_include_t * p_include = (ble_gattc_include_t *) p_rsp->includes;
-
-    for (i = 0; i < include_count; i++)
-    {
-        error_code = ble_gattc_include_t_dec(p_buf, buf_len, p_index, p_include);
-        SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-        p_include++;
-    }
-
-    return error_code;
-}
-
-uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_void_write);
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write;
-
-    err_code = uint8_t_enc(&(p_write->write_op), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&(p_write->flags), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = len16data_enc(p_write->p_value, p_write->len, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_write)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_write);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_write_params_t * p_write = (ble_gattc_write_params_t *)p_void_write;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->write_op));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_write->flags));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_write->offset));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = len16data_dec(p_buf, buf_len, p_index, &(p_write->p_value), &(p_write->len));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gattc_attr_info_t_16_enc(void const * const p_void_struct,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_void_struct);
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_attr_info_t * p_attr_info = (ble_gattc_attr_info_t *)p_void_struct;
-
-    err_code = uint16_t_enc(&(p_attr_info->handle), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_uuid_t_enc(&(p_attr_info->info.uuid16), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gattc_attr_info_t_16_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_struct)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_struct);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_attr_info_t * p_attr_info = (ble_gattc_attr_info_t *)p_void_struct;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_attr_info->handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &(p_attr_info->info.uuid16));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gattc_attr_info_t_128_enc(void const * const p_void_struct,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_void_struct);
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_attr_info_t * p_attr_info = (ble_gattc_attr_info_t *)p_void_struct;
-
-    err_code = uint16_t_enc(&(p_attr_info->handle), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_uuid128_t_enc(&(p_attr_info->info.uuid128), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gattc_attr_info_t_128_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_void_struct)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_struct);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_attr_info_t * p_attr_info = (ble_gattc_attr_info_t *)p_void_struct;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_attr_info->handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_uuid128_t_dec(p_buf, buf_len, p_index, &(p_attr_info->info.uuid128));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gattc_evt_attr_info_disc_rsp_t_enc(void const * const p_void_struct,
-                                                uint8_t * const    p_buf,
-                                                uint32_t           buf_len,
-                                                uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_void_struct);
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_evt_attr_info_disc_rsp_t * p_rsp = (ble_gattc_evt_attr_info_disc_rsp_t *)p_void_struct;
-
-    err_code = uint16_t_enc(&(p_rsp->count), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&(p_rsp->format), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint32_t i;
-    field_encoder_handler_t uuid_enc = (p_rsp->format == BLE_GATTC_ATTR_INFO_FORMAT_16BIT) ?
-            ble_gattc_attr_info_t_16_enc : ble_gattc_attr_info_t_128_enc;
-
-    for (i = 0; i < p_rsp->count; i++)
-    {
-        err_code = uuid_enc(&(p_rsp->attr_info[i]), p_buf, buf_len, p_index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gattc_evt_attr_info_disc_rsp_t_dec(uint8_t const * const p_buf,
-                                                uint32_t              buf_len,
-                                                uint32_t * const      p_index,
-                                                void * const          p_void_struct)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gattc_evt_attr_info_disc_rsp_t * p_rsp = (ble_gattc_evt_attr_info_disc_rsp_t *)p_void_struct;
-
-    uint16_t count;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_rsp)
-    {
-        p_rsp->count = count;
-        err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_rsp->format);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        uint32_t i;
-        field_decoder_handler_t uuid_dec = (p_rsp->format == BLE_GATTC_ATTR_INFO_FORMAT_16BIT) ?
-                ble_gattc_attr_info_t_16_dec : ble_gattc_attr_info_t_128_dec;
-
-        for (i = 0; i < p_rsp->count; i++)
-        {
-            err_code = uuid_dec(p_buf, buf_len, p_index, &(p_rsp->attr_info[i]));
-            SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-        }
-    }
-    else
-    {
-        *p_index =  offsetof(ble_gattc_evt_attr_info_disc_rsp_t, attr_info) + count*sizeof(ble_gattc_attr_info_t);
-    }
-    return err_code;
-}

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/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h
deleted file mode 100644
index c5ea0d4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gattc_struct_serialization.h
+++ /dev/null
@@ -1,125 +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.
- *
- */
-#ifndef BLE_GATTC_STRUCT_SERIALIZATION_H
-#define BLE_GATTC_STRUCT_SERIALIZATION_H
-
-#include "ble_gattc.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_enc(void const * const p_void_struct,
-                                                       uint8_t * const    p_buf,
-                                                       uint32_t           buf_len,
-                                                       uint32_t * const   p_index);
-
-uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(uint8_t const * const p_buf,
-                                                       uint32_t              buf_len,
-                                                       uint32_t * const      p_index,
-                                                       uint32_t * const      p_struct_size,
-                                                       void * const          p_void_struct);
-
-uint32_t ble_gattc_evt_char_vals_read_rsp_t_enc(void const * const p_void_struct,
-                                                uint8_t * const    p_buf,
-                                                uint32_t           buf_len,
-                                                uint32_t * const   p_index);
-
-uint32_t ble_gattc_evt_char_vals_read_rsp_t_dec(uint8_t const * const p_buf,
-                                                uint32_t              buf_len,
-                                                uint32_t * const      p_index,
-                                                void * const          p_void_struct);
-
-uint32_t ble_gattc_handle_range_t_enc(void const * const p_void_struct,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index);
-
-uint32_t ble_gattc_handle_range_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_struct);
-
-uint32_t ble_gattc_service_t_enc(void const * const p_void_struct,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_gattc_service_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_struct);
-
-uint32_t ble_gattc_include_t_enc(void const * const p_void_struct,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_gattc_include_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_struct);
-
-uint32_t ble_gattc_evt_rel_disc_rsp_t_enc(void const * const p_void_struct,
-                                          uint8_t * const    p_buf,
-                                          uint32_t           buf_len,
-                                          uint32_t * const   p_index);
-
-uint32_t ble_gattc_evt_rel_disc_rsp_t_dec(uint8_t const * const p_buf,
-                                          uint32_t              buf_len,
-                                          uint32_t * const      p_index,
-                                          void * const          p_void_struct);
-
-uint32_t ble_gattc_write_params_t_enc(void const * const p_void_write,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index);
-
-uint32_t ble_gattc_write_params_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_write);
-
-uint32_t ble_gattc_attr_info_t_16_enc(void const * const p_void_struct,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index);
-
-uint32_t ble_gattc_attr_info_t_16_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_struct);
-
-uint32_t ble_gattc_attr_info_t_128_enc(void const * const p_void_struct,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index);
-
-uint32_t ble_gattc_attr_info_t_128_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_void_struct);
-
-uint32_t ble_gattc_evt_attr_info_disc_rsp_t_enc(void const * const p_void_struct,
-                                                uint8_t * const    p_buf,
-                                                uint32_t           buf_len,
-                                                uint32_t * const   p_index);
-
-uint32_t ble_gattc_evt_attr_info_disc_rsp_t_dec(uint8_t const * const p_buf,
-                                                uint32_t              buf_len,
-                                                uint32_t * const      p_index,
-                                                void * const          p_void_struct);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*BLE_GATTC_STRUCT_SERIALIZATION_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/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c
deleted file mode 100644
index fe2fe83..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.c
+++ /dev/null
@@ -1,899 +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.
- *
- */
-
-#include "ble_gatts_struct_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "ble_struct_serialization.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "ble_gatts.h"
-#include "cond_field_serialization.h"
-#include <string.h>
-
-uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_char_pf)
-{
-    ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf;
-
-    SER_ASSERT_LENGTH_LEQ(7, buf_len - *p_index);
-
-    uint8_dec(p_buf, buf_len, p_index, &p_char_pf->format);
-    uint8_dec(p_buf, buf_len, p_index, (uint8_t *)&p_char_pf->exponent);
-    uint16_dec(p_buf, buf_len, p_index, &p_char_pf->unit);
-    uint8_dec(p_buf, buf_len, p_index, &p_char_pf->name_space);
-    uint16_dec(p_buf, buf_len, p_index, &p_char_pf->desc);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    ble_gatts_char_pf_t * p_char_pf = (ble_gatts_char_pf_t *)p_void_char_pf;
-    uint32_t              err_code  = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&p_char_pf->format, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_char_pf->exponent, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_char_pf->unit, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_char_pf->name_space, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_char_pf->desc, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md;
-    uint32_t              err_code  = NRF_SUCCESS;
-
-    err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->read_perm, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_conn_sec_mode_enc(&p_attr_md->write_perm, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    /* serializer does not support attributes on stack */
-    if (p_attr_md->vloc != BLE_GATTS_VLOC_STACK)
-    {
-        err_code = NRF_ERROR_INVALID_PARAM;
-    }
-
-    uint8_t temp8;
-    temp8 = p_attr_md->vlen |
-            (p_attr_md->vloc << 1) |
-            (p_attr_md->rd_auth << 3) |
-            (p_attr_md->wr_auth << 4);
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    p_buf[*p_index] = temp8;
-    *p_index       += 1;
-
-    return err_code;
-}
-
-uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_attr_md)
-{
-    ble_gatts_attr_md_t * p_attr_md = (ble_gatts_attr_md_t *)p_void_attr_md;
-    uint32_t              err_code  = NRF_SUCCESS;
-    uint8_t               temp8;
-
-    err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->read_perm);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_attr_md->write_perm);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    uint8_dec(p_buf, buf_len, p_index, &temp8);
-
-    p_attr_md->vlen    = temp8;
-    p_attr_md->vloc    = temp8 >> 1;
-    p_attr_md->rd_auth = temp8 >> 3;
-    p_attr_md->wr_auth = temp8 >> 4;
-
-    return err_code;
-}
-
-uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md;
-    uint8_t               temp8;
-
-    temp8 = p_char_md->char_props.broadcast |
-            (p_char_md->char_props.read << 1) |
-            (p_char_md->char_props.write_wo_resp << 2) |
-            (p_char_md->char_props.write << 3) |
-            (p_char_md->char_props.notify << 4) |
-            (p_char_md->char_props.indicate << 5) |
-            (p_char_md->char_props.auth_signed_wr << 6);
-
-    err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    temp8 = p_char_md->char_ext_props.reliable_wr |
-            (p_char_md->char_ext_props.wr_aux << 1);
-
-    err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_char_md->char_user_desc_max_size, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ERROR_CHECK(p_char_md->char_user_desc_size <= BLE_GATTS_VAR_ATTR_LEN_MAX,
-                    NRF_ERROR_INVALID_PARAM);
-    err_code = len16data_enc(p_char_md->p_char_user_desc, p_char_md->char_user_desc_size, p_buf,
-                             buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_char_md->p_char_pf,
-                              p_buf,
-                              buf_len,
-                              p_index,
-                              ser_ble_gatts_char_pf_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_char_md->p_user_desc_md,
-                              p_buf,
-                              buf_len,
-                              p_index,
-                              ble_gatts_attr_md_enc);
-    SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_char_md->p_cccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc);
-    SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_char_md->p_sccd_md, p_buf, buf_len, p_index, ble_gatts_attr_md_enc);
-    SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_char_md)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    ble_gatts_char_md_t * p_char_md = (ble_gatts_char_md_t *)p_void_char_md;
-
-    SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index);
-    uint8_t temp8 = p_buf[*p_index];
-
-    p_char_md->char_props.broadcast      = temp8 >> 0;
-    p_char_md->char_props.read           = temp8 >> 1;
-    p_char_md->char_props.write_wo_resp  = temp8 >> 2;
-    p_char_md->char_props.write          = temp8 >> 3;
-    p_char_md->char_props.notify         = temp8 >> 4;
-    p_char_md->char_props.indicate       = temp8 >> 5;
-    p_char_md->char_props.auth_signed_wr = temp8 >> 6;
-
-    temp8 = p_buf[*p_index + 1];
-    p_char_md->char_ext_props.reliable_wr = temp8 >> 0;
-    p_char_md->char_ext_props.wr_aux      = temp8 >> 1;
-
-    *p_index += 2;
-
-    SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &p_char_md->char_user_desc_max_size);
-
-    err_code = len16data_dec(p_buf,
-                             buf_len,
-                             p_index,
-                             &p_char_md->p_char_user_desc,
-                             &p_char_md->char_user_desc_size);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf,
-                              buf_len,
-                              p_index,
-                              (void * *)&p_char_md->p_char_pf,
-                              ser_ble_gatts_char_pf_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf,
-                              buf_len,
-                              p_index,
-                              (void * *)&p_char_md->p_user_desc_md,
-                              ble_gatts_attr_md_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf,
-                              buf_len,
-                              p_index,
-                              (void * *)&p_char_md->p_cccd_md,
-                              ble_gatts_attr_md_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf,
-                              buf_len,
-                              p_index,
-                              (void * *)&p_char_md->p_sccd_md,
-                              ble_gatts_attr_md_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-
-}
-
-uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr,
-                            uint8_t * const    p_buf,
-                            uint32_t           buf_len,
-                            uint32_t * const   p_index)
-{
-    uint32_t           err_code     = NRF_SUCCESS;
-    ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr;
-
-    err_code = cond_field_enc((void *)p_gatts_attr->p_uuid, p_buf, buf_len, p_index, ble_uuid_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc((void *)p_gatts_attr->p_attr_md,
-                              p_buf,
-                              buf_len,
-                              p_index,
-                              ble_gatts_attr_md_enc);
-    SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_gatts_attr->init_offs, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_gatts_attr->max_len, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ERROR_CHECK(p_gatts_attr->init_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM);
-    //init len move just before p_data to be able to use len16data decoder.
-    err_code = len16data_enc(p_gatts_attr->p_value, p_gatts_attr->init_len, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf,
-                            uint32_t              buf_len,
-                            uint32_t * const      p_index,
-                            void * const          p_void_gatts_attr)
-{
-    uint32_t           err_code     = NRF_SUCCESS;
-    ble_gatts_attr_t * p_gatts_attr = (ble_gatts_attr_t *)p_void_gatts_attr;
-
-    err_code = cond_field_dec(p_buf,
-                              buf_len,
-                              p_index,
-                              (void * *)&p_gatts_attr->p_uuid,
-                              ble_uuid_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf,
-                              buf_len,
-                              p_index,
-                              (void * *)&p_gatts_attr->p_attr_md,
-                              ble_gatts_attr_md_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->init_offs);
-    uint16_dec(p_buf, buf_len, p_index, &p_gatts_attr->max_len);
-
-    //init len move just before p_data to be able to use len16data decoder.
-    err_code = len16data_dec(p_buf,
-                             buf_len,
-                             p_index,
-                             &p_gatts_attr->p_value,
-                             &p_gatts_attr->init_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles,
-                                    uint8_t * const    p_buf,
-                                    uint32_t           buf_len,
-                                    uint32_t * const   p_index)
-{
-    ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles;
-    uint32_t                   err_code       = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&p_char_handles->value_handle, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_char_handles->user_desc_handle, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_char_handles->cccd_handle, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_char_handles->sccd_handle, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf,
-                                    uint32_t              buf_len,
-                                    uint32_t * const      p_index,
-                                    void * const          p_void_char_handles)
-{
-    ble_gatts_char_handles_t * p_char_handles = (ble_gatts_char_handles_t *)p_void_char_handles;
-
-    SER_ASSERT_LENGTH_LEQ(8, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &(p_char_handles->value_handle));
-    uint16_dec(p_buf, buf_len, p_index, &p_char_handles->user_desc_handle);
-    uint16_dec(p_buf, buf_len, p_index, &p_char_handles->cccd_handle);
-    uint16_dec(p_buf, buf_len, p_index, &p_char_handles->sccd_handle);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params,
-                                    uint8_t * const    p_buf,
-                                    uint32_t           buf_len,
-                                    uint32_t * const   p_index)
-{
-    ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params;
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index);
-
-    err_code = uint16_t_enc(&p_hvx_params->handle, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_hvx_params->type, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_hvx_params->offset, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_hvx_params->p_len != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-        p_buf[(*p_index)++] = SER_FIELD_PRESENT;
-
-        err_code = uint16_t_enc(p_hvx_params->p_len, p_buf, buf_len, p_index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    }
-
-    if (p_hvx_params->p_data != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-        p_buf[(*p_index)++] = SER_FIELD_PRESENT;
-
-        SER_ASSERT_LENGTH_LEQ(*p_hvx_params->p_len, buf_len - *p_index);
-        memcpy(&p_buf[*p_index], p_hvx_params->p_data, *p_hvx_params->p_len);
-        *p_index += *p_hvx_params->p_len;
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf,
-                                    uint32_t              buf_len,
-                                    uint32_t * const      p_index,
-                                    void * const          p_void_hvx_params)
-{
-    ble_gatts_hvx_params_t * p_hvx_params = (ble_gatts_hvx_params_t *)p_void_hvx_params;
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(2 + 1 + 2, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->handle);
-    uint8_dec(p_buf, buf_len, p_index, &p_hvx_params->type);
-    uint16_dec(p_buf, buf_len, p_index, &p_hvx_params->offset);
-
-    SER_ASSERT_NOT_NULL(&p_hvx_params->p_len);
-    err_code = cond_len16_cond_data_dec(p_buf,
-                                        buf_len,
-                                        p_index,
-                                        &p_hvx_params->p_data,
-                                        &p_hvx_params->p_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    ble_gatts_evt_write_t * p_write    = (ble_gatts_evt_write_t *) p_void_write;
-    uint32_t                error_code = NRF_SUCCESS;
-
-    error_code = uint16_t_enc(&(p_write->handle), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    error_code = ble_uuid_t_enc(&(p_write->uuid), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    error_code = uint8_t_enc(&(p_write->op), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    error_code = uint8_t_enc(&(p_write->auth_required), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    error_code = uint16_t_enc(&(p_write->offset), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    uint16_t data_len = p_write->len;
-    error_code = uint16_t_enc(&data_len, p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    SER_ASSERT_LENGTH_LEQ(data_len, buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_write->data, data_len);
-    *p_index += data_len;
-
-    return error_code;
-}
-
-uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   uint32_t * const      p_struct_len,
-                                   void * const          p_void_write)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_struct_len);
-
-    uint32_t err_code      = NRF_SUCCESS;
-    uint32_t in_struct_len = *p_struct_len;
-
-    *p_struct_len = offsetof(ble_gatts_evt_write_t, data);
-
-    uint16_t handle;
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    ble_uuid_t uuid;
-    err_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &uuid);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint8_t op;
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &op);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint8_t auth_required;
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &auth_required);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint16_t offset;
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint16_t len;
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_struct_len += len;
-
-    if (p_void_write != NULL)
-    {
-        ble_gatts_evt_write_t * p_write = (ble_gatts_evt_write_t *)p_void_write;
-
-        SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len);
-
-        p_write->handle = handle;
-        p_write->uuid   = uuid;
-        p_write->op     = op;
-        p_write->auth_required = auth_required;
-        p_write->offset = offset;
-        p_write->len    = len;
-
-        SER_ASSERT_LENGTH_LEQ(p_write->len, buf_len - *p_index);
-        memcpy(p_write->data, &p_buf[*p_index], p_write->len);
-    }
-
-    *p_index += len;
-
-    return err_code;
-}
-
-uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_read);
-
-    ble_gatts_evt_read_t * p_read   = (ble_gatts_evt_read_t *)p_void_read;
-    uint32_t               err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&(p_read->handle), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_uuid_t_enc(&(p_read->uuid), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_read->offset), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  uint32_t * const      p_struct_len,
-                                  void * const          p_void_read)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t err_code      = NRF_SUCCESS;
-    uint32_t in_struct_len = *p_struct_len;
-
-    *p_struct_len = sizeof (ble_gatts_evt_read_t);
-
-    uint16_t handle;
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    ble_uuid_t uuid;
-    err_code = ble_uuid_t_dec(p_buf, buf_len, p_index, &uuid);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint16_t offset;
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &offset);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_void_read != NULL)
-    {
-        ble_gatts_evt_read_t * p_read = (ble_gatts_evt_read_t *)p_void_read;
-
-        SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len);
-
-        p_read->handle = handle;
-        p_read->uuid   = uuid;
-        p_read->offset = offset;
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request,
-                                                  uint8_t * const    p_buf,
-                                                  uint32_t           buf_len,
-                                                  uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_authorize_request);
-
-    ble_gatts_evt_rw_authorize_request_t * p_authorize_request =
-        (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&(p_authorize_request->type), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    switch (p_authorize_request->type)
-    {
-        case BLE_GATTS_AUTHORIZE_TYPE_READ:
-            err_code = ble_gatts_evt_read_t_enc(&(p_authorize_request->request.read),
-                                                p_buf,
-                                                buf_len,
-                                                p_index);
-            SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-            break;
-
-        case BLE_GATTS_AUTHORIZE_TYPE_WRITE:
-            err_code = ble_gatts_evt_write_t_enc(&(p_authorize_request->request.write),
-                                                 p_buf,
-                                                 buf_len,
-                                                 p_index);
-            SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-            break;
-
-        default:
-        case BLE_GATTS_AUTHORIZE_TYPE_INVALID:
-            err_code = NRF_ERROR_INVALID_PARAM;
-            break;
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf,
-                                                  uint32_t              buf_len,
-                                                  uint32_t * const      p_index,
-                                                  uint32_t * const      p_struct_len,
-                                                  void * const          p_void_authorize_request)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_struct_len);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    uint8_t type;
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &type);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint32_t in_struct_len = *p_struct_len;
-
-    *p_struct_len = offsetof(ble_gatts_evt_rw_authorize_request_t, request);
-
-    ble_gatts_evt_rw_authorize_request_t * p_authorize_request =
-        (ble_gatts_evt_rw_authorize_request_t *)p_void_authorize_request;
-
-    void * p_void_request = NULL;
-
-    if (p_void_authorize_request != NULL)
-    {
-        p_authorize_request->type = type;
-
-        SER_ASSERT_LENGTH_LEQ(*p_struct_len, in_struct_len);
-
-        switch (type)
-        {
-            case BLE_GATTS_AUTHORIZE_TYPE_READ:
-                p_void_request = &(p_authorize_request->request.read);
-                break;
-
-            case BLE_GATTS_AUTHORIZE_TYPE_WRITE:
-                p_void_request = &(p_authorize_request->request.write);
-                break;
-
-            default:
-            case BLE_GATTS_AUTHORIZE_TYPE_INVALID:
-                return NRF_ERROR_INVALID_DATA;
-        }
-    }
-
-    switch (type)
-    {
-        case BLE_GATTS_AUTHORIZE_TYPE_READ:
-            err_code = ble_gatts_evt_read_t_dec(p_buf,
-                                                buf_len,
-                                                p_index,
-                                                &in_struct_len,
-                                                p_void_request);
-            SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-            break;
-
-        case BLE_GATTS_AUTHORIZE_TYPE_WRITE:
-            err_code = ble_gatts_evt_write_t_dec(p_buf,
-                                                 buf_len,
-                                                 p_index,
-                                                 &in_struct_len,
-                                                 p_void_request);
-            SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-            break;
-
-        default:
-        case BLE_GATTS_AUTHORIZE_TYPE_INVALID:
-            return NRF_ERROR_INVALID_DATA;
-    }
-    *p_struct_len += in_struct_len;
-
-    return err_code;
-}
-
-uint32_t ble_gatts_authorize_params_t_enc(void const * const p_void_struct,
-                                          uint8_t * const    p_buf,
-                                          uint32_t           buf_len,
-                                          uint32_t * const   p_index)
-{
-    ble_gatts_authorize_params_t * p_params =
-        (ble_gatts_authorize_params_t *) p_void_struct;
-    uint32_t error_code = NRF_SUCCESS;
-
-    error_code = uint16_t_enc(&(p_params->gatt_status), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    uint8_t temp_val = p_params->update;
-    error_code = uint8_t_enc(&temp_val, p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    error_code = uint16_t_enc(&(p_params->offset), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    error_code = len16data_enc(p_params->p_data, p_params->len, p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    return error_code;
-}
-
-uint32_t ble_gatts_authorize_params_t_dec(uint8_t const * const p_buf,
-                                          uint32_t              buf_len,
-                                          uint32_t * const      p_index,
-                                          void * const          p_void_struct)
-{
-    ble_gatts_authorize_params_t * p_params =
-        (ble_gatts_authorize_params_t *) p_void_struct;
-    uint32_t error_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &p_params->gatt_status);
-
-    uint8_t temp_val;
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    uint8_dec(p_buf, buf_len, p_index, &temp_val);
-    p_params->update = temp_val;
-
-    SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &p_params->offset);
-
-    error_code = len16data_dec(p_buf, buf_len, p_index, (uint8_t **)&p_params->p_data, &p_params->len);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    return error_code;
-}
-
-uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct,
-                                                   uint8_t * const    p_buf,
-                                                   uint32_t           buf_len,
-                                                   uint32_t * const   p_index)
-{
-    ble_gatts_rw_authorize_reply_params_t const * const p_params =
-        (ble_gatts_rw_authorize_reply_params_t * ) p_void_struct;
-    uint32_t error_code = NRF_SUCCESS;
-
-    error_code = uint8_t_enc(&(p_params->type), p_buf, buf_len, p_index);
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ)
-    {
-        error_code = ble_gatts_authorize_params_t_enc(&p_params->params.read,
-                                                      p_buf, buf_len, p_index);
-        SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    }
-    else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE)
-    {
-        error_code = ble_gatts_authorize_params_t_enc(&p_params->params.write,
-                                                      p_buf, buf_len, p_index);
-        SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    return error_code;
-}
-
-uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf,
-                                                   uint32_t              buf_len,
-                                                   uint32_t * const      p_index,
-                                                   void * const          p_void_struct)
-{
-    ble_gatts_rw_authorize_reply_params_t * p_params =
-        (ble_gatts_rw_authorize_reply_params_t *) p_void_struct;
-    uint32_t error_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    uint8_dec(p_buf, buf_len, p_index, &(p_params->type));
-
-    if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_READ)
-    {
-        error_code = ble_gatts_authorize_params_t_dec(p_buf, buf_len, p_index,
-                                                           &p_params->params.read);
-        SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    }
-    else if (p_params->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE)
-    {
-        error_code = ble_gatts_authorize_params_t_dec(p_buf, buf_len, p_index,
-                                                            &p_params->params.write);
-        SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    return error_code;
-}
-
-uint32_t ble_gatts_enable_params_t_enc(void const * const p_void_struct,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index)
-{
-    ble_gatts_enable_params_t * p_enable_params = (ble_gatts_enable_params_t *)p_void_struct;
-    uint32_t                    err_code        = NRF_SUCCESS;
-    uint8_t                     temp8           = 0;
-
-    temp8 = (p_enable_params->service_changed & 0x01);
-
-    err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint32_t_enc(&(p_enable_params->attr_tab_size), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_enable_params_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_void_struct)
-{
-    ble_gatts_enable_params_t * p_enable_params = (ble_gatts_enable_params_t *)p_void_struct;
-    uint32_t                    err_code        = NRF_SUCCESS;
-    uint8_t                     temp8           = 0;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_enable_params->service_changed = temp8 & 0x01;
-
-    err_code = uint32_t_dec(p_buf, buf_len, p_index, (void *) &(p_enable_params->attr_tab_size));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gatts_value_t_enc(void const * const p_void_struct,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    ble_gatts_value_t * p_value  = (ble_gatts_value_t *)p_void_struct;
-    uint32_t            err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc((void *) &(p_value->len), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = uint16_t_enc((void *) &(p_value->offset), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = buf_enc(p_value->p_value, p_value->len, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    return err_code;
-}
-
-uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_struct)
-{
-    ble_gatts_value_t * p_value  = (ble_gatts_value_t *)p_void_struct;
-    uint32_t            err_code = NRF_SUCCESS;
-    uint16_t            total_len = p_value->len;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->len));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, (void *) &(p_value->offset));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = buf_dec(p_buf, buf_len, p_index, &(p_value->p_value), total_len, p_value->len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}

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/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h
deleted file mode 100644
index 93e7252..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gatts_struct_serialization.h
+++ /dev/null
@@ -1,158 +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.
- *
- */
-#ifndef BLE_GATTS_STRUCT_SERIALIZATION_H
-#define BLE_GATTS_STRUCT_SERIALIZATION_H
-
-#include "ble_gatts.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-uint32_t ser_ble_gatts_char_pf_enc(void const * const p_void_char_pf,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ser_ble_gatts_char_pf_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_char_pf);
-
-uint32_t ble_gatts_attr_md_enc(void const * const p_void_attr_md,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-
-uint32_t ble_gatts_attr_md_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_attr_md);
-
-uint32_t ble_gatts_char_md_enc(void const * const p_void_char_md,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-
-uint32_t ble_gatts_char_md_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_char_md);
-
-uint32_t ble_gatts_attr_enc(void const * const p_void_gatts_attr,
-                            uint8_t * const    p_buf,
-                            uint32_t           buf_len,
-                            uint32_t * const   p_index);
-
-uint32_t ble_gatts_attr_dec(uint8_t const * const p_buf,
-                            uint32_t              buf_len,
-                            uint32_t * const      p_index,
-                            void * const          p_void_gatts_attr);
-
-uint32_t ble_gatts_char_handles_enc(void const * const p_void_char_handles,
-                                    uint8_t * const    p_buf,
-                                    uint32_t           buf_len,
-                                    uint32_t * const   p_index);
-
-uint32_t ble_gatts_char_handles_dec(uint8_t const * const p_buf,
-                                    uint32_t              buf_len,
-                                    uint32_t * const      p_index,
-                                    void * const          p_void_char_handles);
-
-uint32_t ble_gatts_evt_write_t_enc(void const * const p_void_write,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ble_gatts_evt_write_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   uint32_t * const      p_struct_len,
-                                   void * const          p_void_write);
-
-uint32_t ble_gatts_hvx_params_t_enc(void const * const p_void_hvx_params,
-                                    uint8_t * const    p_buf,
-                                    uint32_t           buf_len,
-                                    uint32_t * const   p_index);
-
-uint32_t ble_gatts_hvx_params_t_dec(uint8_t const * const p_buf,
-                                    uint32_t              buf_len,
-                                    uint32_t * const      p_index,
-                                    void * const          p_void_hvx_params);
-
-uint32_t ble_gatts_evt_read_t_enc(void const * const p_void_read,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index);
-
-uint32_t ble_gatts_evt_read_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  uint32_t * const      p_struct_len,
-                                  void * const          p_void_read);
-
-uint32_t ble_gatts_evt_rw_authorize_request_t_enc(void const * const p_void_authorize_request,
-                                                  uint8_t * const    p_buf,
-                                                  uint32_t           buf_len,
-                                                  uint32_t * const   p_index);
-
-uint32_t ble_gatts_evt_rw_authorize_request_t_dec(uint8_t const * const p_buf,
-                                                  uint32_t              buf_len,
-                                                  uint32_t * const      p_index,
-                                                  uint32_t * const      p_struct_size,
-                                                  void * const          p_void_authorize_request);
-
-uint32_t ble_gatts_authorize_params_t_enc(void const * const p_void_struct,
-                                          uint8_t * const    p_buf,
-                                          uint32_t           buf_len,
-                                          uint32_t * const   p_index);
-
-uint32_t ble_gatts_authorize_params_t_dec(uint8_t const * const p_buf,
-                                          uint32_t              buf_len,
-                                          uint32_t * const      p_index,
-                                          void * const          p_void_struct);
-
-uint32_t ble_gatts_rw_authorize_reply_params_t_enc(void const * const p_void_struct,
-                                                   uint8_t * const    p_buf,
-                                                   uint32_t           buf_len,
-                                                   uint32_t * const   p_index);
-
-uint32_t ble_gatts_rw_authorize_reply_params_t_dec(uint8_t const * const p_buf,
-                                                   uint32_t              buf_len,
-                                                   uint32_t * const      p_index,
-                                                   void * const          p_void_struct);
-                                                   
-uint32_t ble_gatts_enable_params_t_enc(void const * const p_void_struct,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index);
-                                       
-uint32_t ble_gatts_enable_params_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_void_struct);
-                                       
-uint32_t ble_gatts_value_t_enc(void const * const p_void_struct,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-                               
-uint32_t ble_gatts_value_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_struct);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BLE_GATTS_STRUCT_SERIALIZATION_H */


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

Posted by cc...@apache.org.
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/hal/nrf_spi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spi.h
deleted file mode 100644
index 98dd662..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spi.h
+++ /dev/null
@@ -1,342 +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.
- *
- */
-
-/**
- * @defgroup nrf_spi_hal SPI HAL
- * @{
- * @ingroup nrf_spi_master
- *
- * @brief Hardware access layer for accessing the SPI peripheral.
- */
-
-#ifndef NRF_SPI_H__
-#define NRF_SPI_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This value can be used as a parameter for the @ref nrf_spi_pins_set
- *        function to specify that a given SPI signal (SCK, MOSI, or MISO)
- *        shall not be connected to a physical pin.
- */
-#define NRF_SPI_PIN_NOT_CONNECTED  0xFFFFFFFF
-
-
-/**
- * @brief SPI events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_SPI_EVENT_READY = offsetof(NRF_SPI_Type, EVENTS_READY) ///< TXD byte sent and RXD byte received.
-    /*lint -restore*/
-} nrf_spi_event_t;
-
-/**
- * @brief SPI interrupts.
- */
-typedef enum
-{
-    NRF_SPI_INT_READY_MASK = SPI_INTENSET_READY_Msk ///< Interrupt on READY event.
-} nrf_spi_int_mask_t;
-
-/**
- * @brief SPI data rates.
- */
-typedef enum
-{
-    NRF_SPI_FREQ_125K = SPI_FREQUENCY_FREQUENCY_K125,   ///< 125 kbps.
-    NRF_SPI_FREQ_250K = SPI_FREQUENCY_FREQUENCY_K250,   ///< 250 kbps.
-    NRF_SPI_FREQ_500K = SPI_FREQUENCY_FREQUENCY_K500,   ///< 500 kbps.
-    NRF_SPI_FREQ_1M   = SPI_FREQUENCY_FREQUENCY_M1,     ///< 1 Mbps.
-    NRF_SPI_FREQ_2M   = SPI_FREQUENCY_FREQUENCY_M2,     ///< 2 Mbps.
-    NRF_SPI_FREQ_4M   = SPI_FREQUENCY_FREQUENCY_M4,     ///< 4 Mbps.
-    // [conversion to 'int' needed to prevent compilers from complaining
-    //  that the provided value (0x80000000UL) is out of range of "int"]
-    NRF_SPI_FREQ_8M   = (int)SPI_FREQUENCY_FREQUENCY_M8 ///< 8 Mbps.
-} nrf_spi_frequency_t;
-
-/**
- * @brief SPI modes.
- */
-typedef enum
-{
-    NRF_SPI_MODE_0, ///< SCK active high, sample on leading edge of clock.
-    NRF_SPI_MODE_1, ///< SCK active high, sample on trailing edge of clock.
-    NRF_SPI_MODE_2, ///< SCK active low, sample on leading edge of clock.
-    NRF_SPI_MODE_3  ///< SCK active low, sample on trailing edge of clock.
-} nrf_spi_mode_t;
-
-/**
- * @brief SPI bit orders.
- */
-typedef enum
-{
-    NRF_SPI_BIT_ORDER_MSB_FIRST = SPI_CONFIG_ORDER_MsbFirst, ///< Most significant bit shifted out first.
-    NRF_SPI_BIT_ORDER_LSB_FIRST = SPI_CONFIG_ORDER_LsbFirst  ///< Least significant bit shifted out first.
-} nrf_spi_bit_order_t;
-
-
-/**
- * @brief Function for clearing a specific SPI event.
- *
- * @param[in] p_spi     SPI instance.
- * @param[in] spi_event Event to clear.
- */
-__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_spi,
-                                         nrf_spi_event_t spi_event);
-
-/**
- * @brief Function for checking the state of a specific SPI event.
- *
- * @param[in] p_spi     SPI instance.
- * @param[in] spi_event Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_spi,
-                                         nrf_spi_event_t spi_event);
-
-/**
- * @brief Function for getting the address of a specific SPI event register.
- *
- * @param[in] p_spi     SPI instance.
- * @param[in] spi_event Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type  * p_spi,
-                                                     nrf_spi_event_t spi_event);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_spi         SPI instance.
- * @param[in] spi_int_mask  Interrupts to enable.
- */
-__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_spi,
-                                        uint32_t spi_int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_spi         SPI instance.
- * @param[in] spi_int_mask  Interrupts to disable.
- */
-__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_spi,
-                                         uint32_t spi_int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_spi   SPI instance.
- * @param[in] spi_int Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_spi,
-                                              nrf_spi_int_mask_t spi_int);
-
-/**
- * @brief Function for enabling the SPI peripheral.
- *
- * @param[in] p_spi SPI instance.
- */
-__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_spi);
-
-/**
- * @brief Function for disabling the SPI peripheral.
- *
- * @param[in] p_spi SPI instance.
- */
-__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_spi);
-
-/**
- * @brief Function for configuring SPI pins.
- *
- * If a given signal is not needed, pass the @ref NRF_SPI_PIN_NOT_CONNECTED
- * value instead of its pin number.
- *
- * @param[in] p_spi     SPI instance.
- * @param[in] sck_pin   SCK pin number.
- * @param[in] mosi_pin  MOSI pin number.
- * @param[in] miso_pin  MISO pin number.
- */
-__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_spi,
-                                      uint32_t sck_pin,
-                                      uint32_t mosi_pin,
-                                      uint32_t miso_pin);
-
-/**
- * @brief Function for writing data to the SPI transmitter register.
- *
- * @param[in] p_spi SPI instance.
- * @param[in] data  TX data to send.
- */
-__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_spi, uint8_t data);
-
-/**
- * @brief Function for reading data from the SPI receiver register.
- *
- * @param[in] p_spi SPI instance.
- *
- * @return RX data received.
- */
-__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_spi);
-
-/**
- * @brief Function for setting the SPI master data rate.
- *
- * @param[in] p_spi     SPI instance.
- * @param[in] frequency SPI frequency.
- */
-__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_spi,
-                                           nrf_spi_frequency_t frequency);
-
-/**
- * @brief Function for setting the SPI configuration.
- *
- * @param[in] p_spi         SPI instance.
- * @param[in] spi_mode      SPI mode.
- * @param[in] spi_bit_order SPI bit order.
- */
-__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_spi,
-                                       nrf_spi_mode_t spi_mode,
-                                       nrf_spi_bit_order_t spi_bit_order);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_spi_event_clear(NRF_SPI_Type * p_spi,
-                                         nrf_spi_event_t spi_event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_spi_event_check(NRF_SPI_Type * p_spi,
-                                         nrf_spi_event_t spi_event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event);
-}
-
-__STATIC_INLINE uint32_t * nrf_spi_event_address_get(NRF_SPI_Type * p_spi,
-                                                     nrf_spi_event_t spi_event)
-{
-    return (uint32_t *)((uint8_t *)p_spi + (uint32_t)spi_event);
-}
-
-__STATIC_INLINE void nrf_spi_int_enable(NRF_SPI_Type * p_spi,
-                                        uint32_t spi_int_mask)
-{
-    p_spi->INTENSET = spi_int_mask;
-}
-
-__STATIC_INLINE void nrf_spi_int_disable(NRF_SPI_Type * p_spi,
-                                         uint32_t spi_int_mask)
-{
-    p_spi->INTENCLR = spi_int_mask;
-}
-
-__STATIC_INLINE bool nrf_spi_int_enable_check(NRF_SPI_Type * p_spi,
-                                              nrf_spi_int_mask_t spi_int)
-{
-    return (bool)(p_spi->INTENSET & spi_int);
-}
-
-__STATIC_INLINE void nrf_spi_enable(NRF_SPI_Type * p_spi)
-{
-    p_spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_spi_disable(NRF_SPI_Type * p_spi)
-{
-    p_spi->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_spi_pins_set(NRF_SPI_Type * p_spi,
-                                      uint32_t sck_pin,
-                                      uint32_t mosi_pin,
-                                      uint32_t miso_pin)
-{
-    p_spi->PSELSCK  = sck_pin;
-    p_spi->PSELMOSI = mosi_pin;
-    p_spi->PSELMISO = miso_pin;
-}
-
-__STATIC_INLINE void nrf_spi_txd_set(NRF_SPI_Type * p_spi, uint8_t data)
-{
-    p_spi->TXD = data;
-}
-
-__STATIC_INLINE uint8_t nrf_spi_rxd_get(NRF_SPI_Type * p_spi)
-{
-    return p_spi->RXD;
-}
-
-__STATIC_INLINE void nrf_spi_frequency_set(NRF_SPI_Type * p_spi,
-                                           nrf_spi_frequency_t frequency)
-{
-    p_spi->FREQUENCY = frequency;
-}
-
-__STATIC_INLINE void nrf_spi_configure(NRF_SPI_Type * p_spi,
-                                       nrf_spi_mode_t spi_mode,
-                                       nrf_spi_bit_order_t spi_bit_order)
-{
-    uint32_t config = (spi_bit_order == NRF_SPI_BIT_ORDER_MSB_FIRST ?
-        SPI_CONFIG_ORDER_MsbFirst : SPI_CONFIG_ORDER_LsbFirst);
-    switch (spi_mode)
-    {
-    default:
-    case NRF_SPI_MODE_0:
-        config |= (SPI_CONFIG_CPOL_ActiveHigh << SPI_CONFIG_CPOL_Pos) |
-                  (SPI_CONFIG_CPHA_Leading    << SPI_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPI_MODE_1:
-        config |= (SPI_CONFIG_CPOL_ActiveHigh << SPI_CONFIG_CPOL_Pos) |
-                  (SPI_CONFIG_CPHA_Trailing   << SPI_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPI_MODE_2:
-        config |= (SPI_CONFIG_CPOL_ActiveLow  << SPI_CONFIG_CPOL_Pos) |
-                  (SPI_CONFIG_CPHA_Leading    << SPI_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPI_MODE_3:
-        config |= (SPI_CONFIG_CPOL_ActiveLow  << SPI_CONFIG_CPOL_Pos) |
-                  (SPI_CONFIG_CPHA_Trailing   << SPI_CONFIG_CPHA_Pos);
-        break;
-    }
-    p_spi->CONFIG = config;
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_SPI_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/hal/nrf_spim.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spim.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spim.h
deleted file mode 100644
index 7c05956..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spim.h
+++ /dev/null
@@ -1,528 +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.
- *
- */
-
-/**
- * @defgroup nrf_spim_hal SPIM HAL
- * @{
- * @ingroup nrf_spi_master
- *
- * @brief Hardware access layer for accessing the SPIM peripheral.
- */
-
-#ifndef NRF_SPIM_H__
-#define NRF_SPIM_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This value can be used as a parameter for the @ref nrf_spim_pins_set
- *        function to specify that a given SPI signal (SCK, MOSI, or MISO)
- *        shall not be connected to a physical pin.
- */
-#define NRF_SPIM_PIN_NOT_CONNECTED  0xFFFFFFFF
-
-
-/**
- * @brief SPIM tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_SPIM_TASK_START   = offsetof(NRF_SPIM_Type, TASKS_START),   ///< Start SPI transaction.
-    NRF_SPIM_TASK_STOP    = offsetof(NRF_SPIM_Type, TASKS_STOP),    ///< Stop SPI transaction.
-    NRF_SPIM_TASK_SUSPEND = offsetof(NRF_SPIM_Type, TASKS_SUSPEND), ///< Suspend SPI transaction.
-    NRF_SPIM_TASK_RESUME  = offsetof(NRF_SPIM_Type, TASKS_RESUME)   ///< Resume SPI transaction.
-    /*lint -restore*/
-} nrf_spim_task_t;
-
-/**
- * @brief SPIM events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_SPIM_EVENT_STOPPED = offsetof(NRF_SPIM_Type, EVENTS_STOPPED), ///< SPI transaction has stopped.
-    NRF_SPIM_EVENT_ENDRX   = offsetof(NRF_SPIM_Type, EVENTS_ENDRX),   ///< End of RXD buffer reached.
-#ifdef NRF52
-    NRF_SPIM_EVENT_END     = offsetof(NRF_SPIM_Type, EVENTS_END),     ///< End of RXD buffer and TXD buffer reached.
-#endif
-    NRF_SPIM_EVENT_ENDTX   = offsetof(NRF_SPIM_Type, EVENTS_ENDTX),   ///< End of TXD buffer reached.
-    NRF_SPIM_EVENT_STARTED = offsetof(NRF_SPIM_Type, EVENTS_STARTED)  ///< Transaction started.
-    /*lint -restore*/
-} nrf_spim_event_t;
-
-#ifdef NRF52
-/**
- * @brief SPIM shortcuts.
- */
-typedef enum
-{
-    NRF_SPIM_SHORT_END_START_MASK = SPIM_SHORTS_END_START_Msk ///< Shortcut between END event and START task.
-} nrf_spim_short_mask_t;
-#endif
-
-/**
- * @brief SPIM interrupts.
- */
-typedef enum
-{
-    NRF_SPIM_INT_STOPPED_MASK = SPIM_INTENSET_STOPPED_Msk, ///< Interrupt on STOPPED event.
-    NRF_SPIM_INT_ENDRX_MASK   = SPIM_INTENSET_ENDRX_Msk,   ///< Interrupt on ENDRX event.
-#ifdef NRF52
-    NRF_SPIM_INT_END_MASK     = SPIM_INTENSET_END_Msk,     ///< Interrupt on END event.
-#endif
-    NRF_SPIM_INT_ENDTX_MASK   = SPIM_INTENSET_ENDTX_Msk,   ///< Interrupt on ENDTX event.
-    NRF_SPIM_INT_STARTED_MASK = SPIM_INTENSET_STARTED_Msk  ///< Interrupt on STARTED event.
-} nrf_spim_int_mask_t;
-
-/**
- * @brief SPI master data rates.
- */
-typedef enum
-{
-    NRF_SPIM_FREQ_125K = SPIM_FREQUENCY_FREQUENCY_K125,   ///< 125 kbps.
-    NRF_SPIM_FREQ_250K = SPIM_FREQUENCY_FREQUENCY_K250,   ///< 250 kbps.
-    NRF_SPIM_FREQ_500K = SPIM_FREQUENCY_FREQUENCY_K500,   ///< 500 kbps.
-    NRF_SPIM_FREQ_1M   = SPIM_FREQUENCY_FREQUENCY_M1,     ///< 1 Mbps.
-    NRF_SPIM_FREQ_2M   = SPIM_FREQUENCY_FREQUENCY_M2,     ///< 2 Mbps.
-    NRF_SPIM_FREQ_4M   = SPIM_FREQUENCY_FREQUENCY_M4,     ///< 4 Mbps.
-    // [conversion to 'int' needed to prevent compilers from complaining
-    //  that the provided value (0x80000000UL) is out of range of "int"]
-    NRF_SPIM_FREQ_8M   = (int)SPIM_FREQUENCY_FREQUENCY_M8 ///< 8 Mbps.
-} nrf_spim_frequency_t;
-
-/**
- * @brief SPI modes.
- */
-typedef enum
-{
-    NRF_SPIM_MODE_0, ///< SCK active high, sample on leading edge of clock.
-    NRF_SPIM_MODE_1, ///< SCK active high, sample on trailing edge of clock.
-    NRF_SPIM_MODE_2, ///< SCK active low, sample on leading edge of clock.
-    NRF_SPIM_MODE_3  ///< SCK active low, sample on trailing edge of clock.
-} nrf_spim_mode_t;
-
-/**
- * @brief SPI bit orders.
- */
-typedef enum
-{
-    NRF_SPIM_BIT_ORDER_MSB_FIRST = SPIM_CONFIG_ORDER_MsbFirst, ///< Most significant bit shifted out first.
-    NRF_SPIM_BIT_ORDER_LSB_FIRST = SPIM_CONFIG_ORDER_LsbFirst  ///< Least significant bit shifted out first.
-} nrf_spim_bit_order_t;
-
-
-/**
- * @brief Function for activating a specific SPIM task.
- *
- * @param[in] p_spim    SPIM instance.
- * @param[in] spim_task Task to activate.
- */
-__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_spim,
-                                           nrf_spim_task_t spim_task);
-
-/**
- * @brief Function for getting the address of a specific SPIM task register.
- *
- * @param[in] p_spim    SPIM instance.
- * @param[in] spim_task Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_spim,
-                                                   nrf_spim_task_t spim_task);
-
-/**
- * @brief Function for clearing a specific SPIM event.
- *
- * @param[in] p_spim     SPIM instance.
- * @param[in] spim_event Event to clear.
- */
-__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_spim,
-                                          nrf_spim_event_t spim_event);
-
-/**
- * @brief Function for checking the state of a specific SPIM event.
- *
- * @param[in] p_spim     SPIM instance.
- * @param[in] spim_event Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_spim,
-                                          nrf_spim_event_t spim_event);
-
-/**
- * @brief Function for getting the address of a specific SPIM event register.
- *
- * @param[in] p_spim     SPIM instance.
- * @param[in] spim_event Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type  * p_spim,
-                                                    nrf_spim_event_t spim_event);
-#ifdef NRF52
-/**
- * @brief Function for enabling specified shortcuts.
- *
- * @param[in] p_spim           SPIM instance.
- * @param[in] spim_shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_spim,
-                                            uint32_t spim_shorts_mask);
-
-/**
- * @brief Function for disabling specified shortcuts.
- *
- * @param[in] p_spim           SPIM instance.
- * @param[in] spim_shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_spim,
-                                             uint32_t spim_shorts_mask);
-
-/**
- * @brief Function for getting shorts setting.
- *
- * @param[in] p_spim           SPIM instance.
- */
-__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_spim);
-#endif
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_spim        SPIM instance.
- * @param[in] spim_int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_spim,
-                                         uint32_t spim_int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_spim        SPIM instance.
- * @param[in] spim_int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_spim,
-                                          uint32_t spim_int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_spim   SPIM instance.
- * @param[in] spim_int Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_spim,
-                                               nrf_spim_int_mask_t spim_int);
-
-/**
- * @brief Function for enabling the SPIM peripheral.
- *
- * @param[in] p_spim SPIM instance.
- */
-__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_spim);
-
-/**
- * @brief Function for disabling the SPIM peripheral.
- *
- * @param[in] p_spim SPIM instance.
- */
-__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_spim);
-
-/**
- * @brief Function for configuring SPIM pins.
- *
- * If a given signal is not needed, pass the @ref NRF_SPIM_PIN_NOT_CONNECTED
- * value instead of its pin number.
- *
- * @param[in] p_spim    SPIM instance.
- * @param[in] sck_pin   SCK pin number.
- * @param[in] mosi_pin  MOSI pin number.
- * @param[in] miso_pin  MISO pin number.
- */
-__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_spim,
-                                       uint32_t sck_pin,
-                                       uint32_t mosi_pin,
-                                       uint32_t miso_pin);
-
-/**
- * @brief Function for setting the SPI master data rate.
- *
- * @param[in] p_spim    SPIM instance.
- * @param[in] frequency SPI frequency.
- */
-__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_spim,
-                                            nrf_spim_frequency_t frequency);
-
-/**
- * @brief Function for setting the transmit buffer.
- *
- * @param[in]  p_spim   SPIM instance.
- * @param[in]  p_buffer Pointer to the buffer with data to send.
- * @param[in]  length   Maximum number of data bytes to transmit.
- */
-__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_spim,
-                                            uint8_t const * p_buffer,
-                                            uint8_t         length);
-
-/**
- * @brief Function for setting the receive buffer.
- *
- * @param[in] p_spim   SPIM instance.
- * @param[in] p_buffer Pointer to the buffer for received data.
- * @param[in] length   Maximum number of data bytes to receive.
- */
-__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_spim,
-                                            uint8_t * p_buffer,
-                                            uint8_t   length);
-
-/**
- * @brief Function for setting the SPI configuration.
- *
- * @param[in] p_spim        SPIM instance.
- * @param[in] spi_mode      SPI mode.
- * @param[in] spi_bit_order SPI bit order.
- */
-__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_spim,
-                                        nrf_spim_mode_t spi_mode,
-                                        nrf_spim_bit_order_t spi_bit_order);
-
-/**
- * @brief Function for setting the over-read character.
- *
- * @param[in] p_spim SPIM instance.
- * @param[in] orc    Over-read character that is clocked out in case of
- *                   an over-read of the TXD buffer.
- */
-__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_spim,
-                                      uint8_t orc);
-
-#ifdef NRF52
-/**
- * @brief Function for enabling the TX list feature.
- *
- * @param[in] p_spim SPIM instance.
- */
-__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_spim);
-
-/**
- * @brief Function for disabling the TX list feature.
- *
- * @param[in] p_spim SPIM instance.
- */
-__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_spim);
-
-/**
- * @brief Function for enabling the RX list feature.
- *
- * @param[in] p_spim SPIM instance.
- */
-__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_spim);
-
-/**
- * @brief Function for disabling the RX list feature.
- *
- * @param[in] p_spim SPIM instance.
- */
-__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_spim);
-#endif
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_spim_task_trigger(NRF_SPIM_Type * p_spim,
-                                           nrf_spim_task_t spim_task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_spim_task_address_get(NRF_SPIM_Type * p_spim,
-                                                   nrf_spim_task_t spim_task)
-{
-    return (uint32_t)((uint8_t *)p_spim + (uint32_t)spim_task);
-}
-
-__STATIC_INLINE void nrf_spim_event_clear(NRF_SPIM_Type * p_spim,
-                                          nrf_spim_event_t spim_event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_spim_event_check(NRF_SPIM_Type * p_spim,
-                                          nrf_spim_event_t spim_event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_spim + (uint32_t)spim_event);
-}
-
-__STATIC_INLINE uint32_t nrf_spim_event_address_get(NRF_SPIM_Type * p_spim,
-                                                    nrf_spim_event_t spim_event)
-{
-    return (uint32_t)((uint8_t *)p_spim + (uint32_t)spim_event);
-}
-
-#ifdef NRF52
-__STATIC_INLINE void nrf_spim_shorts_enable(NRF_SPIM_Type * p_spim,
-                                            uint32_t spim_shorts_mask)
-{
-    p_spim->SHORTS |= spim_shorts_mask;
-}
-
-__STATIC_INLINE void nrf_spim_shorts_disable(NRF_SPIM_Type * p_spim,
-                                             uint32_t spim_shorts_mask)
-{
-    p_spim->SHORTS &= ~(spim_shorts_mask);
-}
-
-__STATIC_INLINE uint32_t nrf_spim_shorts_get(NRF_SPIM_Type * p_spim)
-{
-    return p_spim->SHORTS;
-}
-#endif
-__STATIC_INLINE void nrf_spim_int_enable(NRF_SPIM_Type * p_spim,
-                                         uint32_t spim_int_mask)
-{
-    p_spim->INTENSET = spim_int_mask;
-}
-
-__STATIC_INLINE void nrf_spim_int_disable(NRF_SPIM_Type * p_spim,
-                                          uint32_t spim_int_mask)
-{
-    p_spim->INTENCLR = spim_int_mask;
-}
-
-__STATIC_INLINE bool nrf_spim_int_enable_check(NRF_SPIM_Type * p_spim,
-                                               nrf_spim_int_mask_t spim_int)
-{
-    return (bool)(p_spim->INTENSET & spim_int);
-}
-
-__STATIC_INLINE void nrf_spim_enable(NRF_SPIM_Type * p_spim)
-{
-    p_spim->ENABLE = (SPIM_ENABLE_ENABLE_Enabled << SPIM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_spim_disable(NRF_SPIM_Type * p_spim)
-{
-    p_spim->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_spim_pins_set(NRF_SPIM_Type * p_spim,
-                                       uint32_t sck_pin,
-                                       uint32_t mosi_pin,
-                                       uint32_t miso_pin)
-{
-    p_spim->PSEL.SCK  = sck_pin;
-    p_spim->PSEL.MOSI = mosi_pin;
-    p_spim->PSEL.MISO = miso_pin;
-}
-
-__STATIC_INLINE void nrf_spim_frequency_set(NRF_SPIM_Type * p_spim,
-                                            nrf_spim_frequency_t frequency)
-{
-    p_spim->FREQUENCY = frequency;
-}
-
-__STATIC_INLINE void nrf_spim_tx_buffer_set(NRF_SPIM_Type * p_spim,
-                                            uint8_t const * p_buffer,
-                                            uint8_t         length)
-{
-    p_spim->TXD.PTR    = (uint32_t)p_buffer;
-    p_spim->TXD.MAXCNT = length;
-}
-
-__STATIC_INLINE void nrf_spim_rx_buffer_set(NRF_SPIM_Type * p_spim,
-                                            uint8_t * p_buffer,
-                                            uint8_t   length)
-{
-    p_spim->RXD.PTR    = (uint32_t)p_buffer;
-    p_spim->RXD.MAXCNT = length;
-}
-
-__STATIC_INLINE void nrf_spim_configure(NRF_SPIM_Type * p_spim,
-                                        nrf_spim_mode_t spi_mode,
-                                        nrf_spim_bit_order_t spi_bit_order)
-{
-    uint32_t config = (spi_bit_order == NRF_SPIM_BIT_ORDER_MSB_FIRST ?
-        SPIM_CONFIG_ORDER_MsbFirst : SPIM_CONFIG_ORDER_LsbFirst);
-    switch (spi_mode)
-    {
-    default:
-    case NRF_SPIM_MODE_0:
-        config |= (SPIM_CONFIG_CPOL_ActiveHigh << SPIM_CONFIG_CPOL_Pos) |
-                  (SPIM_CONFIG_CPHA_Leading    << SPIM_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPIM_MODE_1:
-        config |= (SPIM_CONFIG_CPOL_ActiveHigh << SPIM_CONFIG_CPOL_Pos) |
-                  (SPIM_CONFIG_CPHA_Trailing   << SPIM_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPIM_MODE_2:
-        config |= (SPIM_CONFIG_CPOL_ActiveLow  << SPIM_CONFIG_CPOL_Pos) |
-                  (SPIM_CONFIG_CPHA_Leading    << SPIM_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPIM_MODE_3:
-        config |= (SPIM_CONFIG_CPOL_ActiveLow  << SPIM_CONFIG_CPOL_Pos) |
-                  (SPIM_CONFIG_CPHA_Trailing   << SPIM_CONFIG_CPHA_Pos);
-        break;
-    }
-    p_spim->CONFIG = config;
-}
-
-__STATIC_INLINE void nrf_spim_orc_set(NRF_SPIM_Type * p_spim,
-                                      uint8_t orc)
-{
-    p_spim->ORC = orc;
-}
-
-#ifdef NRF52
-__STATIC_INLINE void nrf_spim_tx_list_enable(NRF_SPIM_Type * p_spim)
-{
-    p_spim->TXD.LIST = 1;
-}
-
-__STATIC_INLINE void nrf_spim_tx_list_disable(NRF_SPIM_Type * p_spim)
-{
-    p_spim->TXD.LIST = 0;
-}
-
-__STATIC_INLINE void nrf_spim_rx_list_enable(NRF_SPIM_Type * p_spim)
-{
-    p_spim->RXD.LIST = 1;
-}
-
-__STATIC_INLINE void nrf_spim_rx_list_disable(NRF_SPIM_Type * p_spim)
-{
-    p_spim->RXD.LIST = 0;
-}
-#endif
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_SPIM_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/hal/nrf_spis.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spis.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spis.h
deleted file mode 100644
index 273e048..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_spis.h
+++ /dev/null
@@ -1,520 +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.
- *
- */
-
-/**
- * @defgroup nrf_spis_hal SPIS HAL
- * @{
- * @ingroup nrf_spis
- *
- * @brief Hardware access layer for accessing the SPIS peripheral.
- */
-
-#ifndef NRF_SPIS_H__
-#define NRF_SPIS_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This value can be used as a parameter for the @ref nrf_spis_pins_set
- *        function to specify that a given SPI signal (SCK, MOSI, or MISO)
- *        shall not be connected to a physical pin.
- */
-#define NRF_SPIS_PIN_NOT_CONNECTED  0xFFFFFFFF
-
-
-/**
- * @brief SPIS tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_SPIS_TASK_ACQUIRE = offsetof(NRF_SPIS_Type, TASKS_ACQUIRE), ///< Acquire SPI semaphore.
-    NRF_SPIS_TASK_RELEASE = offsetof(NRF_SPIS_Type, TASKS_RELEASE), ///< Release SPI semaphore, enabling the SPI slave to acquire it.
-    /*lint -restore*/
-} nrf_spis_task_t;
-
-/**
- * @brief SPIS events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_SPIS_EVENT_END      = offsetof(NRF_SPIS_Type, EVENTS_END),     ///< Granted transaction completed.
-    NRF_SPIS_EVENT_ACQUIRED = offsetof(NRF_SPIS_Type, EVENTS_ACQUIRED) ///< Semaphore acquired.
-    /*lint -restore*/
-} nrf_spis_event_t;
-
-/**
- * @brief SPIS shortcuts.
- */
-typedef enum
-{
-    NRF_SPIS_SHORT_END_ACQUIRE = SPIS_SHORTS_END_ACQUIRE_Msk ///< Shortcut between END event and ACQUIRE task.
-} nrf_spis_short_mask_t;
-
-/**
- * @brief SPIS interrupts.
- */
-typedef enum
-{
-    NRF_SPIS_INT_END_MASK      = SPIS_INTENSET_END_Msk,     ///< Interrupt on END event.
-    NRF_SPIS_INT_ACQUIRED_MASK = SPIS_INTENSET_ACQUIRED_Msk ///< Interrupt on ACQUIRED event.
-} nrf_spis_int_mask_t;
-
-/**
- * @brief SPI modes.
- */
-typedef enum
-{
-    NRF_SPIS_MODE_0, ///< SCK active high, sample on leading edge of clock.
-    NRF_SPIS_MODE_1, ///< SCK active high, sample on trailing edge of clock.
-    NRF_SPIS_MODE_2, ///< SCK active low, sample on leading edge of clock.
-    NRF_SPIS_MODE_3  ///< SCK active low, sample on trailing edge of clock.
-} nrf_spis_mode_t;
-
-/**
- * @brief SPI bit orders.
- */
-typedef enum
-{
-    NRF_SPIS_BIT_ORDER_MSB_FIRST = SPIS_CONFIG_ORDER_MsbFirst, ///< Most significant bit shifted out first.
-    NRF_SPIS_BIT_ORDER_LSB_FIRST = SPIS_CONFIG_ORDER_LsbFirst  ///< Least significant bit shifted out first.
-} nrf_spis_bit_order_t;
-
-/**
- * @brief SPI semaphore status.
- */
-typedef enum
-{
-    NRF_SPIS_SEMSTAT_FREE       = 0, ///< Semaphore is free.
-    NRF_SPIS_SEMSTAT_CPU        = 1, ///< Semaphore is assigned to the CPU.
-    NRF_SPIS_SEMSTAT_SPIS       = 2, ///< Semaphore is assigned to the SPI slave.
-    NRF_SPIS_SEMSTAT_CPUPENDING = 3  ///< Semaphore is assigned to the SPI, but a handover to the CPU is pending.
-} nrf_spis_semstat_t;
-
-/**
- * @brief SPIS status.
- */
-typedef enum
-{
-    NRF_SPIS_STATUS_OVERREAD = SPIS_STATUS_OVERREAD_Msk, ///< TX buffer over-read detected and prevented.
-    NRF_SPIS_STATUS_OVERFLOW = SPIS_STATUS_OVERFLOW_Msk  ///< RX buffer overflow detected and prevented.
-} nrf_spis_status_mask_t;
-
-/**
- * @brief Function for activating a specific SPIS task.
- *
- * @param[in] p_spis    SPIS instance.
- * @param[in] spis_task Task to activate.
- */
-__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_spis,
-                                           nrf_spis_task_t spis_task);
-
-/**
- * @brief Function for getting the address of a specific SPIS task register.
- *
- * @param[in] p_spis    SPIS instance.
- * @param[in] spis_task Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_spis,
-                                                   nrf_spis_task_t spis_task);
-
-/**
- * @brief Function for clearing a specific SPIS event.
- *
- * @param[in] p_spis     SPIS instance.
- * @param[in] spis_event Event to clear.
- */
-__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type * p_spis,
-                                          nrf_spis_event_t spis_event);
-
-/**
- * @brief Function for checking the state of a specific SPIS event.
- *
- * @param[in] p_spis     SPIS instance.
- * @param[in] spis_event Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_spis,
-                                          nrf_spis_event_t spis_event);
-
-/**
- * @brief Function for getting the address of a specific SPIS event register.
- *
- * @param[in] p_spis     SPIS instance.
- * @param[in] spis_event Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_spis,
-                                                    nrf_spis_event_t spis_event);
-
-/**
- * @brief Function for enabling specified shortcuts.
- *
- * @param[in] p_spis           SPIS instance.
- * @param[in] spis_shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_spis,
-                                            uint32_t spis_shorts_mask);
-
-/**
- * @brief Function for disabling specified shortcuts.
- *
- * @param[in] p_spis           SPIS instance.
- * @param[in] spis_shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_spis,
-                                             uint32_t spis_shorts_mask);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_spis        SPIS instance.
- * @param[in] spis_int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_spis,
-                                         uint32_t spis_int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_spis        SPIS instance.
- * @param[in] spis_int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_spis,
-                                          uint32_t spis_int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_spis   SPIS instance.
- * @param[in] spis_int Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_spis,
-                                               nrf_spis_int_mask_t spis_int);
-
-/**
- * @brief Function for enabling the SPIS peripheral.
- *
- * @param[in] p_spis SPIS instance.
- */
-__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_spis);
-
-/**
- * @brief Function for disabling the SPIS peripheral.
- *
- * @param[in] p_spis SPIS instance.
- */
-__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_spis);
-
-/**
- * @brief Function for retrieving the SPIS semaphore status.
- *
- * @param[in] p_spis SPIS instance.
- *
- * @returns Current semaphore status.
- */
-__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_spis);
-
-/**
- * @brief Function for retrieving the SPIS status.
- *
- * @param[in] p_spis SPIS instance.
- *
- * @returns Current SPIS status.
- */
-__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_spis);
-
-/**
- * @brief Function for configuring SPIS pins.
- *
- * If a given signal is not needed, pass the @ref NRF_SPIS_PIN_NOT_CONNECTED
- * value instead of its pin number.
- *
- * @param[in] p_spis    SPIS instance.
- * @param[in] sck_pin   SCK pin number.
- * @param[in] mosi_pin  MOSI pin number.
- * @param[in] miso_pin  MISO pin number.
- * @param[in] csn_pin   CSN pin number.
- */
-__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_spis,
-                                       uint32_t sck_pin,
-                                       uint32_t mosi_pin,
-                                       uint32_t miso_pin,
-                                       uint32_t csn_pin);
-
-/**
- * @brief Function for setting the transmit buffer.
- *
- * @param[in]  p_spis   SPIS instance.
- * @param[in]  p_buffer Pointer to the buffer that contains the data to send.
- * @param[in]  length   Maximum number of data bytes to transmit.
- */
-__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_spis,
-                                            uint8_t const * p_buffer,
-                                            uint8_t         length);
-
-/**
- * @brief Function for setting the receive buffer.
- *
- * @param[in] p_spis   SPIS instance.
- * @param[in] p_buffer Pointer to the buffer for received data.
- * @param[in] length   Maximum number of data bytes to receive.
- */
-__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_spis,
-                                            uint8_t * p_buffer,
-                                            uint8_t   length);
-
-/**
- * @brief Function for getting the number of bytes transmitted
- *        in the last granted transaction.
- *
- * @param[in]  p_spis   SPIS instance.
- *
- * @returns Number of bytes transmitted.
- */
-__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_spis);
-
-/**
- * @brief Function for getting the number of bytes received
- *        in the last granted transaction.
- *
- * @param[in]  p_spis   SPIS instance.
- *
- * @returns Number of bytes received.
- */
-__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_spis);
-
-/**
- * @brief Function for setting the SPI configuration.
- *
- * @param[in] p_spis        SPIS instance.
- * @param[in] spi_mode      SPI mode.
- * @param[in] spi_bit_order SPI bit order.
- */
-__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_spis,
-                                        nrf_spis_mode_t spi_mode,
-                                        nrf_spis_bit_order_t spi_bit_order);
-
-/**
- * @brief Function for setting the default character.
- *
- * @param[in] p_spis SPIS instance.
- * @param[in] def    Default character that is clocked out in case of
- *                   an overflow of the RXD buffer.
- */
-__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_spis,
-                                      uint8_t def);
-
-/**
- * @brief Function for setting the over-read character.
- *
- * @param[in] p_spis SPIS instance.
- * @param[in] orc    Over-read character that is clocked out in case of
- *                   an over-read of the TXD buffer.
- */
-__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_spis,
-                                      uint8_t orc);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_spis_task_trigger(NRF_SPIS_Type * p_spis,
-                                           nrf_spis_task_t spis_task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_spis_task_address_get(NRF_SPIS_Type const * p_spis,
-                                                   nrf_spis_task_t spis_task)
-{
-    return (uint32_t)p_spis + (uint32_t)spis_task;
-}   
-
-__STATIC_INLINE void nrf_spis_event_clear(NRF_SPIS_Type *  p_spis,
-                                          nrf_spis_event_t spis_event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_spis_event_check(NRF_SPIS_Type const * p_spis,
-                                          nrf_spis_event_t spis_event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_spis + (uint32_t)spis_event);
-}
-
-__STATIC_INLINE uint32_t nrf_spis_event_address_get(NRF_SPIS_Type const * p_spis,
-                                                    nrf_spis_event_t spis_event)
-{
-    return (uint32_t)p_spis + (uint32_t)spis_event;
-}
-
-__STATIC_INLINE void nrf_spis_shorts_enable(NRF_SPIS_Type * p_spis,
-                                            uint32_t spis_shorts_mask)
-{
-    p_spis->SHORTS |= spis_shorts_mask;
-}
-
-__STATIC_INLINE void nrf_spis_shorts_disable(NRF_SPIS_Type * p_spis,
-                                             uint32_t spis_shorts_mask)
-{
-    p_spis->SHORTS &= ~(spis_shorts_mask);
-}
-
-__STATIC_INLINE void nrf_spis_int_enable(NRF_SPIS_Type * p_spis,
-                                         uint32_t spis_int_mask)
-{
-    p_spis->INTENSET = spis_int_mask;
-}
-
-__STATIC_INLINE void nrf_spis_int_disable(NRF_SPIS_Type * p_spis,
-                                          uint32_t spis_int_mask)
-{
-    p_spis->INTENCLR = spis_int_mask;
-}
-
-__STATIC_INLINE bool nrf_spis_int_enable_check(NRF_SPIS_Type const * p_spis,
-                                               nrf_spis_int_mask_t spis_int)
-{
-    return (bool)(p_spis->INTENSET & spis_int);
-}
-
-__STATIC_INLINE void nrf_spis_enable(NRF_SPIS_Type * p_spis)
-{
-    p_spis->ENABLE = (SPIS_ENABLE_ENABLE_Enabled << SPIS_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_spis_disable(NRF_SPIS_Type * p_spis)
-{
-    p_spis->ENABLE = (SPIS_ENABLE_ENABLE_Disabled << SPIS_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE nrf_spis_semstat_t nrf_spis_semaphore_status_get(NRF_SPIS_Type * p_spis)
-{
-    return (nrf_spis_semstat_t) ((p_spis->SEMSTAT & SPIS_SEMSTAT_SEMSTAT_Msk) 
-                                 >> SPIS_SEMSTAT_SEMSTAT_Pos);
-}
-
-__STATIC_INLINE nrf_spis_status_mask_t nrf_spis_status_get(NRF_SPIS_Type * p_spis)
-{
-    return (nrf_spis_status_mask_t) p_spis->STATUS;
-}
-
-__STATIC_INLINE void nrf_spis_pins_set(NRF_SPIS_Type * p_spis,
-                                       uint32_t sck_pin,
-                                       uint32_t mosi_pin,
-                                       uint32_t miso_pin,
-                                       uint32_t csn_pin)
-{
-    p_spis->PSELSCK  = sck_pin;
-    p_spis->PSELMOSI = mosi_pin;
-    p_spis->PSELMISO = miso_pin;
-    p_spis->PSELCSN  = csn_pin;
-}
-
-__STATIC_INLINE void nrf_spis_tx_buffer_set(NRF_SPIS_Type * p_spis,
-                                            uint8_t const * p_buffer,
-                                            uint8_t         length)
-{
-    p_spis->TXDPTR = (uint32_t)p_buffer;
-    p_spis->MAXTX  = length;
-}
-
-__STATIC_INLINE void nrf_spis_rx_buffer_set(NRF_SPIS_Type * p_spis,
-                                            uint8_t * p_buffer,
-                                            uint8_t   length)
-{
-    p_spis->RXDPTR = (uint32_t)p_buffer;
-    p_spis->MAXRX  = length;
-}
-
-__STATIC_INLINE uint8_t nrf_spis_tx_amount_get(NRF_SPIS_Type const * p_spis)
-{
-    return (uint8_t) p_spis->AMOUNTRX;
-}
-
-__STATIC_INLINE uint8_t nrf_spis_rx_amount_get(NRF_SPIS_Type const * p_spis)
-{
-    return (uint8_t) p_spis->AMOUNTTX;
-}
-
-__STATIC_INLINE void nrf_spis_configure(NRF_SPIS_Type * p_spis,
-                                        nrf_spis_mode_t spi_mode,
-                                        nrf_spis_bit_order_t spi_bit_order)
-{
-    uint32_t config = (spi_bit_order == NRF_SPIS_BIT_ORDER_MSB_FIRST ?
-        SPIS_CONFIG_ORDER_MsbFirst : SPIS_CONFIG_ORDER_LsbFirst);
-
-    switch (spi_mode)
-    {
-    default:
-    case NRF_SPIS_MODE_0:
-        config |= (SPIS_CONFIG_CPOL_ActiveHigh << SPIS_CONFIG_CPOL_Pos) |
-                  (SPIS_CONFIG_CPHA_Leading    << SPIS_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPIS_MODE_1:
-        config |= (SPIS_CONFIG_CPOL_ActiveHigh << SPIS_CONFIG_CPOL_Pos) |
-                  (SPIS_CONFIG_CPHA_Trailing   << SPIS_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPIS_MODE_2:
-        config |= (SPIS_CONFIG_CPOL_ActiveLow  << SPIS_CONFIG_CPOL_Pos) |
-                  (SPIS_CONFIG_CPHA_Leading    << SPIS_CONFIG_CPHA_Pos);
-        break;
-
-    case NRF_SPIS_MODE_3:
-        config |= (SPIS_CONFIG_CPOL_ActiveLow  << SPIS_CONFIG_CPOL_Pos) |
-                  (SPIS_CONFIG_CPHA_Trailing   << SPIS_CONFIG_CPHA_Pos);
-        break;
-    }
-    p_spis->CONFIG = config;
-}
-
-__STATIC_INLINE void nrf_spis_orc_set(NRF_SPIS_Type * p_spis,
-                                      uint8_t orc)
-{
-    p_spis->ORC = orc;
-}
-
-__STATIC_INLINE void nrf_spis_def_set(NRF_SPIS_Type * p_spis,
-                                      uint8_t def)
-{
-    p_spis->DEF = def;
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_SPIS_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/hal/nrf_temp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_temp.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_temp.h
deleted file mode 100644
index 2075bd6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_temp.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (c) 2012 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.
- *
- */
-
-#ifndef NRF_TEMP_H__
-#define NRF_TEMP_H__
-
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
-* @defgroup nrf_temperature TEMP (temperature) abstraction
-* @{
-* @ingroup nrf_drivers temperature_example
-* @brief Temperature module init and read functions.
-*
-*/
-
-/**@cond NO_DOXYGEN */
-#define MASK_SIGN           (0x00000200UL)
-#define MASK_SIGN_EXTENSION (0xFFFFFC00UL)
-
-/**
- * @brief Function for preparing the temp module for temperature measurement.
- *
- * This function initializes the TEMP module and writes to the hidden configuration register.
- */
-static __INLINE void nrf_temp_init(void)
-{
-    /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */
-    *(uint32_t *) 0x4000C504 = 0;
-}
-
-/**
- * @brief Function for reading temperature measurement.
- *
- * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value.
- */
-static __INLINE int32_t nrf_temp_read(void)
-{    
-    /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */
-    return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP);    
-}
-/**@endcond */
-
-/** @} */
-
-#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/drivers_nrf/hal/nrf_timer.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_timer.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_timer.h
deleted file mode 100644
index c252506..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_timer.h
+++ /dev/null
@@ -1,584 +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.
- *
- */
-
-/**
- * @defgroup nrf_timer_hal Timer HAL
- * @{
- * @ingroup nrf_timer
- *
- * @brief Hardware access layer for accessing the timer peripheral.
- */
-
-#ifndef NRF_TIMER_H__
-#define NRF_TIMER_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-#include "nrf_assert.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Macro for validating the correctness of the BIT_WIDTH setting.
- */
-#ifdef NRF51
-    /**
-     * In the nRF51 Series, timer instance 0 supports all available bit widths.
-     * The other two instances support only 8 and 16 bits.
-     */
-    #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_timer, bit_width) \
-        ((p_timer == NRF_TIMER0) || (bit_width <= NRF_TIMER_BIT_WIDTH_16))
-#else
-    /**
-     * In the nRF52 Series, all timer instances support all available bit widths.
-     */
-    #define NRF_TIMER_IS_BIT_WIDTH_VALID(p_timer, bit_width) true
-#endif
-
-/**
- * @brief Macro for getting the number of capture/compare channels available
- *        in a given timer instance.
- */
-#ifdef NRF51
-    #define NRF_TIMER_CC_CHANNEL_COUNT(id)  4
-#else
-    #define NRF_TIMER_CC_CHANNEL_COUNT(id)  ((id) <= 2 ? 4 : 6)
-#endif
-
-
-/**
- * @brief Timer tasks.
- */
-typedef enum
-{
-    /*lint -save -e30 -esym(628,__INTADDR__)*/
-    NRF_TIMER_TASK_START    = offsetof(NRF_TIMER_Type, TASKS_START),      ///< Task for starting the timer.
-    NRF_TIMER_TASK_STOP     = offsetof(NRF_TIMER_Type, TASKS_STOP),       ///< Task for stopping the timer.
-    NRF_TIMER_TASK_COUNT    = offsetof(NRF_TIMER_Type, TASKS_COUNT),      ///< Task for incrementing the timer (in counter mode).
-    NRF_TIMER_TASK_CLEAR    = offsetof(NRF_TIMER_Type, TASKS_CLEAR),      ///< Task for resetting the timer value.
-    NRF_TIMER_TASK_SHUTDOWN = offsetof(NRF_TIMER_Type, TASKS_SHUTDOWN),   ///< Task for powering off the timer.
-    NRF_TIMER_TASK_CAPTURE0 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[0]), ///< Task for capturing the timer value on channel 0.
-    NRF_TIMER_TASK_CAPTURE1 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[1]), ///< Task for capturing the timer value on channel 1.
-    NRF_TIMER_TASK_CAPTURE2 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[2]), ///< Task for capturing the timer value on channel 2.
-    NRF_TIMER_TASK_CAPTURE3 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[3]), ///< Task for capturing the timer value on channel 3.
-#ifdef NRF52
-    NRF_TIMER_TASK_CAPTURE4 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[4]), ///< Task for capturing the timer value on channel 4.
-    NRF_TIMER_TASK_CAPTURE5 = offsetof(NRF_TIMER_Type, TASKS_CAPTURE[5]), ///< Task for capturing the timer value on channel 5.
-#endif
-    /*lint -restore*/
-} nrf_timer_task_t;
-
-/**
- * @brief Timer events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_TIMER_EVENT_COMPARE0 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[0]), ///< Event from compare channel 0.
-    NRF_TIMER_EVENT_COMPARE1 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[1]), ///< Event from compare channel 1.
-    NRF_TIMER_EVENT_COMPARE2 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[2]), ///< Event from compare channel 2.
-    NRF_TIMER_EVENT_COMPARE3 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[3]), ///< Event from compare channel 3.
-#ifdef NRF52
-    NRF_TIMER_EVENT_COMPARE4 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[4]), ///< Event from compare channel 4.
-    NRF_TIMER_EVENT_COMPARE5 = offsetof(NRF_TIMER_Type, EVENTS_COMPARE[5]), ///< Event from compare channel 5.
-#endif
-    /*lint -restore*/
-} nrf_timer_event_t;
-
-/**
- * @brief Types of timer shortcuts.
- */
-typedef enum
-{
-    NRF_TIMER_SHORT_COMPARE0_STOP_MASK = TIMER_SHORTS_COMPARE0_STOP_Msk,   ///< Shortcut for stopping the timer based on compare 0.
-    NRF_TIMER_SHORT_COMPARE1_STOP_MASK = TIMER_SHORTS_COMPARE1_STOP_Msk,   ///< Shortcut for stopping the timer based on compare 1.
-    NRF_TIMER_SHORT_COMPARE2_STOP_MASK = TIMER_SHORTS_COMPARE2_STOP_Msk,   ///< Shortcut for stopping the timer based on compare 2.
-    NRF_TIMER_SHORT_COMPARE3_STOP_MASK = TIMER_SHORTS_COMPARE3_STOP_Msk,   ///< Shortcut for stopping the timer based on compare 3.
-#ifdef NRF52
-    NRF_TIMER_SHORT_COMPARE4_STOP_MASK = TIMER_SHORTS_COMPARE4_STOP_Msk,   ///< Shortcut for stopping the timer based on compare 4.
-    NRF_TIMER_SHORT_COMPARE5_STOP_MASK = TIMER_SHORTS_COMPARE5_STOP_Msk,   ///< Shortcut for stopping the timer based on compare 5.
-#endif
-    NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK = TIMER_SHORTS_COMPARE0_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 0.
-    NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK = TIMER_SHORTS_COMPARE1_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 1.
-    NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK = TIMER_SHORTS_COMPARE2_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 2.
-    NRF_TIMER_SHORT_COMPARE3_CLEAR_MASK = TIMER_SHORTS_COMPARE3_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 3.
-#ifdef NRF52
-    NRF_TIMER_SHORT_COMPARE4_CLEAR_MASK = TIMER_SHORTS_COMPARE4_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 4.
-    NRF_TIMER_SHORT_COMPARE5_CLEAR_MASK = TIMER_SHORTS_COMPARE5_CLEAR_Msk, ///< Shortcut for clearing the timer based on compare 5.
-#endif
-} nrf_timer_short_mask_t;
-
-/**
- * @brief Timer modes.
- */
-typedef enum
-{
-    NRF_TIMER_MODE_TIMER             = TIMER_MODE_MODE_Timer,           ///< Timer mode: timer.
-    NRF_TIMER_MODE_COUNTER           = TIMER_MODE_MODE_Counter,         ///< Timer mode: counter.
-#ifdef NRF52
-    NRF_TIMER_MODE_LOW_POWER_COUNTER = TIMER_MODE_MODE_LowPowerCounter, ///< Timer mode: low-power counter.
-#endif
-} nrf_timer_mode_t;
-
-/**
- * @brief Timer bit width.
- */
-typedef enum
-{
-    NRF_TIMER_BIT_WIDTH_8  = TIMER_BITMODE_BITMODE_08Bit, ///< Timer bit width 8 bit.
-    NRF_TIMER_BIT_WIDTH_16 = TIMER_BITMODE_BITMODE_16Bit, ///< Timer bit width 16 bit.
-    NRF_TIMER_BIT_WIDTH_24 = TIMER_BITMODE_BITMODE_24Bit, ///< Timer bit width 24 bit.
-    NRF_TIMER_BIT_WIDTH_32 = TIMER_BITMODE_BITMODE_32Bit  ///< Timer bit width 32 bit.
-} nrf_timer_bit_width_t;
-
-/**
- * @brief Timer prescalers.
- */
-typedef enum
-{
-    NRF_TIMER_FREQ_16MHz = 0, ///< Timer frequency 16 MHz.
-    NRF_TIMER_FREQ_8MHz,      ///< Timer frequency 8 MHz.
-    NRF_TIMER_FREQ_4MHz,      ///< Timer frequency 4 MHz.
-    NRF_TIMER_FREQ_2MHz,      ///< Timer frequency 2 MHz.
-    NRF_TIMER_FREQ_1MHz,      ///< Timer frequency 1 MHz.
-    NRF_TIMER_FREQ_500kHz,    ///< Timer frequency 500 kHz.
-    NRF_TIMER_FREQ_250kHz,    ///< Timer frequency 250 kHz.
-    NRF_TIMER_FREQ_125kHz,    ///< Timer frequency 125 kHz.
-    NRF_TIMER_FREQ_62500Hz,   ///< Timer frequency 62500 Hz.
-    NRF_TIMER_FREQ_31250Hz    ///< Timer frequency 31250 Hz.
-} nrf_timer_frequency_t;
-
-/**
- * @brief Timer capture/compare channels.
- */
-typedef enum
-{
-    NRF_TIMER_CC_CHANNEL0 = 0, ///< Timer capture/compare channel 0.
-    NRF_TIMER_CC_CHANNEL1,     ///< Timer capture/compare channel 1.
-    NRF_TIMER_CC_CHANNEL2,     ///< Timer capture/compare channel 2.
-    NRF_TIMER_CC_CHANNEL3,     ///< Timer capture/compare channel 3.
-#ifdef NRF52
-    NRF_TIMER_CC_CHANNEL4,     ///< Timer capture/compare channel 4.
-    NRF_TIMER_CC_CHANNEL5,     ///< Timer capture/compare channel 5.
-#endif
-} nrf_timer_cc_channel_t;
-
-/**
- * @brief Timer interrupts.
- */
-typedef enum
-{
-    NRF_TIMER_INT_COMPARE0_MASK = TIMER_INTENSET_COMPARE0_Msk, ///< Timer interrupt from compare event on channel 0.
-    NRF_TIMER_INT_COMPARE1_MASK = TIMER_INTENSET_COMPARE1_Msk, ///< Timer interrupt from compare event on channel 1.
-    NRF_TIMER_INT_COMPARE2_MASK = TIMER_INTENSET_COMPARE2_Msk, ///< Timer interrupt from compare event on channel 2.
-    NRF_TIMER_INT_COMPARE3_MASK = TIMER_INTENSET_COMPARE3_Msk, ///< Timer interrupt from compare event on channel 3.
-#ifdef NRF52
-    NRF_TIMER_INT_COMPARE4_MASK = TIMER_INTENSET_COMPARE4_Msk, ///< Timer interrupt from compare event on channel 4.
-    NRF_TIMER_INT_COMPARE5_MASK = TIMER_INTENSET_COMPARE5_Msk, ///< Timer interrupt from compare event on channel 5.
-#endif
-} nrf_timer_int_mask_t;
-
-
-/**
- * @brief Function for activating a specific timer task.
- *
- * @param[in] p_timer Timer instance.
- * @param[in] task    Task to activate.
- */
-__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_timer,
-                                            nrf_timer_task_t task);
-
-/**
- * @brief Function for getting the address of a specific timer task register.
- *
- * @param[in] p_timer Timer instance.
- * @param[in] task    Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_timer,
-                                                      nrf_timer_task_t task);
-
-/**
- * @brief Function for clearing a specific timer event.
- *
- * @param[in] p_timer Timer instance.
- * @param[in] event   Event to clear.
- */
-__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_timer,
-                                           nrf_timer_event_t event);
-
-/**
- * @brief Function for checking the state of a specific timer event.
- *
- * @param[in] p_timer Timer instance.
- * @param[in] event   Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_timer,
-                                           nrf_timer_event_t event);
-
-/**
- * @brief Function for getting the address of a specific timer event register.
- *
- * @param[in] p_timer Timer instance.
- * @param[in] event   Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_timer,
-                                                       nrf_timer_event_t event);
-
-/**
- * @brief Function for enabling specified shortcuts.
- *
- * @param[in] p_timer           Timer instance.
- * @param[in] timer_shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_timer,
-                                             uint32_t timer_shorts_mask);
-
-/**
- * @brief Function for disabling specified shortcuts.
- *
- * @param[in] p_timer           Timer instance.
- * @param[in] timer_shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_timer,
-                                              uint32_t timer_shorts_mask);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_timer        Timer instance.
- * @param[in] timer_int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_timer,
-                                          uint32_t timer_int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_timer        Timer instance.
- * @param[in] timer_int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_timer,
-                                           uint32_t timer_int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_timer   Timer instance.
- * @param[in] timer_int Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_timer,
-                                                uint32_t timer_int);
-
-/**
- * @brief Function for setting the timer mode.
- *
- * @param[in] p_timer Timer instance.
- * @param[in] mode    Timer mode.
- */
-__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_timer,
-                                        nrf_timer_mode_t mode);
-
-/**
- * @brief Function for retrieving the timer mode.
- *
- * @param[in] p_timer Timer instance.
- *
- * @return Timer mode.
- */
-__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_timer);
-
-/**
- * @brief Function for setting the timer bit width.
- *
- * @param[in] p_timer   Timer instance.
- * @param[in] bit_width Timer bit width.
- */
-__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_timer,
-                                             nrf_timer_bit_width_t bit_width);
-
-/**
- * @brief Function for retrieving the timer bit width.
- *
- * @param[in] p_timer Timer instance.
- *
- * @return Timer bit width.
- */
-__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_timer);
-
-/**
- * @brief Function for setting the timer frequency.
- *
- * @param[in] p_timer   Timer instance.
- * @param[in] frequency Timer frequency.
- */
-__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_timer,
-                                             nrf_timer_frequency_t frequency);
-
-/**
- * @brief Function for retrieving the timer frequency.
- *
- * @param[in] p_timer Timer instance.
- *
- * @return Timer frequency.
- */
-__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_timer);
-
-/**
- * @brief Function for writing the capture/compare register for a specified channel.
- *
- * @param[in] p_timer    Timer instance.
- * @param[in] cc_channel Requested capture/compare channel.
- * @param[in] cc_value   Value to write to the capture/compare register.
- */
-__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_timer,
-                                        nrf_timer_cc_channel_t cc_channel,
-                                        uint32_t               cc_value);
-
-/**
- * @brief Function for retrieving the capture/compare value for a specified channel.
- *
- * @param[in] p_timer    Timer instance.
- * @param[in] cc_channel Requested capture/compare channel.
- *
- * @return Value from the requested capture/compare register.
- */
-__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_timer,
-                                           nrf_timer_cc_channel_t cc_channel);
-
-/**
- * @brief Function for getting a specific timer capture task.
- *
- * @param[in] channel Capture channel.
- *
- * @return Capture task.
- */
-__STATIC_INLINE nrf_timer_task_t nrf_timer_capture_task_get(uint32_t channel);
-
-/**
- * @brief Function for getting a specific timer compare event.
- *
- * @param[in] channel Compare channel.
- *
- * @return Compare event.
- */
-__STATIC_INLINE nrf_timer_event_t nrf_timer_compare_event_get(uint32_t channel);
-
-/**
- * @brief Function for getting a specific timer compare interrupt.
- *
- * @param[in] channel Compare channel.
- *
- * @return Compare interrupt.
- */
-__STATIC_INLINE nrf_timer_int_mask_t nrf_timer_compare_int_get(uint32_t channel);
-
-/**
- * @brief Function for calculating the number of timer ticks for a given time
- *        (in microseconds) and timer frequency.
- *
- * @param[in] time_us   Time in microseconds.
- * @param[in] frequency Timer frequency.
- *
- * @return Number of timer ticks.
- */
-__STATIC_INLINE uint32_t nrf_timer_us_to_ticks(uint32_t time_us,
-                                               nrf_timer_frequency_t frequency);
-
-/**
- * @brief Function for calculating the number of timer ticks for a given time
- *        (in milliseconds) and timer frequency.
- *
- * @param[in] time_ms   Time in milliseconds.
- * @param[in] frequency Timer frequency.
- *
- * @return Number of timer ticks.
- */
-__STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms,
-                                               nrf_timer_frequency_t frequency);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_timer_task_trigger(NRF_TIMER_Type * p_timer,
-                                            nrf_timer_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t * nrf_timer_task_address_get(NRF_TIMER_Type * p_timer,
-                                                      nrf_timer_task_t task)
-{
-    return (uint32_t *)((uint8_t *)p_timer + (uint32_t)task);
-}
-
-__STATIC_INLINE void nrf_timer_event_clear(NRF_TIMER_Type * p_timer,
-                                           nrf_timer_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_timer_event_check(NRF_TIMER_Type * p_timer,
-                                           nrf_timer_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_timer + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t * nrf_timer_event_address_get(NRF_TIMER_Type * p_timer,
-                                                       nrf_timer_event_t event)
-{
-    return (uint32_t *)((uint8_t *)p_timer + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_timer_shorts_enable(NRF_TIMER_Type * p_timer,
-                                             uint32_t timer_shorts_mask)
-{
-    p_timer->SHORTS |= timer_shorts_mask;
-}
-
-__STATIC_INLINE void nrf_timer_shorts_disable(NRF_TIMER_Type * p_timer,
-                                              uint32_t timer_shorts_mask)
-{
-    p_timer->SHORTS &= ~(timer_shorts_mask);
-}
-
-__STATIC_INLINE void nrf_timer_int_enable(NRF_TIMER_Type * p_timer,
-                                          uint32_t timer_int_mask)
-{
-    p_timer->INTENSET = timer_int_mask;
-}
-
-__STATIC_INLINE void nrf_timer_int_disable(NRF_TIMER_Type * p_timer,
-                                           uint32_t timer_int_mask)
-{
-    p_timer->INTENCLR = timer_int_mask;
-}
-
-__STATIC_INLINE bool nrf_timer_int_enable_check(NRF_TIMER_Type * p_timer,
-                                                uint32_t timer_int)
-{
-    return (bool)(p_timer->INTENSET & timer_int);
-}
-
-__STATIC_INLINE void nrf_timer_mode_set(NRF_TIMER_Type * p_timer,
-                                        nrf_timer_mode_t mode)
-{
-    p_timer->MODE = (p_timer->MODE & ~TIMER_MODE_MODE_Msk) |
-                    ((mode << TIMER_MODE_MODE_Pos) & TIMER_MODE_MODE_Msk);
-}
-
-__STATIC_INLINE nrf_timer_mode_t nrf_timer_mode_get(NRF_TIMER_Type * p_timer)
-{
-    return (nrf_timer_mode_t)(p_timer->MODE);
-}
-
-__STATIC_INLINE void nrf_timer_bit_width_set(NRF_TIMER_Type * p_timer,
-                                             nrf_timer_bit_width_t bit_width)
-{
-    p_timer->BITMODE = (p_timer->BITMODE & ~TIMER_BITMODE_BITMODE_Msk) |
-                       ((bit_width << TIMER_BITMODE_BITMODE_Pos) &
-                            TIMER_BITMODE_BITMODE_Msk);
-}
-
-__STATIC_INLINE nrf_timer_bit_width_t nrf_timer_bit_width_get(NRF_TIMER_Type * p_timer)
-{
-    return (nrf_timer_bit_width_t)(p_timer->BITMODE);
-}
-
-__STATIC_INLINE void nrf_timer_frequency_set(NRF_TIMER_Type * p_timer,
-                                             nrf_timer_frequency_t frequency)
-{
-    p_timer->PRESCALER = (p_timer->PRESCALER & ~TIMER_PRESCALER_PRESCALER_Msk) |
-                         ((frequency << TIMER_PRESCALER_PRESCALER_Pos) &
-                              TIMER_PRESCALER_PRESCALER_Msk);
-}
-
-__STATIC_INLINE nrf_timer_frequency_t nrf_timer_frequency_get(NRF_TIMER_Type * p_timer)
-{
-    return (nrf_timer_frequency_t)(p_timer->PRESCALER);
-}
-
-__STATIC_INLINE void nrf_timer_cc_write(NRF_TIMER_Type * p_timer,
-                                        nrf_timer_cc_channel_t cc_channel,
-                                        uint32_t               cc_value)
-{
-    p_timer->CC[cc_channel] = cc_value;
-}
-
-__STATIC_INLINE uint32_t nrf_timer_cc_read(NRF_TIMER_Type * p_timer,
-                                           nrf_timer_cc_channel_t cc_channel)
-{
-    return (uint32_t)p_timer->CC[cc_channel];
-}
-
-__STATIC_INLINE nrf_timer_task_t nrf_timer_capture_task_get(uint32_t channel)
-{
-    return (nrf_timer_task_t)
-        ((uint32_t)NRF_TIMER_TASK_CAPTURE0 + (channel * sizeof(uint32_t)));
-}
-
-__STATIC_INLINE nrf_timer_event_t nrf_timer_compare_event_get(uint32_t channel)
-{
-    return (nrf_timer_event_t)
-        ((uint32_t)NRF_TIMER_EVENT_COMPARE0 + (channel * sizeof(uint32_t)));
-}
-
-__STATIC_INLINE nrf_timer_int_mask_t nrf_timer_compare_int_get(uint32_t channel)
-{
-    return (nrf_timer_int_mask_t)
-        ((uint32_t)NRF_TIMER_INT_COMPARE0_MASK << channel);
-}
-
-__STATIC_INLINE uint32_t nrf_timer_us_to_ticks(uint32_t time_us,
-                                               nrf_timer_frequency_t frequency)
-{
-    // The "frequency" parameter here is actually the prescaler value, and the
-    // timer runs at the following frequency: f = 16 MHz / 2^prescaler.
-    uint32_t prescaler = (uint32_t)frequency;
-    ASSERT(time_us <= (UINT32_MAX / 16UL));
-    return ((time_us * 16UL) >> prescaler);
-}
-
-__STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms,
-                                               nrf_timer_frequency_t frequency)
-{
-    // The "frequency" parameter here is actually the prescaler value, and the
-    // timer runs at the following frequency: f = 16000 kHz / 2^prescaler.
-    uint32_t prescaler = (uint32_t)frequency;
-    ASSERT(time_ms <= (UINT32_MAX / 16000UL));
-    return ((time_ms * 16000UL) >> prescaler);
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_TIMER_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/hal/nrf_twi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twi.h
deleted file mode 100644
index b5ddaeb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twi.h
+++ /dev/null
@@ -1,410 +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.
- *
- */
-
-#ifndef NRF_TWI_H__
-#define NRF_TWI_H__
- 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_twi_hal TWI HAL
- * @{
- * @ingroup nrf_twi_master
- *
- * @brief Hardware access layer for managing the TWI peripheral.
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-#include "nrf.h"
-
-/**
- * @brief TWI tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_TWI_TASK_STARTRX = offsetof(NRF_TWI_Type, TASKS_STARTRX), ///< Start TWI receive sequence.
-    NRF_TWI_TASK_STARTTX = offsetof(NRF_TWI_Type, TASKS_STARTTX), ///< Start TWI transmit sequence.
-    NRF_TWI_TASK_STOP    = offsetof(NRF_TWI_Type, TASKS_STOP),    ///< Stop TWI transaction.
-    NRF_TWI_TASK_SUSPEND = offsetof(NRF_TWI_Type, TASKS_SUSPEND), ///< Suspend TWI transaction.
-    NRF_TWI_TASK_RESUME  = offsetof(NRF_TWI_Type, TASKS_RESUME)   ///< Resume TWI transaction.
-    /*lint -restore*/
-} nrf_twi_task_t;
-
-/**
- * @brief TWI events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_TWI_EVENT_STOPPED   = offsetof(NRF_TWI_Type, EVENTS_STOPPED),  ///< TWI stopped.
-    NRF_TWI_EVENT_RXDREADY  = offsetof(NRF_TWI_Type, EVENTS_RXDREADY), ///< TWI RXD byte received.
-    NRF_TWI_EVENT_TXDSENT   = offsetof(NRF_TWI_Type, EVENTS_TXDSENT),  ///< TWI TXD byte sent.
-    NRF_TWI_EVENT_ERROR     = offsetof(NRF_TWI_Type, EVENTS_ERROR),    ///< TWI error.
-    NRF_TWI_EVENT_BB        = offsetof(NRF_TWI_Type, EVENTS_BB),       ///< TWI byte boundary, generated before each byte that is sent or received.
-    NRF_TWI_EVENT_SUSPENDED = offsetof(NRF_TWI_Type, EVENTS_SUSPENDED) ///< TWI entered the suspended state.
-    /*lint -restore*/
-} nrf_twi_event_t;
-
-/**
- * @brief TWI shortcuts.
- */
-typedef enum
-{
-    NRF_TWI_SHORT_BB_SUSPEND_MASK = TWI_SHORTS_BB_SUSPEND_Msk, ///< Shortcut between BB event and SUSPEND task.
-    NRF_TWI_SHORT_BB_STOP_MASK    = TWI_SHORTS_BB_STOP_Msk,    ///< Shortcut between BB event and STOP task.
-} nrf_twi_short_mask_t;
-
-/**
- * @brief TWI interrupts.
- */
-typedef enum
-{
-    NRF_TWI_INT_STOPPED_MASK    = TWI_INTENSET_STOPPED_Msk,  ///< Interrupt on STOPPED event.
-    NRF_TWI_INT_RXDREADY_MASK   = TWI_INTENSET_RXDREADY_Msk, ///< Interrupt on RXDREADY event.
-    NRF_TWI_INT_TXDSENT_MASK    = TWI_INTENSET_TXDSENT_Msk,  ///< Interrupt on TXDSENT event.
-    NRF_TWI_INT_ERROR_MASK      = TWI_INTENSET_ERROR_Msk,    ///< Interrupt on ERROR event.
-    NRF_TWI_INT_BB_MASK         = TWI_INTENSET_BB_Msk,       ///< Interrupt on BB event.
-    NRF_TWI_INT_SUSPENDED_MASK  = TWI_INTENSET_SUSPENDED_Msk ///< Interrupt on SUSPENDED event.
-} nrf_twi_int_mask_t;
-
-/**
- * @brief TWI error source.
- */
-typedef enum
-{
-    NRF_TWI_ERROR_ADDRESS_NACK = TWI_ERRORSRC_ANACK_Msk,  ///< NACK received after sending the address.
-    NRF_TWI_ERROR_DATA_NACK    = TWI_ERRORSRC_DNACK_Msk,  ///< NACK received after sending a data byte.
-    NRF_TWI_ERROR_OVERRUN      = TWI_ERRORSRC_OVERRUN_Msk ///< Overrun error.
-                                                          /**< A new byte was received before the previous byte was read
-                                                           *   from the RXD register (previous data is lost). */
-} nrf_twi_error_t;
-
-/**
- * @brief TWI master clock frequency.
- */
-typedef enum
-{
-    NRF_TWI_FREQ_100K = TWI_FREQUENCY_FREQUENCY_K100, ///< 100 kbps.
-    NRF_TWI_FREQ_250K = TWI_FREQUENCY_FREQUENCY_K250, ///< 250 kbps.
-    NRF_TWI_FREQ_400K = TWI_FREQUENCY_FREQUENCY_K400  ///< 400 kbps.
-} nrf_twi_frequency_t;
-
-
-/**
- * @brief Function for activating a specific TWI task.
- *
- * @param[in] p_twi TWI instance.
- * @param[in] task  Task to activate.
- */
-__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_twi,
-                                          nrf_twi_task_t task);
-
-/**
- * @brief Function for getting the address of a specific TWI task register.
- *
- * @param[in] p_twi TWI instance.
- * @param[in] task  Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_twi,
-                                                    nrf_twi_task_t task);
-
-/**
- * @brief Function for clearing a specific TWI event.
- *
- * @param[in] p_twi TWI instance.
- * @param[in] event Event to clear.
- */
-__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type * p_twi,
-                                         nrf_twi_event_t event);
-
-/**
- * @brief Function for checking the state of a specific event.
- *
- * @param[in] p_twi TWI instance.
- * @param[in] event Event to check.
- *
- * @retval true If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type  * p_twi,
-                                         nrf_twi_event_t event);
-
-/**
- * @brief Function for getting the address of a specific TWI event register.
- *
- * @param[in] p_twi TWI instance.
- * @param[in] event Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type  * p_twi,
-                                                     nrf_twi_event_t event);
-
-/**
- * @brief Function for enabling specified shortcuts.
- *
- * @param[in] p_twi       TWI instance.
- * @param[in] shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_twi,
-                                           uint32_t shorts_mask);
-
-/**
- * @brief Function for disabling specified shortcuts.
- *
- * @param[in] p_twi       TWI instance.
- * @param[in] shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_twi,
-                                            uint32_t shorts_mask);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_twi    TWI instance.
- * @param[in] int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_twi,
-                                        uint32_t int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_twi   TWI instance.
- * @param[in] int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_twi,
-                                         uint32_t int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_twi    TWI instance.
- * @param[in] int_mask Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi,
-                                              nrf_twi_int_mask_t int_mask);
-
-/**
- * @brief Function for enabling the TWI peripheral.
- *
- * @param[in] p_twi TWI instance.
- */
-__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_twi);
-
-/**
- * @brief Function for disabling the TWI peripheral.
- *
- * @param[in] p_twi TWI instance.
- */
-__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_twi);
-
-/**
- * @brief Function for configuring TWI pins.
- *
- *
- * @param[in] p_twi   TWI instance.
- * @param[in] scl_pin SCL pin number.
- * @param[in] sda_pin SDA pin number.
- */
-__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_twi,
-                                      uint32_t scl_pin,
-                                      uint32_t sda_pin);
-
-/**
- * @brief Function for setting the TWI master clock frequency.
- *
- * @param[in] p_twi     TWI instance.
- * @param[in] frequency TWI frequency.
- */
-__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi,
-                                           nrf_twi_frequency_t frequency);
-
-/**
- * @brief Function for checking the TWI error source.
- *
- * The error flags are cleared after reading.
- *
- * @param[in] p_twi TWI instance.
- *
- * @return Mask with error source flags.
- */
-__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_twi);
-
-/**
- * @brief Function for setting the address to be used in TWI transfers.
- *
- * @param[in] p_twi   TWI instance.
- * @param[in] address Address to be used in transfers.
- */
-__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_twi, uint8_t address);
-
-/**
- * @brief Function for reading data received by TWI.
- *
- * @param[in] p_twi TWI instance.
- *
- * @return Received data.
- */
-__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_twi);
-
-/**
- * @brief Function for writing data to be transmitted by TWI.
- *
- * @param[in] p_twi TWI instance.
- * @param[in] data  Data to be transmitted.
- */
-__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_twi, uint8_t data);
-
-__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi,
-                                        uint32_t shorts_mask);
-
-/**
- * @}
- */
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_twi_task_trigger(NRF_TWI_Type * p_twi,
-                                          nrf_twi_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t * nrf_twi_task_address_get(NRF_TWI_Type * p_twi,
-                                                    nrf_twi_task_t task)
-{
-    return (uint32_t *)((uint8_t *)p_twi + (uint32_t)task);
-}
-
-__STATIC_INLINE void nrf_twi_event_clear(NRF_TWI_Type  * p_twi,
-                                         nrf_twi_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_twi_event_check(NRF_TWI_Type  * p_twi,
-                                         nrf_twi_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_twi + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t * nrf_twi_event_address_get(NRF_TWI_Type  * p_twi,
-                                                     nrf_twi_event_t event)
-{
-    return (uint32_t *)((uint8_t *)p_twi + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_twi_shorts_enable(NRF_TWI_Type * p_twi,
-                                           uint32_t shorts_mask)
-{
-    p_twi->SHORTS |= shorts_mask;
-}
-
-__STATIC_INLINE void nrf_twi_shorts_disable(NRF_TWI_Type * p_twi,
-                                            uint32_t shorts_mask)
-{
-    p_twi->SHORTS &= ~(shorts_mask);
-}
-
-__STATIC_INLINE void nrf_twi_int_enable(NRF_TWI_Type * p_twi,
-                                        uint32_t int_mask)
-{
-    p_twi->INTENSET = int_mask;
-}
-
-__STATIC_INLINE void nrf_twi_int_disable(NRF_TWI_Type * p_twi,
-                                         uint32_t int_mask)
-{
-    p_twi->INTENCLR = int_mask;
-}
-
-__STATIC_INLINE bool nrf_twi_int_enable_check(NRF_TWI_Type * p_twi,
-                                              nrf_twi_int_mask_t int_mask)
-{
-    return (bool)(p_twi->INTENSET & int_mask);
-}
-
-__STATIC_INLINE void nrf_twi_enable(NRF_TWI_Type * p_twi)
-{
-    p_twi->ENABLE = (TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_twi_disable(NRF_TWI_Type * p_twi)
-{
-    p_twi->ENABLE = (TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_twi_pins_set(NRF_TWI_Type * p_twi,
-                                      uint32_t scl_pin,
-                                      uint32_t sda_pin)
-{
-    p_twi->PSELSCL = scl_pin;
-    p_twi->PSELSDA = sda_pin;
-}
-
-__STATIC_INLINE void nrf_twi_frequency_set(NRF_TWI_Type * p_twi,
-                                           nrf_twi_frequency_t frequency)
-{
-    p_twi->FREQUENCY = frequency;
-}
-
-__STATIC_INLINE uint32_t nrf_twi_errorsrc_get_and_clear(NRF_TWI_Type * p_twi)
-{
-    uint32_t error_source = p_twi->ERRORSRC;
-
-    // [error flags are cleared by writing '1' on their position]
-    p_twi->ERRORSRC = error_source;
-
-    return error_source;
-}
-
-__STATIC_INLINE void nrf_twi_address_set(NRF_TWI_Type * p_twi, uint8_t address)
-{
-    p_twi->ADDRESS = address;
-}
-
-__STATIC_INLINE uint8_t nrf_twi_rxd_get(NRF_TWI_Type * p_twi)
-{
-    return (uint8_t)p_twi->RXD;
-}
-
-__STATIC_INLINE void nrf_twi_txd_set(NRF_TWI_Type * p_twi, uint8_t data)
-{
-    p_twi->TXD = data;
-}
-
-__STATIC_INLINE void nrf_twi_shorts_set(NRF_TWI_Type * p_twi,
-                                        uint32_t shorts_mask)
-{
-    p_twi->SHORTS = shorts_mask;
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_TWI_H__


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

Posted by cc...@apache.org.
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/fds/fds.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds.c
deleted file mode 100644
index 054ef2d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds.c
+++ /dev/null
@@ -1,2058 +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 "fds.h"
-#include "fds_config.h"
-#include "fds_internal_defs.h"
-
-#include <stdint.h>
-#include <string.h>
-#include <stdbool.h>
-#include "fstorage.h"
-#include "app_util.h"
-#include "nrf_error.h"
-
-#if defined(FDS_CRC_ENABLED)
-    #include "crc16.h"
-#endif
-
-
-static void fs_event_handler(fs_evt_t const * const evt, fs_ret_t result);
-
-// Our fstorage configuration.
-FS_REGISTER_CFG(fs_config_t fs_config) =
-{
-    .callback  = fs_event_handler,
-    .num_pages = FDS_PHY_PAGES,
-    // We register with the highest priority in order to be assigned
-    // the pages with the highest memory address (closest to the bootloader).
-    .priority  = 0xFF
-};
-
-// Used to flag a record as dirty, i.e. ready for garbage collection.
-static fds_tl_t const m_fds_tl_dirty =
-{
-    .record_key   = FDS_RECORD_KEY_DIRTY,
-    .length_words = 0xFFFF  // Leave the record length field unchanged in flash.
-};
-
-// Internal status flags.
-static uint8_t              m_flags;
-
-// The number of registered users and their callback functions.
-static uint8_t              m_users;
-static fds_cb_t             m_cb_table[FDS_MAX_USERS];
-
-// The latest (largest) record ID written so far.
-static uint32_t             m_latest_rec_id;
-
-// The internal queues.
-static fds_op_queue_t       m_op_queue;
-static fds_chunk_queue_t    m_chunk_queue;
-
-// Structures used to hold informations about virtual pages.
-static fds_page_t           m_pages[FDS_MAX_PAGES];
-static fds_swap_page_t      m_swap_page;
-
-// Garbage collection data.
-static fds_gc_data_t        m_gc;
-
-
-static void flag_set(fds_flags_t flag)
-{
-    CRITICAL_SECTION_ENTER();
-    m_flags |= flag;
-    CRITICAL_SECTION_EXIT();
-}
-
-
-static void flag_clear(fds_flags_t flag)
-{
-    CRITICAL_SECTION_ENTER();
-    m_flags &= ~(flag);
-    CRITICAL_SECTION_EXIT();
-}
-
-
-static bool flag_is_set(fds_flags_t flag)
-{
-    return (m_flags & flag);
-}
-
-
-static void event_send(fds_evt_t const * const p_evt)
-{
-    for (uint32_t user = 0; user < FDS_MAX_USERS; user++)
-    {
-        if (m_cb_table[user] != NULL)
-        {
-            m_cb_table[user](p_evt);
-        }
-    }
-}
-
-
-static void event_prepare(fds_op_t const * const p_op, fds_evt_t * const p_evt)
-{
-    switch (p_op->op_code)
-    {
-        case FDS_OP_INIT:
-            p_evt->id = FDS_EVT_INIT;
-            break;
-
-        case FDS_OP_WRITE:
-            p_evt->id               = FDS_EVT_WRITE;
-            p_evt->write.file_id    = p_op->write.header.ic.file_id;
-            p_evt->write.record_key = p_op->write.header.tl.record_key;
-            p_evt->write.record_id  = p_op->write.header.record_id;
-            break;
-
-        case FDS_OP_UPDATE:
-            p_evt->id                      = FDS_EVT_UPDATE;
-            p_evt->write.file_id           = p_op->write.header.ic.file_id;
-            p_evt->write.record_key        = p_op->write.header.tl.record_key;
-            p_evt->write.record_id         = p_op->write.header.record_id;
-            p_evt->write.is_record_updated = (p_op->write.step == FDS_OP_WRITE_DONE);
-            break;
-
-        case FDS_OP_DEL_RECORD:
-            p_evt->id             = FDS_EVT_DEL_RECORD;
-            p_evt->del.file_id    = p_op->del.file_id;
-            p_evt->del.record_key = p_op->del.record_key;
-            p_evt->del.record_id  = p_op->del.record_to_delete;
-            break;
-
-        case FDS_OP_DEL_FILE:
-            p_evt->id             = FDS_EVT_DEL_FILE;
-            p_evt->del.file_id    = p_op->del.file_id;
-            p_evt->del.record_key = FDS_RECORD_KEY_DIRTY;
-            break;
-
-        case FDS_OP_GC:
-            p_evt->id = FDS_EVT_GC;
-            break;
-
-        default:
-            // Should not happen.
-            break;
-    }
-}
-
-
-static bool header_is_valid(fds_header_t const * const p_header)
-{
-    return ((p_header->ic.file_id    != FDS_FILE_ID_INVALID) &&
-            (p_header->tl.record_key != FDS_RECORD_KEY_DIRTY));
-}
-
-
-static bool address_is_valid(uint32_t const * const p_addr)
-{
-    return ((p_addr != NULL) &&
-            (p_addr >= fs_config.p_start_addr) &&
-            (p_addr <= fs_config.p_end_addr)   &&
-            (is_word_aligned(p_addr)));
-}
-
-
-static bool chunk_is_aligned(fds_record_chunk_t const * const p_chunk, uint32_t num_chunks)
-{
-    for (uint32_t i = 0; i < num_chunks; i++)
-    {
-        if (!is_word_aligned(p_chunk[i].p_data))
-        {
-            return false;
-        }
-    }
-    return true;
-}
-
-
-// Reads a page tag, and determines if the page is used to store data or as swap.
-static fds_page_type_t page_identify(uint32_t const * const p_page_addr)
-{
-    if (p_page_addr[FDS_PAGE_TAG_WORD_0] != FDS_PAGE_TAG_MAGIC)
-    {
-        return FDS_PAGE_UNDEFINED;
-    }
-
-    switch (p_page_addr[FDS_PAGE_TAG_WORD_1])
-    {
-        case FDS_PAGE_TAG_SWAP:
-            return FDS_PAGE_SWAP;
-
-        case FDS_PAGE_TAG_DATA:
-            return FDS_PAGE_DATA;
-
-        default:
-            return FDS_PAGE_UNDEFINED;
-    }
-}
-
-
-static bool page_is_erased(uint32_t const * const p_page_addr)
-{
-    for (uint32_t i = 0; i < FDS_PAGE_SIZE; i++)
-    {
-        if (*(p_page_addr + i) != FDS_ERASED_WORD)
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-
-// NOTE: Must be called from within a critical section.
-static bool page_has_space(uint16_t page, uint16_t length_words)
-{
-    length_words += m_pages[page].write_offset;
-    length_words += m_pages[page].words_reserved;
-    return (length_words < FDS_PAGE_SIZE);
-}
-
-
-// Given a pointer to a record, find the index of the page on which it is stored.
-// Returns FDS_SUCCESS if the page is found, FDS_ERR_NOT_FOUND otherwise.
-static ret_code_t page_from_record(uint16_t * const p_page, uint32_t const * const p_rec)
-{
-    ret_code_t ret = FDS_ERR_NOT_FOUND;
-
-    CRITICAL_SECTION_ENTER();
-    for (uint16_t i = 0; i < FDS_MAX_PAGES; i++)
-    {
-        if ((p_rec > m_pages[i].p_addr) &&
-            (p_rec < m_pages[i].p_addr + FDS_PAGE_SIZE))
-        {
-            ret     = FDS_SUCCESS;
-            *p_page = i;
-            break;
-        }
-    }
-    CRITICAL_SECTION_EXIT();
-
-    return ret;
-}
-
-
-// Scan a page to determine how many words have been written to it.
-// This information is used to set the page write offset during initialization.
-// Additionally, this function updates the latest record ID as it proceeds.
-// If an invalid record header is found, the can_gc argument is set to true.
-static void page_scan(uint32_t const *       p_addr,
-                      uint16_t       * const words_written,
-                      bool           * const can_gc)
-{
-    uint32_t const * const p_end_addr          = p_addr + FDS_PAGE_SIZE;
-    bool                   dirty_record_found  = false;
-
-    p_addr         += FDS_PAGE_TAG_SIZE;
-    *words_written  = FDS_PAGE_TAG_SIZE;
-
-    while ((p_addr < p_end_addr) && (*p_addr != FDS_ERASED_WORD))
-    {
-        // NOTE: Skip records with a dirty key or with a missing file ID.
-        fds_header_t const * const p_header = (fds_header_t*)p_addr;
-
-        if (!header_is_valid(p_header))
-        {
-            dirty_record_found = true;
-        }
-        else
-        {
-            // Update the latest (largest) record ID.
-            if (p_header->record_id > m_latest_rec_id)
-            {
-               m_latest_rec_id = p_header->record_id;
-            }
-        }
-
-        // Jump to the next record.
-        p_addr         += (FDS_HEADER_SIZE + p_header->tl.length_words);
-        *words_written += (FDS_HEADER_SIZE + p_header->tl.length_words);
-    }
-
-    if (can_gc != NULL)
-    {
-        *can_gc = dirty_record_found;
-    }
-}
-
-
-static void page_offsets_update(fds_page_t * const p_page, uint16_t length_words)
-{
-    p_page->write_offset   += (FDS_HEADER_SIZE + length_words);
-    p_page->words_reserved -= (FDS_HEADER_SIZE + length_words);
-}
-
-
-// Tags a page as swap, i.e., reserved for GC.
-static ret_code_t page_tag_write_swap()
-{
-    // Needs to be statically allocated since it will be written to flash.
-    static uint32_t const page_tag_swap[] = {FDS_PAGE_TAG_MAGIC, FDS_PAGE_TAG_SWAP};
-    return fs_store(&fs_config, m_swap_page.p_addr, page_tag_swap, FDS_PAGE_TAG_SIZE);
-}
-
-
-// Tags a page as data, i.e, ready for storage.
-static ret_code_t page_tag_write_data(uint32_t const * const p_page_addr)
-{
-    // Needs to be statically allocated since it will be written to flash.
-    static uint32_t const page_tag_data[] = {FDS_PAGE_TAG_MAGIC, FDS_PAGE_TAG_DATA};
-    return fs_store(&fs_config, p_page_addr, page_tag_data, FDS_PAGE_TAG_SIZE);
-}
-
-
-// Reserve space on a page.
-// NOTE: this function takes into the account the space required for the record header.
-static ret_code_t write_space_reserve(uint16_t length_words, uint16_t * p_page)
-{
-    bool           space_reserved  = false;
-    uint16_t const total_len_words = length_words + FDS_HEADER_SIZE;
-
-    if (total_len_words >= FDS_PAGE_SIZE - FDS_PAGE_TAG_SIZE)
-    {
-        return FDS_ERR_RECORD_TOO_LARGE;
-    }
-
-    CRITICAL_SECTION_ENTER();
-    for (uint16_t page = 0; page < FDS_MAX_PAGES; page++)
-    {
-        if ((m_pages[page].page_type == FDS_PAGE_DATA) &&
-            (page_has_space(page, total_len_words)))
-        {
-            space_reserved = true;
-            *p_page        = page;
-
-            m_pages[page].words_reserved += total_len_words;
-            break;
-        }
-    }
-    CRITICAL_SECTION_EXIT();
-
-    return (space_reserved) ? FDS_SUCCESS : FDS_ERR_NO_SPACE_IN_FLASH;
-}
-
-
-// Undo a write_space_reserve() call.
-// NOTE: Must be called within a critical section.
-static void write_space_free(uint16_t length_words, uint16_t page)
-{
-    m_pages[page].words_reserved -= (length_words + FDS_HEADER_SIZE);
-}
-
-
-static uint32_t record_id_new(void)
-{
-    CRITICAL_SECTION_ENTER();
-    m_latest_rec_id++;
-    CRITICAL_SECTION_EXIT();
-    return m_latest_rec_id;
-}
-
-
-// Given a page and a record, finds the next valid record on that page. If p_record is NULL,
-// search from the beginning of the page, otherwise, resume searching from the address
-// pointed by p_record. Returns true if a record is found, returns false otherwise.
-// If no record is found, p_record is unchanged.
-static bool record_find_next(uint16_t page, uint32_t const ** p_record)
-{
-    fds_header_t const * p_header;
-    uint32_t     const * p_next_rec = (*p_record);
-
-    // If this is not the first invocation on this page, then jump to the next record.
-    // Otherwise, start searching from the beginning of the page.
-    if (p_next_rec != NULL)
-    {
-        p_header    = ((fds_header_t*)p_next_rec);
-        p_next_rec += (FDS_HEADER_SIZE + p_header->tl.length_words);
-    }
-    else
-    {
-        p_next_rec = m_pages[page].p_addr + FDS_PAGE_TAG_SIZE;
-    }
-
-    // Read records from the page, until a valid record is found or the end of the page is
-    // reached. The argument p_record is only updated if a valid record is found.
-    while ((p_next_rec < (m_pages[page].p_addr + FDS_PAGE_SIZE) &&
-           *p_next_rec != FDS_ERASED_WORD))
-    {
-        p_header = (fds_header_t*)p_next_rec;
-
-        if (header_is_valid(p_header))
-        {
-            *p_record = p_next_rec;
-            return true;
-        }
-        else
-        {
-            // The record is not valid, jump to the next.
-            p_next_rec += (FDS_HEADER_SIZE + (p_header->tl.length_words));
-        }
-    }
-
-    // No more valid records on this page.
-    return false;
-}
-
-
-// Find a record given its descriptor and retrive the page in which the record is stored.
-// NOTE: Do not pass NULL as an argument for p_page.
-static bool record_find_by_desc(fds_record_desc_t * const p_desc, uint16_t * const p_page)
-{
-    // If the gc_run_count field in the descriptor matches our counter, then the record has
-    // not been moved. If the address is valid, and the record ID matches, there is no need
-    // to find the record again. Only lookup the page in which the record is stored.
-
-    if ((address_is_valid(p_desc->p_record))     &&
-        (p_desc->gc_run_count == m_gc.run_count) &&
-        (p_desc->record_id    == ((fds_header_t*)p_desc->p_record)->record_id))
-    {
-        return (page_from_record(p_page, p_desc->p_record) == FDS_SUCCESS);
-    }
-
-    // Otherwise, find the record in flash.
-    for (*p_page = 0; *p_page < FDS_MAX_PAGES; (*p_page)++)
-    {
-        // Set p_record to NULL to make record_find_next() search from the beginning of the page.
-        uint32_t const * p_record = NULL;
-
-        while (record_find_next(*p_page, &p_record))
-        {
-            fds_header_t const * const p_header = (fds_header_t*)p_record;
-            if (p_header->record_id == p_desc->record_id)
-            {
-                p_desc->p_record     = p_record;
-                p_desc->gc_run_count = m_gc.run_count;
-                return true;
-            }
-        }
-    }
-
-    return false;
-}
-
-
-// Search for a record and return its descriptor.
-// If p_file_id is NULL, only the record key will be used for matching.
-// If p_record_key is NULL, only the file ID will be used for matching.
-// If both are NULL, it will iterate through all records.
-static ret_code_t record_find(uint16_t          const * const p_file_id,
-                              uint16_t          const * const p_record_key,
-                              fds_record_desc_t       * const p_desc,
-                              fds_find_token_t        * const p_token)
-{
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    if (p_desc == NULL || p_token == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    // Begin (or resume) searching for a record.
-    for (; p_token->page < FDS_MAX_PAGES; p_token->page++)
-    {
-        if (m_pages[p_token->page].page_type != FDS_PAGE_DATA)
-        {
-            // Skip this page.
-            continue;
-        }
-
-        while (record_find_next(p_token->page, &p_token->p_addr))
-        {
-            fds_header_t const * const p_header = (fds_header_t*)p_token->p_addr;
-
-            // A valid record was found, check its header for a match.
-            if ((p_file_id != NULL) &&
-                (p_header->ic.file_id != *p_file_id))
-            {
-                continue;
-            }
-
-            if ((p_record_key != NULL) &&
-                (p_header->tl.record_key != *p_record_key))
-            {
-                continue;
-            }
-
-            // Record found; update the descriptor.
-            p_desc->record_id    = p_header->record_id;
-            p_desc->p_record     = p_token->p_addr;
-            p_desc->gc_run_count = m_gc.run_count;
-
-            return FDS_SUCCESS;
-        }
-
-        // We have scanned an entire page. Set the address in the token to NULL
-        // so that it will be updated in the next iteration.
-        p_token->p_addr = NULL;
-    }
-
-    return FDS_ERR_NOT_FOUND;
-}
-
-
-// Retrieve basic statistics about dirty records on a page.
-static void dirty_records_stat(uint16_t         page,
-                               uint16_t * const p_dirty_records,
-                               uint16_t * const p_word_count)
-{
-    fds_header_t const * p_header;
-    uint32_t     const * p_rec;
-
-    p_rec = m_pages[page].p_addr + FDS_PAGE_TAG_SIZE;
-
-    while ((p_rec < (m_pages[page].p_addr + FDS_PAGE_SIZE)) &&
-           (*p_rec != FDS_ERASED_WORD))
-    {
-        p_header = (fds_header_t*)p_rec;
-
-        if (!header_is_valid(p_header))
-        {
-            (*p_dirty_records) += 1;
-            (*p_word_count)    += p_header->tl.length_words;
-        }
-        else
-        {
-            p_rec += (FDS_HEADER_SIZE + (p_header->tl.length_words));
-        }
-    }
-}
-
-
-// Advances one position in the queue.
-// Returns true if the queue is not empty.
-static bool queue_advance(void)
-{
-    // Reset the current element.
-    memset(&m_op_queue.op[m_op_queue.rp], 0x00, sizeof(fds_op_t));
-
-    if (m_op_queue.count != 0)
-    {
-        // Advance in the queue, wrapping around if necessary.
-        m_op_queue.rp = (m_op_queue.rp + 1) % FDS_OP_QUEUE_SIZE;
-        m_op_queue.count--;
-    }
-
-    return (m_op_queue.count != 0);
-}
-
-
-// Given a pointer to an element in the chunk queue, computes the pointer to
-// the next element in the queue. Handles wrap around.
-void chunk_queue_next(fds_record_chunk_t ** pp_chunk)
-{
-    if ((*pp_chunk) != &m_chunk_queue.chunk[FDS_CHUNK_QUEUE_SIZE - 1])
-    {
-        (*pp_chunk)++;
-        return;
-    }
-
-    *pp_chunk = &m_chunk_queue.chunk[0];
-}
-
-
-// Retrieve the current chunk, and advance the queue.
-static void chunk_queue_get_and_advance(fds_record_chunk_t ** pp_chunk)
-{
-    if (m_chunk_queue.count != 0)
-    {
-        // Point to the current chunk and advance the queue.
-        *pp_chunk = &m_chunk_queue.chunk[m_chunk_queue.rp];
-
-        m_chunk_queue.rp = (m_chunk_queue.rp + 1) % FDS_CHUNK_QUEUE_SIZE;
-        m_chunk_queue.count--;
-    }
-}
-
-
-static void chunk_queue_skip(fds_op_t const * const p_op)
-{
-    if ((p_op->op_code == FDS_OP_WRITE) ||
-        (p_op->op_code == FDS_OP_UPDATE))
-    {
-        m_chunk_queue.rp    += p_op->write.chunk_count;
-        m_chunk_queue.count -= p_op->write.chunk_count;
-    }
-}
-
-
-// Enqueue an operation.
-static bool op_enqueue(fds_op_t           const * const p_op,
-                       uint32_t                         num_chunks,
-                       fds_record_chunk_t const * const p_chunk)
-{
-    uint32_t idx;
-    bool     ret = false;
-
-    CRITICAL_SECTION_ENTER();
-    if  ((m_op_queue.count    <= FDS_OP_QUEUE_SIZE - 1) &&
-         (m_chunk_queue.count <= FDS_CHUNK_QUEUE_SIZE - num_chunks))
-    {
-        idx = (m_op_queue.count + m_op_queue.rp) % FDS_OP_QUEUE_SIZE;
-
-        m_op_queue.op[idx] = *p_op;
-        m_op_queue.count++;
-
-        if (num_chunks != 0)
-        {
-            idx = (m_chunk_queue.count + m_chunk_queue.rp) % FDS_CHUNK_QUEUE_SIZE;
-
-            fds_record_chunk_t * p_chunk_dst;
-            p_chunk_dst = &m_chunk_queue.chunk[idx];
-
-            for (uint32_t i = 0; i < num_chunks; i++)
-            {
-                *p_chunk_dst = p_chunk[i];
-                chunk_queue_next(&p_chunk_dst);
-            }
-
-            m_chunk_queue.count += num_chunks;
-        }
-
-        ret = true;
-    }
-    CRITICAL_SECTION_EXIT();
-
-    return ret;
-}
-
-
-// This function is called during initialization to setup the page structure (m_pages) and
-// provide additional information regarding eventual further initialization steps.
-static fds_init_opts_t pages_init()
-{
-    uint32_t ret = NO_PAGES;
-    // The index of the page being initialized in m_pages[].
-    uint16_t page = 0;
-
-    for (uint16_t i = 0; i < FDS_VIRTUAL_PAGES; i++)
-    {
-        uint32_t        const * const p_page_addr = fs_config.p_start_addr + (i * FDS_PAGE_SIZE);
-        fds_page_type_t const         page_type   = page_identify(p_page_addr);
-
-        switch (page_type)
-        {
-            case FDS_PAGE_UNDEFINED:
-                if (page_is_erased(p_page_addr))
-                {
-                    if (m_swap_page.p_addr != NULL)
-                    {
-                        // If a swap page is already set, flag the page as erased (in m_pages)
-                        // and try to tag it as data (in flash) later on during initialization.
-                        m_pages[page].page_type    = FDS_PAGE_ERASED;
-                        m_pages[page].p_addr       = p_page_addr;
-                        m_pages[page].write_offset = FDS_PAGE_TAG_SIZE;
-
-                        // This is a candidate for a potential new swap page, in case the
-                        // current swap is going to be promoted to complete a GC instance.
-                        m_gc.cur_page = page;
-                        page++;
-                    }
-                    else
-                    {
-                        // If there is no swap page yet, use this one.
-                        m_swap_page.p_addr       = p_page_addr;
-                        m_swap_page.write_offset = FDS_PAGE_TAG_SIZE;
-                    }
-
-                    ret |= PAGE_ERASED;
-                }
-                break;
-
-            case FDS_PAGE_DATA:
-                m_pages[page].page_type = FDS_PAGE_DATA;
-                m_pages[page].p_addr    = p_page_addr;
-                // Scan the page to compute its write offset and determine whether or not the page
-                // can be garbage collected. Additionally, update the latest kwown record ID.
-                page_scan(p_page_addr, &m_pages[page].write_offset, &m_pages[page].can_gc);
-
-                ret |= PAGE_DATA;
-                page++;
-
-                break;
-
-            case FDS_PAGE_SWAP:
-                m_swap_page.p_addr = p_page_addr;
-                // If the swap is promoted, this offset should be kept, otherwise,
-                // it should be set to FDS_PAGE_TAG_SIZE.
-                page_scan(p_page_addr, &m_swap_page.write_offset, NULL);
-
-                ret |= (m_swap_page.write_offset == FDS_PAGE_TAG_SIZE) ?
-                        SWAP_EMPTY : SWAP_DIRTY;
-                break;
-
-            default:
-                // Shouldn't happen.
-                break;
-        }
-    }
-
-    return (fds_init_opts_t)ret;
-}
-
-
-// Write the first part of a record header (the key and length).
-static ret_code_t record_header_write_begin(fds_op_t * const p_op, uint32_t * const p_addr)
-{
-    ret_code_t ret;
-    ret = fs_store(&fs_config, p_addr + FDS_OFFSET_TL,
-                  (uint32_t*)&p_op->write.header.tl, FDS_HEADER_SIZE_TL);
-
-    // Write the record ID next.
-    p_op->write.step = FDS_OP_WRITE_RECORD_ID;
-
-    return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY;
-}
-
-
-static ret_code_t record_header_write_id(fds_op_t * const p_op, uint32_t * const p_addr)
-{
-    ret_code_t ret;
-    ret = fs_store(&fs_config, p_addr + FDS_OFFSET_ID,
-                   (uint32_t*)&p_op->write.header.record_id, FDS_HEADER_SIZE_ID);
-
-    // If this record has zero chunk, write the last part of the header directly.
-    // Otherwise, write the record chunks next.
-    p_op->write.step = (p_op->write.chunk_count != 0) ? FDS_OP_WRITE_CHUNKS :
-                                                        FDS_OP_WRITE_HEADER_FINALIZE;
-
-    return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY;
-}
-
-
-static ret_code_t record_header_write_finalize(fds_op_t * const p_op, uint32_t * const p_addr)
-{
-    ret_code_t ret;
-    ret = fs_store(&fs_config, p_addr + FDS_OFFSET_IC,
-                   (uint32_t*)&p_op->write.header.ic, FDS_HEADER_SIZE_IC);
-
-    // If this is a simple write operation, then this is the last step.
-    // If this is an update instead, delete the old record next.
-    p_op->write.step = (p_op->op_code == FDS_OP_UPDATE) ? FDS_OP_WRITE_FLAG_DIRTY :
-                                                          FDS_OP_WRITE_DONE;
-
-    return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY;
-}
-
-
-static ret_code_t record_header_flag_dirty(uint32_t * const p_record)
-{
-    // Flag the record as dirty.
-    fs_ret_t ret = fs_store(&fs_config, p_record,
-                            (uint32_t*)&m_fds_tl_dirty, FDS_HEADER_SIZE_TL);
-
-    return (ret == FS_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY;
-}
-
-
-static ret_code_t record_find_and_delete(fds_op_t * const p_op)
-{
-    ret_code_t        ret; 
-    uint16_t          page;
-    fds_record_desc_t desc = {0};
-
-    desc.record_id = p_op->del.record_to_delete;
-
-    if (record_find_by_desc(&desc, &page))
-    {
-        fds_header_t const * const p_header = (fds_header_t const *)desc.p_record;
-
-        // Copy the record key and file ID, so that they can be returned in the event.
-        // In case this function is run as part of an update, there is no need to copy
-        // the file ID and record key since they are present in the header stored
-        // in the queue element.
-
-        p_op->del.file_id    = p_header->ic.file_id;
-        p_op->del.record_key = p_header->tl.record_key;
-
-        // Flag the record as dirty.
-        ret = record_header_flag_dirty((uint32_t*)desc.p_record);
-
-        // This page can now be garbage collected.
-        m_pages[page].can_gc = true;
-    }
-    else
-    {
-        // The record never existed, or it has already been deleted.
-        ret = FDS_ERR_NOT_FOUND;
-    }
-
-    return ret;
-}
-
-
-// Finds a record within a file and flags it as dirty.
-static ret_code_t file_find_and_delete(fds_op_t * const p_op)
-{
-    ret_code_t        ret;
-    fds_record_desc_t desc;
-
-    // This token must persist across calls.
-    static fds_find_token_t tok = {0};
-
-    // Pass NULL to ignore the record key.
-    ret = record_find(&p_op->del.file_id, NULL, &desc, &tok);
-
-    if (ret == FDS_SUCCESS)
-    {
-         // A record was found: flag it as dirty.
-        ret = record_header_flag_dirty((uint32_t*)desc.p_record);
-
-        // This page can now be garbage collected.
-        m_pages[tok.page].can_gc = true;
-    }
-    else // FDS_ERR_NOT_FOUND
-    {
-        // No more records were found. Zero the token, so that it can be reused.
-        memset(&tok, 0x00, sizeof(fds_find_token_t));
-    }
-
-    return ret;
-}
-
-
-// Writes a record chunk to flash and advances the chunk queue. Additionally, decrements
-// the number of chunks left to write for this operation and accumulates the offset.
-static ret_code_t record_write_chunk(fds_op_t * const p_op, uint32_t * const p_addr)
-{
-    ret_code_t           ret;
-    fds_record_chunk_t * p_chunk = NULL;
-
-    // Retrieve the next chunk to be written.
-    chunk_queue_get_and_advance(&p_chunk);
-
-    ret = fs_store(&fs_config, p_addr + p_op->write.chunk_offset,
-                   p_chunk->p_data, p_chunk->length_words);
-
-    // Accumulate the offset.
-    p_op->write.chunk_offset += p_chunk->length_words;
-
-    // Decrement the number of chunks left to write.
-    // NOTE: If chunk_count is initially zero, this function is not called
-    // because this step is skipped entirely. See record_header_write_id().
-    p_op->write.chunk_count--;
-
-    if (p_op->write.chunk_count == 0)
-    {
-        // All record chunks have been written; write the last part of
-        // the record header to finalize the write operation.
-        p_op->write.step = FDS_OP_WRITE_HEADER_FINALIZE;
-    }
-
-    return (ret == NRF_SUCCESS) ? FDS_SUCCESS : FDS_ERR_BUSY;
-}
-
-
-#if defined(FDS_CRC_ENABLED)
-
-static bool crc_verify_success(uint16_t crc, uint16_t len_words, uint32_t const * const p_data)
-{
-    uint16_t computed_crc;
-
-    // The CRC is computed on the entire record, except the CRC field itself.
-    // The record header is 12 bytes, out of these we have to skip bytes 6 to 8 where the
-    // CRC itself is stored. Then we compute the CRC for the rest of the record, from byte 8 of
-    // the header (where the record ID begins) to the end of the record data.
-    computed_crc = crc16_compute((uint8_t const *)p_data,  6, NULL);
-    computed_crc = crc16_compute((uint8_t const *)p_data + 8,
-                                 (FDS_HEADER_SIZE_ID + len_words) * sizeof(uint32_t),
-                                 &computed_crc);
-
-    return (computed_crc == crc);
-}
-
-#endif
-
-
-static void gc_init(void)
-{
-    m_gc.run_count++;
-    m_gc.cur_page = 0;
-    m_gc.resume   = false;
-
-    // Setup which pages to GC. Defer checking for open records and the can_gc flag,
-    // as other operations might change those while GC is running.
-    for (uint16_t i = 0; i < FDS_MAX_PAGES; i++)
-    {
-        m_gc.do_gc_page[i] = (m_pages[i].page_type == FDS_PAGE_DATA);
-    }
-}
-
-
-// Obtain the next page to be garbage collected.
-// Returns true if there are pages left to garbage collect, returns false otherwise.
-static bool gc_page_next(uint16_t * const p_next_page)
-{
-    bool ret = false;
-
-    for (uint16_t i = 0; i < FDS_MAX_PAGES; i++)
-    {
-        if (m_gc.do_gc_page[i])
-        {
-            // Do not attempt to GC this page again.
-            m_gc.do_gc_page[i] = false;
-
-            // Only GC pages with no open records and with some records which have been deleted.
-            if ((m_pages[i].records_open == 0) && (m_pages[i].can_gc == true))
-            {
-                *p_next_page = i;
-                ret = true;
-                break;
-            }
-        }
-    }
-
-    return ret;
-}
-
-
-static ret_code_t gc_swap_erase(void)
-{
-    m_gc.state               = GC_DISCARD_SWAP;
-    m_swap_page.write_offset = FDS_PAGE_TAG_SIZE;
-
-    return fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE);
-}
-
-
-// Erase the page being garbage collected, or erase the swap in case there are any open
-// records on the page being garbage collected.
-static ret_code_t gc_page_erase(void)
-{
-    uint32_t       ret;
-    uint16_t const gc = m_gc.cur_page;
-
-    if (m_pages[gc].records_open == 0)
-    {
-        ret = fs_erase(&fs_config, m_pages[gc].p_addr, FDS_PHY_PAGES_IN_VPAGE);
-        m_gc.state = GC_ERASE_PAGE;
-    }
-    else
-    {
-        // If there are open records, stop garbage collection on this page.
-        // Discard the swap and try to garbage collect another page.
-        ret = gc_swap_erase();
-    }
-
-    return ret;
-}
-
-
-// Copy the current record to swap.
-static ret_code_t gc_record_copy(void)
-{
-    fds_header_t const * const p_header   = (fds_header_t*)m_gc.p_record_src;
-    uint32_t     const * const p_dest     = m_swap_page.p_addr + m_swap_page.write_offset;
-    uint16_t     const         record_len = FDS_HEADER_SIZE + p_header->tl.length_words;
-
-    m_gc.state = GC_COPY_RECORD;
-
-    // Copy the record to swap; it is guaranteed to fit in the destination page,
-    // so there is no need to check its size. This will either succeed or timeout.
-    return fs_store(&fs_config, p_dest, m_gc.p_record_src, record_len);
-}
-
-
-static ret_code_t gc_record_find_next(void)
-{
-    ret_code_t ret;
-
-    // Find the next valid record to copy.
-    if (record_find_next(m_gc.cur_page, &m_gc.p_record_src))
-    {
-        ret = gc_record_copy();
-    }
-    else
-    {
-        // No more records left to copy on this page; swap pages.
-        ret = gc_page_erase();
-    }
-
-    return ret;
-}
-
-
-// Promote the swap by tagging it as a data page.
-static ret_code_t gc_swap_promote(void)
-{
-    m_gc.state = GC_PROMOTE_SWAP;
-    return page_tag_write_data(m_pages[m_gc.cur_page].p_addr);
-}
-
-
-// Tag the page just garbage collected as swap.
-static ret_code_t gc_tag_new_swap(void)
-{
-    m_gc.state        = GC_TAG_NEW_SWAP;
-    m_gc.p_record_src = NULL;
-    return page_tag_write_swap();
-}
-
-
-static ret_code_t gc_next_page(void)
-{
-    if (!gc_page_next(&m_gc.cur_page))
-    {
-        // No pages left to GC; GC has terminated. Reset the state.
-        m_gc.state        = GC_BEGIN;
-        m_gc.cur_page     = 0;
-        m_gc.p_record_src = NULL;
-
-        return FDS_OP_COMPLETED;
-    }
-
-    return gc_record_find_next();
-}
-
-
-// Update the swap page offeset after a record has been successfully copied to it.
-static void gc_update_swap_offset(void)
-{
-    fds_header_t const * const p_header   = (fds_header_t*)m_gc.p_record_src;
-    uint16_t     const         record_len = FDS_HEADER_SIZE + p_header->tl.length_words;
-
-    m_swap_page.write_offset += record_len;
-}
-
-
-static void gc_swap_pages(void)
-{
-    // The page being garbage collected will be the new swap page,
-    // and the current swap will be used as a data page (promoted).
-    uint32_t const * const p_addr = m_swap_page.p_addr;
-
-    m_swap_page.p_addr            = m_pages[m_gc.cur_page].p_addr;
-    m_pages[m_gc.cur_page].p_addr = p_addr;
-
-    // Keep the offset for this page, but reset it for the swap.
-    m_pages[m_gc.cur_page].write_offset = m_swap_page.write_offset;
-    m_swap_page.write_offset            = FDS_PAGE_TAG_SIZE;
-}
-
-
-static void gc_state_advance(void)
-{
-    switch (m_gc.state)
-    {
-        case GC_BEGIN:
-            gc_init();
-            m_gc.state = GC_NEXT_PAGE;
-            break;
-
-        // A record was successfully copied.
-        case GC_COPY_RECORD:
-            gc_update_swap_offset();
-            m_gc.state = GC_FIND_NEXT_RECORD;
-            break;
-
-        // A page was successfully erased. Prepare to promote the swap.
-        case GC_ERASE_PAGE:
-            gc_swap_pages();
-            m_gc.state = GC_PROMOTE_SWAP;
-            break;
-
-        // Swap was discarded because the page being GC'ed had open records.
-        case GC_DISCARD_SWAP:
-        // Swap was sucessfully promoted.
-        case GC_PROMOTE_SWAP:
-            // Prepare to tag the page just GC'ed as swap.
-            m_gc.state = GC_TAG_NEW_SWAP;
-            break;
-
-        case GC_TAG_NEW_SWAP:
-            m_gc.state = GC_NEXT_PAGE;
-            break;
-
-        default:
-            // Should not happen.
-            break;
-    }
-}
-
-
-// Initialize the filesystem.
-static ret_code_t init_execute(uint32_t prev_ret, fds_op_t * const p_op)
-{
-    ret_code_t ret = FDS_ERR_INTERNAL;
-
-    if (prev_ret != FS_SUCCESS)
-    {
-        // A previous operation has timed out.
-        flag_clear(FDS_FLAG_INITIALIZING);
-        return FDS_ERR_OPERATION_TIMEOUT;
-    }
-
-    switch (p_op->init.step)
-    {
-        case FDS_OP_INIT_TAG_SWAP:
-            // The page write offset was determined previously by pages_init().
-            ret             = page_tag_write_swap();
-            p_op->init.step = FDS_OP_INIT_TAG_DATA;
-            break;
-
-        case FDS_OP_INIT_TAG_DATA:
-        {
-            // Tag remaining erased pages as data.
-            bool write_reqd = false;
-            for (uint16_t i = 0; i < FDS_MAX_PAGES; i++)
-            {
-                if (m_pages[i].page_type == FDS_PAGE_ERASED)
-                {
-                    ret = page_tag_write_data(m_pages[i].p_addr);
-                    m_pages[i].page_type = FDS_PAGE_DATA;
-                    write_reqd           = true;
-                    break;
-                }
-            }
-            if (!write_reqd)
-            {
-                flag_set(FDS_FLAG_INITIALIZED);
-                flag_clear(FDS_FLAG_INITIALIZING);
-                return FDS_OP_COMPLETED;
-            }
-        }
-        break;
-
-        case FDS_OP_INIT_ERASE_SWAP:
-            ret = fs_erase(&fs_config, m_swap_page.p_addr, FDS_PHY_PAGES_IN_VPAGE);
-            // If the swap is going to be discarded then reset its write_offset.
-            m_swap_page.write_offset = FDS_PAGE_TAG_SIZE;
-            p_op->init.step          = FDS_OP_INIT_TAG_SWAP;
-            break;
-
-        case FDS_OP_INIT_PROMOTE_SWAP:
-        {
-            // When promoting the swap, keep the write_offset set by pages_init().
-            ret = page_tag_write_data(m_swap_page.p_addr);
-        
-            uint16_t const         gc         = m_gc.cur_page;
-            uint32_t const * const p_old_swap = m_swap_page.p_addr;
-
-            // Execute the swap.
-            m_swap_page.p_addr = m_pages[gc].p_addr;
-            m_pages[gc].p_addr = p_old_swap;
-
-            // Copy the offset from the swap to the new page.
-            m_pages[gc].write_offset = m_swap_page.write_offset;
-            m_swap_page.write_offset = FDS_PAGE_TAG_SIZE;
-
-            m_pages[gc].page_type = FDS_PAGE_DATA;
-            p_op->init.step       = FDS_OP_INIT_TAG_SWAP;
-        }
-        break;
-
-        default:
-            // Should not happen.
-            break;
-    }
-
-    if (ret != FDS_SUCCESS)
-    {
-        // fstorage queue was full.
-        flag_clear(FDS_FLAG_INITIALIZING);
-        return FDS_ERR_BUSY;
-    }
-
-    return FDS_OP_EXECUTING;
-}
-
-
-// Executes write and update operations.
-static ret_code_t write_execute(uint32_t prev_ret, fds_op_t * const p_op)
-{
-    ret_code_t         ret;
-    uint32_t   *       p_write_addr;
-    fds_page_t * const p_page = &m_pages[p_op->write.page];
-
-    // This must persist across calls.
-    static fds_record_desc_t desc = {0};
-
-    if (prev_ret != FS_SUCCESS)
-    {
-        // The previous operation has timed out, update offsets.
-        page_offsets_update(p_page, p_op->write.header.tl.length_words);
-        return FDS_ERR_OPERATION_TIMEOUT;
-    }
-
-    // Compute the address where to write data.
-    p_write_addr = (uint32_t*)(p_page->p_addr + p_page->write_offset);
-
-    // Execute the current step of the operation, and set one to be executed next.
-    switch (p_op->write.step)
-    {
-        case FDS_OP_WRITE_FIND_RECORD:
-        {
-            // The first step of updating a record constists of locating the copy to be deleted.
-            // If the old copy couldn't be found for any reason then the update should fail.
-            // This prevents duplicates when queuing multiple updates of the same record.
-
-            uint16_t page;
-            desc.p_record  = NULL;
-            desc.record_id = p_op->write.record_to_delete;
-
-            if (!record_find_by_desc(&desc, &page))
-            {
-                return FDS_ERR_NOT_FOUND;
-            }
-            // Setting the step is redundant since we are falling through.
-        }
-        // Fallthrough to FDS_OP_WRITE_HEADER_BEGIN.
-
-        case FDS_OP_WRITE_HEADER_BEGIN:
-            ret = record_header_write_begin(p_op, p_write_addr);
-            break;
-
-        case FDS_OP_WRITE_RECORD_ID:
-            ret = record_header_write_id(p_op, p_write_addr);
-            break;
-
-        case FDS_OP_WRITE_CHUNKS:
-            ret = record_write_chunk(p_op, p_write_addr);
-            break;
-
-        case FDS_OP_WRITE_HEADER_FINALIZE:
-            ret = record_header_write_finalize(p_op, p_write_addr);
-            break;
-
-        case FDS_OP_WRITE_FLAG_DIRTY:
-            ret = record_header_flag_dirty((uint32_t*)desc.p_record);
-            p_op->write.step = FDS_OP_WRITE_DONE;
-            break;
-
-        case FDS_OP_WRITE_DONE:
-            ret = FDS_OP_COMPLETED;
-
-#if defined(FDS_CRC_ENABLED)
-            if (flag_is_set(FDS_FLAG_VERIFY_CRC))
-            {
-                if (!crc_verify_success(p_op->write.header.ic.crc16,
-                                        p_op->write.header.tl.length_words,
-                                        p_write_addr))
-                {
-                    ret = FDS_ERR_CRC_CHECK_FAILED;
-                }
-            }
-#endif
-            break;
-
-        default:
-            ret = FDS_ERR_INTERNAL;
-            break;
-    }
-
-    // An operation has either completed or failed. It may have failed because fstorage
-    // ran out of memory, or because the user tried to delete a record which did not exist.
-    if (ret != FDS_OP_EXECUTING)
-    {
-        // There won't be another callback for this operation, so update the page offset now.
-        page_offsets_update(p_page, p_op->write.header.tl.length_words);
-    }
-
-    return ret;
-}
-
-
-static ret_code_t delete_execute(uint32_t prev_ret, fds_op_t * const p_op)
-{
-    ret_code_t ret;
-
-    if (prev_ret != FS_SUCCESS)
-    {
-        return FDS_ERR_OPERATION_TIMEOUT;
-    }
-
-    switch (p_op->del.step)
-    {
-        case FDS_OP_DEL_RECORD_FLAG_DIRTY:
-            ret = record_find_and_delete(p_op);
-            p_op->del.step = FDS_OP_DEL_DONE;
-            break;
-
-        case FDS_OP_DEL_FILE_FLAG_DIRTY:
-            ret = file_find_and_delete(p_op);
-            if (ret == FDS_ERR_NOT_FOUND)
-            {
-                // No more records could be found.
-                // There won't be another callback for this operation, so return now.
-                ret = FDS_OP_COMPLETED;
-            }
-            break;
-
-        case FDS_OP_DEL_DONE:
-            ret = FDS_OP_COMPLETED;
-            break;
-
-        default:
-            ret = FDS_ERR_INTERNAL;
-            break;
-    }
-
-    return ret;
-}
-
-
-static ret_code_t gc_execute(uint32_t prev_ret)
-{
-    ret_code_t ret;
-
-    if (prev_ret != FS_SUCCESS)
-    {
-        return FDS_ERR_OPERATION_TIMEOUT;
-    }
-
-    if (m_gc.resume)
-    {
-        m_gc.resume = false;
-    }
-    else
-    {
-        gc_state_advance();
-    }
-
-    switch (m_gc.state)
-    {
-        case GC_NEXT_PAGE:
-            ret = gc_next_page();
-            break;
-
-        case GC_FIND_NEXT_RECORD:
-            ret = gc_record_find_next();
-            break;
-
-        case GC_COPY_RECORD:
-            ret = gc_record_copy();
-            break;
-
-        case GC_ERASE_PAGE:
-            ret = gc_page_erase();
-            break;
-
-        case GC_PROMOTE_SWAP:
-            ret = gc_swap_promote();
-            break;
-
-        case GC_TAG_NEW_SWAP:
-            ret = gc_tag_new_swap();
-            break;
-
-        default:
-            // Should not happen.
-            ret = FDS_ERR_INTERNAL;
-            break;
-    }
-
-    // Either FDS_OP_EXECUTING, FDS_OP_COMPLETED, FDS_ERR_BUSY or FDS_ERR_INTERNAL.
-    return ret;
-}
-
-
-static void queue_process(fs_ret_t result)
-{
-    ret_code_t         ret;
-    fds_op_t   * const p_op = &m_op_queue.op[m_op_queue.rp];
-
-    switch (p_op->op_code)
-    {
-        case FDS_OP_INIT:
-            ret = init_execute(result, p_op);
-            break;
-
-        case FDS_OP_WRITE:
-        case FDS_OP_UPDATE:
-            ret = write_execute(result, p_op);
-            break;
-
-        case FDS_OP_DEL_RECORD:
-        case FDS_OP_DEL_FILE:
-            ret = delete_execute(result, p_op);
-            break;
-
-        case FDS_OP_GC:
-            ret = gc_execute(result);
-            break;
-
-        default:
-            ret = FDS_ERR_INTERNAL;
-            break;
-    }
-
-    if (ret != FDS_OP_EXECUTING)
-    {
-        fds_evt_t evt;
-
-        if (ret == FDS_OP_COMPLETED)
-        {
-            evt.result = FDS_SUCCESS;
-        }
-        else
-        {
-            // Either FDS_ERR_BUSY, FDS_ERR_OPERATION_TIMEOUT,
-            // FDS_ERR_CRC_CHECK_FAILED or FDS_ERR_NOT_FOUND.
-            evt.result = ret;
-
-            // If this operation had any chunks in the queue, skip them.
-            chunk_queue_skip(p_op);
-        }
-
-        event_prepare(p_op, &evt);
-        event_send(&evt);
-
-        // Advance the queue, and if there are any queued operations, process them.
-        if (queue_advance())
-        {
-            queue_process(FS_SUCCESS);
-        }
-        else
-        {
-            // No more elements in the queue. Clear the FDS_FLAG_PROCESSING flag,
-            // so that new operation can start processing the queue.
-            flag_clear(FDS_FLAG_PROCESSING);
-        }
-    }
-}
-
-
-static void queue_start(void)
-{
-    if (!flag_is_set(FDS_FLAG_PROCESSING))
-    {
-        flag_set(FDS_FLAG_PROCESSING);
-        queue_process(FS_SUCCESS);
-    }
-}
-
-
-static void fs_event_handler(fs_evt_t const * const p_evt, fs_ret_t result)
-{
-    queue_process(result);
-}
-
-
-// Enqueues write and update operations.
-static ret_code_t write_enqueue(fds_record_desc_t         * const p_desc,
-                                fds_record_t        const * const p_record,
-                                fds_reserve_token_t const * const p_tok,
-                                fds_op_code_t                     op_code)
-{
-    ret_code_t ret;
-    fds_op_t   op;
-    uint16_t   page;
-    uint16_t   crc          = 0;
-    uint16_t   length_words = 0;
-
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    if (p_record == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    if ((p_record->file_id == FDS_FILE_ID_INVALID) ||
-        (p_record->key     == FDS_RECORD_KEY_DIRTY))
-    {
-        return FDS_ERR_INVALID_ARG;
-    }
-
-    if (!chunk_is_aligned(p_record->data.p_chunks,
-                          p_record->data.num_chunks))
-    {
-        return FDS_ERR_UNALIGNED_ADDR;
-    }
-
-    // No space was previously reserved for this operation.
-    if (p_tok == NULL)
-    {
-        // Compute the total length of the record.
-        for (uint32_t i = 0; i < p_record->data.num_chunks; i++)
-        {
-            length_words += p_record->data.p_chunks[i].length_words;
-        }
-
-        // Find a page where to write data.
-        ret = write_space_reserve(length_words, &page);
-
-        if (ret != FDS_SUCCESS)
-        {
-            // There is either not enough flash space available (FDS_ERR_NO_SPACE_IN_FLASH) or
-            // the record exceeds the virtual page size (FDS_ERR_RECORD_TOO_LARGE).
-            return ret;
-        }
-    }
-    else
-    {
-        page         = p_tok->page;
-        length_words = p_tok->length_words;
-    }
-
-    // Initialize the operation.
-    op.op_code                      = op_code;
-    op.write.step                   = FDS_OP_WRITE_HEADER_BEGIN;
-    op.write.page                   = page;
-    op.write.chunk_count            = p_record->data.num_chunks;
-    op.write.chunk_offset           = FDS_OFFSET_DATA;
-    op.write.header.record_id       = record_id_new();
-    op.write.header.ic.file_id      = p_record->file_id;
-    op.write.header.tl.record_key   = p_record->key;
-    op.write.header.tl.length_words = length_words;
-
-    if (op_code == FDS_OP_UPDATE)
-    {
-        op.write.step             = FDS_OP_WRITE_FIND_RECORD;
-        // Save the record ID of the record to be updated.
-        op.write.record_to_delete = p_desc->record_id;
-    }
-
-#if defined (FDS_CRC_ENABLED)
-    // First, compute the CRC for the first 6 bytes of the header which contain the
-    // record key, length and file ID, then, compute the CRC of the record ID (4 bytes).
-    crc = crc16_compute((uint8_t*)&op.write.header,           6, NULL);
-    crc = crc16_compute((uint8_t*)&op.write.header.record_id, 4, &crc);
-
-    for (uint32_t i = 0; i < p_record->data.num_chunks; i++)
-    {
-        // Compute the CRC for the record data.
-        crc = crc16_compute((uint8_t*)p_record->data.p_chunks[i].p_data,
-                            p_record->data.p_chunks[i].length_words * sizeof(uint32_t), &crc);
-    }
-#endif
-
-    op.write.header.ic.crc16 = crc;
-
-    // Attempt to enqueue the operation.
-    if (!op_enqueue(&op, p_record->data.num_chunks, p_record->data.p_chunks))
-    {
-        // No space availble in the queues. Cancel the reservation of flash space.
-        CRITICAL_SECTION_ENTER();
-        write_space_free(length_words, page);
-        CRITICAL_SECTION_EXIT();
-
-        return FDS_ERR_NO_SPACE_IN_QUEUES;
-    }
-
-     // Initialize the record descriptor, if provided.
-    if (p_desc != NULL)
-    {
-        p_desc->p_record       = NULL;
-        // Don't invoke record_id_new() again !
-        p_desc->record_id      = op.write.header.record_id;
-        p_desc->record_is_open = false;
-        p_desc->gc_run_count   = m_gc.run_count;
-    }
-
-    // Start processing the queue, if necessary.
-    queue_start();
-
-    return FDS_SUCCESS;
-}
-
-
-ret_code_t fds_register(fds_cb_t cb)
-{
-    ret_code_t ret;
-
-    CRITICAL_SECTION_ENTER();
-    if (m_users == FDS_MAX_USERS)
-    {
-        ret = FDS_ERR_USER_LIMIT_REACHED;
-    }
-    else
-    {
-        m_cb_table[m_users] = cb;
-        m_users++;
-
-        ret = FDS_SUCCESS;
-    }
-    CRITICAL_SECTION_EXIT();
-
-    return ret;
-}
-
-
-ret_code_t fds_init(void)
-{
-    fds_evt_t const evt_success = { .id = FDS_EVT_INIT, .result = FDS_SUCCESS };
-
-    // No initialization is necessary. Notify the application immediately.
-    if (flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        event_send(&evt_success);
-        return FDS_SUCCESS;
-    }
-
-    if (flag_is_set(FDS_FLAG_INITIALIZING))
-    {
-        return FDS_SUCCESS;
-    }
-
-    flag_set(FDS_FLAG_INITIALIZING);
-
-    (void)fs_init();
-
-    // Initialize the page structure (m_pages), and determine which
-    // initialization steps are required given the current state of the filesystem.
-    fds_init_opts_t init_opts = pages_init();
-
-    if (init_opts == NO_PAGES)
-    {
-        return FDS_ERR_NO_PAGES;
-    }
-
-    if (init_opts == ALREADY_INSTALLED)
-    {
-        // No initialization is necessary. Notify the application immediately.
-        flag_set(FDS_FLAG_INITIALIZED);
-        flag_clear(FDS_FLAG_INITIALIZING);
-
-        event_send(&evt_success);
-        return FDS_SUCCESS;
-    }
-
-    fds_op_t op;
-    op.op_code = FDS_OP_INIT;
-
-    switch (init_opts)
-    {
-        case FRESH_INSTALL:
-        case TAG_SWAP:
-            op.init.step = FDS_OP_INIT_TAG_SWAP;
-            break;
-
-        case PROMOTE_SWAP:
-        case PROMOTE_SWAP_INST:
-            op.init.step = FDS_OP_INIT_PROMOTE_SWAP;
-            break;
-
-        case DISCARD_SWAP:
-            op.init.step = FDS_OP_INIT_ERASE_SWAP;
-            break;
-
-        case TAG_DATA:
-        case TAG_DATA_INST:
-            op.init.step = FDS_OP_INIT_TAG_DATA;
-            break;
-
-        default:
-            // Should not happen.
-            break;
-    }
-
-    // This cannot fail since it will be the first operation in the queue.
-    (void)op_enqueue(&op, 0, NULL);
-
-    queue_start();
-
-    return FDS_SUCCESS;
-}
-
-
-ret_code_t fds_record_open(fds_record_desc_t  * const p_desc,
-                           fds_flash_record_t * const p_flash_rec)
-{
-    uint16_t page;
-
-    if ((p_desc == NULL) || (p_flash_rec == NULL))
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    // Find the record if necessary.
-    if (record_find_by_desc(p_desc, &page))
-    {
-        fds_header_t const * const p_header = (fds_header_t*)p_desc->p_record;
-
-#if defined(FDS_CRC_ENABLED)
-        if (!crc_verify_success(p_header->ic.crc16,
-                                p_header->tl.length_words,
-                                p_desc->p_record))
-        {
-            return FDS_ERR_CRC_CHECK_FAILED;
-        }
-#endif
-
-        CRITICAL_SECTION_ENTER();
-        m_pages[page].records_open++;
-        CRITICAL_SECTION_EXIT();
-
-        // Initialize p_flash_rec.
-        p_flash_rec->p_header = p_header;
-        p_flash_rec->p_data   = (p_desc->p_record + FDS_HEADER_SIZE);
-
-        // Set the record as open in the descriptor.
-        p_desc->record_is_open = true;
-
-        return FDS_SUCCESS;
-    }
-
-    // The record could not be found.
-    // It either never existed or it has been deleted.
-    return FDS_ERR_NOT_FOUND;
-}
-
-
-ret_code_t fds_record_close(fds_record_desc_t * const p_desc)
-{
-    ret_code_t ret;
-    uint16_t   page;
-
-    if (p_desc == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    if (record_find_by_desc((fds_record_desc_t*)p_desc, &page))
-    {
-        CRITICAL_SECTION_ENTER();
-        if ((m_pages[page].records_open > 0) && (p_desc->record_is_open))
-        {
-
-            m_pages[page].records_open--;
-            p_desc->record_is_open = false;
-
-            ret = FDS_SUCCESS;
-        }
-        else
-        {
-            ret = FDS_ERR_NO_OPEN_RECORDS;
-        }
-        CRITICAL_SECTION_EXIT();
-    }
-    else
-    {
-        ret = FDS_ERR_NOT_FOUND;
-    }
-
-    return ret;
-}
-
-
-ret_code_t fds_reserve(fds_reserve_token_t * const p_tok, uint16_t length_words)
-{
-    ret_code_t ret;
-    uint16_t   page;
-
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    if (p_tok == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    ret = write_space_reserve(length_words, &page);
-
-    if (ret == FDS_SUCCESS)
-    {
-        p_tok->page         = page;
-        p_tok->length_words = length_words;
-    }
-
-    return ret;
-}
-
-
-ret_code_t fds_reserve_cancel(fds_reserve_token_t * const p_tok)
-{
-    ret_code_t ret;
-
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    if (p_tok == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    if (p_tok->page > FDS_MAX_PAGES)
-    {
-        // The page does not exist. This shouldn't happen.
-        return FDS_ERR_INVALID_ARG;
-    }
-
-    fds_page_t const * const p_page = &m_pages[p_tok->page];
-
-    CRITICAL_SECTION_ENTER();
-    if (p_page->words_reserved - (FDS_HEADER_SIZE + p_tok->length_words) >= 0)
-    {
-        // Free reserved space.
-        write_space_free(p_tok->length_words, p_tok->page);
-
-        // Clean the token.
-        p_tok->page         = 0;
-        p_tok->length_words = 0;
-        ret = FDS_SUCCESS;
-    }
-    else
-    {
-        // We are trying to cancel a reservation of more words than how many are
-        // currently reserved on the page. Clearly, this shouldn't happen.
-        ret = FDS_ERR_INVALID_ARG;
-    }
-    CRITICAL_SECTION_EXIT();
-
-    return ret;
-}
-
-
-ret_code_t fds_record_write(fds_record_desc_t       * const p_desc,
-                            fds_record_t      const * const p_record)
-{
-    return write_enqueue(p_desc, p_record, NULL, FDS_OP_WRITE);
-}
-
-
-ret_code_t fds_record_write_reserved(fds_record_desc_t         * const p_desc,
-                                     fds_record_t        const * const p_record,
-                                     fds_reserve_token_t const * const p_tok)
-{
-    // A NULL token is not allowed when writing to a reserved space.
-    if (p_tok == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    return write_enqueue(p_desc, p_record, p_tok, FDS_OP_WRITE);
-}
-
-
-ret_code_t fds_record_update(fds_record_desc_t       * const p_desc,
-                             fds_record_t      const * const p_record)
-{
-    // A NULL descriptor is not allowed when updating a record.
-    if (p_desc == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    return write_enqueue(p_desc, p_record, NULL, FDS_OP_UPDATE);
-}
-
-
-ret_code_t fds_record_delete(fds_record_desc_t * const p_desc)
-{
-    fds_op_t op;
-
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    if (p_desc == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    op.op_code              = FDS_OP_DEL_RECORD;
-    op.del.step             = FDS_OP_DEL_RECORD_FLAG_DIRTY;
-    op.del.record_to_delete = p_desc->record_id;
-
-    if (op_enqueue(&op, 0, NULL))
-    {
-        queue_start();
-        return FDS_SUCCESS;
-    }
-
-   return FDS_ERR_NO_SPACE_IN_QUEUES;
-}
-
-
-ret_code_t fds_file_delete(uint16_t file_id)
-{
-    fds_op_t op;
-
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    if (file_id == FDS_FILE_ID_INVALID)
-    {
-        return FDS_ERR_INVALID_ARG;
-    }
-
-    op.op_code      = FDS_OP_DEL_FILE;
-    op.del.step     = FDS_OP_DEL_FILE_FLAG_DIRTY;
-    op.del.file_id  = file_id;
-
-    if (op_enqueue(&op, 0, NULL))
-    {
-        queue_start();
-        return FDS_SUCCESS;
-    }
-
-    return FDS_ERR_NO_SPACE_IN_QUEUES;
-}
-
-
-ret_code_t fds_gc(void)
-{
-    fds_op_t op;
-
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    op.op_code = FDS_OP_GC;
-
-    if (op_enqueue(&op, 0, NULL))
-    {
-        if (m_gc.state != GC_BEGIN)
-        {
-            // Resume GC by retrying the last step.
-            m_gc.resume = true;
-        }
-
-        queue_start();
-        return FDS_SUCCESS;
-    }
-
-    return FDS_ERR_NO_SPACE_IN_QUEUES;
-}
-
-
-ret_code_t fds_record_iterate(fds_record_desc_t * const p_desc,
-                              fds_find_token_t  * const p_token)
-{
-    return record_find(NULL, NULL, p_desc, p_token);
-}
-
-
-ret_code_t fds_record_find(uint16_t                  file_id,
-                           uint16_t                  record_key,
-                           fds_record_desc_t * const p_desc,
-                           fds_find_token_t  * const p_token)
-{
-    return record_find(&file_id, &record_key, p_desc, p_token);
-}
-
-
-ret_code_t fds_record_find_by_key(uint16_t                  record_key,
-                                  fds_record_desc_t * const p_desc,
-                                  fds_find_token_t  * const p_token)
-{
-    return record_find(NULL, &record_key, p_desc, p_token);
-}
-
-
-ret_code_t fds_record_find_in_file(uint16_t                  file_id,
-                                   fds_record_desc_t * const p_desc,
-                                   fds_find_token_t  * const p_token)
-{
-    return record_find(&file_id, NULL, p_desc, p_token);
-}
-
-
-ret_code_t fds_descriptor_from_rec_id(fds_record_desc_t * const p_desc,
-                                      uint32_t                  record_id)
-{
-    if (p_desc == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    // Zero the descriptor and set the record_id field.
-    memset(p_desc, 0x00, sizeof(fds_record_desc_t));
-    p_desc->record_id = record_id;
-
-    return FDS_SUCCESS;
-}
-
-
-ret_code_t fds_record_id_from_desc(fds_record_desc_t const * const p_desc,
-                                   uint32_t                * const p_record_id)
-{
-    if ((p_desc == NULL) || (p_record_id == NULL))
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    *p_record_id = p_desc->record_id;
-
-    return FDS_SUCCESS;
-}
-
-
-ret_code_t fds_stat(fds_stat_t * const p_stat)
-{
-    uint16_t const words_in_page = FDS_PAGE_SIZE - FDS_PAGE_TAG_SIZE;
-    // The largest number of free contiguous words on any page.
-    uint16_t       contig_words  = 0;
-
-    if (!flag_is_set(FDS_FLAG_INITIALIZED))
-    {
-        return FDS_ERR_NOT_INITIALIZED;
-    }
-
-    if (p_stat == NULL)
-    {
-        return FDS_ERR_NULL_ARG;
-    }
-
-    memset(p_stat, 0x00, sizeof(fds_stat_t));
-
-    for (uint16_t i = 0; i < FDS_MAX_PAGES; i++)
-    {
-        uint32_t const * p_record   = NULL;
-        uint16_t const   words_used = m_pages[i].write_offset + m_pages[i].words_reserved;
-
-        p_stat->open_records += m_pages[i].records_open;
-        p_stat->words_used   += words_used;
-        contig_words         =  (words_in_page - words_used);
-
-        if (contig_words > p_stat->largest_contig)
-        {
-            p_stat->largest_contig = contig_words;
-        }
-
-        while (record_find_next(i, &p_record))
-        {
-            p_stat->valid_records++;
-        }
-
-        dirty_records_stat(i, &p_stat->dirty_records, &p_stat->freeable_words);
-    }
-
-    return FDS_SUCCESS;
-}
-
-
-#if defined(FDS_CRC_ENABLED)
-
-ret_code_t fds_verify_crc_on_writes(bool enable)
-{
-    if (enable)
-    {
-        flag_set(FDS_FLAG_VERIFY_CRC);
-    }
-    else
-    {
-        flag_clear(FDS_FLAG_VERIFY_CRC);
-    }
-
-    return FDS_SUCCESS;
-}
-
-#endif
-


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

Posted by cc...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/nrf51-blenano/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-blenano/include/bsp/nrf_drv_config.h b/hw/bsp/nrf51-blenano/include/bsp/nrf_drv_config.h
deleted file mode 100644
index 187bbb1..0000000
--- a/hw/bsp/nrf51-blenano/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,472 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 0
-/* NOTE: SCK definitions match NRF51 DK product brief */
-#define SPI0_CONFIG_SCK_PIN         29
-#define SPI0_CONFIG_MOSI_PIN        25
-#define SPI0_CONFIG_MISO_PIN        28
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 0
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         2
-#define SPIS0_CONFIG_MOSI_PIN        3
-#define SPIS0_CONFIG_MISO_PIN        4
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 1
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_SCK_PIN         29
-#define SPIS1_CONFIG_MOSI_PIN        25
-#define SPIS1_CONFIG_MISO_PIN        28
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          0
-#define TWI0_CONFIG_SDA          1
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 0
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 0
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 1
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 0
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 0
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 0
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/nrf51dk-16kbram/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk-16kbram/include/bsp/nrf_drv_config.h b/hw/bsp/nrf51dk-16kbram/include/bsp/nrf_drv_config.h
deleted file mode 100644
index 36c0307..0000000
--- a/hw/bsp/nrf51dk-16kbram/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,474 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 0
-/* NOTE: SCK definitions match NRF51 DK product brief */
-#define SPI0_CONFIG_CSN_PIN         24 /* Note: not defined by SDK */
-#define SPI0_CONFIG_SCK_PIN         29
-#define SPI0_CONFIG_MOSI_PIN        25
-#define SPI0_CONFIG_MISO_PIN        28
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 0
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         2
-#define SPIS0_CONFIG_MOSI_PIN        3
-#define SPIS0_CONFIG_MISO_PIN        4
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 1
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_CSN_PIN         24 /* Note: not defined by SDK */
-#define SPIS1_CONFIG_SCK_PIN         29
-#define SPIS1_CONFIG_MOSI_PIN        25
-#define SPIS1_CONFIG_MISO_PIN        28
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          7
-#define TWI0_CONFIG_SDA          30
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 0
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 0
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 1
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 0
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 0
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 0
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/nrf51dk/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/include/bsp/nrf_drv_config.h b/hw/bsp/nrf51dk/include/bsp/nrf_drv_config.h
deleted file mode 100644
index bd7f62a..0000000
--- a/hw/bsp/nrf51dk/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,472 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 0
-/* NOTE: SCK definitions match NRF51 DK product brief */
-#define SPI0_CONFIG_SCK_PIN         29
-#define SPI0_CONFIG_MOSI_PIN        25
-#define SPI0_CONFIG_MISO_PIN        28
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 0
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         2
-#define SPIS0_CONFIG_MOSI_PIN        3
-#define SPIS0_CONFIG_MISO_PIN        4
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 1
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_SCK_PIN         29
-#define SPIS1_CONFIG_MOSI_PIN        25
-#define SPIS1_CONFIG_MISO_PIN        28
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          7
-#define TWI0_CONFIG_SDA          30
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 0
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 0
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 1
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 0
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 0
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 0
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/nrf52dk/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52dk/include/bsp/nrf_drv_config.h b/hw/bsp/nrf52dk/include/bsp/nrf_drv_config.h
deleted file mode 100644
index 6458bc2..0000000
--- a/hw/bsp/nrf52dk/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,471 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 1
-#define SPI0_CONFIG_SCK_PIN         23
-#define SPI0_CONFIG_MOSI_PIN        24
-#define SPI0_CONFIG_MISO_PIN        25
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 1
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         23
-#define SPIS0_CONFIG_MOSI_PIN        24
-#define SPIS0_CONFIG_MISO_PIN        25
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 0
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_SCK_PIN         2
-#define SPIS1_CONFIG_MOSI_PIN        3
-#define SPIS1_CONFIG_MISO_PIN        4
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          27
-#define TWI0_CONFIG_SDA          26
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 1
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 1
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 0
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 1
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 1
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 1
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/rb-nano2/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/rb-nano2/include/bsp/nrf_drv_config.h b/hw/bsp/rb-nano2/include/bsp/nrf_drv_config.h
deleted file mode 100644
index b5c7806..0000000
--- a/hw/bsp/rb-nano2/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,471 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 1
-#define SPI0_CONFIG_SCK_PIN         2
-#define SPI0_CONFIG_MOSI_PIN        3
-#define SPI0_CONFIG_MISO_PIN        4
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 1
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         23
-#define SPIS0_CONFIG_MOSI_PIN        24
-#define SPIS0_CONFIG_MISO_PIN        25
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 0
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_SCK_PIN         2
-#define SPIS1_CONFIG_MOSI_PIN        3
-#define SPIS1_CONFIG_MISO_PIN        4
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          0
-#define TWI0_CONFIG_SDA          1
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 1
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 1
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 0
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 1
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 1
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 1
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/nrf51xxx/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf51xxx/pkg.yml b/hw/mcu/nordic/nrf51xxx/pkg.yml
index fad358c..1043c16 100644
--- a/hw/mcu/nordic/nrf51xxx/pkg.yml
+++ b/hw/mcu/nordic/nrf51xxx/pkg.yml
@@ -25,7 +25,7 @@ pkg.keywords:
     - nrf51
 
 pkg.deps: 
-    - hw/hal 
-    - hw/cmsis-core 
-    - hw/mcu/nordic 
+    - '@mynewt_nordic/hw/mcu/nordic_sdk'
     - compiler/arm-none-eabi-m0
+    - hw/cmsis-core 
+    - hw/hal 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/nrf52xxx/pkg.yml
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf52xxx/pkg.yml b/hw/mcu/nordic/nrf52xxx/pkg.yml
index ae087c0..a9d4862 100644
--- a/hw/mcu/nordic/nrf52xxx/pkg.yml
+++ b/hw/mcu/nordic/nrf52xxx/pkg.yml
@@ -25,7 +25,7 @@ pkg.keywords:
     - nrf52
 
 pkg.deps: 
-    - hw/hal 
-    - hw/mcu/nordic
-    - hw/cmsis-core 
+    - '@mynewt_nordic/hw/mcu/nordic_sdk'
     - compiler/arm-none-eabi-m4
+    - hw/cmsis-core 
+    - hw/hal 

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/adc/nrf_drv_adc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/adc/nrf_drv_adc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/adc/nrf_drv_adc.c
deleted file mode 100644
index 5a81002..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/adc/nrf_drv_adc.c
+++ /dev/null
@@ -1,253 +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_adc.h"
-#include "nrf_drv_common.h"
-#include "nrf_assert.h"
-#include "app_util_platform.h"
-#include "app_util.h"
-
-typedef struct
-{
-    nrf_drv_adc_event_handler_t event_handler;
-    nrf_drv_adc_channel_t     * p_head;
-    nrf_drv_adc_channel_t     * p_current_conv;
-    nrf_adc_value_t           * p_buffer;
-    uint8_t                     size;
-    uint8_t                     idx;
-    nrf_drv_state_t             state;
-} adc_cb_t;
-
-static adc_cb_t m_cb;
-static const nrf_drv_adc_config_t m_default_config = NRF_DRV_ADC_DEFAULT_CONFIG;
-
-ret_code_t nrf_drv_adc_init(nrf_drv_adc_config_t const * p_config,
-                            nrf_drv_adc_event_handler_t  event_handler)
-{
-    if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    nrf_adc_event_clear(NRF_ADC_EVENT_END);
-    if (event_handler)
-    {
-        if (!p_config)
-        {
-            p_config = (nrf_drv_adc_config_t *)&m_default_config;
-        }
-        nrf_drv_common_irq_enable(ADC_IRQn, p_config->interrupt_priority);
-    }
-    m_cb.event_handler = event_handler;
-    m_cb.state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_adc_uninit(void)
-{
-    m_cb.p_head = NULL;
-    nrf_drv_common_irq_disable(ADC_IRQn);
-    nrf_adc_int_disable(NRF_ADC_INT_END_MASK);
-    nrf_adc_task_trigger(NRF_ADC_TASK_STOP);
-
-    m_cb.state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-void nrf_drv_adc_channel_enable(nrf_drv_adc_channel_t * const p_channel)
-{
-    ASSERT(mp_state == NRF_DRV_STATE_INITIALIZED);
-    ASSERT(!is_address_from_stack(p_channel));
-
-    p_channel->p_next = NULL;
-    if (m_cb.p_head == NULL)
-    {
-        m_cb.p_head = p_channel;
-    }
-    else
-    {
-        nrf_drv_adc_channel_t * p_curr_channel = m_cb.p_head;
-        while (p_curr_channel->p_next != NULL)
-        {
-            ASSERT(p_channel != p_curr_channel);
-            p_curr_channel = p_curr_channel->p_next;
-        }
-        p_curr_channel->p_next = p_channel;
-    }
-}
-
-void nrf_drv_adc_channel_disable(nrf_drv_adc_channel_t * const p_channel)
-{
-    ASSERT(mp_state == NRF_DRV_STATE_INITIALIZED);
-    ASSERT(m_cb.p_head);
-
-    nrf_drv_adc_channel_t * p_curr_channel = m_cb.p_head;
-    nrf_drv_adc_channel_t * p_prev_channel = NULL;
-    while(p_curr_channel != p_channel)
-    {
-        p_prev_channel = p_curr_channel;
-        p_curr_channel = p_curr_channel->p_next;
-        ASSERT(p_curr_channel == NULL);
-    }
-    if (p_prev_channel)
-    {
-        p_prev_channel->p_next = p_curr_channel->p_next;
-    }
-    else
-    {
-        m_cb.p_head = p_curr_channel->p_next;
-    }
-}
-
-void nrf_drv_adc_sample(void)
-{
-    ASSERT(mp_state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(!nrf_adc_is_busy());
-    nrf_adc_start();
-}
-
-ret_code_t nrf_drv_adc_sample_convert(nrf_drv_adc_channel_t const * const p_channel, 
-                                      nrf_adc_value_t * p_value)
-{
-    ASSERT(mp_state != NRF_DRV_STATE_UNINITIALIZED);
-    if(m_cb.state == NRF_DRV_STATE_POWERED_ON)
-    {
-        return NRF_ERROR_BUSY;
-    }
-    else
-    {
-        m_cb.state = NRF_DRV_STATE_POWERED_ON;
-
-        nrf_adc_config_set(p_channel->config.data);
-        nrf_adc_enable();
-        nrf_adc_int_disable(NRF_ADC_INT_END_MASK);
-        nrf_adc_start();
-        if (p_value)
-        {
-            while(!nrf_adc_event_check(NRF_ADC_EVENT_END)) {}
-            nrf_adc_event_clear(NRF_ADC_EVENT_END);
-            *p_value = (nrf_adc_value_t)nrf_adc_result_get();
-            nrf_adc_disable();
-
-            m_cb.state = NRF_DRV_STATE_INITIALIZED;
-        }
-        else
-        {
-            ASSERT(m_cb.event_handler);
-            m_cb.p_buffer = NULL;
-            nrf_adc_int_enable(NRF_ADC_INT_END_MASK);
-        }
-        return NRF_SUCCESS;
-    }
-}
-
-static bool adc_sample_process()
-{
-    nrf_adc_event_clear(NRF_ADC_EVENT_END);
-    nrf_adc_disable();
-    m_cb.p_buffer[m_cb.idx] = (nrf_adc_value_t)nrf_adc_result_get();
-    m_cb.idx++;
-    if (m_cb.idx < m_cb.size)
-    {
-        bool task_trigger = false;
-        if (m_cb.p_current_conv->p_next == NULL)
-        {
-            m_cb.p_current_conv = m_cb.p_head;
-        }
-        else
-        {
-            m_cb.p_current_conv = m_cb.p_current_conv->p_next;
-            task_trigger = true;
-        }
-        nrf_adc_config_set(m_cb.p_current_conv->config.data);
-        nrf_adc_enable();
-        if (task_trigger)
-        {
-            //nrf_adc_start();
-            nrf_adc_task_trigger(NRF_ADC_TASK_START);
-        }
-        return false;
-    }
-    else
-    {
-        return true;
-    }
-}
-
-ret_code_t nrf_drv_adc_buffer_convert(nrf_adc_value_t * buffer, uint16_t size)
-{
-    ASSERT(mp_state != NRF_DRV_STATE_UNINITIALIZED);
-    if(m_cb.state == NRF_DRV_STATE_POWERED_ON)
-    {
-        return NRF_ERROR_BUSY;
-    }
-    else
-    {
-        m_cb.state          = NRF_DRV_STATE_POWERED_ON;
-        m_cb.p_current_conv = m_cb.p_head;
-        m_cb.size           = size;
-        m_cb.idx            = 0;
-        m_cb.p_buffer       = buffer;
-        nrf_adc_config_set(m_cb.p_current_conv->config.data);
-        nrf_adc_event_clear(NRF_ADC_EVENT_END);
-        nrf_adc_enable();
-        if (m_cb.event_handler)
-        {
-            nrf_adc_int_enable(NRF_ADC_INT_END_MASK);
-        }
-        else
-        {
-            while(1)
-            {
-                while(!nrf_adc_event_check(NRF_ADC_EVENT_END)){}
-
-                if (adc_sample_process())
-                {
-                    m_cb.state = NRF_DRV_STATE_INITIALIZED;
-                    break;
-                }
-            }
-        }
-        return NRF_SUCCESS;
-    }
-}
-
-bool nrf_drv_adc_is_busy(void)
-{
-    ASSERT(mp_state != NRF_DRV_STATE_UNINITIALIZED);
-    return (m_cb.state == NRF_DRV_STATE_POWERED_ON) ? true : false;
-}
-
-void ADC_IRQHandler(void)
-{
-    if (m_cb.p_buffer == NULL)
-    {
-        nrf_adc_event_clear(NRF_ADC_EVENT_END);
-        nrf_adc_int_disable(NRF_ADC_INT_END_MASK);
-        nrf_adc_disable();
-        nrf_drv_adc_evt_t evt;
-        evt.type = NRF_DRV_ADC_EVT_SAMPLE;
-        evt.data.sample.sample = (nrf_adc_value_t)nrf_adc_result_get();
-        m_cb.state = NRF_DRV_STATE_INITIALIZED;
-        m_cb.event_handler(&evt);
-    }
-    else if (adc_sample_process())
-    {
-        nrf_adc_int_disable(NRF_ADC_INT_END_MASK);
-        nrf_drv_adc_evt_t evt;
-        evt.type = NRF_DRV_ADC_EVT_DONE;
-        evt.data.done.p_buffer = m_cb.p_buffer;
-        evt.data.done.size     = m_cb.size;
-        m_cb.state = NRF_DRV_STATE_INITIALIZED;
-        m_cb.event_handler(&evt);
-    }
-}


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

Posted by cc...@apache.org.
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/i2s/nrf_drv_i2s.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/i2s/nrf_drv_i2s.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/i2s/nrf_drv_i2s.c
deleted file mode 100644
index 7d978e9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/i2s/nrf_drv_i2s.c
+++ /dev/null
@@ -1,355 +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_i2s.h"
-#include "nrf_drv_common.h"
-#include "nrf_gpio.h"
-#include "nrf_assert.h"
-#include "app_util_platform.h"
-#include "sdk_common.h"
-
-#if (I2S_ENABLED == 0)
-    #error "I2S not enabled in driver configuration file."
-#endif
-
-// Control block - driver instance local data.
-typedef struct
-{
-    nrf_drv_i2s_data_handler_t handler;
-    nrf_drv_state_t            state;
-
-    bool       synchronized_mode : 1;
-    bool       rx_ready          : 1;
-    bool       tx_ready          : 1;
-    bool       just_started      : 1;
-    uint16_t   buffer_half_size;
-    uint32_t * p_rx_buffer;
-    uint32_t * p_tx_buffer;
-} i2s_control_block_t;
-static i2s_control_block_t m_cb;
-
-#define MODULE_INITIALIZED (m_cb.state == NRF_DRV_STATE_INITIALIZED)
-#include "sdk_macros.h"
-
-static nrf_drv_i2s_config_t const m_default_config = NRF_DRV_I2S_DEFAULT_CONFIG;
-
-
-static void configure_pins(nrf_drv_i2s_config_t const * p_config)
-{
-    uint32_t mck_pin, sdout_pin, sdin_pin;
-
-    // Configure pins used by the peripheral:
-
-    // - SCK and LRCK (required) - depending on the mode of operation these
-    //   pins are configured as outputs (in Master mode) or inputs (in Slave
-    //   mode).
-    if (p_config->mode == NRF_I2S_MODE_MASTER)
-    {
-        nrf_gpio_cfg_output(p_config->sck_pin);
-        nrf_gpio_cfg_output(p_config->lrck_pin);
-    }
-    else
-    {
-        nrf_gpio_cfg_input(p_config->sck_pin,  NRF_GPIO_PIN_NOPULL);
-        nrf_gpio_cfg_input(p_config->lrck_pin, NRF_GPIO_PIN_NOPULL);
-    }
-
-    // - MCK (optional) - always output,
-    if (p_config->mck_pin != NRF_DRV_I2S_PIN_NOT_USED)
-    {
-        mck_pin = p_config->mck_pin;
-        nrf_gpio_cfg_output(mck_pin);
-    }
-    else
-    {
-        mck_pin = NRF_I2S_PIN_NOT_CONNECTED;
-    }
-
-    // - SDOUT (optional) - always output,
-    if (p_config->sdout_pin != NRF_DRV_I2S_PIN_NOT_USED)
-    {
-        sdout_pin = p_config->sdout_pin;
-        nrf_gpio_cfg_output(sdout_pin);
-    }
-    else
-    {
-        sdout_pin = NRF_I2S_PIN_NOT_CONNECTED;
-    }
-
-    // - SDIN (optional) - always input.
-    if (p_config->sdin_pin != NRF_DRV_I2S_PIN_NOT_USED)
-    {
-        sdin_pin = p_config->sdin_pin;
-        nrf_gpio_cfg_input(sdin_pin, NRF_GPIO_PIN_NOPULL);
-    }
-    else
-    {
-        sdin_pin = NRF_I2S_PIN_NOT_CONNECTED;
-    }
-
-    nrf_i2s_pins_set(NRF_I2S, p_config->sck_pin, p_config->lrck_pin,
-        mck_pin, sdout_pin, sdin_pin);
-}
-
-
-ret_code_t nrf_drv_i2s_init(nrf_drv_i2s_config_t const * p_config,
-                            nrf_drv_i2s_data_handler_t   handler)
-{
-    ASSERT(handler);
-    if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config;
-    }
-
-    if (!nrf_i2s_configure(NRF_I2S, p_config->mode,
-                                    p_config->format,
-                                    p_config->alignment,
-                                    p_config->sample_width,
-                                    p_config->channels,
-                                    p_config->mck_setup,
-                                    p_config->ratio))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    configure_pins(p_config);
-
-    m_cb.handler = handler;
-
-    nrf_drv_common_irq_enable(I2S_IRQn, p_config->irq_priority);
-
-    m_cb.state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_i2s_uninit(void)
-{
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-
-    nrf_drv_i2s_stop();
-
-    nrf_drv_common_irq_disable(I2S_IRQn);
-
-    m_cb.state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-
-ret_code_t nrf_drv_i2s_start(uint32_t * p_rx_buffer,
-                             uint32_t * p_tx_buffer,
-                             uint16_t   buffer_size,
-                             uint8_t    flags)
-{
-    ASSERT((p_rx_buffer != NULL) || (p_tx_buffer != NULL));
-
-    uint16_t buffer_half_size = buffer_size / 2;
-    ASSERT(buffer_half_size != 0);
-
-    VERIFY_MODULE_INITIALIZED();
-
-    if ((p_rx_buffer != NULL) && !nrf_drv_is_in_RAM(p_rx_buffer))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    if ((p_tx_buffer != NULL) && !nrf_drv_is_in_RAM(p_tx_buffer))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    // Initially we set up the peripheral to use the first half of each buffer,
-    // then in 'I2S_IRQHandler' we will switch to the second half.
-    nrf_i2s_transfer_set(NRF_I2S, buffer_half_size, p_rx_buffer, p_tx_buffer);
-
-    m_cb.p_rx_buffer      = p_rx_buffer;
-    m_cb.p_tx_buffer      = p_tx_buffer;
-    m_cb.buffer_half_size = buffer_half_size;
-    m_cb.just_started     = true;
-
-    if ((flags & NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE) &&
-        // [synchronized mode makes sense only when both RX and TX are enabled]
-        (m_cb.p_rx_buffer != NULL) && (m_cb.p_tx_buffer != NULL))
-    {
-        m_cb.synchronized_mode = true;
-        m_cb.rx_ready          = false;
-        m_cb.tx_ready          = false;
-    }
-    else
-    {
-        m_cb.synchronized_mode = false;
-    }
-
-    nrf_i2s_enable(NRF_I2S);
-
-    m_cb.state = NRF_DRV_STATE_POWERED_ON;
-
-    if (m_cb.p_tx_buffer != NULL)
-    {
-        // Get from the application the first portion of data to be sent - we
-        // need to have it in the transmit buffer before we start the transfer.
-        // Unless the synchronized mode is active. In this mode we must wait
-        // with this until the first portion of data is received, so here we
-        // just make sure that there will be silence on the SDOUT line prior
-        // to that moment.
-        if (m_cb.synchronized_mode)
-        {
-            memset(m_cb.p_tx_buffer, 0, buffer_size);
-        }
-        else
-        {
-            m_cb.handler(NULL, m_cb.p_tx_buffer, m_cb.buffer_half_size);
-        }
-    }
-
-    nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD);
-    nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD);
-    nrf_i2s_int_enable(NRF_I2S,
-        NRF_I2S_INT_RXPTRUPD_MASK | NRF_I2S_INT_TXPTRUPD_MASK);
-    nrf_i2s_task_trigger(NRF_I2S, NRF_I2S_TASK_START);
-
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_i2s_stop(void)
-{
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-
-    // First disable interrupts, then trigger the STOP task, so no spurious
-    // RXPTRUPD and TXPTRUPD events (see FTPAN-55) will be processed.
-    nrf_i2s_int_disable(NRF_I2S,
-        NRF_I2S_INT_RXPTRUPD_MASK | NRF_I2S_INT_TXPTRUPD_MASK);
-
-    nrf_i2s_task_trigger(NRF_I2S, NRF_I2S_TASK_STOP);
-
-    nrf_i2s_disable(NRF_I2S);
-
-    m_cb.state = NRF_DRV_STATE_INITIALIZED;
-}
-
-
-void I2S_IRQHandler(void)
-{
-    uint32_t * p_data_received = NULL;
-    uint32_t * p_data_to_send  = NULL;
-
-    if (nrf_i2s_event_check(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD))
-    {
-        nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_TXPTRUPD);
-
-        // If transmission is not enabled, but for some reason the TXPTRUPD
-        // event has been generated, just ignore it.
-        if (m_cb.p_tx_buffer != NULL)
-        {
-            uint32_t * p_tx_buffer_next;
-            if (nrf_i2s_tx_buffer_get(NRF_I2S) == m_cb.p_tx_buffer)
-            {
-                p_tx_buffer_next = m_cb.p_tx_buffer + m_cb.buffer_half_size;
-            }
-            else
-            {
-                p_tx_buffer_next = m_cb.p_tx_buffer;
-            }
-            nrf_i2s_tx_buffer_set(NRF_I2S, p_tx_buffer_next);
-
-            m_cb.tx_ready = true;
-
-            // Now the part of the buffer that we've configured as "next" should
-            // be filled by the application with proper data to be sent;
-            // the peripheral is sending data from the other part of the buffer
-            // (but it will finish soon...).
-            p_data_to_send = p_tx_buffer_next;
-        }
-    }
-
-    if (nrf_i2s_event_check(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD))
-    {
-        nrf_i2s_event_clear(NRF_I2S, NRF_I2S_EVENT_RXPTRUPD);
-
-        // If reception is not enabled, but for some reason the RXPTRUPD event
-        // has been generated, just ignore it.
-        if (m_cb.p_rx_buffer != NULL)
-        {
-            uint32_t * p_rx_buffer_next;
-            if (nrf_i2s_rx_buffer_get(NRF_I2S) == m_cb.p_rx_buffer)
-            {
-                p_rx_buffer_next = m_cb.p_rx_buffer + m_cb.buffer_half_size;
-            }
-            else
-            {
-                p_rx_buffer_next = m_cb.p_rx_buffer;
-            }
-            nrf_i2s_rx_buffer_set(NRF_I2S, p_rx_buffer_next);
-
-            m_cb.rx_ready = true;
-
-            // The RXPTRUPD event is generated for the first time right after
-            // the transfer is started. Since there is no data received yet at
-            // this point we only update the buffer pointer (it is done above),
-            // there is no callback to the application.
-            // [for synchronized mode this has to be handled differently -
-            //  see below]
-            if (m_cb.just_started && !m_cb.synchronized_mode)
-            {
-                m_cb.just_started = false;
-            }
-            else
-            {
-                // The RXPTRUPD event indicates that from now on the peripheral
-                // will be filling the part of the buffer that was pointed at
-                // the time the event has been generated, hence now we can let
-                // the application process the data stored in the other part of
-                // the buffer - the one that we've just set to be filled next.
-                p_data_received = p_rx_buffer_next;
-            }
-        }
-    }
-
-    // Call the data handler passing received data to the application and/or
-    // requesting data to be sent.
-    if (!m_cb.synchronized_mode)
-    {
-        if ((p_data_received != NULL) || (p_data_to_send != NULL))
-        {
-            m_cb.handler(p_data_received, p_data_to_send,
-                m_cb.buffer_half_size);
-        }
-    }
-    // In the synchronized mode wait until the events for both RX and TX occur.
-    // And ignore the initial occurrences of these events, since they only
-    // indicate that the transfer has started - no data is received yet at
-    // that moment, so we have got nothing to pass to the application.
-    else
-    {
-        if (m_cb.rx_ready && m_cb.tx_ready)
-        {
-            m_cb.rx_ready = false;
-            m_cb.tx_ready = false;
-
-            if (m_cb.just_started)
-            {
-                m_cb.just_started = false;
-            }
-            else
-            {
-                m_cb.handler(nrf_i2s_rx_buffer_get(NRF_I2S),
-                             nrf_i2s_tx_buffer_get(NRF_I2S),
-                             m_cb.buffer_half_size);
-            }
-        }
-    }
-}

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/i2s/nrf_drv_i2s.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/i2s/nrf_drv_i2s.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/i2s/nrf_drv_i2s.h
deleted file mode 100644
index b732f64..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/i2s/nrf_drv_i2s.h
+++ /dev/null
@@ -1,227 +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_i2s I2S HAL and driver
- * @ingroup    nrf_drivers
- * @brief      @tagAPI52 Inter-IC Sound (I2S) interface APIs.
- *
- * @defgroup   nrf_drv_i2s I2S driver
- * @{
- * @ingroup    nrf_i2s
- * @brief      @tagAPI52 Inter-IC Sound (I2S) interface driver.
- */
-
-
-#ifndef NRF_DRV_I2S_H__
-#define NRF_DRV_I2S_H__
-
-#include "nordic_common.h"
-#include "nrf_drv_config.h"
-#include "nrf_i2s.h"
-#include "sdk_errors.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This value can be provided instead of a pin number for the signals
- *        SDOUT, SDIN, and MCK to specify that a given signal is not used
- *        and therefore does not need to be connected to a pin.
- */
-#define NRF_DRV_I2S_PIN_NOT_USED  0xFF
-
-/**
- * @brief Flag indicating that calls to the data handler for RX and TX should
- *        be synchronized, thus always combined into one call.
- *
- * Use this flag when calling @ref nrf_drv_i2s_start to force a common call
- * to the @ref nrf_drv_i2s_data_handler_t "data handler" for RX and TX data.
- * This is useful, for example, when received data should be processed and
- * then be sent back. Obviously, this flag is only applicable when both
- * directions (RX and TX) are enabled.
- */
-#define NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE  0x01
-
-/**
- * @brief I2S driver configuration structure.
- */
-typedef struct
-{
-    uint8_t sck_pin;      ///< SCK pin number.
-    uint8_t lrck_pin;     ///< LRCK pin number.
-    uint8_t mck_pin;      ///< MCK pin number.
-                          /**< Optional. Use @ref NRF_DRV_I2S_PIN_NOT_USED
-                           *   if this signal is not needed. */
-    uint8_t sdout_pin;    ///< SDOUT pin number.
-                          /**< Optional. Use @ref NRF_DRV_I2S_PIN_NOT_USED
-                           *   if this signal is not needed. */
-    uint8_t sdin_pin;     ///< SDIN pin number.
-                          /**< Optional. Use @ref NRF_DRV_I2S_PIN_NOT_USED
-                           *   if this signal is not needed. */
-    uint8_t irq_priority; ///< Interrupt priority.
-
-    nrf_i2s_mode_t     mode;         ///< Mode of operation.
-    nrf_i2s_format_t   format;       ///< Frame format.
-    nrf_i2s_align_t    alignment;    ///< Alignment of sample within a frame.
-    nrf_i2s_swidth_t   sample_width; ///< Sample width.
-    nrf_i2s_channels_t channels;     ///< Enabled channels.
-    nrf_i2s_mck_t      mck_setup;    ///< Master clock setup.
-    nrf_i2s_ratio_t    ratio;        ///< MCK/LRCK ratio.
-} nrf_drv_i2s_config_t;
-
-/**
- * @brief I2S driver default configuration.
- */
-#define NRF_DRV_I2S_DEFAULT_CONFIG           \
-{                                            \
-    .sck_pin      = I2S_CONFIG_SCK_PIN,      \
-    .lrck_pin     = I2S_CONFIG_LRCK_PIN,     \
-    .mck_pin      = I2S_CONFIG_MCK_PIN,      \
-    .sdout_pin    = I2S_CONFIG_SDOUT_PIN,    \
-    .sdin_pin     = I2S_CONFIG_SDIN_PIN,     \
-    .irq_priority = I2S_CONFIG_IRQ_PRIORITY, \
-    .mode         = I2S_CONFIG_MASTER,       \
-    .format       = I2S_CONFIG_FORMAT,       \
-    .alignment    = I2S_CONFIG_ALIGN,        \
-    .sample_width = I2S_CONFIG_SWIDTH,       \
-    .channels     = I2S_CONFIG_CHANNELS,     \
-    .mck_setup    = I2S_CONFIG_MCK_SETUP,    \
-    .ratio        = I2S_CONFIG_RATIO,        \
-}
-
-/**
- * @brief I2S driver data handler type.
- *
- * A data handling function of this type must be specified during initialization
- * of the driver. The driver will call this function when a new portion of data
- * is received or a new portion of data should be prepared for transmission.
- * The first case is indicated by a non-NULL value in the @p p_data_received
- * parameter (which points to the memory containing the received data). 
- * Similarly, the second case is indicated by a non-NULL value in the 
- * @p p_data_to_send parameter (which points to where the data to be transmitted
- * should be placed).
- *
- * @note The two cases mentioned above may be indicated separately or combined
- *       into one call (depending on the environment in which the driver is
- *       used). Therefore, both parameters should be checked and handled
- *       properly in every call. @ref NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE
- *       "Synchronized mode" can be used to always combine these indications.
- *
- * @param[in]  p_data_received Pointer to the buffer with received data,
- *                             or NULL if the handler is called to prepare
- *                             transmission only.
- * @param[out] p_data_to_send  Pointer to the buffer where data to be sent
- *                             should be written, or NULL if the handler is
- *                             called for received data only.
- * @param[in]  number_of_words Length of data received and/or to be written
- *                             (in 32-bit words). This value is always equal to
- *                             half the size of the buffers set by the call
- *                             to the @ref nrf_drv_i2s_start function.
- */
-typedef void (* nrf_drv_i2s_data_handler_t)(uint32_t const * p_data_received,
-                                            uint32_t       * p_data_to_send,
-                                            uint16_t         number_of_words);
-
-
-/**
- * @brief Function for initializing the I2S driver.
- *
- * @param[in] p_config Pointer to the structure with initial configuration.
- *                     If NULL, the default configuration is used.
- * @param[in] handler  Data handler provided by the user. Must not be NULL.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized.
- * @retval NRF_ERROR_INVALID_PARAM If the requested combination of configuration
- *                                 options is not allowed by the I2S peripheral.
- */
-ret_code_t nrf_drv_i2s_init(nrf_drv_i2s_config_t const * p_config,
-                            nrf_drv_i2s_data_handler_t   handler);
-
-/**
- * @brief Function for uninitializing the I2S driver.
- */
-void       nrf_drv_i2s_uninit(void);
-
-/**
- * @brief Function for starting the continuous I2S transfer.
- *
- * The I2S data transfer can be performed in one of three modes: RX (reception)
- * only, TX (transmission) only, or in both directions simultaneously.
- * The mode is selected by specifying a proper buffer for a given direction
- * in the call to this function or by passing NULL instead if this direction
- * should be disabled.
- *
- * The length of the buffer (which is a common value for RX and TX if both
- * directions are enabled) is specified in 32-bit words. One 32-bit memory
- * word can either contain four 8-bit samples, two 16-bit samples, or one
- * right-aligned 24-bit sample sign-extended to a 32-bit value.
- * For a detailed memory mapping for different supported configurations,
- * see the @linkProductSpecification52.
- *
- * The provided buffers are logically divided into two parts of equal size.
- * One of them is in use by the peripheral (for storing received data or for
- * getting data to be transmitted, respectively). The other part is provided
- * to the application via a call to the defined @ref nrf_drv_i2s_data_handler_t
- * "data handling function", so that the application can process the received
- * data or prepare the next portion of data to be sent. The two parts are
- * swapped every time @p buffer_size/2 data words are received or transmitted.
- *
- * Additional options are provided using the @p flags parameter:
- * - @ref NRF_DRV_I2S_FLAG_SYNCHRONIZED_MODE - the calls to data handler should
- *   be done in a synchronized manner (one common call for TX and RX).
- *   Applicable only when both RX and TX are enabled.
- *
- * @attention All data exchange is done in the data handler only. In particular,
- *            no data should be written to the transmit buffer before calling
- *            this function (a proper call to the data handler to get the first
- *            portion of data to be sent will be done before the actual transfer
- *            starts).
- *
- * @note Peripherals using EasyDMA (like I2S) require the transfer buffers
- *       to be placed in the Data RAM region. If this condition is not met,
- *       this function will fail with the error code NRF_ERROR_INVALID_ADDR.
- *
- * @param[in] p_rx_buffer Pointer to the receive buffer.
- *                        Pass NULL if reception is not required.
- * @param[in] p_tx_buffer Pointer to the transmit buffer.
- *                        Pass NULL if transmission is not required.
- * @param[in] buffer_size Size of the buffers (in 32-bit words).
- *                        The size must be an even number greater than 0.
- * @param[in] flags       Transfer options (0 for default settings).
- *
- * @retval NRF_SUCCESS             If the operation was successful.
- * @retval NRF_ERROR_INVALID_STATE If a transfer was already started or
- *                                 the driver has not been initialized.
- * @retval NRF_ERROR_INVALID_ADDR  If the provided buffers are not placed
- *                                 in the Data RAM region.
- */
-ret_code_t nrf_drv_i2s_start(uint32_t * p_rx_buffer,
-                             uint32_t * p_tx_buffer,
-                             uint16_t   buffer_size,
-                             uint8_t    flags);
-
-/**
- * @brief Function for stopping the I2S transfer.
- */
-void       nrf_drv_i2s_stop(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_I2S_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/lpcomp/nrf_drv_lpcomp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.c
deleted file mode 100644
index b1ea6c1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.c
+++ /dev/null
@@ -1,151 +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_lpcomp.h"
-
-#include "nrf_assert.h"
-#include "nrf_error.h"
-#include "nrf_soc.h"
-#include "nrf_drv_common.h"
-#include "app_util_platform.h"
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define LPCOMP_IRQ			LPCOMP_IRQn
-#define LPCOMP_IRQ_HANDLER 	LPCOMP_IRQHandler
-
-static lpcomp_events_handler_t m_lpcomp_events_handler = NULL;
-static nrf_drv_state_t         m_state = NRF_DRV_STATE_UNINITIALIZED;
-
-static const nrf_drv_lpcomp_config_t m_default_config = NRF_DRV_LPCONF_DEFAULT_CONFIG;
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    #define IRQ_HANDLER_NAME    irq_handler_for_lpcomp
-    #define IRQ_HANDLER      	static void IRQ_HANDLER_NAME(void)
-
-	IRQ_HANDLER;
-#else
-    #define IRQ_HANDLER void LPCOMP_IRQ_HANDLER(void)
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-static void lpcomp_execute_handler(nrf_lpcomp_event_t event, uint32_t event_mask)
-{
-    if ( nrf_lpcomp_event_check(event) && nrf_lpcomp_int_enable_check(event_mask) )
-    {
-        nrf_lpcomp_event_clear(event);
-
-        m_lpcomp_events_handler(event);
-    }
-}
-
-
-IRQ_HANDLER
-{
-    lpcomp_execute_handler(NRF_LPCOMP_EVENT_READY, LPCOMP_INTENSET_READY_Msk);
-    lpcomp_execute_handler(NRF_LPCOMP_EVENT_DOWN, LPCOMP_INTENSET_DOWN_Msk);
-    lpcomp_execute_handler(NRF_LPCOMP_EVENT_UP, LPCOMP_INTENSET_UP_Msk);
-    lpcomp_execute_handler(NRF_LPCOMP_EVENT_CROSS, LPCOMP_INTENSET_CROSS_Msk);
-}
-
-
-ret_code_t nrf_drv_lpcomp_init(const nrf_drv_lpcomp_config_t * p_config,
-                               lpcomp_events_handler_t   events_handler)
-{
-    if (m_state != NRF_DRV_STATE_UNINITIALIZED)
-    { // LPCOMP driver is already initialized
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config;
-    }
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    if (nrf_drv_common_per_res_acquire(NRF_LPCOMP, IRQ_HANDLER_NAME) != NRF_SUCCESS)
-    {
-        return NRF_ERROR_BUSY;
-    }
-#endif
-
-    nrf_lpcomp_configure(&(p_config->hal) );
-
-    if (events_handler)
-    {
-        m_lpcomp_events_handler = events_handler;
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    nrf_lpcomp_input_select(p_config->input);
-
-    switch (p_config->hal.detection)
-    {
-        case NRF_LPCOMP_DETECT_UP:
-            nrf_lpcomp_int_enable(LPCOMP_INTENSET_UP_Msk);
-            break;
-
-        case NRF_LPCOMP_DETECT_DOWN:
-            nrf_lpcomp_int_enable(LPCOMP_INTENSET_DOWN_Msk);
-            break;
-
-        case NRF_LPCOMP_DETECT_CROSS:
-            nrf_lpcomp_int_enable(LPCOMP_INTENSET_CROSS_Msk);
-            break;
-
-        default:
-            break;
-    }
-    nrf_lpcomp_shorts_enable(NRF_LPCOMP_SHORT_READY_SAMPLE_MASK);
-
-    nrf_drv_common_irq_enable(LPCOMP_IRQn, p_config->interrupt_priority);
-
-    m_state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_lpcomp_uninit(void)
-{
-    ASSERT(m_state != NRF_DRV_STATE_UNINITIALIZED);
-    nrf_drv_common_irq_disable(LPCOMP_IRQn);
-    nrf_drv_lpcomp_disable();
-    m_state = NRF_DRV_STATE_UNINITIALIZED;
-    m_lpcomp_events_handler = NULL;
-}
-
-void nrf_drv_lpcomp_enable(void)
-{
-    ASSERT(m_state == NRF_DRV_STATE_INITIALIZED);
-    nrf_lpcomp_enable();
-    nrf_lpcomp_task_trigger(NRF_LPCOMP_TASK_START);
-    m_state = NRF_DRV_STATE_POWERED_ON;
-}
-
-void nrf_drv_lpcomp_disable(void)
-{
-    ASSERT(m_state == NRF_DRV_STATE_POWERED_ON);
-    nrf_lpcomp_disable();
-    nrf_lpcomp_task_trigger(NRF_LPCOMP_TASK_STOP);
-    m_state = NRF_DRV_STATE_POWERED_ON;
-}
-
-void nrf_drv_lpcomp_event_handler_register(lpcomp_events_handler_t lpcomp_events_handler)
-{
-    m_lpcomp_events_handler = lpcomp_events_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/lpcomp/nrf_drv_lpcomp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.h
deleted file mode 100644
index eed52d5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/lpcomp/nrf_drv_lpcomp.h
+++ /dev/null
@@ -1,115 +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.
- *
- */
-
-#ifndef NRF_DRV_LPCOMP_H__
-#define NRF_DRV_LPCOMP_H__
-
-#include "nrf_lpcomp.h"
-#include "sdk_errors.h"
-#include "nrf_drv_common.h"
-#include "nrf_drv_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup nrf_lpcomp LPCOMP HAL and driver
- * @ingroup nrf_drivers
- * @brief Low Power Comparator (LPCOMP) APIs.
- * @details The LPCOMP HAL provides basic APIs for accessing the registers of Low Power Comparator. 
- * The LPCOMP driver provides APIs on a higher level.
- *
- * @defgroup nrf_drivers_lpcomp LPCOMP driver
- * @{
- * @ingroup nrf_lpcomp
- * @brief Low Power Comparator (LPCOMP) driver. 
- */
-
-/**@brief LPCOMP event handler function type.
- * @param[in] event  LPCOMP event.
- */
-typedef void (* lpcomp_events_handler_t)(nrf_lpcomp_event_t event);
-
-/**@brief LPCOMP configuration.
- */
-typedef struct
-{
-    nrf_lpcomp_config_t    hal;                /**< LPCOMP HAL configuration. */
-    nrf_lpcomp_input_t     input;              /**< Input to be monitored. */
-    uint8_t                interrupt_priority; /**< LPCOMP interrupt priority. */
-} nrf_drv_lpcomp_config_t;
-
-/** @brief LPCOMP driver default configuration including the LPCOMP HAL configuration. */
-#define NRF_DRV_LPCONF_DEFAULT_CONFIG                                              \
-    {                                                                              \
-        .hal                = {LPCOMP_CONFIG_REFERENCE , LPCOMP_CONFIG_DETECTION}, \
-        .input              = LPCOMP_CONFIG_INPUT,                                 \
-        .interrupt_priority = LPCOMP_CONFIG_IRQ_PRIORITY                           \
-    }
-
-/**
- * @brief Function for initializing the LPCOMP driver.
- * 
- * This function initializes the LPCOMP driver, but does not enable the peripheral or any interrupts. 
- * To start the driver, call the function nrf_drv_lpcomp_enable() after initialization.
- *
- * If no configuration structure is provided, the driver is initialized with the default settings.
- *
- * @param[in] p_config              Initial configuration. If NULL, the default configuration is used.
- * @param[in] events_handler        Handler function.
- * @retval NRF_ERROR_INVALID_PARAM If the configuration is invalid.
- * @retval NRF_ERROR_INVALID_STATE If the driver has already been initialized.
- */
-ret_code_t nrf_drv_lpcomp_init(const nrf_drv_lpcomp_config_t * p_config,
-                               lpcomp_events_handler_t   events_handler);
-
-
-/**
- *  @brief Function for uninitializing the LCOMP driver.
- *
- *  This function uninitializes the LPCOMP driver. The LPCOMP peripheral and 
- *  its interrupts are disabled, and local variables are cleaned. After this call, you must
- *  initialize the driver again by calling nrf_drv_lpcomp_init() if you want to use it.
- *
- *  @sa nrf_drv_lpcomp_disable()
- *  @sa nrf_drv_lpcomp_init()
- */
-void     nrf_drv_lpcomp_uninit(void);
-
-/**@brief Function for enabling the LPCOMP peripheral and interrupts.
- *
- * Before calling this function, the driver must be initialized. This function
- * enables the LPCOMP peripheral and its interrupts.
- *
- * @sa nrf_drv_lpcomp_disable()
- */
-void nrf_drv_lpcomp_enable(void);
-
-/**@brief Function for disabling the LPCOMP peripheral.
- *
- * Before calling this function, the driver must be initialized. This function disables the LPCOMP
- * peripheral and its interrupts.
- *
- * @sa nrf_drv_lpcomp_enable()
- */
-void nrf_drv_lpcomp_disable(void);
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
- #endif /* NRF_DRV_LPCOMP_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/nrf_soc_nosd/nrf_error.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_error.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_error.h
deleted file mode 100644
index bff2053..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_error.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is confidential property of Nordic Semiconductor. The use,
- * copying, transfer or disclosure of such information is prohibited except by express written
- * agreement with Nordic Semiconductor.
- *
- */
-
-/* Header guard */
-#ifndef NRF_ERROR_H__
-#define NRF_ERROR_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/// @cond Make doxygen skip this file 
-
-/** @defgroup NRF_ERRORS_BASE Error Codes Base number definitions
- * @{ */
-#define NRF_ERROR_BASE_NUM      (0x0)       ///< Global error base
-#define NRF_ERROR_SDM_BASE_NUM  (0x1000)    ///< SDM error base
-#define NRF_ERROR_SOC_BASE_NUM  (0x2000)    ///< SoC error base
-#define NRF_ERROR_STK_BASE_NUM  (0x3000)    ///< STK error base
-/** @} */
-
-#define NRF_SUCCESS                           (NRF_ERROR_BASE_NUM + 0)  ///< Successful command
-#define NRF_ERROR_SVC_HANDLER_MISSING         (NRF_ERROR_BASE_NUM + 1)  ///< SVC handler is missing
-#define NRF_ERROR_SOFTDEVICE_NOT_ENABLED      (NRF_ERROR_BASE_NUM + 2)  ///< SoftDevice has not been enabled
-#define NRF_ERROR_INTERNAL                    (NRF_ERROR_BASE_NUM + 3)  ///< Internal Error
-#define NRF_ERROR_NO_MEM                      (NRF_ERROR_BASE_NUM + 4)  ///< No Memory for operation
-#define NRF_ERROR_NOT_FOUND                   (NRF_ERROR_BASE_NUM + 5)  ///< Not found
-#define NRF_ERROR_NOT_SUPPORTED               (NRF_ERROR_BASE_NUM + 6)  ///< Not supported
-#define NRF_ERROR_INVALID_PARAM               (NRF_ERROR_BASE_NUM + 7)  ///< Invalid Parameter
-#define NRF_ERROR_INVALID_STATE               (NRF_ERROR_BASE_NUM + 8)  ///< Invalid state, operation disallowed in this state
-#define NRF_ERROR_INVALID_LENGTH              (NRF_ERROR_BASE_NUM + 9)  ///< Invalid Length
-#define NRF_ERROR_INVALID_FLAGS               (NRF_ERROR_BASE_NUM + 10) ///< Invalid Flags
-#define NRF_ERROR_INVALID_DATA                (NRF_ERROR_BASE_NUM + 11) ///< Invalid Data
-#define NRF_ERROR_DATA_SIZE                   (NRF_ERROR_BASE_NUM + 12) ///< Data size exceeds limit
-#define NRF_ERROR_TIMEOUT                     (NRF_ERROR_BASE_NUM + 13) ///< Operation timed out
-#define NRF_ERROR_NULL                        (NRF_ERROR_BASE_NUM + 14) ///< Null Pointer
-#define NRF_ERROR_FORBIDDEN                   (NRF_ERROR_BASE_NUM + 15) ///< Forbidden Operation
-#define NRF_ERROR_INVALID_ADDR                (NRF_ERROR_BASE_NUM + 16) ///< Bad Memory Address
-#define NRF_ERROR_BUSY                        (NRF_ERROR_BASE_NUM + 17) ///< Busy
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_ERROR_H__
-
-/// @endcond 
-/**
-  @}
-*/

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/nrf_soc_nosd/nrf_nvic.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c
deleted file mode 100644
index 3c9657a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.c
+++ /dev/null
@@ -1,96 +0,0 @@
-  /* Copyright (c) 2016 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 <stdlib.h>
-#include "nrf_soc.h"
-#include "nrf_error.h"
-
-static uint8_t m_in_critical_region = 0;
-
-uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn)
-{
-    NVIC_EnableIRQ(IRQn);
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn)
-{
-    NVIC_DisableIRQ(IRQn);
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq)
-{
-    if (p_pending_irq != NULL)
-    {
-        *p_pending_irq = NVIC_GetPendingIRQ(IRQn);
-        return NRF_SUCCESS;
-    }
-    return NRF_ERROR_NULL;
-}
-
-uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn)
-{
-    NVIC_SetPendingIRQ(IRQn);
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn)
-{
-    NVIC_ClearPendingIRQ(IRQn);
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority)
-{
-    NVIC_SetPriority(IRQn, priority);
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority)
-{
-    if (p_priority != NULL)
-    {
-        *p_priority = NVIC_GetPriority(IRQn);
-        return NRF_SUCCESS;
-    }
-    
-    return NRF_ERROR_NULL;
-}
-
-uint32_t sd_nvic_SystemReset(void)
-{
-    NVIC_SystemReset();
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region)
-{
-    __disable_irq();
-    
-    *p_is_nested_critical_region = (m_in_critical_region != 0);
-    m_in_critical_region++;
-    
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region)
-{
-    m_in_critical_region--;
-    
-    if (is_nested_critical_region == 0)
-    {
-        m_in_critical_region = 0;
-        __enable_irq();
-    }
-    return NRF_SUCCESS;
-}

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/nrf_soc_nosd/nrf_nvic.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.h
deleted file mode 100644
index f429d9f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_nvic.h
+++ /dev/null
@@ -1,138 +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.
- *
- */
-
-#ifndef NRF_SOC_H__
-#define NRF_SOC_H__
-
-#include <stdint.h>
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Enable External Interrupt.
- * @note Corresponds to NVIC_EnableIRQ in CMSIS.
- *
- * @pre{IRQn is valid and not reserved by the stack}
- *
- * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS.
- *
- * @retval ::NRF_SUCCESS The interrupt was enabled.
- */
-uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn);
-
-/**@brief  Disable External Interrupt.
- * @note Corresponds to NVIC_DisableIRQ in CMSIS.
- *
- * @pre{IRQn is valid and not reserved by the stack}
- *
- * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS
- *
- * @retval ::NRF_SUCCESS The interrupt was disabled.
- */
-uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn);
-
-/**@brief  Get Pending Interrupt.
- * @note Corresponds to NVIC_GetPendingIRQ in CMSIS.
- *
- * @pre{IRQn is valid and not reserved by the stack}
- *
- * @param[in]   IRQn          See the NVIC_GetPendingIRQ documentation in CMSIS.
- * @param[out]  p_pending_irq Return value from NVIC_GetPendingIRQ.
- *
- * @retval ::NRF_SUCCESS The interrupt is available for the application.
- */
-uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq);
-
-/**@brief  Set Pending Interrupt.
- * @note Corresponds to NVIC_SetPendingIRQ in CMSIS.
- *
- * @pre{IRQn is valid and not reserved by the stack}
- *
- * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS.
- *
- * @retval ::NRF_SUCCESS The interrupt is set pending.
- */
-uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn);
-
-/**@brief  Clear Pending Interrupt.
- * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS.
- *
- * @pre{IRQn is valid and not reserved by the stack}
- *
- * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS.
- *
- * @retval ::NRF_SUCCESS The interrupt pending flag is cleared.
- */
-uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn);
-
-/**@brief Set Interrupt Priority.
- * @note Corresponds to NVIC_SetPriority in CMSIS.
- *
- * @pre{IRQn is valid and not reserved by the stack}
- * @pre{priority is valid and not reserved by the stack}
- *
- * @param[in] IRQn      See the NVIC_SetPriority documentation in CMSIS.
- * @param[in] priority  A valid IRQ priority for use by the application.
- *
- * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application.
- */
-uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority);
-
-/**@brief Get Interrupt Priority.
- * @note Corresponds to NVIC_GetPriority in CMSIS.
- *
- * @pre{IRQn is valid and not reserved by the stack}
- *
- * @param[in]  IRQn         See the NVIC_GetPriority documentation in CMSIS.
- * @param[out] p_priority   Return value from NVIC_GetPriority.
- *
- * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority.
- */
-uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority);
-
-/**@brief System Reset.
- * @note Corresponds to NVIC_SystemReset in CMSIS.
- *
- * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN
- */
-uint32_t sd_nvic_SystemReset(void);
-
-/**@brief Enters critical region.
- *
- * @post Application interrupts will be disabled.
- * @sa sd_nvic_critical_region_exit
- *
- * @param[out]  p_is_nested_critical_region  1: If in a nested critical region.
- *                                           0: Otherwise.
- *
- * @retval ::NRF_SUCCESS
- */
-uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region);
-
-/**@brief Exit critical region.
- *
- * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter.
- * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. 
- *
- * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter.
- *
- * @retval ::NRF_SUCCESS
- */
-uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_SOC_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/nrf_soc_nosd/nrf_soc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c
deleted file mode 100644
index 063b7b9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_soc.c
+++ /dev/null
@@ -1,21 +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.
- *
- */
-
-#include <stdlib.h>
-#include "nrf_soc.h"
-#include "nrf_error.h"
-
-uint32_t sd_app_evt_wait(void)
-{
-    __WFE();
-    return NRF_SUCCESS;
-}

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/nrf_soc_nosd/nrf_soc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_soc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_soc.h
deleted file mode 100644
index b64326d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/nrf_soc_nosd/nrf_soc.h
+++ /dev/null
@@ -1,52 +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.
- *
- */
-
-#ifndef NRF_SOC_H__
-#define NRF_SOC_H__
-
-#include <stdint.h>
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Waits for an application event.
- *
- * An application event is either an application interrupt or a pended interrupt when the
- * interrupt is disabled. When the interrupt is enabled it will be taken immediately since
- * this function will wait in thread mode, then the execution will return in the application's
- * main thread. When an interrupt is disabled and gets pended it will return to the application's
- * thread main. The application must ensure that the pended flag is cleared using
- * ::sd_nvic_ClearPendingIRQ in order to sleep using this function. This is only necessary for
- * disabled interrupts, as the interrupt handler will clear the pending flag automatically for
- * enabled interrupts.
- *
- * In order to wake up from disabled interrupts, the SEVONPEND flag has to be set in the Cortex-M0
- * System Control Register (SCR). @sa CMSIS_SCB
- *
- * @note If an application interrupt has happened since the last time sd_app_evt_wait was
- *       called this function will return immediately and not go to sleep. This is to avoid race
- *       conditions that can occur when a flag is updated in the interrupt handler and processed
- *       in the main loop.
- *
- * @post An application interrupt has happened or a interrupt pending flag is set.
- *
- * @retval ::NRF_SUCCESS
- */
-uint32_t sd_app_evt_wait(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_SOC_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/pdm/nrf_drv_pdm.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pdm/nrf_drv_pdm.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pdm/nrf_drv_pdm.c
deleted file mode 100644
index 71b7a7a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pdm/nrf_drv_pdm.c
+++ /dev/null
@@ -1,170 +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_pdm.h"
-#include "nrf_assert.h"
-#include "nrf_drv_common.h"
-#include "nrf_gpio.h"
-
-
-/** @brief PDM interface status. */
-typedef enum
-{
-    NRF_PDM_STATE_IDLE,
-    NRF_PDM_STATE_RUNNING,
-    NRF_PDM_STATE_TRANSITION
-} nrf_drv_pdm_state_t;
-
-
-/** @brief PDM interface control block.*/
-typedef struct
-{
-    nrf_drv_state_t             drv_state;        ///< Driver state.
-    nrf_drv_pdm_state_t         status;           ///< Sampling state.
-    nrf_drv_pdm_event_handler_t event_handler;    ///< Event handler function pointer.
-    uint16_t                    buffer_length;    ///< Length of a single buffer in 16-bit words.
-    uint32_t *                  buffers[2];       ///< Sample buffers.
-} nrf_drv_pdm_cb_t;
-
-static nrf_drv_pdm_cb_t m_cb;
-
-
-void PDM_IRQHandler(void)
-{
-    if (nrf_pdm_event_check(NRF_PDM_EVENT_END))
-    {
-        nrf_pdm_event_clear(NRF_PDM_EVENT_END);
-        
-        //Buffer is ready to process.
-        if (nrf_pdm_buffer_get() == m_cb.buffers[0])
-        {
-            m_cb.event_handler(m_cb.buffers[1], m_cb.buffer_length);
-        }
-        else
-        {
-            m_cb.event_handler(m_cb.buffers[0], m_cb.buffer_length);
-        }
-    }
-    else if (nrf_pdm_event_check(NRF_PDM_EVENT_STARTED))
-    {
-        nrf_pdm_event_clear(NRF_PDM_EVENT_STARTED);
-        m_cb.status = NRF_PDM_STATE_RUNNING;
-        
-        //Swap buffer.
-        if (nrf_pdm_buffer_get() == m_cb.buffers[0])
-        {
-            nrf_pdm_buffer_set(m_cb.buffers[1],m_cb.buffer_length);
-        }
-        else
-        {
-            nrf_pdm_buffer_set(m_cb.buffers[0],m_cb.buffer_length);
-        }
-    }
-    else if (nrf_pdm_event_check(NRF_PDM_EVENT_STOPPED))
-    {
-        nrf_pdm_event_clear(NRF_PDM_EVENT_STOPPED);
-        nrf_pdm_disable();
-        m_cb.status = NRF_PDM_STATE_IDLE;
-    }
-}
-
-
-ret_code_t nrf_drv_pdm_init(nrf_drv_pdm_config_t const * p_config,
-                              nrf_drv_pdm_event_handler_t event_handler)
-{
-    if (m_cb.drv_state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if ((p_config == NULL)
-        || (event_handler == NULL))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (p_config->gain_l > NRF_PDM_GAIN_MAXIMUM
-        || p_config->gain_r > NRF_PDM_GAIN_MAXIMUM
-        || p_config->buffer_length > NRF_PDM_MAX_BUFFER_SIZE)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    
-    m_cb.buffers[0] = (uint32_t*)p_config->buffer_a;
-    m_cb.buffers[1] = (uint32_t*)p_config->buffer_b;
-    m_cb.buffer_length = p_config->buffer_length;
-    m_cb.event_handler = event_handler;
-    m_cb.status = NRF_PDM_STATE_IDLE;
-    
-    nrf_pdm_buffer_set(m_cb.buffers[0],m_cb.buffer_length);
-    nrf_pdm_clock_set(p_config->clock_freq);
-    nrf_pdm_mode_set(p_config->mode, p_config->edge);
-    nrf_pdm_gain_set(p_config->gain_l, p_config->gain_r);
-
-    nrf_gpio_cfg_output(p_config->pin_clk);
-    nrf_gpio_pin_clear(p_config->pin_clk);
-    nrf_gpio_cfg_input(p_config->pin_din, NRF_GPIO_PIN_NOPULL);
-    nrf_pdm_psel_connect(p_config->pin_clk, p_config->pin_din);
-    
-    m_cb.drv_state = NRF_DRV_STATE_INITIALIZED;
-    nrf_pdm_int_enable(NRF_PDM_INT_STARTED | NRF_PDM_INT_END | NRF_PDM_INT_STOPPED);
-    nrf_drv_common_irq_enable(PDM_IRQn, p_config->interrupt_priority);
-    
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_pdm_uninit(void)
-{
-    nrf_pdm_disable();
-    nrf_pdm_psel_disconnect();
-    m_cb.drv_state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-
-
-
-ret_code_t nrf_drv_pdm_start(void)
-{
-    ASSERT(m_cb.drv_state != NRF_DRV_STATE_UNINITIALIZED);
-    if (m_cb.status != NRF_PDM_STATE_IDLE)
-    {
-        if (m_cb.status == NRF_PDM_STATE_RUNNING)
-        {
-            return NRF_SUCCESS;
-        }
-        return NRF_ERROR_BUSY;
-    }
-    m_cb.status = NRF_PDM_STATE_TRANSITION;
-    m_cb.drv_state = NRF_DRV_STATE_POWERED_ON;
-    nrf_pdm_enable();
-    nrf_pdm_event_clear(NRF_PDM_EVENT_STARTED);
-    nrf_pdm_task_trigger(NRF_PDM_TASK_START);
-    return NRF_SUCCESS;
-}
-
-
-ret_code_t nrf_drv_pdm_stop(void)
-{
-    ASSERT(m_cb.drv_state != NRF_DRV_STATE_UNINITIALIZED);
-    if (m_cb.status != NRF_PDM_STATE_RUNNING)
-    {
-        if (m_cb.status == NRF_PDM_STATE_IDLE)
-        {
-            nrf_pdm_disable();
-            return NRF_SUCCESS;
-        }
-        return NRF_ERROR_BUSY;
-    }
-    m_cb.status = NRF_PDM_STATE_TRANSITION;
-    m_cb.drv_state = NRF_DRV_STATE_INITIALIZED;
-    nrf_pdm_task_trigger(NRF_PDM_TASK_STOP);
-    return NRF_SUCCESS;
-}

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/pdm/nrf_drv_pdm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pdm/nrf_drv_pdm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pdm/nrf_drv_pdm.h
deleted file mode 100644
index 623785e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pdm/nrf_drv_pdm.h
+++ /dev/null
@@ -1,175 +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.
- *
- */
-
-/**
- * @addtogroup nrf_pdm PDM HAL and driver
- * @ingroup    nrf_drivers
- * @brief      @tagAPI52 Pulse density modulation (PDM) interface APIs.
- *
- * The PDM HAL provides basic APIs for accessing the registers of the PDM interface peripheral. 
- * The PDM driver provides APIs on a higher level.
- *
- * @defgroup nrf_drv_pdm PDM driver
- * @{
- * @ingroup  nrf_pdm
- *
- * @brief    @tagAPI52 Pulse density modulation (PDM) interface driver.
- */
-
-
-#ifndef NRF_DRV_PDM_H__
-#define NRF_DRV_PDM_H__
-
-#include "nrf_drv_config.h"
-#include "nrf_pdm.h"
-#include "sdk_errors.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define NRF_PDM_MAX_BUFFER_SIZE 32768
-
-
-/**
- * @brief PDM interface driver configuration structure.
- */
-typedef struct
-{
-    nrf_pdm_mode_t mode;               ///< Interface operation mode.
-    nrf_pdm_edge_t edge;               ///< Sampling mode.
-    uint8_t        pin_clk;            ///< CLK pin.
-    uint8_t        pin_din;            ///< DIN pin.
-    nrf_pdm_freq_t clock_freq;         ///< Clock frequency.
-    nrf_pdm_gain_t gain_l;             ///< Left channel gain.
-    nrf_pdm_gain_t gain_r;             ///< Right channel gain.
-    uint8_t        interrupt_priority; ///< Interrupt priority.
-    uint16_t       buffer_length;      ///< Length of a single buffer (in 16-bit words).
-    int16_t *      buffer_a;           ///< Sample buffer A (filled first).
-    int16_t *      buffer_b;           ///< Sample buffer B (filled after buffer A).
-} nrf_drv_pdm_config_t;
-
-
-/**
- * @brief Macro for setting @ref nrf_drv_pdm_config_t to default settings
- *        in single ended mode.
- *
- * @param PIN_CLK  CLK output pin.
- * @param PIN_DIN  DIN input pin.
- * @param BUFF_A   Sample buffer A (filled first).
- * @param BUFF_B   Sample buffer B (filled after buffer A).
- * @param BUFF_LEN Length of a single buffer (in 16-bit words).
- */
-#define NRF_DRV_PDM_DEFAULT_CONFIG(PIN_CLK, PIN_DIN, BUFF_A, BUFF_B, BUFF_LEN) \
-{                                                                              \
-    .mode               = PDM_CONFIG_MODE,                                     \
-    .edge               = PDM_CONFIG_EDGE,                                     \
-    .pin_clk            = PIN_CLK,                                             \
-    .pin_din            = PIN_DIN,                                             \
-    .clock_freq         = PDM_CONFIG_CLOCK_FREQ,                               \
-    .gain_l             = NRF_PDM_GAIN_DEFAULT,                                \
-    .gain_r             = NRF_PDM_GAIN_DEFAULT,                                \
-    .interrupt_priority = PDM_CONFIG_IRQ_PRIORITY,                             \
-    .buffer_length      = BUFF_LEN,                                            \
-    .buffer_a           = BUFF_A,                                              \
-    .buffer_b           = BUFF_B                                               \
-}
-
-
-/**
- * @brief   Handler for PDM interface ready events.
- *
- * This event handler is called when a buffer is full and ready to be processed.
- *
- * @param[in] p_buffer Sample buffer pointer.
- * @param[in] length   Buffer length in 16-bit words.
- */
-typedef void (*nrf_drv_pdm_event_handler_t)(uint32_t * buffer, uint16_t length);
-
-
-/**
- * @brief Function for initializing the PDM interface.
- *
- * @param[in] p_config      Pointer to a configuration structure. If NULL, the default one is used.
- * @param[in] event_handler Event handler provided by the user.
- *
- * @retval    NRF_SUCCESS If initialization was successful.
- * @retval    NRF_ERROR_INVALID_STATE If the driver is already initialized.
- * @retval    NRF_ERROR_INVALID_PARAM If invalid parameters were specified.
- */
-ret_code_t nrf_drv_pdm_init(nrf_drv_pdm_config_t const * p_config,
-                            nrf_drv_pdm_event_handler_t event_handler);
-
-
-/**
- * @brief Function for uninitializing the PDM interface.
- *
- * This function stops PDM sampling, if it is in progress.
- */
-void nrf_drv_pdm_uninit(void);
-
-
-/**
- * @brief Function for getting the address of a PDM interface task.
- *
- * @param[in]  task Task.
- *
- * @return     Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_pdm_task_address_get(nrf_pdm_task_t task)
-{
-    return nrf_pdm_task_address_get(task);
-}
-
-
-/**
- * @brief Function for getting the state of the PDM interface.
- *
- * @retval TRUE  If the PDM interface is enabled.
- * @retval FALSE If the PDM interface is disabled.
- */
-__STATIC_INLINE bool nrf_drv_pdm_enable_check()
-{
-    return nrf_pdm_enable_check();
-}
-
-
-/**
- * @brief Function for starting PDM sampling.
- *
- * @retval NRF_SUCCESS    If sampling was started successfully or was already in progress.
- * @retval NRF_ERROR_BUSY If a previous start/stop operation is in progress.
- */
-ret_code_t nrf_drv_pdm_start(void);
-
-
-/**
- * @brief   Function for stopping PDM sampling.
- *
- * When this function is called, the PDM interface is stopped after finishing 
- * the current frame.
- * The event handler function might be called once more after calling this function.
- *
- * @retval NRF_SUCCESS    If sampling was stopped successfully or was already stopped before.
- * @retval NRF_ERROR_BUSY If a previous start/stop operation is in progress.
- */
-ret_code_t nrf_drv_pdm_stop(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_PDM_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/ppi/nrf_drv_ppi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ppi/nrf_drv_ppi.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ppi/nrf_drv_ppi.c
deleted file mode 100644
index 706824d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ppi/nrf_drv_ppi.c
+++ /dev/null
@@ -1,427 +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 <stdlib.h>
-
-#include "nrf.h"
-#include "nrf_drv_ppi.h"
-#include "nrf_drv_common.h"
-#include "nrf_ppi.h"
-#include "app_util_platform.h"
-#include "sdk_common.h"
-
-
-static nrf_drv_state_t     m_drv_state;            /**< Driver state */
-static uint32_t            m_channels_allocated;   /**< Bitmap representing channels availability. 1 when a channel is allocated, 0 otherwise. */
-static uint8_t             m_groups_allocated;     /**< Bitmap representing groups availability. 1 when a group is allocated, 0 otherwise.*/
-
-
-/**@brief  Compute a group mask (needed for driver internals, not used for NRF_PPI registers).
- * @param[in]  group  Group number to transform to a mask.
- * @retval     Group mask.
- */
-__STATIC_INLINE uint32_t group_to_mask(nrf_ppi_channel_group_t group)
-{
-    return (1uL << (uint32_t) group);
-}
-
-
-/**@brief  Check whether a channel is a programmable channel and can be used by an application.
- * @param[in]  channel  Channel to check.
- * @retval     true     The channel is a programmable application channel.
- *             false    The channel is used by a SoftDevice or is preprogrammed.
- */
-__STATIC_INLINE bool is_programmable_app_channel(nrf_ppi_channel_t channel)
-{
-    return ((NRF_PPI_PROG_APP_CHANNELS_MASK & nrf_drv_ppi_channel_to_mask(channel)) != 0);
-}
-
-
-/**@brief  Check whether a channels can be used by an application.
- * @param[in]  channel  Channel mask to check.
- * @retval     true     All specified channels can be used by an application.
- *             false    At least one specified channel is used by a SoftDevice.
- */
-__STATIC_INLINE bool are_app_channels(uint32_t channel_mask)
-{
-    //lint -e(587)
-    return ((~(NRF_PPI_ALL_APP_CHANNELS_MASK) & channel_mask) == 0);
-}
-
-
-/**@brief  Check whether a channel can be used by an application.
- * @param[in]  channel  Channel to check.
- * @retval     true     The channel can be used by an application.
- *             false    The channel is used by a SoftDevice.
- */
-__STATIC_INLINE bool is_app_channel(nrf_ppi_channel_t channel)
-{
-    return are_app_channels(nrf_drv_ppi_channel_to_mask(channel));
-}
-
-
-/**@brief  Check whether a channel group can be used by an application.
- * @param[in]  group    Group to check.
- * @retval     true     The group is an application group.
- *             false    The group is not an application group (this group either does not exist or
- *                      it is used by a SoftDevice).
- */
-__STATIC_INLINE bool is_app_group(nrf_ppi_channel_group_t group)
-{
-    return ((NRF_PPI_ALL_APP_GROUPS_MASK & group_to_mask(group)) != 0);
-}
-
-
-/**@brief  Check whether a channel is allocated.
- * @param[in]  channel_num  Channel number to check.
- * @retval     true         The channel is allocated.
- *             false        The channel is not allocated.
- */
-__STATIC_INLINE bool is_allocated_channel(nrf_ppi_channel_t channel)
-{
-    return ((m_channels_allocated & nrf_drv_ppi_channel_to_mask(channel)) != 0);
-}
-
-
-/**@brief  Set channel allocated indication.
- * @param[in]  channel_num  Specifies the channel to set the "allocated" indication.
- */
-__STATIC_INLINE void channel_allocated_set(nrf_ppi_channel_t channel)
-{
-    m_channels_allocated |= nrf_drv_ppi_channel_to_mask(channel);
-}
-
-
-/**@brief  Clear channel allocated indication.
- * @param[in]  channel_num  Specifies the channel to clear the "allocated" indication.
- */
-__STATIC_INLINE void channel_allocated_clr(nrf_ppi_channel_t channel)
-{
-    m_channels_allocated &= ~nrf_drv_ppi_channel_to_mask(channel);
-}
-
-
-/**@brief  Clear all allocated channels.
- */
-__STATIC_INLINE void channel_allocated_clr_all(void)
-{
-    m_channels_allocated &= ~NRF_PPI_ALL_APP_CHANNELS_MASK;
-}
-
-
-/**@brief  Check whether a group is allocated.
- * @param[in]  group_num    Group number to check.
- * @retval     true         The group is allocated.
- *             false        The group is not allocated.
- */
-__STATIC_INLINE bool is_allocated_group(nrf_ppi_channel_group_t group)
-{
-    return ((m_groups_allocated & group_to_mask(group)) != 0);
-}
-
-
-/**@brief  Set group allocated indication.
- * @param[in]  group_num  Specifies the group to set the "allocated" indication.
- */
-__STATIC_INLINE void group_allocated_set(nrf_ppi_channel_group_t group)
-{
-    m_groups_allocated |= group_to_mask(group);
-}
-
-
-/**@brief  Clear group allocated indication.
- * @param[in]  group_num  Specifies the group to clear the "allocated" indication.
- */
-__STATIC_INLINE void group_allocated_clr(nrf_ppi_channel_group_t group)
-{
-    m_groups_allocated &= ~group_to_mask(group);
-}
-
-
-/**@brief  Clear all allocated groups.
- */
-__STATIC_INLINE void group_allocated_clr_all()
-{
-    m_groups_allocated &= ~NRF_PPI_ALL_APP_GROUPS_MASK;
-}
-
-
-uint32_t nrf_drv_ppi_init(void)
-{
-    uint32_t err_code;
-
-    if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED)
-    {
-        m_drv_state = NRF_DRV_STATE_INITIALIZED;
-        err_code    = NRF_SUCCESS;
-    }
-    else
-    {
-        err_code = MODULE_ALREADY_INITIALIZED;
-    }
-
-    return err_code;
-}
-
-
-uint32_t nrf_drv_ppi_uninit(void)
-{
-    uint32_t mask = NRF_PPI_ALL_APP_GROUPS_MASK;
-    nrf_ppi_channel_group_t group;
-
-    if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    m_drv_state = NRF_DRV_STATE_UNINITIALIZED;
-
-    // Disable all channels and groups
-    nrf_ppi_channels_disable(NRF_PPI_ALL_APP_CHANNELS_MASK);
-
-    for (group = NRF_PPI_CHANNEL_GROUP0; mask != 0; mask &= ~group_to_mask(group), group++)
-    {
-        if(mask & group_to_mask(group))
-        {
-            nrf_ppi_channel_group_clear(group);
-        }
-    }
-    channel_allocated_clr_all();
-    group_allocated_clr_all();
-    return NRF_SUCCESS;
-}
-
-
-uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel)
-{
-    uint32_t err_code;
-    nrf_ppi_channel_t channel;
-    uint32_t mask = 0;
-
-    err_code = NRF_ERROR_NO_MEM;
-
-    mask = NRF_PPI_PROG_APP_CHANNELS_MASK;
-    for (channel = NRF_PPI_CHANNEL0; mask != 0; mask &= ~nrf_drv_ppi_channel_to_mask(channel), channel++)
-    {
-        CRITICAL_REGION_ENTER();
-        if ((mask & nrf_drv_ppi_channel_to_mask(channel)) && (!is_allocated_channel(channel)))
-        {
-            channel_allocated_set(channel);
-            *p_channel = channel;
-            err_code   = NRF_SUCCESS;
-        }
-        CRITICAL_REGION_EXIT();
-        if (err_code == NRF_SUCCESS)
-        {
-            break;
-        }
-    }
-
-    return err_code;
-}
-
-
-uint32_t nrf_drv_ppi_channel_free(nrf_ppi_channel_t channel)
-{
-    if (!is_programmable_app_channel(channel))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    // First disable this channel
-    nrf_ppi_channel_disable(channel);
-    CRITICAL_REGION_ENTER();
-    channel_allocated_clr(channel);
-    CRITICAL_REGION_EXIT();
-    return NRF_SUCCESS;
-}
-
-
-uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep)
-{
-    VERIFY_PARAM_NOT_NULL((uint32_t *)eep);
-    VERIFY_PARAM_NOT_NULL((uint32_t *)tep);
-
-    if (!is_programmable_app_channel(channel))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (!is_allocated_channel(channel))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    nrf_ppi_channel_endpoint_setup(channel, eep, tep);
-    return NRF_SUCCESS;
-}
-
-uint32_t nrf_drv_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork_tep)
-{
-#ifdef NRF51
-    return NRF_ERROR_NOT_SUPPORTED;
-#else
-    if (!is_programmable_app_channel(channel))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (!is_allocated_channel(channel))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    nrf_ppi_fork_endpoint_setup(channel, fork_tep);
-    return NRF_SUCCESS;
-#endif
-}
-
-uint32_t nrf_drv_ppi_channel_enable(nrf_ppi_channel_t channel)
-{
-    if (!is_app_channel(channel))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (is_programmable_app_channel(channel) && !is_allocated_channel(channel))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    nrf_ppi_channel_enable(channel);
-    return NRF_SUCCESS;
-}
-
-
-uint32_t nrf_drv_ppi_channel_disable(nrf_ppi_channel_t channel)
-{
-    if (!is_app_channel(channel))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (is_programmable_app_channel(channel) && !is_allocated_channel(channel))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    nrf_ppi_channel_disable(channel);
-    return NRF_SUCCESS;
-}
-
-
-uint32_t nrf_drv_ppi_group_alloc(nrf_ppi_channel_group_t * p_group)
-{
-    uint32_t err_code;
-    uint32_t mask = 0;
-    nrf_ppi_channel_group_t group;
-
-    err_code = NRF_ERROR_NO_MEM;
-
-    mask = NRF_PPI_ALL_APP_GROUPS_MASK;
-    for (group = NRF_PPI_CHANNEL_GROUP0; mask != 0; mask &= ~group_to_mask(group), group++)
-    {
-        CRITICAL_REGION_ENTER();
-        if ((mask & group_to_mask(group)) && (!is_allocated_group(group)))
-        {
-            group_allocated_set(group);
-            *p_group = group;
-            err_code = NRF_SUCCESS;
-        }
-        CRITICAL_REGION_EXIT();
-        if (err_code == NRF_SUCCESS)
-        {
-            break;
-        }
-    }
-
-    return err_code;
-}
-
-
-uint32_t nrf_drv_ppi_group_free(nrf_ppi_channel_group_t group)
-{
-    if (!is_app_group(group))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (!is_allocated_group(group))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    else
-    nrf_ppi_group_disable(group);
-    CRITICAL_REGION_ENTER();
-    group_allocated_clr(group);
-    CRITICAL_REGION_EXIT();
-    return NRF_SUCCESS;
-}
-
-
-uint32_t nrf_drv_ppi_group_enable(nrf_ppi_channel_group_t group)
-{
-    if (!is_app_group(group))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (!is_allocated_group(group))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    nrf_ppi_group_enable(group);
-    return NRF_SUCCESS;
-}
-
-
-uint32_t nrf_drv_ppi_group_disable(nrf_ppi_channel_group_t group)
-{
-    if (!is_app_group(group))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    nrf_ppi_group_disable(group);
-    return NRF_SUCCESS;
-}
-
-uint32_t nrf_drv_ppi_channels_remove_from_group(uint32_t channel_mask,
-                                                nrf_ppi_channel_group_t group)
-{
-    if (!is_app_group(group))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (!is_allocated_group(group))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if (!are_app_channels(channel_mask))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    CRITICAL_REGION_ENTER();
-    nrf_ppi_channels_remove_from_group(channel_mask, group);
-    CRITICAL_REGION_EXIT();
-    return NRF_SUCCESS;
-}
-
-uint32_t nrf_drv_ppi_channels_include_in_group(uint32_t channel_mask,
-                                               nrf_ppi_channel_group_t group)
-{
-    if (!is_app_group(group))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (!is_allocated_group(group))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if (!are_app_channels(channel_mask))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    CRITICAL_REGION_ENTER();
-    nrf_ppi_channels_include_in_group(channel_mask, group);
-    CRITICAL_REGION_EXIT();
-    return NRF_SUCCESS;
-}

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/ppi/nrf_drv_ppi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ppi/nrf_drv_ppi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ppi/nrf_drv_ppi.h
deleted file mode 100644
index 27cea57..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ppi/nrf_drv_ppi.h
+++ /dev/null
@@ -1,292 +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.
- *
- */
-
-#ifndef NRF_DRV_PPI_H
-#define NRF_DRV_PPI_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*lint ++flb "Enter library region" */
-#include "sdk_errors.h"
-#include "nrf_ppi.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-/** @file
- *
- * @addtogroup nrf_ppi PPI HAL and driver
- * @ingroup nrf_drivers
- * @brief Programmable Peripheral Interconnect (PPI) APIs.
- *
- * @details The PPI HAL provides basic APIs for accessing the registers of the PPI. 
- * The PPI driver provides APIs on a higher level.
- *
- * @defgroup lib_driver_ppi PPI driver
- * @{
- * @ingroup  nrf_ppi
- *
- * @brief Programmable Peripheral Interconnect (PPI) driver.
- */
-
-#include "sdk_resources.h"
-
-#ifdef NRF52
-
-    #define NRF_PPI_ALL_APP_CHANNELS_MASK   ((uint32_t)0xFFFFFFFFuL & ~(NRF_PPI_CHANNELS_USED))  /**< All PPI channels available to the application. */
-    #define NRF_PPI_PROG_APP_CHANNELS_MASK  ((uint32_t)0x000FFFFFuL & ~(NRF_PPI_CHANNELS_USED))  /**< Programmable PPI channels available to the application. */
-    #define NRF_PPI_ALL_APP_GROUPS_MASK     ((uint32_t)0x0000003FuL & ~(NRF_PPI_GROUPS_USED))    /**< All PPI groups available to the application. */
-
-#else
-
-    #define NRF_PPI_ALL_APP_CHANNELS_MASK   ((uint32_t)0xFFF0FFFFuL & ~(NRF_PPI_CHANNELS_USED))  /**< All PPI channels available to the application. */
-    #define NRF_PPI_PROG_APP_CHANNELS_MASK  ((uint32_t)0x0000FFFFuL & ~(NRF_PPI_CHANNELS_USED))  /**< Programmable PPI channels available to the application. */
-    #define NRF_PPI_ALL_APP_GROUPS_MASK     ((uint32_t)0x0000000FuL & ~(NRF_PPI_GROUPS_USED))    /**< All PPI groups available to the application. */
-
-#endif
-
-
-/**@brief Function for initializing PPI module.
- *
- * @retval     NRF_SUCCESS                If the module was successfully initialized.
- * @retval     MODULE_ALREADY_INITIALIZED If the module has already been initialized.
- */
-uint32_t nrf_drv_ppi_init(void);
-
-/**@brief Function for uninitializing the PPI module. 
- *
- * This function also disables all channels and clears the channel groups.
- *
- * @retval     NRF_SUCCESS             If the module was successfully uninitialized.
- * @retval     NRF_ERROR_INVALID_STATE If the module has not been initialized yet.
- * @retval     NRF_ERROR_INTERNAL      If the channels or groups could not be disabled.
- */
-uint32_t nrf_drv_ppi_uninit(void);
-
-/**@brief Function for allocating a PPI channel.
- * @details This function allocates the first unused PPI channel.
- *
- * @param[out] p_channel               Pointer to the PPI channel that has been allocated.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully allocated.
- * @retval     NRF_ERROR_NO_MEM        If there is no available channel to be used.
- */
-uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel);
-
-/**@brief Function for freeing a PPI channel.
- * @details This function also disables the chosen channel.
- *
- * @param[in]  channel                 PPI channel to be freed.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully freed.
- * @retval     NRF_ERROR_INVALID_PARAM If the channel is not user-configurable.
- */
-uint32_t nrf_drv_ppi_channel_free(nrf_ppi_channel_t channel);
-
-/**@brief Function for assigning task and event endpoints to the PPI channel.
- *
- * @param[in]  channel                 PPI channel to be assigned endpoints.
- *
- * @param[in]  eep                     Event endpoint address.
- *
- * @param[in]  tep                     Task endpoint address.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully assigned.
- * @retval     NRF_ERROR_INVALID_STATE If the channel is not allocated for the user.
- * @retval     NRF_ERROR_INVALID_PARAM If the channel is not user-configurable.
- */
-uint32_t nrf_drv_ppi_channel_assign(nrf_ppi_channel_t channel, uint32_t eep, uint32_t tep);
-
-/**@brief Function for assigning or clearing fork endpoint to the PPI channel.
- *
- * @param[in]  channel                 PPI channel to be assigned endpoints.
- *
- * @param[in]  fork_tep                Fork task endpoint address or 0 to clear.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully assigned.
- * @retval     NRF_ERROR_INVALID_STATE If the channel is not allocated for the user.
- * @retval     NRF_ERROR_INVALID_PARAM If the channel is not user-configurable.
- * @retval     NRF_ERROR_NOT_SUPPORTED If function is not supported.
- */
-uint32_t nrf_drv_ppi_channel_fork_assign(nrf_ppi_channel_t channel, uint32_t fork_tep);
-
-/**@brief Function for enabling a PPI channel.
- *
- * @param[in]  channel                 PPI channel to be enabled.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully enabled.
- * @retval     NRF_ERROR_INVALID_STATE If the user-configurable channel is not allocated.
- * @retval     NRF_ERROR_INVALID_PARAM If the channel cannot be enabled by the user.
- */
-uint32_t nrf_drv_ppi_channel_enable(nrf_ppi_channel_t channel);
-
-/**@brief Function for disabling a PPI channel.
- *
- * @param[in]  channel                 PPI channel to be disabled.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully disabled.
- * @retval     NRF_ERROR_INVALID_STATE If the user-configurable channel is not allocated.
- * @retval     NRF_ERROR_INVALID_PARAM If the channel cannot be disabled by the user.
- */
-uint32_t nrf_drv_ppi_channel_disable(nrf_ppi_channel_t channel);
-
-/**@brief Function for allocating a PPI channel group.
- * @details This function allocates the first unused PPI group.
- *
- * @param[out] p_group                 Pointer to the PPI channel group that has been allocated.
- *
- * @retval     NRF_SUCCESS             If the channel group was successfully allocated.
- * @retval     NRF_ERROR_NO_MEM        If there is no available channel group to be used.
- */
-uint32_t nrf_drv_ppi_group_alloc(nrf_ppi_channel_group_t * p_group);
-
-/**@brief Function for freeing a PPI channel group.
- * @details This function also disables the chosen group.
- *
- * @param[in]  group                   PPI channel group to be freed.
- *
- * @retval     NRF_SUCCESS             If the channel group was successfully freed.
- * @retval     NRF_ERROR_INVALID_PARAM If the channel group is not user-configurable.
- */
-uint32_t nrf_drv_ppi_group_free(nrf_ppi_channel_group_t group);
-
-/**@brief  Compute a channel mask for NRF_PPI registers.
- *
- * @param[in]  channel  Channel number to transform to a mask.
- *
- * @retval     Channel mask.
- */
-__STATIC_INLINE uint32_t nrf_drv_ppi_channel_to_mask(nrf_ppi_channel_t channel)
-{
-    return (1uL << (uint32_t) channel);
-}
-
-/**@brief Function for including multiple PPI channels in a channel group.
- *
- * @param[in]  channel_mask            PPI channels to be added.
- * @param[in]  group                   Channel group in which to include the channels.
- *
- * @retval     NRF_SUCCESS             If the channels was successfully included.
- */
-uint32_t nrf_drv_ppi_channels_include_in_group(uint32_t channel_mask,
-                                               nrf_ppi_channel_group_t group);
-
-/**@brief Function for including a PPI channel in a channel group.
- *
- * @param[in]  channel                 PPI channel to be added.
- * @param[in]  group                   Channel group in which to include the channel.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully included.
- */
-__STATIC_INLINE uint32_t nrf_drv_ppi_channel_include_in_group(nrf_ppi_channel_t       channel,
-                                                              nrf_ppi_channel_group_t group)
-{
-    return nrf_drv_ppi_channels_include_in_group(nrf_drv_ppi_channel_to_mask(channel), group);
-}
-
-/**@brief Function for removing multiple PPI channels from a channel group.
- *
- * @param[in]  channel_mask            PPI channels to be removed.
- * @param[in]  group                   Channel group from which to remove the channels.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully removed.
- */
-uint32_t nrf_drv_ppi_channels_remove_from_group(uint32_t channel_mask,
-                                                nrf_ppi_channel_group_t group);
-
-/**@brief Function for removing a PPI channel from a channel group.
- *
- * @param[in]  channel                 PPI channel to be removed.
- * @param[in]  group                   Channel group from which to remove the channel.
- *
- * @retval     NRF_SUCCESS             If the channel was successfully removed.
- */
-__STATIC_INLINE uint32_t nrf_drv_ppi_channel_remove_from_group(nrf_ppi_channel_t       channel,
-                                                               nrf_ppi_channel_group_t group)
-{
-    return nrf_drv_ppi_channels_remove_from_group(nrf_drv_ppi_channel_to_mask(channel), group);
-}
-
-/**@brief Function for clearing a PPI channel group.
- *
- * @param[in]  group                   Channel group to be cleared.
- *
- * @retval     NRF_SUCCESS             If the group was successfully cleared.
- */
-__STATIC_INLINE uint32_t nrf_drv_ppi_group_clear(nrf_ppi_channel_group_t group)
-{
-    return nrf_drv_ppi_channels_remove_from_group(NRF_PPI_ALL_APP_CHANNELS_MASK, group);
-}
-
-/**@brief Function for enabling a PPI channel group.
- *
- * @param[in]  group                   Channel group to be enabled.
- *
- * @retval     NRF_SUCCESS             If the group was successfully enabled.
- */
-uint32_t nrf_drv_ppi_group_enable(nrf_ppi_channel_group_t group);
-
-/**@brief Function for disabling a PPI channel group.
- *
- * @param[in]  group                   Channel group to be disabled.
- *
- * @retval     NRF_SUCCESS             If the group was successfully disabled.
- */
-uint32_t nrf_drv_ppi_group_disable(nrf_ppi_channel_group_t group);
-
-/**
- * @brief Function for getting the address of a PPI task.
- *
- * @param[in]  task                      Task.
- *
- * @retval     Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_ppi_task_addr_get(nrf_ppi_task_t task)
-{
-    return (uint32_t) nrf_ppi_task_address_get(task);
-}
-
-/**
- * @brief Function for getting the address of a PPI group enable task.
- *
- * @param[in]  group                     PPI channel group
- *
- * @retval     Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_ppi_task_addr_group_enable_get(nrf_ppi_channel_group_t group)
-{
-    return (uint32_t) nrf_ppi_task_group_enable_address_get(group);
-}
-
-/**
- * @brief Function for getting the address of a PPI group enable task.
- *
- * @param[in]  group                     PPI channel group
- *
- * @retval     Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_ppi_task_addr_group_disable_get(nrf_ppi_channel_group_t group)
-{
-    return (uint32_t) nrf_ppi_task_group_disable_address_get(group);
-}
-
-/**
- *@}
- **/
-
-/*lint --flb "Leave library region" */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_PPI_H


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

Posted by cc...@apache.org.
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/util/nordic_common.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/nordic_common.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/nordic_common.h
deleted file mode 100644
index b0f8290..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/nordic_common.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (c) 2008 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
- * @brief Common defines and macros for firmware developed by Nordic Semiconductor.
- */
-
-#ifndef NORDIC_COMMON_H__
-#define NORDIC_COMMON_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** The upper 8 bits of a 32 bit value */
-//lint -emacro(572,MSB) // Suppress warning 572 "Excessive shift value"
-#define MSB_32(a) (((a) & 0xFF000000) >> 24)
-/** The lower 8 bits (of a 32 bit value) */
-#define LSB_32(a) ((a) & 0x000000FF)
-
-/** The upper 8 bits of a 16 bit value */
-//lint -emacro(572,MSB_16) // Suppress warning 572 "Excessive shift value"
-#define MSB_16(a) (((a) & 0xFF00) >> 8)
-/** The lower 8 bits (of a 16 bit value) */
-#define LSB_16(a) ((a) & 0x00FF)
-
-/** Leaves the minimum of the two 32-bit arguments */
-/*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-/** Leaves the maximum of the two 32-bit arguments */
-/*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */
-#define MAX(a, b) ((a) < (b) ? (b) : (a))
-
-/** Concatenates two parameters. Useful as a second level of indirection,
- *  when a parameter can be macro itself. */
-#define CONCAT_2(p1, p2)      p1##p2
-/** Concatenates three parameters. Useful as a second level of indirection,
- *  when a parameter can be macro itself. */
-#define CONCAT_3(p1, p2, p3)  p1##p2##p3
-
-/**@brief Set a bit in the uint32 word.
- *
- * @param[in] W  Word whose bit is being set.
- * @param[in] B  Bit number in the word to be set.
- */
-#define SET_BIT(W,B)  ((W) |= (uint32_t)(1U << (B)))
-
-
-/**@brief Clears a bit in the uint32 word.
- *
- * @param[in] W   Word whose bit is to be cleared.
- * @param[in] B   Bit number in the word to be cleared.
- */
-#define CLR_BIT(W, B) ((W) &= (~((uint32_t)1 << (B))))
-
-
-/**@brief Checks if a bit is set.
- *
- * @param[in] W   Word whose bit is to be checked.
- * @param[in] B   Bit number in the word to be checked.
- *
- * @retval 1 if bit is set.
- * @retval 0 if bit is not set.
- */
-#define IS_SET(W,B) (((W) >> (B)) & 1)
-
-#define BIT_0 0x01 /**< The value of bit 0 */
-#define BIT_1 0x02 /**< The value of bit 1 */
-#define BIT_2 0x04 /**< The value of bit 2 */
-#define BIT_3 0x08 /**< The value of bit 3 */
-#define BIT_4 0x10 /**< The value of bit 4 */
-#define BIT_5 0x20 /**< The value of bit 5 */
-#define BIT_6 0x40 /**< The value of bit 6 */
-#define BIT_7 0x80 /**< The value of bit 7 */
-#define BIT_8 0x0100 /**< The value of bit 8 */
-#define BIT_9 0x0200 /**< The value of bit 9 */
-#define BIT_10 0x0400 /**< The value of bit 10 */
-#define BIT_11 0x0800 /**< The value of bit 11 */
-#define BIT_12 0x1000 /**< The value of bit 12 */
-#define BIT_13 0x2000 /**< The value of bit 13 */
-#define BIT_14 0x4000 /**< The value of bit 14 */
-#define BIT_15 0x8000 /**< The value of bit 15 */
-#define BIT_16 0x00010000 /**< The value of bit 16 */
-#define BIT_17 0x00020000 /**< The value of bit 17 */
-#define BIT_18 0x00040000 /**< The value of bit 18 */
-#define BIT_19 0x00080000 /**< The value of bit 19 */
-#define BIT_20 0x00100000 /**< The value of bit 20 */
-#define BIT_21 0x00200000 /**< The value of bit 21 */
-#define BIT_22 0x00400000 /**< The value of bit 22 */
-#define BIT_23 0x00800000 /**< The value of bit 23 */
-#define BIT_24 0x01000000 /**< The value of bit 24 */
-#define BIT_25 0x02000000 /**< The value of bit 25 */
-#define BIT_26 0x04000000 /**< The value of bit 26 */
-#define BIT_27 0x08000000 /**< The value of bit 27 */
-#define BIT_28 0x10000000 /**< The value of bit 28 */
-#define BIT_29 0x20000000 /**< The value of bit 29 */
-#define BIT_30 0x40000000 /**< The value of bit 30 */
-#define BIT_31 0x80000000 /**< The value of bit 31 */
-
-#define UNUSED_VARIABLE(X)  ((void)(X))
-#define UNUSED_PARAMETER(X) UNUSED_VARIABLE(X)
-#define UNUSED_RETURN_VALUE(X) UNUSED_VARIABLE(X)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NORDIC_COMMON_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/util/nrf_assert.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/nrf_assert.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/nrf_assert.c
deleted file mode 100644
index 3596565..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/nrf_assert.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) 2006 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_assert.h"
-#include "app_error.h"
-#include "nordic_common.h"
-
-#if defined(DEBUG_NRF)
-void assert_nrf_callback(uint16_t line_num, const uint8_t * file_name)
-{
-    assert_info_t assert_info =
-    {
-        .line_num    = line_num,
-        .p_file_name = file_name,
-    };
-    app_error_fault_handler(NRF_FAULT_ID_SDK_ASSERT, 0, (uint32_t)(&assert_info));
-
-    UNUSED_VARIABLE(assert_info);
-}
-#endif /* DEBUG_NRF */

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/util/sdk_common.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_common.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_common.h
deleted file mode 100644
index bab4964..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_common.h
+++ /dev/null
@@ -1,182 +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.
- *
- */
-
-/** @cond */
-/**@file
- *
- * @ingroup experimental_api
- * @defgroup sdk_common SDK Common Header
- * @breif All common headers needed for SDK examples will be included here so that application
- *       developer does not have to include headers on him/herself.
- * @{
- */
-
-#ifndef SDK_COMMON_H__
-#define SDK_COMMON_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <string.h>
-#include "nordic_common.h"
-#include "compiler_abstraction.h"
-#include "sdk_os.h"
-#include "sdk_errors.h"
-#include "app_util.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Macro for verifying that the module is initialized. It will cause the function to return
- *        if not.
- *
- * @param[in] param  The variable to check if is NULL.
- */
-#ifndef DISABLE_PARAM_CHECK
-#define VERIFY_PARAM_NOT_NULL(param)                \
-do                                                  \
-{                                                   \
-    if (param == NULL)                              \
-    {                                               \
-        return NRF_ERROR_NULL;                      \
-    }                                               \
-} while(0)
-#else
-#define VERIFY_PARAM_NOT_NULL()
-#endif /* DISABLE_PARAM_CHECK */
-
-
-/**@brief Macro for verifying that the module is initialized. It will cause the function to return
- *        if not.
- *
- * @param[in] param  The variable to check if is NULL.
- */
-#ifndef DISABLE_PARAM_CHECK
-#define VERIFY_PARAM_NOT_NULL_VOID(param)           \
-do                                                  \
-{                                                   \
-    if (param == NULL)                              \
-    {                                               \
-        return;                                     \
-    }                                               \
-} while(0)
-#else
-#define VERIFY_PARAM_NOT_NULL_VOID()
-#endif /* DISABLE_PARAM_CHECK */
-
-
-/**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return the err code
- * if not.
- *
- * @param[in] err_code The error code to check.
- */
-#ifndef DISABLE_PARAM_CHECK
-#define VERIFY_SUCCESS(err_code)            \
-do                                          \
-{                                           \
-    if (err_code != NRF_SUCCESS)            \
-    {                                       \
-        return err_code;                    \
-    }                                       \
-} while(0)
-#else
-#define VERIFY_SUCCESS()
-#endif /* DISABLE_PARAM_CHECK */
-
-
-/**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return if not.
- *
- * @param[in] err_code The error code to check.
- */
-#ifndef DISABLE_PARAM_CHECK
-#define VERIFY_SUCCESS_VOID(err_code)       \
-do                                          \
-{                                           \
-    if (err_code != NRF_SUCCESS)            \
-    {                                       \
-        return;                             \
-    }                                       \
-} while(0)
-#else
-#define VERIFY_SUCCESS_VOID()
-#endif /* DISABLE_PARAM_CHECK */
-
-
-/**@brief Macro for verifying statement to be true. Will return err_code if not.
-*
-* @param[in]   statement   Statement to test.
-* @param[in]   err_code     Error value to return if test was invalid.
-*
-* @retval      err_code if test fails.
-*/
-#define VERIFY_TRUE(statement, err_code)    \
-do                                          \
-{                                           \
-    if (!(statement))                       \
-    {                                       \
-        return err_code;                    \
-    }                                       \
-} while(0)
-
-
-/**@brief Macro for verifying statement to be true. Will return if not.
-*
-* @param[in]   statement   Statement to test.
-*/
-#define VERIFY_TRUE_VOID(statement)         \
-do                                          \
-{                                           \
-    if (!(statement))                       \
-    {                                       \
-        return;                             \
-    }                                       \
-} while(0)
-
-
-/**@brief Macro for verifying statement to be false. Will return err_code if not.
-*
-* @param[in]   statement   Statement to test.
-* @param[in]   err_code     Error value to return if test was invalid.
-*
-* @retval      err_code if test fails.
-*/
-#define VERIFY_FALSE(statement, err_code)   \
-do                                          \
-{                                           \
-    if ((statement))                        \
-    {                                       \
-        return err_code;                    \
-    }                                       \
-} while(0)
-
-
-/**@brief Macro for verifying statement to be false. Will return if not.
-*
-* @param[in]   statement    Statement to test.
-*/
-#define VERIFY_FALSE_VOID(statement)        \
-do                                          \
-{                                           \
-    if ((statement))                        \
-    {                                       \
-        return;                             \
-    }                                       \
-} while(0)
-
-/** @} */
-/** @endcond */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SDK_COMMON_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/util/sdk_errors.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_errors.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_errors.h
deleted file mode 100644
index f3b5997..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_errors.h
+++ /dev/null
@@ -1,123 +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 sdk_error SDK Error codes
- * @{
- * @ingroup app_common
- * @{
- * @details Error codes are 32-bit unsigned integers with the most significant 16-bit reserved for
- *          identifying the module where the error occurred while the least least significant LSB
- *          are used to provide the cause or nature of error. Each module is assigned a 16-bit
- *          unsigned integer. Which it will use to identify all errors that occurred in it. 16-bit
- *          LSB range is with module id as the MSB in the 32-bit error code is reserved for the
- *          module. As an example, if 0x8800 identifies a certain SDK module, all values from 
- *          0x88000000 - 0x8800FFFF are reserved for this module.
- *          It should be noted that common error reasons have been assigned values to make it 
- *          possible to decode error reason easily. As an example, lets module uninitialized has
- *          been assigned an error code 0x000A0. Then, if application encounters an error code
- *          0xZZZZ00A0, it knows that it accessing a certain module without initializing it.
- *          Apart from this, each module is allowed to define error codes that are not covered by
- *          the common ones, however, these values are defined in a range that does not conflict
- *          with common error values. For module, specific error however, it is possible that the
- *          same error value is used by two different modules to indicated errors of very different
- *          nature. If error is already defined by the NRF common error codes, these are reused.
- *          A range is reserved for application as well, it can use this range for defining
- *          application specific errors.
- *
- * @note Success code, NRF_SUCCESS, does not include any module identifier.          
-
- */
-
-#ifndef SDK_ERRORS_H__
-#define SDK_ERRORS_H__
-
-#include <stdint.h>
-#include "nrf_error.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup sdk_err_base Base defined for SDK Modules
- * @{
- */
-#define SDK_ERROR_BASE         (NRF_ERROR_BASE_NUM + 0x8000)   /**< Base value defined for SDK module identifiers. */
-#define SDK_COMMON_ERROR_BASE  (NRF_ERROR_BASE_NUM + 0x0080)   /**< Base error value to be used for SDK error values. */
-/* @} */
-
-/**
- * @defgroup sdk_module_codes Codes reserved as identification for module where the error occurred.
- * @{
- */
-#define DEVICE_MANAGER_ERR_BASE   (0x8000)
-#define MEMORY_MANAGER_ERR_BASE   (0x8100)
-/* @} */
-
-
-/**
- * @defgroup sdk_iot_errors Codes reserved as identification for IoT errors.
- * @{
- */
-#define IOT_ERR_BASE_START        (0xA000)
-#define IOT_ERR_BASE_STOP         (0xAFFF)
-/* @} */
- 
-
-/**
- * @defgroup sdk_common_errors Codes reserved as identification for common errors.
- * @{
- */
-#define MODULE_NOT_INITIALZED      (SDK_COMMON_ERROR_BASE + 0x0000)
-#define MUTEX_INIT_FAILED          (SDK_COMMON_ERROR_BASE + 0x0001)
-#define MUTEX_LOCK_FAILED          (SDK_COMMON_ERROR_BASE + 0x0002)
-#define MUTEX_UNLOCK_FAILED        (SDK_COMMON_ERROR_BASE + 0x0003)
-#define MUTEX_COND_INIT_FAILED     (SDK_COMMON_ERROR_BASE + 0x0004)
-#define MODULE_ALREADY_INITIALIZED (SDK_COMMON_ERROR_BASE + 0x0005)
-#define API_NOT_IMPLEMENTED        (SDK_COMMON_ERROR_BASE + 0x0010)
-#define FEATURE_NOT_ENABLED        (SDK_COMMON_ERROR_BASE + 0x0011)
-/* @} */
-
-
-/**
- * @defgroup dm_specific_errors Error / status codes specific to device manager.
- * @{
- */
-#define DM_NO_APP_CONTEXT                (DEVICE_MANAGER_ERR_BASE + 0x0040)
-#define DM_SERVICE_CONTEXT_NOT_APPLIED   (DEVICE_MANAGER_ERR_BASE + 0x0041)
-#define DM_CONTEXT_INFO_LOST             (DEVICE_MANAGER_ERR_BASE + 0x0042)
-#define DM_DEVICE_CONTEXT_FULL           (DEVICE_MANAGER_ERR_BASE + 0x0043)
-/* @} */
-
-/**
- * @brief API Result.
- *
- * @details Indicates success or failure of an API procedure. In case of failure, a comprehensive
- *          error code indicating cause or reason for failure is provided.
- *
- *          Though called an API result, it could used in Asynchronous notifications callback along
- *          with asynchronous callback as event result. This mechanism is employed when an event
- *          marks the end of procedure initiated using API. API result, in this case, will only be
- *          an indicative of whether the procedure has been requested successfully.
- */
-typedef uint32_t ret_code_t;
-/** @} */
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SDK_ERRORS_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/util/sdk_macros.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_macros.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_macros.h
deleted file mode 100644
index 83e489f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_macros.h
+++ /dev/null
@@ -1,80 +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.
- *
- */
-
-/** @cond */
-/**@file
- *
- * @ingroup sdk_util
- * @defgroup sdk_common_macros SDK Common Header
- * @breif Macros for parameter checking and similar tasks
- * @{
- */
-
-#ifndef SDK_MACROS_H__
-#define SDK_MACROS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Macro for verifying that the module is initialized. It will cause the function to return
- *        @ref NRF_ERROR_INVALID_STATE if not.
- */
-#ifdef DISABLE_PARAM_CHECK
-#define VERIFY_MODULE_INITIALIZED()
-#else
-#ifdef MODULE_INITIALIZED
-#define VERIFY_MODULE_INITIALIZED()                 \
-do                                          \
-{                                           \
-    if (!MODULE_INITIALIZED)                \
-    {                                       \
-        return NRF_ERROR_INVALID_STATE;     \
-    }                                       \
-} while(0)
-#else
-#define VERIFY_MODULE_INITIALIZED()
-#endif /* MODULE_INITIALIZED  */
-#endif /* DISABLE_PARAM_CHECK */
-
-
-/**@brief Macro for verifying that the module is initialized. It will cause the function to return
- *        if not.
- */
-#ifdef DISABLE_PARAM_CHECK
-#define VERIFY_MODULE_INITIALIZED_VOID()
-#else
-#ifdef MODULE_INITIALIZED
-#define VERIFY_MODULE_INITIALIZED_VOID()            \
-do                                                  \
-{                                                   \
-    if (!MODULE_INITIALIZED)                        \
-    {                                               \
-        return;                                     \
-    }                                               \
-} while(0)
-#else
-#define VERIFY_MODULE_INITIALIZED_VOID()
-#endif /* MODULE_INITIALIZED  */
-#endif /* DISABLE_PARAM_CHECK */
-
-
-
-
-/** @} */
-/** @endcond */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SDK_MACROS_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/util/sdk_mapped_flags.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_mapped_flags.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_mapped_flags.c
deleted file mode 100644
index 697dd3f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_mapped_flags.c
+++ /dev/null
@@ -1,161 +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 "sdk_mapped_flags.h"
-#include <stdint.h>
-#include <stdbool.h>
-#include <stddef.h>
-#include "compiler_abstraction.h"
-
-
-/**@brief Function for setting the state of a flag to true.
- *
- * @note This function does not check whether the index is valid.
- *
- * @param[in]  p_flags  The collection of flags to modify.
- * @param[in]  index    The index of the flag to modify.
- */
-static __INLINE void sdk_mapped_flags_set_by_index(sdk_mapped_flags_t * p_flags, uint16_t index)
-{
-    *p_flags |= (1U << index);
-}
-
-
-/**@brief Function for setting the state of a flag to false.
- *
- * @note This function does not check whether the index is valid.
- *
- * @param[in]  p_flags  The collection of flags to modify.
- * @param[in]  index    The index of the flag to modify.
- */
-static __INLINE void sdk_mapped_flags_clear_by_index(sdk_mapped_flags_t * p_flags, uint16_t index)
-{
-    *p_flags &= ~(1U << index);
-}
-
-
-/**@brief Function for getting the state of a flag.
- *
- * @note This function does not check whether the index is valid.
- *
- * @param[in]  p_flags  The collection of flags to read.
- * @param[in]  index    The index of the flag to get.
- */
-static __INLINE bool sdk_mapped_flags_get_by_index(sdk_mapped_flags_t flags, uint16_t index)
-{
-    return ((flags & (1 << index)) != 0);
-}
-
-
-
-uint16_t sdk_mapped_flags_first_key_index_get(sdk_mapped_flags_t flags)
-{
-    for (uint16_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++)
-    {
-        if (sdk_mapped_flags_get_by_index(flags, i))
-        {
-            return i;
-        }
-    }
-    return SDK_MAPPED_FLAGS_INVALID_INDEX;
-}
-
-
-void sdk_mapped_flags_update_by_key(uint16_t           * p_keys,
-                                    sdk_mapped_flags_t * p_flags,
-                                    uint16_t             key,
-                                    bool                 value)
-{
-    sdk_mapped_flags_bulk_update_by_key(p_keys, p_flags, 1, key, value);
-}
-
-
-void sdk_mapped_flags_bulk_update_by_key(uint16_t           * p_keys,
-                                         sdk_mapped_flags_t * p_flags,
-                                         uint32_t             n_flag_collections,
-                                         uint16_t             key,
-                                         bool                 value)
-{
-    if ((p_keys != NULL) && (p_flags != NULL) && (n_flag_collections > 0))
-    {
-        for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++)
-        {
-            if (p_keys[i] == key)
-            {
-                for (uint32_t j = 0; j < n_flag_collections; j++)
-                {
-                    if (value)
-                    {
-                        sdk_mapped_flags_set_by_index(&p_flags[j], i);
-                    }
-                    else
-                    {
-                        sdk_mapped_flags_clear_by_index(&p_flags[j], i);
-                    }
-                }
-                return;
-            }
-        }
-    }
-}
-
-
-bool sdk_mapped_flags_get_by_key(uint16_t * p_keys, sdk_mapped_flags_t flags, uint16_t key)
-{
-    if (p_keys != NULL)
-    {
-        for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++)
-        {
-            if (p_keys[i] == key)
-            {
-                return sdk_mapped_flags_get_by_index(flags, i);
-            }
-        }
-    }
-    return false;
-}
-
-
-sdk_mapped_flags_key_list_t sdk_mapped_flags_key_list_get(uint16_t           * p_keys,
-                                                          sdk_mapped_flags_t   flags)
-{
-    sdk_mapped_flags_key_list_t key_list;
-    key_list.len = 0;
-
-    if (p_keys != NULL)
-    {
-        for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++)
-        {
-            if (sdk_mapped_flags_get_by_index(flags, i))
-            {
-                key_list.flag_keys[key_list.len++] = p_keys[i];
-            }
-        }
-    }
-
-    return key_list;
-}
-
-
-uint32_t sdk_mapped_flags_n_flags_set(sdk_mapped_flags_t flags)
-{
-    uint32_t n_flags_set = 0;
-
-    for (uint32_t i = 0; i < SDK_MAPPED_FLAGS_N_KEYS; i++)
-    {
-        if (sdk_mapped_flags_get_by_index(flags, i))
-        {
-            n_flags_set += 1;
-        }
-    }
-    return n_flags_set;
-}

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/util/sdk_mapped_flags.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_mapped_flags.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_mapped_flags.h
deleted file mode 100644
index 63733bc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_mapped_flags.h
+++ /dev/null
@@ -1,161 +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.
- *
- */
-
-#ifndef SDK_MAPPED_FLAGS_H__
-#define SDK_MAPPED_FLAGS_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "app_util.h"
-#include "compiler_abstraction.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file
- * @defgroup sdk_mapped_flags Mapped flags
- * @ingroup app_common
- * @{
- * @brief Module for writing and reading flags that are associated
- *        with keys.
- *
- * @details The flags are represented as bits in a bitmap called a <i>flag collection</i>. The keys
- *          are uint16_t. Each flag collection contains all flags of the same type, one flag for
- *          each key.
- *
- *          The mapped flags module does not keep the flag states, nor the list of keys. These are
- *          provided in the API calls. A key's index in the key list determines which bit in the
- *          flag collection is associated with it. This module does not ever edit the key list, and
- *          does not edit flags except in function calls that take the flag collection as a pointer.
- *
- */
-
-#define SDK_MAPPED_FLAGS_N_KEYS          8       /**< The number of keys to keep flags for. This is also the number of flags in a flag collection. If changing this value, you might also need change the width of the sdk_mapped_flags_t type. */
-#define SDK_MAPPED_FLAGS_N_KEYS_PER_BYTE 8       /**< The number of flags that fit in one byte. */
-#define SDK_MAPPED_FLAGS_INVALID_INDEX   0xFFFF  /**< A flag index guaranteed to be invalid. */
-
-typedef uint8_t sdk_mapped_flags_t; /**< The bitmap to hold flags. Each flag is one bit, and each bit represents the flag state associated with one key. */
-
-
-// Test whether the flag collection type is large enough to hold all the flags. If this fails,
-// reduce SDK_MAPPED_FLAGS_N_KEYS or increase the size of sdk_mapped_flags_t.
-STATIC_ASSERT((
-    sizeof(sdk_mapped_flags_t)*SDK_MAPPED_FLAGS_N_KEYS_PER_BYTE) >= SDK_MAPPED_FLAGS_N_KEYS);
-
-
-/**@brief Type used to present a subset of the registered keys.
- */
-typedef struct
-{
-    uint32_t len;                                 /**< The length of the list. */
-    uint16_t flag_keys[SDK_MAPPED_FLAGS_N_KEYS];  /**< The list of keys. */
-} sdk_mapped_flags_key_list_t;
-
-
-/**@brief Function for getting the first index at which the flag is true in the provided
- *        collection.
- *
- * @param[in]  flags   The flag collection to search for a flag set to true.
- *
- * @return  The first index that has its flag set to true. If none were found, the
- *          function returns @ref SDK_MAPPED_FLAGS_INVALID_INDEX.
- */
-uint16_t sdk_mapped_flags_first_key_index_get(sdk_mapped_flags_t flags);
-
-
-/**@brief Function for updating the state of a flag.
- *
- * @param[in]  p_keys   The list of associated keys (assumed to have a length of
- *                      @ref SDK_MAPPED_FLAGS_N_KEYS).
- * @param[out] p_flags  The flag collection to modify.
- * @param[in]  key      The key to modify the flag of.
- * @param[in]  value    The state to set the flag to.
- */
-void sdk_mapped_flags_update_by_key(uint16_t           * p_keys,
-                                    sdk_mapped_flags_t * p_flags,
-                                    uint16_t             key,
-                                    bool                 value);
-
-
-/**@brief Function for updating the state of the same flag in multiple flag collections.
- *
- * @details The key and value are the same for all flag collections in the p_flags array.
- *
- * @param[in]  p_keys              The list of associated keys (assumed to have a length of
- *                                 @ref SDK_MAPPED_FLAGS_N_KEYS).
- * @param[out] p_flags             The flag collections to modify.
- * @param[out] n_flag_collections  The number of flag collections in p_flags.
- * @param[in]  key                 The key to modify the flag of.
- * @param[in]  value               The state to set the flag to.
- */
-void sdk_mapped_flags_bulk_update_by_key(uint16_t           * p_keys,
-                                         sdk_mapped_flags_t * p_flags,
-                                         uint32_t             n_flag_collections,
-                                         uint16_t             key,
-                                         bool                 value);
-
-
-/**@brief Function for getting the state of a specific flag.
- *
- * @param[in]  p_keys  The list of associated keys (assumed to have a length of
- *                     @ref SDK_MAPPED_FLAGS_N_KEYS).
- * @param[in]  flags   The flag collection to read from.
- * @param[in]  key     The key to get the flag for.
- *
- * @return  The state of the flag.
- */
-bool sdk_mapped_flags_get_by_key(uint16_t * p_keys, sdk_mapped_flags_t flags, uint16_t key);
-
-
-/**@brief Function for getting a list of all keys that have a specific flag set to true.
- *
- * @param[in]  p_keys  The list of associated keys (assumed to have a length of
- *                     @ref SDK_MAPPED_FLAGS_N_KEYS).
- * @param[in]  flags   The flag collection to search.
- *
- * @return  The list of keys.
- */
-sdk_mapped_flags_key_list_t sdk_mapped_flags_key_list_get(uint16_t           * p_keys,
-                                                          sdk_mapped_flags_t   flags);
-
-
-/**@brief Function for getting the number of keys that have a specific flag set to true.
- *
- * @param[in]  flags  The flag collection to search.
- *
- * @return  The number of keys.
- */
-uint32_t sdk_mapped_flags_n_flags_set(sdk_mapped_flags_t flags);
-
-
-/**@brief Function for querying whether any flags in the collection are set.
- *
- * @param[in]  flags  The flag collection to query.
- *
- * @retval  true If one or more flags are set to true.
- * @retval  false Otherwise.
- */
-static __INLINE bool sdk_mapped_flags_any_set(sdk_mapped_flags_t flags)
-{
-    return (flags != 0);
-}
-
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SDK_MAPPED_FLAGS_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/util/sdk_os.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_os.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_os.h
deleted file mode 100644
index 3fbbf4b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_os.h
+++ /dev/null
@@ -1,48 +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.
- *
- */
-
- /** @cond */
-/**@file
- *
- * @defgroup sdk_os SDK OS Abstraction
- * @ingroup experimental_api
- * @details In order to made SDK modules independent of use of an embedded OS, and permit
- *          application with varied task architecture, SDK abstracts the OS specific
- *          elements here in order to make all other modules agnostic to the OS or task
- *          architecture.
- * @{
- */
-
-#ifndef SDK_OS_H__
-#define SDK_OS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SDK_MUTEX_DEFINE(X)
-#define SDK_MUTEX_INIT(X)
-#define SDK_MUTEX_LOCK(X)
-#define SDK_MUTEX_UNLOCK(X)
-
-/**
- * @defgroup os_data_type Data types.
- */
- 
-/** @} */
-/** @endcond */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SDK_OS_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/util/sdk_resources.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_resources.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_resources.h
deleted file mode 100644
index c95a65e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/sdk_resources.h
+++ /dev/null
@@ -1,58 +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
- * @brief Definition file for resource usage by SoftDevice, ESB and Gazell.
- */
-
-#ifndef APP_RESOURCES_H__
-#define APP_RESOURCES_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef SOFTDEVICE_PRESENT
-	#include "nrf_sd_def.h"
-#else
-	#define SD_PPI_RESTRICTED	      0uL /**< 1 if PPI peripheral is restricted, 0 otherwise. */
-	#define SD_PPI_CHANNELS_USED      0uL /**< PPI channels utilized by SotfDevice (not available to th spplication). */
-	#define SD_PPI_GROUPS_USED        0uL /**< PPI groups utilized by SotfDevice (not available to th spplication). */
-	#define SD_TIMERS_USED            0uL /**< Timers used by SoftDevice. */
-	#define SD_SWI_USED               0uL /**< Software interrupts used by SoftDevice. */
-#endif
-
-#ifdef GAZELL_PRESENT
-	#include "nrf_gzll_resources.h"
-#else
-	#define GZLL_PPI_CHANNELS_USED    0uL /**< PPI channels utilized by Gazell (not available to th spplication). */
-	#define GZLL_TIMERS_USED          0uL /**< Timers used by Gazell. */
-	#define GZLL_SWI_USED             0uL /**< Software interrupts used by Gazell */
-#endif
-
-#ifdef ESB_PRESENT
-	#include "nrf_esb_resources.h"
-#else
-	#define ESB_PPI_CHANNELS_USED    0uL /**< PPI channels utilized by ESB (not available to th spplication). */
-	#define ESB_TIMERS_USED          0uL /**< Timers used by ESB. */
-	#define ESB_SWI_USED             0uL /**< Software interrupts used by ESB */
-#endif
-
-#define NRF_PPI_CHANNELS_USED (SD_PPI_CHANNELS_USED | GZLL_PPI_CHANNELS_USED | ESB_PPI_CHANNELS_USED)
-#define NRF_PPI_GROUPS_USED   (SD_PPI_GROUPS_USED)
-#define NRF_SWI_USED          (SD_SWI_USED | GZLL_SWI_USED | ESB_SWI_USED)
-#define NRF_TIMERS_USED       (SD_TIMERS_USED | GZLL_TIMERS_USED | ESB_TIMERS_USED)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_RESOURCES_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/serialization/application/codecs/common/ble_dtm_app.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_app.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_app.c
deleted file mode 100644
index 1362d23..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_app.c
+++ /dev/null
@@ -1,73 +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.
- *
- */
- 
-#include <stdint.h>
-#include "app_error.h"
-#include "ble_dtm_app.h"
-#include "ble_serialization.h"
-#include "nrf_error.h"
-#include "ser_config.h"
-#include "ser_hal_transport.h"
-#include "ser_sd_transport.h"
-
-
-static uint32_t dtm_init_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_dtm_init_rsp_dec(p_buffer, length, &result_code);
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t ble_dtm_init(app_uart_stream_comm_params_t * p_uart_comm_params)
-{
-    if (p_uart_comm_params == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-    
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t index = 0;
-    
-    uint8_t * p_tx_buf = NULL;
-    uint32_t tx_buf_len = 0;
-
-    err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len);
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    p_tx_buf[index++] = SER_PKT_TYPE_DTM_CMD;
-    tx_buf_len -= SER_PKT_TYPE_SIZE;
-
-    err_code = ble_dtm_init_req_enc(p_uart_comm_params, &(p_tx_buf[SER_PKT_TYPE_SIZE]), &tx_buf_len);
-    if (err_code == NRF_SUCCESS)
-    {
-        tx_buf_len += SER_PKT_TYPE_SIZE;
-
-        err_code = ser_sd_transport_cmd_write(p_tx_buf, tx_buf_len, dtm_init_rsp_dec);
-        if (err_code != NRF_SUCCESS)
-        {
-            err_code = NRF_ERROR_INTERNAL;
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_INTERNAL;
-    }
-
-    return err_code;
-}

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/serialization/application/codecs/common/ble_dtm_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_app.h
deleted file mode 100644
index e47ae2f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_app.h
+++ /dev/null
@@ -1,92 +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.
- *
- */
- 
-#ifndef BLE_DTM_APP_H__
-#define BLE_DTM_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_common_codecs Application common codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_dtm_app DTM Application command request encoders and command response decoders
- * @{
- * @ingroup  ser_app_common_codecs
- *
- * @brief   DTM Application command request encoders and command response decoders.
- */
-
-#include "dtm_uart_params.h"
-
-/**@brief Encodes @ref ble_dtm_init command request.
- *
- * @sa @ref nrf51_dtm_init_encoding_sec for packet format,
- *     @ref ble_dtm_init_rsp_dec for command response decoder.
- *
- * @param[in] p_uart_comm_params    Pointer to UART configuration parameters.
- * @param[in] p_buf                 Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len         \c in: Size of \p p_buf buffer.
- *                                  \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_dtm_init_req_enc(app_uart_stream_comm_params_t const * const p_uart_comm_params,
-                              uint8_t                             * const p_buf,
-                              uint32_t                            * const p_buf_len);
-
-
-/**@brief Decodes response @ref ble_dtm_init command.
- *
- * @sa @ref nrf51_dtm_init_encoding_sec for packet format,
- *     @ref ble_dtm_init_req_enc for command request encoder.
- *
- * @param[in] p_buf             Pointer to beginning of command response packet.
- * @param[in] packet_len        Length (in bytes) of response packet.
- * @param[out] p_result_code    Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- */
-uint32_t ble_dtm_init_rsp_dec(uint8_t const * const p_buf, 
-                              uint32_t              packet_len,
-                              uint32_t * const      p_result_code);
-
-
-/**@brief Function to initializing DTM mode.
- *
- * @param[in] p_uart_comm_params    Pointer to the DTM UART configuration parameters.
- *
- * @retval NRF_SUCCESS          Encoding success.
- * @retval NRF_ERROR_NULL       Encoding failure. NULL pointer supplied.
- */
-uint32_t ble_dtm_init(app_uart_stream_comm_params_t * p_uart_comm_params);
-
-/** @} */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BLE_DTM_APP_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/serialization/application/codecs/common/ble_dtm_init.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_init.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_init.c
deleted file mode 100644
index 443b7b5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/ble_dtm_init.c
+++ /dev/null
@@ -1,56 +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.
- *
- */
- 
-#include "ble_dtm_app.h"
-#include "ble_serialization.h"
-#include "nrf_error.h"
-
-uint32_t ble_dtm_init_req_enc(app_uart_stream_comm_params_t const * const p_uart_comm_params, uint8_t * const p_buf, uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-    SER_ASSERT_NOT_NULL(p_uart_comm_params);
-
-    uint32_t index = 0;
-    uint32_t buf_len = *p_buf_len;
-    uint32_t err_code;
-
-    err_code = uint8_t_enc(&p_uart_comm_params->tx_pin_no, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_uart_comm_params->rx_pin_no, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_uart_comm_params->baud_rate, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_dtm_init_rsp_dec(uint8_t const * const p_buf, uint32_t packet_len, uint32_t * const p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t err_code;
-    uint32_t index = 0;
-
-    err_code = uint32_t_dec(p_buf, packet_len, &index, p_result_code);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT(packet_len == index, NRF_ERROR_INVALID_LENGTH);
-
-    return err_code;
-}

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/serialization/application/codecs/common/conn_systemreset.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/conn_systemreset.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/conn_systemreset.c
deleted file mode 100644
index c8950ec..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/conn_systemreset.c
+++ /dev/null
@@ -1,42 +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.
- *
- */
- 
-#include <stdint.h>
-#include "ble_serialization.h"
-#include "ser_hal_transport.h"
-#include "ser_sd_transport.h"
-
-
-uint32_t conn_systemreset(void)
-{
-    uint32_t err_code = NRF_SUCCESS;
-    uint8_t * p_tx_buf = NULL;
-    uint32_t tx_buf_len = 0;
-
-    err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len);
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(SER_PKT_TYPE_SIZE, tx_buf_len);
-    p_tx_buf[SER_PKT_TYPE_POS] = SER_PKT_TYPE_RESET_CMD;
-    tx_buf_len = SER_PKT_TYPE_SIZE;
-
-    err_code = ser_sd_transport_cmd_write(p_tx_buf, tx_buf_len, NULL);
-    if (err_code != NRF_SUCCESS)
-    {
-        err_code = NRF_ERROR_INTERNAL;
-    }
-
-    return err_code;
-}

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/serialization/application/codecs/common/conn_systemreset.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/conn_systemreset.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/conn_systemreset.h
deleted file mode 100644
index a1004aa..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/common/conn_systemreset.h
+++ /dev/null
@@ -1,51 +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.
- *
- */
- 
-#ifndef CONN_SYSTEMRESET_H__
-#define CONN_SYSTEMRESET_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_common_codecs Application common codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup conn_systemreset Connectivity chip reset command request encoder.
- * @{
- * @ingroup  ser_app_common_codecs
- *
- * @brief    Connectivity chip reset command request encoder.
- */
-
-/**@brief Function for performing the connectivity chip reset.
- *
- * @retval NRF_SUCCESS          Encoding success.
- * @retval NRF_ERROR_INTERNAL   Encoding failure. Transport error.
- */
-uint32_t conn_systemreset(void);
-
-/** @} */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // CONN_SYSTEMRESET_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/serialization/application/codecs/s130/middleware/app_mw_ble.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble.c
deleted file mode 100644
index 8948e5f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble.c
+++ /dev/null
@@ -1,498 +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.
- *
- */
-
-#include "ble.h"
-#include "ble_serialization.h"
-#include <stdint.h>
-#include "ble_app.h"
-#include "ser_sd_transport.h"
-#include "app_error.h"
-#include "app_ble_user_mem.h"
-
-extern ser_ble_user_mem_t m_app_user_mem_table[];
-
-/**@brief Structure containing @ref sd_ble_uuid_encode output parameters. */
-typedef struct
-{
-    uint8_t * p_uuid_le_len; /**< @ref sd_ble_uuid_encode appearance p_uuid_le_len output parameter. */
-    uint8_t * p_uuid_le;     /**< @ref sd_ble_uuid_encode appearance p_uuid_le output parameter. */
-} ble_uuid_encode_out_params_t;
-
-/**@brief Structure containing @ref sd_ble_user_mem_reply output parameters. */
-typedef struct
-{
-    uint16_t conn_handle;       /**< @ref sd_ble_user_mem_reply conn_handle. */
-    uint8_t  context_allocated; /**< @ref sd_ble_user_mem_reply user memory context allocated flag. */
-} ble_user_mem_reply_out_params_t;
-
-/**@brief Union containing BLE command output parameters. */
-typedef union
-{
-    ble_uuid_encode_out_params_t          ble_uuid_encode_out_params;         /**< @ref sd_ble_uuid_encode output parameters. */
-    ble_user_mem_reply_out_params_t       ble_user_mem_reply_out_params;      /**< @ref sd_ble_user_mem_reply output parameters. */
-} ble_command_output_params_t;
-
-static ble_command_output_params_t m_output_params; /**< BLE command output parameters. */
-
-static void * mp_out_params[3];
-static uint32_t m_uint32_param;
-
-static void tx_buf_alloc(uint8_t * * p_data, uint32_t * p_len)
-{
-    uint32_t err_code;
-    uint16_t len16;
-
-    do
-    {
-        err_code = ser_sd_transport_tx_alloc(p_data, &len16);
-    }
-    while (err_code != NRF_SUCCESS);
-
-    *p_data[0] = SER_PKT_TYPE_CMD;
-    *p_len     = (uint32_t)len16 - 1;
-}
-
-/**@brief Command response callback function for @ref sd_ble_uuid_encode BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t uuid_encode_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code =
-        ble_uuid_encode_rsp_dec(p_buffer,
-                                length,
-                                m_output_params.ble_uuid_encode_out_params.p_uuid_le_len,
-                                m_output_params.ble_uuid_encode_out_params.p_uuid_le,
-                                &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-    return result_code;
-}
-
-
-uint32_t sd_ble_uuid_encode(ble_uuid_t const * const p_uuid,
-                            uint8_t * const          p_uuid_le_len,
-                            uint8_t * const          p_uuid_le)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-
-    m_output_params.ble_uuid_encode_out_params.p_uuid_le_len = p_uuid_le_len;
-    m_output_params.ble_uuid_encode_out_params.p_uuid_le     = p_uuid_le;
-
-    uint32_t err_code = ble_uuid_encode_req_enc(p_uuid,
-                                                p_uuid_le_len,
-                                                p_uuid_le,
-                                                &(p_buffer[1]),
-                                                &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      uuid_encode_rsp_dec);
-
-}
-
-/**@brief Command response callback function for @ref sd_ble_tx_packet_count_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t tx_packet_count_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_tx_packet_count_get_rsp_dec(p_buffer,
-                                                              length,
-                                                              (uint8_t * *)&mp_out_params[0],
-                                                              &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_tx_packet_count_get(uint16_t conn_handle, uint8_t * p_count)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-    mp_out_params[0] = p_count;
-
-    const uint32_t err_code = ble_tx_packet_count_get_req_enc(conn_handle,
-                                                              p_count,
-                                                              &(p_buffer[1]),
-                                                              &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      tx_packet_count_get_rsp_dec);
-
-}
-
-/**@brief Command response callback function for @ref sd_ble_uuid_vs_add BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t uuid_vs_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_uuid_vs_add_rsp_dec(p_buffer,
-                                                      length,
-                                                      (uint8_t * *)&mp_out_params[0],
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_uuid_vs_add(ble_uuid128_t const * const p_vs_uuid, uint8_t * const p_uuid_type)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-    mp_out_params[0] = p_uuid_type;
-
-    const uint32_t err_code = ble_uuid_vs_add_req_enc(p_vs_uuid, p_uuid_type,
-                                                      &(p_buffer[1]),
-                                                      &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      uuid_vs_add_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_uuid_decode BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t uuid_decode_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_uuid_decode_rsp_dec(p_buffer,
-                                                      length,
-                                                      (ble_uuid_t * *)&mp_out_params[0],
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_uuid_decode(uint8_t               uuid_le_len,
-                            uint8_t const * const p_uuid_le,
-                            ble_uuid_t * const    p_uuid)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-    mp_out_params[0] = p_uuid;
-
-    const uint32_t err_code = ble_uuid_decode_req_enc(uuid_le_len, p_uuid_le, p_uuid,
-                                                      &(p_buffer[1]),
-                                                      &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      uuid_decode_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_version_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t version_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_version_get_rsp_dec(p_buffer,
-                                                      length,
-                                                      (ble_version_t *)mp_out_params[0],
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_version_get(ble_version_t * p_version)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-    mp_out_params[0] = p_version;
-
-    const uint32_t err_code = ble_version_get_req_enc(p_version,
-                                                      &(p_buffer[1]),
-                                                      &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      version_get_rsp_dec);
-
-}
-
-/**@brief Command response callback function for @ref sd_ble_opt_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t opt_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-    uint32_t uint32_param;
-
-    uint32_t err_code = ble_opt_get_rsp_dec(p_buffer,
-                                            length,
-                                            &uint32_param,
-                                            (ble_opt_t *)mp_out_params[0],
-                                            &result_code);
-
-    APP_ERROR_CHECK(err_code);
-    if (m_uint32_param != uint32_param) // decoded id should be the same as encoded one
-    {
-      err_code = NRF_ERROR_INVALID_PARAM;
-    }
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-    mp_out_params[0] = p_opt;
-    m_uint32_param = opt_id;
-
-    const uint32_t err_code = ble_opt_get_req_enc(opt_id,
-                                                  p_opt,
-                                                  &(p_buffer[1]),
-                                                  &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      opt_get_rsp_dec);
-
-}
-
-/**@brief Command response callback function for @ref sd_ble_opt_set BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t opt_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_opt_set_rsp_dec(p_buffer,
-                                                  length,
-                                                  &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-
-    const uint32_t err_code = ble_opt_set_req_enc(opt_id,
-                                                  p_opt,
-                                                  &(p_buffer[1]),
-                                                  &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      opt_set_rsp_dec);
-
-}
-
-/**@brief Command response callback function for @ref sd_ble_enable BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t enable_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_enable_rsp_dec(p_buffer,
-                                                 length,
-                                                 &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_enable(ble_enable_params_t * p_params, uint32_t * p_app_ram_base)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length;
-
-    //Ignore ram_base parameter
-    (void)p_app_ram_base;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-    mp_out_params[0] = p_params;
-
-    const uint32_t err_code = ble_enable_req_enc(p_params,
-                                                 &(p_buffer[1]),
-                                                 &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      enable_rsp_dec);
-
-}
-
-/**@brief Command response callback function for @ref sd_ble_user_mem_reply BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t user_mem_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    uint32_t err_code = ble_user_mem_reply_rsp_dec(p_buffer,
-                                                         length,
-                                                         &result_code);
-    APP_ERROR_CHECK(err_code);
-
-    if ((result_code != NRF_SUCCESS) && 
-        (m_output_params.ble_user_mem_reply_out_params.context_allocated))
-    {
-        err_code = app_ble_user_mem_context_destroy(
-                       m_output_params.ble_user_mem_reply_out_params.conn_handle);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    }
-
-    return result_code;
-}
-
-uint32_t sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length, user_mem_table_index;
-    uint32_t  err_code = NRF_SUCCESS;
-
-    tx_buf_alloc(&p_buffer, &buffer_length);
-
-    // Prepare User Memory Block context for later synchronization when SoftDevice updates 
-    // the data in the memory block
-    if(p_block != NULL)
-    {
-        err_code = app_ble_user_mem_context_create(conn_handle, &user_mem_table_index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-        m_app_user_mem_table[user_mem_table_index].mem_block.len   = p_block->len;
-        m_app_user_mem_table[user_mem_table_index].mem_block.p_mem = p_block->p_mem;
-        // Save connection handle and context allocation flag for case if context destroy was needed
-        m_output_params.ble_user_mem_reply_out_params.conn_handle       = conn_handle;
-        m_output_params.ble_user_mem_reply_out_params.context_allocated = 1;
-    }
-    else
-    {
-        m_output_params.ble_user_mem_reply_out_params.context_allocated = 0;
-    }
-
-    err_code = ble_user_mem_reply_req_enc(conn_handle,
-                                          p_block,   
-                                          &(p_buffer[1]),
-                                          &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      user_mem_reply_rsp_dec);
-}


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

Posted by cc...@apache.org.
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/pstorage/config/pstorage_platform.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/config/pstorage_platform.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/config/pstorage_platform.h
deleted file mode 100644
index 5dd217a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/config/pstorage_platform.h
+++ /dev/null
@@ -1,80 +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.
- *
- */
-
- /** @cond To make doxygen skip this file */
-
-/** @file
- *  This header contains defines with respect persistent storage that are specific to
- *  persistent storage implementation and application use case.
- */
-#ifndef PSTORAGE_PL_H__
-#define PSTORAGE_PL_H__
-
-#include <stdint.h>
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static __INLINE uint16_t pstorage_flash_page_size()
-{
-  	return (uint16_t)NRF_FICR->CODEPAGESIZE;
-}
-
-#define PSTORAGE_FLASH_PAGE_SIZE     pstorage_flash_page_size()          /**< Size of one flash page. */
-#define PSTORAGE_FLASH_EMPTY_MASK    0xFFFFFFFF                          /**< Bit mask that defines an empty address in flash. */
-
-static __INLINE uint32_t pstorage_flash_page_end()
-{
-   uint32_t bootloader_addr = NRF_UICR->NRFFW[0];
-  
-   return ((bootloader_addr != PSTORAGE_FLASH_EMPTY_MASK) ?
-           (bootloader_addr/ PSTORAGE_FLASH_PAGE_SIZE) : NRF_FICR->CODESIZE);
-}
-
-#define PSTORAGE_FLASH_PAGE_END     pstorage_flash_page_end()
-
-#define PSTORAGE_NUM_OF_PAGES       1                                                           /**< Number of flash pages allocated for the pstorage module excluding the swap page, configurable based on system requirements. */
-#define PSTORAGE_MIN_BLOCK_SIZE     0x0010                                                      /**< Minimum size of block that can be registered with the module. Should be configured based on system requirements, recommendation is not have this value to be at least size of word. */
-
-#define PSTORAGE_DATA_START_ADDR    ((PSTORAGE_FLASH_PAGE_END - PSTORAGE_NUM_OF_PAGES - 1) \
-                                    * PSTORAGE_FLASH_PAGE_SIZE)                                 /**< Start address for persistent data, configurable according to system requirements. */
-#define PSTORAGE_DATA_END_ADDR      ((PSTORAGE_FLASH_PAGE_END - 1) * PSTORAGE_FLASH_PAGE_SIZE)  /**< End address for persistent data, configurable according to system requirements. */
-#define PSTORAGE_SWAP_ADDR          PSTORAGE_DATA_END_ADDR                                      /**< Top-most page is used as swap area for clear and update. */
-
-#define PSTORAGE_MAX_BLOCK_SIZE     PSTORAGE_FLASH_PAGE_SIZE                                    /**< Maximum size of block that can be registered with the module. Should be configured based on system requirements. And should be greater than or equal to the minimum size. */
-#define PSTORAGE_CMD_QUEUE_SIZE     10                                                          /**< Maximum number of flash access commands that can be maintained by the module for all applications. Configurable. */
-
-
-/** Abstracts persistently memory block identifier. */
-typedef uint32_t pstorage_block_t;
-
-typedef struct
-{
-    uint32_t            module_id;      /**< Module ID.*/
-    pstorage_block_t    block_id;       /**< Block ID.*/
-} pstorage_handle_t;
-
-typedef uint16_t pstorage_size_t;      /** Size of length and offset fields. */
-
-/**@brief Handles Flash Access Result Events. To be called in the system event dispatcher of the application. */
-void pstorage_sys_event_handler (uint32_t sys_evt);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // PSTORAGE_PL_H__
-
-/** @} */
-/** @endcond */

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/pstorage/pstorage.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage.c
deleted file mode 100644
index 7d64e11..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage.c
+++ /dev/null
@@ -1,1572 +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 "pstorage.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include "nordic_common.h"
-#include "nrf_error.h"
-#include "nrf_assert.h"
-#include "nrf.h"
-#include "nrf_soc.h"
-#include "app_util.h"
-#include "app_error.h"
-
-#define INVALID_OPCODE             0x00                                /**< Invalid op code identifier. */
-#define SOC_MAX_WRITE_SIZE         PSTORAGE_FLASH_PAGE_SIZE            /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API. */
-#define RAW_MODE_APP_ID            (PSTORAGE_NUM_OF_PAGES + 1)         /**< Application id for raw mode. */
-
-#if defined(NRF52)
-#define SD_CMD_MAX_TRIES           1000                                /**< Number of times to try a softdevice flash operatoion, specific for nRF52 to account for longest time of flash page erase*/
-#else
-#define SD_CMD_MAX_TRIES           3                                   /**< Number of times to try a softdevice flash operation when the @ref NRF_EVT_FLASH_OPERATION_ERROR sys_evt is received. */
-#endif /* defined(NRF52) */
-
-#define MASK_TAIL_SWAP_DONE        (1 << 0)                            /**< Flag for checking if the tail restore area has been written to swap page. */     
-#define MASK_SINGLE_PAGE_OPERATION (1 << 1)                            /**< Flag for checking if command is a single flash page operation. */
-#define MASK_MODULE_INITIALIZED    (1 << 2)                            /**< Flag for checking if the module has been initialized. */
-#define MASK_FLASH_API_ERR_BUSY    (1 << 3)                            /**< Flag for checking if flash API returned NRF_ERROR_BUSY. */
-
-/**
- * @defgroup api_param_check API Parameters check macros.
- *
- * @details Macros that verify parameters passed to the module in the APIs. These macros
- *          could be mapped to nothing in final code versions to save execution and size.
- *
- * @{
- */
-
-/**@brief Check if the input pointer is NULL, if so it returns NRF_ERROR_NULL.
- */
-#define NULL_PARAM_CHECK(PARAM)                                                                   \
-        if ((PARAM) == NULL)                                                                      \
-        {                                                                                         \
-            return NRF_ERROR_NULL;                                                                \
-        }
-
-/**@brief Verifies that the module identifier supplied by the application is within permissible
- *        range.
- */
-#define MODULE_ID_RANGE_CHECK(ID)                                                                 \
-        if ((((ID)->module_id) >= PSTORAGE_NUM_OF_PAGES) ||                                       \
-            (m_app_table[(ID)->module_id].cb == NULL))                                            \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies that the block identifier supplied by the application is within the permissible
- *        range.
- */
-#define BLOCK_ID_RANGE_CHECK(ID)                                                                  \
-        if (((ID)->block_id) >= (m_app_table[(ID)->module_id].base_id +                           \
-            (m_app_table[(ID)->module_id].block_count * MODULE_BLOCK_SIZE(ID))))                  \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies that the block size requested by the application can be supported by the module.
- */
-#define BLOCK_SIZE_CHECK(X)                                                                       \
-        if (((X) > PSTORAGE_MAX_BLOCK_SIZE) || ((X) < PSTORAGE_MIN_BLOCK_SIZE))                   \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies the block size requested by the application in registration API.
- */
-#define BLOCK_COUNT_CHECK(COUNT, SIZE)                                                            \
-        if (((COUNT) == 0) ||                                                                     \
-            ((m_next_page_addr + ((COUNT) *(SIZE)) > PSTORAGE_SWAP_ADDR)))                        \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }        
-
-/**@brief Verifies the size parameter provided by the application in API.
- */
-#define SIZE_CHECK(ID, SIZE)                                                                      \
-        if(((SIZE) == 0) || ((SIZE) > MODULE_BLOCK_SIZE(ID)))                                     \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies the offset parameter provided by the application in API.
- */
-#define OFFSET_CHECK(ID, OFFSET, SIZE)                                                            \
-        if(((SIZE) + (OFFSET)) > MODULE_BLOCK_SIZE(ID))                                           \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-#ifdef PSTORAGE_RAW_MODE_ENABLE
-
-/**@brief Verifies the module identifier supplied by the application.
- */
-#define MODULE_RAW_HANDLE_CHECK(ID)                                                               \
-        if ((((ID)->module_id) != RAW_MODE_APP_ID))                                               \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-#endif // PSTORAGE_RAW_MODE_ENABLE
-
-/**@} */
-
-
-/**@brief Verify module's initialization status.
- *
- * @details  Verify module's initialization status. Returns NRF_ERROR_INVALID_STATE when a
- *           module API is called without initializing the module.
- */
-#define VERIFY_MODULE_INITIALIZED()                                                               \
-        do                                                                                        \
-        {                                                                                         \
-            if (!(m_flags & MASK_MODULE_INITIALIZED))                                             \
-            {                                                                                     \
-                 return NRF_ERROR_INVALID_STATE;                                                  \
-            }                                                                                     \
-        } while(0)
-
-/**@brief Macro to fetch the block size registered for the module. */
-#define MODULE_BLOCK_SIZE(ID) (m_app_table[(ID)->module_id].block_size)
-
-/**@brief Main state machine of the component. */
-typedef enum
-{
-    STATE_IDLE,                                                        /**< State for being idle (no command execution in progress). */
-    STATE_STORE,                                                       /**< State for storing data when using store/update API. */
-    STATE_DATA_ERASE_WITH_SWAP,                                        /**< State for erasing the data page when using update/clear API when use of swap page is required. */
-    STATE_DATA_ERASE,                                                  /**< State for erasing the data page when using update/clear API without the need to use the swap page. */
-    STATE_ERROR                                                        /**< State entered when command processing is terminated abnormally. */
-} pstorage_state_t;  
-
-/**@brief Sub state machine contained by @ref STATE_DATA_ERASE_WITH_SWAP super state machine. */
-typedef enum
-{
-    STATE_ERASE_SWAP,                                                  /**< State for erasing the swap page when using the update/clear API. */   
-    STATE_WRITE_DATA_TO_SWAP,                                          /**< State for writing the data page into the swap page when using update/clear API. */
-    STATE_ERASE_DATA_PAGE,                                             /**< State for erasing data page when using update/clear API. */
-    STATE_RESTORE_TAIL,                                                /**< State for restoring tail (end) of backed up data from swap to data page when using update/clear API. */
-    STATE_RESTORE_HEAD,                                                /**< State for restoring head (beginning) of backed up data from swap to data page when using update/clear API. */
-    SWAP_SUB_STATE_MAX                                                 /**< Enumeration upper bound. */   
-} flash_swap_sub_state_t;
-
-/**@brief Application registration information.
- *
- * @details Defines application specific information that the application needs to maintain to be able 
- *          to process requests from each one of them.
- */
-typedef struct
-{
-    pstorage_ntf_cb_t cb;                                              /**< Callback registered with the module to be notified of result of flash access.  */
-    pstorage_block_t  base_id;                                         /**< Base block ID assigned to the module. */
-    pstorage_size_t   block_size;                                      /**< Size of block for the module. */
-    pstorage_size_t   block_count;                                     /**< Number of blocks requested by the application. */
-} pstorage_module_table_t;
-
-
-#ifdef PSTORAGE_RAW_MODE_ENABLE
-/**@brief Application registration information.
- *
- * @details Defines application specific information that the application registered for raw mode.
- */
-typedef struct
-{
-    pstorage_ntf_cb_t cb;                                              /**< Callback registered with the module to be notified of the result of flash access.  */
-} pstorage_raw_module_table_t;
-#endif // PSTORAGE_RAW_MODE_ENABLE
-
-
-/**@brief Defines command queue element.
- *
- * @details Defines command queue element. Each element encapsulates needed information to process
- *          a flash access command.
- */
-typedef struct
-{
-    uint8_t           op_code;                                         /**< Identifies the flash access operation being queued. Element is free if op-code is INVALID_OPCODE. */
-    pstorage_size_t   size;                                            /**< Identifies the size in bytes requested for the operation. */
-    pstorage_size_t   offset;                                          /**< Offset requested by the application for the access operation. */
-    pstorage_handle_t storage_addr;                                    /**< Address/Identifier for persistent memory. */
-    uint8_t *         p_data_addr;                                     /**< Address/Identifier for data memory. This is assumed to be resident memory. */
-} cmd_queue_element_t;
-
-
-/**@brief   Defines command queue, an element is free if the op_code field is not invalid.
- *
- * @details Defines commands enqueued for flash access. At any point in time, this queue has one or
- *          more flash access operations pending if the count field is not zero. When the queue is
- *          not empty, the rp (read pointer) field points to the flash access command in progress 
- *          or, if none is in progress, the command to be requested next. The queue implements a 
- *          simple first in first out algorithm. Data addresses are assumed to be resident.
- */
-typedef struct
-{
-    uint8_t             rp;                                            /**< Read pointer, pointing to flash access that is ongoing or to be requested next. */
-    uint8_t             count;                                         /**< Number of elements in the queue.  */
-    cmd_queue_element_t cmd[PSTORAGE_CMD_QUEUE_SIZE];                  /**< Array to maintain flash access operation details. */
-} cmd_queue_t;
-
-static cmd_queue_t             m_cmd_queue;                            /**< Flash operation request queue. */
-static pstorage_size_t         m_next_app_instance;                    /**< Points to the application module instance that can be allocated next. */
-static uint32_t                m_next_page_addr;                       /**< Points to the flash address that can be allocated to a module next. This is needed as blocks of a module that can span across flash pages. */
-static pstorage_state_t        m_state;                                /**< Main state tracking variable. */
-static flash_swap_sub_state_t  m_swap_sub_state;                       /**< Flash swap erase when swap used state tracking variable. */
-static uint32_t                m_head_word_size;                       /**< Head restore area size in words. */
-static uint32_t                m_tail_word_size;                       /**< Tail restore area size in words. */
-static uint32_t                m_current_page_id;                      /**< Variable for tracking the flash page being processed. */
-static uint32_t                m_num_of_command_retries;               /**< Variable for tracking flash operation retries upon flash operation failures. */
-static pstorage_module_table_t m_app_table[PSTORAGE_NUM_OF_PAGES];     /**< Registered application information table. */
-static uint32_t                m_num_of_bytes_written;                 /**< Variable for tracking the number of bytes written by the store operation. */
-static uint32_t                m_app_data_size;                        /**< Variable for storing the application command size parameter internally. */
-static uint32_t                m_flags = 0;                            /**< Storage for boolean flags for state tracking. */
-
-#ifdef PSTORAGE_RAW_MODE_ENABLE
-static pstorage_raw_module_table_t m_raw_app_table;                    /**< Registered application information table for raw mode. */
-#endif // PSTORAGE_RAW_MODE_ENABLE
-
-// Required forward declarations.
-static void cmd_process(void);
-static void store_operation_execute(void);
-static void app_notify(uint32_t result, cmd_queue_element_t * p_elem);
-static void cmd_queue_element_init(uint32_t index);
-static void cmd_queue_dequeue(void);
-static void sm_state_change(pstorage_state_t new_state);
-static void swap_sub_state_state_change(flash_swap_sub_state_t new_state); 
-
-/**@brief Function for consuming a command queue element.
- *
- * @details Function for consuming a command queue element, which has been fully processed.
- */
-static void command_queue_element_consume(void)
-{
-    // Initialize/free the element as it is now processed.    
-    cmd_queue_element_init(m_cmd_queue.rp);
-
-    // Adjust command queue state tracking variables.
-    --(m_cmd_queue.count);   
-    if (++(m_cmd_queue.rp) == PSTORAGE_CMD_QUEUE_SIZE)
-    {
-        m_cmd_queue.rp = 0;
-    }    
-}
-
-
-/**@brief Function for executing the finalization procedure for the command executed.
- *
- * @details Function for executing the finalization procedure for command executed, which includes 
- *          notifying the application of command completion, consuming the command queue element, 
- *          and changing the internal state.
- */
-static void command_end_procedure_run(void)
-{    
-    app_notify(NRF_SUCCESS, &m_cmd_queue.cmd[m_cmd_queue.rp]);
-    
-    command_queue_element_consume();
-    
-    sm_state_change(STATE_IDLE);
-}
-
-
-/**@brief Function for idle state entry actions.
- *
- * @details Function for idle state entry actions, which include resetting relevant state data and 
- *          scheduling any possible queued flash access operation.
- */
-static void state_idle_entry_run(void)
-{
-    m_num_of_command_retries = 0;
-    m_num_of_bytes_written   = 0;
-    
-    // Schedule any possible queued flash access operation.
-    cmd_queue_dequeue();
-}
-
-
-/**@brief Function for notifying an application of command completion and transitioning to an error 
- *        state.
- *
- * @param[in] result Result code of the operation for the application.
- */
-static void app_notify_error_state_transit(uint32_t result)
-{
-    app_notify(result, &m_cmd_queue.cmd[m_cmd_queue.rp]);
-    sm_state_change(STATE_ERROR);                
-}
-
-
-/**@brief Function for processing flash API error code.
- *
- * @param[in] err_code Error code from the flash API.
- */
-static void flash_api_err_code_process(uint32_t err_code)
-{
-    switch (err_code)
-    {
-        case NRF_SUCCESS:
-            break;
-            
-        case NRF_ERROR_BUSY:
-            // Flash access operation was not accepted and must be reissued upon flash operation 
-            // complete event.
-            m_flags |= MASK_FLASH_API_ERR_BUSY;        
-            break;
-            
-        default:
-            // Complete the operation with appropriate result code and transit to an error state. 
-            app_notify_error_state_transit(err_code);
-            break;
-    }
-}
-
-/**@brief Function for writing data to flash.
- *
- * @param[in] p_dst         Pointer to start of flash location to be written.
- * @param[in] p_src         Pointer to buffer with data to be written.
- * @param[in] size_in_words Number of 32-bit words to write. 
- */
-static void flash_write(uint32_t * const       p_dst, 
-                        uint32_t const * const p_src, 
-                        uint32_t               size_in_words)
-{
-    flash_api_err_code_process(sd_flash_write(p_dst, p_src, size_in_words));    
-}
-
-
-/**@brief Function for writing data to flash upon store command.
- *
- * @details Function for writing data to flash upon executing store command. Data is written to 
- *          flash in reverse order, meaning starting at the end. If the data that is to be written 
- *          is greater than the flash page size, it will be fragmented to fit the flash page size.
- */
-static void store_cmd_flash_write_execute(void)
-{
-    const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp];
-    
-    if (p_cmd->size > SOC_MAX_WRITE_SIZE)    
-    {
-        const uint32_t offset = p_cmd->size - PSTORAGE_FLASH_PAGE_SIZE;
-        flash_write((uint32_t *)(p_cmd->storage_addr.block_id + p_cmd->offset + offset),
-                    (uint32_t *)(p_cmd->p_data_addr + offset), 
-                    PSTORAGE_FLASH_PAGE_SIZE / sizeof(uint32_t));   
-
-        m_num_of_bytes_written = PSTORAGE_FLASH_PAGE_SIZE;    
-    }
-    else
-    {
-        flash_write((uint32_t *)(p_cmd->storage_addr.block_id + p_cmd->offset),
-                    (uint32_t *)(p_cmd->p_data_addr), 
-                    p_cmd->size / sizeof(uint32_t));   
-
-        m_num_of_bytes_written = p_cmd->size;        
-    }    
-}
-
-
-/**@brief Function for store state entry action.
- *
- * @details Function for store state entry action, which includes writing data to a flash page.
- */
-static void state_store_entry_run(void)
-{
-    store_cmd_flash_write_execute();    
-}
-
-
-/**@brief Function for data erase with swap state entry actions.
- *
- * @details Function for data erase with swap state entry actions. This includes adjusting relevant 
- *          state and data variables and transitioning to the correct sub state.
- */
-static void state_data_erase_swap_entry_run(void)
-{
-    m_flags &= ~MASK_TAIL_SWAP_DONE;
-    
-    const cmd_queue_element_t * p_cmd        = &m_cmd_queue.cmd[m_cmd_queue.rp];
-    const pstorage_block_t      cmd_block_id = p_cmd->storage_addr.block_id;
-    
-    const uint32_t clear_start_page_id = cmd_block_id / PSTORAGE_FLASH_PAGE_SIZE;
-    m_current_page_id                  = clear_start_page_id;      
-        
-    // @note: No need to include p_cmd->offset when calculating clear_end_page_id as:
-    // - clear API does not include offset parameter
-    // - update and store APIs are limited to operate on single block boundary thus the boolean 
-    // clause ((m_head_word_size == 0) && is_more_than_one_page) below in this function  will never 
-    // evaluate as true as if is_more_than_one_page == true m_head_word_size is always != 0        
-    const uint32_t clear_end_page_id  = (cmd_block_id + p_cmd->size - 1u) / 
-                                        PSTORAGE_FLASH_PAGE_SIZE;
-
-    if (clear_start_page_id == clear_end_page_id)
-    {
-        m_flags |= MASK_SINGLE_PAGE_OPERATION;
-    }
-    else
-    {
-        m_flags &= ~MASK_SINGLE_PAGE_OPERATION;
-    }
-                            
-    if ((m_head_word_size == 0) && !(m_flags & MASK_SINGLE_PAGE_OPERATION))
-    {        
-        // No head restore required and clear/update area is shared by multiple flash pages, which 
-        // means the current flash page does not have any tail area to restore. You can proceed with 
-        // data page erase directly as no swap is needed for the current flash page.
-        swap_sub_state_state_change(STATE_ERASE_DATA_PAGE);        
-    }
-    else
-    {     
-        swap_sub_state_state_change(STATE_ERASE_SWAP);
-    }               
-}
-
-
-/**@brief Function for erasing flash page.
- *
- * @param[in] page_number Page number of the page to be erased.
- */
-static void flash_page_erase(uint32_t page_number)
-{
-    flash_api_err_code_process(sd_flash_page_erase(page_number));
-}
-
-
-/**@brief Function for data erase state entry action.
- *
- * @details Function for data erase state entry action, which includes erasing the data flash page.
- */
-static void state_data_erase_entry_run(void)
-{
-    flash_page_erase(m_current_page_id);                          
-}
-
-
-/**@brief Function for dispatching the correct application main state entry action.
- */
-static void state_entry_action_run(void)
-{
-    switch (m_state)
-    {
-        case STATE_IDLE:
-            state_idle_entry_run();
-            break;
-
-        case STATE_STORE:
-            state_store_entry_run();
-            break;
-            
-        case STATE_DATA_ERASE_WITH_SWAP:
-            state_data_erase_swap_entry_run();
-            break;
-            
-        case STATE_DATA_ERASE:
-            state_data_erase_entry_run();        
-            break;
-                        
-        default:
-            // No action needed.
-            break;
-    }
-}
-
-
-/**@brief Function for changing application main state and dispatching state entry action.
- *
- * @param[in] new_state New application main state to transit to.
- */
-static void sm_state_change(pstorage_state_t new_state)
-{
-    m_state = new_state;
-    state_entry_action_run();
-}
-
-
-/**@brief Function for swap erase state entry action.
- *
- * @details Function for swap erase state entry action, which includes erasing swap flash 
- *          page.
- */
-static void state_swap_erase_entry_run(void)
-{
-    flash_page_erase(PSTORAGE_SWAP_ADDR / PSTORAGE_FLASH_PAGE_SIZE);                
-}
-
-
-/**@brief Function for write data to the swap state entry action.
- *
- * @details Function for write data to the swap state entry action, which includes writing the 
- *          current data page to the swap flash page.
- */
-static void state_write_data_swap_entry_run(void)
-{
-    // @note: There is room for further optimization here as there is only need to write the
-    // whole flash page to swap area if there is both head and tail area to be restored. In any 
-    // other case we can omit some data from the head or end of the page as that is the clear area.
-    flash_write((uint32_t *)(PSTORAGE_SWAP_ADDR), 
-                (uint32_t *)(m_current_page_id * PSTORAGE_FLASH_PAGE_SIZE), 
-                PSTORAGE_FLASH_PAGE_SIZE / sizeof(uint32_t));    
-}
-
-
-/**@brief Function for erase data page state entry action.
- *
- * @details Function for erase data page state entry action, which includes erasing the data flash 
- *          page.
- */
-static void state_erase_data_page_entry_run(void)
-{
-    flash_page_erase(m_current_page_id);
-}
-
-
-/**@brief Function for restore tail state entry action.
- *
- * @details Function for restore tail state entry action, which includes writing the tail section 
- *          back from swap to the data page.
- */
-static void state_restore_tail_entry_run(void)
-{
-    const cmd_queue_element_t * p_cmd        = &m_cmd_queue.cmd[m_cmd_queue.rp];    
-    const pstorage_block_t      cmd_block_id = p_cmd->storage_addr.block_id;                            
-    
-    const uint32_t tail_offset = (cmd_block_id + p_cmd->size + p_cmd->offset) % 
-                                 PSTORAGE_FLASH_PAGE_SIZE; 
-                                 
-    flash_write((uint32_t *)(cmd_block_id + p_cmd->size + p_cmd->offset),
-                (uint32_t *)(PSTORAGE_SWAP_ADDR + tail_offset),
-                m_tail_word_size);
-}
-
-
-/**@brief Function for restore head state entry action.
- *
- * @details Function for restore head state entry action, which includes writing the head section 
- *          back from swap to the data page.
- */
-static void state_restore_head_entry_run(void)
-{
-    flash_write((uint32_t *)((m_current_page_id - 1u) * PSTORAGE_FLASH_PAGE_SIZE),
-                (uint32_t *)PSTORAGE_SWAP_ADDR,
-                m_head_word_size);
-}
-
-
-/**@brief Function for dispatching the correct swap sub state entry action.
- */
-static void swap_sub_state_entry_action_run(void)
-{
-    static void (* const swap_sub_state_sm_lut[SWAP_SUB_STATE_MAX])(void) = 
-    {
-        state_swap_erase_entry_run,
-        state_write_data_swap_entry_run,
-        state_erase_data_page_entry_run,
-        state_restore_tail_entry_run,
-        state_restore_head_entry_run
-    };
-    
-    swap_sub_state_sm_lut[m_swap_sub_state]();
-}
-
-
-/**@brief Function for changing the swap sub state and dispatching state entry action.
- *
- * @param[in] new_state New swap sub state to transit to.
- */   
-static void swap_sub_state_state_change(flash_swap_sub_state_t new_state)
-{
-    m_swap_sub_state = new_state;
-    swap_sub_state_entry_action_run();    
-}
-
-
-/**@brief Function for initializing the command queue element.
- *
- * @param[in] index Index of the element to be initialized.
- */
-static void cmd_queue_element_init(uint32_t index)
-{
-    // Internal function and checks on range of index can be avoided.
-    m_cmd_queue.cmd[index].op_code                = INVALID_OPCODE;
-    m_cmd_queue.cmd[index].size                   = 0;
-    m_cmd_queue.cmd[index].storage_addr.module_id = PSTORAGE_NUM_OF_PAGES;
-    m_cmd_queue.cmd[index].storage_addr.block_id  = 0;
-    m_cmd_queue.cmd[index].p_data_addr            = NULL;
-    m_cmd_queue.cmd[index].offset                 = 0;
-}
-
-
-/**@brief Function for initializing the command queue.
- */
-static void cmd_queue_init(void)
-{
-    m_cmd_queue.rp    = 0;
-    m_cmd_queue.count = 0;
-
-    for (uint32_t cmd_index = 0; cmd_index < PSTORAGE_CMD_QUEUE_SIZE; ++cmd_index)
-    {
-        cmd_queue_element_init(cmd_index);
-    }
-}
-
-
-/**@brief Function for enqueuing, and possibly dispatching, a flash access operation.
- *
- * @param[in] opcode         Identifies the operation requested to be enqueued.
- * @param[in] p_storage_addr Identifies the module and flash address on which the operation is 
- *                           requested.
- * @param[in] p_data_addr    Identifies the data address for flash access.
- * @param[in] size           Size in bytes of data requested for the access operation.
- * @param[in] offset         Offset within the flash memory block at which operation is requested.
- *
- * @retval    NRF_SUCCESS      Upon success.
- * @retval    NRF_ERROR_NO_MEM Upon failure, when no space is available in the command queue. 
- */
-static uint32_t cmd_queue_enqueue(uint8_t             opcode,
-                                  pstorage_handle_t * p_storage_addr,
-                                  uint8_t           * p_data_addr,
-                                  pstorage_size_t     size,
-                                  pstorage_size_t     offset)
-{
-    uint32_t err_code;
-
-    if (m_cmd_queue.count != PSTORAGE_CMD_QUEUE_SIZE)
-    {
-        // Enqueue the command if it the queue is not full.
-        uint32_t write_index = m_cmd_queue.rp + m_cmd_queue.count;
-
-        if (write_index >= PSTORAGE_CMD_QUEUE_SIZE) 
-        {
-            write_index -= PSTORAGE_CMD_QUEUE_SIZE;
-        }
-
-        m_cmd_queue.cmd[write_index].op_code      = opcode;
-        m_cmd_queue.cmd[write_index].p_data_addr  = p_data_addr;
-        m_cmd_queue.cmd[write_index].storage_addr = (*p_storage_addr);
-        m_cmd_queue.cmd[write_index].size         = size;
-        m_cmd_queue.cmd[write_index].offset       = offset;
-               
-        m_cmd_queue.count++;
-                                
-        if (m_state == STATE_IDLE)
-        {
-            cmd_process(); 
-        }            
-        
-        err_code = NRF_SUCCESS;        
-    }
-    else
-    {
-        err_code = NRF_ERROR_NO_MEM;
-    }
-
-    return err_code;
-}
-
-
-/**@brief Function for dequeing a possible pending flash access operation.
- */
-static void cmd_queue_dequeue(void)
-{
-    if ((m_cmd_queue.count != 0)) 
-    {
-        cmd_process();
-    }
-}
-
-
-/**@brief Function for notifying an application of command completion.
- *
- * @param[in] result Result code of the operation for the application.
- * @param[in] p_elem Pointer to the command queue element for which this result was received. 
- */
-static void app_notify(uint32_t result, cmd_queue_element_t * p_elem)
-{
-    pstorage_ntf_cb_t ntf_cb;
-    const uint8_t     op_code = p_elem->op_code;
-
-#ifdef PSTORAGE_RAW_MODE_ENABLE
-    if (p_elem->storage_addr.module_id == RAW_MODE_APP_ID)
-    {
-        ntf_cb = m_raw_app_table.cb;
-    }
-    else
-#endif // PSTORAGE_RAW_MODE_ENABLE
-    {
-        ntf_cb = m_app_table[p_elem->storage_addr.module_id].cb;
-    }
-
-    ntf_cb(&p_elem->storage_addr, op_code, result, p_elem->p_data_addr, m_app_data_size);
-}
-
-
-/**@brief Function for evaluating if a data page swap is required for the tail section on the 
- *        current page.
- *
- * @retval true  If data page swap is required.
- * @retval false If data page swap is not required.
- */
-static bool is_tail_data_page_swap_required(void)
-{
-    bool ret_value;
-
-    // Extract id of the last page command is executed upon.
-    const cmd_queue_element_t * p_cmd        = &m_cmd_queue.cmd[m_cmd_queue.rp];
-    const pstorage_block_t      cmd_block_id = p_cmd->storage_addr.block_id;        
-    const uint32_t              last_page_id = (cmd_block_id + p_cmd->size + p_cmd->offset - 1u) / 
-                                               PSTORAGE_FLASH_PAGE_SIZE;    
-        
-    // If tail section area exists and the current page is the last page then tail data page swap is 
-    // required.    
-    if ((m_tail_word_size != 0) && (m_current_page_id == last_page_id))
-    {
-        ret_value = true;
-    }
-    else
-    {
-        ret_value = false;    
-    }
-    
-    return ret_value;
-}
-
-
-/**@brief Function for performing post processing for the update and clear commands.
- *
- * @details Function for performing post processing for the update and clear commands, which implies 
- *          executing the correct execution path depending on the command. 
- */
-static void clear_post_processing_run(void)
-{
-    const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; 
-    
-    if (p_cmd->op_code != PSTORAGE_UPDATE_OP_CODE)
-    {
-        command_end_procedure_run();    
-    }
-    else
-    {
-        store_operation_execute();                    
-    }
-}
-
-
-/**@brief Function for doing swap sub state exit action.
- */
-static void swap_sub_sm_exit_action_run(void)
-{
-    clear_post_processing_run();
-}
-
-
-/**@brief Function for evaluating if the page erase operation is required for the current page.
- *
- * @retval true  If page erase is required.
- * @retval false If page erase is not required. 
- */
-static bool is_page_erase_required(void)
-{
-    bool ret;
-    
-    const cmd_queue_element_t * p_cmd                      = &m_cmd_queue.cmd[m_cmd_queue.rp];
-    const pstorage_block_t      cmd_block_id               = p_cmd->storage_addr.block_id;        
-    const uint32_t              id_last_page_to_be_cleared = (cmd_block_id + p_cmd->size + 
-                                                             p_cmd->offset - 1u) / 
-                                                             PSTORAGE_FLASH_PAGE_SIZE;
-
-    // True if:
-    // - current page is not the last page OR
-    // - current page is the last page AND no tail exists
-    if ((m_current_page_id < id_last_page_to_be_cleared) ||
-        ((m_current_page_id == id_last_page_to_be_cleared) && (m_tail_word_size == 0)))         
-    {
-        ret = true;
-    }
-    else
-    {
-        ret = false;
-    }
-    
-    return ret;
-}
-
-
-/**@brief Function for reissuing the last flash operation request, which was rejected by the flash 
- *        API, in swap sub sate.
- */
-static void swap_sub_state_err_busy_process(void)
-{
-    // Reissue the request by doing a self transition to the current state.    
-    m_flags &= ~MASK_FLASH_API_ERR_BUSY;
-    swap_sub_state_state_change(m_swap_sub_state);        
-}
-
-
-/**@brief Function for doing restore head state action upon flash operation success event.
- *
- * @details Function for doing restore head state action upon flash operation success event, which 
- *          includes making a state transition depending on the current state.
- */
-static void head_restore_state_run(void)
-{
-    if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-    {            
-        if (is_tail_data_page_swap_required())
-        {
-            // Additional data page needs to be swapped for tail section as we are clearing a block, 
-            // which is shared between 2 flash pages.
-                    
-            // Adjust variables to ensure correct state transition path is taken after the tail 
-            // section swap has completed.
-            m_head_word_size = 0;   
-            m_flags         |= MASK_TAIL_SWAP_DONE;        
-                  
-            swap_sub_state_state_change(STATE_ERASE_SWAP);        
-        }
-        else if (is_page_erase_required())
-        {
-            // Additional page erase operation is required.
-                    
-            // Adjust variable to ensure correct state transition path is taken after the additional 
-            // page erase operation has completed.
-            m_head_word_size = 0;
-            swap_sub_state_state_change(STATE_ERASE_DATA_PAGE);        
-        }            
-        else if (m_tail_word_size != 0)
-        {
-            // Proceed with restoring tail from swap to data page. 
-            swap_sub_state_state_change(STATE_RESTORE_TAIL);
-        }
-        else
-        {            
-            // Swap statemachine execution end reached.
-            swap_sub_sm_exit_action_run();        
-        }
-    }
-    else
-    {
-        // As operation request was rejected by the flash API reissue the request.
-        swap_sub_state_err_busy_process();        
-    }
-}
-
-
-/**@brief Function for doing restore tail state action upon flash operation success event.
- */
-static void tail_restore_state_run(void)
-{
-    if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-    {
-        swap_sub_sm_exit_action_run();        
-    }
-    else
-    {
-        // As operation request was rejected by the flash API reissue the request.
-        swap_sub_state_err_busy_process();        
-    }    
-}
-
-
-/**@brief Function for doing data page erase state action upon a flash operation success event.
- *
- * @details Function for doing data page erase state action upon a flash operation success event, 
- *          which includes making a state transit to a new state depending on the current state.
- */
-static void data_page_erase_state_run(void)
-{            
-    if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-    {
-        ++m_current_page_id;   
-                    
-        if (m_head_word_size != 0)
-        {            
-            swap_sub_state_state_change(STATE_RESTORE_HEAD);
-        }
-        else if (is_page_erase_required())
-        {
-            // Additional page erase operation is required.    
-            swap_sub_state_state_change(STATE_ERASE_DATA_PAGE);                
-        }                
-        else if (m_tail_word_size != 0)
-        {                    
-            if (!(m_flags & MASK_TAIL_SWAP_DONE)) 
-            {
-                // Tail area restore is required and we have not yet written the relevant data page 
-                // to swap area. Start the process of writing the data page to swap.
-                m_flags |= MASK_TAIL_SWAP_DONE;            
-
-                swap_sub_state_state_change(STATE_ERASE_SWAP);            
-            }
-            else
-            {
-                // Tail area restore is required and we have already written the relevant data page 
-                // to swap area. Proceed by restoring the tail area.
-                swap_sub_state_state_change(STATE_RESTORE_TAIL);            
-            }
-        }            
-        else
-        {
-            swap_sub_sm_exit_action_run();        
-        }        
-    }
-    else
-    {
-        // As operation request was rejected by the flash API reissue the request.
-        swap_sub_state_err_busy_process();        
-    }
-}
-
-
-/**@brief Function for doing data to swap write state action upon flash operation success event.
- */
-static void data_to_swap_write_state_run(void)
-{        
-    if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-    {
-        // If the operation is executed only on 1 single flash page it automatically means that tail 
-        // area is written to the swap, which we store to flags.     
-        if (m_flags & MASK_SINGLE_PAGE_OPERATION)
-        {
-            m_flags |= MASK_TAIL_SWAP_DONE;        
-        }
-
-        swap_sub_state_state_change(STATE_ERASE_DATA_PAGE);    
-    }
-    else
-    {
-        // As operation request was rejected by the flash API reissue the request.
-        swap_sub_state_err_busy_process();        
-    }        
-}
-
-
-/**@brief Function for doing swap erase state action upon flash operation success event.
- */
-static void swap_erase_state_run(void)
-{
-    if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-    {        
-        swap_sub_state_state_change(STATE_WRITE_DATA_TO_SWAP);
-    }
-    else
-    {
-        // As operation request was rejected by the flash API reissue the request.
-        swap_sub_state_err_busy_process();        
-    }
-}
-
-
-/**@brief Function for dispatching the correct state action for data erase with a swap composite 
-*         state upon a flash operation success event.
- */
-static void swap_sub_state_sm_run(void)
-{  
-    static void (* const swap_sub_state_sm_lut[SWAP_SUB_STATE_MAX])(void) = 
-    {
-        swap_erase_state_run,
-        data_to_swap_write_state_run,
-        data_page_erase_state_run,
-        tail_restore_state_run,
-        head_restore_state_run
-    };
-    
-    swap_sub_state_sm_lut[m_swap_sub_state]();    
-}
-
-
-/**@brief Function for reissuing the last flash operation request, which was rejected by the flash 
- *        API, in main sate.
- */
-static void main_state_err_busy_process(void)
-{
-    // Reissue the request by doing a self transition to the current state.    
-    m_flags &= ~MASK_FLASH_API_ERR_BUSY;
-    sm_state_change(m_state);                    
-}
-
-
-/**@brief Function for doing erase state action upon flash operation success event.
- *
- * @details Function for doing erase state action upon flash operation success event, which includes 
- *          making a state transition depending on the current state.
- */
-static void erase_sub_state_sm_run(void)
-{
-    if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-    {        
-        // Clear operation request has succeeded.
-        ++m_current_page_id;                        
-                
-        if (!is_page_erase_required())
-        {
-            clear_post_processing_run();
-        }
-        else
-        {   
-            // All required flash pages have not yet been erased, issue erase by doing a self 
-            // transit. 
-            sm_state_change(m_state);        
-        }                              
-    }
-    else
-    {
-        // As operation request was rejected by the flash API reissue the request.
-        main_state_err_busy_process();
-    }
-}
-
-
-/**@brief Function for doing store state action upon flash operation success event.
- */
-static void store_sub_state_sm_run(void)
-{
-    if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-    {        
-        // As write operation request has succeeded, adjust the size tracking state information 
-        // accordingly.
-        cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp];    
-        p_cmd->size                -= m_num_of_bytes_written;
-
-        if (p_cmd->size == 0)
-        {
-            command_end_procedure_run();
-        }
-        else
-        {
-            store_cmd_flash_write_execute();
-        }
-    }
-    else
-    {
-        // As operation request was rejected by the flash API reissue the request.
-        main_state_err_busy_process();
-    }
-}
-
-
-/**@brief Function for doing action upon flash operation success event.
- */
-static void flash_operation_success_run(void)
-{    
-    switch (m_state)
-    {                   
-        case STATE_STORE:
-            store_sub_state_sm_run();
-            break;
-                        
-        case STATE_DATA_ERASE:
-            erase_sub_state_sm_run();
-            break;
-                        
-        case STATE_DATA_ERASE_WITH_SWAP:
-            swap_sub_state_sm_run();                        
-            break;                        
-            
-        default:
-            // No implementation needed.
-            break;
-    }                    
-}
-
-
-/**@brief Function for doing action upon flash operation failure event.
- *
- * @details Function for doing action upon flash operation failure event, which includes retrying 
- *          the last operation or if retry count has been reached completing the operation with 
- *          appropriate result code and transitioning to an error state.
- *
- * @note    The command is not removed from the command queue, which will result to stalling of the 
- *          command pipeline and the appropriate application recovery procedure for this is to reset 
- *          the system by issuing @ref pstorage_init which will also result to flushing of the 
- *          command queue.
- */
-static void flash_operation_failure_run(void)
-{   
-    if (++m_num_of_command_retries != SD_CMD_MAX_TRIES)
-    {
-        // Retry the last operation by doing a self transition to the current state.
-            
-        if (m_state != STATE_DATA_ERASE_WITH_SWAP)
-        {
-            sm_state_change(m_state);        
-        }
-        else
-        {
-            swap_sub_state_state_change(m_swap_sub_state);
-        }
-    }
-    else
-    {
-        // Complete the operation with appropriate result code and transit to an error state.     
-        app_notify_error_state_transit(NRF_ERROR_TIMEOUT);        
-    }   
-}
-
-
-/**@brief Function for handling flash access result events.
- *
- * @param[in] sys_evt System event to be handled.
- */
-void pstorage_sys_event_handler(uint32_t sys_evt)
-{  
-    if (m_state != STATE_IDLE && m_state != STATE_ERROR)
-    {        
-        switch (sys_evt)
-        {
-            case NRF_EVT_FLASH_OPERATION_SUCCESS:
-                flash_operation_success_run();
-                break;
-            
-            case NRF_EVT_FLASH_OPERATION_ERROR:            
-                if (!(m_flags & MASK_FLASH_API_ERR_BUSY))
-                {
-                    flash_operation_failure_run();
-                }
-                else
-                {
-                    // As our last flash operation request was rejected by the flash API reissue the 
-                    // request by doing same code execution path as for flash operation sucess 
-                    // event. This will promote code reuse in the implementation.                    
-                    flash_operation_success_run();
-                }                
-                break;
-                
-            default:
-                // No implementation needed.
-                break;
-        }
-
-    }
-}
-
-
-/**@brief Function for calculating the tail area size in number of 32-bit words.
- *
- * @param[in] cmd_end_of_storage_address End of storage area within the scope of the command.
- * @param[in] end_of_storage_address     End of allocated storage area for the application.
- */
-static void tail_word_size_calculate(pstorage_size_t cmd_end_of_storage_address, 
-                                     pstorage_size_t end_of_storage_address)
-{ 
-    // Two different cases to resolve when calculating correct size for restore tail section:
-    // 1) End of storage area and command end area are in the same page.
-    // 2) End of storage area and command end area are not in the same page.
-    
-    const uint32_t end_of_storage_area_page         = end_of_storage_address     / 
-                                                      PSTORAGE_FLASH_PAGE_SIZE;
-    const uint32_t command_end_of_storage_area_page = cmd_end_of_storage_address / 
-                                                      PSTORAGE_FLASH_PAGE_SIZE;
-
-    if (end_of_storage_area_page == command_end_of_storage_area_page)
-    {
-        //lint -e{573} suppress "Signed-unsigned mix with divide".
-        m_tail_word_size = (end_of_storage_address - cmd_end_of_storage_address) / sizeof(uint32_t);                                           
-    }
-    else
-    {
-        //lint -e{573} suppress "Signed-unsigned mix with divide".    
-        m_tail_word_size = (PSTORAGE_FLASH_PAGE_SIZE - 
-                           (cmd_end_of_storage_address % PSTORAGE_FLASH_PAGE_SIZE)) / 
-                           sizeof(uint32_t);               
-    }            
-}
-
-
-/**@brief Function for executing the clear operation.
- */
-static void clear_operation_execute(void)
-{    
-    const cmd_queue_element_t * p_cmd        = &m_cmd_queue.cmd[m_cmd_queue.rp];
-    const pstorage_block_t      cmd_block_id = p_cmd->storage_addr.block_id;
-
-    const pstorage_size_t  block_size    = m_app_table[p_cmd->storage_addr.module_id].block_size;
-    const pstorage_size_t  block_count   = m_app_table[p_cmd->storage_addr.module_id].block_count;
-    const pstorage_block_t block_base_id = m_app_table[p_cmd->storage_addr.module_id].base_id;  
-      
-    const bool is_start_address_page_aligned = (cmd_block_id % PSTORAGE_FLASH_PAGE_SIZE) == 0;
-    
-    // Calculate the end (1 beyond allocated area) for complete storage area and to the area only 
-    // within scope of this command.
-    const pstorage_block_t end_of_storage_address     = block_base_id + (block_size * block_count); 
-    const pstorage_block_t cmd_end_of_storage_address = cmd_block_id + p_cmd->size + p_cmd->offset;
-
-    // Zero tail to make sure no extra erase is done erroneously.
-    m_tail_word_size = 0;        
-        
-    // If the following is true no swap access is needed:
-    // - 1st logical test covers the case of: clear/update 1 complete single page.
-    // - 2nd logical test covers the case of: 
-    //   1) Clear/update last allocated page and page is not full (page can't be shared between 
-    //      multiple clients so the end of the page is unused area).
-    //   2) Clear/update all allocated storage.
-    if ((is_start_address_page_aligned && (p_cmd->size == PSTORAGE_FLASH_PAGE_SIZE)) ||
-        (is_start_address_page_aligned && (cmd_end_of_storage_address == end_of_storage_address) && 
-        (p_cmd->offset == 0)) || (p_cmd->storage_addr.module_id == RAW_MODE_APP_ID)) 
-    {
-        // Nothing to put to the swap and we can just erase the pages(s).         
-        
-        m_current_page_id = cmd_block_id / PSTORAGE_FLASH_PAGE_SIZE;
-        
-        sm_state_change(STATE_DATA_ERASE);                        
-    }
-    else
-    {
-        // Not all the blocks for the module can be cleared, we need to use swap page for storing 
-        // data temporarily.                        
-        
-        m_head_word_size = ((cmd_block_id + p_cmd->offset) % PSTORAGE_FLASH_PAGE_SIZE) / 
-                           sizeof(uint32_t);
-        
-        const bool is_cmd_end_address_page_aligned = ((cmd_end_of_storage_address % 
-                                                      PSTORAGE_FLASH_PAGE_SIZE) == 0);
-        if ((cmd_end_of_storage_address != end_of_storage_address) && 
-            !is_cmd_end_address_page_aligned)
-        {
-            // When command area is not equal to end of the storage allocation area and not ending 
-            // to page boundary there is a need to restore the tail area.
-            tail_word_size_calculate(cmd_end_of_storage_address, end_of_storage_address);
-        }
-
-        sm_state_change(STATE_DATA_ERASE_WITH_SWAP);         
-    }        
-}
-
-
-/**@brief Function for executing the store operation.
- */
-static void store_operation_execute(void)
-{    
-    sm_state_change(STATE_STORE);
-}
- 
-
-/**@brief Function for executing the update operation.
- */ 
-static void update_operation_execute(void)
-{
-    clear_operation_execute();
-}
-
-
-/**@brief Function for dispatching the flash access operation.
- */  
-static void cmd_process(void)
-{
-    const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp];
-    m_app_data_size                   = p_cmd->size;
-
-    switch (p_cmd->op_code)
-    {
-        case PSTORAGE_STORE_OP_CODE:                   
-            store_operation_execute();       
-            break;
-
-        case PSTORAGE_CLEAR_OP_CODE:
-            clear_operation_execute();
-            break;
-
-        case PSTORAGE_UPDATE_OP_CODE:
-            update_operation_execute();
-            break;
-
-        default:
-            // No action required.
-            break;
-    }
-}
-
-
-uint32_t pstorage_init(void)
-{
-    cmd_queue_init();
-
-    m_next_app_instance = 0;
-    m_next_page_addr    = PSTORAGE_DATA_START_ADDR;
-    m_current_page_id   = 0;
-    
-    for (uint32_t index = 0; index < PSTORAGE_NUM_OF_PAGES; index++)
-    {
-        m_app_table[index].cb           = NULL;
-        m_app_table[index].block_size   = 0;
-        m_app_table[index].block_count  = 0;
-    }
-
-#ifdef PSTORAGE_RAW_MODE_ENABLE
-    m_raw_app_table.cb           = NULL;
-#endif //PSTORAGE_RAW_MODE_ENABLE
-
-    m_state                     = STATE_IDLE;
-    m_num_of_command_retries    = 0;
-    m_flags                     = 0;
-    m_num_of_bytes_written      = 0;
-    m_flags                    |= MASK_MODULE_INITIALIZED;
-       
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_register(pstorage_module_param_t * p_module_param,
-                           pstorage_handle_t       * p_block_id)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_module_param);
-    NULL_PARAM_CHECK(p_block_id);
-    NULL_PARAM_CHECK(p_module_param->cb);
-    BLOCK_SIZE_CHECK(p_module_param->block_size);    
-    BLOCK_COUNT_CHECK(p_module_param->block_count, p_module_param->block_size);
-
-    if (!((p_module_param->block_size % sizeof(uint32_t)) == 0))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    
-    if (m_next_app_instance == PSTORAGE_NUM_OF_PAGES)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-    p_block_id->module_id = m_next_app_instance;
-    p_block_id->block_id  = m_next_page_addr;
-
-    m_app_table[m_next_app_instance].base_id     = p_block_id->block_id;
-    m_app_table[m_next_app_instance].cb          = p_module_param->cb;
-    m_app_table[m_next_app_instance].block_size  = p_module_param->block_size;
-    m_app_table[m_next_app_instance].block_count = p_module_param->block_count;
-
-    // Calculate number of flash pages allocated for the device and adjust next free page address.
-    /*lint -save -e666 */
-    const uint32_t page_count = CEIL_DIV((p_module_param->block_size * p_module_param->block_count), 
-                                         PSTORAGE_FLASH_PAGE_SIZE);
-    /*lint -restore */
-    m_next_page_addr         += page_count * PSTORAGE_FLASH_PAGE_SIZE;
-    
-    ++m_next_app_instance;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id,
-                                       pstorage_size_t     block_num,
-                                       pstorage_handle_t * p_block_id)
-{
-    pstorage_handle_t temp_id;
-
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_base_id);
-    NULL_PARAM_CHECK(p_block_id);
-    MODULE_ID_RANGE_CHECK(p_base_id);
-
-    temp_id           = (*p_base_id);
-    temp_id.block_id += (block_num * MODULE_BLOCK_SIZE(p_base_id));
-
-    BLOCK_ID_RANGE_CHECK(&temp_id);
-
-    (*p_block_id) = temp_id;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_store(pstorage_handle_t * p_dest,
-                        uint8_t           * p_src,
-                        pstorage_size_t     size,
-                        pstorage_size_t     offset)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_src);
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK(p_dest);
-    BLOCK_ID_RANGE_CHECK(p_dest);
-    SIZE_CHECK(p_dest, size);    
-    OFFSET_CHECK(p_dest, offset, size);
-    
-    if ((!is_word_aligned(p_src))                    || 
-        (!is_word_aligned((void *)(uint32_t)offset)) || 
-        (!is_word_aligned((uint32_t *)p_dest->block_id)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset);
-}
-
-
-uint32_t pstorage_update(pstorage_handle_t * p_dest,
-                         uint8_t           * p_src,
-                         pstorage_size_t     size,
-                         pstorage_size_t     offset)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_src);
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK(p_dest);
-    BLOCK_ID_RANGE_CHECK(p_dest);
-    SIZE_CHECK(p_dest, size);
-    OFFSET_CHECK(p_dest, offset, size);
-
-    if ((!is_word_aligned(p_src))                    || 
-        (!is_word_aligned((void *)(uint32_t)offset)) || 
-        (!is_word_aligned((uint32_t *)p_dest->block_id)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    return cmd_queue_enqueue(PSTORAGE_UPDATE_OP_CODE, p_dest, p_src, size, offset);
-}
-
-
-uint32_t pstorage_load(uint8_t           * p_dest,
-                       pstorage_handle_t * p_src,
-                       pstorage_size_t     size,
-                       pstorage_size_t     offset)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_src);
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK(p_src);
-    BLOCK_ID_RANGE_CHECK(p_src);
-    SIZE_CHECK(p_src, size);
-    OFFSET_CHECK(p_src, offset, size);
-
-    if ((!is_word_aligned(p_dest))                   || 
-        (!is_word_aligned((void *)(uint32_t)offset)) || 
-        (!is_word_aligned((uint32_t *)p_src->block_id)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    memcpy(p_dest, (((uint8_t *)p_src->block_id) + offset), size);
-
-    m_app_table[p_src->module_id].cb(p_src, PSTORAGE_LOAD_OP_CODE, NRF_SUCCESS, p_dest, size);
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK(p_dest);
-    BLOCK_ID_RANGE_CHECK(p_dest);
-
-    if ((!is_word_aligned((uint32_t *)p_dest->block_id)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    // Check is the area starting from block_id multiple of block_size.
-    if (
-        !(
-            ((p_dest->block_id - m_app_table[p_dest->module_id].base_id) %
-             m_app_table[p_dest->module_id].block_size) == 0
-            )
-        )
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    // Check is requested size multiple of registered block size or 0.
-    if (((size % m_app_table[p_dest->module_id].block_size) != 0) || (size == 0))    
-    {        
-        return NRF_ERROR_INVALID_PARAM;        
-    }
-
-    const uint32_t registered_allocation_size = m_app_table[p_dest->module_id].block_size * 
-                                                m_app_table[p_dest->module_id].block_count;
-    
-    const pstorage_block_t clear_request_end_address = p_dest->block_id + size;
-    const pstorage_block_t allocation_end_address    = m_app_table[p_dest->module_id].base_id + 
-                                                       registered_allocation_size;
-    // Check if request would lead to a buffer overrun.                                                       
-    if (clear_request_end_address > allocation_end_address)
-    {        
-        return NRF_ERROR_INVALID_PARAM;            
-    }
-    
-    return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL, size, 0);
-}
-
-
-uint32_t pstorage_access_status_get(uint32_t * p_count)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_count);
-
-    (*p_count) = m_cmd_queue.count;
-
-    return NRF_SUCCESS;
-}
-
-#ifdef PSTORAGE_RAW_MODE_ENABLE
-
-uint32_t pstorage_raw_register(pstorage_module_param_t * p_module_param,
-                               pstorage_handle_t       * p_block_id)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_module_param);
-    NULL_PARAM_CHECK(p_block_id);
-    NULL_PARAM_CHECK(p_module_param->cb);
-
-    if (m_raw_app_table.cb != NULL)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-    p_block_id->module_id = RAW_MODE_APP_ID;
-    m_raw_app_table.cb    = p_module_param->cb;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_raw_store(pstorage_handle_t * p_dest,
-                            uint8_t           * p_src,
-                            pstorage_size_t     size,
-                            pstorage_size_t     offset)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_src);
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_RAW_HANDLE_CHECK(p_dest);
-    
-    if (size == 0)
-    {
-        return NRF_ERROR_INVALID_PARAM;        
-    }
-    
-    // Verify word alignment.
-    if ((!is_word_aligned(p_src))                    || 
-        (!is_word_aligned((void *)(uint32_t)size))   ||     
-        (!is_word_aligned((void *)(uint32_t)offset)) || 
-        (!is_word_aligned((void *)(p_dest->block_id))))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-       
-    return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset);
-}
-
-
-uint32_t pstorage_raw_clear(pstorage_handle_t * p_dest, pstorage_size_t size)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_RAW_HANDLE_CHECK(p_dest);
-    
-    if ((!is_word_aligned((uint32_t *)p_dest->block_id)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }    
-
-    return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL, size, 0);
-}
-
-#endif // PSTORAGE_RAW_MODE_ENABLE


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h
deleted file mode 100644
index d379807..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h
+++ /dev/null
@@ -1,319 +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.
- *
- */
-#ifndef BLE_GATTC_EVT_APP_H__
-#define BLE_GATTC_EVT_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_gattc_evt_app GATTC Application event decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    GATTC Application event decoders.
- */
-#include "ble.h"
-
-/**
- * @brief Decodes ble_gattc_evt_char_disc_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_char_val_by_uuid_read_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf,
-                                                     uint32_t              packet_len,
-                                                     ble_evt_t * const     p_event,
-                                                     uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_char_vals_read_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              ble_evt_t * const     p_event,
-                                              uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_desc_disc_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_hvx event.
- *
- * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf,
-                               uint32_t              packet_len,
-                               ble_evt_t * const     p_event,
-                               uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_prim_srvc_disc_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              ble_evt_t * const     p_event,
-                                              uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_read_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    ble_evt_t * const     p_event,
-                                    uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_rel_disc_rsp_dec event.
- *
- * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        ble_evt_t * const     p_event,
-                                        uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_timeout event.
- *
- * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_write_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     ble_evt_t * const     p_event,
-                                     uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gattc_evt_attr_info_disc_rsp event.
- *
- * @sa @ref nrf51_gattc_evt_attr_info_disc_rsp_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gattc_evt_attr_info_disc_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              ble_evt_t * const     p_event,
-                                              uint32_t * const      p_event_len);
-
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c
deleted file mode 100644
index 7e1ad6b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c
+++ /dev/null
@@ -1,62 +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 "ble_gattc_evt_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gattc_struct_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gattc_evt_attr_info_disc_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              ble_evt_t * const     p_event,
-                                              uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint16_t conn_handle;
-    uint16_t gatt_status;
-    uint16_t error_handle;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &gatt_status);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &error_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint32_t temp_index = index;
-    err_code = ble_gattc_evt_attr_info_disc_rsp_t_dec(p_buf, packet_len, &temp_index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    uint32_t event_length = offsetof(ble_gattc_evt_t, params.attr_info_disc_rsp) + temp_index;
-
-    if (p_event != NULL)
-    {
-        SER_ASSERT(event_length <= *p_event_len, NRF_ERROR_DATA_SIZE);
-        p_event->evt.gattc_evt.conn_handle = conn_handle;
-        p_event->evt.gattc_evt.gatt_status = gatt_status;
-        p_event->evt.gattc_evt.error_handle = error_handle;
-
-        err_code = ble_gattc_evt_attr_info_disc_rsp_t_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.params.attr_info_disc_rsp);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-    }
-    *p_event_len = event_length;
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c
deleted file mode 100644
index 8ea82b2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c
+++ /dev/null
@@ -1,103 +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 "ble_gattc_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "nordic_common.h"
-
-
-uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(2 + 2 + 2 + 2, packet_len);
-
-    uint16_t tmp_conn_handle;
-    uint16_t tmp_gatt_status;
-    uint16_t tmp_error_handle;
-    uint16_t tmp_service_count;
-    uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle);
-    uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status);
-    uint16_dec(p_buf, packet_len, &index, &tmp_error_handle);
-    uint16_dec(p_buf, packet_len, &index, &tmp_service_count);
-
-
-    uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.char_disc_rsp) +
-                         sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_char_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id                            = BLE_GATTC_EVT_CHAR_DISC_RSP;
-    p_event->header.evt_len                           = event_len;
-    p_event->evt.gattc_evt.conn_handle                = tmp_conn_handle;
-    p_event->evt.gattc_evt.gatt_status                = tmp_gatt_status;
-    p_event->evt.gattc_evt.error_handle               = tmp_error_handle;
-    p_event->evt.gattc_evt.params.char_disc_rsp.count = tmp_service_count;
-
-    SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 9), packet_len);
-
-    for (uint16_t i = 0; i < tmp_service_count; i++)
-    {
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid);
-        uint8_dec(p_buf, packet_len, &index,
-                  &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type);
-
-        uint8_t characteristic_props;
-        uint8_dec(p_buf, packet_len, &index, &characteristic_props);
-
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.broadcast =
-            !!(characteristic_props & BIT_0);
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.read =
-            !!(characteristic_props & BIT_1);
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write_wo_resp =
-            !!(characteristic_props & BIT_2);
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write =
-            !!(characteristic_props & BIT_3);
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.notify =
-            !!(characteristic_props & BIT_4);
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.indicate =
-            !!(characteristic_props & BIT_5);
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.auth_signed_wr =
-            !!(characteristic_props & BIT_6);
-
-        uint8_t characteristic_ext_props;
-        uint8_dec(p_buf, packet_len, &index, &characteristic_ext_props);
-
-        p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_ext_props =
-            characteristic_ext_props & BIT_0;
-
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl);
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value);
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c
deleted file mode 100644
index 4c8d107..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c
+++ /dev/null
@@ -1,78 +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.
- *
- */
-
-#include "app_util.h"
-#include "ble.h"
-#include "ble_serialization.h"
-#include "ble_gattc_struct_serialization.h"
-#include "ble_gattc_evt_app.h"
-
-
-uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf,
-                                                     uint32_t              packet_len,
-                                                     ble_evt_t * const     p_event,
-                                                     uint32_t * const      p_event_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t index = 0;
-    uint32_t err_code;
-    uint16_t conn_handle;
-    uint16_t gatt_status;
-    uint16_t error_handle;
-
-    SER_ASSERT_LENGTH_LEQ(6, packet_len - index);
-
-    uint32_t in_event_len = *p_event_len;
-
-    *p_event_len = (offsetof(ble_evt_t, evt.gattc_evt.params)) - sizeof (ble_evt_hdr_t);
-
-    uint16_dec(p_buf, packet_len, &index, &conn_handle);
-    uint16_dec(p_buf, packet_len, &index, &gatt_status);
-    uint16_dec(p_buf, packet_len, &index, &error_handle);
-
-    void * p_data = NULL;
-
-    if (p_event)
-    {
-        SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len);
-
-        p_event->header.evt_id              = BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP;
-        p_event->evt.gattc_evt.conn_handle  = conn_handle;
-        p_event->evt.gattc_evt.gatt_status  = gatt_status;
-        p_event->evt.gattc_evt.error_handle = error_handle;
-
-        p_data = &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp;
-    }
-    else
-    {
-        p_data = NULL;
-    }
-
-    //call struct decoder with remaining size of event struct
-    uint32_t temp_event_len = in_event_len - *p_event_len;
-    err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(p_buf, packet_len, &index,
-                                                             &temp_event_len, p_data);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    //update event length with the amount processed by struct decoder
-    *p_event_len += temp_event_len;
-
-    if (p_event)
-    {
-        p_event->header.evt_len = *p_event_len;
-    }
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c
deleted file mode 100644
index 258bf23..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c
+++ /dev/null
@@ -1,66 +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.
- *
- */
-
-#include "ble_gattc_evt_app.h"
-#include "ble_gattc_struct_serialization.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-#define BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION 6
-
-
-uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              ble_evt_t * const     p_event,
-                                              uint32_t * const      p_event_len)
-{
-    uint32_t index     = 0;
-    uint32_t event_len = 0;
-
-    uint32_t error_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(10, packet_len);
-
-    event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.char_vals_read_rsp.values)) -
-                sizeof (ble_evt_hdr_t) +
-                uint16_decode(&p_buf[BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION]);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-    else
-    {
-        SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-        *p_event_len = event_len;
-    }
-
-    p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VALS_READ_RSP;
-
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle));
-
-    //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP
-    error_code =
-        ble_gattc_evt_char_vals_read_rsp_t_dec(p_buf, packet_len, &index,
-                                               &(p_event->evt.gattc_evt.params.char_vals_read_rsp));
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return error_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c
deleted file mode 100644
index 77af946..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Copyright (c) Nordic Semiconductor ASA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. This software must only be used in a processor manufactured by Nordic
- * Semiconductor ASA, or in a processor manufactured by a third party that
- * is used in combination with a processor manufactured by Nordic Semiconductor.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "ble_gattc_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len);
-
-    uint16_t tmp_conn_handle;
-    uint16_t tmp_gatt_status;
-    uint16_t tmp_error_handle;
-    uint16_t tmp_service_count;
-    uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle);
-    uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status);
-    uint16_dec(p_buf, packet_len, &index, &tmp_error_handle);
-    uint16_dec(p_buf, packet_len, &index, &tmp_service_count);
-
-    uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.desc_disc_rsp) +
-                         sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_desc_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id                            = BLE_GATTC_EVT_DESC_DISC_RSP;
-    p_event->header.evt_len                           = event_len;
-    p_event->evt.gattc_evt.conn_handle                = tmp_conn_handle;
-    p_event->evt.gattc_evt.gatt_status                = tmp_gatt_status;
-    p_event->evt.gattc_evt.error_handle               = tmp_error_handle;
-    p_event->evt.gattc_evt.params.desc_disc_rsp.count = tmp_service_count;
-
-    SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 5), packet_len);
-
-    for (uint16_t i = 0; i < tmp_service_count; i++)
-    {
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle);
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid);
-        uint8_dec(p_buf, packet_len, &index,
-                  &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type);
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c
deleted file mode 100644
index d8bdf19..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c
+++ /dev/null
@@ -1,65 +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 "ble_gattc_evt_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf,
-                               uint32_t              packet_len,
-                               ble_evt_t * const     p_event,
-                               uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint16_t tmp_attr_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(11, packet_len);
-
-    tmp_attr_len = uint16_decode(&(p_buf[9]));
-
-    uint32_t event_len = offsetof(ble_gattc_evt_t, params.hvx) +
-                         offsetof (ble_gattc_evt_hvx_t, data) + tmp_attr_len;
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTC_EVT_HVX;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.handle));
-    uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.type));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.len));
-
-    SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len);
-
-    if (tmp_attr_len > 0)
-    {
-        memcpy(&(p_event->evt.gattc_evt.params.hvx.data[0]), &(p_buf[index]), tmp_attr_len);
-        index += tmp_attr_len;
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c
deleted file mode 100644
index ab8c63e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c
+++ /dev/null
@@ -1,78 +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 "ble_gattc_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              ble_evt_t * const     p_event,
-                                              uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len);
-
-    uint16_t tmp_conn_handle;
-    uint16_t tmp_gatt_status;
-    uint16_t tmp_error_handle;
-    uint16_t tmp_service_count;
-    uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle);
-    uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status);
-    uint16_dec(p_buf, packet_len, &index, &tmp_error_handle);
-    uint16_dec(p_buf, packet_len, &index, &tmp_service_count);
-
-    uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.prim_srvc_disc_rsp) +
-                         sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_service_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id                                 = BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP;
-    p_event->header.evt_len                                = event_len;
-    p_event->evt.gattc_evt.conn_handle                     = tmp_conn_handle;
-    p_event->evt.gattc_evt.gatt_status                     = tmp_gatt_status;
-    p_event->evt.gattc_evt.error_handle                    = tmp_error_handle;
-    p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count = tmp_service_count;
-
-    SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 7), packet_len);
-
-    for (uint16_t i = 0; i < tmp_service_count; i++)
-    {
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid);
-        uint8_dec(p_buf, packet_len, &index,
-                  &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type);
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range.
-                   start_handle);
-        uint16_dec(p_buf, packet_len, &index,
-                   &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range.
-                   end_handle);
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c
deleted file mode 100644
index 2dc198c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c
+++ /dev/null
@@ -1,66 +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 "ble_gattc_evt_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    ble_evt_t * const     p_event,
-                                    uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint16_t tmp_attr_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(12, packet_len);
-
-    tmp_attr_len = uint16_decode(&(p_buf[10]));
-
-    uint32_t event_len = offsetof(ble_gattc_evt_t, params.read_rsp) +
-            offsetof(ble_gattc_evt_read_rsp_t, data) + tmp_attr_len;
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTC_EVT_READ_RSP;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.offset));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.len));
-
-    SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len);
-
-    if (tmp_attr_len > 0)
-    {
-        memcpy(&(p_event->evt.gattc_evt.params.read_rsp.data[0]), &(p_buf[index]), tmp_attr_len);
-        index += tmp_attr_len;
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c
deleted file mode 100644
index abfd611..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c
+++ /dev/null
@@ -1,65 +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.
- *
- */
-
-#include "ble_gattc_evt_app.h"
-#include "ble_gattc_struct_serialization.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-#define BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION 6
-
-
-uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        ble_evt_t * const     p_event,
-                                        uint32_t * const      p_event_len)
-{
-    uint32_t index         = 0;
-    uint32_t event_len     = 0;
-    uint16_t include_count = 0;
-
-    uint32_t error_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(8, packet_len);
-
-    include_count = uint16_decode(&p_buf[BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION]);
-    event_len     = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes)) -
-                    sizeof (ble_evt_hdr_t) + (include_count * sizeof (ble_gattc_include_t));
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id = BLE_GATTC_EVT_REL_DISC_RSP;
-    error_code             =
-        uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-    error_code =
-        ble_gattc_evt_rel_disc_rsp_t_dec(p_buf, packet_len, &index,
-                                         &(p_event->evt.gattc_evt.params.rel_disc_rsp));
-    SER_ASSERT(error_code == NRF_SUCCESS, error_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return error_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c
deleted file mode 100644
index 0194709..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (c) Nordic Semiconductor ASA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. This software must only be used in a processor manufactured by Nordic
- * Semiconductor ASA, or in a processor manufactured by a third party that
- * is used in combination with a processor manufactured by Nordic Semiconductor.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "ble_gattc_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t event_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len);
-
-    event_len = offsetof(ble_evt_t, evt.gattc_evt.params.timeout) +
-                sizeof (ble_gattc_evt_timeout_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTC_EVT_TIMEOUT;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.conn_handle);
-    uint8_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.params.timeout.src);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c
deleted file mode 100644
index 6605121..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c
+++ /dev/null
@@ -1,66 +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 "ble_gattc_evt_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     ble_evt_t * const     p_event,
-                                     uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(13, packet_len);
-
-    uint16_t tmp_attr_len = uint16_decode(&(p_buf[11]));
-
-    uint32_t event_len = offsetof(ble_gattc_evt_t, params.write_rsp) +
-                         offsetof(ble_gattc_evt_write_rsp_t, data) + tmp_attr_len;
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTC_EVT_WRITE_RSP;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.handle));
-    uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.write_op));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.offset));
-    uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.len));
-
-    SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len);
-
-    if (tmp_attr_len > 0)
-    {
-        memcpy(&(p_event->evt.gattc_evt.params.write_rsp.data[0]), &(p_buf[index]), tmp_attr_len);
-        index += tmp_attr_len;
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c
deleted file mode 100644
index 12a709e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c
+++ /dev/null
@@ -1,49 +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.
- *
- */
-
-#include "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gattc_hv_confirm_req_enc(uint16_t         conn_handle,
-                                      uint16_t         handle,
-                                      uint8_t * const  p_buf,
-                                      uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GATTC_HV_CONFIRM;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_HV_CONFIRM, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c
deleted file mode 100644
index c5d5a86..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c
+++ /dev/null
@@ -1,59 +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 "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t                 conn_handle,
-                                                     uint16_t                 start_handle,
-                                                     ble_uuid_t const * const p_srvc_uuid,
-                                                     uint8_t * const          p_buf,
-                                                     uint32_t *               p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 5, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-    index         += uint16_encode(start_handle, &p_buf[index]);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-
-    p_buf[index++] = (p_srvc_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_srvc_uuid != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
-
-        index         += uint16_encode(p_srvc_uuid->uuid, &p_buf[index]);
-        p_buf[index++] = p_srvc_uuid->type;
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf,
-                                                     uint32_t              packet_len,
-                                                     uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER,
-                               p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_read.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c
deleted file mode 100644
index c30d592..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c
+++ /dev/null
@@ -1,47 +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.
- *
- */
-
-#include "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_read_req_enc(uint16_t        conn_handle,
-                                uint16_t        handle,
-                                uint16_t        offset,
-                                uint8_t * const p_buf,
-                                uint32_t *      p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 7, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTC_READ;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-    index         += uint16_encode(handle, &p_buf[index]);
-    index         += uint16_encode(offset, &p_buf[index]);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf,
-                                uint32_t              packet_len,
-                                uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_READ, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c
deleted file mode 100644
index dbc5bdc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c
+++ /dev/null
@@ -1,57 +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 "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_relationships_discover_req_enc(
-    uint16_t                               conn_handle,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t *                             p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTC_RELATIONSHIPS_DISCOVER;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-    p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_handle_range != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len);
-
-        index += uint16_encode(p_handle_range->start_handle, &p_buf[index]);
-        index += uint16_encode(p_handle_range->end_handle, &p_buf[index]);
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf,
-                                                  uint32_t              packet_len,
-                                                  uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_RELATIONSHIPS_DISCOVER,
-                               p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_write.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c
deleted file mode 100644
index d192c24..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c
+++ /dev/null
@@ -1,68 +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 "ble_gattc_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gattc_write_req_enc(uint16_t                               conn_handle,
-                                 ble_gattc_write_params_t const * const p_write_params,
-                                 uint8_t * const                        p_buf,
-                                 uint32_t *                             p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTC_WRITE;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-    p_buf[index++] = (p_write_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    if (p_write_params != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 9, *p_buf_len);
-        p_buf[index++] = p_write_params->write_op;
-        p_buf[index++] = p_write_params->flags;
-        index         += uint16_encode(p_write_params->handle, &p_buf[index]);
-        index         += uint16_encode(p_write_params->offset, &p_buf[index]);
-        index         += uint16_encode(p_write_params->len, &p_buf[index]);
-
-        SER_ERROR_CHECK(p_write_params->len <= BLE_GATTC_WRITE_P_VALUE_LEN_MAX,
-                        NRF_ERROR_INVALID_PARAM);
-
-        p_buf[index++] = (p_write_params->p_value == NULL) ?
-                         SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-        if (p_write_params->p_value != NULL)
-        {
-            SER_ASSERT_LENGTH_LEQ(index + p_write_params->len, *p_buf_len);
-            memcpy(&p_buf[index], p_write_params->p_value, p_write_params->len);
-            index += p_write_params->len;
-        }
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_WRITE, p_result_code);
-}


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

Posted by cc...@apache.org.
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/low_power_pwm/low_power_pwm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/low_power_pwm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/low_power_pwm.h
deleted file mode 100644
index f8175bb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/low_power_pwm.h
+++ /dev/null
@@ -1,176 +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
- *
- * @defgroup low_power_pwm Low-power PWM
- * @{
- * @ingroup app_common
- *
- * @brief Module for generating a low-power pulse-width modulated output signal.
- *
- * This module provides a low-power PWM implementation using app_timers and GPIO.
- *
- * Each low-power PWM instance utilizes one app_timer. This means it runs on RTC 
- * and does not require HFCLK to be running. There can be any number of output 
- * channels per instance.
- */
-
-#ifndef LOW_POWER_PWM_H__
-#define LOW_POWER_PWM_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "app_timer.h"
-#include "nrf_drv_common.h"
-#include "sdk_errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Event types.
- */
-typedef enum
-{
-    LOW_POWER_PWM_EVENT_PERIOD = 0, 
-    LOW_POWER_PWM_EVENT_DUTY_CYCLE
-}low_power_pwm_evt_type_t;
-
-/**@brief Application time-out handler type. */
-typedef void (*low_power_pwm_timeout_user)(void * p_context, low_power_pwm_evt_type_t evt_type);
-
-/**
- * @brief Structure holding the initialization parameters.
- */
-typedef struct
-{
-    bool                    active_high;        /**< Activate negative polarity. */
-    uint8_t                 period;             /**< Width of the low_power_pwm period. */
-    uint32_t                bit_mask;           /**< Pins to be initialized. */
-    app_timer_id_t const *  p_timer_id;         /**< Pointer to the timer ID of low_power_pwm. */
-} low_power_pwm_config_t;
-
-
-/**
- * @name Default settings
- * @{
- *
- * @brief Default parameters for the @ref low_power_pwm_config_t structure.
- *
- */
-#define LOW_POWER_PWM_CONFIG_ACTIVE_HIGH        false
-#define LOW_POWER_PWM_CONFIG_PERIOD             UINT8_MAX
-#define LOW_POWER_PWM_CONFIG_BIT_MASK(mask)     (mask)
-/** @} */
-
-/**
- * @brief Low-power PWM default configuration.
- */
-#define LOW_POWER_PWM_DEFAULT_CONFIG(mask)                  \
-{                                                           \
-    .active_high    = LOW_POWER_PWM_CONFIG_ACTIVE_HIGH ,    \
-    .period         = LOW_POWER_PWM_CONFIG_PERIOD   ,       \
-    .bit_mask       = LOW_POWER_PWM_CONFIG_BIT_MASK(mask)   \
-}
-/** 
- * @cond (NODOX)
- * @defgroup low_power_pwm_internal Auxiliary internal types declarations
- * @brief Module for internal usage inside the library only.
- * @details These definitions are available to the user, but they should not 
- * be accessed directly. Use @ref low_power_pwm_duty_set instead.
- * @{
- *
- */
-
-    /**
-     * @brief Structure holding parameters of a given low-power PWM instance.
-     */
-    struct low_power_pwm_s
-    {
-        bool                        active_high;        /**< Activate negative polarity. */
-        bool                        led_is_on;          /**< Indicates the current state of the LED. */
-        uint8_t                     period;             /**< Width of the low_power_pwm period. */
-        uint8_t                     duty_cycle;         /**< Width of high pulse. */
-        nrf_drv_state_t             pwm_state;          /**< Indicates the current state of the PWM instance. */
-        uint32_t                    bit_mask;           /**< Pins to be initialized. */
-        uint32_t                    bit_mask_toggle;    /**< Pins to be toggled. */
-        uint32_t                    timeout_ticks;      /**< Value to start the next app_timer. */
-        low_power_pwm_evt_type_t    evt_type;           /**< Slope that triggered time-out. */
-        app_timer_timeout_handler_t handler;            /**< User handler to be called in the time-out handler. */
-        app_timer_id_t const *      p_timer_id;         /**< Pointer to the timer ID of low_power_pwm. */
-    };
-
-/** @} 
- * @endcond
- */
-
-/**
- * @brief Internal structure holding parameters of a low-power PWM instance.
- */
-typedef struct low_power_pwm_s low_power_pwm_t;
-
-    
-/**
- * @brief   Function for initializing a low-power PWM instance.
- *
- * @param[in] p_pwm_instance            Pointer to the instance to be started.
- * @param[in] p_pwm_config              Pointer to the configuration structure.
- * @param[in] handler                   User function to be called in case of time-out.
- *
- * @return Values returned by @ref app_timer_create.
- */
-ret_code_t low_power_pwm_init(low_power_pwm_t * p_pwm_instance, low_power_pwm_config_t const * p_pwm_config, app_timer_timeout_handler_t handler);
-    
-    
-/**
- * @brief   Function for starting a low-power PWM instance.
- *
- * @param[in] p_pwm_instance            Pointer to the instance to be started.
- * @param[in] leds_pin_bit_mask         Bit mask of pins to be started.
- *
- * @return Values returned by @ref app_timer_start.
- */
-ret_code_t low_power_pwm_start(low_power_pwm_t * p_pwm_instance,
-                             uint32_t          leds_pin_bit_mask);
-
-/**
- * @brief   Function for stopping a low-power PWM instance.
- *
- * @param[in] p_pwm_instance            Pointer to the instance to be stopped.
- *
- * @return Values returned by @ref app_timer_stop.
- */
-ret_code_t low_power_pwm_stop(low_power_pwm_t * p_pwm_instance);
-
-
-/**
- * @brief   Function for setting a new high pulse width for a given instance.
- *
- * This function can be called from the timer handler.
- *
- * @param[in] p_pwm_instance            Pointer to the instance to be changed.
- * @param[in] duty_cycle                New high pulse width. 0 means that the LED is always off. 255 means that it is always on.
- *
- * @retval NRF_SUCCESS                  If the function completed successfully.
- * @retval NRF_ERROR_INVALID_PARAM      If the function returned an error because of invalid parameters.
- */
-ret_code_t low_power_pwm_duty_set(low_power_pwm_t * p_pwm_instance, uint8_t duty_cycle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // LOW_POWER_PWM_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/mailbox/app_mailbox.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox.c
deleted file mode 100644
index b4f3b43..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox.c
+++ /dev/null
@@ -1,152 +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 <stddef.h>
-#include <string.h>
-#include "app_mailbox.h"
-#include "nrf_error.h"
-#include "app_util_platform.h"
-#include "app_util.h"
-#include "nrf_assert.h"
-
-ret_code_t app_mailbox_create(const app_mailbox_t * queue_def)
-{
-    queue_def->p_cb->r_idx    = 0;
-    queue_def->p_cb->w_idx    = 0;
-    queue_def->p_cb->len      = 0;
-    queue_def->p_cb->mode     = APP_MAILBOX_MODE_NO_OVERFLOW;
-
-    return NRF_SUCCESS;
-}
-
-static __INLINE void dequeue(app_mailbox_cb_t * p_cb, uint8_t queue_sz)
-{
-    uint8_t  r_idx = p_cb->r_idx + 1;
-    p_cb->len--;
-
-    //Handle index wrapping.
-    p_cb->r_idx = (r_idx == queue_sz) ? 0 : r_idx;
-}
-
-static __INLINE void enqueue(app_mailbox_cb_t * p_cb, uint8_t queue_sz)
-{
-    uint8_t  w_idx = p_cb->w_idx + 1;
-    p_cb->len++;
-
-    //Handle index wrapping.
-    p_cb->w_idx = (w_idx == queue_sz) ? 0 : w_idx;
-}
-
-ret_code_t app_mailbox_put(const app_mailbox_t * p_mailbox, void * p_item)
-{
-    ASSERT(p_mailbox);
-    return app_mailbox_sized_put(p_mailbox, p_item, p_mailbox->item_sz);
-}
-
-ret_code_t app_mailbox_sized_put(const app_mailbox_t * p_mailbox, void * p_item, uint16_t size)
-{
-    ASSERT((uint32_t)p_item>0);
-    ASSERT(p_mailbox);
-    uint32_t           err_code  = NRF_ERROR_INTERNAL;
-    uint32_t *         p_dst     = p_mailbox->p_pool;
-    bool               do_put    = true;
-    uint8_t            queue_sz  = p_mailbox->queue_sz;
-    uint16_t           item_sz   = p_mailbox->item_sz;
-    app_mailbox_cb_t * p_cb      = p_mailbox->p_cb;
-
-    CRITICAL_REGION_ENTER();
-
-    if (p_cb->len == queue_sz)
-    {
-        if (p_cb->mode == APP_MAILBOX_MODE_NO_OVERFLOW)
-        {
-            do_put = false;
-        }
-        else
-        {
-            // Remove the oldest element.
-            dequeue(p_cb, queue_sz);
-        }
-        err_code = NRF_ERROR_NO_MEM;
-    }
-    else
-    {
-        err_code = NRF_SUCCESS;
-    }
-
-    if (do_put)
-    {
-        p_dst = (uint32_t *)((uint32_t)p_dst + (p_cb->w_idx * (item_sz + sizeof(uint32_t))));
-        enqueue(p_cb, queue_sz);
-
-        //Put data in mailbox.
-        *p_dst = (uint32_t)size;
-        p_dst++;
-        memcpy(p_dst, p_item, size);
-    }
-
-    CRITICAL_REGION_EXIT();
-
-    return err_code;
-}
-
-ret_code_t app_mailbox_get(const app_mailbox_t * p_mailbox, void * p_item)
-{
-    uint16_t size;
-    return app_mailbox_sized_get(p_mailbox, p_item, &size);
-}
-
-ret_code_t app_mailbox_sized_get(const app_mailbox_t * p_mailbox, void * p_item, uint16_t * p_size)
-{
-    ASSERT(p_mailbox);
-    ASSERT((uint32_t)p_item>0);
-    uint32_t *         p_src     = p_mailbox->p_pool;
-    ret_code_t         err_code  = NRF_SUCCESS;
-    uint16_t           item_sz   = p_mailbox->item_sz;
-    uint8_t            queue_sz  = p_mailbox->queue_sz;
-    app_mailbox_cb_t * p_cb      = p_mailbox->p_cb;
-
-    CRITICAL_REGION_ENTER();
-
-    if (p_cb->len == 0)
-    {
-        err_code = NRF_ERROR_NO_MEM;
-    }
-    else
-    {
-        p_src = (void *)((uint32_t)p_src + (p_cb->r_idx * (item_sz + sizeof(uint32_t))));
-        dequeue(p_cb, queue_sz);
-    }
-
-    if (err_code == NRF_SUCCESS)
-    {
-        uint16_t size = (uint16_t)*p_src;
-        *p_size = size;
-        p_src++;
-        memcpy(p_item, p_src, size);
-    }
-
-    CRITICAL_REGION_EXIT();
-
-    return err_code;
-}
-
-uint32_t app_mailbox_length_get (const app_mailbox_t * p_mailbox)
-{
-    ASSERT(p_mailbox);
-    return p_mailbox->p_cb->len;
-}
-
-void app_mailbox_mode_set(const app_mailbox_t * p_mailbox, app_mailbox_overflow_mode_t mode)
-{
-    ASSERT(p_mailbox);
-    p_mailbox->p_cb->mode = mode;
-}

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/mailbox/app_mailbox.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox.h
deleted file mode 100644
index e663af4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox.h
+++ /dev/null
@@ -1,151 +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
- *
- * @defgroup app_mailbox Mailbox library
- * @{
- * @ingroup app_common
- *
- * @brief Mailbox for safely queuing items.
- *
- */
-
-#ifndef _APP_MAILBOX_H
-#define _APP_MAILBOX_H
-
-#include <stdint.h>
-#include "sdk_errors.h"
-#include "app_util.h"
-#include "nordic_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Supported overflow modes.
- */
-typedef enum
-{
-    APP_MAILBOX_MODE_NO_OVERFLOW, //!< If the mailbox is full, @ref app_mailbox_put does not add a new element.
-    APP_MAILBOX_MODE_OVERFLOW     //!< If the mailbox is full, the oldest element is lost and a new one is added.
-} app_mailbox_overflow_mode_t;
-
-#include "app_mailbox_local.h"
-
-/**
- * @brief Mailbox definition structure.
- */
-typedef struct
-{
-  void                      * p_pool;    /**< Memory array for mail. */
-  app_mailbox_cb_t          * p_cb;      /**< Mailbox handle. */
-  uint16_t                    item_sz;  /**< Size of a single item. */
-  uint8_t                     queue_sz; /**< Capacity of the queue. */
-} app_mailbox_t;
-
-/**
- * @brief Macro to statically allocate memory for a given mailbox queue.
- */
-#define APP_MAILBOX_DEF(name, QUEUE_SZ, ITEM_SZ)                                            \
-static uint32_t         STRING_CONCATENATE(mailbox_items_,name)[(1+CEIL_DIV((ITEM_SZ),4))*(QUEUE_SZ)];\
-static app_mailbox_cb_t STRING_CONCATENATE(mailbox_cb_,name);                                         \
-const app_mailbox_t name =                                                                  \
-    {                                                                                       \
-        .p_pool   = STRING_CONCATENATE(mailbox_items_,name),                                          \
-        .p_cb     = STRING_CONCATENATE(&mailbox_cb_,name),                                            \
-        .queue_sz = (uint8_t)(QUEUE_SZ),                                                    \
-        .item_sz  = (uint16_t)(ITEM_SZ),                                                    \
-    }
-
-/**
- * @brief Function for creating a mailbox queue.
- *
- * This function creates and initializes a mailbox queue.
- *
- * @param[in]  p_mailbox  Pointer to the mailbox.
- *
- * @retval NRF_SUCCESS              If the queue was successfully created.
- */
-ret_code_t app_mailbox_create(const app_mailbox_t * p_mailbox);
-
-/**
- * @brief Function for putting an item in the mailbox queue.
- *
- * @param[in] p_mailbox   Pointer to the mailbox.
- * @param[in] p_item      Pointer to the item to be queued.
- *
- * @retval NRF_SUCCESS              If the item was enqueued.
- * @retval NRF_ERROR_NO_MEM         If the queue is full.
- */
-ret_code_t app_mailbox_put (const app_mailbox_t * p_mailbox, void * p_item);
-
-/**
- * @brief Function for putting an item with a specified size in the mailbox queue.
- *
- * @param[in] p_mailbox   Pointer to the mailbox.
- * @param[in] p_item      Pointer to the item to be queued.
- * @param[in] size        Size of the item.
- *
- * @retval NRF_SUCCESS              If the item was enqueued.
- * @retval NRF_ERROR_NO_MEM         If the queue is full.
- */
-ret_code_t app_mailbox_sized_put (const app_mailbox_t * p_mailbox, void * p_item, uint16_t size);
-
-/**
- * @brief Function for getting an item from the mailbox queue.
- *
- * @param[in]  p_mailbox   Pointer to the mailbox.
- * @param[out] p_item      Pointer to the output location for the dequeued item.
- *
- * @retval NRF_SUCCESS              If the item was retrieved successfully.
- * @retval NRF_ERROR_NO_MEM         If the queue is empty.
- */
-ret_code_t app_mailbox_get (const app_mailbox_t * p_mailbox, void * p_item);
-
-/**
- * @brief Function for getting an item and its size from the mailbox queue.
- *
- * @param[in]  p_mailbox   Pointer to the mailbox.
- * @param[out] p_item      Pointer to the output location for the dequeued item.
- * @param[out] p_size      Pointer to the item size.
- *
- * @retval NRF_SUCCESS              If the item was retrieved successfully.
- * @retval NRF_ERROR_NO_MEM         If the queue is empty.
- */
-ret_code_t app_mailbox_sized_get (const app_mailbox_t * p_mailbox, void * p_item, uint16_t * p_size);
-
-/**
- * @brief Function for getting the current length of the mailbox queue.
- *
- * @param[in]  p_mailbox   Pointer to the mailbox.
- *
- * @return Current number of elements in the queue.
- *
- */
-uint32_t app_mailbox_length_get (const app_mailbox_t * p_mailbox);
-
-/**
- * @brief Function for changing the mode of overflow handling.
- *
- * @param[in]  p_mailbox   Pointer to the mailbox.
- * @param mode             New mode to set.
- */
-void app_mailbox_mode_set(const app_mailbox_t * p_mailbox, app_mailbox_overflow_mode_t mode);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_APP_MAILBOX_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/mailbox/app_mailbox_local.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox_local.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox_local.h
deleted file mode 100644
index f59f70b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mailbox/app_mailbox_local.h
+++ /dev/null
@@ -1,41 +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.
- *
- */
-
-/**
- * @cond (NODOX)
- * @defgroup app_mailbox_internal Auxiliary internal types declarations
- * @{
- * @ingroup app_mailbox
- * @internal
- *
- * @brief Module for internal usage inside the library only
- *
- * Some definitions must be included in the header file because
- * of the way the library is set up. In this way, the are accessible to the user.
- * However, any functions and variables defined here may change at any time
- * without a warning, so you should not access them directly.
- */
-     /**
-     * @brief Mailbox handle used for managing a mailbox queue.
-     */
-    typedef struct
-    {
-        uint8_t                      r_idx;    /**< Read index for the mailbox queue. */
-        uint8_t                      w_idx;    /**< Write index for the mailbox queue. */
-        uint8_t                      len;      /**< Number of elements currently in the mailbox queue. */
-        app_mailbox_overflow_mode_t  mode;     /**< Mode of overflow handling. */
-    } app_mailbox_cb_t;
-
-
-/** @} 
- * @endcond
- */

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/mem_manager/mem_manager.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mem_manager/mem_manager.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mem_manager/mem_manager.c
deleted file mode 100644
index 161c78a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mem_manager/mem_manager.c
+++ /dev/null
@@ -1,925 +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.
- *
- */
-#include "sdk_config.h"
-#include "sdk_common.h"
-#include "mem_manager.h"
-#include "app_trace.h"
-#include "nrf_assert.h"
-
-/**
- * @defgroup mem_manager_log Module's Log Macros
- *
- * @details Macros used for creating module logs which can be useful in understanding handling
- *          of events or actions on API requests. These are intended for debugging purposes and
- *          can be enabled by defining the MEM_MANAGER_ENABLE_LOGS.
- *
- * @note If ENABLE_DEBUG_LOG_SUPPORT is disabled, having MEM_MANAGER_ENABLE_LOGS has no effect.
- * @{
- */
-#if (MEM_MANAGER_ENABLE_LOGS == 1)
-
-#define MM_LOG  app_trace_log                                                                       /**< Used for logging details. */
-#define MM_ERR  app_trace_log                                                                       /**< Used for logging errors in the module. */
-#define MM_TRC  app_trace_log                                                                       /**< Used for getting trace of execution in the module. */
-#define MM_DUMP app_trace_dump                                                                      /**< Used for dumping octet information. */
-
-#else //MEM_MANAGER_ENABLE_LOGS
-
-#define MM_DUMP(...)                                                                                /**< Disables dumping of octet streams. */
-#define MM_LOG(...)                                                                                 /**< Disables detailed logs. */
-#define MM_ERR(...)                                                                                 /**< Disables error logs. */
-#define MM_TRC(...)                                                                                 /**< Disables traces. */
-
-#endif //MEM_MANAGER_ENABLE_LOGS
-/** @} */
-
-#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-#if (MEM_MANAGER_DIAGNOSTICS_LOGS_ONLY == 1)
-#define MMD_LOG  app_trace_log                                                                       /**< Used for logging diagnostic details. */
-#else
-#define MMD_LOG MM_LOG                                                                               /**< Diagnostoc logs same as other module logs, and depend on definition of MEM_MANAGER_ENABLE_LOGS */
-#endif //MEM_MANAGER_DIAGNOSTICS_LOGS_ONLY
-#endif //MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-/**
- * @defgroup memory_manager_mutex_lock_unlock Module's Mutex Lock/Unlock Macros.
- *
- * @details Macros used to lock and unlock modules. Currently the SDK does not use mutexes but
- *          framework is provided in case need arises to use an alternative architecture.
- * @{
- */
-#define MM_MUTEX_LOCK()   SDK_MUTEX_LOCK(m_mm_mutex)                                                /**< Lock module using mutex. */
-#define MM_MUTEX_UNLOCK() SDK_MUTEX_UNLOCK(m_mm_mutex)                                              /**< Unlock module using mutex. */
-/** @} */
-
-#undef NULL_PARAM_CHECK
-#undef NULL_PARAM_CHECK_VOID
-#undef VERIFY_MODULE_INITIALIZED
-#undef VERIFY_MODULE_INITIALIZED_VOID
-#undef VERIFY_REQUESTED_SIZE
-#undef VERIFY_REQUESTED_SIZE_VOID
-
-#if (MEM_MANAGER_DISABLE_API_PARAM_CHECK == 0)
-
-/**
- * @brief Macro for verifying NULL parameters.
- *        Returning with an appropriate error code on failure.
- *
- * @param[in] PARAM Parameter checked for NULL.
- *
- * @retval (NRF_ERROR_NULL | MEMORY_MANAGER_ERR_BASE) when @ref PARAM is NULL.
- */
-#define NULL_PARAM_CHECK(PARAM)                            \
-    if ((PARAM) == NULL)                                   \
-    {                                                      \
-        return (NRF_ERROR_NULL | MEMORY_MANAGER_ERR_BASE); \
-    }
-
-/**
- * @brief Macro for verifying NULL parameters are not passed to API and returning on failure.
- *
- * @param[in] PARAM Parameter checked for NULL.
- */
-#define NULL_PARAM_CHECK_VOID(PARAM)                       \
-    if ((PARAM) == NULL)                                   \
-    {                                                      \
-        return;                                            \
-    }
-
-
-/**
- * @brief Macro for verifying module's initialization status.
- *        Returning with an appropriate error code on failure.
- *
- * @retval (NRF_ERROR_INVALID_STATE | MEMORY_MANAGER_ERR_BASE) module is uninitialized.
- */
-#define VERIFY_MODULE_INITIALIZED()                                     \
-    do                                                                  \
-    {                                                                   \
-        if (!m_module_initialized)                                      \
-        {                                                               \
-            return (NRF_ERROR_INVALID_STATE | MEMORY_MANAGER_ERR_BASE); \
-        }                                                               \
-    } while (0)
-
-/**
- * @brief Macro for verifying module's initialization status and returning on failure.
- */
-#define VERIFY_MODULE_INITIALIZED_VOID()                                \
-    do                                                                  \
-    {                                                                   \
-        if (!m_module_initialized)                                      \
-        {                                                               \
-            return;                                                     \
-        }                                                               \
-    } while (0)
-
-
-/**
- * @brief Macro for verifying requested size of memory does not exceed maximum block
- *       size supported by the module. Returning with appropriate error code on failure.
- *
- * @param[in] SIZE Requested size to be allocated.
- *
- * @retval (NRF_ERROR_INVALID_PARAM | MEMORY_MANAGER_ERR_BASE) if requested size is greater
- *         than the largest block size managed by the module.
- */
-#define VERIFY_REQUESTED_SIZE(SIZE)                                     \
-    do                                                                  \
-    {                                                                   \
-        if (((SIZE) == 0) ||((SIZE) >  MAX_MEM_SIZE))                   \
-        {                                                               \
-            return (NRF_ERROR_INVALID_PARAM | MEMORY_MANAGER_ERR_BASE); \
-        }                                                               \
-    } while (0)
-
-
-/**
- * @brief Macro for verifying requested size of memory does not exceed maximum block
- *       size supported by the module. Returnson failure.
- *
- * @param[in] SIZE Requested size to be allocated.
- */
-#define VERIFY_REQUESTED_SIZE_VOID(SIZE)                                \
-    do                                                                  \
-    {                                                                   \
-        if (((SIZE) == 0) ||((SIZE) >  MAX_MEM_SIZE))                   \
-        {                                                               \
-            return;                                                     \
-        }                                                               \
-    } while (0)
-
-
-/**@} */
-#else  //MEM_MANAGER_DISABLE_API_PARAM_CHECK
-
-#define NULL_PARAM_CHECK(PARAM)
-#define VERIFY_MODULE_INITIALIZED()
-#define VERIFY_REQUESTED_SIZE(SIZE)
-
-#endif //MEM_MANAGER_DISABLE_API_PARAM_CHECK
-
-
-/**@brief Setting defualts in case XXSmall block not used by application. */
-#ifndef MEMORY_MANAGER_XXSMALL_BLOCK_COUNT
-    #define MEMORY_MANAGER_XXSMALL_BLOCK_COUNT 0
-    #define MEMORY_MANAGER_XXSMALL_BLOCK_SIZE  0
-    #define XXSMALL_BLOCK_START                0
-    #define XXSMALL_BLOCK_END                  0
-    #define XXSMALL_MEMORY_START               0
-#endif // MEMORY_MANAGER_XXSMALL_BLOCK_SIZE
-
-
-/**@brief Setting defualts in case XSmall block not used by application. */
-#ifndef MEMORY_MANAGER_XSMALL_BLOCK_COUNT
-   #define MEMORY_MANAGER_XSMALL_BLOCK_COUNT   0
-   #define MEMORY_MANAGER_XSMALL_BLOCK_SIZE    0
-   #define XSMALL_BLOCK_START                  0
-   #define XSMALL_BLOCK_END                    0
-   #define XSMALL_MEMORY_START                 0
-#endif // MEMORY_MANAGER_XSMALL_BLOCK_SIZE
-
-
-/**@brief Setting defualts in case Small block not used by application. */
-#ifndef MEMORY_MANAGER_SMALL_BLOCK_COUNT
-   #define MEMORY_MANAGER_SMALL_BLOCK_COUNT    0
-   #define MEMORY_MANAGER_SMALL_BLOCK_SIZE     0
-   #define SMALL_BLOCK_START                   0
-   #define SMALL_BLOCK_END                     0
-   #define SMALL_MEMORY_START                  0
-#endif // MEMORY_MANAGER_SMALL_BLOCK_COUNT
-
-
-/**@brief Setting defualts in case Medium block not used by application. */
-#ifndef MEMORY_MANAGER_MEDIUM_BLOCK_COUNT
-   #define MEMORY_MANAGER_MEDIUM_BLOCK_COUNT   0
-   #define MEMORY_MANAGER_MEDIUM_BLOCK_SIZE    0
-   #define MEDIUM_BLOCK_START                  0
-   #define MEDIUM_BLOCK_END                    0
-   #define MEDIUM_MEMORY_START                 0
-#endif // MEMORY_MANAGER_MEDIUM_BLOCK_COUNT
-
-
-/**@brief Setting defualts in case Large block not used by application. */
-#ifndef MEMORY_MANAGER_LARGE_BLOCK_COUNT
-   #define MEMORY_MANAGER_LARGE_BLOCK_COUNT    0
-   #define MEMORY_MANAGER_LARGE_BLOCK_SIZE     0
-   #define LARGE_BLOCK_START                   0
-   #define LARGE_BLOCK_END                     0
-   #define LARGE_MEMORY_START                  0
-#endif // MEMORY_MANAGER_LARGE_BLOCK_COUNT
-
-
-/**@brief Setting defualts in case XLarge block not used by application. */
-#ifndef MEMORY_MANAGER_XLARGE_BLOCK_COUNT
-   #define MEMORY_MANAGER_XLARGE_BLOCK_COUNT   0
-   #define MEMORY_MANAGER_XLARGE_BLOCK_SIZE    0
-   #define XLARGE_BLOCK_START                  0
-   #define XLARGE_BLOCK_END                    0
-   #define XLARGE_MEMORY_START                 0
-#endif // MEMORY_MANAGER_XLARGE_BLOCK_COUNT
-
-
-/**@brief Setting defualts in case XXLarge block not used by application. */
-#ifndef MEMORY_MANAGER_XXLARGE_BLOCK_COUNT
-   #define MEMORY_MANAGER_XXLARGE_BLOCK_COUNT  0
-   #define MEMORY_MANAGER_XXLARGE_BLOCK_SIZE   0
-   #define XXLARGE_BLOCK_START                 0
-   #define XXLARGE_BLOCK_END                   0
-   #define XXLARGE_MEMORY_START                0
-#endif // MEMORY_MANAGER_XXLARGE_BLOCK_COUNT
-
-
-/**@brief  Based on which blocks are defined, MAX_MEM_SIZE is determined.
- *
- * @note   Also, in case none of these are defined, a compile time error is indicated.
- */
-#if (MEMORY_MANAGER_XXLARGE_BLOCK_COUNT != 0)
-    #define MAX_MEM_SIZE MEMORY_MANAGER_XXLARGE_BLOCK_SIZE
-#elif (MEMORY_MANAGER_XLARGE_BLOCK_COUNT != 0)
-    #define MAX_MEM_SIZE MEMORY_MANAGER_XLARGE_BLOCK_SIZE
-#elif (MEMORY_MANAGER_LARGE_BLOCK_COUNT != 0)
-    #define MAX_MEM_SIZE MEMORY_MANAGER_LARGE_BLOCK_SIZE
-#elif (MEMORY_MANAGER_MEDIUM_BLOCK_COUNT != 0)
-    #define MAX_MEM_SIZE MEMORY_MANAGER_MEDIUM_BLOCK_SIZE
-#elif (MEMORY_MANAGER_SMALL_BLOCK_COUNT != 0)
-    #define MAX_MEM_SIZE MEMORY_MANAGER_SMALL_BLOCK_SIZE
-#elif (MEMORY_MANAGER_XSMALL_BLOCK_COUNT != 0)
-    #define MAX_MEM_SIZE MEMORY_MANAGER_XSMALL_BLOCK_SIZE
-#elif (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT != 0)
-    #define MAX_MEM_SIZE MEMORY_MANAGER_XXSMALL_BLOCK_SIZE
-#else
-    #err "One of MEMORY_MANAGER_SMALL_BLOCK_COUNT, MEMORY_MANAGER_MEDIUM_BLOCK_COUNT or \
-         or MEMORY_MANAGER_LARGE_BLOCK_COUNT should be defined."
-#endif
-
-/**@brief XXSmall block start index in case XXSmall Block is defined. */
-#ifndef XXSMALL_BLOCK_START
-#define XXSMALL_BLOCK_START   0
-#endif // XXSMALL_BLOCK_START
-
-
-/**@brief XSmall block start index in case XSmall Block is defined. */
-#ifndef XSMALL_BLOCK_START
-#define XSMALL_BLOCK_START    (XXSMALL_BLOCK_START + MEMORY_MANAGER_XXSMALL_BLOCK_COUNT)
-#endif // XSMALL_BLOCK_START
-
-
-/**@brief Small block start index in case Small Block is defined. */
-#ifndef SMALL_BLOCK_START
-#define SMALL_BLOCK_START     (XSMALL_BLOCK_START  + MEMORY_MANAGER_XSMALL_BLOCK_COUNT)
-#endif // SMALL_BLOCK_START
-
-
-/**@brief Medium block start index in case Medium Block is defined. */
-#ifndef MEDIUM_BLOCK_START
-#define MEDIUM_BLOCK_START    (SMALL_BLOCK_START   + MEMORY_MANAGER_SMALL_BLOCK_COUNT)
-#endif // MEDIUM_BLOCK_START
-
-
-/**@brief Large block start index in case Large Block is defined. */
-#ifndef LARGE_BLOCK_START
-#define LARGE_BLOCK_START     (MEDIUM_BLOCK_START  + MEMORY_MANAGER_MEDIUM_BLOCK_COUNT)
-#endif // LARGE_BLOCK_START
-
-
-/**@brief XLarge block start index in case XLarge Block is defined. */
-#ifndef XLARGE_BLOCK_START
-#define XLARGE_BLOCK_START    (LARGE_BLOCK_START   + MEMORY_MANAGER_LARGE_BLOCK_COUNT)
-#endif // XLARGE_BLOCK_START
-
-/**@brief XXLarge block start index in case XXLarge Block is defined. */
-#ifndef XXLARGE_BLOCK_START
-#define XXLARGE_BLOCK_START   (XLARGE_BLOCK_START  + MEMORY_MANAGER_XLARGE_BLOCK_COUNT)
-#endif //XXLARGE_BLOCK_START
-
-
-/**@brief XXSmall block end index in case XXSmall Block is defined. */
-#ifndef XXSMALL_BLOCK_END
-#define XXSMALL_BLOCK_END   (XXSMALL_BLOCK_START   + MEMORY_MANAGER_XXSMALL_BLOCK_COUNT)
-#endif // XXSMALL_BLOCK_END
-
-/**@brief XSmall block end index in case XSmall Block is defined. */
-#ifndef XSMALL_BLOCK_END
-#define XSMALL_BLOCK_END    (XSMALL_BLOCK_START    + MEMORY_MANAGER_XSMALL_BLOCK_COUNT)
-#endif // XSMALL_BLOCK_END
-
-
-/**@brief Small block end index in case Small Block is defined. */
-#ifndef SMALL_BLOCK_END
-#define SMALL_BLOCK_END     (SMALL_BLOCK_START     + MEMORY_MANAGER_SMALL_BLOCK_COUNT)
-#endif // SMALL_BLOCK_END
-
-
-/**@brief Medium block end index in case Medium Block is defined. */
-#ifndef MEDIUM_BLOCK_END
-#define MEDIUM_BLOCK_END    (MEDIUM_BLOCK_START    + MEMORY_MANAGER_MEDIUM_BLOCK_COUNT)
-#endif // MEDIUM_BLOCK_END
-
-
-/**@brief Large block end index in case Large Block is defined. */
-#ifndef LARGE_BLOCK_END
-#define LARGE_BLOCK_END     (LARGE_BLOCK_START    + MEMORY_MANAGER_LARGE_BLOCK_COUNT)
-#endif // LARGE_BLOCK_END
-
-
-/**@brief XLarge block end index in case XLarge Block is defined. */
-#ifndef XLARGE_BLOCK_END
-#define XLARGE_BLOCK_END    (XLARGE_BLOCK_START   + MEMORY_MANAGER_XLARGE_BLOCK_COUNT)
-#endif // XLARGE_BLOCK_END
-
-
-/**@brief XXLarge block end index in case XXLarge Block is defined. */
-#ifndef XXLARGE_BLOCK_END
-#define XXLARGE_BLOCK_END   (XXLARGE_BLOCK_START  + MEMORY_MANAGER_XXLARGE_BLOCK_COUNT)
-#endif //XXLARGE_BLOCK_END
-
-
-#define XXSMALL_MEMORY_SIZE (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT * MEMORY_MANAGER_XXSMALL_BLOCK_SIZE)
-#define XSMALL_MEMORY_SIZE  (MEMORY_MANAGER_XSMALL_BLOCK_COUNT  * MEMORY_MANAGER_XSMALL_BLOCK_SIZE)
-#define SMALL_MEMORY_SIZE   (MEMORY_MANAGER_SMALL_BLOCK_COUNT   * MEMORY_MANAGER_SMALL_BLOCK_SIZE)
-#define MEDIUM_MEMORY_SIZE  (MEMORY_MANAGER_MEDIUM_BLOCK_COUNT  * MEMORY_MANAGER_MEDIUM_BLOCK_SIZE)
-#define LARGE_MEMORY_SIZE   (MEMORY_MANAGER_LARGE_BLOCK_COUNT   * MEMORY_MANAGER_LARGE_BLOCK_SIZE)
-#define XLARGE_MEMORY_SIZE  (MEMORY_MANAGER_XLARGE_BLOCK_COUNT  * MEMORY_MANAGER_XLARGE_BLOCK_SIZE)
-#define XXLARGE_MEMORY_SIZE (MEMORY_MANAGER_XXLARGE_BLOCK_COUNT * MEMORY_MANAGER_XXLARGE_BLOCK_SIZE)
-
-
-/**@brief XXSmall memory start index in case XXSmall Block is defined. */
-#ifndef XXSMALL_MEMORY_START
-#define XXSMALL_MEMORY_START  0
-#endif // XXSMALL_MEMORY_START
-
-
-/**@brief XSmall memory start index in case XSmall Block is defined. */
-#ifndef XSMALL_MEMORY_START
-#define XSMALL_MEMORY_START  (XXSMALL_MEMORY_START + XXSMALL_MEMORY_SIZE)
-#endif // XSMALL_MEMORY_START
-
-
-/**@brief Small memory start index in case Small Block is defined. */
-#ifndef SMALL_MEMORY_START
-#define SMALL_MEMORY_START  (XSMALL_MEMORY_START + XSMALL_MEMORY_SIZE)
-#endif // SMALL_MEMORY_START
-
-
-/**@brief Medium memory start index in case Medium Block is defined. */
-#ifndef MEDIUM_MEMORY_START
-#define MEDIUM_MEMORY_START  (SMALL_MEMORY_START + SMALL_MEMORY_SIZE)
-#endif // MEDIUM_MEMORY_START
-
-
-/**@brief Large memory start index in case Large Block is defined. */
-#ifndef LARGE_MEMORY_START
-#define LARGE_MEMORY_START  (MEDIUM_MEMORY_START + MEDIUM_MEMORY_SIZE)
-#endif // LARGE_MEMORY_START
-
-
-/**@brief XLarge memory start index in case XLarge Block is defined. */
-#ifndef XLARGE_MEMORY_START
-#define XLARGE_MEMORY_START  (LARGE_MEMORY_START + LARGE_MEMORY_SIZE)
-#endif // XLARGE_MEMORY_START
-
-
-/**@brief XXLarge memory start index in case XXLarge Block is defined. */
-#ifndef XXLARGE_MEMORY_START
-#define XXLARGE_MEMORY_START  (XLARGE_MEMORY_START + XLARGE_MEMORY_SIZE)
-#endif // XLARGE_MEMORY_START
-
-
-/**@brief Total count of block managed by the module. */
-#define TOTAL_BLOCK_COUNT (MEMORY_MANAGER_XXSMALL_BLOCK_COUNT +                                     \
-                           MEMORY_MANAGER_XSMALL_BLOCK_COUNT  +                                     \
-                           MEMORY_MANAGER_SMALL_BLOCK_COUNT   +                                     \
-                           MEMORY_MANAGER_MEDIUM_BLOCK_COUNT  +                                     \
-                           MEMORY_MANAGER_LARGE_BLOCK_COUNT   +                                     \
-                           MEMORY_MANAGER_XLARGE_BLOCK_COUNT  +                                     \
-                           MEMORY_MANAGER_XLARGE_BLOCK_COUNT)
-
-
-/**@brief Total memory managed by the module. */
-#define TOTAL_MEMORY_SIZE (XXSMALL_MEMORY_SIZE +                                                    \
-                           XSMALL_MEMORY_SIZE  +                                                    \
-                           SMALL_MEMORY_SIZE   +                                                    \
-                           MEDIUM_MEMORY_SIZE  +                                                    \
-                           LARGE_MEMORY_SIZE   +                                                    \
-                           XLARGE_MEMORY_SIZE  +                                                    \
-                           XXLARGE_MEMORY_SIZE)
-
-
-#define BLOCK_CAT_COUNT                7                                                            /**< Block category count is 7 (xxsmall, xsmall, small, medium, large, xlarge, xxlarge). Having one of the block count to zero has no impact on this count. */
-#define BLOCK_CAT_XXS                  0                                                            /**< Extra Extra Small category identifier. */
-#define BLOCK_CAT_XS                   1                                                            /**< Extra Small category identifier. */
-#define BLOCK_CAT_SMALL                2                                                            /**< Small category identifier. */
-#define BLOCK_CAT_MEDIUM               3                                                            /**< Medium category identifier. */
-#define BLOCK_CAT_LARGE                4                                                            /**< Large category identifier. */
-#define BLOCK_CAT_XL                   5                                                            /**< Extra Large category identifier. */
-#define BLOCK_CAT_XXL                  6                                                            /**< Extra Extra Large category identifier. */
-
-#define BITMAP_SIZE                    32                                                           /**< Bitmap size for each word used to contain block information. */
-#define BLOCK_BITMAP_ARRAY_SIZE        CEIL_DIV(TOTAL_BLOCK_COUNT, BITMAP_SIZE)                     /**< Determines number of blocks needed for book keeping availability status of all blocks. */
-
-
-/**@brief Lookup table for maximum memory size per block category. */
-static const uint32_t m_block_size[BLOCK_CAT_COUNT] =
-{
-    MEMORY_MANAGER_XXSMALL_BLOCK_SIZE,
-    MEMORY_MANAGER_XSMALL_BLOCK_SIZE,
-    MEMORY_MANAGER_SMALL_BLOCK_SIZE,
-    MEMORY_MANAGER_MEDIUM_BLOCK_SIZE,
-    MEMORY_MANAGER_LARGE_BLOCK_SIZE,
-    MEMORY_MANAGER_XLARGE_BLOCK_SIZE,
-    MEMORY_MANAGER_XXLARGE_BLOCK_SIZE
-};
-
-/**@brief Lookup table for block start index for each block caetgory. */
-static const uint32_t m_block_start[BLOCK_CAT_COUNT] =
-{
-    XXSMALL_BLOCK_START,
-    XSMALL_BLOCK_START,
-    SMALL_BLOCK_START,
-    MEDIUM_BLOCK_START,
-    LARGE_BLOCK_START,
-    XLARGE_BLOCK_START,
-    XXLARGE_BLOCK_START
-};
-
-/**@brief Lookup table for last block index for each block category. */
-static const uint32_t m_block_end[BLOCK_CAT_COUNT] =
-{
-    XXSMALL_BLOCK_END,
-    XSMALL_BLOCK_END,
-    SMALL_BLOCK_END,
-    MEDIUM_BLOCK_END,
-    LARGE_BLOCK_END,
-    XLARGE_BLOCK_END,
-    XXLARGE_BLOCK_END
-};
-
-/**@brief Lookup table for memory start range for each block category. */
-static const uint32_t m_block_mem_start[BLOCK_CAT_COUNT] =
-{
-    XXSMALL_MEMORY_START,
-    XSMALL_MEMORY_START,
-    SMALL_MEMORY_START,
-    MEDIUM_MEMORY_START,
-    LARGE_MEMORY_START,
-    XLARGE_MEMORY_START,
-    XXLARGE_MEMORY_START
-};
-
-static uint8_t  m_memory[TOTAL_MEMORY_SIZE];                                                        /**< Memory managed by the module. */
-static uint32_t m_mem_pool[BLOCK_BITMAP_ARRAY_SIZE];                                                /**< Bitmap used for book-keeping availability of all blocks managed by the module.  */
-
-#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-/**@brief Lookup table for descriptive strings for each block category. */
-static const char * m_block_desc_str[BLOCK_CAT_COUNT] =
-{
-    "XXSmall",
-    "XSmall",
-    "Small",
-    "Medium",
-    "Large",
-    "XLarge",
-    "XXLarge"
-};
-
-/**@brief Table for book keeping smallest size allocated in each block range. */
-static uint32_t m_min_size[BLOCK_CAT_COUNT]  =
-{
-    MEMORY_MANAGER_XXSMALL_BLOCK_SIZE,
-    MEMORY_MANAGER_XSMALL_BLOCK_SIZE,
-    MEMORY_MANAGER_SMALL_BLOCK_SIZE,
-    MEMORY_MANAGER_MEDIUM_BLOCK_SIZE,
-    MEMORY_MANAGER_LARGE_BLOCK_SIZE,
-    MEMORY_MANAGER_XLARGE_BLOCK_SIZE,
-    MEMORY_MANAGER_XXLARGE_BLOCK_SIZE
-};
-
-/**@brief Table for book keeping largest size allocated in each block range. */
-static uint32_t m_max_size[BLOCK_CAT_COUNT];
-
-/**@brief Global pointing to minimum size holder for block type being allocated. */
-static uint32_t * p_min_size;
-
-/**@brief Global pointing to maximum size holder for block type being allocated. */
-static uint32_t * p_max_size;
-
-/**@brief Lookup table for count of block available in each block category. */
-static uint32_t m_block_count[BLOCK_CAT_COUNT] =
-{
-    MEMORY_MANAGER_XXSMALL_BLOCK_COUNT,
-    MEMORY_MANAGER_XSMALL_BLOCK_COUNT,
-    MEMORY_MANAGER_SMALL_BLOCK_COUNT,
-    MEMORY_MANAGER_MEDIUM_BLOCK_COUNT,
-    MEMORY_MANAGER_LARGE_BLOCK_COUNT,
-    MEMORY_MANAGER_XLARGE_BLOCK_COUNT,
-    MEMORY_MANAGER_XXLARGE_BLOCK_COUNT
-};
-
-#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-SDK_MUTEX_DEFINE(m_mm_mutex)                                                                        /**< Mutex variable. Currently unused, this declaration does not occupy any space in RAM. */
-#if (MEM_MANAGER_DISABLE_API_PARAM_CHECK == 0)
-static bool     m_module_initialized = false;                                                       /**< State indicating if module is initialized or not. */
-#endif // MEM_MANAGER_DISABLE_API_PARAM_CHECK
-
-
-/**@brief Function to get X and Y coordinates.
- *
- * @details Function to get X and Y co-ordinates for the block identified by index.
- *          Here, X determines relevant word for the block. Y determines the actual bit in the word.
- *
- * @param[in]  index Identifies the block.
- * @param[out] p_x   Points to the word that contains the bit representing the block.
- * @param[out] p_y   Contains the bitnumber in the the word 'X' relevant to the block.
- */
-static __INLINE void get_block_coordinates(uint32_t block_index, uint32_t * p_x, uint32_t * p_y)
-{
-    // Determine position of the block in the bitmap.
-    // X determines relevant word for the block. Y determines the actual bit in the word.
-    const uint32_t x = block_index/BITMAP_SIZE;
-    const uint32_t y = (block_index - x*BITMAP_SIZE);
-
-    (*p_x) = x;
-    (*p_y) = y;
-}
-
-
-/**@brief Initializes the block by setting it to be free. */
-static void block_init (uint32_t block_index)
-{
-    uint32_t x;
-    uint32_t y;
-
-    // Determine position of the block in the bitmap.
-    // X determines relevant word for the block. Y determines the actual bit in the word.
-    get_block_coordinates(block_index, &x, &y);
-
-    // Set bit related to the block to indicate that the block is free.
-    SET_BIT(m_mem_pool[x], y);
-}
-
-
-/**@brief Function to get the category of the block of size 'size' or block number 'block_index'.*/
-static __INLINE uint32_t get_block_cat(uint32_t size, uint32_t block_index)
-{
-    for (uint32_t block_cat = 0; block_cat < BLOCK_CAT_COUNT; block_cat++)
-    {
-        if (((size != 0) && (size <= m_block_size[block_cat]) &&
-            (m_block_end[block_cat] != m_block_start[block_cat])) ||
-            (block_index < m_block_end[block_cat]))
-        {
-            return block_cat;
-        }
-    }
-
-    return 0;
-}
-
-
-/**@brief Function to get the size of the block number 'block_index'. */
-static __INLINE uint32_t get_block_size(uint32_t block_index)
-{
-    const uint32_t block_cat = get_block_cat(0, block_index);
-
-    #ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-        p_min_size = &m_min_size[block_cat];
-        p_max_size = &m_max_size[block_cat];
-    #endif // MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-    return m_block_size[block_cat];
-}
-
-
-/**@brief Function to free the block identified by block number 'block_index'. */
-static bool is_block_free(uint32_t block_index)
-{
-    uint32_t x;
-    uint32_t y;
-
-    // Determine position of the block in the bitmap.
-    // X determines relevant word for the block. Y determines the actual bit in the word.
-    get_block_coordinates(block_index, &x, &y);
-
-    return IS_SET(m_mem_pool[x], y);
-}
-
-
-/**@brief Function to allocate the block identified by block number 'block_index'. */
-static void block_allocate(uint32_t block_index)
-{
-    uint32_t x;
-    uint32_t y;
-
-    // Determine position of the block in the bitmap.
-    // X determines relevant word for the block. Y determines the actual bit in the word.
-    get_block_coordinates(block_index, &x, &y);
-
-    CLR_BIT(m_mem_pool[x], y);
-}
-
-
-uint32_t nrf_mem_init(void)
-{
-    MM_LOG("[MM]: >> nrf_mem_init.\r\n");
-
-    SDK_MUTEX_INIT(m_mm_mutex);
-
-    MM_MUTEX_LOCK();
-
-    uint32_t block_index = 0;
-
-    for(block_index = 0; block_index < TOTAL_BLOCK_COUNT; block_index++)
-    {
-        block_init(block_index);
-    }
-
-#if (MEM_MANAGER_DISABLE_API_PARAM_CHECK == 0)
-    m_module_initialized = true;
-#endif // MEM_MANAGER_DISABLE_API_PARAM_CHECK
-
-#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-        nrf_mem_diagnose();
-#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-    MM_MUTEX_UNLOCK();
-
-    MM_LOG("[MM]: << nrf_mem_init.\r\n");
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t nrf_mem_reserve(uint8_t ** pp_buffer, uint32_t * p_size)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(pp_buffer);
-    NULL_PARAM_CHECK(p_size);
-
-    const uint32_t requested_size = (*p_size);
-
-    VERIFY_REQUESTED_SIZE(requested_size);
-
-    MM_LOG("[MM]: >> nrf_mem_reserve, size 0x%04lX.\r\n", requested_size);
-
-    MM_MUTEX_LOCK();
-
-    const uint32_t block_cat    = get_block_cat(requested_size, TOTAL_BLOCK_COUNT);
-    uint32_t       block_index  = m_block_start[block_cat];
-    uint32_t       memory_index = m_block_mem_start[block_cat];
-    uint32_t       err_code     = (NRF_ERROR_NO_MEM | MEMORY_MANAGER_ERR_BASE);
-
-    MM_LOG("[MM]: Start index for the pool = 0x%08lX, total block count 0x%08X\r\n",
-           block_index,
-           TOTAL_BLOCK_COUNT);
-
-    for (; block_index < TOTAL_BLOCK_COUNT; block_index++)
-    {
-        uint32_t block_size = get_block_size(block_index);
-
-        if (is_block_free(block_index) == true)
-        {
-            MM_LOG("[MM]: Reserving block 0x%08lX\r\n", block_index);
-
-            // Search succeeded, found free block.
-            err_code     = NRF_SUCCESS;
-
-            // Allocate block.
-            block_allocate(block_index);
-
-            (*pp_buffer) = &m_memory[memory_index];
-            (*p_size)    = block_size;
-
-            #ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-                (*p_min_size) = MIN((*p_min_size), requested_size);
-                (*p_max_size) = MAX((*p_max_size), requested_size);
-            #endif // MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-            break;
-        }
-        memory_index += block_size;
-    }
-    if (err_code != NRF_SUCCESS)
-    {
-        MM_LOG ("[MM]: Memory reservation result %d, memory %p, size %d!",
-                err_code,
-                (*pp_buffer),
-                (*p_size));
-
-        #ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-        nrf_mem_diagnose();
-        #endif // MEM_MANAGER_ENABLE_DIAGNOSTICS
-    }
-
-    MM_MUTEX_UNLOCK();
-
-    MM_LOG("[MM]: << nrf_mem_reserve %p, result 0x%08lX.\r\n", (*pp_buffer), err_code);
-
-    return err_code;
-}
-
-
-void * nrf_malloc(uint32_t size)
-{
-    uint8_t * buffer = NULL;
-    uint32_t allocated_size = size;
-
-    uint32_t retval = nrf_mem_reserve(&buffer, &allocated_size);
-
-    if (retval != NRF_SUCCESS)
-    {
-        buffer = NULL;
-    }
-
-    return buffer;
-}
-
-
-void * nrf_calloc(uint32_t count, uint32_t size)
-{
-    uint8_t * buffer = NULL;
-    uint32_t allocated_size = (size * count);
-
-    MM_LOG ("[nrf_calloc]: Requested size %d, count %d\r\n", allocated_size, count);
-
-    uint32_t retval = nrf_mem_reserve(&buffer,&allocated_size);
-    if (retval == NRF_SUCCESS)
-    {
-        MM_LOG ("[nrf_calloc]: buffer %p, total size %d\r\n", buffer, allocated_size);
-        memset(buffer,0, allocated_size);
-    }
-    else
-    {
-        MM_LOG("[nrf_calloc]: Failed to allocate memory %d\r\n", allocated_size);
-        buffer = NULL;
-    }
-
-    return buffer;
-}
-
-
-void nrf_free(void * p_mem)
-{
-    VERIFY_MODULE_INITIALIZED_VOID();
-    NULL_PARAM_CHECK_VOID(p_mem);
-
-    MM_LOG("[MM]: >> nrf_free %p.\r\n", p_mem);
-
-    MM_MUTEX_LOCK();
-
-    uint32_t index;
-    uint32_t memory_index = 0;
-
-    for (index = 0; index < TOTAL_BLOCK_COUNT; index++)
-    {
-        if (&m_memory[memory_index] == p_mem)
-        {
-            // Found a free block of memory, assign.
-            MM_LOG("[MM]: << Freeing block %d.\r\n", index);
-            block_init(index);
-            break;
-        }
-        memory_index += get_block_size(index);
-    }
-
-    MM_MUTEX_UNLOCK();
-
-    MM_LOG("[MM]: << nrf_free.\r\n");
-    return;
-}
-
-
-void * nrf_realloc(void * p_mem, uint32_t size)
-{
-    return p_mem;
-}
-
-
-#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-/**@brief Function to format and print information with respect to each block.
- *
- * @details Internal function that formats and prints information related to the block category
- *          identified by 'block_cat'. This function also appends the number of bytes in use to
- *          p_mem_in_use based on current count of block in the category.
- *
- * @param[in]  block_cat    Identifies the category of block.
- * @param[out] p_mem_in_use Updates the memory in use based on count in use.
- */
-void print_block_info(uint32_t block_cat, uint32_t * p_mem_in_use)
-{
-    #define PRINT_COLUMN_WIDTH      13
-    #define PRINT_BUFFER_SIZE       80
-    #define ASCII_VALUE_FOR_SPACE   32
-
-    char           print_buffer[PRINT_BUFFER_SIZE];
-    const uint32_t total_count   = (m_block_start[block_cat] + m_block_count[block_cat]);
-    uint32_t       in_use        = 0;
-    uint32_t       num_of_blocks = 0;
-    uint32_t       index         = m_block_start[block_cat];
-    uint32_t       column_number;
-
-    // No statistic provided in case block category is not included.
-    if (m_block_count[block_cat] != 0)
-    {
-        memset(print_buffer, ASCII_VALUE_FOR_SPACE, PRINT_BUFFER_SIZE);
-
-        for (; index < total_count; index++)
-        {
-            if (is_block_free(index) == false)
-            {
-                num_of_blocks++;
-                in_use += m_block_size[block_cat];
-            }
-        }
-
-        column_number = 0;
-        snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH],
-                 PRINT_COLUMN_WIDTH,
-                 "| %s",
-                 m_block_desc_str[block_cat]);
-
-        column_number++;
-        snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH],
-                 PRINT_COLUMN_WIDTH,
-                 "| %d",
-                 m_block_size[block_cat]);
-
-        column_number++;
-        snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH],
-                 PRINT_COLUMN_WIDTH,
-                 "| %d",
-                 m_block_count[block_cat]);
-
-        column_number++;
-        snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH],
-                 PRINT_COLUMN_WIDTH,
-                 "| %d",
-                 num_of_blocks);
-
-        column_number++;
-        snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH],
-                 PRINT_COLUMN_WIDTH,
-                 "| %d",
-                 m_min_size[block_cat]);
-
-        column_number++;
-        snprintf(&print_buffer[column_number * PRINT_COLUMN_WIDTH],
-                 PRINT_COLUMN_WIDTH,
-                 "| %d",
-                 m_max_size[block_cat]);
-
-        column_number++;
-        const uint32_t column_end = (column_number * PRINT_COLUMN_WIDTH);
-
-        for (int j = 0; j < column_end; j ++)
-        {
-            if (print_buffer[j] == 0)
-            {
-                print_buffer[j] = 0x20;
-            }
-        }
-        snprintf(&print_buffer[column_end], 2, "|");
-
-        MMD_LOG("%s\r\n", print_buffer);
-
-        (*p_mem_in_use) += in_use;
-    }
-}
-
-
-void nrf_mem_diagnose(void)
-{
-    uint32_t in_use = 0;
-
-    MMD_LOG ("\r\n");
-    MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n");
-    MMD_LOG ("| Block      | Size       | Total      | In Use     | Min Alloc  | Max Alloc  |\r\n");
-    MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n");
-
-    print_block_info(BLOCK_CAT_XXS, &in_use);
-    print_block_info(BLOCK_CAT_XS, &in_use);
-    print_block_info(BLOCK_CAT_SMALL, &in_use);
-    print_block_info(BLOCK_CAT_MEDIUM, &in_use);
-    print_block_info(BLOCK_CAT_LARGE, &in_use);
-    print_block_info(BLOCK_CAT_XL, &in_use);
-    print_block_info(BLOCK_CAT_XXL, &in_use);
-
-    MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n");
-    MMD_LOG ("| Total      | %d      | %d        | %d\r\n",
-            TOTAL_MEMORY_SIZE, TOTAL_BLOCK_COUNT,in_use);
-    MMD_LOG ("+------------+------------+------------+------------+------------+------------+\r\n");
-}
-
-#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS
-/** @} */

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/mem_manager/mem_manager.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mem_manager/mem_manager.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mem_manager/mem_manager.h
deleted file mode 100644
index 5d009ce..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/mem_manager/mem_manager.h
+++ /dev/null
@@ -1,147 +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 mem_manager Memory Manager
- * @{
- * @ingroup app_common
- * @brief Memory Manager for the \nRFXX SDK
- *
- * @details This module allows for dynamic use of memory. Currently,
- * this module can be used only to allocate and free memory in the RAM.
- *
- * The Memory Manager manages static memory blocks of fixed sizes. These blocks can be requested for
- * usage, and freed when the application no longer needs them. A maximum of seven block categories
- * can be managed by the module. These block categories are identified by xxsmall, xmall, small,
- * medium, large, xlarge, and xxlarge. They are ordered in increasing block sizes.
- * The size and the count of each of the block categories can be configured based on the application
- * requirements in the configuration file @c sdk_config.h.
- * To use fewer than seven buffer pools, do not define the count for the unwanted block
- * or explicitly set it to zero. At least one block category must be configured
- * for this module to function as expected.
- */
-
-#ifndef MEM_MANAGER_H__
-#define MEM_MANAGER_H__
-
-#include "sdk_common.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Initializes Memory Manager.
- *
- * @details API to initialize the Memory Manager. Always call this API before using any of the other
- *          APIs of the module. This API should be called only once.
- *
- * @retval NRF_SUCCESS If initialization was successful.
- *         Otherwise, an error code that indicates the reason for the failure is returned.
- *
- * @warning   If this API fails, the application shall not proceed with using other APIs of this
- *            module.
- */
-uint32_t nrf_mem_init(void);
-
-
-/**@brief Reserves a block of memory for the application.
- *
- * @details API to request a contiguous memory block of the given length. If
- *          the memory allocation succeeds, pp_buffer points to the memory block. If
- *          the memory allocation fails, pp_buffer points to NULL and the return value of
- *          the API indicates the reason for the failure. The memory block reserved using this API can
- *          be freed using the @ref nrf_free function.
- *
- * @param[out]   pp_buffer             Pointer to the allocated memory block if memory allocation
- *                                     succeeds; otherwise points to NULL.
- * @param[inout] p_size                Requested memory size. This parameter returns the actual size
- *                                     allocated. If the procedure was successful, the actual size
- *                                     returned is always greater than or equal to requested size,
- *                                     never less.
- *
- * @retval     NRF_SUCCESS             If memory was successfully allocated.
- *                                     Otherwise, an error code indicating the reason for failure.
- * @retval     NRF_ERROR_INVALID_PARAM If the requested memory size is zero or greater than the
- *                                     largest memory block that the module is configured to
- *                                     support.
- * @retval     NRF_ERROR_NO_MEM        If there is no memory available of the requested size.
- */
-uint32_t nrf_mem_reserve(uint8_t ** pp_buffer, uint32_t * p_size);
-
-
-/**@brief 'malloc' styled memory allocation function.
- *
- * @details API to allocate memory, same as nrf_mem_reserve but uses malloc signature.
- *
- * @param[in]  size  Requested memory size.
- *
- * @retval     Valid memory location if the procedure was successful, else, NULL.
- */
-void * nrf_malloc(uint32_t size);
-
-
-/**@brief 'calloc' styled memory allocation function.
- *
- * @details API to allocate zero-initialized memory of size count*size.
- *
- * @param[in]  nmemb  Number of elements of 'size' bytes.
- * @param[in]  size   Size of each element allocated.
- *
- * @retval     Valid, zero-initialized memory location if the procedure was successful, else, NULL.
- */
-void * nrf_calloc(uint32_t nmemb, uint32_t size);
-
-
-/**@brief Free allocated memory - standard 'free' styles API.
- *
- * @details API to resubmit memory allocated, same in functionality nrf_free.
- *
- * @param[out] p_buffer   Pointer to the memory block that is being freed.
- */
-void nrf_free(void * p_buffer);
-
-
-/**@brief Memory reallocation (trim) function.
- *
- * @details API to reallocate memory or to trim it. Trim is mentioned here to avoid use of API to
- *          request memory size larger than original memory allocated.
- *
- * @param[in] p_buffer   Pointer to the memory block that needs to be trimmed.
- * @param[in] size       Size of memory at the beginning of the buffer to be left untrimmed.
- *
- * @retval    Pointer to memory location with trimmed size, else, NULL.
- */
-void * nrf_realloc(void *p_buffer, uint32_t size);
-
-#ifdef MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-/**@brief Function to print statstics related to memory blocks managed by memory manager.
- *
- * @details This API prints information with respects to each block function, including size, total
- *          block count, number of blocks in use at the time of printing, smallest memory size
- *          allocated in the block and the largest one. This  API is intended to help developers
- *          tune the block sizes to make optimal use of memory for the application.
- *          This functionality is never needed in final application and therefore, is disabled by
- *          default.
- */
-void nrf_mem_diagnose(void);
-
-#endif // MEM_MANAGER_ENABLE_DIAGNOSTICS
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // MEM_MANAGER_H__
-/** @} */


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c
deleted file mode 100644
index d463e14..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gap.c
+++ /dev/null
@@ -1,1453 +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.
- *
- */
-
-#include "ble_gap.h"
-#include <stdint.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "ser_sd_transport.h"
-#include "ble_gap_app.h"
-#include "app_error.h"
-#include "app_ble_gap_sec_keys.h"
-
-extern ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS];
-
-/**@brief Structure containing @ref sd_ble_gap_device_name_get output parameters. */
-typedef struct
-{
-    uint8_t *  p_dev_name; /**< @ref sd_ble_gap_device_name_get p_dev_name output parameter. */
-    uint16_t * p_len;      /**< @ref sd_ble_gap_device_name_get p_len output parameter. */
-} gap_device_name_get_output_params_t;
-
-/**@brief Structure containing @ref sd_ble_gap_appearance_get output parameters. */
-typedef struct
-{
-    uint16_t * p_appearance; /**< @ref sd_ble_gap_appearance_get p_appearance output parameter. */
-} gap_appearance_get_output_params_t;
-
-/**@brief Structure containing @ref sd_ble_gap_ppcp_get output parameters. */
-typedef struct
-{
-    ble_gap_conn_params_t * p_conn_params; /**< @ref sd_ble_gap_ppcp_get p_conn_params output parameter. */
-} gap_ppcp_get_out_params_t;
-
-/**@brief Structure containing @ref sd_ble_gap_sec_params_reply output parameters. */
-typedef struct
-{
-    ble_gap_sec_keyset_t const * p_sec_keyset;  /**< @ref sd_ble_gap_sec_params_reply p_sec_keyset output parameter. */
-    uint16_t                     conn_handle; /**< @ref sd_ble_gap_sec_params_reply p_conn_handle output parameter. */
-} gap_sec_params_reply_out_params_t;
-
-/**@brief Union containing BLE command output parameters. */
-typedef union
-{
-    gap_device_name_get_output_params_t gap_device_name_get_out_params; /**< @ref sd_ble_gap_device_name_get output parameters. */
-    gap_appearance_get_output_params_t  gap_appearance_get_out_params;  /**< @ref sd_ble_gap_appearance_get output parameters. */
-    gap_ppcp_get_out_params_t           gap_ppcp_get_out_params;        /**< @ref sd_ble_gap_ppcp_get output parameters. */
-    gap_sec_params_reply_out_params_t   gap_sec_params_reply_out_params;/**< @ref sd_ble_sec_params_reply output parameters. */
-} gap_command_output_params_t;
-
-static gap_command_output_params_t m_output_params; /**< BLE command output parameters. */
-
-static void * mp_out_params[1];
-
-static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
-{
-    uint32_t err_code;
-
-    do
-    {
-        err_code = ser_sd_transport_tx_alloc(p_data, p_len);
-    }
-    while (err_code != NRF_SUCCESS);
-    *p_data[0] = SER_PKT_TYPE_CMD;
-    *p_len    -= 1;
-}
-/**@brief Command response callback function for @ref sd_ble_gap_adv_start BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_adv_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_adv_start_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_adv_start(ble_gap_adv_params_t const * const p_adv_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gap_adv_start_req_enc(p_adv_params,
-                                                        &(p_buffer[1]),
-                                                        &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_adv_start_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref ble_gap_device_name_get_req_enc BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_device_name_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code =
-        ble_gap_device_name_get_rsp_dec(p_buffer,
-                                        length,
-                                        m_output_params.gap_device_name_get_out_params.p_dev_name,
-                                        m_output_params.gap_device_name_get_out_params.p_len,
-                                        &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_device_name_get(uint8_t * const p_dev_name, uint16_t * const p_len)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    m_output_params.gap_device_name_get_out_params.p_dev_name = p_dev_name;
-    m_output_params.gap_device_name_get_out_params.p_len      = p_len;
-
-    const uint32_t err_code = ble_gap_device_name_get_req_enc(p_dev_name,
-                                                              p_len,
-                                                              &(p_buffer[1]),
-                                                              &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_device_name_get_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_appearance_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_appearance_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code =
-        ble_gap_appearance_get_rsp_dec(p_buffer,
-                                       length,
-                                       m_output_params.gap_appearance_get_out_params.p_appearance,
-                                       &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_appearance_get(uint16_t * const p_appearance)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    m_output_params.gap_appearance_get_out_params.p_appearance = p_appearance;
-
-    const uint32_t err_code = ble_gap_appearance_get_req_enc(p_appearance,
-                                                             &(p_buffer[1]),
-                                                             &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_appearance_get_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_device_name_set BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_device_name_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_device_name_set_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const * const p_write_perm,
-                                    uint8_t const * const                 p_dev_name,
-                                    uint16_t                              len)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_device_name_set_req_enc(p_write_perm,
-                                                              p_dev_name,
-                                                              len,
-                                                              &(p_buffer[1]),
-                                                              &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_device_name_set_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_appearance_set BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_appearance_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_appearance_set_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_appearance_set(uint16_t appearance)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_appearance_set_req_enc(appearance,
-                                                             &(p_buffer[1]),
-                                                             &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_appearance_set_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_ppcp_set BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_ppcp_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_ppcp_set_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_ppcp_set(ble_gap_conn_params_t const * const p_conn_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_ppcp_set_req_enc(p_conn_params,
-                                                       &(p_buffer[1]),
-                                                       &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_ppcp_set_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_adv_data_set BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_adv_data_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_adv_data_set_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_adv_data_set(uint8_t const * const p_data,
-                                 uint8_t               dlen,
-                                 uint8_t const * const p_sr_data,
-                                 uint8_t               srdlen)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_adv_data_set_req_enc(p_data,
-                                                           dlen,
-                                                           p_sr_data,
-                                                           srdlen,
-                                                           &(p_buffer[1]),
-                                                           &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_adv_data_set_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_conn_param_update BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_conn_param_update_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_conn_param_update_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_conn_param_update(uint16_t                            conn_handle,
-                                      ble_gap_conn_params_t const * const p_conn_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_conn_param_update_req_enc(conn_handle,
-                                                                p_conn_params,
-                                                                &(p_buffer[1]),
-                                                                &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_conn_param_update_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_disconnect BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_disconnect_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_disconnect_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_disconnect_req_enc(conn_handle,
-                                                         hci_status_code,
-                                                         &(p_buffer[1]),
-                                                         &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_disconnect_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_sec_info_reply BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_sec_info_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gap_sec_info_reply_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_gap_sec_info_reply(uint16_t                    conn_handle,
-                                   ble_gap_enc_info_t  const * p_enc_info,
-                                   ble_gap_irk_t       const * p_id_info,
-                                   ble_gap_sign_info_t const * p_sign_info)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_sec_info_reply_req_enc(conn_handle,
-                                                             p_enc_info,
-                                                             p_id_info,
-                                                             p_sign_info,
-                                                             &(p_buffer[1]),
-                                                             &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_sec_info_reply_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_sec_params_reply BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_sec_params_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code   = 0;
-
-    uint32_t err_code = ble_gap_sec_params_reply_rsp_dec(p_buffer, length,
-                            m_output_params.gap_sec_params_reply_out_params.p_sec_keyset, &result_code);
-    APP_ERROR_CHECK(err_code);
-
-    // If soft device returned error free security context
-    if (result_code)
-    {
-        err_code = app_ble_gap_sec_context_destroy(m_output_params.gap_sec_params_reply_out_params.conn_handle);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    }
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_sec_params_reply(uint16_t                     conn_handle,
-                                     uint8_t                      sec_status,
-                                     ble_gap_sec_params_t const * p_sec_params,
-                                     ble_gap_sec_keyset_t const * p_sec_keyset)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-    uint32_t  sec_tab_index = 0;
-    uint32_t  err_code      = NRF_SUCCESS;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    m_output_params.gap_sec_params_reply_out_params.p_sec_keyset = p_sec_keyset;
-    m_output_params.gap_sec_params_reply_out_params.conn_handle = conn_handle;
-
-    // First allocate security context for serialization
-    if (p_sec_keyset)
-    {
-        err_code = app_ble_gap_sec_context_create(conn_handle, &sec_tab_index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-        memcpy(&(m_app_keys_table[sec_tab_index].keyset), p_sec_keyset, sizeof(ble_gap_sec_keyset_t));
-    }
-
-    err_code = ble_gap_sec_params_reply_req_enc(conn_handle,
-                                                               sec_status,
-                                                               p_sec_params,
-                                                               p_sec_keyset,
-                                                               &(p_buffer[1]),
-                                                               &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_sec_params_reply_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gap_ppcp_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_ppcp_get_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_ppcp_get_rsp_dec(
-        p_buffer,
-        length,
-        m_output_params.gap_ppcp_get_out_params.
-        p_conn_params,
-        &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_ppcp_get(ble_gap_conn_params_t * const p_conn_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    m_output_params.gap_ppcp_get_out_params.p_conn_params = p_conn_params;
-
-    const uint32_t err_code = ble_gap_ppcp_get_req_enc(p_conn_params,
-                                                       &(p_buffer[1]),
-                                                       &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_ppcp_get_reply_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_address_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_address_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_address_get_rsp_dec(p_buffer,
-                                                          length,
-                                                          (ble_gap_addr_t *)mp_out_params[0],
-                                                          &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_address_get(ble_gap_addr_t * const p_addr)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_addr;
-
-    const uint32_t err_code = ble_gap_address_get_req_enc(p_addr,
-                                                          &(p_buffer[1]),
-                                                          &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-
-                                      gap_address_get_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_address_set BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_address_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_address_set_rsp_dec(p_buffer,
-                                                          length,
-                                                          &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_address_set(uint8_t addr_cycle_mode, ble_gap_addr_t const * const p_addr)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_address_set_req_enc(addr_cycle_mode,
-                                                          p_addr,
-                                                          &(p_buffer[1]),
-                                                          &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_address_set_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_adv_stop BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_adv_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_adv_stop_rsp_dec(p_buffer,
-                                                       length,
-                                                       &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_adv_stop(void)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_adv_stop_req_enc(&(p_buffer[1]),
-                                                       &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_adv_stop_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_auth_key_reply BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_auth_key_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_auth_key_reply_rsp_dec(p_buffer,
-                                                             length,
-                                                             &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_auth_key_reply(uint16_t              conn_handle,
-                                   uint8_t               key_type,
-                                   uint8_t const * const key)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_auth_key_reply_req_enc(conn_handle, key_type, key,
-                                                             &(p_buffer[1]), &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_auth_key_reply_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_authenticate BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_authenticate_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_authenticate_rsp_dec(p_buffer,
-                                                           length,
-                                                           &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_authenticate(uint16_t                           conn_handle,
-                                 ble_gap_sec_params_t const * const p_sec_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_authenticate_req_enc(conn_handle, p_sec_params,
-                                                           &(p_buffer[1]), &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_authenticate_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_conn_sec_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_conn_sec_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_conn_sec_get_rsp_dec(
-        p_buffer,
-        length,
-        (ble_gap_conn_sec_t * *)&mp_out_params[0
-        ],
-        &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t * const p_conn_sec)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_conn_sec;
-
-    const uint32_t err_code = ble_gap_conn_sec_get_req_enc(conn_handle, p_conn_sec,
-                                                           &(p_buffer[1]), &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_conn_sec_get_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_rssi_start BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_rssi_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_rssi_start_rsp_dec(p_buffer,
-                                                         length,
-                                                         &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_rssi_start_req_enc(conn_handle, 
-                                                         threshold_dbm, 
-                                                         skip_count,
-                                                         &(p_buffer[1]), &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_rssi_start_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_rssi_stop BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_rssi_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_rssi_stop_rsp_dec(p_buffer,
-                                                        length,
-                                                        &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_rssi_stop(uint16_t conn_handle)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_rssi_stop_req_enc(conn_handle,
-                                                        &(p_buffer[1]), &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_rssi_stop_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_tx_power_set BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_tx_power_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_tx_power_set_rsp_dec(p_buffer,
-                                                           length,
-                                                           &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_tx_power_set(int8_t tx_power)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_tx_power_set_req_enc(tx_power,
-                                                           &(p_buffer[1]), &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_tx_power_set_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_scan_stop BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_scan_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_scan_stop_rsp_dec(p_buffer,
-                                                       length,
-                                                       &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_scan_stop(void)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_scan_stop_req_enc(&(p_buffer[1]),
-                                                       &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_scan_stop_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_connect BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_connect_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_connect_rsp_dec(p_buffer,
-                                                      length,
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_connect(ble_gap_addr_t const * const        p_addr,
-                            ble_gap_scan_params_t const * const p_scan_params,
-                            ble_gap_conn_params_t const * const p_conn_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_connect_req_enc(p_addr,
-                                                      p_scan_params,
-                                                      p_conn_params,
-                                                      &(p_buffer[1]),
-                                                      &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_connect_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_connect_cancel BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_connect_cancel_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_connect_cancel_rsp_dec(p_buffer,
-                                                             length,
-                                                             &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_connect_cancel(void)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_connect_cancel_req_enc(&(p_buffer[1]),
-                                                             &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_connect_cancel_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_scan_start BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_scan_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_scan_start_rsp_dec(p_buffer,
-                                                         length,
-                                                         &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_scan_start(ble_gap_scan_params_t const * const p_scan_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_scan_start_req_enc(p_scan_params,
-                                                         &(p_buffer[1]),
-                                                         &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_scan_start_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_encrypt BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_encrypt_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_encrypt_rsp_dec(p_buffer,
-                                                      length,
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_encrypt( uint16_t                    conn_handle,
-                             ble_gap_master_id_t const * p_master_id,
-                             ble_gap_enc_info_t  const * p_enc_info)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_encrypt_req_enc( conn_handle, p_master_id, p_enc_info, &(p_buffer[1]), &buffer_length );
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_encrypt_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_rssi_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_rssi_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_rssi_get_rsp_dec(p_buffer,
-                                                      length,
-                                                      (int8_t *) mp_out_params[0],
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_rssi_get(uint16_t  conn_handle,
-                             int8_t  * p_rssi)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_rssi;
-
-    const uint32_t err_code = ble_gap_rssi_get_req_enc(conn_handle, p_rssi, &(p_buffer[1]), &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_rssi_get_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_keypress_notify BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_keypress_notify_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_keypress_notify_rsp_dec(p_buffer,
-                                                      length,
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_keypress_notify( uint16_t conn_handle, uint8_t kp_not)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_keypress_notify_req_enc( conn_handle, kp_not, &p_buffer[1], &buffer_length );
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_keypress_notify_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_lesc_dhkey_reply BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_lesc_dhkey_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_lesc_dhkey_reply_rsp_dec(p_buffer,
-                                                      length,
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_lesc_dhkey_reply( uint16_t conn_handle, ble_gap_lesc_dhkey_t const *p_dhkey)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_lesc_dhkey_reply_req_enc( conn_handle, p_dhkey, &(p_buffer[1]), &buffer_length );
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_lesc_dhkey_reply_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_lesc_oob_data_set BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_lesc_oob_data_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_lesc_oob_data_set_rsp_dec(p_buffer,
-                                                      length,
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_lesc_oob_data_set(uint16_t conn_handle,
-                                      ble_gap_lesc_oob_data_t const *p_oobd_own,
-                                      ble_gap_lesc_oob_data_t const *p_oobd_peer)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gap_lesc_oob_data_set_req_enc(conn_handle, p_oobd_own, p_oobd_peer,
-                                                                &(p_buffer[1]), &buffer_length );
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_lesc_oob_data_set_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gap_lesc_oob_data_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gap_lesc_oob_data_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = 0;
-
-    const uint32_t err_code = ble_gap_lesc_oob_data_get_rsp_dec(p_buffer,
-                                                      length,
-                                                      (ble_gap_lesc_oob_data_t **) &mp_out_params[0],
-                                                      &result_code);
-
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gap_lesc_oob_data_get(uint16_t                      conn_handle,
-                                      ble_gap_lesc_p256_pk_t const *p_pk_own,
-                                      ble_gap_lesc_oob_data_t      *p_oobd_own)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_oobd_own;
-    const uint32_t err_code = ble_gap_lesc_oob_data_get_req_enc(conn_handle, p_pk_own, p_oobd_own,
-                                                                &(p_buffer[1]), &buffer_length );
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gap_lesc_oob_data_get_rsp_dec);
-}

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/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c
deleted file mode 100644
index aed1fdf..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gattc.c
+++ /dev/null
@@ -1,467 +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.
- *
- */
-
-#include <stdint.h>
-#include "ble_gattc.h"
-#include "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "ser_sd_transport.h"
-#include "app_error.h"
-
-static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
-{
-    uint32_t err_code;
-
-    do
-    {
-        err_code = ser_sd_transport_tx_alloc(p_data, p_len);
-    }
-    while (err_code != NRF_SUCCESS);
-    *p_data[0] = SER_PKT_TYPE_CMD;
-    *p_len    -= 1;
-}
-/**@brief Command response callback function for @ref sd_ble_gattc_primary_services_discover BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_primary_services_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_primary_services_discover_rsp_dec(p_buffer,
-                                                                          length,
-                                                                          &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_primary_services_discover(uint16_t                 conn_handle,
-                                                uint16_t                 start_handle,
-                                                ble_uuid_t const * const p_srvc_uuid)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_primary_services_discover_req_enc(conn_handle,
-                                                                          start_handle,
-                                                                          p_srvc_uuid,
-                                                                          &(p_buffer[1]),
-                                                                          &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_primary_services_discover_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_relationships_discover BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_relationships_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_relationships_discover_rsp_dec(p_buffer,
-                                                                       length,
-                                                                       &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_relationships_discover(uint16_t                               conn_handle,
-                                             ble_gattc_handle_range_t const * const p_handle_range)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_relationships_discover_req_enc(conn_handle,
-                                                                       p_handle_range,
-                                                                       &(p_buffer[1]),
-                                                                       &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_relationships_discover_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_characteristics_discover BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_characteristics_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_characteristics_discover_rsp_dec(p_buffer,
-                                                                         length,
-                                                                         &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_characteristics_discover(
-    uint16_t conn_handle,
-    ble_gattc_handle_range_t const * const
-    p_handle_range)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_characteristics_discover_req_enc(conn_handle,
-                                                                         p_handle_range,
-                                                                         &(p_buffer[1]),
-                                                                         &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_characteristics_discover_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_descriptors_discover BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_descriptors_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_descriptors_discover_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_descriptors_discover(uint16_t                               conn_handle,
-                                           ble_gattc_handle_range_t const * const p_handle_range)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_descriptors_discover_req_enc(conn_handle,
-                                                                     p_handle_range,
-                                                                     &(p_buffer[1]),
-                                                                     &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_descriptors_discover_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_char_value_by_uuid_read BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_char_value_by_uuid_read_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_char_value_by_uuid_read_rsp_dec(p_buffer,
-                                                                        length,
-                                                                        &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_char_value_by_uuid_read(uint16_t                               conn_handle,
-                                              ble_uuid_t const * const               p_uuid,
-                                              ble_gattc_handle_range_t const * const p_handle_range)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_char_value_by_uuid_read_req_enc(conn_handle,
-                                                                        p_uuid,
-                                                                        p_handle_range,
-                                                                        &(p_buffer[1]),
-                                                                        &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_char_value_by_uuid_read_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_read BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_read_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_read_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_read(uint16_t conn_handle,
-                           uint16_t handle,
-                           uint16_t offset)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_read_req_enc(conn_handle,
-                                                     handle,
-                                                     offset,
-                                                     &(p_buffer[1]),
-                                                     &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_read_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_char_values_read BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_char_values_read_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_char_values_read_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_char_values_read(uint16_t               conn_handle,
-                                       uint16_t const * const p_handles,
-                                       uint16_t               handle_count)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_char_values_read_req_enc(conn_handle,
-                                                                 p_handles,
-                                                                 handle_count,
-                                                                 &(p_buffer[1]),
-                                                                 &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_char_values_read_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_write BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_write_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_write_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_write(uint16_t                               conn_handle,
-                            ble_gattc_write_params_t const * const p_write_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_write_req_enc(conn_handle,
-                                                      p_write_params,
-                                                      &(p_buffer[1]),
-                                                      &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_write_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gattc_hv_confirm BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_hv_confirm_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_hv_confirm_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_hv_confirm(uint16_t conn_handle,
-                                 uint16_t handle)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_hv_confirm_req_enc(conn_handle,
-                                                           handle,
-                                                           &(p_buffer[1]),
-                                                           &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_hv_confirm_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gattc_info_discover BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gattc_attr_info_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gattc_attr_info_discover_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ble_gattc_attr_info_discover(uint16_t                               conn_handle,
-                                        ble_gattc_handle_range_t const * const p_handle_range)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gattc_attr_info_discover_req_enc(conn_handle,
-                                                                   p_handle_range,
-                                                                   &(p_buffer[1]),
-                                                                   &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gattc_attr_info_discover_rsp_dec);
-}


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

Posted by cc...@apache.org.
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/hal/nrf_pwm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h
deleted file mode 100644
index 8fc4bbb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pwm.h
+++ /dev/null
@@ -1,669 +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.
- *
- */
-
-/**
- * @defgroup nrf_pwm_hal PWM HAL
- * @{
- * @ingroup nrf_pwm
- *
- * @brief @tagAPI52 Hardware access layer for managing the Pulse Width Modulation (PWM)
- *        peripheral.
- */
-
-#ifndef NRF_PWM_H__
-#define NRF_PWM_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-#include "nrf_assert.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This value can be provided as a parameter for the @ref nrf_pwm_pins_set
- *        function call to specify that a given output channel shall not be
- *        connected to a physical pin.
- */
-#define NRF_PWM_PIN_NOT_CONNECTED   0xFFFFFFFF
-
-/**
- * @brief Number of channels in each PWM instance.
- */
-#define NRF_PWM_CHANNEL_COUNT   4
-
-
-/**
- * @brief PWM tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_PWM_TASK_STOP      = offsetof(NRF_PWM_Type, TASKS_STOP),        ///< Stops PWM pulse generation on all channels at the end of the current PWM period, and stops the sequence playback.
-    NRF_PWM_TASK_SEQSTART0 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[0]), ///< Starts playback of sequence 0.
-    NRF_PWM_TASK_SEQSTART1 = offsetof(NRF_PWM_Type, TASKS_SEQSTART[1]), ///< Starts playback of sequence 1.
-    NRF_PWM_TASK_NEXTSTEP  = offsetof(NRF_PWM_Type, TASKS_NEXTSTEP)     ///< Steps by one value in the current sequence if the decoder is set to @ref NRF_PWM_STEP_TRIGGERED mode.
-    /*lint -restore*/
-} nrf_pwm_task_t;
-
-/**
- * @brief PWM events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_PWM_EVENT_STOPPED      = offsetof(NRF_PWM_Type, EVENTS_STOPPED),       ///< Response to STOP task, emitted when PWM pulses are no longer generated.
-    NRF_PWM_EVENT_SEQSTARTED0  = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[0]), ///< First PWM period started on sequence 0.
-    NRF_PWM_EVENT_SEQSTARTED1  = offsetof(NRF_PWM_Type, EVENTS_SEQSTARTED[1]), ///< First PWM period started on sequence 1.
-    NRF_PWM_EVENT_SEQEND0      = offsetof(NRF_PWM_Type, EVENTS_SEQEND[0]),     ///< Emitted at the end of every sequence 0 when its last value has been read from RAM.
-    NRF_PWM_EVENT_SEQEND1      = offsetof(NRF_PWM_Type, EVENTS_SEQEND[1]),     ///< Emitted at the end of every sequence 1 when its last value has been read from RAM.
-    NRF_PWM_EVENT_PWMPERIODEND = offsetof(NRF_PWM_Type, EVENTS_PWMPERIODEND),  ///< Emitted at the end of each PWM period.
-    NRF_PWM_EVENT_LOOPSDONE    = offsetof(NRF_PWM_Type, EVENTS_LOOPSDONE)      ///< Concatenated sequences have been played the requested number of times.
-    /*lint -restore*/
-} nrf_pwm_event_t;
-
-/**
- * @brief PWM interrupts.
- */
-typedef enum
-{
-    NRF_PWM_INT_STOPPED_MASK      = PWM_INTENSET_STOPPED_Msk,      ///< Interrupt on STOPPED event.
-    NRF_PWM_INT_SEQSTARTED0_MASK  = PWM_INTENSET_SEQSTARTED0_Msk,  ///< Interrupt on SEQSTARTED[0] event.
-    NRF_PWM_INT_SEQSTARTED1_MASK  = PWM_INTENSET_SEQSTARTED1_Msk,  ///< Interrupt on SEQSTARTED[1] event.
-    NRF_PWM_INT_SEQEND0_MASK      = PWM_INTENSET_SEQEND0_Msk,      ///< Interrupt on SEQEND[0] event.
-    NRF_PWM_INT_SEQEND1_MASK      = PWM_INTENSET_SEQEND1_Msk,      ///< Interrupt on SEQEND[1] event.
-    NRF_PWM_INT_PWMPERIODEND_MASK = PWM_INTENSET_PWMPERIODEND_Msk, ///< Interrupt on PWMPERIODEND event.
-    NRF_PWM_INT_LOOPSDONE_MASK    = PWM_INTENSET_LOOPSDONE_Msk     ///< Interrupt on LOOPSDONE event.
-} nrf_pwm_int_mask_t;
-
-/**
- * @brief PWM shortcuts.
- */
-typedef enum
-{
-    NRF_PWM_SHORT_SEQEND0_STOP_MASK        = PWM_SHORTS_SEQEND0_STOP_Msk,        ///< Shortcut between SEQEND[0] event and STOP task.
-    NRF_PWM_SHORT_SEQEND1_STOP_MASK        = PWM_SHORTS_SEQEND1_STOP_Msk,        ///< Shortcut between SEQEND[1] event and STOP task.
-    NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART0_Msk, ///< Shortcut between LOOPSDONE event and SEQSTART[0] task.
-    NRF_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK = PWM_SHORTS_LOOPSDONE_SEQSTART1_Msk, ///< Shortcut between LOOPSDONE event and SEQSTART[1] task.
-    NRF_PWM_SHORT_LOOPSDONE_STOP_MASK      = PWM_SHORTS_LOOPSDONE_STOP_Msk       ///< Shortcut between LOOPSDONE event and STOP task.
-} nrf_pwm_short_mask_t;
-
-/**
- * @brief PWM modes of operation.
- */
-typedef enum
-{
-    NRF_PWM_MODE_UP          = PWM_MODE_UPDOWN_Up,        ///< Up counter (edge-aligned PWM duty cycle).
-    NRF_PWM_MODE_UP_AND_DOWN = PWM_MODE_UPDOWN_UpAndDown, ///< Up and down counter (center-aligned PWM duty cycle).
-} nrf_pwm_mode_t;
-
-/**
- * @brief PWM base clock frequencies.
- */
-typedef enum
-{
-    NRF_PWM_CLK_16MHz  = PWM_PRESCALER_PRESCALER_DIV_1,  ///< 16 MHz / 1 = 16 MHz.
-    NRF_PWM_CLK_8MHz   = PWM_PRESCALER_PRESCALER_DIV_2,  ///< 16 MHz / 2 = 8 MHz.
-    NRF_PWM_CLK_4MHz   = PWM_PRESCALER_PRESCALER_DIV_4,  ///< 16 MHz / 4 = 4 MHz.
-    NRF_PWM_CLK_2MHz   = PWM_PRESCALER_PRESCALER_DIV_8,  ///< 16 MHz / 8 = 2 MHz.
-    NRF_PWM_CLK_1MHz   = PWM_PRESCALER_PRESCALER_DIV_16, ///< 16 MHz / 16 = 1 MHz.
-    NRF_PWM_CLK_500kHz = PWM_PRESCALER_PRESCALER_DIV_32, ///< 16 MHz / 32 = 500 kHz.
-    NRF_PWM_CLK_250kHz = PWM_PRESCALER_PRESCALER_DIV_64, ///< 16 MHz / 64 = 250 kHz.
-    NRF_PWM_CLK_125kHz = PWM_PRESCALER_PRESCALER_DIV_128 ///< 16 MHz / 128 = 125 kHz.
-} nrf_pwm_clk_t;
-
-/**
- * @brief PWM decoder load modes.
- *
- * The selected mode determines how the sequence data is read from RAM and
- * spread to the compare registers.
- */
-typedef enum
-{
-    NRF_PWM_LOAD_COMMON     = PWM_DECODER_LOAD_Common,     ///< 1st half word (16-bit) used in all PWM channels (0-3).
-    NRF_PWM_LOAD_GROUPED    = PWM_DECODER_LOAD_Grouped,    ///< 1st half word (16-bit) used in channels 0 and 1; 2nd word in channels 2 and 3.
-    NRF_PWM_LOAD_INDIVIDUAL = PWM_DECODER_LOAD_Individual, ///< 1st half word (16-bit) used in channel 0; 2nd in channel 1; 3rd in channel 2; 4th in channel 3.
-    NRF_PWM_LOAD_WAVE_FORM  = PWM_DECODER_LOAD_WaveForm    ///< 1st half word (16-bit) used in channel 0; 2nd in channel 1; ... ; 4th as the top value for the pulse generator counter.
-} nrf_pwm_dec_load_t;
-
-/**
- * @brief PWM decoder next step modes.
- *
- * The selected mode determines when the next value from the active sequence
- * is loaded.
- */
-typedef enum
-{
-    NRF_PWM_STEP_AUTO      = PWM_DECODER_MODE_RefreshCount, ///< Automatically after the current value is played and repeated the requested number of times.
-    NRF_PWM_STEP_TRIGGERED = PWM_DECODER_MODE_NextStep      ///< When the @ref NRF_PWM_TASK_NEXTSTEP task is triggered.
-} nrf_pwm_dec_step_t;
-
-
-/**
- * @brief Type used for defining duty cycle values for a sequence
- *        loaded in @ref NRF_PWM_LOAD_COMMON mode.
- */
-typedef uint16_t nrf_pwm_values_common_t;
-
-/**
- * @brief Structure for defining duty cycle values for a sequence
- *        loaded in @ref NRF_PWM_LOAD_GROUPED mode.
- */
-typedef struct {
-    uint16_t group_0; ///< Duty cycle value for group 0 (channels 0 and 1).
-    uint16_t group_1; ///< Duty cycle value for group 1 (channels 2 and 3).
-} nrf_pwm_values_grouped_t;
-
-/**
- * @brief Structure for defining duty cycle values for a sequence
- *        loaded in @ref NRF_PWM_LOAD_INDIVIDUAL mode.
- */
-typedef struct
-{
-    uint16_t channel_0; ///< Duty cycle value for channel 0.
-    uint16_t channel_1; ///< Duty cycle value for channel 1.
-    uint16_t channel_2; ///< Duty cycle value for channel 2.
-    uint16_t channel_3; ///< Duty cycle value for channel 3.
-} nrf_pwm_values_individual_t;
-
-/**
- * @brief Structure for defining duty cycle values for a sequence
- *        loaded in @ref NRF_PWM_LOAD_WAVE_FORM mode.
- */
-typedef struct {
-    uint16_t channel_0;   ///< Duty cycle value for channel 0.
-    uint16_t channel_1;   ///< Duty cycle value for channel 1.
-    uint16_t channel_2;   ///< Duty cycle value for channel 2.
-    uint16_t counter_top; ///< Top value for the pulse generator counter.
-} nrf_pwm_values_wave_form_t;
-
-/**
- * @brief Union grouping pointers to arrays of duty cycle values applicable to
- *        various loading modes.
- */
-typedef union {
-    nrf_pwm_values_common_t     const * p_common;     ///< Pointer to be used in @ref NRF_PWM_LOAD_COMMON mode.
-    nrf_pwm_values_grouped_t    const * p_grouped;    ///< Pointer to be used in @ref NRF_PWM_LOAD_GROUPED mode.
-    nrf_pwm_values_individual_t const * p_individual; ///< Pointer to be used in @ref NRF_PWM_LOAD_INDIVIDUAL mode.
-    nrf_pwm_values_wave_form_t  const * p_wave_form;  ///< Pointer to be used in @ref NRF_PWM_LOAD_WAVE_FORM mode.
-    uint16_t                    const * p_raw;        ///< Pointer providing raw access to the values.
-} nrf_pwm_values_t;
-
-/**
- * @brief Structure for defining a sequence of PWM duty cycles.
- *
- * When the sequence is set (by a call to @ref nrf_pwm_sequence_set), the
- * provided duty cycle values are not copied. The @p values pointer is stored
- * in the peripheral's internal register, and the values are loaded from RAM
- * during the sequence playback. Therefore, you must ensure that the values
- * do not change before and during the sequence playback (for example,
- * the values cannot be placed in a local variable that is allocated on stack).
- * If the sequence is played in a loop and the values should be updated
- * before the next iteration, it is safe to modify them when the corresponding
- * event signaling the end of sequence occurs (@ref NRF_PWM_EVENT_SEQEND0
- * or @ref NRF_PWM_EVENT_SEQEND1, respectively).
- *
- * @note The @p repeats and @p end_delay values (which are written to the
- *       SEQ[n].REFRESH and SEQ[n].ENDDELAY registers in the peripheral,
- *       respectively) are ignored at the end of a complex sequence
- *       playback, indicated by the LOOPSDONE event.
- *       See the @linkProductSpecification52 for more information.
- */
-typedef struct
-{
-    nrf_pwm_values_t values; ///< Pointer to an array with duty cycle values. This array must be in Data RAM.
-                             /**< This field is defined as an union of pointers
-                              *   to provide a convenient way to define duty
-                              *   cycle values in various loading modes
-                              *   (see @ref nrf_pwm_dec_load_t).
-                              *   In each value, the most significant bit (15)
-                              *   determines the polarity of the output and the
-                              *   others (14-0) compose the 15-bit value to be
-                              *   compared with the pulse generator counter. */
-    uint16_t length;    ///< Number of 16-bit values in the array pointed by @p values.
-    uint32_t repeats;   ///< Number of times that each duty cycle should be repeated (after being played once). Ignored in @ref NRF_PWM_STEP_TRIGGERED mode.
-    uint32_t end_delay; ///< Additional time (in PWM periods) that the last duty cycle is to be kept after the sequence is played. Ignored in @ref NRF_PWM_STEP_TRIGGERED mode.
-} nrf_pwm_sequence_t;
-
-/**
- * @brief Helper macro for calculating the number of 16-bit values in specified
- *        array of duty cycle values.
- */
-#define NRF_PWM_VALUES_LENGTH(array)  (sizeof(array)/sizeof(uint16_t))
-
-
-/**
- * @brief Function for activating a specific PWM task.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] task  Task to activate.
- */
-__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm,
-                                          nrf_pwm_task_t task);
-
-/**
- * @brief Function for getting the address of a specific PWM task register.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] task  Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm,
-                                                  nrf_pwm_task_t task);
-
-/**
- * @brief Function for clearing a specific PWM event.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] event Event to clear.
- */
-__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm,
-                                         nrf_pwm_event_t event);
-
-/**
- * @brief Function for checking the state of a specific PWM event.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] event Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_pwm,
-                                         nrf_pwm_event_t event);
-
-/**
- * @brief Function for getting the address of a specific PWM event register.
- *
- * @param[in] p_pwm PWM instance.
- * @param[in] event Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm,
-                                                   nrf_pwm_event_t event);
-
-/**
- * @brief Function for enabling specified shortcuts.
- *
- * @param[in] p_pwm           PWM instance.
- * @param[in] pwm_shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm,
-                                           uint32_t pwm_shorts_mask);
-
-/**
- * @brief Function for disabling specified shortcuts.
- *
- * @param[in] p_pwm           PWM instance.
- * @param[in] pwm_shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm,
-                                            uint32_t pwm_shorts_mask);
-
-/**
- * @brief Function for setting the configuration of PWM shortcuts.
- *
- * @param[in] p_pwm           PWM instance.
- * @param[in] pwm_shorts_mask Shortcuts configuration to set.
- */
-__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm,
-                                        uint32_t pwm_shorts_mask);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_pwm        PWM instance.
- * @param[in] pwm_int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm,
-                                        uint32_t pwm_int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_pwm        PWM instance.
- * @param[in] pwm_int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm,
-                                         uint32_t pwm_int_mask);
-
-/**
- * @brief Function for setting the configuration of PWM interrupts.
- *
- * @param[in] p_pwm        PWM instance.
- * @param[in] pwm_int_mask Interrupts configuration to set.
- */
-__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm,
-                                     uint32_t pwm_int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_pwm   PWM instance.
- * @param[in] pwm_int Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm,
-                                              nrf_pwm_int_mask_t pwm_int);
-
-/**
- * @brief Function for enabling the PWM peripheral.
- *
- * @param[in] p_pwm PWM instance.
- */
-__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm);
-
-/**
- * @brief Function for disabling the PWM peripheral.
- *
- * @param[in] p_pwm PWM instance.
- */
-__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm);
-
-/**
- * @brief Function for assigning pins to PWM output channels.
- *
- * Usage of all PWM output channels is optional. If a given channel is not
- * needed, pass the @ref NRF_PWM_PIN_NOT_CONNECTED value instead of its pin
- * number.
- *
- * @param[in] p_pwm    PWM instance.
- * @param[in] out_pins Array with pin numbers for individual PWM output channels.
- */
-__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm,
-                                      uint32_t out_pins[NRF_PWM_CHANNEL_COUNT]);
-
-/**
- * @brief Function for configuring the PWM peripheral.
- *
- * @param[in] p_pwm      PWM instance.
- * @param[in] base_clock Base clock frequency.
- * @param[in] mode       Operating mode of the pulse generator counter.
- * @param[in] top_value  Value up to which the pulse generator counter counts.
- */
-__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm,
-                                       nrf_pwm_clk_t  base_clock,
-                                       nrf_pwm_mode_t mode,
-                                       uint16_t       top_value);
-
-/**
- * @brief Function for defining a sequence of PWM duty cycles.
- *
- * @param[in] p_pwm  PWM instance.
- * @param[in] seq_id Identifier of the sequence (0 or 1).
- * @param[in] p_seq  Pointer to the sequence definition.
- */
-__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm,
-                                          uint8_t                    seq_id,
-                                          nrf_pwm_sequence_t const * p_seq);
-
-/**
- * @brief Function for modifying the pointer to the duty cycle values
- *        in the specified sequence.
- *
- * @param[in] p_pwm    PWM instance.
- * @param[in] seq_id   Identifier of the sequence (0 or 1).
- * @param[in] p_values Pointer to an array with duty cycle values.
- */
-__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm,
-                                         uint8_t          seq_id,
-                                         uint16_t const * p_values);
-
-/**
- * @brief Function for modifying the total number of duty cycle values
- *        in the specified sequence.
- *
- * @param[in] p_pwm  PWM instance.
- * @param[in] seq_id Identifier of the sequence (0 or 1).
- * @param[in] length Number of duty cycle values.
- */
-__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm,
-                                         uint8_t  seq_id,
-                                         uint16_t length);
-
-/**
- * @brief Function for modifying the additional number of PWM periods spent
- *        on each duty cycle value in the specified sequence.
- *
- * @param[in] p_pwm   PWM instance.
- * @param[in] seq_id  Identifier of the sequence (0 or 1).
- * @param[in] refresh Number of additional PWM periods for each duty cycle value.
- */
-__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm,
-                                             uint8_t  seq_id,
-                                             uint32_t refresh);
-
-/**
- * @brief Function for modifying the additional time added after the sequence
- *        is played.
- *
- * @param[in] p_pwm     PWM instance.
- * @param[in] seq_id    Identifier of the sequence (0 or 1).
- * @param[in] end_delay Number of PWM periods added at the end of the sequence.
- */
-__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm,
-                                               uint8_t  seq_id,
-                                               uint32_t end_delay);
-
-/**
- * @brief Function for setting the mode of loading sequence data from RAM
- *        and advancing the sequence.
- *
- * @param[in] p_pwm    PWM instance.
- * @param[in] dec_load Mode of loading sequence data from RAM.
- * @param[in] dec_step Mode of advancing the active sequence.
- */
-__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm,
-                                         nrf_pwm_dec_load_t dec_load,
-                                         nrf_pwm_dec_step_t dec_step);
-
-/**
- * @brief Function for setting the number of times the sequence playback
- *        should be performed.
- *
- * This function applies to two-sequence playback (concatenated sequence 0 and 1).
- * A single sequence can be played back only once.
- *
- * @param[in] p_pwm      PWM instance.
- * @param[in] loop_count Number of times to perform the sequence playback.
- */
-__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm,
-                                      uint16_t loop_count);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_pwm_task_trigger(NRF_PWM_Type * p_pwm,
-                                          nrf_pwm_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_pwm_task_address_get(NRF_PWM_Type const * p_pwm,
-                                                  nrf_pwm_task_t task)
-{
-    return ((uint32_t)p_pwm + (uint32_t)task);
-}
-
-__STATIC_INLINE void nrf_pwm_event_clear(NRF_PWM_Type * p_pwm,
-                                         nrf_pwm_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_pwm_event_check(NRF_PWM_Type const * p_pwm,
-                                         nrf_pwm_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_pwm + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t nrf_pwm_event_address_get(NRF_PWM_Type const * p_pwm,
-                                                   nrf_pwm_event_t event)
-{
-    return ((uint32_t)p_pwm + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_pwm_shorts_enable(NRF_PWM_Type * p_pwm,
-                                           uint32_t pwm_shorts_mask)
-{
-    p_pwm->SHORTS |= pwm_shorts_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_shorts_disable(NRF_PWM_Type * p_pwm,
-                                            uint32_t pwm_shorts_mask)
-{
-    p_pwm->SHORTS &= ~(pwm_shorts_mask);
-}
-
-__STATIC_INLINE void nrf_pwm_shorts_set(NRF_PWM_Type * p_pwm,
-                                        uint32_t pwm_shorts_mask)
-{
-    p_pwm->SHORTS = pwm_shorts_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_int_enable(NRF_PWM_Type * p_pwm,
-                                        uint32_t pwm_int_mask)
-{
-    p_pwm->INTENSET = pwm_int_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_int_disable(NRF_PWM_Type * p_pwm,
-                                         uint32_t pwm_int_mask)
-{
-    p_pwm->INTENCLR = pwm_int_mask;
-}
-
-__STATIC_INLINE void nrf_pwm_int_set(NRF_PWM_Type * p_pwm,
-                                     uint32_t pwm_int_mask)
-{
-    p_pwm->INTEN = pwm_int_mask;
-}
-
-__STATIC_INLINE bool nrf_pwm_int_enable_check(NRF_PWM_Type const * p_pwm,
-                                              nrf_pwm_int_mask_t pwm_int)
-{
-    return (bool)(p_pwm->INTENSET & pwm_int);
-}
-
-__STATIC_INLINE void nrf_pwm_enable(NRF_PWM_Type * p_pwm)
-{
-    p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Enabled << PWM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_pwm_disable(NRF_PWM_Type * p_pwm)
-{
-    p_pwm->ENABLE = (PWM_ENABLE_ENABLE_Disabled << PWM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_pwm_pins_set(NRF_PWM_Type * p_pwm,
-                                      uint32_t out_pins[NRF_PWM_CHANNEL_COUNT])
-{
-    uint8_t i;
-    for (i = 0; i < NRF_PWM_CHANNEL_COUNT; ++i)
-    {
-        p_pwm->PSEL.OUT[i] = out_pins[i];
-    }
-}
-
-__STATIC_INLINE void nrf_pwm_configure(NRF_PWM_Type * p_pwm,
-                                       nrf_pwm_clk_t  base_clock,
-                                       nrf_pwm_mode_t mode,
-                                       uint16_t       top_value)
-{
-    ASSERT(top_value <= PWM_COUNTERTOP_COUNTERTOP_Msk);
-
-    p_pwm->PRESCALER  = base_clock;
-    p_pwm->MODE       = mode;
-    p_pwm->COUNTERTOP = top_value;
-}
-
-__STATIC_INLINE void nrf_pwm_sequence_set(NRF_PWM_Type * p_pwm,
-                                          uint8_t                    seq_id,
-                                          nrf_pwm_sequence_t const * p_seq)
-{
-    ASSERT(p_seq != NULL);
-
-    nrf_pwm_seq_ptr_set(      p_pwm, seq_id, p_seq->values.p_raw);
-    nrf_pwm_seq_cnt_set(      p_pwm, seq_id, p_seq->length);
-    nrf_pwm_seq_refresh_set(  p_pwm, seq_id, p_seq->repeats);
-    nrf_pwm_seq_end_delay_set(p_pwm, seq_id, p_seq->end_delay);
-}
-
-__STATIC_INLINE void nrf_pwm_seq_ptr_set(NRF_PWM_Type * p_pwm,
-                                         uint8_t          seq_id,
-                                         uint16_t const * p_values)
-{
-    ASSERT(seq_id <= 1);
-    ASSERT(p_values != NULL);
-    p_pwm->SEQ[seq_id].PTR = (uint32_t)p_values;
-}
-
-__STATIC_INLINE void nrf_pwm_seq_cnt_set(NRF_PWM_Type * p_pwm,
-                                         uint8_t  seq_id,
-                                         uint16_t length)
-{
-    ASSERT(seq_id <= 1);
-    ASSERT(length != 0);
-    ASSERT(length <= PWM_SEQ_CNT_CNT_Msk);
-    p_pwm->SEQ[seq_id].CNT = length;
-}
-
-__STATIC_INLINE void nrf_pwm_seq_refresh_set(NRF_PWM_Type * p_pwm,
-                                             uint8_t  seq_id,
-                                             uint32_t refresh)
-{
-    ASSERT(seq_id <= 1);
-    ASSERT(refresh <= PWM_SEQ_REFRESH_CNT_Msk);
-    p_pwm->SEQ[seq_id].REFRESH  = refresh;
-}
-
-__STATIC_INLINE void nrf_pwm_seq_end_delay_set(NRF_PWM_Type * p_pwm,
-                                               uint8_t  seq_id,
-                                               uint32_t end_delay)
-{
-    ASSERT(seq_id <= 1);
-    ASSERT(end_delay <= PWM_SEQ_ENDDELAY_CNT_Msk);
-    p_pwm->SEQ[seq_id].ENDDELAY = end_delay;
-}
-
-__STATIC_INLINE void nrf_pwm_decoder_set(NRF_PWM_Type * p_pwm,
-                                         nrf_pwm_dec_load_t dec_load,
-                                         nrf_pwm_dec_step_t dec_step)
-{
-    p_pwm->DECODER = ((uint32_t)dec_load << PWM_DECODER_LOAD_Pos) |
-                     ((uint32_t)dec_step << PWM_DECODER_MODE_Pos);
-}
-
-__STATIC_INLINE void nrf_pwm_loop_set(NRF_PWM_Type * p_pwm,
-                                      uint16_t loop_count)
-{
-    p_pwm->LOOP = loop_count;
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_PWM_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/hal/nrf_qdec.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_qdec.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_qdec.h
deleted file mode 100644
index 499df98..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_qdec.h
+++ /dev/null
@@ -1,476 +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.
- *
- */
-#ifndef NRF_QDEC_H__
-#define NRF_QDEC_H__
-
-#include <stddef.h>
-#include "nrf_error.h"
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*lint ++flb "Enter library region" */
-
-/**
- * @defgroup nrf_qdec_hal QDEC HAL
- * @{
- * @ingroup nrf_qdec
- * @brief Hardware access layer for accessing the quadrature decoder (QDEC) peripheral.
- */
-
-/**
- * @enum nrf_qdec_task_t
- * @brief QDEC tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_QDEC_TASK_START      = offsetof(NRF_QDEC_Type, TASKS_START),     /**< Starting the quadrature decoder. */
-    NRF_QDEC_TASK_STOP       = offsetof(NRF_QDEC_Type, TASKS_STOP),      /**< Stopping the quadrature decoder. */
-    NRF_QDEC_TASK_READCLRACC = offsetof(NRF_QDEC_Type, TASKS_READCLRACC) /**< Reading and clearing ACC and ACCDBL registers. */
-} nrf_qdec_task_t;
-
-/**
- * @enum nrf_qdec_event_t
- * @brief QDEC events.
- */
-typedef enum
-{
-    NRF_QDEC_EVENT_SAMPLERDY = offsetof(NRF_QDEC_Type, EVENTS_SAMPLERDY), /**< Event generated for every new sample.  */
-    NRF_QDEC_EVENT_REPORTRDY = offsetof(NRF_QDEC_Type, EVENTS_REPORTRDY), /**< Event generated for every new report.  */
-    NRF_QDEC_EVENT_ACCOF     = offsetof(NRF_QDEC_Type, EVENTS_ACCOF)      /**< Event generated for every accumulator overflow. */
-} nrf_qdec_event_t;                                                       /*lint -restore */
-
-/**
- * @enum nrf_qdec_short_mask_t
- * @brief QDEC shortcuts.
- */
-typedef enum
-{
-    NRF_QDEC_SHORT_REPORTRDY_READCLRACC_MASK = QDEC_SHORTS_REPORTRDY_READCLRACC_Msk, /**< Shortcut between REPORTRDY event and READCLRACC task.  */
-    NRF_QDEC_SHORT_SAMPLERDY_STOP_MASK       = QDEC_SHORTS_SAMPLERDY_STOP_Msk        /**< Shortcut between SAMPLERDY event and STOP task.  */
-} nrf_qdec_short_mask_t;
-
-/**
- * @enum nrf_qdec_int_mask_t
- * @brief QDEC interrupts.
- */
-typedef enum
-{
-    NRF_QDEC_INT_SAMPLERDY_MASK = QDEC_INTENSET_SAMPLERDY_Msk, /**< Mask for enabling or disabling an interrupt on SAMPLERDY event.  */
-    NRF_QDEC_INT_REPORTRDY_MASK = QDEC_INTENSET_REPORTRDY_Msk, /**< Mask for enabling or disabling an interrupt on REPORTRDY event.  */
-    NRF_QDEC_INT_ACCOF_MASK     = QDEC_INTENSET_ACCOF_Msk      /**< Mask for enabling or disabling an interrupt on ACCOF event.  */
-} nrf_qdec_int_mask_t;
-
-/**
- * @enum nrf_qdec_enable_t
- * @brief States of the enable bit.
- */
-typedef enum
-{
-    NRF_QDEC_DISABLE = QDEC_ENABLE_ENABLE_Disabled, /**< Mask for disabling the QDEC periperal. When disabled, the QDEC decoder pins are not active.  */
-    NRF_QDEC_ENABLE  = QDEC_ENABLE_ENABLE_Enabled   /**< Mask for enabling the QDEC periperal. When enabled, the QDEC pins are active. */
-} nrf_qdec_enable_t;
-
-
-/**
- * @enum nrf_qdec_dbfen_t
- * @brief States of the debounce filter enable bit.
- */
-typedef enum
-{
-    NRF_QDEC_DBFEN_DISABLE = QDEC_DBFEN_DBFEN_Disabled, /**< Mask for disabling the debounce filter.  */
-    NRF_QDEC_DBFEN_ENABLE  = QDEC_DBFEN_DBFEN_Enabled   /**< Mask for enabling the debounce filter.  */
-} nrf_qdec_dbfen_t;
-
-/**
- * @enum nrf_qdec_ledpol_t
- * @brief Active LED polarity.
- */
-typedef enum
-{
-    NRF_QDEC_LEPOL_ACTIVE_LOW  = QDEC_LEDPOL_LEDPOL_ActiveLow, /**< QDEC LED active on output pin low.  */
-    NRF_QDEC_LEPOL_ACTIVE_HIGH = QDEC_LEDPOL_LEDPOL_ActiveHigh /**< QDEC LED active on output pin high.  */
-} nrf_qdec_ledpol_t;
-
-
-/**
- * @enum nrf_qdec_sampleper_t
- * @brief Available sampling periods.
- */
-typedef enum
-{
-    NRF_QDEC_SAMPLEPER_128us   = QDEC_SAMPLEPER_SAMPLEPER_128us,  /**< QDEC sampling period 128 microseconds.  */
-    NRF_QDEC_SAMPLEPER_256us   = QDEC_SAMPLEPER_SAMPLEPER_256us,  /**< QDEC sampling period 256 microseconds.  */
-    NRF_QDEC_SAMPLEPER_512us   = QDEC_SAMPLEPER_SAMPLEPER_512us,  /**< QDEC sampling period 512 microseconds.  */
-    NRF_QDEC_SAMPLEPER_1024us  = QDEC_SAMPLEPER_SAMPLEPER_1024us, /**< QDEC sampling period 1024 microseconds.  */
-    NRF_QDEC_SAMPLEPER_2048us  = QDEC_SAMPLEPER_SAMPLEPER_2048us, /**< QDEC sampling period 2048 microseconds.  */
-    NRF_QDEC_SAMPLEPER_4096us  = QDEC_SAMPLEPER_SAMPLEPER_4096us, /**< QDEC sampling period 4096 microseconds.  */
-    NRF_QDEC_SAMPLEPER_8192us  = QDEC_SAMPLEPER_SAMPLEPER_8192us, /**< QDEC sampling period 8192 microseconds.  */
-    NRF_QDEC_SAMPLEPER_16384us = QDEC_SAMPLEPER_SAMPLEPER_16384us /**< QDEC sampling period 16384 microseconds.  */
-} nrf_qdec_sampleper_t;
-
-/**
- * @enum nrf_qdec_reportper_t
- * @brief Available report periods.
- */
-typedef enum
-{
-    NRF_QDEC_REPORTPER_10  = QDEC_REPORTPER_REPORTPER_10Smpl,  /**< QDEC report period 10 samples.  */
-    NRF_QDEC_REPORTPER_40  = QDEC_REPORTPER_REPORTPER_40Smpl,  /**< QDEC report period 40 samples.  */
-    NRF_QDEC_REPORTPER_80  = QDEC_REPORTPER_REPORTPER_80Smpl,  /**< QDEC report period 80 samples.  */
-    NRF_QDEC_REPORTPER_120 = QDEC_REPORTPER_REPORTPER_120Smpl, /**< QDEC report period 120 samples. */
-    NRF_QDEC_REPORTPER_160 = QDEC_REPORTPER_REPORTPER_160Smpl, /**< QDEC report period 160 samples. */
-    NRF_QDEC_REPORTPER_200 = QDEC_REPORTPER_REPORTPER_200Smpl, /**< QDEC report period 200 samples. */
-    NRF_QDEC_REPORTPER_240 = QDEC_REPORTPER_REPORTPER_240Smpl, /**< QDEC report period 240 samples. */
-    NRF_QDEC_REPORTPER_280 = QDEC_REPORTPER_REPORTPER_280Smpl, /**< QDEC report period 280 samples. */
-    NRF_QDEC_REPORTPER_DISABLED                                /**< QDEC reporting disabled.        */
-} nrf_qdec_reportper_t;
-
-/**
- * @brief Function for enabling QDEC.
- */
-__STATIC_INLINE void nrf_qdec_enable(void)
-{
-    NRF_QDEC->ENABLE = NRF_QDEC_ENABLE;
-}
-
-
-/**
- * @brief Function for disabling QDEC.
- */
-__STATIC_INLINE void nrf_qdec_disable(void)
-{
-    NRF_QDEC->ENABLE = NRF_QDEC_DISABLE;
-}
-
-
-/**
- * @brief Function for returning the enable state of QDEC.
- * @return State of the register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_enable_get(void)
-{
-    return NRF_QDEC->ENABLE;
-}
-
-
-/**
- * @brief Function for enabling QDEC interrupts by mask.
- * @param[in] qdec_int_mask Sources of the interrupts to enable.
- */
-__STATIC_INLINE void nrf_qdec_int_enable(uint32_t qdec_int_mask)
-{
-    NRF_QDEC->INTENSET = qdec_int_mask; // writing 0 has no effect
-}
-
-
-/**
- * @brief Function for disabling QDEC interrupts by mask.
- * @param[in] qdec_int_mask Sources of the interrupts to disable.
- *
- */
-__STATIC_INLINE void nrf_qdec_int_disable(uint32_t qdec_int_mask)
-{
-    NRF_QDEC->INTENCLR = qdec_int_mask; // writing 0 has no effect
-}
-
-
-/**
- * @brief Function for getting the enabled interrupts of the QDEC.
- */
-__STATIC_INLINE uint32_t nrf_qdec_int_enable_check(nrf_qdec_int_mask_t qdec_int_mask)
-{
-    return NRF_QDEC->INTENSET & qdec_int_mask; // when read this register will return the value of INTEN.
-}
-
-
-/**
- * @brief Function for enabling the debouncing filter of the QED.
- */
-__STATIC_INLINE void nrf_qdec_dbfen_enable(void)
-{
-    NRF_QDEC->DBFEN = NRF_QDEC_DBFEN_ENABLE;
-}
-
-
-/**
- * @brief Function for disabling the debouncing filter of the QED.
- */
-__STATIC_INLINE void nrf_qdec_dbfen_disable(void)
-{
-    NRF_QDEC->DBFEN = NRF_QDEC_DBFEN_DISABLE;
-}
-
-
-/**
- * @brief Function for getting the state of the QDEC's debouncing filter.
- * @retval NRF_QDEC_DBFEN_DISABLE If the debouncing filter is disabled.
- * @retval NRF_QDEC_DBFEN_ENABLE If the debouncing filter is enabled.
- */
-__STATIC_INLINE uint32_t nrf_qdec_dbfen_get(void)
-{
-    return NRF_QDEC->DBFEN;
-}
-
-
-/**
- * @brief Function for assigning QDEC pins.
- * @param[in] psela   Pin number.
- * @param[in] pselb   Pin number.
- * @param[in] pselled Pin number.
- */
-__STATIC_INLINE void nrf_qdec_pio_assign( uint32_t psela, uint32_t pselb, uint32_t pselled)
-{
-#ifdef NRF51
-    NRF_QDEC->PSELA = psela;
-    NRF_QDEC->PSELB = pselb;
-    NRF_QDEC->PSELLED = pselled;
-#elif defined NRF52
-    NRF_QDEC->PSEL.A = psela;
-    NRF_QDEC->PSEL.B = pselb;
-    NRF_QDEC->PSEL.LED = pselled;
-#endif
-}
-
-/**
- * @brief Function for setting a specific QDEC task.
- * @param[in] qdec_task QDEC task to be set.
- */
-__STATIC_INLINE void nrf_qdec_task_trigger(nrf_qdec_task_t qdec_task)
-{
-    *( (volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_task) ) = 1;
-}
-
-
-/**
- * @brief Function for retrieving the address of a QDEC task register.
- * @param[in] qdec_task QDEC task.
- */
-__STATIC_INLINE uint32_t * nrf_qdec_task_address_get(nrf_qdec_task_t qdec_task)
-{
-    return (uint32_t *)( (uint8_t *)NRF_QDEC + qdec_task);
-}
-
-
-/**
- * @brief Function for clearing a specific QDEC event.
- * @param[in] qdec_event QDEC event to clear.
- */
-__STATIC_INLINE void nrf_qdec_event_clear(nrf_qdec_event_t qdec_event)
-{
-    *( (volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event) ) = 0;
-}
-
-
-/**
- * @brief Function for retrieving the state of a specific QDEC event.
- * @return State of the QDEC event.
- */
-__STATIC_INLINE uint32_t nrf_qdec_event_check(nrf_qdec_event_t qdec_event)
-{
-    return *(volatile uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event);
-}
-
-
-/**
- * @brief Function for retrieving the address of a specific QDEC event register.
- * @param[in] qdec_event QDEC event.
- * @return Address of the specified QDEC event.
- */
-__STATIC_INLINE uint32_t * nrf_qdec_event_address_get(nrf_qdec_event_t qdec_event)
-{
-    return (uint32_t *)( (uint8_t *)NRF_QDEC + qdec_event);
-}
-
-
-/**
- * @brief  Function for setting QDEC shortcuts.
- * @param[in] qdec_short_mask QDEC shortcut by mask.
- */
-__STATIC_INLINE void nrf_qdec_shorts_enable(uint32_t qdec_short_mask)
-{
-    NRF_QDEC->SHORTS |= qdec_short_mask;
-}
-
-
-/**
- * @brief Function for clearing shortcuts of the QDEC by mask.
- * @param[in] qdec_short_mask QDEC shortcute to be cleared.
- */
-__STATIC_INLINE void nrf_qdec_shorts_disable(uint32_t qdec_short_mask)
-{
-    NRF_QDEC->SHORTS &= ~qdec_short_mask;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's SAMPLEPER register.
- * @return Value of the SAMPLEPER register.
- */
-__STATIC_INLINE int32_t nrf_qdec_sampleper_reg_get(void)
-{
-    return NRF_QDEC->SAMPLEPER;
-}
-
-
-/**
- * @brief Function for converting the value of QDEC's SAMPLE PERIOD to microseconds.
- * @retval sampling period in microseconds.
- */
-__STATIC_INLINE uint32_t nrf_qdec_sampleper_to_value(uint32_t sampleper)
-{
-    return (1 << (7+sampleper));
-}
-
-/**
- * @brief Function for setting the value of QDEC's SAMPLEPER register.
- * @param[in] sample_per Sampling period.
- */
-__STATIC_INLINE void nrf_qdec_sampleper_set(nrf_qdec_sampleper_t sample_per)
-{
-    NRF_QDEC->SAMPLEPER = sample_per;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's SAMPLE register.
- * @return Value of the SAMPLE register.
- */
-__STATIC_INLINE int32_t nrf_qdec_sample_get(void)
-{
-    return NRF_QDEC->SAMPLE;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACC register.
- * @return Value of the ACC register.
- */
-__STATIC_INLINE int32_t nrf_qdec_acc_get(void)
-{
-    return NRF_QDEC->ACC;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACCREAD register.
- * @return Value of the ACCREAD register.
- */
-__STATIC_INLINE int32_t nrf_qdec_accread_get(void)
-{
-    return NRF_QDEC->ACCREAD;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACCDBL register.
- * @return Value of the ACCDBL register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_accdbl_get(void)
-{
-    return NRF_QDEC->ACCDBL;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's ACCDBLREAD register.
- * @return Value of the ACCDBLREAD register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_accdblread_get(void)
-{
-    return NRF_QDEC->ACCDBLREAD;
-}
-
-
-/**
- * @brief Function for setting how long the LED is switched on before sampling.
- * @param[in] time_us Time (in microseconds) how long the LED is switched on before sampling.
- */
-__STATIC_INLINE void nrf_qdec_ledpre_set(uint32_t time_us)
-{
-    NRF_QDEC->LEDPRE = time_us;
-}
-
-
-/**
- * @brief Function for retrieving how long the LED is switched on before sampling.
- * @retval time_us Time (in microseconds) how long the LED is switched on before sampling.
- */
-__STATIC_INLINE uint32_t nrf_qdec_ledpre_get(void)
-{
-    return NRF_QDEC->LEDPRE;
-}
-
-
-/**
- * @brief Function for setting the report period (in samples).
- * @param[in] reportper Number of samples.
- */
-__STATIC_INLINE void nrf_qdec_reportper_set(nrf_qdec_reportper_t reportper)
-{
-    NRF_QDEC->REPORTPER = reportper;
-}
-
-
-/**
- * @brief Function for retrieving the report period.
- * @retval reportper Number of samples as encoded in the register.
- */
-__STATIC_INLINE uint32_t nrf_qdec_reportper_reg_get(void)
-{
-    return NRF_QDEC->REPORTPER;
-}
-
-
-/**
- * @brief Function for retrieving the value of QDEC's SAMPLEPER register.
- * @param [in] reportper  Reportper to be converted to amount of samples per report.
-
- */
-__STATIC_INLINE uint32_t nrf_qdec_reportper_to_value(uint32_t reportper)
-{
-    return (reportper == NRF_QDEC_REPORTPER_10) ? 10 : reportper*40;
-}
-
-
-/**
- * @brief Function for setting the active level for the LED.
- * @param[in] pol Active level for the LED.
- */
-__STATIC_INLINE void nrf_qdec_ledpol_set(nrf_qdec_ledpol_t pol)
-{
-    NRF_QDEC->LEDPOL = pol;
-}
-
-
-/**
- * @brief Function for retrieving the active level for the LED.
- * @return Active level for the LED.
- */
-__STATIC_INLINE uint32_t nrf_qdec_ledpol_get(void)
-{
-    return NRF_QDEC->LEDPOL;
-}
-
-
-/**
-   *@}
- **/
-
-/*lint --flb "Leave library region" */
-#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/drivers_nrf/hal/nrf_rng.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rng.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rng.h
deleted file mode 100644
index 415fad6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rng.h
+++ /dev/null
@@ -1,219 +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
- * @brief RNG HAL API.
- */
-
-#ifndef NRF_RNG_H__
-#define NRF_RNG_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_rng_hal RNG HAL
- * @{
- * @ingroup nrf_rng
- * @brief Hardware access layer for managing the random number generator (RNG).
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include "nrf.h"
-
-#define NRF_RNG_TASK_SET    (1UL)
-#define NRF_RNG_EVENT_CLEAR (0UL)
-/**
- * @enum nrf_rng_task_t
- * @brief RNG tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_RNG_TASK_START = offsetof(NRF_RNG_Type, TASKS_START), /**< Start the random number generator. */
-    NRF_RNG_TASK_STOP  = offsetof(NRF_RNG_Type, TASKS_STOP)   /**< Stop the random number generator. */
-} nrf_rng_task_t;                                             /*lint -restore */
-
-/**
- * @enum nrf_rng_event_t
- * @brief RNG events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_RNG_EVENT_VALRDY = offsetof(NRF_RNG_Type, EVENTS_VALRDY) /**< New random number generated event. */
-} nrf_rng_event_t;                                               /*lint -restore */
-
-/**
- * @enum nrf_rng_int_mask_t
- * @brief RNG interrupts.
- */
-typedef enum
-{
-    NRF_RNG_INT_VALRDY_MASK = RNG_INTENSET_VALRDY_Msk /**< Mask for enabling or disabling an interrupt on VALRDY event.  */
-} nrf_rng_int_mask_t;
-
-/**
- * @enum nrf_rng_short_mask_t
- * @brief Types of RNG shortcuts.
- */
-typedef enum
-{
-    NRF_RNG_SHORT_VALRDY_STOP_MASK = RNG_SHORTS_VALRDY_STOP_Msk /**<  Mask for setting shortcut between EVENT_VALRDY and TASK_STOP. */
-} nrf_rng_short_mask_t;
-
-/**
- * @brief Function for enabling interrupts.
- *
- * @param[in]  rng_int_mask              Mask of interrupts.
- */
-__STATIC_INLINE void nrf_rng_int_enable(uint32_t rng_int_mask)
-{
-    NRF_RNG->INTENSET = rng_int_mask;
-}
-
-/**
- * @brief Function for disabling interrupts.
- *
- * @param[in]  rng_int_mask              Mask of interrupts.
- */
-__STATIC_INLINE void nrf_rng_int_disable(uint32_t rng_int_mask)
-{
-    NRF_RNG->INTENCLR = rng_int_mask;
-}
-
-/**
- * @brief Function for getting the state of a specific interrupt.
- *
- * @param[in]  rng_int_mask              Interrupt.
- *
- * @retval     true                   If the interrupt is not enabled.
- * @retval     false                  If the interrupt is enabled.
- */
-__STATIC_INLINE bool nrf_rng_int_get(nrf_rng_int_mask_t rng_int_mask)
-{
-    return (bool)(NRF_RNG->INTENCLR & rng_int_mask);
-}
-
-/**
- * @brief Function for getting the address of a specific task. 
- *
- * This function can be used by the PPI module.
- *
- * @param[in]  rng_task              Task.
- */
-__STATIC_INLINE uint32_t * nrf_rng_task_address_get(nrf_rng_task_t rng_task)
-{
-    return (uint32_t *)((uint8_t *)NRF_RNG + rng_task);
-}
-
-/**
- * @brief Function for setting a specific task.
- *
- * @param[in]  rng_task              Task.
- */
-__STATIC_INLINE void nrf_rng_task_trigger(nrf_rng_task_t rng_task)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_task)) = NRF_RNG_TASK_SET;
-}
-
-/**
- * @brief Function for getting address of a specific event. 
- *
- * This function can be used by the PPI module.
- *
- * @param[in]  rng_event              Event.
- */
-__STATIC_INLINE uint32_t * nrf_rng_event_address_get(nrf_rng_event_t rng_event)
-{
-    return (uint32_t *)((uint8_t *)NRF_RNG + rng_event);
-}
-
-/**
- * @brief Function for clearing a specific event.
- *
- * @param[in]  rng_event              Event.
- */
-__STATIC_INLINE void nrf_rng_event_clear(nrf_rng_event_t rng_event)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event)) = NRF_RNG_EVENT_CLEAR;
-}
-
-/**
- * @brief Function for getting the state of a specific event.
- *
- * @param[in]  rng_event              Event.
- *
- * @retval     true               If the event is not set.
- * @retval     false              If the event is set.
- */
-__STATIC_INLINE bool nrf_rng_event_get(nrf_rng_event_t rng_event)
-{
-    return (bool)*((volatile uint32_t *)((uint8_t *)NRF_RNG + rng_event));
-}
-
-/**
- * @brief Function for setting shortcuts.
- *
- * @param[in]  rng_short_mask              Mask of shortcuts.
- *
- */
-__STATIC_INLINE void nrf_rng_shorts_enable(uint32_t rng_short_mask)
-{
-     NRF_RNG->SHORTS |= rng_short_mask;
-}
-
-/**
- * @brief Function for clearing shortcuts.
- *
- * @param[in]  rng_short_mask              Mask of shortcuts.
- *
- */
-__STATIC_INLINE void nrf_rng_shorts_disable(uint32_t rng_short_mask)
-{
-     NRF_RNG->SHORTS &= ~rng_short_mask;
-}
-
-/**
- * @brief Function for getting the previously generated random value.
- *
- * @return     Previously generated random value.
- */
-__STATIC_INLINE uint8_t nrf_rng_random_value_get(void)
-{
-    return (uint8_t)(NRF_RNG->VALUE & RNG_VALUE_VALUE_Msk);
-}
-
-/**
- * @brief Function for enabling digital error correction.
- */
-__STATIC_INLINE void nrf_rng_error_correction_enable(void)
-{
-    NRF_RNG->CONFIG |= RNG_CONFIG_DERCEN_Msk;
-}
-
-/**
- * @brief Function for disabling digital error correction.
- */
-__STATIC_INLINE void nrf_rng_error_correction_disable(void)
-{
-    NRF_RNG->CONFIG &= ~RNG_CONFIG_DERCEN_Msk;
-}
-/**
- *@}
- **/
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_RNG_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/hal/nrf_rtc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rtc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rtc.h
deleted file mode 100644
index ad05f61..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_rtc.h
+++ /dev/null
@@ -1,312 +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
- * @brief RTC HAL API.
- */
-
-#ifndef NRF_RTC_H
-#define NRF_RTC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_rtc_hal RTC HAL
- * @{
- * @ingroup nrf_rtc
- * @brief Hardware access layer for managing the real time counter (RTC).
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-#include "nrf.h"
-#include "nrf_assert.h"
-
-/**
- * @brief Macro for getting the number of compare channels available
- *        in a given RTC instance.
- */
-#ifdef NRF51
-    #define NRF_RTC_CC_CHANNEL_COUNT(id)  4
-#else
-    #define NRF_RTC_CC_CHANNEL_COUNT(id)  ((id) == 0 ? 3 : 4)
-#endif
-
-#define RTC_INPUT_FREQ 32768 /**< Input frequency of the RTC instance. */
-
-/**< Macro for wrapping values to RTC capacity. */
-#define RTC_WRAP(val) (val & RTC_COUNTER_COUNTER_Msk)
-
-#define RTC_CHANNEL_INT_MASK(ch)    ((uint32_t)NRF_RTC_INT_COMPARE0_MASK << ch)
-#define RTC_CHANNEL_EVENT_ADDR(ch)  (nrf_rtc_event_t)(NRF_RTC_EVENT_COMPARE_0 + ch*sizeof(uint32_t))
-/**
- * @enum nrf_rtc_task_t
- * @brief RTC tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_RTC_TASK_START            = offsetof(NRF_RTC_Type,TASKS_START),     /**< Start. */
-    NRF_RTC_TASK_STOP             = offsetof(NRF_RTC_Type,TASKS_STOP),      /**< Stop. */
-    NRF_RTC_TASK_CLEAR            = offsetof(NRF_RTC_Type,TASKS_CLEAR),     /**< Clear. */
-    NRF_RTC_TASK_TRIGGER_OVERFLOW = offsetof(NRF_RTC_Type,TASKS_TRIGOVRFLW),/**< Trigger overflow. */
-    /*lint -restore*/
-} nrf_rtc_task_t;
-
-/**
- * @enum nrf_rtc_event_t
- * @brief RTC events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_RTC_EVENT_TICK        = offsetof(NRF_RTC_Type,EVENTS_TICK),       /**< Tick event. */
-    NRF_RTC_EVENT_OVERFLOW    = offsetof(NRF_RTC_Type,EVENTS_OVRFLW),     /**< Overflow event. */
-    NRF_RTC_EVENT_COMPARE_0   = offsetof(NRF_RTC_Type,EVENTS_COMPARE[0]), /**< Compare 0 event. */
-    NRF_RTC_EVENT_COMPARE_1   = offsetof(NRF_RTC_Type,EVENTS_COMPARE[1]), /**< Compare 1 event. */
-    NRF_RTC_EVENT_COMPARE_2   = offsetof(NRF_RTC_Type,EVENTS_COMPARE[2]), /**< Compare 2 event. */
-    NRF_RTC_EVENT_COMPARE_3   = offsetof(NRF_RTC_Type,EVENTS_COMPARE[3])  /**< Compare 3 event. */
-    /*lint -restore*/
-} nrf_rtc_event_t;
-
-/**
- * @enum nrf_rtc_int_t
- * @brief RTC interrupts.
- */
-typedef enum
-{
-    NRF_RTC_INT_TICK_MASK     = RTC_INTENSET_TICK_Msk,     /**< RTC interrupt from tick event. */
-    NRF_RTC_INT_OVERFLOW_MASK = RTC_INTENSET_OVRFLW_Msk,   /**< RTC interrupt from overflow event. */
-    NRF_RTC_INT_COMPARE0_MASK = RTC_INTENSET_COMPARE0_Msk, /**< RTC interrupt from compare event on channel 0. */
-    NRF_RTC_INT_COMPARE1_MASK = RTC_INTENSET_COMPARE1_Msk, /**< RTC interrupt from compare event on channel 1. */
-    NRF_RTC_INT_COMPARE2_MASK = RTC_INTENSET_COMPARE2_Msk, /**< RTC interrupt from compare event on channel 2. */
-    NRF_RTC_INT_COMPARE3_MASK = RTC_INTENSET_COMPARE3_Msk  /**< RTC interrupt from compare event on channel 3. */
-} nrf_rtc_int_t;
-
-/**@brief Function for setting a compare value for a channel.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  ch            Channel.
- * @param[in]  cc_val        Compare value to set.
- */
-__STATIC_INLINE  void nrf_rtc_cc_set(NRF_RTC_Type * p_rtc, uint32_t ch, uint32_t cc_val);
-
-/**@brief Function for returning the compare value for a channel.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  ch            Channel.
- *
- * @return                   COMPARE[ch] value.
- */
-__STATIC_INLINE  uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch);
-
-/**@brief Function for enabling interrupts.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  mask          Interrupt mask to be enabled.
- */
-__STATIC_INLINE void nrf_rtc_int_enable(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for disabling interrupts.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  mask          Interrupt mask to be disabled.
- */
-__STATIC_INLINE void nrf_rtc_int_disable(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for checking if interrupts are enabled.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  mask          Mask of interrupt flags to check.
- *
- * @return                   Mask with enabled interrupts.
- */
-__STATIC_INLINE uint32_t nrf_rtc_int_is_enabled(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for returning the status of currently enabled interrupts.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- *
- * @return                   Value in INTEN register.
- */
-__STATIC_INLINE uint32_t nrf_rtc_int_get(NRF_RTC_Type * p_rtc);
-
-/**@brief Function for checking if an event is pending.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  event         Address of the event.
- *
- * @return                   Mask of pending events.
- */
-__STATIC_INLINE uint32_t nrf_rtc_event_pending(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event);
-
-/**@brief Function for clearing an event.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  event         Event to clear.
- */
-__STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event);
-
-/**@brief Function for returning a counter value.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- *
- * @return                   Counter value.
- */
-__STATIC_INLINE uint32_t nrf_rtc_counter_get(NRF_RTC_Type * p_rtc);
-
-/**@brief Function for setting a prescaler value.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  val           Value to set the prescaler to.
- */
-__STATIC_INLINE void nrf_rtc_prescaler_set(NRF_RTC_Type * p_rtc, uint32_t val);
-
-/**@brief Function for returning the address of an event.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  event         Requested event.
- *
- * @return     Address of the requested event register.
- */
-__STATIC_INLINE uint32_t nrf_rtc_event_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event);
-
-/**@brief Function for returning the address of a task.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  task          Requested task.
- *
- * @return     Address of the requested task register.
- */
-__STATIC_INLINE uint32_t nrf_rtc_task_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task);
-
-/**@brief Function for starting a task.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  task          Requested task.
- */
-__STATIC_INLINE void nrf_rtc_task_trigger(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task);
-
-/**@brief Function for enabling events.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  mask          Mask of event flags to enable.
- */
-__STATIC_INLINE void nrf_rtc_event_enable(NRF_RTC_Type * p_rtc, uint32_t mask);
-
-/**@brief Function for disabling an event.
- *
- * @param[in]  p_rtc         Pointer to the instance register structure.
- * @param[in]  event         Requested event.
- */
-__STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t event);
-
-/**
- *@}
- **/
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE  void nrf_rtc_cc_set(NRF_RTC_Type * p_rtc, uint32_t ch, uint32_t cc_val)
-{
-    p_rtc->CC[ch] = cc_val;
-}
-
-__STATIC_INLINE  uint32_t nrf_rtc_cc_get(NRF_RTC_Type * p_rtc, uint32_t ch)
-{
-    return p_rtc->CC[ch];
-}
-
-__STATIC_INLINE void nrf_rtc_int_enable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
-    p_rtc->INTENSET = mask;
-}
-
-__STATIC_INLINE void nrf_rtc_int_disable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
-    p_rtc->INTENCLR = mask;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_int_is_enabled(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
-    return (p_rtc->INTENSET & mask);
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_int_get(NRF_RTC_Type * p_rtc)
-{
-    return p_rtc->INTENSET;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_event_pending(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event)
-{
-    return *(volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_rtc_event_clear(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event)) = 0;
-#if __CORTEX_M == 0x04
-    volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)p_rtc + (uint32_t)event));
-    (void)dummy;
-#endif
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_counter_get(NRF_RTC_Type * p_rtc)
-{
-     return p_rtc->COUNTER;
-}
-
-__STATIC_INLINE void nrf_rtc_prescaler_set(NRF_RTC_Type * p_rtc, uint32_t val)
-{
-    ASSERT(val <= (RTC_PRESCALER_PRESCALER_Msk >> RTC_PRESCALER_PRESCALER_Pos));
-    p_rtc->PRESCALER = val;
-}
-__STATIC_INLINE uint32_t rtc_prescaler_get(NRF_RTC_Type * p_rtc)
-{
-    return p_rtc->PRESCALER;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_event_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_event_t event)
-{
-    return (uint32_t)p_rtc + event;
-}
-
-__STATIC_INLINE uint32_t nrf_rtc_task_address_get(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task)
-{
-    return (uint32_t)p_rtc + task;
-}
-
-__STATIC_INLINE void nrf_rtc_task_trigger(NRF_RTC_Type * p_rtc, nrf_rtc_task_t task)
-{
-    *(__IO uint32_t *)((uint32_t)p_rtc + task) = 1;
-}
-
-__STATIC_INLINE void nrf_rtc_event_enable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
-    p_rtc->EVTENSET = mask;
-}
-__STATIC_INLINE void nrf_rtc_event_disable(NRF_RTC_Type * p_rtc, uint32_t mask)
-{
-    p_rtc->EVTENCLR = mask;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  /* NRF_RTC_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/hal/nrf_saadc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.c
deleted file mode 100644
index 849c3bd..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.c
+++ /dev/null
@@ -1,31 +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
- * @brief SAADC HAL implementation
- */
-
-#include "nrf_saadc.h"
-
-void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config)
-{
-    NRF_SAADC->CH[channel].CONFIG = 
-            ((config->resistor_p   << SAADC_CH_CONFIG_RESP_Pos)   & SAADC_CH_CONFIG_RESP_Msk)
-            | ((config->resistor_n << SAADC_CH_CONFIG_RESN_Pos)   & SAADC_CH_CONFIG_RESN_Msk)
-            | ((config->gain       << SAADC_CH_CONFIG_GAIN_Pos)   & SAADC_CH_CONFIG_GAIN_Msk)
-            | ((config->reference  << SAADC_CH_CONFIG_REFSEL_Pos) & SAADC_CH_CONFIG_REFSEL_Msk)
-            | ((config->acq_time   << SAADC_CH_CONFIG_TACQ_Pos)   & SAADC_CH_CONFIG_TACQ_Msk)
-            | ((config->mode       << SAADC_CH_CONFIG_MODE_Pos)   & SAADC_CH_CONFIG_MODE_Msk);
-    nrf_saadc_channel_input_set(channel, config->pin_p, config->pin_n);
-    return;
-}

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/hal/nrf_saadc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.h
deleted file mode 100644
index f2b6805..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_saadc.h
+++ /dev/null
@@ -1,562 +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.
- *
- */
-
-
-#ifndef NRF_SAADC_H_
-#define NRF_SAADC_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_saadc_hal SAADC HAL
- * @{
- * @ingroup nrf_saadc
- *
- * @brief @tagAPI52 Hardware access layer for accessing the SAADC peripheral.
- */
-
-#include <stdbool.h>
-#include <stddef.h>
-#include "nrf.h"
-#include "nrf_assert.h"
-
-#define NRF_SAADC_CHANNEL_COUNT 8
-
-/**
- * @brief Resolution of the analog-to-digital converter.
- */
-typedef enum
-{
-    NRF_SAADC_RESOLUTION_8BIT  = SAADC_RESOLUTION_VAL_8bit,  ///< 8 bit resolution.
-    NRF_SAADC_RESOLUTION_10BIT = SAADC_RESOLUTION_VAL_10bit, ///< 10 bit resolution.
-    NRF_SAADC_RESOLUTION_12BIT = SAADC_RESOLUTION_VAL_12bit, ///< 12 bit resolution.
-    NRF_SAADC_RESOLUTION_14BIT = SAADC_RESOLUTION_VAL_14bit  ///< 14 bit resolution.
-} nrf_saadc_resolution_t;
-
-
-/**
- * @brief Input selection for the analog-to-digital converter.
- */
-typedef enum
-{
-    NRF_SAADC_INPUT_DISABLED = SAADC_CH_PSELP_PSELP_NC,           ///< Not connected.
-    NRF_SAADC_INPUT_AIN0     = SAADC_CH_PSELP_PSELP_AnalogInput0, ///< Analog input 0 (AIN0).
-    NRF_SAADC_INPUT_AIN1     = SAADC_CH_PSELP_PSELP_AnalogInput1, ///< Analog input 1 (AIN1).
-    NRF_SAADC_INPUT_AIN2     = SAADC_CH_PSELP_PSELP_AnalogInput2, ///< Analog input 2 (AIN2).
-    NRF_SAADC_INPUT_AIN3     = SAADC_CH_PSELP_PSELP_AnalogInput3, ///< Analog input 3 (AIN3).
-    NRF_SAADC_INPUT_AIN4     = SAADC_CH_PSELP_PSELP_AnalogInput4, ///< Analog input 4 (AIN4).
-    NRF_SAADC_INPUT_AIN5     = SAADC_CH_PSELP_PSELP_AnalogInput5, ///< Analog input 5 (AIN5).
-    NRF_SAADC_INPUT_AIN6     = SAADC_CH_PSELP_PSELP_AnalogInput6, ///< Analog input 6 (AIN6).
-    NRF_SAADC_INPUT_AIN7     = SAADC_CH_PSELP_PSELP_AnalogInput7, ///< Analog input 7 (AIN7).
-    NRF_SAADC_INPUT_VDD      = SAADC_CH_PSELP_PSELP_VDD           ///< VDD as input.
-} nrf_saadc_input_t;
-
-
-/**
- * @brief Analog-to-digital converter oversampling mode.
- */
-typedef enum
-{
-    NRF_SAADC_OVERSAMPLE_DISABLED = SAADC_OVERSAMPLE_OVERSAMPLE_Bypass,   ///< No oversampling.
-    NRF_SAADC_OVERSAMPLE_2X       = SAADC_OVERSAMPLE_OVERSAMPLE_Over2x,   ///< Oversample 2x.
-    NRF_SAADC_OVERSAMPLE_4X       = SAADC_OVERSAMPLE_OVERSAMPLE_Over4x,   ///< Oversample 4x.
-    NRF_SAADC_OVERSAMPLE_8X       = SAADC_OVERSAMPLE_OVERSAMPLE_Over8x,   ///< Oversample 8x.
-    NRF_SAADC_OVERSAMPLE_16X      = SAADC_OVERSAMPLE_OVERSAMPLE_Over16x,  ///< Oversample 16x.
-    NRF_SAADC_OVERSAMPLE_32X      = SAADC_OVERSAMPLE_OVERSAMPLE_Over32x,  ///< Oversample 32x.
-    NRF_SAADC_OVERSAMPLE_64X      = SAADC_OVERSAMPLE_OVERSAMPLE_Over64x,  ///< Oversample 64x.
-    NRF_SAADC_OVERSAMPLE_128X     = SAADC_OVERSAMPLE_OVERSAMPLE_Over128x, ///< Oversample 128x.
-    NRF_SAADC_OVERSAMPLE_256X     = SAADC_OVERSAMPLE_OVERSAMPLE_Over256x  ///< Oversample 256x.
-} nrf_saadc_oversample_t;
-
-
-/**
- * @brief Analog-to-digital converter channel resistor control.
- */
-typedef enum
-{
-    NRF_SAADC_RESISTOR_DISABLED = SAADC_CH_CONFIG_RESP_Bypass,   ///< Bypass resistor ladder.
-    NRF_SAADC_RESISTOR_PULLDOWN = SAADC_CH_CONFIG_RESP_Pulldown, ///< Pull-down to GND.
-    NRF_SAADC_RESISTOR_PULLUP   = SAADC_CH_CONFIG_RESP_Pullup,   ///< Pull-up to VDD.
-    NRF_SAADC_RESISTOR_VDD1_2   = SAADC_CH_CONFIG_RESP_VDD1_2    ///< Set input at VDD/2.
-} nrf_saadc_resistor_t;
-
-
-/**
- * @brief Gain factor of the analog-to-digital converter input.
- */
-typedef enum
-{
-    NRF_SAADC_GAIN1_6 = SAADC_CH_CONFIG_GAIN_Gain1_6, ///< Gain factor 1/6.
-    NRF_SAADC_GAIN1_5 = SAADC_CH_CONFIG_GAIN_Gain1_5, ///< Gain factor 1/5.
-    NRF_SAADC_GAIN1_4 = SAADC_CH_CONFIG_GAIN_Gain1_4, ///< Gain factor 1/4.
-    NRF_SAADC_GAIN1_3 = SAADC_CH_CONFIG_GAIN_Gain1_3, ///< Gain factor 1/3.
-    NRF_SAADC_GAIN1_2 = SAADC_CH_CONFIG_GAIN_Gain1_2, ///< Gain factor 1/2.
-    NRF_SAADC_GAIN1   = SAADC_CH_CONFIG_GAIN_Gain1,   ///< Gain factor 1.
-    NRF_SAADC_GAIN2   = SAADC_CH_CONFIG_GAIN_Gain2,   ///< Gain factor 2.
-    NRF_SAADC_GAIN4   = SAADC_CH_CONFIG_GAIN_Gain4,   ///< Gain factor 4.
-} nrf_saadc_gain_t;
-
-
-/**
- * @brief Reference selection for the analog-to-digital converter.
- */
-typedef enum
-{
-    NRF_SAADC_REFERENCE_INTERNAL = SAADC_CH_CONFIG_REFSEL_Internal, ///< Internal reference (0.6 V).
-    NRF_SAADC_REFERENCE_VDD4     = SAADC_CH_CONFIG_REFSEL_VDD1_4    ///< VDD/4 as reference.
-} nrf_saadc_reference_t;
-
-
-/**
- * @brief Analog-to-digital converter acquisition time.
- */
-typedef enum
-{
-    NRF_SAADC_ACQTIME_3US  = SAADC_CH_CONFIG_TACQ_3us,  ///< 3 us.
-    NRF_SAADC_ACQTIME_5US  = SAADC_CH_CONFIG_TACQ_5us,  ///< 5 us.
-    NRF_SAADC_ACQTIME_10US = SAADC_CH_CONFIG_TACQ_10us, ///< 10 us.
-    NRF_SAADC_ACQTIME_15US = SAADC_CH_CONFIG_TACQ_15us, ///< 15 us.
-    NRF_SAADC_ACQTIME_20US = SAADC_CH_CONFIG_TACQ_20us, ///< 20 us.
-    NRF_SAADC_ACQTIME_40US = SAADC_CH_CONFIG_TACQ_40us  ///< 40 us.
-} nrf_saadc_acqtime_t;
-
-
-/**
- * @brief Analog-to-digital converter channel mode.
- */
-typedef enum
-{
-    NRF_SAADC_MODE_SINGLE_ENDED = SAADC_CH_CONFIG_MODE_SE,  ///< Single ended, PSELN will be ignored, negative input to ADC shorted to GND.
-    NRF_SAADC_MODE_DIFFERENTIAL = SAADC_CH_CONFIG_MODE_Diff ///< Differential mode.
-} nrf_saadc_mode_t;
-
-
-/**
- * @brief Analog-to-digital converter tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_SAADC_TASK_START           = offsetof(NRF_SAADC_Type, TASKS_START),           ///< Start the ADC and prepare the result buffer in RAM.
-    NRF_SAADC_TASK_SAMPLE          = offsetof(NRF_SAADC_Type, TASKS_SAMPLE),          ///< Take one ADC sample. If scan is enabled, all channels are sampled.
-    NRF_SAADC_TASK_STOP            = offsetof(NRF_SAADC_Type, TASKS_STOP),            ///< Stop the ADC and terminate any on-going conversion.
-    NRF_SAADC_TASK_CALIBRATEOFFSET = offsetof(NRF_SAADC_Type, TASKS_CALIBRATEOFFSET), ///< Starts offset auto-calibration.
-} nrf_saadc_task_t;
-
-
-/**
- * @brief Analog-to-digital converter events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_SAADC_EVENT_STARTED       = offsetof(NRF_SAADC_Type, EVENTS_STARTED),       ///< The ADC has started.
-    NRF_SAADC_EVENT_END           = offsetof(NRF_SAADC_Type, EVENTS_END),           ///< The ADC has filled up the result buffer.
-    NRF_SAADC_EVENT_CALIBRATEDONE = offsetof(NRF_SAADC_Type, EVENTS_CALIBRATEDONE), ///< Calibration is complete.
-    NRF_SAADC_EVENT_STOPPED       = offsetof(NRF_SAADC_Type, EVENTS_STOPPED),       ///< The ADC has stopped.
-    NRF_SAADC_EVENT_CH0_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITH),  ///< Last result is equal or above CH[0].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH0_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[0].LIMITL),  ///< Last result is equal or below CH[0].LIMIT.LOW.
-    NRF_SAADC_EVENT_CH1_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITH),  ///< Last result is equal or above CH[1].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH1_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[1].LIMITL),  ///< Last result is equal or below CH[1].LIMIT.LOW.
-    NRF_SAADC_EVENT_CH2_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITH),  ///< Last result is equal or above CH[2].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH2_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[2].LIMITL),  ///< Last result is equal or below CH[2].LIMIT.LOW.
-    NRF_SAADC_EVENT_CH3_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITH),  ///< Last result is equal or above CH[3].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH3_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[3].LIMITL),  ///< Last result is equal or below CH[3].LIMIT.LOW.
-    NRF_SAADC_EVENT_CH4_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITH),  ///< Last result is equal or above CH[4].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH4_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[4].LIMITL),  ///< Last result is equal or below CH[4].LIMIT.LOW.
-    NRF_SAADC_EVENT_CH5_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITH),  ///< Last result is equal or above CH[5].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH5_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[5].LIMITL),  ///< Last result is equal or below CH[5].LIMIT.LOW.
-    NRF_SAADC_EVENT_CH6_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITH),  ///< Last result is equal or above CH[6].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH6_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[6].LIMITL),  ///< Last result is equal or below CH[6].LIMIT.LOW.
-    NRF_SAADC_EVENT_CH7_LIMITH    = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITH),  ///< Last result is equal or above CH[7].LIMIT.HIGH.
-    NRF_SAADC_EVENT_CH7_LIMITL    = offsetof(NRF_SAADC_Type, EVENTS_CH[7].LIMITL)   ///< Last result is equal or below CH[7].LIMIT.LOW.
-} nrf_saadc_event_t;
-
-
-/**
- * @brief Analog-to-digital converter interrupt masks.
- */
-typedef enum
-{
-    NRF_SAADC_INT_STARTED   = SAADC_INTENSET_STARTED_Msk,   ///< Interrupt on EVENTS_STARTED event.
-    NRF_SAADC_INT_END       = SAADC_INTENSET_END_Msk,       ///< Interrupt on EVENTS_END event.
-    NRF_SAADC_INT_STOPPED   = SAADC_INTENSET_STOPPED_Msk,   ///< Interrupt on EVENTS_STOPPED event.
-    NRF_SAADC_INT_CH0LIMITH = SAADC_INTENSET_CH0LIMITH_Msk, ///< Interrupt on EVENTS_CH[0].LIMITH event.
-    NRF_SAADC_INT_CH0LIMITL = SAADC_INTENSET_CH0LIMITL_Msk, ///< Interrupt on EVENTS_CH[0].LIMITL event.
-    NRF_SAADC_INT_CH1LIMITH = SAADC_INTENSET_CH1LIMITH_Msk, ///< Interrupt on EVENTS_CH[1].LIMITH event.
-    NRF_SAADC_INT_CH1LIMITL = SAADC_INTENSET_CH1LIMITL_Msk, ///< Interrupt on EVENTS_CH[1].LIMITL event.
-    NRF_SAADC_INT_CH2LIMITH = SAADC_INTENSET_CH2LIMITH_Msk, ///< Interrupt on EVENTS_CH[2].LIMITH event.
-    NRF_SAADC_INT_CH2LIMITL = SAADC_INTENSET_CH2LIMITL_Msk, ///< Interrupt on EVENTS_CH[2].LIMITL event.
-    NRF_SAADC_INT_CH3LIMITH = SAADC_INTENSET_CH3LIMITH_Msk, ///< Interrupt on EVENTS_CH[3].LIMITH event.
-    NRF_SAADC_INT_CH3LIMITL = SAADC_INTENSET_CH3LIMITL_Msk, ///< Interrupt on EVENTS_CH[3].LIMITL event.
-    NRF_SAADC_INT_CH4LIMITH = SAADC_INTENSET_CH4LIMITH_Msk, ///< Interrupt on EVENTS_CH[4].LIMITH event.
-    NRF_SAADC_INT_CH4LIMITL = SAADC_INTENSET_CH4LIMITL_Msk, ///< Interrupt on EVENTS_CH[4].LIMITL event.
-    NRF_SAADC_INT_CH5LIMITH = SAADC_INTENSET_CH5LIMITH_Msk, ///< Interrupt on EVENTS_CH[5].LIMITH event.
-    NRF_SAADC_INT_CH5LIMITL = SAADC_INTENSET_CH5LIMITL_Msk, ///< Interrupt on EVENTS_CH[5].LIMITL event.
-    NRF_SAADC_INT_CH6LIMITH = SAADC_INTENSET_CH6LIMITH_Msk, ///< Interrupt on EVENTS_CH[6].LIMITH event.
-    NRF_SAADC_INT_CH6LIMITL = SAADC_INTENSET_CH6LIMITL_Msk, ///< Interrupt on EVENTS_CH[6].LIMITL event.
-    NRF_SAADC_INT_CH7LIMITH = SAADC_INTENSET_CH7LIMITH_Msk, ///< Interrupt on EVENTS_CH[7].LIMITH event.
-    NRF_SAADC_INT_CH7LIMITL = SAADC_INTENSET_CH7LIMITL_Msk, ///< Interrupt on EVENTS_CH[7].LIMITL event.
-    NRF_SAADC_INT_ALL       = 0x7FFFFFFFUL                  ///< Mask of all interrupts.
-} nrf_saadc_int_mask_t;
-
-
-/**
- * @brief Analog-to-digital converter value limit type.
- */
-typedef enum
-{
-    NRF_SAADC_LIMIT_LOW  = 0,
-    NRF_SAADC_LIMIT_HIGH = 1
-} nrf_saadc_limit_t;
-
-
-typedef int16_t nrf_saadc_value_t;  ///< Type of a single ADC conversion result.
-
-
-/**
- * @brief Analog-to-digital converter configuration structure.
- */
-typedef struct
-{
-    nrf_saadc_resolution_t resolution;
-    nrf_saadc_oversample_t oversample;
-    nrf_saadc_value_t *    buffer;
-    uint32_t               buffer_size;
-} nrf_saadc_config_t;
-
-
-/**
- * @brief Analog-to-digital converter channel configuration structure.
- */
-typedef struct
-{
-    nrf_saadc_resistor_t  resistor_p;
-    nrf_saadc_resistor_t  resistor_n;
-    nrf_saadc_gain_t      gain;
-    nrf_saadc_reference_t reference;
-    nrf_saadc_acqtime_t   acq_time;
-    nrf_saadc_mode_t      mode;
-    nrf_saadc_input_t     pin_p;
-    nrf_saadc_input_t     pin_n;
-} nrf_saadc_channel_config_t;
-
-
-/**
- * @brief Function for triggering a specific SAADC task.
- *
- * @param[in] saadc_task SAADC task.
- */
-__STATIC_INLINE void nrf_saadc_task_trigger(nrf_saadc_task_t saadc_task)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_task)) = 0x1UL;
-}
-
-
-/**
- * @brief Function for getting the address of a specific SAADC task register.
- *
- * @param[in] saadc_task SAADC task.
- *
- * @return Address of the specified SAADC task.
- */
-__STATIC_INLINE uint32_t nrf_saadc_task_address_get(nrf_saadc_task_t saadc_task)
-{
-    return (uint32_t)((uint8_t *)NRF_SAADC + (uint32_t)saadc_task);
-}
-
-
-/**
- * @brief Function for getting the state of a specific SAADC event.
- *
- * @param[in] saadc_event SAADC event.
- *
- * @return State of the specified SAADC event.
- */
-__STATIC_INLINE bool nrf_saadc_event_check(nrf_saadc_event_t saadc_event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event);
-}
-
-
-/**
- * @brief Function for clearing the specific SAADC event.
- *
- * @param[in] saadc_event SAADC event.
- */
-__STATIC_INLINE void nrf_saadc_event_clear(nrf_saadc_event_t saadc_event)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event)) = 0x0UL;
-}
-
-
-/**
- * @brief Function for getting the address of a specific SAADC event register.
- *
- * @param[in] saadc_event SAADC event.
- *
- * @return Address of the specified SAADC event.
- */
-__STATIC_INLINE volatile uint32_t * nrf_saadc_event_address_get(nrf_saadc_event_t saadc_event)
-{
-    return (volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)saadc_event);
-}
-
-
-/**
- * @brief Function for getting the address of a specific SAADC limit event register.
- *
- * @param[in] channel Channel number.
- * @param[in] limit_type Low limit or high limit.
- *
- * @return Address of the specified SAADC limit event.
- */
-__STATIC_INLINE volatile uint32_t * nrf_saadc_event_limit_address_get(uint8_t channel, nrf_saadc_limit_t limit_type)
-{
-    ASSERT(channel < NRF_SAADC_CHANNEL_COUNT);
-    if (limit_type == NRF_SAADC_LIMIT_HIGH)
-    {
-        return &NRF_SAADC->EVENTS_CH[channel].LIMITH;
-    }
-    else
-    {
-        return &NRF_SAADC->EVENTS_CH[channel].LIMITL;
-    }
-}
-
-
-/**
- * @brief Function for getting the SAADC channel monitoring limit events.
- *
- * @param[in] channel    Channel number.
- * @param[in] limit_type Low limit or high limit.
- */
-__STATIC_INLINE nrf_saadc_event_t nrf_saadc_event_limit_get(uint8_t channel, nrf_saadc_limit_t limit_type)
-{
-    if (limit_type == NRF_SAADC_LIMIT_HIGH)
-    {
-        return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITH + 
-                        (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITH - NRF_SAADC_EVENT_CH0_LIMITH)
-                        * (uint32_t) channel );
-    }
-    else
-    {
-        return (nrf_saadc_event_t)( (uint32_t) NRF_SAADC_EVENT_CH0_LIMITL + 
-                        (uint32_t) (NRF_SAADC_EVENT_CH1_LIMITL - NRF_SAADC_EVENT_CH0_LIMITL)
-                        * (uint32_t) channel );
-    }
-}
-
-
-/**
- * @brief Function for configuring the input pins for a specific SAADC channel.
- *
- * @param[in] channel Channel number.
- * @param[in] pselp   Positive input.
- * @param[in] pseln   Negative input. Set to NRF_SAADC_INPUT_DISABLED in single ended mode.
- */
-__STATIC_INLINE void nrf_saadc_channel_input_set(uint8_t channel,
-                                                 nrf_saadc_input_t pselp,
-                                                 nrf_saadc_input_t pseln)
-{
-    NRF_SAADC->CH[channel].PSELN = pseln;
-    NRF_SAADC->CH[channel].PSELP = pselp;
-}
-
-
-/**
- * @brief Function for setting the SAADC channel monitoring limits.
- *
- * @param[in] channel Channel number.
- * @param[in] low     Low limit.
- * @param[in] high    High limit.
- */
-__STATIC_INLINE void nrf_saadc_channel_limits_set(uint8_t channel, int16_t low, int16_t high)
-{
-    NRF_SAADC->CH[channel].LIMIT = (
-            (((uint32_t) low << SAADC_CH_LIMIT_LOW_Pos) & SAADC_CH_LIMIT_LOW_Msk)
-          | (((uint32_t) high << SAADC_CH_LIMIT_HIGH_Pos) & SAADC_CH_LIMIT_HIGH_Msk));
-}
-
-
-/**
- * @brief Function for enabling specified SAADC interrupts.
- *
- * @param[in] saadc_int_mask Interrupt(s) to enable.
- */
-__STATIC_INLINE void nrf_saadc_int_enable(uint32_t saadc_int_mask)
-{
-    NRF_SAADC->INTENSET = saadc_int_mask;
-}
-
-
-/**
- * @brief Function for retrieving the state of specified SAADC interrupts.
- *
- * @param[in] saadc_int_mask Interrupt(s) to check.
- *
- * @retval true  If all specified interrupts are enabled.
- * @retval false If at least one of the given interrupts is not enabled.
- */
-__STATIC_INLINE bool nrf_saadc_int_enable_check(uint32_t saadc_int_mask)
-{
-    return (bool)(NRF_SAADC->INTENSET & saadc_int_mask);
-}
-
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param saadc_int_mask Interrupt(s) to disable.
- */
-__STATIC_INLINE void nrf_saadc_int_disable(uint32_t saadc_int_mask)
-{
-    NRF_SAADC->INTENCLR = saadc_int_mask;
-}
-
-
-/**
- * @brief Function for generating masks for SAADC channel limit interrupts.
- * 
- * @param[in] channel    SAADC channel number.
- * @param[in] limit_type Limit type.
- *
- * @returns Interrupt mask.
- */
-__STATIC_INLINE uint32_t nrf_saadc_limit_int_get(uint8_t channel, nrf_saadc_limit_t limit_type)
-{
-    ASSERT(channel < NRF_SAADC_CHANNEL_COUNT);
-    uint32_t mask = (limit_type == NRF_SAADC_LIMIT_LOW) ? NRF_SAADC_INT_CH0LIMITL : NRF_SAADC_INT_CH0LIMITH;
-    return mask << (channel * 2);
-}
-
-
-/**
- * @brief Function for checking whether the SAADC is busy.
- *
- * This function checks whether the analog-to-digital converter is busy with a conversion.
- *
- * @retval true  If the SAADC is busy.
- * @retval false If the SAADC is not busy.
- */
-__STATIC_INLINE bool nrf_saadc_busy_check(void)
-{
-    //return ((NRF_SAADC->STATUS & SAADC_STATUS_STATUS_Msk) == SAADC_STATUS_STATUS_Msk);
-    //simplified for performance
-    return NRF_SAADC->STATUS;
-}
-
-
-/**
- * @brief Function for enabling the SAADC.
- *
- * The analog-to-digital converter must be enabled before use.
- */
-__STATIC_INLINE void nrf_saadc_enable(void)
-{
-    NRF_SAADC->ENABLE = (SAADC_ENABLE_ENABLE_Enabled << SAADC_ENABLE_ENABLE_Pos);
-}
-
-
-/**
- * @brief Function for disabling the SAADC.
- */
-__STATIC_INLINE void nrf_saadc_disable(void)
-{
-    NRF_SAADC->ENABLE = (SAADC_ENABLE_ENABLE_Disabled << SAADC_ENABLE_ENABLE_Pos);
-}
-
-
-/**
- * @brief Function for checking if the SAADC is enabled.
- *
- * @retval true  If the SAADC is enabled.
- * @retval false If the SAADC is not enabled.
- */
-__STATIC_INLINE bool nrf_saadc_enable_check(void)
-{
-    //simplified for performance
-    return NRF_SAADC->ENABLE;
-}
-
-
-/**
- * @brief Function for initializing the SAADC result buffer.
- *
- * @param[in] buffer Pointer to the result buffer.
- * @param[in] num    Size of buffer in words.
- */
-__STATIC_INLINE void nrf_saadc_buffer_init(nrf_saadc_value_t * buffer, uint32_t num)
-{
-    NRF_SAADC->RESULT.PTR = (uint32_t)buffer;
-    NRF_SAADC->RESULT.MAXCNT = num;
-}
-
-/**
- * @brief Function for getting the number of buffer words transferred since last START operation.
- *
- * @returns Number of words transferred.
- */
-__STATIC_INLINE uint16_t nrf_saadc_amount_get(void)
-{
-    return NRF_SAADC->RESULT.AMOUNT;
-}
-
-
-/**
- * @brief Function for setting the SAADC sample resolution.
- * 
- * @param[in] resolution Bit resolution.
- */
-__STATIC_INLINE void nrf_saadc_resolution_set(nrf_saadc_resolution_t resolution)
-{
-    NRF_SAADC->RESOLUTION = resolution;
-}
-
-
-/**
- * @brief Function for configuring the oversampling feature.
- *
- * @param[in] oversample Oversampling mode.
- */
-__STATIC_INLINE void nrf_saadc_oversample_set(nrf_saadc_oversample_t oversample)
-{
-    NRF_SAADC->OVERSAMPLE = oversample;
-}
-
-/**
- * @brief Function for getting the oversampling feature configuration.
- *
- * @return Oversampling configuration.
- */
-__STATIC_INLINE nrf_saadc_oversample_t nrf_saadc_oversample_get(void)
-{
-    return (nrf_saadc_oversample_t)NRF_SAADC->OVERSAMPLE;
-}
-
-/**
- * @brief Function for initializing the SAADC channel.
- *
- * @param[in] channel Channel number.
- * @param[in] config  Pointer to the channel configuration structure.
- */
-void nrf_saadc_channel_init(uint8_t channel, nrf_saadc_channel_config_t const * const config);
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_SAADC_H_ */


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c
deleted file mode 100644
index 8872c2c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_params_request.c
+++ /dev/null
@@ -1,55 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            ble_evt_t * const     p_event,
-                                            uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t event_len;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(7, packet_len);
-
-    event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_sec_params_request_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-    p_event->header.evt_id  = BLE_GAP_EVT_SEC_PARAMS_REQUEST;
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_evt_sec_params_request_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.sec_params_request));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c
deleted file mode 100644
index dc90202..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_request.c
+++ /dev/null
@@ -1,59 +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 <string.h>
-
-#include "ble_gap_evt_app.h"
-#include "ble_gap_struct_serialization.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     ble_evt_t * const     p_event,
-                                     uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(3, packet_len);
-
-    uint32_t event_len = sizeof (ble_gap_evt_sec_request_t) +
-                         sizeof (p_event->evt.gap_evt.conn_handle);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-
-    ble_gap_evt_sec_request_t * p_decoded_evt = &(p_event->evt.gap_evt.params.sec_request);
-    
-    uint32_t err_code = ble_gap_evt_sec_request_t_dec(p_buf, packet_len, &index, p_decoded_evt);
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c
deleted file mode 100644
index 0d230f5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_timeout.c
+++ /dev/null
@@ -1,52 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_evt_t * const     p_event,
-                                 uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t event_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_EQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len);
-
-    event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_timeout_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_TIMEOUT;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.timeout.src);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_keypress_notify.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_keypress_notify.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_keypress_notify.c
deleted file mode 100644
index 9b8a9ab..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_keypress_notify.c
+++ /dev/null
@@ -1,52 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_keypress_notify_req_enc(uint16_t                           conn_handle,
-                                          uint8_t                           kp_not,
-                                          uint8_t * const                   p_buf,
-                                          uint32_t * const                  p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_KEYPRESS_NOTIFY;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&kp_not, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_keypress_notify_rsp_dec(uint8_t const * const              p_buf,
-                                        uint32_t                           packet_len,
-                                        uint32_t * const                   p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_KEYPRESS_NOTIFY, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_lesc_dhkey_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_dhkey_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_dhkey_reply.c
deleted file mode 100644
index 4326f82..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_dhkey_reply.c
+++ /dev/null
@@ -1,52 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_lesc_dhkey_reply_req_enc(uint16_t             conn_handle,
-                                          ble_gap_lesc_dhkey_t const *p_dhkey,
-                                          uint8_t * const      p_buf,
-                                          uint32_t * const     p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_LESC_DHKEY_REPLY;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_dhkey, p_buf, buf_len, &index, ble_gap_lesc_dhkey_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_lesc_dhkey_reply_rsp_dec(uint8_t const * const              p_buf,
-                                        uint32_t                           packet_len,
-                                        uint32_t * const                   p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_LESC_DHKEY_REPLY, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_get.c
deleted file mode 100644
index 8efc46b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_get.c
+++ /dev/null
@@ -1,77 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_lesc_oob_data_get_req_enc(uint16_t                      conn_handle,
-                                           ble_gap_lesc_p256_pk_t const *p_pk_own,
-                                           ble_gap_lesc_oob_data_t      *p_oobd_own,
-                                           uint8_t * const               p_buf,
-                                           uint32_t * const              p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_LESC_OOB_DATA_GET;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_pk_own, p_buf, buf_len, &index, ble_gap_lesc_p256_pk_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_oobd_own, p_buf, buf_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_lesc_oob_data_get_rsp_dec(uint8_t const * const       p_buf,
-                                           uint32_t                    packet_len,
-                                           ble_gap_lesc_oob_data_t  * *pp_oobd_own,
-                                           uint32_t * const            p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    uint32_t index    = 0;
-    uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                        SD_BLE_GAP_LESC_OOB_DATA_GET,
-                                                        p_result_code);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_oobd_own,
-                              ble_gap_lesc_oob_data_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_set.c
deleted file mode 100644
index ebc1958..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_lesc_oob_data_set.c
+++ /dev/null
@@ -1,56 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_lesc_oob_data_set_req_enc(uint16_t             conn_handle,
-                                           ble_gap_lesc_oob_data_t const *p_oobd_own,
-                                           ble_gap_lesc_oob_data_t const *p_oobd_peer,
-                                           uint8_t * const      p_buf,
-                                           uint32_t * const     p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_LESC_OOB_DATA_SET;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_oobd_own, p_buf, buf_len, &index, ble_gap_lesc_oob_data_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_oobd_peer, p_buf, buf_len, &index, ble_gap_lesc_oob_data_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_lesc_oob_data_set_rsp_dec(uint8_t const * const              p_buf,
-                                           uint32_t                           packet_len,
-                                           uint32_t * const                   p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_LESC_OOB_DATA_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c
deleted file mode 100644
index 91c6cac..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_get.c
+++ /dev/null
@@ -1,68 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-
-
-uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params,
-                                  uint8_t * const                     p_buf,
-                                  uint32_t * const                    p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_PPCP_GET;
-    p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const         p_buf,
-                                  uint32_t                      packet_len,
-                                  ble_gap_conn_params_t * const p_conn_params,
-                                  uint32_t * const              p_result_code)
-{
-    uint32_t index = 0;
-
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                             SD_BLE_GAP_PPCP_GET, p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_NOT_NULL(p_conn_params);
-
-    SER_ASSERT_LENGTH_LEQ(index + 8, packet_len);
-    uint16_dec(p_buf, packet_len, &index, &p_conn_params->min_conn_interval);
-    uint16_dec(p_buf, packet_len, &index, &p_conn_params->max_conn_interval);
-    uint16_dec(p_buf, packet_len, &index, &p_conn_params->slave_latency);
-    uint16_dec(p_buf, packet_len, &index, &p_conn_params->conn_sup_timeout);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return decode_result;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c
deleted file mode 100644
index dc95078..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_ppcp_set.c
+++ /dev/null
@@ -1,54 +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 "ble_gap_app.h"
-#include <stddef.h>
-#include "nrf_error.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params,
-                                  uint8_t * const                     p_buf,
-                                  uint32_t * const                    p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_PPCP_SET;
-    p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_conn_params != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len);
-        index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]);
-        index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]);
-        index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]);
-        index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]);
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_PPCP_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c
deleted file mode 100644
index 6dd268d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_get.c
+++ /dev/null
@@ -1,80 +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 "ble_gap_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gap_rssi_get_req_enc(uint16_t             conn_handle,
-                                  int8_t const * const p_rssi,
-                                  uint8_t  * const     p_buf,
-                                  uint32_t * const     p_buf_len)
-{
-    uint32_t index     = 0;
-    uint32_t err_code  = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t total_len = *p_buf_len;
-    SER_ASSERT_LENGTH_LEQ(index + 1, total_len);
-
-    p_buf[index++] = SD_BLE_GAP_RSSI_GET;
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_rssi, p_buf, total_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  int8_t * const        p_rssi,
-                                  uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GAP_RSSI_GET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    decode_result = uint8_t_dec(p_buf, packet_len, &index, (uint8_t *) p_rssi);
-    SER_ASSERT(decode_result == NRF_SUCCESS, decode_result);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return decode_result;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c
deleted file mode 100644
index 0f069b7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_start.c
+++ /dev/null
@@ -1,53 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gap_rssi_start_req_enc(uint16_t         conn_handle,
-                                    uint8_t          threshold_dbm,
-                                    uint8_t          skip_count,
-                                    uint8_t * const  p_buf,
-                                    uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_RSSI_START;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = uint8_t_enc(&threshold_dbm, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = uint8_t_enc(&skip_count, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_START, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c
deleted file mode 100644
index 8507f0f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_rssi_stop.c
+++ /dev/null
@@ -1,45 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gap_rssi_stop_req_enc(uint16_t         conn_handle,
-                                   uint8_t * const  p_buf,
-                                   uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    uint8_t op_code = SD_BLE_GAP_RSSI_STOP;
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_RSSI_STOP, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c
deleted file mode 100644
index 62996ef..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_scan_start.c
+++ /dev/null
@@ -1,45 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "cond_field_serialization.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-
-uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const *  p_scan_params,
-                                    uint8_t * const                p_buf,
-                                    uint32_t * const               p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_SCAN_START;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_START, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c
deleted file mode 100644
index 342bb54..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_scan_stop.c
+++ /dev/null
@@ -1,40 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-
-uint32_t ble_gap_scan_stop_req_enc(uint8_t * const  p_buf,
-                                  uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_SCAN_STOP;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SCAN_STOP, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c
deleted file mode 100644
index 1e0134c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_sec_info_reply.c
+++ /dev/null
@@ -1,78 +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 "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "ble_gap.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_sec_info_reply_req_enc(uint16_t                    conn_handle,
-                                        ble_gap_enc_info_t  const * p_enc_info,
-                                        ble_gap_irk_t       const * p_id_info, 
-                                        ble_gap_sign_info_t const * p_sign_info,
-                                        uint8_t * const             p_buf,
-                                        uint32_t * const            p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-    
-    uint8_t  op_code  = SD_BLE_GAP_SEC_INFO_REPLY;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    SER_ASSERT_LENGTH_LEQ(index + 1, buf_len);
-    p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_enc_info != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, buf_len);
-        memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN);
-        index         += BLE_GAP_SEC_KEY_LEN;
-        p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1));
-    }
-    
-    err_code = cond_field_enc(p_id_info, p_buf, buf_len, &index, ble_gap_irk_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, buf_len);
-    p_buf[index++] = (p_sign_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_sign_info != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN, buf_len);
-        memcpy(&p_buf[index], p_sign_info->csrk, BLE_GAP_SEC_KEY_LEN);
-        index += BLE_GAP_SEC_KEY_LEN;
-    }
-    
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_SEC_INFO_REPLY, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c
deleted file mode 100644
index a199878..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_sec_params_reply.c
+++ /dev/null
@@ -1,87 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_sec_params_reply_req_enc(uint16_t                           conn_handle,
-                                          uint8_t                            sec_status,
-                                          ble_gap_sec_params_t const * const p_sec_params,
-                                          ble_gap_sec_keyset_t const * const p_sec_keyset,
-                                          uint8_t * const                    p_buf,
-                                          uint32_t * const                   p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_SEC_PARAMS_REPLY;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&sec_status, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_sec_params, p_buf, buf_len, &index, ble_gap_sec_params_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_sec_keyset, p_buf, buf_len, &index, ble_gap_sec_keyset_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const              p_buf,
-                                          uint32_t                           packet_len,
-                                          ble_gap_sec_keyset_t const * const p_sec_keyset,
-                                          uint32_t * const                   p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t index    = 0;
-
-    err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, SD_BLE_GAP_SEC_PARAMS_REPLY, p_result_code);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_NOT_NULL(p_sec_keyset);
-
-    err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&p_sec_keyset, ble_gap_sec_keyset_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c
deleted file mode 100644
index a461338..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_tx_power_set.c
+++ /dev/null
@@ -1,45 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gap_tx_power_set_req_enc(int8_t           tx_power,
-                                      uint8_t * const  p_buf,
-                                      uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_TX_POWER_SET;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&tx_power, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_TX_POWER_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_app.h
deleted file mode 100644
index 77cbd59..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_app.h
+++ /dev/null
@@ -1,451 +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.
- *
- */
-#ifndef BLE_GATTC_APP_H__
-#define BLE_GATTC_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_gattc_app GATTC Application command request encoders and command response decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    GATTC Application command request encoders and command response decoders.
- */
-#include "ble_gattc.h"
-#include "ble.h"
-
-/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format,
- *     @ref ble_gattc_primary_services_discover_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      start_handle   Handle to start searching from.
- * @param[in]      p_srvc_uuid    Pointer to a @ref ble_uuid_t which indicates the service UUID to
- *                                be found. If it is NULL, all primary services will be returned.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t                 conn_handle,
-                                                     uint16_t                 start_handle,
-                                                     ble_uuid_t const * const p_srvc_uuid,
-                                                     uint8_t * const          p_buf,
-                                                     uint32_t *               p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_primary_services_discover command.
- *
- * @sa @ref nrf51_sd_ble_gattc_primary_services_discover_encoding for packet format,
- *     @ref ble_gattc_primary_services_discover_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf,
-                                                     uint32_t              packet_len,
-                                                     uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format,
- *     @ref ble_gattc_descriptors_discover_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_handle_range A pointer to the range of handles of the Service to perform
- *                                this procedure on.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_descriptors_discover_req_enc(
-    uint16_t                               conn_handle,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t *                             p_buf_len);
-
-
-/**@brief Decodes response to @ref sd_ble_gattc_descriptors_discover command.
- *
- * @sa @ref nrf51_sd_ble_gattc_descriptors_discover_encoding for packet format,
- *     @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf,
-                                                uint32_t              packet_len,
-                                                uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_relationships_discover command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format,
- *     @ref ble_gattc_relationships_discover_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_handle_range A pointer to the range of handles of the Service to perform
- *                                this procedure on.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_relationships_discover_req_enc(
-    uint16_t                               conn_handle,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t *                             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_relationships_discover command.
- *
- * @sa @ref nrf51_sd_ble_gattc_relationships_discover_encoding for packet format,
- *     @ref ble_gattc_relationships_discover_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf,
-                                                  uint32_t              packet_len,
-                                                  uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format,
- *     @ref ble_gattc_characteristics_discover_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_handle_range A pointer to the range of handles of the Service to perform
- *                                this procedure on.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_characteristics_discover_req_enc
-    (uint16_t                              conn_handle,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t *                             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_characteristics_discover command.
- *
- * @sa @ref nrf51_sd_ble_gattc_characteristics_discover_encoding for packet format,
- *     @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf,
-                                                    uint32_t              packet_len,
-                                                    uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_read command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format,
- *     @ref ble_gattc_read_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      handle         The handle of the attribute to be read.
- * @param[in]      offset         Offset into the attribute value to be read.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_read_req_enc(uint16_t        conn_handle,
-                                uint16_t        handle,
-                                uint16_t        offset,
-                                uint8_t * const p_buf,
-                                uint32_t *      p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_read command.
- *
- * @sa @ref nrf51_sd_ble_gattc_read_encoding for packet format,
- *     @ref ble_gattc_read_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf,
-                                uint32_t              packet_len,
-                                uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_char_values_read command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format,
- *     @ref ble_gattc_char_values_read_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_handles      A pointer to the handle(s) of the attribute(s) to be read.
- * @param[in]      handle_count   The number of handles in p_handles.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_char_values_read_req_enc(uint16_t               conn_handle,
-                                            uint16_t const * const p_handles,
-                                            uint16_t               handle_count,
-                                            uint8_t * const        p_buf,
-                                            uint32_t *             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_char_values_read command.
- *
- * @sa @ref nrf51_sd_ble_gattc_char_values_read for packet format,
- *     @ref ble_gattc_char_values_read_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_write command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format,
- *     @ref ble_gattc_write_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_write_params Pointer to \ref sd_ble_gattc_write params.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_write_req_enc(uint16_t                               conn_handle,
-                                 ble_gattc_write_params_t const * const p_write_params,
-                                 uint8_t * const                        p_buf,
-                                 uint32_t *                             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_write command.
- *
- * @sa @ref nrf51_sd_ble_gattc_write_encoding for packet format,
- *     @ref ble_gattc_write_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_hv_confirm command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format,
- *     @ref ble_gattc_hv_confirm_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      handle         Handle of the attribute in the indication.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_hv_confirm_req_enc(uint16_t         conn_handle,
-                                      uint16_t         handle,
-                                      uint8_t * const  p_buf,
-                                      uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_hv_confirm command.
- *
- * @sa @ref nrf51_sd_ble_gattc_hv_confirm for packet format,
- *     @ref ble_gattc_hv_confirm_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Pointer to command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command request.
- *
- * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format,
- *     @ref ble_gattc_char_value_by_uuid_read_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_uuid         Pointer to a characteristic value UUID to read.
- * @param[in]      p_handle_range Pointer to the range of handles to perform this procedure on.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_char_value_by_uuid_read_req_enc
-    (uint16_t                              conn_handle,
-    ble_uuid_t const * const               p_uuid,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t * const                       p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_char_value_by_uuid_read command.
- *
- * @sa @ref nrf51_sd_ble_gattc_char_value_by_uuid_read_encoding for packet format,
- *     @ref ble_gattc_char_value_by_uuid_read_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code Pointer to command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf,
-                                                   uint32_t              packet_len,
-                                                   uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gattc_attr_info_discover command request.
- *
- * @sa @ref ble_gattc_attr_info_discover_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_handle_range Pointer to the range of handles
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gattc_attr_info_discover_req_enc(uint16_t                               conn_handle,
-                                              ble_gattc_handle_range_t const * const p_handle_range,
-                                              uint8_t * const                        p_buf,
-                                              uint32_t *                             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gattc_attr_info_discover command.
- *
- * @sa @ref ble_gattc_attr_info_discover_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code Pointer to command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gattc_attr_info_discover_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              uint32_t * const      p_result_code);
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_gattc_attr_info_discover.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_attr_info_discover.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_attr_info_discover.c
deleted file mode 100644
index 3ae1c13..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_attr_info_discover.c
+++ /dev/null
@@ -1,49 +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 "ble_gattc_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gattc_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gattc_attr_info_discover_req_enc(uint16_t                               conn_handle,
-                                              ble_gattc_handle_range_t const * const p_handle_range,
-                                              uint8_t * const                        p_buf,
-                                              uint32_t *                             p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code;
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTC_ATTR_INFO_DISCOVER;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-    
-    err_code = cond_field_enc(p_handle_range, p_buf, *p_buf_len, &index, ble_gattc_handle_range_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gattc_attr_info_discover_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_ATTR_INFO_DISCOVER, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c
deleted file mode 100644
index d9e55ea..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_char_value_by_uuid_read.c
+++ /dev/null
@@ -1,61 +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.
- *
- */
-
-#include "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "ble_gattc_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "ble_types.h"
-#include <string.h>
-
-uint32_t ble_gattc_char_value_by_uuid_read_req_enc
-    (uint16_t                              conn_handle,
-    ble_uuid_t const * const               p_uuid,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t * const                       p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t err_code;
-    uint32_t index   = 0;
-    uint32_t buf_len = *p_buf_len;
-    uint8_t  opcode  = SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ;
-
-    err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_uuid, p_buf, buf_len, &index, ble_uuid_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_handle_range, p_buf, buf_len, &index, ble_gattc_handle_range_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf,
-                                                   uint32_t              packet_len,
-                                                   uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf,
-                               packet_len,
-                               SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ,
-                               p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c
deleted file mode 100644
index 3ffbb7a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_char_values_read.c
+++ /dev/null
@@ -1,48 +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.
- *
- */
-
-#include "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gattc_char_values_read_req_enc(uint16_t               conn_handle,
-                                            uint16_t const * const p_handles,
-                                            uint16_t               handle_count,
-                                            uint8_t * const        p_buf,
-                                            uint32_t *             p_buf_len)
-{
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index   = 0;
-    uint32_t buf_len = *p_buf_len;
-    uint32_t err_code;
-    uint8_t  opCode = SD_BLE_GATTC_CHAR_VALUES_READ;
-
-    err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    err_code = count16_cond_data16_enc(p_handles, handle_count, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    *p_buf_len = index;
-    return err_code;
-}
-
-
-uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHAR_VALUES_READ, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c
deleted file mode 100644
index 1be7548..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_characteristics_discover.c
+++ /dev/null
@@ -1,57 +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 "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_characteristics_discover_req_enc(
-    uint16_t                               conn_handle,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t *                             p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTC_CHARACTERISTICS_DISCOVER;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-    p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_handle_range != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len);
-
-        index += uint16_encode(p_handle_range->start_handle, &p_buf[index]);
-        index += uint16_encode(p_handle_range->end_handle, &p_buf[index]);
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf,
-                                                    uint32_t              packet_len,
-                                                    uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_CHARACTERISTICS_DISCOVER,
-                               p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c
deleted file mode 100644
index bf1bc69..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_descriptors_discover.c
+++ /dev/null
@@ -1,53 +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 "ble_gattc_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gattc_descriptors_discover_req_enc(
-    uint16_t                               conn_handle,
-    ble_gattc_handle_range_t const * const p_handle_range,
-    uint8_t * const                        p_buf,
-    uint32_t *                             p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTC_DESCRIPTORS_DISCOVER;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-    p_buf[index++] = (p_handle_range == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    if (p_handle_range != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 2 + 2, *p_buf_len);
-        index += uint16_encode(p_handle_range->start_handle, &p_buf[index]);
-        index += uint16_encode(p_handle_range->end_handle, &p_buf[index]);
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf,
-                                                uint32_t              packet_len,
-                                                uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_DESCRIPTORS_DISCOVER, p_result_code);
-}


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/ble_gatts_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_app.h
deleted file mode 100644
index c5ed7c2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_app.h
+++ /dev/null
@@ -1,639 +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.
- *
- */
-#ifndef BLE_GATTS_APP_H__
-#define BLE_GATTS_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_gatts_app GATTS Application command request encoders and command response decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    GATTS Application command request encoders and command response decoders.
- */
-#include "ble_gatts.h"
-#include "ble.h"
-
-/**@brief Encodes @ref sd_ble_gatts_value_get command request.
- *
- * @sa @ref nrf51_gatts_value_get_encoding for packet format,
- *     @ref ble_gatts_value_get_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle    Connection handle.
- * @param[in] handle         Attribute handle.
- * @param[in] p_value        Pointer to attribute value information.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_data_len and \p p_data will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gatts_value_get_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_value_get_req_enc(uint16_t                        conn_handle,
-                                     uint16_t                        handle,
-                                     ble_gatts_value_t const * const p_value,
-                                     uint8_t * const                 p_buf,
-                                     uint32_t * const                p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_value_get command.
- *
- * @sa @ref nrf51_gatts_value_get_encoding for packet format,
- *     @ref ble_gatts_value_get_req_enc for command request encoder.
- *
- * @param[in]  p_buf           Pointer to beginning of command response packet.
- * @param[in]  packet_len      Length (in bytes) of response packet.
- * @param[out] p_value         Pointer to structure where the attribute value will be stored.
- * @param[out] p_result_code   Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Length of \p p_value is too small to hold decoded
- *                                   value from response.
- */
-uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const      p_buf,
-                                     uint32_t                   packet_len,
-                                     ble_gatts_value_t *  const p_value,
-                                     uint32_t * const           p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_hvx command request.
- *
- * @sa @ref nrf51_gatts_hvx_encoding for packet format,
- *     @ref ble_gatts_hvx_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle    Connection handle.
- * @param[in] p_hvx_params   Pointer to an HVx parameters structure to be encoded.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_hvx_params will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gatts_hvx_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_hvx_req_enc(uint16_t                             conn_handle,
-                               ble_gatts_hvx_params_t const * const p_hvx_params,
-                               uint8_t * const                      p_buf,
-                               uint32_t * const                     p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_hvx command.
- *
- * @sa @ref nrf51_gatts_hvx_encoding for packet format,
- *     @ref ble_gatts_hvx_req_enc for command request encoder.
- *
- * @param[in]  p_buf            Pointer to beginning of command response packet.
- * @param[in]  packet_len       Length (in bytes) of response packet.
- * @param[out] p_result_code    Command result code.
- * @param[out] pp_bytes_written Pointer to pointer to location where number of bytes is written.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf,
-                               uint32_t              packet_len,
-                               uint32_t * const      p_result_code,
-                               uint16_t * * const    pp_bytes_written);
-
-/**@brief Encodes @ref sd_ble_gatts_characteristic_add command request.
- *
- * @sa @ref nrf51_characteristics_add_encoding for packet format,
- *     @ref ble_gatts_characteristic_add_rsp_dec for command response decoder.
- *
- * @param[in] service_handle     Handle of the service where the characteristic is to be placed.
- *                               If @ref BLE_GATT_HANDLE_INVALID is used, it will be placed
- *                               sequentially.
- * @param[in] p_char_md          Pointer to a @ref ble_gatts_char_md_t structure, characteristic
- *                               metadata.
- * @param[in] p_attr_char_value  Pointer to a @ref ble_gatts_attr_t structure, corresponding to
- *                               the characteristic value.
- * @param[in] p_handles          Pointer to a @ref ble_gatts_char_handles_t structure, where the
- *                               assigned handles will be stored.
- * @param[in] p_buf              Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len      \c in: Size of \p p_buf buffer.
- *                               \c out: Length of encoded command packet.
- *
- * @note  \p p_handles will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gatts_characteristic_add_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_characteristic_add_req_enc
-    (uint16_t                              service_handle,
-    ble_gatts_char_md_t const * const      p_char_md,
-    ble_gatts_attr_t const * const         p_attr_char_value,
-    ble_gatts_char_handles_t const * const p_handles,
-    uint8_t * const                        p_buf,
-    uint32_t * const                       p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_characteristic_add command.
- *
- * @sa @ref nrf51_characteristics_add_encoding for packet format,
- *     @ref ble_gatts_characteristic_add_req_enc for command request encoder.
- *
- * @param[in]  p_buf              Pointer to beginning of command response packet.
- * @param[in]  packet_len         Length (in bytes) of response packet.
- * @param[out] pp_handles         Pointer to pointer to location where handles should be decoded.
- * @param[out] p_result_code      Pointer to command result code decode location.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              uint16_t * * const    pp_handles,
-                                              uint32_t * const      p_result_code);
-
-
-/**@brief Encodes @ref sd_ble_gatts_service_add command request.
- *
- * @sa @ref nrf51_gatts_service_add_encoding for packet format,
- *     @ref ble_gatts_service_add_rsp_dec for command response decoder.
- *
- * @param[in] type           Toggles between primary and secondary services,
- *                           see @ref BLE_GATTS_SRVC_TYPES.
- * @param[in] p_uuid         Pointer to service UUID.
- * @param[in] p_conn_handle  Pointer to a 16-bit word where the assigned handle will be stored.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_conn_handle will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gatts_service_add_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_service_add_req_enc(uint8_t                  type,
-                                       ble_uuid_t const * const p_uuid,
-                                       uint16_t const * const   p_conn_handle,
-                                       uint8_t * const          p_buf,
-                                       uint32_t * const         p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_service_add command.
- *
- * @sa @ref nrf51_gatts_service_add_encoding for packet format,
- *     @ref ble_gatts_service_add_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_conn_handle  Connection handle.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf,
-                                       uint32_t              packet_len,
-                                       uint16_t * const      p_conn_handle,
-                                       uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command request.
- *
- * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format,
- *     @ref ble_gatts_sys_attr_set_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle        Connection handle.
- * @param[in] p_sys_attr_data    Pointer to a buffer (at least \p sys_attr_data_len bytes long)
- *                               containing the attribute value to write.
- * @param[in] sys_attr_data_len  Length (in bytes) of \p p_sys_attr_data.
- * @param[in] flags              Optional additional flags.
- * @param[in] p_buf              Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len      \c in: Size of \p p_buf buffer.
- *                               \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t              conn_handle,
-                                        uint8_t const * const p_sys_attr_data,
-                                        uint16_t              sys_attr_data_len,
-                                        uint32_t              flags,
-                                        uint8_t * const       p_buf,
-                                        uint32_t * const      p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_set command.
- *
- * @sa @ref nrf51_gatts_sys_attr_set_encoding for packet format,
- *     @ref ble_gatts_sys_attr_set_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_value_set command request.
- *
- * @sa @ref nrf51_gatts_value_set_encoding for packet format,
- *     @ref ble_gatts_value_set_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle    Connection handle.
- * @param[in] handle         Attribute handle.
- * @param[in] p_value        Pointer to attribute value information.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_value_set_req_enc(uint16_t             conn_handle,
-                                     uint16_t             handle,
-                                     ble_gatts_value_t *  p_value, 
-                                     uint8_t * const      p_buf,
-                                     uint32_t * const     p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_value_set command.
- *
- * @sa @ref nrf51_gatts_value_set_encoding for packet format,
- *     @ref ble_gatts_value_set_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_value        Pointer to attribute value information..
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const       p_buf,
-                                     uint32_t                    packet_len,
-                                     ble_gatts_value_t * const   p_value,
-                                     uint32_t * const            p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_sys_attr_get command request.
- *
- * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format,
- *     @ref ble_gatts_sys_attr_get_rsp_dec for command response decoder.
- *
- * @param[in]     conn_handle          Connection handle of the connection.
- * @param[in]     p_sys_attr_data      Pointer to buffer where updated information about system
- *                                     attributes will be stored. Can be NULL to calculate required
- *                                     size.
- * @param[in]     p_sys_attr_data_len  Size of p_sys_attr_data buffer if \p p_sys_attr_data is
- *                                     not NULL.
- * @param[in]     flags                Additional optional flags.
- * @param[in,out] p_buf                Pointer to buffer where encoded data command will
- *                                     be returned.
- * @param[in,out] p_buf_len            \c in: size of \p p_buf buffer.
- *                                     \c out: Length of encoded command packet.
- *
- * @note  \p p_sys_attr_data and \p p_sys_attr_data_len will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gatts_sys_attr_get_rsp_dec.
- *
- * @retval NRF_SUCCESS               Encoding success.
- * @retval NRF_ERROR_NULL            Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t               conn_handle,
-                                        uint8_t const * const  p_sys_attr_data,
-                                        uint16_t const * const p_sys_attr_data_len,
-                                        uint32_t               flags,
-                                        uint8_t * const        p_buf,
-                                        uint32_t *             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_get command.
- *
- * @sa @ref nrf51_gatts_sys_attr_get_encoding for packet format,
- *     @ref ble_gatts_sys_attr_get_req_enc for command request encoder.
- *
- * @param[in] p_buf                    Pointer to beginning of command response packet.
- * @param[in] packet_len               Length (in bytes) of response packet.
- * @param[out] p_sys_attr_data         Pointer to a buffer where updated information about system
- *                                     attributes will be stored.
- * @param[in,out] p_sys_attr_data_len  \c in: Size (in bytes) of \p p_sys_attr_data buffer.
- *                                     \c out: Length of decoded contents of \p p_sys_attr_data.
- * @param[out] p_result_code           Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Length of \p p_sys_attr_data is too small to hold decoded
- *                                   value from response.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint8_t * const       p_sys_attr_data,
-                                        uint16_t * const      p_sys_attr_data_len,
-                                        uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_descriptor_add command request.
- *
- * @sa @ref nrf51_descriptor_add_encoding for packet format,
- *     @ref ble_gatts_descriptor_add_rsp_dec for command response decoder.
- *
- * @param[in] char_handle        Handle of the characteristic where the description is to be placed.
- *                               If @ref BLE_GATT_HANDLE_INVALID is used, it will be placed
- *                               sequentially.
- * @param[in] p_attr         Pointer to a @ref ble_gatts_attr_t structure, characteristic
- *                               metadata.
- * @param[in] p_handle           Pointer to a @ref ble_gatts_char_handles_t structure, where the
- *                               assigned handles will be stored.
- * @param[in] p_buf              Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len      \c in: Size of \p p_buf buffer.
- *                               \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_descriptor_add_req_enc(uint16_t                       char_handle,
-                                          ble_gatts_attr_t const * const p_attr,
-                                          uint16_t * const               p_handle,
-                                          uint8_t * const                p_buf,
-                                          uint32_t * const               p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_descriptor_add command.
- *
- * @sa @ref nrf51_descriptor_add_encoding for packet format,
- *     @ref ble_gatts_descriptor_add_req_enc for command request encoder.
- *
- * @param[in]  p_buf              Pointer to beginning of command response packet.
- * @param[in]  packet_len         Length (in bytes) of response packet.
- * @param[out] p_handle           Pointer to bufer where descriptor handle will be
-                                  returned.
- * @param[out] p_result_code      Pointer to command result code decode location.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          uint16_t * const      p_handle,
-                                          uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_include_add command request.
- *
- * @sa @ref nrf51_gatts_include_add_encoding for packet format,
- *     @ref ble_gatts_include_add_rsp_dec for command response decoder.
- *
- * @param[in] service_handle     Handle of the service where the included service is to be placed.
- * @param[in] inc_srvc_handle    Handle of the included service
- * @param[in] p_include_handle   Pointer to Pointer to a 16-bit word where the assigned handle will be stored.
- * @param[in] p_buf              Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len      \c in: Size of \p p_buf buffer.
- *                               \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_include_add_req_enc(uint16_t         service_handle,
-                                       uint16_t         inc_srvc_handle,
-                                       uint16_t * const p_include_handle,
-                                       uint8_t * const  p_buf,
-                                       uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_include_add command.
- *
- * @sa @ref nrf51_gatts_include_add_encoding for packet format,
- *     @ref ble_gatts_include_add_req_enc for command request encoder.
- *
- * @param[in]  p_buf              Pointer to beginning of command response packet.
- * @param[in]  packet_len         Length (in bytes) of response packet.
- * @param[out] p_include_handle   Pointer to a 16-bit word where the assigned handle will be stored.
- * @param[out] p_result_code      Pointer to command result code decode location.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf,
-                                       uint32_t              packet_len,
-                                       uint16_t * const      p_include_handle,
-                                       uint32_t * const      p_result_code);
-
-
-/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command request.
- *
- * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format,
- *     @ref ble_gatts_rw_authorize_reply_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle    Connection handle.
- * @param[in] p_reply_params Pointer to \ref ble_gatts_rw_authorize_reply_params_t
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Encoding failure. Invalid param provided in p_reply_params.
- */
-uint32_t ble_gatts_rw_authorize_reply_req_enc(
-    uint16_t conn_handle,
-    ble_gatts_rw_authorize_reply_params_t const * const
-    p_reply_params,
-    uint8_t * const
-    p_buf,
-    uint32_t * const
-    p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_rw_authorize_reply command.
- *
- * @sa @ref nrf51_gatts_rw_authorize_reply_encoding for packet format,
- *     @ref ble_gatts_rw_authorize_reply_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_service_changed command request.
- *
- * @sa @ref nrf51_service_changed_encoding for packet format,
- *     @ref ble_gatts_service_changed_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle    Connection handle.
- * @param[in] start_handle   Start of affected attribute handle range.
- * @param[in] end_handle     End of affected attribute handle range.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Encoding failure. Invalid param provided in p_reply_params.
- */
-uint32_t ble_gatts_service_changed_req_enc(uint16_t         conn_handle,
-                                           uint16_t         start_handle,
-                                           uint16_t         end_handle,
-                                           uint8_t * const  p_buf,
-                                           uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_service_changed command.
- *
- * @sa @ref nrf51_service_changed_encoding for packet format,
- *     @ref ble_gatts_service_changed_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf,
-                                           uint32_t              packet_len,
-                                           uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_attr_get command request.
- *
- * @sa  @ref ble_gatts_attr_get_rsp_dec for command response decoder.
- *
- * @param[in]     handle      See @ref sd_ble_gatts_attr_get.
- * @param[in]     p_uuid      See @ref sd_ble_gatts_attr_get.
- * @param[out]    p_md        See @ref sd_ble_gatts_attr_get.
- * @param[in,out] p_buf       Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len   \c in: size of \p p_buf buffer.
- *                            \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS               Encoding success.
- * @retval NRF_ERROR_NULL            Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_attr_get_req_enc(uint16_t              handle,
-                                    ble_uuid_t          * p_uuid,
-                                    ble_gatts_attr_md_t * p_md,
-                                    uint8_t * const       p_buf,
-                                    uint32_t *            p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_attr_get command.
- *
- * @sa @ref ble_gatts_attr_get_req_enc for command request encoder.
- *
- * @param[in] p_buf                  Pointer to beginning of command response packet.
- * @param[in] packet_len             Length (in bytes) of response packet.
- * @param[out] pp_md                 Pointer to address where to put output data.
- * @param[out] p_result_code         Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_attr_get_rsp_dec(uint8_t const * const  p_buf,
-                                    uint32_t               packet_len,
-                                    ble_gatts_attr_md_t ** pp_md,
-                                    uint32_t * const       p_result_code);
-
-/**@brief Encodes @ref sd_ble_gatts_initial_user_handle_get command request.
- *
- * @sa  @ref ble_gatts_initial_user_handle_get_rsp_dec for command response decoder.
- *
- * @param[out]    p_handle    See @ref sd_ble_gatts_initial_user_handle_get.
- * @param[in,out] p_buf       Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len   \c in: size of \p p_buf buffer.
- *                            \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS               Encoding success.
- * @retval NRF_ERROR_NULL            Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gatts_initial_user_handle_get_req_enc(uint16_t      * p_handle,
-                                                   uint8_t * const p_buf,
-                                                   uint32_t *      p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gatts_initial_user_handle_get command.
- *
- * @sa @ref ble_gatts_initial_user_handle_get_req_enc for command request encoder.
- *
- * @param[in] p_buf                  Pointer to beginning of command response packet.
- * @param[in] packet_len             Length (in bytes) of response packet.
- * @param[out] pp_handle             Pointer to address where to put output data.
- * @param[out] p_result_code         Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gatts_initial_user_handle_get_rsp_dec(uint8_t const * const  p_buf,
-                                                   uint32_t               packet_len,
-                                                   uint16_t ** pp_handle,
-                                                   uint32_t * const       p_result_code);
-/** @} */
-#ifdef __cplusplus
-}
-#endif
-
-#endif //BLE_GATTS_APP_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/serialization/application/codecs/s130/serializers/ble_gatts_attr_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_attr_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_attr_get.c
deleted file mode 100644
index c2e7b44..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_attr_get.c
+++ /dev/null
@@ -1,86 +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 "ble_gatts_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-#include "ble_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_attr_get_req_enc(uint16_t              handle,
-                                    ble_uuid_t          * p_uuid,
-                                    ble_gatts_attr_md_t * p_md,
-                                    uint8_t * const       p_buf,
-                                    uint32_t *            p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t total_len = *p_buf_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTS_ATTR_GET;
-
-    err_code = uint16_t_enc(&handle, p_buf, total_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_uuid, p_buf, total_len, &index, ble_uuid_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_md, p_buf, total_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_attr_get_rsp_dec(uint8_t const * const  p_buf,
-                                    uint32_t               packet_len,
-                                    ble_gatts_attr_md_t ** pp_md,
-                                    uint32_t * const       p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    uint32_t err_code;
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GATTS_ATTR_GET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_md,
-            ble_gatts_attr_md_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c
deleted file mode 100644
index b72e14b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_characteristic_add.c
+++ /dev/null
@@ -1,89 +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 "ble_gatts_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gatts.h"
-#include "app_util.h"
-#include "cond_field_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-
-uint32_t ble_gatts_characteristic_add_req_enc(
-    uint16_t                               service_handle,
-    ble_gatts_char_md_t const * const      p_char_md,
-    ble_gatts_attr_t const * const         p_attr_char_value,
-    ble_gatts_char_handles_t const * const p_handles,
-    uint8_t * const                        p_buf,
-    uint32_t * const                       p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-    uint8_t  opcode   = SD_BLE_GATTS_CHARACTERISTIC_ADD;
-    uint32_t buf_len  = *p_buf_len;
-
-    err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_char_md, p_buf, buf_len, &index, ble_gatts_char_md_enc);
-    SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_attr_char_value, p_buf, buf_len, &index, ble_gatts_attr_enc);
-    SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_handles, p_buf, buf_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              buf_len,
-                                              uint16_t * * const    pp_handles,
-                                              uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index = 0;
-
-    uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, buf_len,
-                                                        SD_BLE_GATTS_CHARACTERISTIC_ADD,
-                                                        p_result_code);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, buf_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf,
-                              buf_len,
-                              &index,
-                              (void * *)pp_handles,
-                              ble_gatts_char_handles_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, buf_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c
deleted file mode 100644
index 43b45d8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_descriptor_add.c
+++ /dev/null
@@ -1,91 +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.
- *
- */
-
-
-#include "ble_gatts_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-#include "cond_field_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-
-
-uint32_t ble_gatts_descriptor_add_req_enc(uint16_t                       char_handle,
-                                          ble_gatts_attr_t const * const p_attr,
-                                          uint16_t * const               p_handle,
-                                          uint8_t * const                p_buf,
-                                          uint32_t * const               p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(1, *p_buf_len);
-    p_buf[index++] = SD_BLE_GATTS_DESCRIPTOR_ADD;
-
-    uint32_t err_code = uint16_t_enc(&char_handle, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_attr,
-                              p_buf,
-                              *p_buf_len,
-                              &index,
-                              ble_gatts_attr_enc);
-    SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-    p_buf[index++] = (p_handle != NULL) ? SER_FIELD_PRESENT :
-                     SER_FIELD_NOT_PRESENT;
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          uint16_t * const      p_handle,
-                                          uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GATTS_DESCRIPTOR_ADD,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 2, packet_len);
-    SER_ASSERT_NOT_NULL(p_handle);
-
-    uint16_dec(p_buf, packet_len, &index, p_handle);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h
deleted file mode 100644
index 6e8ab02..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_app.h
+++ /dev/null
@@ -1,194 +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.
- *
- */
-#ifndef BLE_GATTS_EVT_APP_H__
-#define BLE_GATTS_EVT_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_gatts_evt_app GATTS Application event decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    GATTS Application event decoders.
- */
-#include "ble.h"
-
-/**
- * @brief Decodes ble_gatts_evt_hvc event.
- *
- * @sa @ref nrf51_gatts_evt_hvc_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf,
-                               uint32_t              packet_len,
-                               ble_evt_t * const     p_event,
-                               uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gatts_evt_rw_authorize_request event.
- *
- * @sa @ref nrf51_evt_rw_authorize_request for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf,
-                                                uint32_t              packet_len,
-                                                ble_evt_t * const     p_event,
-                                                uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gatts_evt_sc_confirm event.
- *
- * @sa @ref nrf51_gatts_evt_sc_confirm_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gatts_evt_sys_attr_missing event.
- *
- * @sa @ref nrf51_evt_sys_attr_missing_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            ble_evt_t * const     p_event,
-                                            uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gatts_evt_timeout event.
- *
- * @sa @ref nrf51_gatts_evt_timeout_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gatts_evt_write event.
- *
- * @sa @ref nrf51_evt_write_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_evt_t * const     p_event,
-                                 uint32_t * const      p_event_len);
-
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c
deleted file mode 100644
index 4707ae8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_hvc.c
+++ /dev/null
@@ -1,51 +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 "ble_gatts_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf,
-                               uint32_t              packet_len,
-                               ble_evt_t * const     p_event,
-                               uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len);
-
-    uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_hvc_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTS_EVT_HVC;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle);
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.hvc.handle);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c
deleted file mode 100644
index 9335725..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_rw_authorize_request.c
+++ /dev/null
@@ -1,78 +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.
- *
- */
-
-#include "ble_gatts_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-#include "app_ble_user_mem.h"
-#include "app_util.h"
-
-extern ser_ble_user_mem_t m_app_user_mem_table[];
-
-uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf,
-                                                uint32_t              packet_len,
-                                                ble_evt_t * const     p_event,
-                                                uint32_t * const      p_event_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    uint32_t in_event_len = *p_event_len;
-
-    *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t);
-
-    uint16_t conn_handle;
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    void * p_void_authorize_request = NULL;
-
-    if (p_event != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len);
-
-        p_event->header.evt_id             = BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST;
-        p_event->evt.gatts_evt.conn_handle = conn_handle;
-
-        p_void_authorize_request = &(p_event->evt.gatts_evt.params.authorize_request);
-    }
-    uint32_t tmp_event_len = in_event_len - *p_event_len;
-    err_code = ble_gatts_evt_rw_authorize_request_t_dec(p_buf,
-                                                        packet_len,
-                                                        &index,
-                                                        &tmp_event_len,
-                                                        p_void_authorize_request);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_event_len += tmp_event_len;
-    
-    if(p_event != NULL)
-    {
-        if((p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) && (p_event->evt.gatts_evt.params.authorize_request.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW))
-        {
-            uint32_t conn_index;
-        
-            if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND)
-            {      
-                err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len);
-                SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-            }
-        }
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c
deleted file mode 100644
index 4f6d2c4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sc_confirm.c
+++ /dev/null
@@ -1,49 +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.
- *
- */
-
-#include "ble_gatts_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE, packet_len);
-
-    uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE;
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTS_EVT_SC_CONFIRM;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c
deleted file mode 100644
index d9a0d0c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_sys_attr_missing.c
+++ /dev/null
@@ -1,51 +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 "ble_gatts_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            ble_evt_t * const     p_event,
-                                            uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(3, packet_len);
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gatts_evt.params.sys_attr_missing)) +
-                         sizeof (ble_gatts_evt_sys_attr_missing_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTS_EVT_SYS_ATTR_MISSING;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.sys_attr_missing.hint);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c
deleted file mode 100644
index bb959b7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_timeout.c
+++ /dev/null
@@ -1,50 +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 "ble_gatts_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_evt_timeout_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len);
-
-    uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gatts_evt_timeout_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GATTS_EVT_TIMEOUT;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.conn_handle);
-    uint8_dec(p_buf, packet_len, &index, &p_event->evt.gatts_evt.params.timeout.src);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c
deleted file mode 100644
index 3d8610c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_evt_write.c
+++ /dev/null
@@ -1,78 +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 "ble_gatts_evt_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-#include "app_ble_user_mem.h"
-#include "app_util.h"
-
-extern ser_ble_user_mem_t m_app_user_mem_table[];
-
-uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_evt_t * const     p_event,
-                                 uint32_t * const      p_event_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t index    = 0;
-
-    uint32_t in_event_len = *p_event_len;
-
-    *p_event_len = offsetof(ble_evt_t, evt.gatts_evt.params) - sizeof (ble_evt_hdr_t);
-
-    uint16_t conn_handle;
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    void * p_void_write = NULL;
-
-    if (p_event != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len);
-        p_event->evt.gatts_evt.conn_handle = conn_handle;
-
-        p_void_write = &(p_event->evt.gatts_evt.params.write);
-    }
-
-    uint32_t tmp_struct_len = in_event_len - *p_event_len;
-    err_code = ble_gatts_evt_write_t_dec(p_buf,
-                                         packet_len,
-                                         &index,
-                                         &tmp_struct_len,
-                                         p_void_write);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_event_len += tmp_struct_len;
-    
-    if(p_event != NULL)
-    {
-        if(p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)
-        {
-            uint32_t conn_index;
-
-            if(app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND)
-            {        
-                err_code = len16data_dec(p_buf, packet_len, &index, &m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len);
-                SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-            }
-        }
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c
deleted file mode 100644
index bfdf455..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_hvx.c
+++ /dev/null
@@ -1,115 +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 "ble_gatts_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_hvx_req_enc(uint16_t                             conn_handle,
-                               ble_gatts_hvx_params_t const * const p_hvx_params,
-                               uint8_t * const                      p_buf,
-                               uint32_t * const                     p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT(p_hvx_params == NULL ||
-               !(p_hvx_params->p_len == NULL && p_hvx_params->p_data != NULL), NRF_ERROR_NULL);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTS_HVX;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-
-    p_buf[index++] = (p_hvx_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_hvx_params != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 2 + 1 + 2 + 2, *p_buf_len);
-        index         += uint16_encode(p_hvx_params->handle, &p_buf[index]);
-        p_buf[index++] = p_hvx_params->type;
-        index         += uint16_encode(p_hvx_params->offset, &p_buf[index]);
-
-        if (p_hvx_params->p_len != NULL)
-        {
-            SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len);
-
-            SER_ERROR_CHECK(*p_hvx_params->p_len <= BLE_GATTS_VAR_ATTR_LEN_MAX,
-                            NRF_ERROR_INVALID_PARAM);
-            p_buf[index++] = SER_FIELD_PRESENT;
-            index         += uint16_encode(*(p_hvx_params->p_len), &p_buf[index]);
-
-            if (p_hvx_params->p_data != NULL)
-            {
-                SER_ASSERT_LENGTH_LEQ(index + 1 + *(p_hvx_params->p_len), *p_buf_len);
-                p_buf[index++] = SER_FIELD_PRESENT;
-                memcpy(&(p_buf[index]), p_hvx_params->p_data, *(p_hvx_params->p_len));
-                index += *(p_hvx_params->p_len);
-            }
-            else
-            {
-                p_buf[index++] = SER_FIELD_NOT_PRESENT;
-            }
-        }
-        else
-        {
-            p_buf[index++] = SER_FIELD_NOT_PRESENT;
-            p_buf[index++] = SER_FIELD_NOT_PRESENT;
-        }
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf,
-                               uint32_t              packet_len,
-                               uint32_t * const      p_result_code,
-                               uint16_t * * const    pp_bytes_written)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t err_code;
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GATTS_HVX,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_bytes_written, uint16_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c
deleted file mode 100644
index 4a5faca..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_include_add.c
+++ /dev/null
@@ -1,74 +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 "ble_gatts_app.h"
-#include "ble_serialization.h"
-#include "ble_gatts.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_include_add_req_enc(uint16_t         service_handle,
-                                       uint16_t         inc_srvc_handle,
-                                       uint16_t * const p_include_handle,
-                                       uint8_t * const  p_buf,
-                                       uint32_t * const p_buf_len)
-{
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-    SER_ASSERT_LENGTH_LEQ(6, *p_buf_len);
-
-    uint32_t index   = 0;
-    uint32_t buf_len = *p_buf_len;
-    uint32_t err_code;
-    uint8_t  opCode = SD_BLE_GATTS_INCLUDE_ADD;
-    uint8_t  presenceFlag;
-
-    err_code = uint8_t_enc(&opCode, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    err_code = uint16_t_enc(&service_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    err_code = uint16_t_enc(&inc_srvc_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    presenceFlag = (p_include_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-    err_code     = uint8_t_enc(&presenceFlag, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    *p_buf_len = index;
-    return err_code;
-
-}
-
-
-uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf,
-                                       uint32_t              packet_len,
-                                       uint16_t * const      p_include_handle,
-                                       uint32_t * const      p_result_code)
-{
-    uint32_t index = 0;
-    uint32_t err_code;
-
-    err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                               SD_BLE_GATTS_INCLUDE_ADD,
-                                               p_result_code);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-    SER_ASSERT_NOT_NULL(p_include_handle);
-    SER_ASSERT_LENGTH_LEQ(index + 2, packet_len);
-    err_code = uint16_t_dec(p_buf, packet_len, &index, p_include_handle);
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_initial_user_handle_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_initial_user_handle_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_initial_user_handle_get.c
deleted file mode 100644
index fc66a6a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_initial_user_handle_get.c
+++ /dev/null
@@ -1,78 +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 "ble_gatts_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-#include "ble_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_initial_user_handle_get_req_enc(uint16_t      * p_handle,
-                                                   uint8_t * const p_buf,
-                                                   uint32_t *      p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t total_len = *p_buf_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTS_INITIAL_USER_HANDLE_GET;
-
-    err_code = cond_field_enc(p_handle, p_buf, total_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_initial_user_handle_get_rsp_dec(uint8_t const * const  p_buf,
-                                                   uint32_t               packet_len,
-                                                   uint16_t ** pp_handle,
-                                                   uint32_t * const       p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    uint32_t err_code;
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GATTS_INITIAL_USER_HANDLE_GET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_handle,
-            uint16_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c
deleted file mode 100644
index 095f6c2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c
+++ /dev/null
@@ -1,74 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "cond_field_serialization.h"
-#include "ble_gap_struct_serialization.h"
-
-uint32_t ble_gap_conn_sec_get_req_enc(uint16_t                         conn_handle,
-                                      ble_gap_conn_sec_t const * const p_conn_sec,
-                                      uint8_t * const                  p_buf,
-                                      uint32_t * const                 p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index     = 0;
-    uint32_t total_len = *p_buf_len;
-    uint32_t err_code  = NRF_SUCCESS;
-    uint8_t  opcode    = SD_BLE_GAP_CONN_SEC_GET;
-
-
-    err_code = uint8_t_enc(&opcode, p_buf, total_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_conn_sec, p_buf, total_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const        p_buf,
-                                      uint32_t                     packet_len,
-                                      ble_gap_conn_sec_t * * const pp_conn_sec,
-                                      uint32_t * const             p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    uint32_t index    = 0;
-    uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                        SD_BLE_GAP_CONN_SEC_GET,
-                                                        p_result_code);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_conn_sec,
-                              ble_gap_conn_sec_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_connect.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c
deleted file mode 100644
index dd02fcc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c
+++ /dev/null
@@ -1,54 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "ble_gap_struct_serialization.h"
-
-uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const        p_peer_addr,
-                                 ble_gap_scan_params_t const * const p_scan_params,
-                                 ble_gap_conn_params_t const * const p_conn_params,
-                                 uint8_t * const                     p_buf,
-                                 uint32_t * const                    p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_CONNECT;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_peer_addr, p_buf, buf_len, &index, ble_gap_addr_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_conn_params, p_buf, buf_len, &index, ble_gap_conn_params_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c
deleted file mode 100644
index 06c87b2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c
+++ /dev/null
@@ -1,42 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "ble_gap_struct_serialization.h"
-
-uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const  p_buf,
-                                        uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_CONNECT_CANCEL;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT_CANCEL, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c
deleted file mode 100644
index e74558b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c
+++ /dev/null
@@ -1,84 +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 "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const  p_dev_name,
-                                         uint16_t const * const p_len,
-                                         uint8_t * const        p_buf,
-                                         uint32_t * const       p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_GET;
-    p_buf[index++] = (p_len != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_len != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
-        index += uint16_encode(*p_len, &p_buf[index]);
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-    p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         uint8_t * const       p_dev_name,
-                                         uint16_t * const      p_dev_name_len,
-                                         uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    uint32_t index       = 0;
-    uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                           SD_BLE_GAP_DEVICE_NAME_GET,
-                                                           p_result_code);
-
-    if (status_code != NRF_SUCCESS)
-    {
-        return status_code;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_NOT_NULL(p_dev_name_len);
-    status_code = len16data_dec(p_buf, packet_len, &index, (uint8_t * *)&p_dev_name, p_dev_name_len);
-
-    if (status_code != NRF_SUCCESS)
-    {
-        return status_code;
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return status_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c
deleted file mode 100644
index 15bdf3a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c
+++ /dev/null
@@ -1,66 +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 "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm,
-                                         uint8_t const * const                 p_dev_name,
-                                         uint16_t                              len,
-                                         uint8_t * const                       p_buf,
-                                         uint32_t * const                      p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(2, *p_buf_len);
-    p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_SET;
-
-    p_buf[index++] = (p_write_perm != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_write_perm != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-        p_buf[index++] = (uint8_t) ((p_write_perm->sm) | (p_write_perm->lv << 4));
-    }
-
-    SER_ERROR_CHECK(len <= BLE_GAP_DEVNAME_MAX_LEN, NRF_ERROR_INVALID_PARAM);
-
-    SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
-    index += uint16_encode(len, &p_buf[index]);
-
-    p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_dev_name != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + len, *p_buf_len);
-        memcpy(&p_buf[index], p_dev_name, len);
-        index += len;
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DEVICE_NAME_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c
deleted file mode 100644
index bd947dd..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c
+++ /dev/null
@@ -1,45 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_disconnect_req_enc(uint16_t         conn_handle,
-                                    uint8_t          hci_status_code,
-                                    uint8_t * const  p_buf,
-                                    uint32_t * const p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_DISCONNECT;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-    p_buf[index++] = hci_status_code;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DISCONNECT, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c
deleted file mode 100644
index 214d8dd..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c
+++ /dev/null
@@ -1,68 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_encrypt_req_enc( uint16_t             	            conn_handle,
-								                  ble_gap_master_id_t const * const p_master_id,
-								                  ble_gap_enc_info_t const  * const p_enc_info,
-								                  uint8_t                   * const p_buf,
-								                  uint32_t                  * const p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_ENCRYPT;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-    p_buf[index++] = (p_master_id != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_master_id != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_RAND_LEN + 2, *p_buf_len);
-        index += uint16_encode(p_master_id->ediv, &p_buf[index]);
-        memcpy(&p_buf[index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN);
-        index += BLE_GAP_SEC_RAND_LEN;
-    }
-
-    p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_enc_info != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, *p_buf_len);
-        memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN);
-        index += BLE_GAP_SEC_KEY_LEN;
-        p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1));
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 uint32_t      * const p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ENCRYPT, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c
deleted file mode 100644
index 7064b71..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c
+++ /dev/null
@@ -1,72 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    ble_evt_t * const     p_event,
-                                    uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-    uint8_t  byte;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE+7+1+1, packet_len); // assumed size(data) = 0
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.adv_report)) +
-                         sizeof (ble_gap_evt_adv_report_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_ADV_REPORT;
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.peer_addr));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.rssi));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &byte);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p_event->evt.gap_evt.params.adv_report.scan_rsp = byte & 0x01;
-    p_event->evt.gap_evt.params.adv_report.type = (byte >> 1) & 0x03;
-    p_event->evt.gap_evt.params.adv_report.dlen = (byte >> 3) & 0x1F;
-
-    err_code = uint8_vector_dec(p_buf, packet_len, &index,
-        p_event->evt.gap_evt.params.adv_report.data, (uint16_t)(p_event->evt.gap_evt.params.adv_report.dlen));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h
deleted file mode 100644
index 12c1f1b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h
+++ /dev/null
@@ -1,466 +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.
- *
- */
-#ifndef BLE_GAP_EVT_APP_H__
-#define BLE_GAP_EVT_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_gap_evt_app GAP Application event decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    GAP Application event decoders.
- */
-#include "ble.h"
-
-/**
- * @brief Decodes ble_gap_evt_auth_key_request event.
- *
- * @sa @ref nrf51_evt_auth_key_request_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          ble_evt_t * const     p_event,
-                                          uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_auth_status event.
- *
- * @sa @ref nrf51_evt_auth_status_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     ble_evt_t * const     p_event,
-                                     uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_conn_param_update event.
- *
- * @sa @ref nrf51_evt_conn_param_update_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf,
-                                           uint32_t              packet_len,
-                                           ble_evt_t * const     p_event,
-                                           uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_conn_sec_update event.
- *
- * @sa @ref nrf51_evt_conn_sec_update_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_connected event.
- *
- * @sa @ref nrf51_evt_connected_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_disconnected event.
- *
- * @sa @ref nrf51_evt_disconnected_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_passkey_display event.
- *
- * @sa @ref nrf51_evt_passkey_display for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_rssi_changed event.
- *
- * @sa @ref nrf51_evt_rssi_changed_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_sec_info_request event.
- *
- * @sa @ref nrf51_evt_sec_info_request_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          ble_evt_t * const     p_event,
-                                          uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_sec_params_request event.
- *
- * @sa @ref nrf51_evt_sec_param_request_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            ble_evt_t * const     p_event,
-                                            uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_timeout event.
- *
- * @sa @ref nrf51_evt_timeout_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_timeout_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_evt_t * const     p_event,
-                                 uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_sec_request event.
- *
- * @sa @ref nrf51_evt_sec_request_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     ble_evt_t * const     p_event,
-                                     uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_conn_param_update_request event.
- *
- * @sa @ref nrf51_evt_conn_param_update_request_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf,
-                                                   uint32_t              packet_len,
-                                                   ble_evt_t * const     p_event,
-                                                   uint32_t * const      p_event_len);
-/**
- * @brief Decodes ble_gap_evt_adv_report event.
- *
- * @sa @ref nrf51_evt_adv_report_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    ble_evt_t * const     p_event,
-                                    uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_scan_req_report event.
- *
- * @sa @ref nrf51_evt_scan_req_report_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_gap_evt_key_pressed event.
- *
- * @sa @ref nrf51_evt_key_pressed_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_key_pressed_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len);
-/**
- * @brief Decodes ble_gap_evt_lesc_dhkey_request event.
- *
- * @sa @ref nrf51_evt_lesc_dhkey_request_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_gap_evt_lesc_dhkey_request_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            ble_evt_t * const     p_event,
-                                            uint32_t * const      p_event_len);
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c
deleted file mode 100644
index 122381c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c
+++ /dev/null
@@ -1,53 +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.
- *
- */
-
-#include "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          ble_evt_t * const     p_event,
-                                          uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t event_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(3, packet_len);
-
-    event_len = SER_EVT_CONN_HANDLE_SIZE + 1;
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_AUTH_KEY_REQUEST;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-
-    uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.auth_key_request.key_type);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c
deleted file mode 100644
index 95d5a51..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c
+++ /dev/null
@@ -1,72 +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 "ble_gap_evt_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-#include "app_ble_gap_sec_keys.h"
-
-extern ser_ble_gap_app_keyset_t m_app_keys_table[];
-
-uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     ble_evt_t * const     p_event,
-                                     uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t conn_index;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len);
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.auth_status)) +
-                         sizeof (ble_gap_evt_adv_report_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    p_event->header.evt_id  = BLE_GAP_EVT_AUTH_STATUS;
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_evt_auth_status_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.auth_status));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_event->evt.gap_evt.params.auth_status.bonded)
-    {
-		// keyset is an extension of standard event data - used to synchronize keys at application
-		err_code = app_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index);
-		SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-		err_code = ble_gap_sec_keyset_t_dec(p_buf, packet_len, &index, &(m_app_keys_table[conn_index].keyset));
-		SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-		err_code = app_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle);
-		SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-		SER_ASSERT_LENGTH_EQ(index, packet_len);
-		*p_event_len = event_len;
-    }
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c
deleted file mode 100644
index 10599f8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c
+++ /dev/null
@@ -1,58 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf,
-                                           uint32_t              packet_len,
-                                           ble_evt_t * const     p_event,
-                                           uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len);
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_gap_evt_t, params.conn_param_update)) +
-                         sizeof (ble_gap_evt_conn_param_update_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_CONN_PARAM_UPDATE;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval);
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update.conn_params.max_conn_interval);
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update.conn_params.slave_latency);
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update.conn_params.conn_sup_timeout);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c
deleted file mode 100644
index a84ba68..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c
+++ /dev/null
@@ -1,59 +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.
- *
- */
-
-#include "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf,
-                                                   uint32_t              packet_len,
-                                                   ble_evt_t * const     p_event,
-                                                   uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len);
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update_request)) +
-                         sizeof (ble_gap_evt_conn_param_update_request_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.min_conn_interval);
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.max_conn_interval);
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.slave_latency);
-    uint16_dec(p_buf, packet_len, &index,
-               &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.conn_sup_timeout);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c
deleted file mode 100644
index 98b0a65..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c
+++ /dev/null
@@ -1,57 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len);
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_sec_update)) +
-                         sizeof (ble_gap_evt_conn_sec_update_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_CONN_SEC_UPDATE;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-
-    p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm = p_buf[index] & 0x0F;
-    p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv = (p_buf[index] >> 4) & 0x0F;
-    index++;
-
-    uint8_dec(p_buf, packet_len,
-              &index, &p_event->evt.gap_evt.params.conn_sec_update.conn_sec.encr_key_size);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c
deleted file mode 100644
index d83f2cc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c
+++ /dev/null
@@ -1,53 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t event_len = sizeof (ble_gap_evt_connected_t) +
-                         sizeof (p_event->evt.gap_evt.conn_handle);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_evt_connected_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.connected));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c
deleted file mode 100644
index 0937116..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c
+++ /dev/null
@@ -1,48 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(3, packet_len);
-
-    uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_disconnected_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_DISCONNECTED;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.disconnected.reason);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c
deleted file mode 100644
index 87b52dd..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c
+++ /dev/null
@@ -1,52 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_key_pressed_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   ble_evt_t * const     p_event,
-                                   uint32_t * const      p_event_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t event_len = offsetof (ble_gap_evt_t, params) + sizeof(ble_gap_evt_key_pressed_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.key_pressed.kp_not);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c
deleted file mode 100644
index ff30f47..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c
+++ /dev/null
@@ -1,71 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-#include "app_ble_gap_sec_keys.h"
-extern ser_ble_gap_app_keyset_t m_app_keys_table[];
-
-uint32_t ble_gap_evt_lesc_dhkey_request_dec(uint8_t const * const p_buf,
-                                            uint32_t              packet_len,
-                                            ble_evt_t * const     p_event,
-                                            uint32_t * const      p_event_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t conn_index;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-    // [minimal packet is: 'conn_handle' + 'p_pk_peer' SER_FIELD_NOT_PRESENT +
-    //  'oobd_req']
-    SER_ASSERT_LENGTH_LEQ(sizeof(uint16_t) + sizeof(uint8_t) + sizeof(uint8_t),
-        packet_len);
-
-    uint32_t event_len = offsetof (ble_gap_evt_t, params) + sizeof(uint8_t) + sizeof(uint8_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    // keyset is an extension of standard event data - used to synchronize keys at application
-    err_code = app_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p_event->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer = m_app_keys_table[conn_index].keyset.keys_peer.p_pk;
-
-    err_code = cond_field_dec(p_buf, packet_len, &index,
-        (void **)&p_event->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer, ble_gap_lesc_p256_pk_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint8_t data;
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &data);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_event->evt.gap_evt.params.lesc_dhkey_request.oobd_req = data & 0x01;
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c
deleted file mode 100644
index 0b93930..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.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 "ble_gap_evt_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey)
-
-
-uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t event_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    event_len = offsetof(ble_gap_evt_t, params.passkey_display) + sizeof (ble_gap_evt_passkey_display_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_PASSKEY_DISPLAY;
-    p_event->header.evt_len = event_len;
-
-    uint32_t err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    memcpy(p_event->evt.gap_evt.params.passkey_display.passkey, &p_buf[index], PASSKEY_LEN);
-    index += PASSKEY_LEN;
-    uint8_t match_req;
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &match_req);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p_event->evt.gap_evt.params.passkey_display.match_request = (match_req & 0x01);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}
-

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/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c
deleted file mode 100644
index 8e0c602..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c
+++ /dev/null
@@ -1,53 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t event_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len);
-
-    event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_rssi_changed_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_RSSI_CHANGED;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-    int8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.rssi_changed.rssi);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}
-

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/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c
deleted file mode 100644
index 6fc6de4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c
+++ /dev/null
@@ -1,58 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         ble_evt_t * const     p_event,
-                                         uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.scan_req_report)) +
-                         sizeof (ble_gap_evt_scan_req_report_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_SCAN_REQ_REPORT;
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.peer_addr));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.rssi));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c
deleted file mode 100644
index c1de6e8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c
+++ /dev/null
@@ -1,55 +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 "ble_gap_evt_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          ble_evt_t * const     p_event,
-                                          uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len);
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.sec_info_request)) +
-                         sizeof (ble_gap_evt_sec_info_request_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_GAP_EVT_SEC_INFO_REQUEST;
-    p_event->header.evt_len = event_len;
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle);
-
-    err_code = ble_gap_evt_sec_info_request_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.sec_info_request);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   SER_ASSERT_LENGTH_EQ(index, packet_len);
-   *p_event_len = event_len;
-
-   return NRF_SUCCESS;
-}


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

Posted by cc...@apache.org.
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/hal/nrf_clock.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_clock.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_clock.h
deleted file mode 100644
index b9839dc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_clock.h
+++ /dev/null
@@ -1,422 +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.
- *
- */
-
-#ifndef NRF_CLOCK_H__
-#define NRF_CLOCK_H__
-
-#include <stddef.h>
-#include <stdbool.h>
- 
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_clock_hal Clock HAL
- * @{
- * @ingroup nrf_clock
- * @brief Hardware access layer for managing the low-frequency clock (LFCLK) and the high-frequency clock (HFCLK).
- */
-
-#define NRF_CLOCK_TASK_TRIGGER (1UL)
-#define NRF_CLOCK_EVENT_CLEAR  (0UL)
-
-/**
- * @brief Low-frequency clock sources.
- * @details Used by LFCLKSRC, LFCLKSTAT, and LFCLKSRCCOPY registers.
- */
-typedef enum
-{
-    NRF_CLOCK_LFCLK_RC    = CLOCK_LFCLKSRC_SRC_RC,   /**< Internal 32 kHz RC oscillator. */
-    NRF_CLOCK_LFCLK_Xtal  = CLOCK_LFCLKSRC_SRC_Xtal, /**< External 32 kHz crystal. */
-    NRF_CLOCK_LFCLK_Synth = CLOCK_LFCLKSRC_SRC_Synth /**< Internal 32 kHz synthesizer from HFCLK system clock. */
-} nrf_clock_lfclk_t;
-
-/**
- * @brief High-frequency clock sources.
- */
-typedef enum
-{
-    NRF_CLOCK_HFCLK_LOW_ACCURACY  = CLOCK_HFCLKSTAT_SRC_RC,  /**< Internal 16 MHz RC oscillator. */
-    NRF_CLOCK_HFCLK_HIGH_ACCURACY = CLOCK_HFCLKSTAT_SRC_Xtal /**< External 16 MHz/32 MHz crystal oscillator. */
-} nrf_clock_hfclk_t;
-
-/**
- * @brief Trigger status of task LFCLKSTART/HFCLKSTART.
- * @details Used by LFCLKRUN and HFCLKRUN registers.
- */
-typedef enum
-{
-    NRF_CLOCK_START_TASK_NOT_TRIGGERED = CLOCK_LFCLKRUN_STATUS_NotTriggered, /**< Task LFCLKSTART/HFCLKSTART has not been triggered. */
-    NRF_CLOCK_START_TASK_TRIGGERED     = CLOCK_LFCLKRUN_STATUS_Triggered     /**< Task LFCLKSTART/HFCLKSTART has been triggered. */
-} nrf_clock_start_task_status_t;
-
-/**
- * @brief Crystal frequency selection.
- */
-typedef enum
-{
-#ifdef NRF51
-    NRF_CLOCK_XTALFREQ_Default = CLOCK_XTALFREQ_XTALFREQ_16MHz, /**< Default. 32 MHz. */
-    NRF_CLOCK_XTALFREQ_16MHz   = CLOCK_XTALFREQ_XTALFREQ_16MHz, /**< 16 MHz crystal. */
-    NRF_CLOCK_XTALFREQ_32MHz   = CLOCK_XTALFREQ_XTALFREQ_32MHz  /**< 32 MHz crystal. */
-#elif defined NRF52
-    NRF_CLOCK_XTALFREQ_Default,                                 /**< Default. 64MHz. */
-#endif
-} nrf_clock_xtalfreq_t;
-
-/**
- * @brief Interrupts.
- */
-typedef enum
-{
-    NRF_CLOCK_INT_HF_STARTED_MASK = CLOCK_INTENSET_HFCLKSTARTED_Msk, /**< Interrupt on HFCLKSTARTED event. */
-    NRF_CLOCK_INT_LF_STARTED_MASK = CLOCK_INTENSET_LFCLKSTARTED_Msk, /**< Interrupt on LFCLKSTARTED event. */
-    NRF_CLOCK_INT_DONE_MASK       = CLOCK_INTENSET_DONE_Msk,         /**< Interrupt on DONE event. */
-    NRF_CLOCK_INT_CTTO_MASK       = CLOCK_INTENSET_CTTO_Msk          /**< Interrupt on CTTO event. */
-} nrf_clock_int_mask_t;
-
-/**
- * @brief Tasks.
- *
- * @details The NRF_CLOCK_TASK_LFCLKSTOP task cannot be set when the low-frequency clock is not running.
- * The NRF_CLOCK_TASK_HFCLKSTOP task cannot be set when the high-frequency clock is not running.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_CLOCK_TASK_HFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTART), /**< Start HFCLK clock source.*/
-    NRF_CLOCK_TASK_HFCLKSTOP  = offsetof(NRF_CLOCK_Type, TASKS_HFCLKSTOP),  /**< Stop HFCLK clock source.*/
-    NRF_CLOCK_TASK_LFCLKSTART = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTART), /**< Start LFCLK clock source.*/
-    NRF_CLOCK_TASK_LFCLKSTOP  = offsetof(NRF_CLOCK_Type, TASKS_LFCLKSTOP),  /**< Stop LFCLK clock source.*/
-    NRF_CLOCK_TASK_CAL        = offsetof(NRF_CLOCK_Type, TASKS_CAL),        /**< Start calibration of LFCLK RC oscillator.*/
-    NRF_CLOCK_TASK_CTSTART    = offsetof(NRF_CLOCK_Type, TASKS_CTSTART),    /**< Start calibration timer.*/
-    NRF_CLOCK_TASK_CTSTOP     = offsetof(NRF_CLOCK_Type, TASKS_CTSTOP)      /**< Stop calibration timer.*/
-} nrf_clock_task_t;                                                         /*lint -restore */
-
-/**
- * @brief Events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_CLOCK_EVENT_HFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_HFCLKSTARTED), /**< HFCLK oscillator started.*/
-    NRF_CLOCK_EVENT_LFCLKSTARTED = offsetof(NRF_CLOCK_Type, EVENTS_LFCLKSTARTED), /**< LFCLK oscillator started.*/
-    NRF_CLOCK_EVENT_DONE         = offsetof(NRF_CLOCK_Type, EVENTS_DONE),         /**< Calibration of LFCLK RC oscillator completed.*/
-    NRF_CLOCK_EVENT_CTTO         = offsetof(NRF_CLOCK_Type, EVENTS_CTTO)          /**< Calibration timer time-out.*/
-} nrf_clock_event_t;                                                               /*lint -restore */
-
-/**
- * @brief Function for enabling a specific interrupt.
- *
- * @param[in]  int_mask         Interrupt.
- */
-__STATIC_INLINE void nrf_clock_int_enable(uint32_t int_mask);
-
-/**
- * @brief Function for disabling a specific interrupt.
- *
- * @param[in]  int_mask         Interrupt.
- */
-__STATIC_INLINE void nrf_clock_int_disable(uint32_t int_mask);
-
-/**
- * @brief Function for retrieving the state of a specific interrupt.
- *
- * @param[in]  int_mask         Interrupt.
- *
- * @retval     true                   If the interrupt is enabled.
- * @retval     false                  If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_clock_int_enable_check(nrf_clock_int_mask_t int_mask);
-
-/**
- * @brief Function for retrieving the address of a specific task. 
- * @details This function can be used by the PPI module.
- *
- * @param[in]  task             Task.
- *
- * @return     Address of the requested task register.
- */
-__STATIC_INLINE uint32_t nrf_clock_task_address_get(nrf_clock_task_t task);
-
-/**
- * @brief Function for setting a specific task.
- *
- * @param[in]  task             Task.
- */
-__STATIC_INLINE void nrf_clock_task_trigger(nrf_clock_task_t task);
-
-/**
- * @brief Function for retrieving the address of a specific event. 
- * @details This function can be used by the PPI module.
- *
- * @param[in]  event       Event.
- *
- * @return     Address of the requested event register.
- */
-__STATIC_INLINE uint32_t nrf_clock_event_address_get(nrf_clock_event_t event);
-
-/**
- * @brief Function for clearing a specific event.
- *
- * @param[in]  event       Event.
- */
-__STATIC_INLINE void nrf_clock_event_clear(nrf_clock_event_t event);
-
-/**
- * @brief Function for retrieving the state of a specific event.
- *
- * @param[in]  event       Event.
- *
- * @retval     true              If the event is set.
- * @retval     false             If the event is not set.
- */
-__STATIC_INLINE bool nrf_clock_event_check(nrf_clock_event_t event);
-
-/**
- * @brief Function for changing the low-frequency clock source.
- * @details This function cannot be called when the low-frequency clock is running.
- *
- * @param[in]  source            New low-frequency clock source.
- *
- */
-__STATIC_INLINE void nrf_clock_lf_src_set(nrf_clock_lfclk_t source);
-
-/**
- * @brief Function for retrieving the selected source for the low-frequency clock.
- *
- * @retval     NRF_CLOCK_LFCLK_RC     If the internal 32 kHz RC oscillator is the selected source for the low-frequency clock.
- * @retval     NRF_CLOCK_LFCLK_Xtal   If an external 32 kHz crystal oscillator is the selected source for the low-frequency clock.
- * @retval     NRF_CLOCK_LFCLK_Synth  If the internal 32 kHz synthesizer from the HFCLK is the selected source for the low-frequency clock.
- */
-__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_src_get(void);
-
-/**
- * @brief Function for retrieving the active source of the low-frequency clock.
- *
- * @retval     NRF_CLOCK_LFCLK_RC     If the internal 32 kHz RC oscillator is the active source of the low-frequency clock.
- * @retval     NRF_CLOCK_LFCLK_Xtal   If an external 32 kHz crystal oscillator is the active source of the low-frequency clock.
- * @retval     NRF_CLOCK_LFCLK_Synth  If the internal 32 kHz synthesizer from the HFCLK is the active source of the low-frequency clock.
- */
-__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_actv_src_get(void);
-
-/**
- * @brief Function for retrieving the clock source for the LFCLK clock when the task LKCLKSTART is triggered.
- *
- * @retval     NRF_CLOCK_LFCLK_RC     If the internal 32 kHz RC oscillator is running and generating the LFCLK clock.
- * @retval     NRF_CLOCK_LFCLK_Xtal   If an external 32 kHz crystal oscillator is running and generating the LFCLK clock.
- * @retval     NRF_CLOCK_LFCLK_Synth  If the internal 32 kHz synthesizer from the HFCLK is running and generating the LFCLK clock.
- */
-__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_srccopy_get(void);
-
-/**
- * @brief Function for retrieving the state of the LFCLK clock.
- *
- * @retval     false                     If the LFCLK clock is not running.
- * @retval     true                      If the LFCLK clock is running.
- */
-__STATIC_INLINE bool nrf_clock_lf_is_running(void);
-
-/**
- * @brief Function for retrieving the trigger status of the task LFCLKSTART.
- *
- * @retval     NRF_CLOCK_START_TASK_NOT_TRIGGERED     If the task LFCLKSTART has not been triggered.
- * @retval     NRF_CLOCK_START_TASK_TRIGGERED         If the task LFCLKSTART has been triggered.
- */
-__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_lf_start_task_status_get(void);
-
-/**
- * @brief Function for retrieving the active source of the high-frequency clock.
- *
- * @retval     NRF_CLOCK_HFCLK_LOW_ACCURACY   If the internal 16 MHz RC oscillator is the active source of the high-frequency clock.
- * @retval     NRF_CLOCK_HFCLK_HIGH_ACCURACY  If an external 16 MHz/32 MHz crystal oscillator is the active source of the high-frequency clock.
- */
-__STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get(void);
-
-/**
- * @brief Function for retrieving the state of the HFCLK clock.
- *
- * @param[in]  clk_src                   Clock source to be checked.
- *
- * @retval     false                     If the HFCLK clock is not running.
- * @retval     true                      If the HFCLK clock is running.
- */
-__STATIC_INLINE bool nrf_clock_hf_is_running(nrf_clock_hfclk_t clk_src);
-
-/**
- * @brief Function for retrieving the trigger status of the task HFCLKSTART.
- *
- * @retval     NRF_CLOCK_START_TASK_NOT_TRIGGERED     If the task HFCLKSTART has not been triggered.
- * @retval     NRF_CLOCK_START_TASK_TRIGGERED         If the task HFCLKSTART has been triggered.
- */
-__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get(void);
-
-/**
- * @brief Function for retrieving the frequency selection of the external crystal.
- *
- * @retval     NRF_CLOCK_XTALFREQ_16MHz     If a 16 MHz crystal is used as source for the HFCLK oscillator.
- * @retval     NRF_CLOCK_XTALFREQ_32MHz     If a 32 MHz crystal is used as source for the HFCLK oscillator.
- */
-__STATIC_INLINE nrf_clock_xtalfreq_t nrf_clock_xtalfreq_get(void);
-
-/**
- * @brief Function for changing the frequency selection of the external crystal.
- *
- * @param[in]  xtalfreq             New frequency selection for the external crystal.
- */
-__STATIC_INLINE void nrf_clock_xtalfreq_set(nrf_clock_xtalfreq_t xtalfreq);
-
-/**
- * @brief Function for changing the calibration timer interval.
- *
- * @param[in]  interval             New calibration timer interval in 0.25 s resolution (range: 0.25 seconds to 31.75 seconds).
- */
-__STATIC_INLINE void nrf_clock_cal_timer_timeout_set(uint32_t interval);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_clock_int_enable(uint32_t int_mask)
-{
-    NRF_CLOCK->INTENSET = int_mask;
-}
-
-__STATIC_INLINE void nrf_clock_int_disable(uint32_t int_mask)
-{
-    NRF_CLOCK->INTENCLR = int_mask;
-}
-
-__STATIC_INLINE bool nrf_clock_int_enable_check(nrf_clock_int_mask_t int_mask)
-{
-    return (bool)(NRF_CLOCK->INTENCLR & int_mask);
-}
-
-__STATIC_INLINE uint32_t nrf_clock_task_address_get(nrf_clock_task_t task)
-{
-    return ((uint32_t )NRF_CLOCK + task);
-}
-
-__STATIC_INLINE void nrf_clock_task_trigger(nrf_clock_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + task)) = NRF_CLOCK_TASK_TRIGGER;
-}
-
-__STATIC_INLINE uint32_t nrf_clock_event_address_get(nrf_clock_event_t event)
-{
-    return ((uint32_t)NRF_CLOCK + event);
-}
-
-__STATIC_INLINE void nrf_clock_event_clear(nrf_clock_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + event)) = NRF_CLOCK_EVENT_CLEAR;
-#if __CORTEX_M == 0x04
-    volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + event));
-    (void)dummy;
-#endif
-}
-
-__STATIC_INLINE bool nrf_clock_event_check(nrf_clock_event_t event)
-{
-    return (bool)*((volatile uint32_t *)((uint8_t *)NRF_CLOCK + event));
-}
-
-__STATIC_INLINE void nrf_clock_lf_src_set(nrf_clock_lfclk_t source)
-{
-    NRF_CLOCK->LFCLKSRC =
-        (uint32_t)((source << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk);
-}
-
-__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_src_get(void)
-{
-    return (nrf_clock_lfclk_t)((NRF_CLOCK->LFCLKSRC &
-                                CLOCK_LFCLKSRC_SRC_Msk) >> CLOCK_LFCLKSRC_SRC_Pos);
-}
-
-__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_actv_src_get(void)
-{
-    return (nrf_clock_lfclk_t)((NRF_CLOCK->LFCLKSTAT &
-                                CLOCK_LFCLKSTAT_SRC_Msk) >> CLOCK_LFCLKSTAT_SRC_Pos);
-}
-
-__STATIC_INLINE nrf_clock_lfclk_t nrf_clock_lf_srccopy_get(void)
-{
-    return (nrf_clock_lfclk_t)((NRF_CLOCK->LFCLKSRCCOPY &
-                                CLOCK_LFCLKSRCCOPY_SRC_Msk) >> CLOCK_LFCLKSRCCOPY_SRC_Pos);
-}
-
-__STATIC_INLINE bool nrf_clock_lf_is_running(void)
-{
-    return ((NRF_CLOCK->LFCLKSTAT &
-             CLOCK_LFCLKSTAT_STATE_Msk) >> CLOCK_LFCLKSTAT_STATE_Pos);
-}
-
-__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_lf_start_task_status_get(void)
-{
-    return (nrf_clock_start_task_status_t)((NRF_CLOCK->LFCLKRUN &
-                                            CLOCK_LFCLKRUN_STATUS_Msk) >>
-                                           CLOCK_LFCLKRUN_STATUS_Pos);
-}
-
-__STATIC_INLINE nrf_clock_hfclk_t nrf_clock_hf_src_get(void)
-{
-    return (nrf_clock_hfclk_t)((NRF_CLOCK->HFCLKSTAT &
-                                CLOCK_HFCLKSTAT_SRC_Msk) >> CLOCK_HFCLKSTAT_SRC_Pos);
-}
-
-__STATIC_INLINE bool nrf_clock_hf_is_running(nrf_clock_hfclk_t clk_src)
-{
-    return (NRF_CLOCK->HFCLKSTAT & (CLOCK_HFCLKSTAT_STATE_Msk | CLOCK_HFCLKSTAT_SRC_Msk)) ==
-            (CLOCK_HFCLKSTAT_STATE_Msk | (clk_src << CLOCK_HFCLKSTAT_SRC_Pos));
-}
-
-__STATIC_INLINE nrf_clock_start_task_status_t nrf_clock_hf_start_task_status_get(void)
-{
-    return (nrf_clock_start_task_status_t)((NRF_CLOCK->HFCLKRUN &
-                                            CLOCK_HFCLKRUN_STATUS_Msk) >>
-                                           CLOCK_HFCLKRUN_STATUS_Pos);
-}
-
-__STATIC_INLINE nrf_clock_xtalfreq_t nrf_clock_xtalfreq_get(void)
-{
-#ifdef NRF51
-    return (nrf_clock_xtalfreq_t)((NRF_CLOCK->XTALFREQ &
-                                       CLOCK_XTALFREQ_XTALFREQ_Msk) >> CLOCK_XTALFREQ_XTALFREQ_Pos);
-#elif defined NRF52
-    return NRF_CLOCK_XTALFREQ_Default;
-#endif
-}
-
-__STATIC_INLINE void nrf_clock_xtalfreq_set(nrf_clock_xtalfreq_t xtalfreq)
-{
-#ifdef NRF51
-    NRF_CLOCK->XTALFREQ =
-        (uint32_t)((xtalfreq << CLOCK_XTALFREQ_XTALFREQ_Pos) & CLOCK_XTALFREQ_XTALFREQ_Msk);
-#elif defined NRF52
-    return;
-#endif
-}
-
-__STATIC_INLINE void nrf_clock_cal_timer_timeout_set(uint32_t interval)
-{
-    NRF_CLOCK->CTIV = ((interval << CLOCK_CTIV_CTIV_Pos) & CLOCK_CTIV_CTIV_Msk);
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-/**
- *@}
- **/
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_CLOCK_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/hal/nrf_comp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_comp.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_comp.h
deleted file mode 100644
index b1a3b71..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_comp.h
+++ /dev/null
@@ -1,477 +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
- * @brief COMP HAL API.
- */
-
-#ifndef NRF_COMP_H_
-#define NRF_COMP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_comp_hal COMP HAL
- * @{
- * @ingroup nrf_comp
- * @brief @tagAPI52 Hardware access layer for managing the Comparator (COMP).
- */
-
-#include "nrf.h"
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/**
- * @enum nrf_comp_input_t
- * @brief COMP analog pin selection.
- */
-typedef enum
-{
-	NRF_COMP_INPUT_0 = COMP_PSEL_PSEL_AnalogInput0,		/*!< AIN0 selected as analog input. */
-	NRF_COMP_INPUT_1 = COMP_PSEL_PSEL_AnalogInput1,		/*!< AIN1 selected as analog input. */
-	NRF_COMP_INPUT_2 = COMP_PSEL_PSEL_AnalogInput2,		/*!< AIN2 selected as analog input. */
-	NRF_COMP_INPUT_3 = COMP_PSEL_PSEL_AnalogInput3,		/*!< AIN3 selected as analog input. */
-	NRF_COMP_INPUT_4 = COMP_PSEL_PSEL_AnalogInput4,		/*!< AIN4 selected as analog input. */
-	NRF_COMP_INPUT_5 = COMP_PSEL_PSEL_AnalogInput5,		/*!< AIN5 selected as analog input. */
-	NRF_COMP_INPUT_6 = COMP_PSEL_PSEL_AnalogInput6,		/*!< AIN6 selected as analog input. */
-	NRF_COMP_INPUT_7 = COMP_PSEL_PSEL_AnalogInput7		/*!< AIN7 selected as analog input. */
-}nrf_comp_input_t;
-
-/**
- * @enum nrf_comp_ref_t
- * @brief COMP reference selection.
- */
-typedef enum
-{
-	NRF_COMP_REF_Int1V2 = COMP_REFSEL_REFSEL_Int1V2, 	/*!< VREF = internal 1.2 V reference (VDD >= 1.7 V). */
-	NRF_COMP_REF_Int1V8 = COMP_REFSEL_REFSEL_Int1V8, 	/*!< VREF = internal 1.8 V reference (VDD >= VREF + 0.2 V). */
-	NRF_COMP_REF_Int2V4 = COMP_REFSEL_REFSEL_Int2V4,	/*!< VREF = internal 2.4 V reference (VDD >= VREF + 0.2 V). */
-	NRF_COMP_REF_VDD = COMP_REFSEL_REFSEL_VDD,	 		/*!< VREF = VDD. */
-	NRF_COMP_REF_ARef = COMP_REFSEL_REFSEL_ARef  		/*!< VREF = AREF (VDD >= VREF >= AREFMIN). */
-}nrf_comp_ref_t;
-
-/**
- * @enum nrf_comp_ext_ref_t
- * @brief COMP external analog reference selection.
- */
-typedef enum
-{
-	NRF_COMP_EXT_REF_0 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference0,		/*!< Use AIN0 as external analog reference. */ 
-	NRF_COMP_EXT_REF_1 = COMP_EXTREFSEL_EXTREFSEL_AnalogReference1 		/*!< Use AIN1 as external analog reference. */
-}nrf_comp_ext_ref_t;
-
-/**
- * @brief COMP THDOWN and THUP values that are used to calculate the threshold voltages VDOWN and VUP.
- */
-typedef struct
-{
-	uint8_t th_down; /*!< THDOWN value. */
-	uint8_t th_up;   /*!< THUP value. */
-}nrf_comp_th_t;
-
-/**
- * @enum nrf_comp_main_mode_t
- * @brief COMP main operation mode.
- */
-typedef enum
-{
-	NRF_COMP_MAIN_MODE_SE = COMP_MODE_MAIN_SE,		/*!< Single ended mode. */
-	NRF_COMP_MAIN_MODE_Diff = COMP_MODE_MAIN_Diff	/*!< Differential mode. */
-}nrf_comp_main_mode_t;
-
-/**
- * @enum nrf_comp_sp_mode_t
- * @brief COMP speed and power mode.
- */
-typedef enum
-{
-	NRF_COMP_SP_MODE_Low = COMP_MODE_SP_Low, 		/*!< Low power mode. */
-	NRF_COMP_SP_MODE_Normal = COMP_MODE_SP_Normal,	/*!< Normal mode. */
-	NRF_COMP_SP_MODE_High = COMP_MODE_SP_High 		/*!< High speed mode. */
-}nrf_comp_sp_mode_t;
-
-/**
- * @enum nrf_comp_hyst_t
- * @brief COMP comparator hysteresis.
- */
-typedef enum
-{
-	NRF_COMP_HYST_NoHyst = COMP_HYST_HYST_NoHyst,	/*!< Comparator hysteresis disabled. */
-	NRF_COMP_HYST_50mV = COMP_HYST_HYST_Hyst50mV 	/*!< Comparator hysteresis enabled. */
-}nrf_comp_hyst_t;
-
-/**
- * @brief COMP current source selection on analog input.
- */
-typedef enum
-{
-	NRF_COMP_ISOURCE_Off = COMP_ISOURCE_ISOURCE_Off,			/*!< Current source disabled. */
-	NRF_COMP_ISOURCE_Ien2uA5 = COMP_ISOURCE_ISOURCE_Ien2mA5, 	/*!< Current source enabled (+/- 2.5 uA). */
-	NRF_COMP_ISOURCE_Ien5uA = COMP_ISOURCE_ISOURCE_Ien5mA,		/*!< Current source enabled (+/- 5 uA). */
-	NRF_COMP_ISOURCE_Ien10uA = COMP_ISOURCE_ISOURCE_Ien10mA 	/*!< Current source enabled (+/- 10 uA). */
-}nrf_isource_t;
-
-/**
- * @enum nrf_comp_task_t
- * @brief COMP tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_COMP_TASK_START  = offsetof(NRF_COMP_Type, TASKS_START), /*!< COMP start sampling task. */
-    NRF_COMP_TASK_STOP   = offsetof(NRF_COMP_Type, TASKS_STOP),  /*!< COMP stop sampling task. */
-    NRF_COMP_TASK_SAMPLE = offsetof(NRF_COMP_Type, TASKS_SAMPLE) /*!< Sample comparator value. */
-    /*lint -restore*/
-}nrf_comp_task_t;
-
-/**
- * @enum nrf_comp_event_t
- * @brief COMP events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_COMP_EVENT_READY = offsetof(NRF_COMP_Type, EVENTS_READY), /*!< COMP is ready and output is valid. */
-    NRF_COMP_EVENT_DOWN  = offsetof(NRF_COMP_Type, EVENTS_DOWN),  /*!< Input voltage crossed the threshold going down. */
-    NRF_COMP_EVENT_UP    = offsetof(NRF_COMP_Type, EVENTS_UP),    /*!< Input voltage crossed the threshold going up. */
-    NRF_COMP_EVENT_CROSS = offsetof(NRF_COMP_Type, EVENTS_CROSS)  /*!< Input voltage crossed the threshold in any direction. */
-    /*lint -restore*/
-}nrf_comp_event_t;
-
-/**
- * @brief COMP reference configuration.
- */
-typedef struct
-{
-	nrf_comp_ref_t		reference;		/*!< COMP reference selection. */
-	nrf_comp_ext_ref_t	external;		/*!< COMP external analog reference selection. */
-}nrf_comp_ref_conf_t;
-
-
-/**
- * @brief Function for enabling the COMP peripheral.
- */
-__STATIC_INLINE void nrf_comp_enable(void);
-
-
-/**
- * @brief Function for disabling the COMP peripheral.
- */
-
-__STATIC_INLINE void nrf_comp_disable(void);
-
-/**
- * @brief Function for checking if the COMP peripheral is enabled.
- *
- * @retval true  If the COMP peripheral is enabled.
- * @retval false If the COMP peripheral is not enabled.
- */
-__STATIC_INLINE bool nrf_comp_enable_check(void);
-
-/**
- * @brief Function for setting the reference source.
- *
- * @param[in] reference                 COMP reference selection.
- */
-__STATIC_INLINE void nrf_comp_ref_set(nrf_comp_ref_t reference);
-
-
-/**
- * @brief Function for setting the external analog reference source.
- *
- * @param[in] ext_ref                   COMP external analog reference selection.
- */
-__STATIC_INLINE void nrf_comp_ext_ref_set(nrf_comp_ext_ref_t ext_ref);
-
-
-/**
- * @brief Function for setting threshold voltages.
- *
- * @param[in] threshold                 COMP VDOWN and VUP thresholds.
- */
-__STATIC_INLINE void nrf_comp_th_set(nrf_comp_th_t threshold);
-
-
-/**
- * @brief Function for setting the main mode.
- * 
- * @param[in] main_mode                 COMP main operation mode.
- */
-__STATIC_INLINE void nrf_comp_main_mode_set(nrf_comp_main_mode_t main_mode);
-
-
-/**
- * @brief Function for setting the speed mode.
- * 
- * @param[in] speed_mode                COMP speed and power mode.
- */
-__STATIC_INLINE void nrf_comp_speed_mode_set(nrf_comp_sp_mode_t speed_mode);
-
-
-/**
- * @brief Function for setting the hysteresis.
- *
- * @param[in] hyst                      COMP comparator hysteresis.
- */
-__STATIC_INLINE void nrf_comp_hysteresis_set(nrf_comp_hyst_t hyst);
-
-
-/**
- * @brief Function for setting the current source on the analog input.
- *
- * @param[in] isource                   COMP current source selection on analog input.
- */
-__STATIC_INLINE void nrf_comp_isource_set(nrf_isource_t isource);
-
-
-/**
- * @brief Function for selecting the active input of the COMP.
- *
- * @param[in] input Input to be selected.
- */
-__STATIC_INLINE void nrf_comp_input_select(nrf_comp_input_t input);
-
-
-/**
- * @brief Function for getting the last COMP compare result.
- *
- * @return The last compare result. If 0, then VIN+ < VIN-. If 1, then VIN+ > VIN-.
- *
- * @note If VIN+ == VIN-, the return value depends on the previous result.
- */
-__STATIC_INLINE uint32_t nrf_comp_result_get(void);
-
-
-/**
- * @brief Function for enabling interrupts from COMP.
- *
- * @param[in] comp_int_mask Mask of interrupts to be enabled.
- *
- * @sa nrf_comp_int_enable_check()
- */
-__STATIC_INLINE void nrf_comp_int_enable(uint32_t comp_int_mask);
-
-/**
- * @brief Function for disabling interrupts from COMP.
- *
- * @param[in] comp_int_mask Mask of interrupts to be disabled.
- *
- * @sa nrf_comp_int_enable_check()
- */
-__STATIC_INLINE void nrf_comp_int_disable(uint32_t comp_int_mask);
-
-
-/**
- * @brief Function for getting the enabled interrupts of COMP.
- *
- * @param[in] comp_int_mask Mask of interrupts to be checked.
- *
- * @retval true If any interrupts of the specified mask are enabled.
- */
-__STATIC_INLINE bool nrf_comp_int_enable_check(uint32_t comp_int_mask);
-
-
-
-/**
- * @brief Function for getting the address of a specific COMP task register.
- *
- * @param[in] comp_task COMP task.
- *
- * @return Address of the specified COMP task.
- */
-__STATIC_INLINE uint32_t * nrf_comp_task_address_get(nrf_comp_task_t comp_task);
-
-
-/**
- * @brief Function for getting the address of a specific COMP event register.
- *
- * @param[in] comp_event COMP event.
- *
- * @return Address of the specified COMP event.
- */
-__STATIC_INLINE uint32_t * nrf_comp_event_address_get(nrf_comp_event_t comp_event);
-
-
-/**
- * @brief  Function for setting COMP shorts.
- *
- * @param[in] comp_short_mask COMP shorts by mask.
- *
- */
-__STATIC_INLINE void nrf_comp_shorts_enable(uint32_t comp_short_mask);
-
-
-/**
- * @brief Function for clearing COMP shorts by mask.
- *
- * @param[in] comp_short_mask COMP shorts to be cleared.
- *
- */
-__STATIC_INLINE void nrf_comp_shorts_disable(uint32_t comp_short_mask);
-
-
-/**
- * @brief Function for setting a specific COMP task.
- *
- * @param[in] comp_task COMP task to be set.
- *
- */
-__STATIC_INLINE void nrf_comp_task_trigger(nrf_comp_task_t comp_task);
-
-
-/**
- * @brief Function for clearing a specific COMP event.
- *
- * @param[in] comp_event COMP event to be cleared.
- *
- */
-__STATIC_INLINE void nrf_comp_event_clear(nrf_comp_event_t comp_event);
-
-
-/**
- * @brief Function for getting the state of a specific COMP event.
- *
- * @retval true If the specified COMP event is active.
- *
- */
-__STATIC_INLINE bool nrf_comp_event_check(nrf_comp_event_t comp_event);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_comp_enable(void)
-{
-	NRF_COMP->ENABLE = (COMP_ENABLE_ENABLE_Enabled << COMP_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_comp_disable(void)
-{
-    NRF_COMP->ENABLE = (COMP_ENABLE_ENABLE_Disabled << COMP_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE bool nrf_comp_enable_check(void)
-{
-	return ((NRF_COMP->ENABLE) & COMP_ENABLE_ENABLE_Enabled);
-}
-
-__STATIC_INLINE void nrf_comp_ref_set(nrf_comp_ref_t reference)
-{
-    NRF_COMP->REFSEL = (reference << COMP_REFSEL_REFSEL_Pos);
-}
-
-__STATIC_INLINE void nrf_comp_ext_ref_set(nrf_comp_ext_ref_t ext_ref)
-{
-    NRF_COMP->EXTREFSEL = (ext_ref << COMP_EXTREFSEL_EXTREFSEL_Pos);
-}
-
-__STATIC_INLINE void nrf_comp_th_set(nrf_comp_th_t threshold)
-{
-    NRF_COMP->TH = 
-        ((threshold.th_down << COMP_TH_THDOWN_Pos) & COMP_TH_THDOWN_Msk) | 
-        ((threshold.th_up << COMP_TH_THUP_Pos) & COMP_TH_THUP_Msk);
-}
-
-__STATIC_INLINE void nrf_comp_main_mode_set(nrf_comp_main_mode_t main_mode)
-{
-    NRF_COMP->MODE |= (main_mode << COMP_MODE_MAIN_Pos);
-}
-
-__STATIC_INLINE void nrf_comp_speed_mode_set(nrf_comp_sp_mode_t speed_mode)
-{
-    NRF_COMP->MODE |= (speed_mode << COMP_MODE_SP_Pos);
-}
-
-__STATIC_INLINE void nrf_comp_hysteresis_set(nrf_comp_hyst_t hyst)
-{
-    NRF_COMP->HYST = (hyst << COMP_HYST_HYST_Pos) & COMP_HYST_HYST_Msk;
-}
-
-__STATIC_INLINE void nrf_comp_isource_set(nrf_isource_t isource)
-{
-    NRF_COMP->ISOURCE = (isource << COMP_ISOURCE_ISOURCE_Pos) & COMP_ISOURCE_ISOURCE_Msk;
-}
-
-__STATIC_INLINE void nrf_comp_input_select(nrf_comp_input_t input)
-{
-    NRF_COMP->PSEL   = ((uint32_t)input << COMP_PSEL_PSEL_Pos);
-}
-
-__STATIC_INLINE uint32_t nrf_comp_result_get(void)
-{
-    return (uint32_t)NRF_COMP->RESULT;
-}
-
-__STATIC_INLINE void nrf_comp_int_enable(uint32_t comp_int_mask)
-{
-    NRF_COMP->INTENSET = comp_int_mask;
-}
-
-__STATIC_INLINE void nrf_comp_int_disable(uint32_t comp_int_mask)
-{
-    NRF_COMP->INTENCLR = comp_int_mask;
-}
-
-__STATIC_INLINE bool nrf_comp_int_enable_check(uint32_t comp_int_mask)
-{
-    return (NRF_COMP->INTENSET & comp_int_mask); // when read this register will return the value of INTEN.
-}
-
-__STATIC_INLINE uint32_t * nrf_comp_task_address_get(nrf_comp_task_t comp_task)
-{
-    return (uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)comp_task);
-}
-
-__STATIC_INLINE uint32_t * nrf_comp_event_address_get(nrf_comp_event_t comp_event)
-{
-    return (uint32_t *)((uint8_t *)NRF_COMP + (uint32_t)comp_event);
-}
-
-__STATIC_INLINE void nrf_comp_shorts_enable(uint32_t comp_short_mask)
-{
-    NRF_COMP->SHORTS |= comp_short_mask;
-}
-
-__STATIC_INLINE void nrf_comp_shorts_disable(uint32_t comp_short_mask)
-{
-    NRF_COMP->SHORTS &= ~comp_short_mask;
-}
-
-__STATIC_INLINE void nrf_comp_task_trigger(nrf_comp_task_t comp_task)
-{
-    *( (volatile uint32_t *)( (uint8_t *)NRF_COMP + comp_task) ) = 1;
-}
-
-__STATIC_INLINE void nrf_comp_event_clear(nrf_comp_event_t comp_event)
-{
-    *( (volatile uint32_t *)( (uint8_t *)NRF_COMP + (uint32_t)comp_event) ) = 0;
-}
-
-__STATIC_INLINE bool nrf_comp_event_check(nrf_comp_event_t comp_event)
-{
-    return (bool) (*(volatile uint32_t *)( (uint8_t *)NRF_COMP + comp_event));
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_COMP_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/hal/nrf_ecb.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ecb.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ecb.c
deleted file mode 100644
index aef68c3..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ecb.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (c) 2012 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.
-*
-* $LastChangedRevision: 25419 $
-*/ 
-
-/** 
- * @file
- * @brief Implementation of AES ECB driver
- */
-
-
-//lint -e438
-
-#include <stdlib.h>
-#include <stdbool.h>
-#include <string.h>
-#include "nrf.h" 
-#include "nrf_ecb.h"
-
-static uint8_t  ecb_data[48];   ///< ECB data structure for RNG peripheral to access.
-static uint8_t* ecb_key;        ///< Key:        Starts at ecb_data 
-static uint8_t* ecb_cleartext;  ///< Cleartext:  Starts at ecb_data + 16 bytes.
-static uint8_t* ecb_ciphertext; ///< Ciphertext: Starts at ecb_data + 32 bytes.
-
-bool nrf_ecb_init(void)
-{
-  ecb_key = ecb_data;
-  ecb_cleartext  = ecb_data + 16;
-  ecb_ciphertext = ecb_data + 32;
-
-  NRF_ECB->ECBDATAPTR = (uint32_t)ecb_data;
-  return true;
-}
-
-
-bool nrf_ecb_crypt(uint8_t * dest_buf, const uint8_t * src_buf)
-{
-   uint32_t counter = 0x1000000;
-   if(src_buf != ecb_cleartext)
-   {
-     memcpy(ecb_cleartext,src_buf,16);
-   }
-   NRF_ECB->EVENTS_ENDECB = 0;
-   NRF_ECB->TASKS_STARTECB = 1;
-   while(NRF_ECB->EVENTS_ENDECB == 0)
-   {
-    counter--;
-    if(counter == 0)
-    {
-      return false;
-    }
-   }
-   NRF_ECB->EVENTS_ENDECB = 0;
-   if(dest_buf != ecb_ciphertext)
-   {
-     memcpy(dest_buf,ecb_ciphertext,16);
-   }
-   return true;
-}
-
-void nrf_ecb_set_key(const uint8_t * key)
-{
-  memcpy(ecb_key,key,16);
-}
-
-

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/hal/nrf_ecb.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ecb.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ecb.h
deleted file mode 100644
index 7c3f3d2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ecb.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is confidential 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.
- *              
- * $LastChangedRevision: 13999 $
- */
-
-/**
- * @file
- * @brief ECB driver API.
- */
-
-#ifndef NRF_ECB_H__
-#define NRF_ECB_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_ecb AES ECB encryption
- * @{
- * @ingroup nrf_drivers
- * @brief Driver for the AES Electronic Code Book (ECB) peripheral.
- *
- * To encrypt and decrypt data, the peripheral must first be powered on
- * using @ref nrf_ecb_init. Next, the key must be set using @ref nrf_ecb_set_key.
- */
-
-#include <stdint.h>
-
-/**
- * @brief Function for initializing and powering on the ECB peripheral.
- *
- * This function allocates memory for the ECBDATAPTR.
- * @retval true If initialization was successful.
- * @retval false If powering on failed.
- */
-bool nrf_ecb_init(void);
-
-/**
- * @brief Function for encrypting and decrypting 16-byte data using current key.
- *
- * This function avoids unnecessary copying of data if the parameters point to the 
- * correct locations in the ECB data structure.
- *
- * @param dst Result of encryption/decryption. 16 bytes will be written. 
- * @param src Source with 16-byte data to be encrypted/decrypted.
- *
- * @retval true  If the encryption operation completed.
- * @retval false If the encryption operation did not complete.
- */
-bool nrf_ecb_crypt(uint8_t * dst, const uint8_t * src);
-
-/**
- * @brief Function for setting the key to be used for encryption and decryption.
- *
- * @param key Pointer to the key. 16 bytes will be read.
- */
-void nrf_ecb_set_key(const uint8_t * key);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // NRF_ECB_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/hal/nrf_egu.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_egu.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_egu.h
deleted file mode 100644
index 105839c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_egu.h
+++ /dev/null
@@ -1,294 +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.
- *
- */
-
-#ifndef NRF_EGU_H__
-#define NRF_EGU_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef NRF52
-    #error EGU is not supported on your chip.
-#endif
-
-/**
-* @defgroup nrf_egu EGU (Event Generator Unit) abstraction
-* @{
-* @ingroup nrf_drivers
-* @brief @tagAPI52 EGU (Event Generator Unit) module functions.
-*
-*/
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include "nrf_assert.h"
-#include "nrf.h"
-
-#define NRF_EGU_COUNT           6   /**< Number of EGU instances. */
-#define NRF_EGU_CHANNEL_COUNT   16  /**< Number of channels per EGU instance. */
-
-/**
- * @enum  nrf_egu_task_t
- * @brief EGU tasks.
- */
-typedef enum
-{
-    /*lint -save -e30 -esym(628,__INTADDR__)*/
-    NRF_EGU_TASK_TRIGGER0  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[0]),  /**< Trigger 0 for triggering the corresponding TRIGGERED[0] event. */
-    NRF_EGU_TASK_TRIGGER1  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[1]),  /**< Trigger 1 for triggering the corresponding TRIGGERED[1] event. */
-    NRF_EGU_TASK_TRIGGER2  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[2]),  /**< Trigger 2 for triggering the corresponding TRIGGERED[2] event. */
-    NRF_EGU_TASK_TRIGGER3  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[3]),  /**< Trigger 3 for triggering the corresponding TRIGGERED[3] event. */
-    NRF_EGU_TASK_TRIGGER4  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[4]),  /**< Trigger 4 for triggering the corresponding TRIGGERED[4] event. */
-    NRF_EGU_TASK_TRIGGER5  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[5]),  /**< Trigger 5 for triggering the corresponding TRIGGERED[5] event. */
-    NRF_EGU_TASK_TRIGGER6  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[6]),  /**< Trigger 6 for triggering the corresponding TRIGGERED[6] event. */
-    NRF_EGU_TASK_TRIGGER7  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[7]),  /**< Trigger 7 for triggering the corresponding TRIGGERED[7] event. */
-    NRF_EGU_TASK_TRIGGER8  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[8]),  /**< Trigger 8 for triggering the corresponding TRIGGERED[8] event. */
-    NRF_EGU_TASK_TRIGGER9  = offsetof(NRF_EGU_Type, TASKS_TRIGGER[9]),  /**< Trigger 9 for triggering the corresponding TRIGGERED[9] event. */
-    NRF_EGU_TASK_TRIGGER10 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[10]), /**< Trigger 10 for triggering the corresponding TRIGGERED[10] event. */
-    NRF_EGU_TASK_TRIGGER11 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[11]), /**< Trigger 11 for triggering the corresponding TRIGGERED[11] event. */
-    NRF_EGU_TASK_TRIGGER12 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[12]), /**< Trigger 12 for triggering the corresponding TRIGGERED[12] event. */
-    NRF_EGU_TASK_TRIGGER13 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[13]), /**< Trigger 13 for triggering the corresponding TRIGGERED[13] event. */
-    NRF_EGU_TASK_TRIGGER14 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[14]), /**< Trigger 14 for triggering the corresponding TRIGGERED[14] event. */
-    NRF_EGU_TASK_TRIGGER15 = offsetof(NRF_EGU_Type, TASKS_TRIGGER[15])  /**< Trigger 15 for triggering the corresponding TRIGGERED[15] event. */
-    /*lint -restore*/
-} nrf_egu_task_t;
-
-
-/**
- * @enum  nrf_egu_event_t
- * @brief EGU events.
- */
-typedef enum
-{
-    /*lint -save -e30 -esym(628,__INTADDR__)*/
-    NRF_EGU_EVENT_TRIGGERED0  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[0]),  /**< Event number 0 generated by triggering the corresponding TRIGGER[0] task. */
-    NRF_EGU_EVENT_TRIGGERED1  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[1]),  /**< Event number 1 generated by triggering the corresponding TRIGGER[1] task. */
-    NRF_EGU_EVENT_TRIGGERED2  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[2]),  /**< Event number 2 generated by triggering the corresponding TRIGGER[2] task. */
-    NRF_EGU_EVENT_TRIGGERED3  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[3]),  /**< Event number 3 generated by triggering the corresponding TRIGGER[3] task. */
-    NRF_EGU_EVENT_TRIGGERED4  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[4]),  /**< Event number 4 generated by triggering the corresponding TRIGGER[4] task. */
-    NRF_EGU_EVENT_TRIGGERED5  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[5]),  /**< Event number 5 generated by triggering the corresponding TRIGGER[5] task. */
-    NRF_EGU_EVENT_TRIGGERED6  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[6]),  /**< Event number 6 generated by triggering the corresponding TRIGGER[6] task. */
-    NRF_EGU_EVENT_TRIGGERED7  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[7]),  /**< Event number 7 generated by triggering the corresponding TRIGGER[7] task. */
-    NRF_EGU_EVENT_TRIGGERED8  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[8]),  /**< Event number 8 generated by triggering the corresponding TRIGGER[8] task. */
-    NRF_EGU_EVENT_TRIGGERED9  = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[9]),  /**< Event number 9 generated by triggering the corresponding TRIGGER[9] task. */
-    NRF_EGU_EVENT_TRIGGERED10 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[10]), /**< Event number 10 generated by triggering the corresponding TRIGGER[10] task. */
-    NRF_EGU_EVENT_TRIGGERED11 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[11]), /**< Event number 11 generated by triggering the corresponding TRIGGER[11] task. */
-    NRF_EGU_EVENT_TRIGGERED12 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[12]), /**< Event number 12 generated by triggering the corresponding TRIGGER[12] task. */
-    NRF_EGU_EVENT_TRIGGERED13 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[13]), /**< Event number 13 generated by triggering the corresponding TRIGGER[13] task. */
-    NRF_EGU_EVENT_TRIGGERED14 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[14]), /**< Event number 14 generated by triggering the corresponding TRIGGER[14] task. */
-    NRF_EGU_EVENT_TRIGGERED15 = offsetof(NRF_EGU_Type, EVENTS_TRIGGERED[15])  /**< Event number 15 generated by triggering the corresponding TRIGGER[15] task. */
-    /*lint -restore*/
-} nrf_egu_event_t;
-
-
-/**
- * @enum  nrf_egu_int_mask_t
- * @brief EGU interrupts.
- */
-typedef enum
-{
-    NRF_EGU_INT_TRIGGERED0  = EGU_INTENSET_TRIGGERED0_Msk,  /**< Interrupt on EVENTS_TRIGGERED[0] event. */
-    NRF_EGU_INT_TRIGGERED1  = EGU_INTENSET_TRIGGERED1_Msk,  /**< Interrupt on EVENTS_TRIGGERED[1] event. */
-    NRF_EGU_INT_TRIGGERED2  = EGU_INTENSET_TRIGGERED2_Msk,  /**< Interrupt on EVENTS_TRIGGERED[2] event. */
-    NRF_EGU_INT_TRIGGERED3  = EGU_INTENSET_TRIGGERED3_Msk,  /**< Interrupt on EVENTS_TRIGGERED[3] event. */
-    NRF_EGU_INT_TRIGGERED4  = EGU_INTENSET_TRIGGERED4_Msk,  /**< Interrupt on EVENTS_TRIGGERED[4] event. */
-    NRF_EGU_INT_TRIGGERED5  = EGU_INTENSET_TRIGGERED5_Msk,  /**< Interrupt on EVENTS_TRIGGERED[5] event. */
-    NRF_EGU_INT_TRIGGERED6  = EGU_INTENSET_TRIGGERED6_Msk,  /**< Interrupt on EVENTS_TRIGGERED[6] event. */
-    NRF_EGU_INT_TRIGGERED7  = EGU_INTENSET_TRIGGERED7_Msk,  /**< Interrupt on EVENTS_TRIGGERED[7] event. */
-    NRF_EGU_INT_TRIGGERED8  = EGU_INTENSET_TRIGGERED8_Msk,  /**< Interrupt on EVENTS_TRIGGERED[8] event. */
-    NRF_EGU_INT_TRIGGERED9  = EGU_INTENSET_TRIGGERED9_Msk,  /**< Interrupt on EVENTS_TRIGGERED[9] event. */
-    NRF_EGU_INT_TRIGGERED10 = EGU_INTENSET_TRIGGERED10_Msk, /**< Interrupt on EVENTS_TRIGGERED[10] event. */
-    NRF_EGU_INT_TRIGGERED11 = EGU_INTENSET_TRIGGERED11_Msk, /**< Interrupt on EVENTS_TRIGGERED[11] event. */
-    NRF_EGU_INT_TRIGGERED12 = EGU_INTENSET_TRIGGERED12_Msk, /**< Interrupt on EVENTS_TRIGGERED[12] event. */
-    NRF_EGU_INT_TRIGGERED13 = EGU_INTENSET_TRIGGERED13_Msk, /**< Interrupt on EVENTS_TRIGGERED[13] event. */
-    NRF_EGU_INT_TRIGGERED14 = EGU_INTENSET_TRIGGERED14_Msk, /**< Interrupt on EVENTS_TRIGGERED[14] event. */
-    NRF_EGU_INT_TRIGGERED15 = EGU_INTENSET_TRIGGERED15_Msk, /**< Interrupt on EVENTS_TRIGGERED[15] event. */
-    NRF_EGU_INT_ALL         = 0xFFFFuL
-} nrf_egu_int_mask_t;
-
-
-/**
- * @brief Function for triggering a specific EGU task.
- *
- * @param NRF_EGUx EGU instance.
- * @param egu_task EGU task.
- */
-__STATIC_INLINE void nrf_egu_task_trigger(NRF_EGU_Type * NRF_EGUx, nrf_egu_task_t egu_task)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_task)) = 0x1UL;
-}
-
-
-/**
- * @brief Function for returning the address of a specific EGU task register.
- *
- * @param NRF_EGUx EGU instance.
- * @param egu_task EGU task.
- */
-__STATIC_INLINE uint32_t * nrf_egu_task_address_get(NRF_EGU_Type * NRF_EGUx,
-                                                    nrf_egu_task_t egu_task)
-{
-    return (uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_task);
-}
-
-
-/**
- * @brief Function for returning the address of a specific EGU TRIGGER task register.
- *
- * @param NRF_EGUx EGU instance.
- * @param channel  Channel number.
- */
-__STATIC_INLINE uint32_t * nrf_egu_task_trigger_addres_get(NRF_EGU_Type * NRF_EGUx,
-                                                           uint8_t channel)
-{
-    ASSERT(channel < NRF_EGU_CHANNEL_COUNT);
-    return (uint32_t*)&NRF_EGUx->TASKS_TRIGGER[channel];
-}
-
-
-/**
- * @brief Function for returning the specific EGU TRIGGER task.
- *
- * @param channel  Channel number.
- */
-__STATIC_INLINE nrf_egu_task_t nrf_egu_task_trigger_get(uint8_t channel)
-{
-    ASSERT(channel <= NRF_EGU_CHANNEL_COUNT);
-    return (nrf_egu_task_t)((uint32_t) NRF_EGU_TASK_TRIGGER0 + (channel * sizeof(uint32_t)));
-}
-
-
-/**
- * @brief Function for returning the state of a specific EGU event.
- *
- * @param NRF_EGUx  EGU instance.
- * @param egu_event EGU event to check.
- */
-__STATIC_INLINE bool nrf_egu_event_check(NRF_EGU_Type * NRF_EGUx,
-                                         nrf_egu_event_t egu_event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event);
-}
-
-
-/**
- * @brief Function for clearing a specific EGU event.
- *
- * @param NRF_EGUx  EGU instance.
- * @param egu_event EGU event to clear.
- */
-__STATIC_INLINE void nrf_egu_event_clear(NRF_EGU_Type * NRF_EGUx,
-                                         nrf_egu_event_t egu_event)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event)) = 0x0UL;
-}
-
-
-/**
- * @brief Function for returning the address of a specific EGU event register.
- *
- * @param NRF_EGUx  EGU instance.
- * @param egu_event EGU event.
- */
-__STATIC_INLINE uint32_t * nrf_egu_event_address_get(NRF_EGU_Type * NRF_EGUx,
-                                                     nrf_egu_event_t egu_event)
-{
-    return (uint32_t *)((uint8_t *)NRF_EGUx + (uint32_t)egu_event);
-}
-
-
-/**
- * @brief Function for returning the address of a specific EGU TRIGGERED event register.
- *
- * @param NRF_EGUx EGU instance.
- * @param channel  Channel number.
- */
-__STATIC_INLINE uint32_t * nrf_egu_event_triggered_addres_get(NRF_EGU_Type * NRF_EGUx,
-                                                              uint8_t channel)
-{
-    ASSERT(channel < NRF_EGU_CHANNEL_COUNT);
-    return (uint32_t*)&NRF_EGUx->EVENTS_TRIGGERED[channel];
-}
-
-
-/**
- * @brief Function for returning the specific EGU TRIGGERED event.
- *
- * @param channel  Channel number.
- */
-__STATIC_INLINE nrf_egu_event_t nrf_egu_event_triggered_get(uint8_t channel)
-{
-    ASSERT(channel < NRF_EGU_CHANNEL_COUNT);
-    return (nrf_egu_event_t)((uint32_t) NRF_EGU_EVENT_TRIGGERED0 + (channel * sizeof(uint32_t)));
-}
-
-
-/**
- * @brief Function for enabling one or more specific EGU interrupts.
- *
- * @param NRF_EGUx     EGU instance.
- * @param egu_int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_egu_int_enable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask)
-{
-    NRF_EGUx->INTENSET = egu_int_mask;
-}
-
-
-/**
- * @brief Function for retrieving the state of one or more EGU interrupts.
- *
- * @param NRF_EGUx EGU instance.
- * @param egu_int_mask Interrupts to check.
- *
- * @retval true  If all of the specified interrupts are enabled.
- * @retval false If at least one of the specified interrupts is disabled.
- */
-__STATIC_INLINE bool nrf_egu_int_enable_check(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask)
-{
-    return (bool)(NRF_EGUx->INTENSET & egu_int_mask);
-}
-
-
-/**
- * @brief Function for disabling one or more specific EGU interrupts.
- *
- * @param NRF_EGUx     EGU instance.
- * @param egu_int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_egu_int_disable(NRF_EGU_Type * NRF_EGUx, uint32_t egu_int_mask)
-{
-    NRF_EGUx->INTENCLR = egu_int_mask;
-}
-
-/**
- * @brief Function for retrieving one or more specific EGU interrupts.
- *
- * @param channel Channel number.
- *
- * @returns EGU interrupt mask.
- */
-__STATIC_INLINE nrf_egu_int_mask_t nrf_egu_int_get(uint8_t channel)
-{
-    ASSERT(channel < NRF_EGU_CHANNEL_COUNT);
-    return (nrf_egu_int_mask_t)((uint32_t) (EGU_INTENSET_TRIGGERED0_Msk << channel));
-}
-
-/** @} */
-
-#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/drivers_nrf/hal/nrf_gpio.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_gpio.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_gpio.h
deleted file mode 100644
index 3e8b2d7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_gpio.h
+++ /dev/null
@@ -1,655 +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.
-*
-*/
-#ifndef NRF_GPIO_H__
-#define NRF_GPIO_H__
-
-#include "nrf.h"
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_gpio GPIO abstraction
- * @{
- * @ingroup nrf_drivers
- * @brief GPIO pin abstraction and port abstraction for reading and writing byte-wise to GPIO ports.
- *
- * Here, the GPIO ports are defined as follows:
- * - Port 0 -> pin 0-7
- * - Port 1 -> pin 8-15
- * - Port 2 -> pin 16-23
- * - Port 3 -> pin 24-31
- */
-
-#define NUMBER_OF_PINS 32
-
-/**
- * @brief Enumerator used for selecting between port 0 - 3.
- */
-typedef enum
-{
-    NRF_GPIO_PORT_SELECT_PORT0 = 0,           ///<  Port 0 (GPIO pin 0-7)
-    NRF_GPIO_PORT_SELECT_PORT1,               ///<  Port 1 (GPIO pin 8-15)
-    NRF_GPIO_PORT_SELECT_PORT2,               ///<  Port 2 (GPIO pin 16-23)
-    NRF_GPIO_PORT_SELECT_PORT3,               ///<  Port 3 (GPIO pin 24-31)
-} nrf_gpio_port_select_t;
-
-/**
- * @brief Enumerator used for setting the direction of a GPIO port.
- */
-typedef enum
-{
-    NRF_GPIO_PORT_DIR_OUTPUT,       ///<  Output
-    NRF_GPIO_PORT_DIR_INPUT         ///<  Input
-} nrf_gpio_port_dir_t;
-
-/**
- * @brief Pin direction definitions.
- */
-typedef enum
-{
-    NRF_GPIO_PIN_DIR_INPUT  = GPIO_PIN_CNF_DIR_Input,   ///< Input
-    NRF_GPIO_PIN_DIR_OUTPUT = GPIO_PIN_CNF_DIR_Output   ///< Output
-} nrf_gpio_pin_dir_t;
-
-/**
- * @brief Connection of input buffer
- */
-typedef enum
-{
-    NRF_GPIO_PIN_INPUT_CONNECT    = GPIO_PIN_CNF_INPUT_Connect,   ///< Connect input buffer
-    NRF_GPIO_PIN_INPUT_DISCONNECT = GPIO_PIN_CNF_INPUT_Disconnect ///< Disconnect input buffer
-} nrf_gpio_pin_input_t;
-
-/**
- * @brief Enumerator used for selecting the pin to be pulled down or up at the time of pin configuration
- */
-typedef enum
-{
-    NRF_GPIO_PIN_NOPULL   = GPIO_PIN_CNF_PULL_Disabled,                 ///<  Pin pullup resistor disabled
-    NRF_GPIO_PIN_PULLDOWN = GPIO_PIN_CNF_PULL_Pulldown,                 ///<  Pin pulldown resistor enabled
-    NRF_GPIO_PIN_PULLUP   = GPIO_PIN_CNF_PULL_Pullup,                   ///<  Pin pullup resistor enabled
-} nrf_gpio_pin_pull_t;
-
-/**
- * @brief Enumerator used for selecting output drive mode
- */
-typedef enum
-{
-    NRF_GPIO_PIN_S0S1 = GPIO_PIN_CNF_DRIVE_S0S1, ///< !< Standard '0', standard '1'
-    NRF_GPIO_PIN_H0S1 = GPIO_PIN_CNF_DRIVE_H0S1, ///< !< High drive '0', standard '1'
-    NRF_GPIO_PIN_S0H1 = GPIO_PIN_CNF_DRIVE_S0H1, ///< !< Standard '0', high drive '1'
-    NRF_GPIO_PIN_H0H1 = GPIO_PIN_CNF_DRIVE_H0H1, ///< !< High drive '0', high 'drive '1''
-    NRF_GPIO_PIN_D0S1 = GPIO_PIN_CNF_DRIVE_D0S1, ///< !< Disconnect '0' standard '1'
-    NRF_GPIO_PIN_D0H1 = GPIO_PIN_CNF_DRIVE_D0H1, ///< !< Disconnect '0', high drive '1'
-    NRF_GPIO_PIN_S0D1 = GPIO_PIN_CNF_DRIVE_S0D1, ///< !< Standard '0'. disconnect '1'
-    NRF_GPIO_PIN_H0D1 = GPIO_PIN_CNF_DRIVE_H0D1, ///< !< High drive '0', disconnect '1'
-} nrf_gpio_pin_drive_t;
-
-/**
- * @brief Enumerator used for selecting the pin to sense high or low level on the pin input.
- */
-typedef enum
-{
-    NRF_GPIO_PIN_NOSENSE    = GPIO_PIN_CNF_SENSE_Disabled,              ///<  Pin sense level disabled.
-    NRF_GPIO_PIN_SENSE_LOW  = GPIO_PIN_CNF_SENSE_Low,                   ///<  Pin sense low level.
-    NRF_GPIO_PIN_SENSE_HIGH = GPIO_PIN_CNF_SENSE_High,                  ///<  Pin sense high level.
-} nrf_gpio_pin_sense_t;
-
-
-/**
- * @brief Function for configuring the GPIO pin range as outputs with normal drive strength.
- *        This function can be used to configure pin range as simple output with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases).
- *
- * @param pin_range_start specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30)
- *
- * @param pin_range_end specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30)
- *
- * @note For configuring only one pin as output use @ref nrf_gpio_cfg_output
- *       Sense capability on the pin is disabled, and input is disconnected from the buffer as the pins are configured as output.
- */
-__STATIC_INLINE void nrf_gpio_range_cfg_output(uint32_t pin_range_start, uint32_t pin_range_end);
-
-/**
- * @brief Function for configuring the GPIO pin range as inputs with given initial value set, hiding inner details.
- *        This function can be used to configure pin range as simple input.
- *
- * @param pin_range_start specifies the start number (inclusive) in the range of pin numbers to be configured (allowed values 0-30)
- *
- * @param pin_range_end specifies the end number (inclusive) in the range of pin numbers to be configured (allowed values 0-30)
- *
- * @param pull_config State of the pin range pull resistor (no pull, pulled down or pulled high)
- *
- * @note  For configuring only one pin as input use @ref nrf_gpio_cfg_input
- *        Sense capability on the pin is disabled, and input is connected to buffer so that the GPIO->IN register is readable
- */
-__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, uint32_t pin_range_end, nrf_gpio_pin_pull_t pull_config);
-
-/**
- * @brief Pin configuration function
- *
- * The main pin configuration function.
- * This function allows to set any aspect in PIN_CNF register.
- * @param pin_number Specifies the pin number (allowed values 0-31).
- * @param dir   Pin direction
- * @param input Connect or disconnect input buffer
- * @param pull  Pull configuration
- * @param drive Drive configuration
- * @param sense Pin sensing mechanism
- */
-__STATIC_INLINE void nrf_gpio_cfg(
-        uint32_t             pin_number,
-        nrf_gpio_pin_dir_t   dir,
-        nrf_gpio_pin_input_t input,
-        nrf_gpio_pin_pull_t  pull,
-        nrf_gpio_pin_drive_t drive,
-        nrf_gpio_pin_sense_t sense);
-
-/**
- * @brief Function for configuring the given GPIO pin number as output with given initial value set, hiding inner details.
- *        This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases).
- *
- * @param pin_number specifies the pin number (allowed values 0-31)
- *
- * @note  Sense capability on the pin is disabled, and input is disconnected from the buffer as the pins are configured as output.
- */
-__STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number);
-
-/**
- * @brief Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details.
- *        This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases).
- *
- * @param pin_number Specifies the pin number (allowed values 0-30).
- * @param pull_config State of the pin range pull resistor (no pull, pulled down or pulled high).
- *
- * @note  Sense capability on the pin is disabled, and input is connected to buffer so that the GPIO->IN register is readable
- */
-__STATIC_INLINE void nrf_gpio_cfg_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config);
-
-/**
- * @brief Function for reseting pin configuration to its default state.
- *
- * @param pin_number Specifies the pin number (allowed values 0-31).
- */
-__STATIC_INLINE void nrf_gpio_cfg_default(uint32_t pin_number);
-
-/**
- * @brief Function for configuring the given GPIO pin number as a watcher. Only input is connected.
- *
- * @param pin_number Specifies the pin number (allowed values 0-31).
- *
- */
-__STATIC_INLINE void nrf_gpio_cfg_watcher(uint32_t pin_number);
-
-/**
- * @brief Function for disconnecting input for the given GPIO.
- *
- * @param pin_number Specifies the pin number (allowed values 0-31).
- *
- */
-__STATIC_INLINE void nrf_gpio_input_disconnect(uint32_t pin_number);
-
-/**
- * @brief Function for configuring the given GPIO pin number as input with given initial value set, hiding inner details.
- *        This function can be used to configure pin range as simple input with gate driving GPIO_PIN_CNF_DRIVE_S0S1 (normal cases).
- *        Sense capability on the pin is configurable, and input is connected to buffer so that the GPIO->IN register is readable.
- *
- * @param pin_number   Specifies the pin number (allowed values 0-30).
- * @param pull_config  State of the pin pull resistor (no pull, pulled down or pulled high).
- * @param sense_config Sense level of the pin (no sense, sense low or sense high).
- */
-__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config, nrf_gpio_pin_sense_t sense_config);
-
-/**
- * @brief Function for configuring sense level for the given GPIO.
- *
- * @param pin_number   Specifies the pin number of gpio pin numbers to be configured (allowed values 0-30).
- * @param sense_config Sense configuration.
- *
- */
-__STATIC_INLINE void nrf_gpio_cfg_sense_set(uint32_t pin_number, nrf_gpio_pin_sense_t sense_config);
-
-/**
- * @brief Function for setting the direction for a GPIO pin.
- *
- * @param pin_number specifies the pin number (0-31) for which to
- * set the direction.
- *
- * @param direction specifies the direction
- */
-__STATIC_INLINE void nrf_gpio_pin_dir_set(uint32_t pin_number, nrf_gpio_pin_dir_t direction);
-
-/**
- * @brief Function for setting a GPIO pin.
- *
- * Note that the pin must be configured as an output for this
- * function to have any effect.
- *
- * @param pin_number Specifies the pin number (0-31) to set.
- */
-__STATIC_INLINE void nrf_gpio_pin_set(uint32_t pin_number);
-
-/**
- * @brief Function for setting GPIO pins.
- *
- * Note that the pins must be configured as outputs for this
- * function to have any effect.
- *
- * @param pin_mask Specifies the pins to set.
- */
-__STATIC_INLINE void nrf_gpio_pins_set(uint32_t pin_mask);
-
-/**
- * @brief Function for clearing a GPIO pin.
- *
- * Note that the pin must be configured as an output for this
- * function to have any effect.
- *
- * @param pin_number Specifies the pin number (0-31) to clear.
- */
-__STATIC_INLINE void nrf_gpio_pin_clear(uint32_t pin_number);
-
-/**
- * @brief Function for clearing GPIO pins.
- *
- * Note that the pins must be configured as outputs for this
- * function to have any effect.
- *
- * @param pin_mask Specifies the pins to clear.
- */
-__STATIC_INLINE void nrf_gpio_pins_clear(uint32_t pin_mask);
-
-/**
- * @brief Function for toggling a GPIO pin.
- *
- * Note that the pin must be configured as an output for this
- * function to have any effect.
- *
- * @param pin_number Specifies the pin number (0-31) to toggle.
- */
-__STATIC_INLINE void nrf_gpio_pin_toggle(uint32_t pin_number);
-
-/**
- * @brief Function for toggling GPIO pins.
- *
- * Note that the pins must be configured as outputs for this
- * function to have any effect.
- *
- * @param pin_mask Specifies the pins to toggle.
- */
-__STATIC_INLINE void nrf_gpio_pins_toggle(uint32_t pin_mask);
-
-/**
- * @brief Function for writing a value to a GPIO pin.
- *
- * Note that the pin must be configured as an output for this
- * function to have any effect.
- *
- * @param pin_number specifies the pin number (0-31) to
- * write.
- *
- * @param value specifies the value to be written to the pin.
- * @arg 0 clears the pin
- * @arg >=1 sets the pin.
- */
-__STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value);
-
-/**
- * @brief Function for reading the input level of a GPIO pin.
- *
- * Note that the pin must have input connected for the value
- * returned from this function to be valid.
- *
- * @param pin_number specifies the pin number (0-31) to
- * read.
- *
- * @return
- * @retval 0 if the pin input level is low.
- * @retval 1 if the pin input level is high.
- * @retval > 1 should never occur.
- */
-__STATIC_INLINE uint32_t nrf_gpio_pin_read(uint32_t pin_number);
-
-/**
- * @brief Function for reading the input level of all GPIO pins.
- *
- * Note that the pin must have input connected for the value
- * returned from this function to be valid.
- *
- * @retval Status of input of all pins
- */
-__STATIC_INLINE uint32_t nrf_gpio_pins_read(void);
-
-/**
- * @brief Function for reading the sense configuration of a GPIO pin.
- *
- * @param pin_number specifies the pin number (0-31) to
- * read.
- *
- * @retval Sense configuration
- */
-__STATIC_INLINE nrf_gpio_pin_sense_t nrf_gpio_pin_sense_get(uint32_t pin_number);
-
-/**
- * @brief Generic function for writing a single byte of a 32 bit word at a given
- * address.
- *
- * This function should not be called from outside the nrf_gpio
- * abstraction layer.
- *
- * @param word_address is the address of the word to be written.
- *
- * @param byte_no is the word byte number (0-3) to be written.
- *
- * @param value is the value to be written to byte "byte_no" of word
- * at address "word_address"
- */
-__STATIC_INLINE void nrf_gpio_word_byte_write(volatile uint32_t * word_address, uint8_t byte_no, uint8_t value);
-
-/**
- * @brief Generic function for reading a single byte of a 32 bit word at a given
- * address.
- *
- * This function should not be called from outside the nrf_gpio
- * abstraction layer.
- *
- * @param word_address is the address of the word to be read.
- *
- * @param byte_no is the byte number (0-3) of the word to be read.
- *
- * @return byte "byte_no" of word at address "word_address".
- */
-__STATIC_INLINE uint8_t nrf_gpio_word_byte_read(const volatile uint32_t* word_address, uint8_t byte_no);
-
-/**
- * @brief Function for setting the direction of a port.
- *
- * @param port is the port for which to set the direction.
- *
- * @param dir direction to be set for this port.
- */
-__STATIC_INLINE void nrf_gpio_port_dir_set(nrf_gpio_port_select_t port, nrf_gpio_port_dir_t dir);
-
-/**
- * @brief Function for reading a GPIO port.
- *
- * @param port is the port to read.
- *
- * @return the input value on this port.
- */
-__STATIC_INLINE uint8_t nrf_gpio_port_read(nrf_gpio_port_select_t port);
-
-/**
- * @brief Function for writing to a GPIO port.
- *
- * @param port is the port to write.
- *
- * @param value is the value to write to this port.
- *
- * @sa nrf_gpio_port_dir_set()
- */
-__STATIC_INLINE void nrf_gpio_port_write(nrf_gpio_port_select_t port, uint8_t value);
-
-/**
- * @brief Function for setting individual pins on GPIO port.
- *
- * @param port is the port for which to set the pins.
- *
- * @param set_mask is a mask specifying which pins to set. A bit
- * set to 1 indicates that the corresponding port pin shall be
- * set.
- *
- * @sa nrf_gpio_port_dir_set()
- */
-__STATIC_INLINE void nrf_gpio_port_set(nrf_gpio_port_select_t port, uint8_t set_mask);
-
-/**
- * @brief Function for clearing individual pins on GPIO port.
- *
- * @param port is the port for which to clear the pins.
- *
- * @param clr_mask is a mask specifying which pins to clear. A bit
- * set to 1 indicates that the corresponding port pin shall be
- * cleared.
- *
- * @sa nrf_gpio_port_dir_set()
- */
-__STATIC_INLINE void nrf_gpio_port_clear(nrf_gpio_port_select_t port, uint8_t clr_mask);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-__STATIC_INLINE void nrf_gpio_range_cfg_output(uint32_t pin_range_start, uint32_t pin_range_end)
-{
-    /*lint -e{845} // A zero has been given as right argument to operator '|'" */
-    for (; pin_range_start <= pin_range_end; pin_range_start++)
-    {
-        nrf_gpio_cfg_output(pin_range_start);
-    }
-}
-
-__STATIC_INLINE void nrf_gpio_range_cfg_input(uint32_t pin_range_start, uint32_t pin_range_end, nrf_gpio_pin_pull_t pull_config)
-{
-    /*lint -e{845} // A zero has been given as right argument to operator '|'" */
-    for (; pin_range_start <= pin_range_end; pin_range_start++)
-    {
-        nrf_gpio_cfg_input(pin_range_start, pull_config);
-    }
-}
-
-__STATIC_INLINE void nrf_gpio_cfg(
-        uint32_t             pin_number,
-        nrf_gpio_pin_dir_t   dir,
-        nrf_gpio_pin_input_t input,
-        nrf_gpio_pin_pull_t  pull,
-        nrf_gpio_pin_drive_t drive,
-        nrf_gpio_pin_sense_t sense)
-{
-    NRF_GPIO->PIN_CNF[pin_number] = ((uint32_t)dir   << GPIO_PIN_CNF_DIR_Pos)
-                                  | ((uint32_t)input << GPIO_PIN_CNF_INPUT_Pos)
-                                  | ((uint32_t)pull  << GPIO_PIN_CNF_PULL_Pos)
-                                  | ((uint32_t)drive << GPIO_PIN_CNF_DRIVE_Pos)
-                                  | ((uint32_t)sense << GPIO_PIN_CNF_SENSE_Pos);
-}
-
-__STATIC_INLINE void nrf_gpio_cfg_output(uint32_t pin_number)
-{
-    nrf_gpio_cfg(
-            pin_number,
-            NRF_GPIO_PIN_DIR_OUTPUT,
-            NRF_GPIO_PIN_INPUT_DISCONNECT,
-            NRF_GPIO_PIN_NOPULL,
-            NRF_GPIO_PIN_S0S1,
-            NRF_GPIO_PIN_NOSENSE);
-}
-
-__STATIC_INLINE void nrf_gpio_cfg_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config)
-{
-    nrf_gpio_cfg(
-            pin_number,
-            NRF_GPIO_PIN_DIR_INPUT,
-            NRF_GPIO_PIN_INPUT_CONNECT,
-            pull_config,
-            NRF_GPIO_PIN_S0S1,
-            NRF_GPIO_PIN_NOSENSE);
-}
-
-__STATIC_INLINE void nrf_gpio_cfg_default(uint32_t pin_number)
-{
-    nrf_gpio_cfg(
-            pin_number,
-            NRF_GPIO_PIN_DIR_INPUT,
-            NRF_GPIO_PIN_INPUT_DISCONNECT,
-            NRF_GPIO_PIN_NOPULL,
-            NRF_GPIO_PIN_S0S1,
-            NRF_GPIO_PIN_NOSENSE);
-}
-
-__STATIC_INLINE void nrf_gpio_cfg_watcher(uint32_t pin_number)
-{
-    /*lint -e{845} // A zero has been given as right argument to operator '|'" */
-    uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk;
-    NRF_GPIO->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos);
-}
-
-__STATIC_INLINE void nrf_gpio_input_disconnect(uint32_t pin_number)
-{
-    /*lint -e{845} // A zero has been given as right argument to operator '|'" */
-    uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_INPUT_Msk;
-    NRF_GPIO->PIN_CNF[pin_number] = cnf | (GPIO_PIN_CNF_INPUT_Disconnect << GPIO_PIN_CNF_INPUT_Pos);
-}
-
-__STATIC_INLINE void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pull_config, nrf_gpio_pin_sense_t sense_config)
-{
-    nrf_gpio_cfg(
-            pin_number,
-            NRF_GPIO_PIN_DIR_INPUT,
-            NRF_GPIO_PIN_INPUT_CONNECT,
-            pull_config,
-            NRF_GPIO_PIN_S0S1,
-            sense_config);
-}
-
-__STATIC_INLINE void nrf_gpio_cfg_sense_set(uint32_t pin_number, nrf_gpio_pin_sense_t sense_config)
-{
-    /*lint -e{845} // A zero has been given as right argument to operator '|'" */
-    //uint32_t cnf = NRF_GPIO->PIN_CNF[pin_number] & ~GPIO_PIN_CNF_SENSE_Msk;
-    NRF_GPIO->PIN_CNF[pin_number] &= ~GPIO_PIN_CNF_SENSE_Msk;
-    NRF_GPIO->PIN_CNF[pin_number] |= (sense_config << GPIO_PIN_CNF_SENSE_Pos);
-}
-
-__STATIC_INLINE void nrf_gpio_pin_dir_set(uint32_t pin_number, nrf_gpio_pin_dir_t direction)
-{
-    if(direction == NRF_GPIO_PIN_DIR_INPUT)
-    {
-        nrf_gpio_cfg(
-                pin_number,
-                NRF_GPIO_PIN_DIR_INPUT,
-                NRF_GPIO_PIN_INPUT_CONNECT,
-                NRF_GPIO_PIN_NOPULL,
-                NRF_GPIO_PIN_S0S1,
-                NRF_GPIO_PIN_NOSENSE);
-    }
-    else
-    {
-        NRF_GPIO->DIRSET = (1UL << pin_number);
-    }
-}
-
-__STATIC_INLINE void nrf_gpio_pin_set(uint32_t pin_number)
-{
-    NRF_GPIO->OUTSET = (1UL << pin_number);
-}
-
-__STATIC_INLINE void nrf_gpio_pins_set(uint32_t pin_mask)
-{
-    NRF_GPIO->OUTSET = pin_mask;
-}
-
-__STATIC_INLINE void nrf_gpio_pin_clear(uint32_t pin_number)
-{
-    NRF_GPIO->OUTCLR = (1UL << pin_number);
-}
-
-__STATIC_INLINE void nrf_gpio_pins_clear(uint32_t pin_mask)
-{
-    NRF_GPIO->OUTCLR = pin_mask;
-}
-
-__STATIC_INLINE void nrf_gpio_pin_toggle(uint32_t pin_number)
-{
-    nrf_gpio_pins_toggle(1UL << pin_number);
-}
-
-__STATIC_INLINE void nrf_gpio_pins_toggle(uint32_t pin_mask)
-{
-    uint32_t pins_state = NRF_GPIO->OUT;
-    NRF_GPIO->OUTSET = (~pins_state & pin_mask);
-    NRF_GPIO->OUTCLR = ( pins_state & pin_mask);
-}
-
-__STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value)
-{
-    if (value == 0)
-    {
-        nrf_gpio_pin_clear(pin_number);
-    }
-    else
-    {
-        nrf_gpio_pin_set(pin_number);
-    }
-}
-
-__STATIC_INLINE uint32_t nrf_gpio_pin_read(uint32_t pin_number)
-{
-    return  ((NRF_GPIO->IN >> pin_number) & 1UL);
-}
-
-__STATIC_INLINE uint32_t nrf_gpio_pins_read(void)
-{
-    return NRF_GPIO->IN;
-}
-
-__STATIC_INLINE nrf_gpio_pin_sense_t nrf_gpio_pin_sense_get(uint32_t pin_number)
-{
-    return (nrf_gpio_pin_sense_t)((NRF_GPIO->PIN_CNF[pin_number] & GPIO_PIN_CNF_SENSE_Msk) >> GPIO_PIN_CNF_SENSE_Pos);
-}
-
-__STATIC_INLINE void nrf_gpio_word_byte_write(volatile uint32_t * word_address, uint8_t byte_no, uint8_t value)
-{
-    *((volatile uint8_t*)(word_address) + byte_no) = value;
-}
-
-__STATIC_INLINE uint8_t nrf_gpio_word_byte_read(const volatile uint32_t* word_address, uint8_t byte_no)
-{
-    return (*((const volatile uint8_t*)(word_address) + byte_no));
-}
-
-__STATIC_INLINE void nrf_gpio_port_dir_set(nrf_gpio_port_select_t port, nrf_gpio_port_dir_t dir)
-{
-    if (dir == NRF_GPIO_PORT_DIR_OUTPUT)
-    {
-        nrf_gpio_word_byte_write(&NRF_GPIO->DIRSET, port, 0xFF);
-    }
-    else
-    {
-        nrf_gpio_range_cfg_input(port*8, (port+1)*8-1, NRF_GPIO_PIN_NOPULL);
-    }
-}
-
-__STATIC_INLINE uint8_t nrf_gpio_port_read(nrf_gpio_port_select_t port)
-{
-    return nrf_gpio_word_byte_read(&NRF_GPIO->IN, port);
-}
-
-__STATIC_INLINE void nrf_gpio_port_write(nrf_gpio_port_select_t port, uint8_t value)
-{
-    nrf_gpio_word_byte_write(&NRF_GPIO->OUT, port, value);
-}
-
-__STATIC_INLINE void nrf_gpio_port_set(nrf_gpio_port_select_t port, uint8_t set_mask)
-{
-    nrf_gpio_word_byte_write(&NRF_GPIO->OUTSET, port, set_mask);
-}
-
-__STATIC_INLINE void nrf_gpio_port_clear(nrf_gpio_port_select_t port, uint8_t clr_mask)
-{
-    nrf_gpio_word_byte_write(&NRF_GPIO->OUTCLR, port, clr_mask);
-}
-#endif //SUPPRESS_INLINE_IMPLEMENTATION
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif


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

Posted by cc...@apache.org.
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_util.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_util.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_util.c
deleted file mode 100644
index 0a8a213..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_util.c
+++ /dev/null
@@ -1,152 +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_util.h"
-#include <stdint.h>
-#include <string.h>
-
-
-/**
- * @brief Function for aborting current application/bootloader jump to to other app/bootloader.
- *
- * @details This functions will use the address provide to swap the stack pointer and then load 
- *          the address of the reset handler to be executed. It will check current system mode 
- *          (thread/handler) and if in thread mode it will reset into other application.
- *          If in handler mode \ref isr_abort will be executed to ensure correct exit of handler 
- *          mode and jump into reset handler of other application.
- *
- * @param[in]  start_addr  Start address of other application. This address must point to the 
-               initial stack pointer of the application.
- *
- * @note This function will never return but issue a reset into provided application.
- */
-#if defined ( __CC_ARM )
-__asm static void bootloader_util_reset(uint32_t start_addr)
-{
-    LDR   R5, [R0]              ; Get App initial MSP for bootloader.
-    MSR   MSP, R5               ; Set the main stack pointer to the applications MSP.
-    LDR   R0, [R0, #0x04]       ; Load Reset handler into R0. This will be first argument to branch instruction (BX).
-
-    MOVS  R4, #0xFF             ; Load ones to R4.
-    SXTB  R4, R4                ; Sign extend R4 to obtain 0xFFFFFFFF instead of 0xFF.
-    MRS   R5, IPSR              ; Load IPSR to R5 to check for handler or thread mode.
-    CMP   R5, #0x00             ; Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader.
-    BNE   isr_abort             ; If not zero we need to exit current ISR and jump to reset handler of bootloader.
-
-    MOV   LR, R4                ; Clear the link register and set to ones to ensure no return, R4 = 0xFFFFFFFF.
-    BX    R0                    ; Branch to reset handler of bootloader.
-
-isr_abort
-                                ; R4 contains ones from line above. Will be popped as R12 when exiting ISR (Cleaning up the registers).
-    MOV   R5, R4                ; Fill with ones before jumping to reset handling. We be popped as LR when exiting ISR. Ensures no return to application.
-    MOV   R6, R0                ; Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR.
-    MOVS  r7, #0x21             ; Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21.
-    REV   r7, r7                ; Reverse byte order to put 0x21 as MSB.
-    PUSH  {r4-r7}               ; Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR.
-
-    MOVS  R4, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers).
-    MOVS  R5, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers).
-    MOVS  R6, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers).
-    MOVS  R7, #0x00             ; Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers).
-    PUSH  {r4-r7}               ; Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine.
-
-    MOVS  R0, #0xF9             ; Move the execution return command into register, 0xFFFFFFF9.
-    SXTB  R0, R0                ; Sign extend R0 to obtain 0xFFFFFFF9 instead of 0xF9.
-    BX    R0                    ; No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application.
-    ALIGN
-}
-#elif defined ( __GNUC__ )
-static inline void bootloader_util_reset(uint32_t start_addr)
-{
-    __asm volatile(
-        "ldr   r0, [%0]\t\n"            // Get App initial MSP for bootloader.
-        "msr   msp, r0\t\n"             // Set the main stack pointer to the applications MSP.
-        "ldr   r0, [%0, #0x04]\t\n"     // Load Reset handler into R0.
-
-        "movs  r4, #0xFF\t\n"           // Move ones to R4.
-        "sxtb  r4, r4\t\n"              // Sign extend R4 to obtain 0xFFFFFFFF instead of 0xFF.
-
-        "mrs   r5, IPSR\t\n"            // Load IPSR to R5 to check for handler or thread mode.
-        "cmp   r5, #0x00\t\n"           // Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader.
-        "bne   isr_abort\t\n"           // If not zero we need to exit current ISR and jump to reset handler of bootloader.
-
-        "mov   lr, r4\t\n"              // Clear the link register and set to ones to ensure no return.
-        "bx    r0\t\n"                  // Branch to reset handler of bootloader.
-
-        "isr_abort:  \t\n"
-
-        "mov   r5, r4\t\n"              // Fill with ones before jumping to reset handling. Will be popped as LR when exiting ISR. Ensures no return to application.
-        "mov   r6, r0\t\n"              // Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR.
-        "movs  r7, #0x21\t\n"           // Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21.
-        "rev   r7, r7\t\n"              // Reverse byte order to put 0x21 as MSB.
-        "push  {r4-r7}\t\n"             // Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR.
-
-        "movs  r4, #0x00\t\n"           // Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers).
-        "movs  r5, #0x00\t\n"           // Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers).
-        "movs  r6, #0x00\t\n"           // Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers).
-        "movs  r7, #0x00\t\n"           // Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers).
-        "push  {r4-r7}\t\n"             // Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine.
-
-        "movs  r0, #0xF9\t\n"           // Move the execution return command into register, 0xFFFFFFF9.
-        "sxtb  r0, r0\t\n"              // Sign extend R0 to obtain 0xFFFFFFF9 instead of 0xF9.
-        "bx    r0\t\n"                  // No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application.
-        ".align\t\n"
-        :: "r" (start_addr)             // Argument list for the gcc assembly. start_addr is %0.
-        :  "r0", "r4", "r5", "r6", "r7" // List of register maintained manually.
-    );
-}
-#elif defined ( __ICCARM__ )
-static inline void bootloader_util_reset(uint32_t start_addr)
-{
-    asm("ldr   r5, [%0]\n"                    // Get App initial MSP for bootloader.
-        "msr   msp, r5\n"                     // Set the main stack pointer to the applications MSP.
-        "ldr   r0, [%0, #0x04]\n"             // Load Reset handler into R0.
-
-        "movs  r4, #0x00\n"                   // Load zero into R4.
-        "mvns  r4, r4\n"                      // Invert R4 to ensure it contain ones.
-
-        "mrs   r5, IPSR\n"                    // Load IPSR to R5 to check for handler or thread mode 
-        "cmp   r5, #0x00\n"                   // Compare, if 0 then we are in thread mode and can continue to reset handler of bootloader.
-        "bne.n isr_abort\n"                   // If not zero we need to exit current ISR and jump to reset handler of bootloader.
-
-        "mov   lr, r4\n"                      // Clear the link register and set to ones to ensure no return.
-        "bx    r0\n"                          // Branch to reset handler of bootloader.
-
-        "isr_abort: \n"
-                                              // R4 contains ones from line above. We be popped as R12 when exiting ISR (Cleaning up the registers).
-        "mov   r5, r4\n"                      // Fill with ones before jumping to reset handling. Will be popped as LR when exiting ISR. Ensures no return to application.
-        "mov   r6, r0\n"                      // Move address of reset handler to R6. Will be popped as PC when exiting ISR. Ensures the reset handler will be executed when exist ISR.
-        "movs  r7, #0x21\n"                   // Move MSB reset value of xPSR to R7. Will be popped as xPSR when exiting ISR. xPSR is 0x21000000 thus MSB is 0x21.
-        "rev   r7, r7\n"                      // Reverse byte order to put 0x21 as MSB.
-        "push  {r4-r7}\n"                     // Push everything to new stack to allow interrupt handler to fetch it on exiting the ISR.
-
-        "movs  r4, #0x00\n"                   // Fill with zeros before jumping to reset handling. We be popped as R0 when exiting ISR (Cleaning up of the registers).
-        "movs  r5, #0x00\n"                   // Fill with zeros before jumping to reset handling. We be popped as R1 when exiting ISR (Cleaning up of the registers).
-        "movs  r6, #0x00\n"                   // Fill with zeros before jumping to reset handling. We be popped as R2 when exiting ISR (Cleaning up of the registers).
-        "movs  r7, #0x00\n"                   // Fill with zeros before jumping to reset handling. We be popped as R3 when exiting ISR (Cleaning up of the registers).
-        "push  {r4-r7}\n"                     // Push zeros (R4-R7) to stack to prepare for exiting the interrupt routine.
-
-        "movs  r0, #0x06\n"                   // Load 0x06 into R6 to prepare for exec return command.
-        "mvns  r0, r0\n"                      // Invert 0x06 to obtain EXEC_RETURN, 0xFFFFFFF9.
-        "bx    r0\n"                          // No return - Handler mode will be exited. Stack will be popped and execution will continue in reset handler initializing other application.
-        :: "r" (start_addr)                   // Argument list for the IAR assembly. start_addr is %0.
-        :  "r0", "r4", "r5", "r6", "r7");     // List of register maintained manually.
-}
-#else
-#error Compiler not supported.
-#endif
-
-
-void bootloader_util_app_start(uint32_t start_addr)
-{
-    bootloader_util_reset(start_addr);
-}

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_util.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_util.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_util.h
deleted file mode 100644
index ca92415..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/bootloader_util.h
+++ /dev/null
@@ -1,46 +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_util Bootloader util API.
- * @{     
- *  
- * @brief Bootloader util module interface.
- */
- 
-#ifndef BOOTLOADER_UTIL_H__
-#define BOOTLOADER_UTIL_H__
-
-#include <stdint.h>
-#include "bootloader_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for starting the application (or bootloader) at the provided address.
- * 
- * @param[in]  start_addr             Start address.
- *
- * @note This function will never retrun. Instead it will reset into the application of the 
- *       provided address.
- */
-void bootloader_util_app_start(uint32_t start_addr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BOOTLOADER_UTIL_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/dfu.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu.h
deleted file mode 100644
index 716dcce..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu.h
+++ /dev/null
@@ -1,142 +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_dfu Device Firmware Update API.
- * @{     
- *
- * @brief Device Firmware Update module interface.
- */
-
-#ifndef DFU_H__
-#define DFU_H__
-
-#include <dfu_types.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief DFU event callback for asynchronous calls.
- *
- * @param[in] packet  Packet type for which this callback is related. START_PACKET, DATA_PACKET.
- * @param[in] result  Operation result code. NRF_SUCCESS when a queued operation was successful.
- * @param[in] p_data  Pointer to the data to which the operation is related.
- */
-typedef void (*dfu_callback_t)(uint32_t packet, uint32_t  result, uint8_t * p_data);
-
-/**@brief Function for initializing the Device Firmware Update module.
- * 
- * @return    NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t dfu_init(void);
-
-/**@brief Function for registering a callback listener for \ref dfu_data_pkt_handle callbacks.
- *
- * @param[in] callback_handler  Callback handler for receiving DFU events on completed operations
- *                              of DFU packets.
- */
-void dfu_register_callback(dfu_callback_t callback_handler);
-
-/**@brief Function for setting the DFU image size. 
- *
- * @details Function sets the DFU image size. This function must be called when an update is started 
- *          in order to notify the DFU of the new image size. If multiple images are to be 
- *          transferred within the same update context then this function must be called with size 
- *          information for each image being transfered.
- *          If an image type is not being transfered, e.g. SoftDevice but no Application , then the
- *          image size for application must be zero.
- * 
- * @param[in] p_packet   Pointer to the DFU packet containing information on DFU update process to
- *                       be started.
- *
- * @return    NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet);
-
-/**@brief Function for handling DFU data packets.
- *
- * @param[in] p_packet   Pointer to the DFU packet.
- *
- * @return    NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet);
-
-/**@brief Function for handling DFU init packets.
- *
- * @return    NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet);
-
-/**@brief Function for validating a transferred image after the transfer has completed.
- * 
- * @return    NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t dfu_image_validate(void);
-
-/**@brief Function for activating the transfered image after validation has successfully completed.
- *
- * @return    NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t dfu_image_activate(void);
-
-/**@brief Function for reseting the current update procedure and return to initial state.
- *        
- * @details This function call will result in a system reset to ensure correct system behavior.
- *          The reset will might be scheduled to execute at a later point in time to ensure pending 
- *          flash operations has completed.
- */
-void dfu_reset(void);
-
-/**@brief Function for validating that new bootloader has been correctly installed.
- *        
- * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs.
- */
-uint32_t dfu_bl_image_validate(void);
-
-/**@brief Function for validating that new SoftDevicehas been correctly installed.
- *        
- * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs.
- */
-uint32_t dfu_sd_image_validate(void);
-
-/**@brief Function for swapping existing bootloader with newly received.
- *        
- * @return NRF_SUCCESS on succesfull swapping. For error code please refer to 
- *         \ref sd_mbr_command_copy_bl_t.
- */
-uint32_t dfu_bl_image_swap(void);
-
-/**@brief Function for swapping existing SoftDevice with newly received.
- *        
- * @return NRF_SUCCESS on succesfull swapping. For error code please refer to 
- *         \ref sd_mbr_command_copy_sd_t.
- */
-uint32_t dfu_sd_image_swap(void);
-
-/**@brief Function for handling DFU init packet complete.
- *
- * @return    NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t dfu_init_pkt_complete(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_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/dfu_app_handler.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_app_handler.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_app_handler.c
deleted file mode 100644
index 6180c40..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_app_handler.c
+++ /dev/null
@@ -1,192 +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.
- *
- */
-
-#include "dfu_app_handler.h"
-#include <string.h>
-#include "bootloader_util.h"
-#include "nrf.h"
-#include "nrf_sdm.h"
-#include "ble_gatt.h"
-#include "ble_gatts.h"
-#include "app_error.h"
-#include "dfu_ble_svc.h"
-#include "device_manager.h"
-#include "nrf_delay.h"
-
-#define IRQ_ENABLED            0x01                                     /**< Field that identifies if an interrupt is enabled. */
-#define MAX_NUMBER_INTERRUPTS  32                                       /**< Maximum number of interrupts available. */
-
-static void                    dfu_app_reset_prepare(void);             /**< Forward declaration of default reset handler. */
-static dfu_app_reset_prepare_t m_reset_prepare = dfu_app_reset_prepare; /**< Callback function to application to prepare for system reset. Allows application to clean up service and memory before reset. */
-static dfu_ble_peer_data_t     m_peer_data;                             /**< Peer data to be used for data exchange when resetting into DFU mode. */
-static dm_handle_t             m_dm_handle;                             /**< Device Manager handle with instance IDs of current BLE connection. */
-
-
-/**@brief Function for reset_prepare handler if the application has not registered a handler.
- */
-static void dfu_app_reset_prepare(void)
-{
-    // Reset prepare should be handled by application.
-    // This function can be extended to include default handling if application does not implement
-    // own handler.
-}
-
-
-/**@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;
-
-    // Fetch the current interrupt settings.
-    interrupt_setting_mask = NVIC->ISER[0];
-
-    // Loop from interrupt 0 for disabling of all interrupts.
-    for (irq = 0; irq < MAX_NUMBER_INTERRUPTS; irq++)
-    {
-        if (interrupt_setting_mask & (IRQ_ENABLED << irq))
-        {
-            // The interrupt was enabled, hence disable it.
-            NVIC_DisableIRQ((IRQn_Type)irq);
-        }
-    }
-}
-
-
-/**@brief Function for providing peer information to DFU for re-establishing a bonded connection in
- *        DFU mode.
- *
- * @param[in] conn_handle   Connection handle for the connection requesting DFU mode.
- */
-static void dfu_app_peer_data_set(uint16_t conn_handle)
-{
-    uint32_t                 err_code;
-    dm_sec_keyset_t          key_set;
-    uint32_t                 app_context_data = 0;
-    dm_application_context_t app_context;
-
-
-/** [DFU bond sharing] */
-    err_code = dm_handle_get(conn_handle, &m_dm_handle);
-    if (err_code == NRF_SUCCESS)
-    {
-        err_code = dm_distributed_keys_get(&m_dm_handle, &key_set);
-        if (err_code == NRF_SUCCESS)
-        {
-            APP_ERROR_CHECK(err_code);
-
-            m_peer_data.addr              = key_set.keys_central.p_id_key->id_addr_info;
-            m_peer_data.irk               = key_set.keys_central.p_id_key->id_info;
-            m_peer_data.enc_key.enc_info  = key_set.keys_periph.enc_key.p_enc_key->enc_info;
-            m_peer_data.enc_key.master_id = key_set.keys_periph.enc_key.p_enc_key->master_id;
-
-            err_code = dfu_ble_svc_peer_data_set(&m_peer_data);
-            APP_ERROR_CHECK(err_code);
-
-            app_context_data   = (DFU_APP_ATT_TABLE_CHANGED << DFU_APP_ATT_TABLE_POS);
-            app_context.len    = sizeof(app_context_data);
-            app_context.p_data = (uint8_t *)&app_context_data;
-            app_context.flags  = 0;
-
-            err_code = dm_application_context_set(&m_dm_handle, &app_context);
-            APP_ERROR_CHECK(err_code);
-        }
-        else
-        {
-            // Keys were not available, thus we have a non-encrypted connection.
-            err_code = dm_peer_addr_get(&m_dm_handle, &m_peer_data.addr);
-            APP_ERROR_CHECK(err_code);
-
-            err_code = dfu_ble_svc_peer_data_set(&m_peer_data);
-            APP_ERROR_CHECK(err_code);
-        }
-    }
-/** [DFU bond sharing] */
-}
-
-
-/**@brief Function for preparing the reset, disabling SoftDevice, and jumping to the bootloader.
- *
- * @param[in] conn_handle Connection handle for peer requesting to enter DFU mode.
- */
-static void bootloader_start(uint16_t conn_handle)
-{
-    uint32_t err_code;
-    uint16_t sys_serv_attr_len = sizeof(m_peer_data.sys_serv_attr);
-
-    err_code = sd_ble_gatts_sys_attr_get(conn_handle,
-                                         m_peer_data.sys_serv_attr,
-                                         &sys_serv_attr_len,
-                                         BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
-    if (err_code != NRF_SUCCESS)
-    {
-        // Any error at this stage means the system service attributes could not be fetched.
-        // This means the service changed indication cannot be sent in DFU mode, but connection
-        // is still possible to establish.
-    }
-
-    m_reset_prepare();
-
-    err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START);
-    APP_ERROR_CHECK(err_code);
-
-    err_code = sd_softdevice_disable();
-    APP_ERROR_CHECK(err_code);
-
-    err_code = sd_softdevice_vector_table_base_set(NRF_UICR->NRFFW[0]);
-    APP_ERROR_CHECK(err_code);
-
-    dfu_app_peer_data_set(conn_handle);
-
-    NVIC_ClearPendingIRQ(SWI2_IRQn);
-    interrupts_disable();
-    bootloader_util_app_start(NRF_UICR->NRFFW[0]);
-}
-
-
-void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
-{
-    switch (p_evt->ble_dfu_evt_type)
-    {
-        case BLE_DFU_START:
-            // Starting the bootloader - will cause reset.
-            bootloader_start(p_dfu->conn_handle);
-            break;
-
-        default:
-            {
-                // Unsupported event received from DFU Service. 
-                // Send back BLE_DFU_RESP_VAL_NOT_SUPPORTED message to peer.
-                uint32_t err_code = ble_dfu_response_send(p_dfu,
-                                                          BLE_DFU_START_PROCEDURE,
-                                                          BLE_DFU_RESP_VAL_NOT_SUPPORTED);
-                APP_ERROR_CHECK(err_code);
-            }
-            break;
-    }
-}
-
-
-void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func)
-{
-    m_reset_prepare = reset_prepare_func;
-}
-
-
-void dfu_app_dm_appl_instance_set(dm_application_instance_t app_instance)
-{
-    uint32_t err_code;
-    
-    err_code = dm_application_instance_set(&app_instance, &m_dm_handle);
-    APP_ERROR_CHECK(err_code);
-}

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/dfu_app_handler.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_app_handler.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_app_handler.h
deleted file mode 100644
index d25172e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_app_handler.h
+++ /dev/null
@@ -1,94 +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_dfu_app_handler DFU BLE packet handling in application
- * @{
- *
- * @brief Handling of DFU BLE packets in the application.
- *
- * @details This module implements the handling of DFU packets for switching 
- *          from an application to the bootloader and start DFU mode. The DFU
- *          packets are transmitted over BLE. 
- *          This module handles only the StartDFU packet, which allows a BLE 
- *          application to expose support for the DFU Service.
- *          The actual DFU Service runs in a dedicated environment after a BLE 
- *          disconnect and reset of the \nRFXX device. 
- *          The host must reconnect and continue the update procedure with 
- *          access to the full DFU Service.
- *
- * @note The application must propagate DFU events to this module by calling
- *       @ref dfu_app_on_dfu_evt from the @ref ble_dfu_evt_handler_t callback.
- */
- 
-#ifndef DFU_APP_HANDLER_H__
-#define DFU_APP_HANDLER_H__
-
-#include "ble_dfu.h"
-#include "nrf_svc.h"
-#include "bootloader_types.h"
-#include "device_manager.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define DFU_APP_ATT_TABLE_POS     0                     /**< Position for the ATT table changed setting. */
-#define DFU_APP_ATT_TABLE_CHANGED 1                     /**< Value indicating that the ATT table might have changed. This value will be set in the application-specific context in Device Manager when entering DFU mode. */
-
-/**@brief DFU application reset_prepare function. This function is a callback that allows the 
- *        application to prepare for an upcoming application reset. 
- */
-typedef void (*dfu_app_reset_prepare_t)(void);
-
-/**@brief   Function for handling events from the DFU Service. 
- *
- * @details The application must inject this function into the DFU Service or propagate DFU events 
- *          to the dfu_app_handler module by calling this function in the application-specific DFU event 
- *          handler.
- * 
- * @param[in] p_dfu  Pointer to the DFU Service structure to which the include event relates.
- * @param[in] p_evt  Pointer to the DFU event.
- */
-void dfu_app_on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt);
-
-/**@brief Function for registering a function to prepare a reset.
- *
- * @details The provided function is executed before resetting the system into bootloader/DFU
- *          mode. By registering this function, the caller is notified before the reset and can
- *          thus prepare the application for reset. For example, the application can gracefully
- *          disconnect any peers on BLE, turn of LEDS, ensure that all pending flash operations
- *          have completed, and so on.
- *
- * @param[in] reset_prepare_func  Function to be executed before a reset.
- */
-void dfu_app_reset_prepare_set(dfu_app_reset_prepare_t reset_prepare_func);
-
-/**@brief Function for setting the Device Manager application instance.
- *
- * @details This function allows to set the @ref dm_application_instance_t value that is returned by the 
- *          Device Manager when the application registers using @ref dm_register.
- *          If this function is not called, it is not be possible to share bonding information
- *          from the application to the bootloader/DFU when entering DFU mode.
- *
- * @param[in] app_instance Value for the application instance in use.
- */
-void dfu_app_dm_appl_instance_set(dm_application_instance_t app_instance);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_APP_HANDLER_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/dfu_bank_internal.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_bank_internal.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_bank_internal.h
deleted file mode 100644
index 5d759c0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_bank_internal.h
+++ /dev/null
@@ -1,95 +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 dfu_bank_internal Device Firmware Update internal header for bank handling in DFU.
- * @{     
- *
- * @brief Device Firmware Update Bank handling module interface.
- *
- * @details This header is intended for shared definition and functions between single and dual bank 
- *         implementations used for DFU support. It is not supposed to be used for external access 
- *         to the DFU module.
- *  
- */
-#ifndef DFU_BANK_INTERNAL_H__
-#define DFU_BANK_INTERNAL_H__
-
-#include <dfu_types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief States of the DFU state machine. */
-typedef enum
-{
-    DFU_STATE_INIT_ERROR,                                                           /**< State for: dfu_init(...) error. */
-    DFU_STATE_IDLE,                                                                 /**< State for: idle. */
-    DFU_STATE_PREPARING,                                                            /**< State for: preparing, indicates that the flash is being erased and no data packets can be processed. */
-    DFU_STATE_RDY,                                                                  /**< State for: ready. */
-    DFU_STATE_RX_INIT_PKT,                                                          /**< State for: receiving initialization packet. */
-    DFU_STATE_RX_DATA_PKT,                                                          /**< State for: receiving data packet. */
-    DFU_STATE_VALIDATE,                                                             /**< State for: validate. */
-    DFU_STATE_WAIT_4_ACTIVATE                                                       /**< State for: waiting for dfu_image_activate(). */
-} dfu_state_t;
-
-#define APP_TIMER_PRESCALER         0                                               /**< Value of the RTC1 PRESCALER register. */
-#define DFU_TIMEOUT_INTERVAL        APP_TIMER_TICKS(120000, APP_TIMER_PRESCALER)    /**< DFU timeout interval in units of timer ticks. */     
-
-#define IS_UPDATING_SD(START_PKT)   ((START_PKT).dfu_update_mode & DFU_UPDATE_SD)   /**< Macro for determining if a SoftDevice update is ongoing. */
-#define IS_UPDATING_BL(START_PKT)   ((START_PKT).dfu_update_mode & DFU_UPDATE_BL)   /**< Macro for determining if a Bootloader update is ongoing. */
-#define IS_UPDATING_APP(START_PKT)  ((START_PKT).dfu_update_mode & DFU_UPDATE_APP)  /**< Macro for determining if a Application update is ongoing. */
-#define IMAGE_WRITE_IN_PROGRESS()   (m_data_received > 0)                           /**< Macro for determining if an image write is in progress. */
-#define IS_WORD_SIZED(SIZE)         ((SIZE & (sizeof(uint32_t) - 1)) == 0)          /**< Macro for checking that the provided is word sized. */
-
-/**@cond NO_DOXYGEN */
-static uint32_t                     m_data_received;                                /**< Amount of received data. */
-/**@endcond */
-
-/**@brief     Type definition of function used for preparing of the bank before receiving of a
- *            software image.
- *
- * @param[in] image_size  Size of software image being received.
- */
-typedef void (*dfu_bank_prepare_t)(uint32_t image_size);
-
-/**@brief     Type definition of function used for handling clear complete of the bank before 
- *            receiving of a software image.
- */
-typedef void (*dfu_bank_cleared_t)(void);
-
-/**@brief    Type definition of function used for activating of the software image received.
- *
- * @return  NRF_SUCCESS If the image has been successfully activated any other NRF_ERROR code in
- *          case of a failure.
- */
-typedef uint32_t (*dfu_bank_activate_t)(void);
-
-/**@brief Structure for holding of function pointers for needed prepare and activate procedure for
- *        the requested update procedure. 
- */
-typedef struct
-{
-    dfu_bank_prepare_t  prepare;                                                    /**< Function pointer to the prepare function called on start of update procedure. */
-    dfu_bank_cleared_t  cleared;                                                    /**< Function pointer to the cleared function called after prepare function completes. */
-    dfu_bank_activate_t activate;                                                   /**< Function pointer to the activate function called on finalizing the update procedure. */
-} dfu_bank_func_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_BANK_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/dfu_ble_svc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_ble_svc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_ble_svc.h
deleted file mode 100644
index 37a6412..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_ble_svc.h
+++ /dev/null
@@ -1,88 +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_dfu_ble_svc DFU BLE SVC 
- * @{
- *
- * @brief DFU BLE SVC in bootloader. The DFU BLE SuperVisor Calls allow an application to execute
- *        functions in the installed bootloader. 
- *
- * @details This module implements handling of SuperVisor Calls in the bootloader. 
- *          SuperVisor Calls allow for an application to execute calls into the bootloader.
- *          Currently, it is possible to exchange bonding information (like keys) from the 
- *          application to a bootloader supporting DFU OTA using BLE, so the update process can be 
- *          done through an already existing bond.
- *
- * @note The application must make sure that all SuperVisor Calls (SVC) are forwarded to the 
- *       bootloader to ensure correct behavior. Forwarding of SVCs to the bootloader is 
- *       done using the SoftDevice SVC @ref sd_softdevice_vector_table_base_set with the value 
- *       present in @c NRF_UICR->NRFFW[0].
- */
- 
-#ifndef DFU_BLE_SVC_H__
-#define DFU_BLE_SVC_H__
-
-#include "nrf_svc.h"
-#include <stdint.h>
-#include "ble_gap.h"
-#include "nrf.h"
-#include "nrf_soc.h"
-#include "nrf_error_sdm.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BOOTLOADER_SVC_BASE     0x0     /**< The number of the lowest SVC number reserved for the bootloader. */
-#define SYSTEM_SERVICE_ATT_SIZE 8       /**< Size of the system service attribute length including CRC-16 at the end. */  
-
-/**@brief The SVC numbers used by the SVC functions in the SoC library. */
-enum BOOTLOADER_SVCS
-{
-    DFU_BLE_SVC_PEER_DATA_SET = BOOTLOADER_SVC_BASE,    /**< SVC number for the setting of peer data call. */
-    BOOTLOADER_SVC_LAST
-};
-
-/**@brief   DFU Peer data structure.
- *
- * @details This structure contains peer data needed for connection to a bonded device during DFU.
- *          The peer data must be provided by the application to the bootloader during buttonless
- *          update. See @ref dfu_ble_svc_peer_data_set. It contains bond information about the
- *          desired DFU peer.
- */
-typedef struct
-{
-    ble_gap_addr_t      addr;                                   /**< BLE GAP address of the device that initiated the DFU process. */
-    ble_gap_irk_t       irk;                                    /**< IRK of the device that initiated the DFU process if this device uses Private Resolvable Addresses. */
-    ble_gap_enc_key_t   enc_key;                                /**< Encryption key structure containing encrypted diversifier and LTK for re-establishing the bond. */
-    uint8_t             sys_serv_attr[SYSTEM_SERVICE_ATT_SIZE]; /**< System service attributes for restoring of Service Changed Indication setting in DFU mode. */
-} dfu_ble_peer_data_t;
-
-/**@brief   SVC Function for setting peer data containing address, IRK, and LTK to establish bonded
- *          connection in DFU mode.
- *
- * @param[in] p_peer_data  Pointer to the peer data containing keys for the connection.
- *
- * @retval NRF_ERROR_NULL If a NULL pointer was provided as argument.
- * @retval NRF_SUCCESS    If the function completed successfully.
- */
-SVCALL(DFU_BLE_SVC_PEER_DATA_SET, uint32_t, dfu_ble_svc_peer_data_set(dfu_ble_peer_data_t * p_peer_data));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_BLE_SVC_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/dfu_ble_svc_internal.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h
deleted file mode 100644
index f74eeb2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h
+++ /dev/null
@@ -1,51 +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_dfu_ble_svc_internal DFU BLE SVC internal
- * @{
- *
- * @brief DFU BLE SVC internal functions in bootloader. The DFU BLE SuperVisor Calls allow an 
- *        application to execute functions in the installed bootloader. This interface provides 
- *        internal Bootloader DFU functions for retrieving data exchanged through SuperVisor Calls.
- *
- */
-
-#ifndef DFU_BLE_SVC_INTERNAL_H__
-#define DFU_BLE_SVC_INTERNAL_H__
-
-#include <stdint.h>
-#include "dfu_ble_svc.h"
-#include "ble_gap.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Internal bootloader/DFU function for retrieving peer data provided from application.
- *
- * @param[out] p_peer_data Peer data set by application to be used for DFU connection.
- *
- * @retval NRF_SUCCESS            If peer data is valid and can be used for connection.
- * @retval NRF_ERROR_NULL         If p_peer_data is a NULL pointer.
- * @retval NRF_ERROR_INVALID_DATA If peer data is not available or invalid.
- */
-uint32_t dfu_ble_peer_data_get(dfu_ble_peer_data_t * p_peer_data);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_BLE_SVC_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/dfu_dual_bank.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_dual_bank.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_dual_bank.c
deleted file mode 100644
index fecbdf3..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_dual_bank.c
+++ /dev/null
@@ -1,834 +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 <stddef.h>
-#include "dfu.h"
-#include <dfu_types.h>
-#include "dfu_bank_internal.h"
-#include "nrf.h"
-#include "nrf_sdm.h"
-#include "app_error.h"
-#include "app_timer.h"
-#include "bootloader.h"
-#include "bootloader_types.h"
-#include "pstorage.h"
-#include "nrf_mbr.h"
-#include "dfu_init.h"
-#include "sdk_common.h"
-
-static dfu_state_t                  m_dfu_state;                /**< Current DFU state. */
-static uint32_t                     m_image_size;               /**< Size of the image that will be transmitted. */
-
-static dfu_start_packet_t           m_start_packet;             /**< Start packet received for this update procedure. Contains update mode and image sizes information to be used for image transfer. */
-static uint8_t                      m_init_packet[128];         /**< Init packet, can hold CRC, Hash, Signed Hash and similar, for image validation, integrety check and authorization checking. */ 
-static uint8_t                      m_init_packet_length;       /**< Length of init packet received. */
-static uint16_t                     m_image_crc;                /**< Calculated CRC of the image received. */
-
-APP_TIMER_DEF(m_dfu_timer_id);                                  /**< Application timer id. */
-static bool                         m_dfu_timed_out = false;    /**< Boolean flag value for tracking DFU timer timeout state. */
-
-static pstorage_handle_t            m_storage_handle_swap;      /**< Pstorage handle for the swap area (bank 1). Bank used when updating an application or bootloader without SoftDevice. */
-static pstorage_handle_t            m_storage_handle_app;       /**< Pstorage handle for the application area (bank 0). Bank used when updating a SoftDevice w/wo bootloader. Handle also used when swapping received application from bank 1 to bank 0. */
-static pstorage_handle_t          * mp_storage_handle_active;   /**< Pointer to the pstorage handle for the active bank for receiving of data packets. */
-
-static dfu_callback_t               m_data_pkt_cb;              /**< Callback from DFU Bank module for notification of asynchronous operation such as flash prepare. */
-static dfu_bank_func_t              m_functions;                /**< Structure holding operations for the selected update process. */
-
-
-/**@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)
-{
-    switch (op_code)
-    {
-        case PSTORAGE_STORE_OP_CODE:
-            if ((m_dfu_state == DFU_STATE_RX_DATA_PKT) && (m_data_pkt_cb != NULL))
-            {
-                m_data_pkt_cb(DATA_PACKET, result, p_data);
-            }
-            break;
-
-        case PSTORAGE_CLEAR_OP_CODE:
-            if (m_dfu_state == DFU_STATE_PREPARING)
-            {
-                m_functions.cleared();
-                m_dfu_state = DFU_STATE_RDY;
-                if (m_data_pkt_cb != NULL)
-                {
-                    m_data_pkt_cb(START_PACKET, result, p_data);
-                }
-            }
-            break;
-
-        default:
-            break;
-    }
-    APP_ERROR_CHECK(result);
-}
-
-
-/**@brief Function for handling the DFU timeout.
- *
- * @param[in] p_context The timeout context.
- */
-static void dfu_timeout_handler(void * p_context)
-{
-    UNUSED_PARAMETER(p_context);
-    dfu_update_status_t update_status;
-
-    m_dfu_timed_out           = true;
-    update_status.status_code = DFU_TIMEOUT;
-
-    bootloader_dfu_update_process(update_status);
-}
-
-
-/**@brief   Function for restarting the DFU Timer.
- *
- * @details This function will stop and restart the DFU timer. This function will be called by the
- *          functions handling any DFU packet received from the peer that is transferring a firmware
- *          image.
- */
-static uint32_t dfu_timer_restart(void)
-{
-    if (m_dfu_timed_out)
-    {
-        // The DFU timer had already timed out.
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    uint32_t err_code = app_timer_stop(m_dfu_timer_id);
-    APP_ERROR_CHECK(err_code);
-
-    err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL);
-    APP_ERROR_CHECK(err_code);
-
-    return err_code;
-}
-
-
-/**@brief   Function for preparing of flash before receiving SoftDevice image.
- *
- * @details This function will erase current application area to ensure sufficient amount of
- *          storage for the SoftDevice image. Upon erase complete a callback will be done.
- *          See \ref dfu_bank_prepare_t for further details.
- */
-static void dfu_prepare_func_app_erase(uint32_t image_size)
-{
-    uint32_t err_code;
-
-    mp_storage_handle_active = &m_storage_handle_app;
-
-    // Doing a SoftDevice update thus current application must be cleared to ensure enough space
-    // for new SoftDevice.
-    m_dfu_state = DFU_STATE_PREPARING;
-    err_code    = pstorage_clear(&m_storage_handle_app, m_image_size);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief   Function for preparing swap before receiving application or bootloader image.
- *
- * @details This function will erase current swap area to ensure flash is ready for storage of the
- *          Application or Bootloader image. Upon erase complete a callback will be done.
- *          See \ref dfu_bank_prepare_t for further details.
- */
-static void dfu_prepare_func_swap_erase(uint32_t image_size)
-{
-    uint32_t err_code;
-
-    mp_storage_handle_active = &m_storage_handle_swap;
-
-    m_dfu_state = DFU_STATE_PREPARING;
-    err_code    = pstorage_clear(&m_storage_handle_swap, DFU_IMAGE_MAX_SIZE_BANKED);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief   Function for handling behaviour when clear operation has completed.
- */
-static void dfu_cleared_func_swap(void)
-{
-    // Do nothing.
-}
-
-
-/**@brief   Function for handling behaviour when clear operation has completed.
- */
-static void dfu_cleared_func_app(void)
-{
-    dfu_update_status_t update_status = {DFU_BANK_0_ERASED, };
-    bootloader_dfu_update_process(update_status);
-}
-
-
-/**@brief   Function for calculating storage offset for receiving SoftDevice image.
- *
- * @details When a new SoftDevice is received it will be temporary stored in flash before moved to
- *          address 0x0. In order to succesfully validate transfer and relocation it is important
- *          that temporary image and final installed image does not ovwerlap hence an offset must
- *          be calculated in case new image is larger than currently installed SoftDevice.
- */
-uint32_t offset_calculate(uint32_t sd_image_size)
-{
-    uint32_t offset = 0;
-    
-    if (m_start_packet.sd_image_size > DFU_BANK_0_REGION_START)
-    {
-        uint32_t page_mask = (CODE_PAGE_SIZE - 1);
-        uint32_t diff = m_start_packet.sd_image_size - DFU_BANK_0_REGION_START;
-        
-        offset = diff & ~page_mask;
-        
-        // Align offset to next page if image size is not page sized.
-        if ((diff & page_mask) > 0)
-        {
-            offset += CODE_PAGE_SIZE;
-        }
-    }
-
-    return offset;
-}
-
-
-/**@brief Function for activating received SoftDevice image.
- *
- *  @note This function will not move the SoftDevice image.
- *        The bootloader settings will be marked as SoftDevice update complete and the swapping of
- *        current SoftDevice will occur after system reset.
- *
- * @return NRF_SUCCESS on success.
- */
-static uint32_t dfu_activate_sd(void)
-{
-    dfu_update_status_t update_status;
-
-    update_status.status_code    = DFU_UPDATE_SD_COMPLETE;
-    update_status.app_crc        = m_image_crc;
-    update_status.sd_image_start = DFU_BANK_0_REGION_START;
-    update_status.sd_size        = m_start_packet.sd_image_size;
-    update_status.bl_size        = m_start_packet.bl_image_size;
-    update_status.app_size       = m_start_packet.app_image_size;
-
-    bootloader_dfu_update_process(update_status);
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for activating received Application image.
- *
- *  @details This function will move the received application image fram swap (bank 1) to
- *           application area (bank 0).
- *
- * @return NRF_SUCCESS on success. Error code otherwise.
- */
-static uint32_t dfu_activate_app(void)
-{
-    uint32_t err_code;
-
-    // Erase BANK 0.
-    err_code = pstorage_clear(&m_storage_handle_app, m_start_packet.app_image_size);
-    APP_ERROR_CHECK(err_code);
-
-    err_code = pstorage_store(&m_storage_handle_app,
-                                  (uint8_t *)m_storage_handle_swap.block_id,
-                                  m_start_packet.app_image_size,
-                                  0);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        dfu_update_status_t update_status;
-
-        memset(&update_status, 0, sizeof(dfu_update_status_t ));
-        update_status.status_code = DFU_UPDATE_APP_COMPLETE;
-        update_status.app_crc     = m_image_crc;
-        update_status.app_size    = m_start_packet.app_image_size;
-
-        bootloader_dfu_update_process(update_status);
-    }
-
-    return err_code;
-}
-
-
-/**@brief Function for activating received Bootloader image.
- *
- *  @note This function will not move the bootloader image.
- *        The bootloader settings will be marked as Bootloader update complete and the swapping of
- *        current bootloader will occur after system reset.
- *
- * @return NRF_SUCCESS on success.
- */
-static uint32_t dfu_activate_bl(void)
-{
-    dfu_update_status_t update_status;
-
-    update_status.status_code = DFU_UPDATE_BOOT_COMPLETE;
-    update_status.app_crc     = m_image_crc;
-    update_status.sd_size     = m_start_packet.sd_image_size;
-    update_status.bl_size     = m_start_packet.bl_image_size;
-    update_status.app_size    = m_start_packet.app_image_size;
-
-    bootloader_dfu_update_process(update_status);
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_init(void)
-{
-    uint32_t                err_code;
-    pstorage_module_param_t storage_module_param = {.cb = pstorage_callback_handler};
-
-    m_init_packet_length = 0;
-    m_image_crc          = 0;
-
-    err_code = pstorage_register(&storage_module_param, &m_storage_handle_app);
-    if (err_code != NRF_SUCCESS)
-    {
-        m_dfu_state = DFU_STATE_INIT_ERROR;
-        return err_code;
-    }
-
-    m_storage_handle_app.block_id  = DFU_BANK_0_REGION_START;
-    m_storage_handle_swap          = m_storage_handle_app;
-    m_storage_handle_swap.block_id = DFU_BANK_1_REGION_START;
-
-    // Create the timer to monitor the activity by the peer doing the firmware update.
-    err_code = app_timer_create(&m_dfu_timer_id,
-                                APP_TIMER_MODE_SINGLE_SHOT,
-                                dfu_timeout_handler);
-    APP_ERROR_CHECK(err_code);
-
-    // Start the DFU timer.
-    err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL);
-    APP_ERROR_CHECK(err_code);
-
-    m_data_received = 0;
-    m_dfu_state     = DFU_STATE_IDLE;
-
-    return NRF_SUCCESS;
-}
-
-
-void dfu_register_callback(dfu_callback_t callback_handler)
-{
-    m_data_pkt_cb = callback_handler;
-}
-
-
-uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet)
-{
-    uint32_t err_code;
-
-    m_start_packet = *(p_packet->params.start_packet);
-
-    // Check that the requested update procedure is supported.
-    // Currently the following combinations are allowed:
-    // - Application
-    // - SoftDevice
-    // - Bootloader
-    // - SoftDevice with Bootloader
-    if (IS_UPDATING_APP(m_start_packet) && 
-        (IS_UPDATING_SD(m_start_packet) || IS_UPDATING_BL(m_start_packet)))
-    {
-        // App update is only supported independently.
-        return NRF_ERROR_NOT_SUPPORTED;
-    }
-
-    if (!(IS_WORD_SIZED(m_start_packet.sd_image_size) &&
-          IS_WORD_SIZED(m_start_packet.bl_image_size) &&
-          IS_WORD_SIZED(m_start_packet.app_image_size)))
-    {
-        // Image_sizes are not a multiple of 4 (word size).
-        return NRF_ERROR_NOT_SUPPORTED;
-    }
-
-    m_image_size = m_start_packet.sd_image_size + m_start_packet.bl_image_size +
-                   m_start_packet.app_image_size;
-    
-    if (m_start_packet.bl_image_size > DFU_BL_IMAGE_MAX_SIZE)
-    {
-        return NRF_ERROR_DATA_SIZE;
-    }
-
-    if (IS_UPDATING_SD(m_start_packet))
-    {
-        if (m_image_size > (DFU_IMAGE_MAX_SIZE_FULL))
-        {
-            return NRF_ERROR_DATA_SIZE;
-        }
-        m_functions.prepare  = dfu_prepare_func_app_erase;
-        m_functions.cleared  = dfu_cleared_func_app;
-        m_functions.activate = dfu_activate_sd;
-    }
-    else
-    {
-        if (m_image_size > DFU_IMAGE_MAX_SIZE_BANKED)
-        {
-            return NRF_ERROR_DATA_SIZE;
-        }
-
-        m_functions.prepare = dfu_prepare_func_swap_erase;
-        m_functions.cleared = dfu_cleared_func_swap;
-        if (IS_UPDATING_BL(m_start_packet))
-        {
-            m_functions.activate = dfu_activate_bl;
-        }
-        else
-        {
-            m_functions.activate = dfu_activate_app;
-        }
-    }
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_IDLE:
-            // Valid peer activity detected. Hence restart the DFU timer.
-            err_code = dfu_timer_restart();
-            VERIFY_SUCCESS(err_code);
-            m_functions.prepare(m_image_size);
-
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet)
-{
-    uint32_t   data_length;
-    uint32_t   err_code;
-    uint32_t * p_data;
-
-    VERIFY_PARAM_NOT_NULL(p_packet);
-
-    // Check pointer alignment.
-    if (!is_word_aligned(p_packet->params.data_packet.p_data_packet))
-    {
-        // The p_data_packet is not word aligned address.
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_RDY:
-        case DFU_STATE_RX_INIT_PKT:
-            return NRF_ERROR_INVALID_STATE;
-
-        case DFU_STATE_RX_DATA_PKT:
-            data_length = p_packet->params.data_packet.packet_length * sizeof(uint32_t);
-
-            if ((m_data_received + data_length) > m_image_size)
-            {
-                // The caller is trying to write more bytes into the flash than the size provided to
-                // the dfu_image_size_set function. This is treated as a serious error condition and
-                // an unrecoverable one. Hence point the variable mp_app_write_address to the top of
-                // the flash area. This will ensure that all future application data packet writes
-                // will be blocked because of the above check.
-                m_data_received = 0xFFFFFFFF;
-
-                return NRF_ERROR_DATA_SIZE;
-            }
-
-            // Valid peer activity detected. Hence restart the DFU timer.
-            err_code = dfu_timer_restart();
-            VERIFY_SUCCESS(err_code);
-
-            p_data = (uint32_t *)p_packet->params.data_packet.p_data_packet;
-
-            err_code = pstorage_store(mp_storage_handle_active,
-                                          (uint8_t *)p_data,
-                                          data_length,
-                                          m_data_received);
-            VERIFY_SUCCESS(err_code);
-
-            m_data_received += data_length;
-
-            if (m_data_received != m_image_size)
-            {
-                // The entire image is not received yet. More data is expected.
-                err_code = NRF_ERROR_INVALID_LENGTH;
-            }
-            else
-            {
-                // The entire image has been received. Return NRF_SUCCESS.
-                err_code = NRF_SUCCESS;
-            }
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_init_pkt_complete(void)
-{
-    uint32_t err_code = NRF_ERROR_INVALID_STATE;
-    
-    // DFU initialization has been done and a start packet has been received.
-    if (IMAGE_WRITE_IN_PROGRESS())
-    {
-        // Image write is already in progress. Cannot handle an init packet now.
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    if (m_dfu_state == DFU_STATE_RX_INIT_PKT)
-    {
-        err_code = dfu_init_prevalidate(m_init_packet, m_init_packet_length);
-        if (err_code == NRF_SUCCESS)
-        {
-            m_dfu_state = DFU_STATE_RX_DATA_PKT;
-        }
-        else
-        {
-            m_init_packet_length = 0;
-        }
-    }
-    return err_code;
-}
-
-
-uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet)
-{
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t length;
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_RDY:
-            m_dfu_state = DFU_STATE_RX_INIT_PKT;
-            // When receiving init packet in state ready just update and fall through this case.         
-
-        case DFU_STATE_RX_INIT_PKT:
-            // DFU initialization has been done and a start packet has been received.
-            if (IMAGE_WRITE_IN_PROGRESS())
-            {
-                // Image write is already in progress. Cannot handle an init packet now.
-                return NRF_ERROR_INVALID_STATE;
-            }
-
-            // Valid peer activity detected. Hence restart the DFU timer.
-            err_code = dfu_timer_restart();
-            VERIFY_SUCCESS(err_code);
-
-            length = p_packet->params.data_packet.packet_length * sizeof(uint32_t);
-            if ((m_init_packet_length + length) > sizeof(m_init_packet))
-            {
-                return NRF_ERROR_INVALID_LENGTH;
-            }
-            
-            memcpy(&m_init_packet[m_init_packet_length],
-                   &p_packet->params.data_packet.p_data_packet[0],
-                   length);
-            m_init_packet_length += length;
-            break;
-
-        default:
-            // Either the start packet was not received or dfu_init function was not called before.
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_image_validate()
-{
-    uint32_t err_code;
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_RX_DATA_PKT:
-            // Check if the application image write has finished.
-            if (m_data_received != m_image_size)
-            {
-                // Image not yet fully transfered by the peer or the peer has attempted to write
-                // too much data. Hence the validation should fail.
-                err_code = NRF_ERROR_INVALID_STATE;
-            }
-            else
-            {
-                m_dfu_state = DFU_STATE_VALIDATE;
-
-                // Valid peer activity detected. Hence restart the DFU timer.
-                err_code = dfu_timer_restart();
-                if (err_code == NRF_SUCCESS)
-                {
-                    err_code = dfu_init_postvalidate((uint8_t *)mp_storage_handle_active->block_id,
-                                                     m_image_size);
-                    VERIFY_SUCCESS(err_code);
-
-                    m_dfu_state = DFU_STATE_WAIT_4_ACTIVATE;
-                }
-            }
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_image_activate()
-{
-    uint32_t err_code;
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_WAIT_4_ACTIVATE:
-
-            // Stop the DFU Timer because the peer activity need not be monitored any longer.
-            err_code = app_timer_stop(m_dfu_timer_id);
-            APP_ERROR_CHECK(err_code);
-
-            err_code = m_functions.activate();
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-void dfu_reset(void)
-{
-    dfu_update_status_t update_status;
-
-    update_status.status_code = DFU_RESET;
-
-    bootloader_dfu_update_process(update_status);
-}
-
-
-static uint32_t dfu_compare_block(uint32_t * ptr1, uint32_t * ptr2, uint32_t len)
-{
-    sd_mbr_command_t sd_mbr_cmd;
-
-    sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
-    sd_mbr_cmd.params.compare.ptr1 = ptr1;
-    sd_mbr_cmd.params.compare.ptr2 = ptr2;
-    sd_mbr_cmd.params.compare.len  = len / sizeof(uint32_t);
-
-    return sd_mbr_command(&sd_mbr_cmd);
-}
-
-
-static uint32_t dfu_copy_sd(uint32_t * src, uint32_t * dst, uint32_t len)
-{
-    sd_mbr_command_t sd_mbr_cmd;
-
-    sd_mbr_cmd.command            = SD_MBR_COMMAND_COPY_SD;
-    sd_mbr_cmd.params.copy_sd.src = src;
-    sd_mbr_cmd.params.copy_sd.dst = dst;
-    sd_mbr_cmd.params.copy_sd.len = len / sizeof(uint32_t);
-
-    return sd_mbr_command(&sd_mbr_cmd);
-}
-
-
-static uint32_t dfu_sd_img_block_swap(uint32_t * src, 
-                                      uint32_t * dst, 
-                                      uint32_t len, 
-                                      uint32_t block_size)
-{
-    // It is neccesarry to swap the new SoftDevice in 3 rounds to ensure correct copy of data
-    // and verifucation of data in case power reset occurs during write to flash. 
-    // To ensure the robustness of swapping the images are compared backwards till start of
-    // image swap. If the back is identical everything is swapped.
-    uint32_t err_code = dfu_compare_block(src, dst, len);
-    if (err_code == NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    if ((uint32_t)dst > SOFTDEVICE_REGION_START)
-    {
-        err_code = dfu_sd_img_block_swap((uint32_t *)((uint32_t)src - block_size), 
-                                         (uint32_t *)((uint32_t)dst - block_size), 
-                                         block_size, 
-                                         block_size);
-        VERIFY_SUCCESS(err_code);
-    }
-
-    err_code = dfu_copy_sd(src, dst, len);
-    VERIFY_SUCCESS(err_code);
-
-    return dfu_compare_block(src, dst, len);
-}
-
-
-uint32_t dfu_sd_image_swap(void)
-{
-    bootloader_settings_t boot_settings;
-
-    bootloader_settings_get(&boot_settings);
-
-    if (boot_settings.sd_image_size == 0)
-    {
-        return NRF_SUCCESS;
-    }
-    
-    if ((SOFTDEVICE_REGION_START + boot_settings.sd_image_size) > boot_settings.sd_image_start)
-    {
-        uint32_t err_code;
-        uint32_t sd_start        = SOFTDEVICE_REGION_START;
-        uint32_t block_size      = (boot_settings.sd_image_start - sd_start) / 2;
-        uint32_t image_end       = boot_settings.sd_image_start + boot_settings.sd_image_size;
-
-        uint32_t img_block_start = boot_settings.sd_image_start + 2 * block_size;
-        uint32_t sd_block_start  = sd_start + 2 * block_size;
-        
-        if (SD_SIZE_GET(MBR_SIZE) < boot_settings.sd_image_size)
-        {
-            // This will clear a page thus ensuring the old image is invalidated before swapping.
-            err_code = dfu_copy_sd((uint32_t *)(sd_start + block_size), 
-                                   (uint32_t *)(sd_start + block_size), 
-                                   sizeof(uint32_t));
-            VERIFY_SUCCESS(err_code);
-
-            err_code = dfu_copy_sd((uint32_t *)sd_start, (uint32_t *)sd_start, sizeof(uint32_t));
-            VERIFY_SUCCESS(err_code);
-        }
-        
-        return dfu_sd_img_block_swap((uint32_t *)img_block_start, 
-                                     (uint32_t *)sd_block_start, 
-                                     image_end - img_block_start, 
-                                     block_size);
-    }
-    else
-    {
-        if (boot_settings.sd_image_size != 0)
-        {
-            return dfu_copy_sd((uint32_t *)boot_settings.sd_image_start,
-                               (uint32_t *)SOFTDEVICE_REGION_START, 
-                               boot_settings.sd_image_size);
-        }
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_bl_image_swap(void)
-{
-    bootloader_settings_t bootloader_settings;
-    sd_mbr_command_t      sd_mbr_cmd;
-
-    bootloader_settings_get(&bootloader_settings);
-
-    if (bootloader_settings.bl_image_size != 0)
-    {
-        uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ?
-                                  DFU_BANK_1_REGION_START :
-                                  bootloader_settings.sd_image_start + 
-                                  bootloader_settings.sd_image_size;
-
-        sd_mbr_cmd.command               = SD_MBR_COMMAND_COPY_BL;
-        sd_mbr_cmd.params.copy_bl.bl_src = (uint32_t *)(bl_image_start);
-        sd_mbr_cmd.params.copy_bl.bl_len = bootloader_settings.bl_image_size / sizeof(uint32_t);
-
-        return sd_mbr_command(&sd_mbr_cmd);
-    }
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_bl_image_validate(void)
-{
-    bootloader_settings_t bootloader_settings;
-    sd_mbr_command_t      sd_mbr_cmd;
-
-    bootloader_settings_get(&bootloader_settings);
-
-    if (bootloader_settings.bl_image_size != 0)
-    {
-        uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ?
-                                  DFU_BANK_1_REGION_START :
-                                  bootloader_settings.sd_image_start +
-                                  bootloader_settings.sd_image_size;
-
-        sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
-        sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)BOOTLOADER_REGION_START;
-        sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)(bl_image_start);
-        sd_mbr_cmd.params.compare.len  = bootloader_settings.bl_image_size / sizeof(uint32_t);
-
-        return sd_mbr_command(&sd_mbr_cmd);
-    }
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_sd_image_validate(void)
-{
-    bootloader_settings_t bootloader_settings;
-    sd_mbr_command_t      sd_mbr_cmd;
-
-    bootloader_settings_get(&bootloader_settings);
-
-    if (bootloader_settings.sd_image_size == 0)
-    {
-        return NRF_SUCCESS;
-    }
-    
-    if ((SOFTDEVICE_REGION_START + bootloader_settings.sd_image_size) > bootloader_settings.sd_image_start)
-    {
-        uint32_t sd_start        = SOFTDEVICE_REGION_START;
-        uint32_t block_size      = (bootloader_settings.sd_image_start - sd_start) / 2;
-        uint32_t image_end       = bootloader_settings.sd_image_start + 
-                                   bootloader_settings.sd_image_size;
-
-        uint32_t img_block_start = bootloader_settings.sd_image_start + 2 * block_size;
-        uint32_t sd_block_start  = sd_start + 2 * block_size;
-
-        if (SD_SIZE_GET(MBR_SIZE) < bootloader_settings.sd_image_size)
-        {
-            return NRF_ERROR_NULL;
-        }
-
-        return dfu_sd_img_block_swap((uint32_t *)img_block_start, 
-                                     (uint32_t *)sd_block_start, 
-                                     image_end - img_block_start, 
-                                     block_size);
-    }
-    
-    sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
-    sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)SOFTDEVICE_REGION_START;
-    sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)bootloader_settings.sd_image_start;
-    sd_mbr_cmd.params.compare.len  = bootloader_settings.sd_image_size / sizeof(uint32_t);
-
-    return sd_mbr_command(&sd_mbr_cmd);
-}

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/dfu_init.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_init.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_init.h
deleted file mode 100644
index edac3ce..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_init.h
+++ /dev/null
@@ -1,142 +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_dfu_init Init packet handling in DFU
- * @{
- *
- * @brief Device Firmware Update module type and function declaration for init packet handling.
- *
- * @details This header contains basic functionality for performing safety checks on software 
- *          updates for \nRFXX based devices. It provides a skeleton for pre-checking an init packet
- *          to ensure the following image is compatible with this device. A safety check should 
- *          always be performed to prevent accidental flashing of unsupported applications or a
- *          wrong combination of application and SoftDevice.
- *          The device information contains information such as:
- *          - Device type (2 bytes), for example Heart Rate. The device type is a number defined by
- *            the customer. It can be located in UICR or FICR.
- *          - Device revision (2 bytes), for example major revision 1, minor revision 0. The device
- *            revision is a number defined by the customer. It can be located in UICR or FICR.
- *          - List of SoftDevices supported by this application, for example 
- *              0x0049 = S110v6_0_0 
- *              0xFFFE = S110 development (any SoftDevice accepted),
- *          - CRC or hash of firmware image
- *
- * @note This module does not support security features such as image signing, but the corresponding
- *       implementation allows for such extensions.
- *       If the init packet is signed by a trusted source, it must be decrypted before it can be 
- *       processed.
- */
-
-#ifndef DFU_INIT_H__
-#define DFU_INIT_H__
-
-#include <stdint.h>
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Structure contained in an init packet. Contains information on device type, revision, and 
- *        supported SoftDevices.
- */
-typedef struct
-{
-    uint16_t device_type;                                                                   /**< Device type (2 bytes), for example Heart Rate. This number must be defined by the customer before production. It can be located in UICR or FICR. */
-    uint16_t device_rev;                                                                    /**< Device revision (2 bytes), for example major revision 1, minor revision 0. This number must be defined by the customer before production. It can be located in UICR or FICR. */
-    uint32_t app_version;                                                                   /**< Application version for the image software. This field allows for additional checking, for example ensuring that a downgrade is not allowed. */
-    uint16_t softdevice_len;                                                                /**< Number of different SoftDevice revisions compatible with this application. The list of SoftDevice firmware IDs is defined in @ref softdevice. */
-    uint16_t softdevice[1];                                                                 /**< Variable length array of SoftDevices compatible with this application. The length of the array is specified in the length field. SoftDevice firmware id 0xFFFE indicates any SoftDevice. */
-} dfu_init_packet_t;
-
-/**@brief Structure holding basic device information settings.
- */
-typedef struct
-{
-    uint16_t device_type;                                                                   /**< Device type (2 bytes), for example Heart Rate. This number must be defined by the customer before production. It can be located in UICR or FICR. */
-    uint16_t device_rev;                                                                    /**< Device revision (2 bytes), for example major revision 1, minor revision 0. This number must be defined by the customer before production. It can be located in UICR or FICR. */
-} dfu_device_info_t;
-
-/** The device info offset can be modified to place the device info settings at a different location.
-  * If the customer reserved UICR location is used for other application specific data, the offset
-  * must be updated to avoid collision with that data.
-  */
-/** [DFU UICR DEV offset] */
-#define UICR_CUSTOMER_DEVICE_INFO_OFFSET    0x0                                             /**< Device info offset inside the customer UICR reserved area. Customers may change this value to place the device information in a user-preferred location. */
-/** [DFU UICR DEV offset] */
-
-#define UICR_CUSTOMER_RESERVED_OFFSET       0x80                                            /**< Customer reserved area in the UICR. The area from UICR + 0x80 is reserved for customer usage. */
-#define DFU_DEVICE_INFO_BASE                (NRF_UICR_BASE + \
-                                             UICR_CUSTOMER_RESERVED_OFFSET + \
-                                             UICR_CUSTOMER_DEVICE_INFO_OFFSET)              /**< The device information base address inside of UICR. */
-#define DFU_DEVICE_INFO                     ((dfu_device_info_t *)DFU_DEVICE_INFO_BASE)     /**< The memory mapped structure for device information data. */
-
-#define DFU_DEVICE_TYPE_EMPTY               ((uint16_t)0xFFFF)                              /**< Mask indicating no device type is present in UICR. 0xFFFF is default flash pattern when not written with data. */
-#define DFU_DEVICE_REVISION_EMPTY           ((uint16_t)0xFFFF)                              /**< Mask indicating no device revision is present in UICR. 0xFFFF is default flash pattern when not written with data. */
-#define DFU_SOFTDEVICE_ANY                  ((uint16_t)0xFFFE)                              /**< Mask indicating that any SoftDevice is allowed for updating this application. Allows for easy development. Not to be used in production images. */
-
-
-/**@brief DFU prevalidate call for pre-checking the received init packet.
- *
- * @details  Pre-validation will safety check the firmware image to be transfered in second stage.
- *           The function currently checks the device type, device revision, application firmware 
- *           version, and supported SoftDevices. More checks should be added according to 
- *           customer-specific requirements.
- * 
- * @param[in] p_init_data    Pointer to the init packet. If the init packet is encrypted or signed,
- *                           it must first be decrypted before being checked.
- * @param[in] init_data_len  Length of the init data.
- *
- * @retval NRF_SUCCESS              If the pre-validation succeeded, that means the image is 
- *                                  supported by the device and it is considered to come from a 
- *                                  trusted source (signing).
- * @retval NRF_ERROR_INVALID_DATA   If the pre-validation failed, that means the image is not 
- *                                  supported by the device or comes from an un-trusted source 
- *                                  (signing).
- * @retval NRF_ERROR_INVALID_LENGTH If the size of the init packet is not within the limits of 
- *                                  the init packet handler.
- */
-uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len);
-
-/**@brief DFU postvalidate call for post-checking the received image using the init packet.
- *
- * @details  Post-validation can verify the integrity check the firmware image received before 
- *           activating the image.
- *           Checks performed can be: 
- *           - A simple CRC as shown in the corresponding implementation of this API in the file
- *             dfu_init_template.c
- *           - A hash for better verification of the image.
- *           - A signature to ensure the image originates from a trusted source.
- *           Checks are intended to be expanded for customer-specific requirements.
- * 
- * @param[in] p_image    Pointer to the received image. The init data provided in the call 
- *                       \ref dfu_init_prevalidate will be used for validating the image.
- * @param[in] image_len  Length of the image data.
- *
- * @retval NRF_SUCCESS             If the post-validation succeeded, that meant the integrity of the
- *                                 image has been verified and the image originates from a trusted 
- *                                 source (signing).
- * @retval NRF_ERROR_INVALID_DATA  If the post-validation failed, that meant the post check of the 
- *                                 image failed such as the CRC is not matching the image transfered
- *                                 or the verification of the image fails (signing).
- */
-uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_INIT_H__
-
-/**@} */


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

Posted by cc...@apache.org.
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/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c
deleted file mode 100644
index 9422682..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_conn.c
+++ /dev/null
@@ -1,784 +0,0 @@
-/* Copyright (c) Nordic Semiconductor ASA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. This software must only be used in a processor manufactured by Nordic
- * Semiconductor ASA, or in a processor manufactured by STMicroelectronics that
- * is used in combination with a processor manufactured by Nordic Semiconductor
- * or in a processor manufactured by STMicroelectronics.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "nordic_common.h"
-#include "boards.h"
-#include "nrf.h"
-#include "nrf_soc.h"
-#include "nrf_error.h"
-#include "nrf_gpio.h"
-#include "nrf_delay.h"
-#include "app_util_platform.h"
-#include "app_gpiote.h"
-#include "ser_phy.h"
-#include "ser_phy_config_conn_nrf51.h"
-
-#define APP_GPIOTE_MAX_USERS  1
-#define UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */
-
-/** @brief States for the app_uart state machine. */
-typedef enum
-{
-    UART_IDLE,              /**< Indicating that the current status for either RX or TX is idle. When both RX and TX is idle the UART will be disabled in order to save power. */
-    UART_RX,                /**< Used to indicate that a packet is currently being received on RX. */
-    UART_RX_PENDING,        /**< Used to indicate that byte is ready at RXD register but no buffer was available when the byte was received. The byte will be pulled when a buffer is set. */
-    UART_TX_COMPLETE,       /**< Used on TX to indicate that final byte has been put on TXD register. Next TXDRDY interrupt will indicate that last byte has been transmitted. */
-    UART_TX_SEND,           /**< Used to indicate that a packet is currently being transmitted on TX. */
-    UART_TX_LAST_BYTE_WAIT, /**< Used to indicate that the last byte on a TX packet is currently waiting to be transmitted when CTS goes low. Note that flow control is off when tranmitting final byte. */
-    UART_STALL,             /**< Indicates that TX is stalled because final byte is being received on the UART. */
-} uart_states_t;
-
-static volatile uint32_t m_pin_cts_mask;           /**< CTS pin mask for UART module. */
-static          app_gpiote_user_id_t m_gpiote_uid; /**< GPIOTE module user id for the UART module. */
-
-static volatile uint8_t * mp_tx_stream;                          /**< Pointer to array of data packet to be transmitted. */
-static volatile uint16_t  m_tx_stream_length;                    /**< Total length of data packet to be transmitted. */
-static volatile uint16_t  m_tx_stream_index;                     /**< Index in data packet for next byte to be transmitted. */
-static          uint8_t   m_tx_length_buf[SER_PHY_HEADER_SIZE];  /**< Buffer needed in transmission of packet length */
-
-static          uint8_t * mp_rx_stream;                          /**< Pointer to current receive buffer. */
-static volatile uint16_t  m_rx_stream_length;                    /**< Length of receive buffer. */
-static volatile uint16_t  m_rx_stream_index;                     /**< Index in receive buffer where the next byte will be placed. */
-static volatile bool      m_rx_stream_header;                    /**< Indication of whether header data (true) or payload data (false) is currently being received. */
-static          uint8_t   m_rx_length_buf[SER_PHY_HEADER_SIZE];  /**< Buffer needed in reception of packet length */
-static          uint8_t   m_rx_drop_buf[1];                      /**< Additional buffer, needed by packet dropping functionality. */
-
-static volatile uart_states_t m_rx_state            = UART_IDLE; /**< State of the RX state machine. */
-static volatile uart_states_t m_tx_state            = UART_IDLE; /**< State of the TX state machine. */
-static volatile bool          m_tx_pending          = false;     /**< If TX state is UART_STALL and a byte is ready for tranmission the pending flag is set to true. */
-static volatile bool          m_cts_high_disconnect = false;     /**< If CTS was sampled low when last byte was transmitted this flag is set to true to indicate that a switch from low->high on CTS should be interpreted as transmission has completed and UART is to be disabled to save power. */
-
-static volatile ser_phy_events_handler_t m_ser_phy_event_handler;
-static volatile ser_phy_evt_t            m_ser_phy_event_rx;
-static volatile ser_phy_evt_t            m_ser_phy_event_tx;
-
-
-static void uart_peripheral_disconnect_flow(void)
-{
-    NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-    nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-
-    NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED;
-    NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED;
-    NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-}
-
-
-static void uart_peripheral_connect_flow(void)
-{
-    NRF_UART0->PSELCTS = SER_PHY_UART_CTS;
-    NRF_UART0->PSELRTS = SER_PHY_UART_RTS;
-    NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-}
-
-
-static void uart_peripheral_enable_wo_flow(void)
-{
-    if (!(NRF_UART0->ENABLE & (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos)))
-    {
-        NRF_UART0->PSELCTS       = UART_PIN_DISCONNECTED;
-        NRF_UART0->PSELRTS       = UART_PIN_DISCONNECTED;
-        NRF_UART0->CONFIG       &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-        NRF_UART0->TASKS_STARTRX = 1;
-        NRF_UART0->TASKS_STARTTX = 1;
-        NRF_UART0->ENABLE        = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos);
-    }
-}
-
-
-static void uart_peripheral_enable(void)
-{
-    if (!(NRF_UART0->ENABLE & (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos)))
-    {
-        NRF_UART0->PSELCTS       = SER_PHY_UART_CTS;
-        NRF_UART0->PSELRTS       = SER_PHY_UART_RTS;
-        NRF_UART0->CONFIG       |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-        NRF_UART0->TASKS_STARTRX = 1;
-        NRF_UART0->TASKS_STARTTX = 1;
-        NRF_UART0->ENABLE        = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos);
-    }
-}
-
-
-static void uart_peripheral_disable(void)
-{
-    if ((m_tx_state == UART_IDLE || m_tx_state == UART_STALL) &&
-        (m_rx_state == UART_IDLE))
-    {
-        uint32_t pins;
-        NRF_UART0->TASKS_STOPTX = 1;
-        NRF_UART0->TASKS_STOPRX = 1;
-        NRF_UART0->PSELCTS      = UART_PIN_DISCONNECTED;
-        NRF_UART0->PSELRTS      = UART_PIN_DISCONNECTED;
-        NRF_UART0->ENABLE       = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos);
-
-        nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL);
-
-        (void) app_gpiote_user_enable(m_gpiote_uid);
-        (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins);
-
-        if (!pins)
-        {
-            NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-            nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-            uart_peripheral_enable();
-        }
-    }
-}
-
-
-static void uart_tx_start(void)
-{
-    if (mp_tx_stream != NULL)
-    {
-        //If RX is already ongoing then no wakeup signal is required.
-        if (m_rx_state == UART_IDLE)
-        {
-            (void) app_gpiote_user_disable(m_gpiote_uid);
-            uart_peripheral_enable_wo_flow();
-            NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-            nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-            NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS;
-            nrf_delay_us(4);
-            NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-            uart_peripheral_connect_flow();
-        }
-    }
-}
-
-
-static void uart_tx_send(void)
-{
-    //First send 2 bytes of header then payload
-    if (m_tx_stream_index < SER_PHY_HEADER_SIZE)
-    {
-        NRF_UART0->TXD = m_tx_length_buf[m_tx_stream_index++];
-    }
-    else if (m_tx_stream_index < m_tx_stream_length)
-    {
-        NRF_UART0->TXD = mp_tx_stream[m_tx_stream_index++ - SER_PHY_HEADER_SIZE];
-    }
-}
-
-
-static void uart_tx_last_byte(void)
-{
-    uint32_t pins;
-
-    uart_peripheral_disconnect_flow();
-    m_tx_state = UART_TX_LAST_BYTE_WAIT;
-
-    (void) app_gpiote_user_enable(m_gpiote_uid);
-    (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins);
-
-    if (!pins) //All pins are low --> last byte can be transmitted.
-    {
-        (void) app_gpiote_user_disable(m_gpiote_uid);
-
-        //Re-check state as it might have changed due to preemption of current interrupt.
-        if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-        {
-            m_tx_state = UART_TX_COMPLETE;
-            uart_tx_send();
-        }
-    }
-}
-
-
-static void tx_complete_event_send(void)
-{
-    mp_tx_stream       = NULL;
-    m_tx_stream_length = 0;
-    m_tx_stream_index  = 0;
-
-    m_ser_phy_event_tx.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    m_ser_phy_event_handler(m_ser_phy_event_tx);
-}
-
-
-static void uart_txdrdy_handle(void)
-{
-    NRF_UART0->EVENTS_TXDRDY = 0;
-
-    if (m_tx_state == UART_TX_SEND || m_tx_state == UART_IDLE)
-    {
-        if (m_tx_stream_index < (m_tx_stream_length - 1))
-        {
-            m_tx_state = UART_TX_SEND;
-            uart_tx_send();
-            //Keep same state.
-        }
-        else if (m_tx_stream_index == m_tx_stream_length)
-        {
-            m_tx_state = UART_IDLE;
-            tx_complete_event_send();
-        }
-        else
-        {
-            uart_tx_last_byte();
-        }
-    }
-    else if (m_tx_state == UART_TX_COMPLETE)
-    {
-        m_tx_state = UART_IDLE;
-
-        if (m_rx_state == UART_IDLE)
-        {
-            uint32_t pins;
-            (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins);
-
-            if (pins)
-            {
-                uart_peripheral_disable();
-            }
-            else
-            {
-                uart_peripheral_connect_flow();
-                m_cts_high_disconnect = true;
-                (void) app_gpiote_user_enable(m_gpiote_uid);
-                (void) app_gpiote_pins_state_get(m_gpiote_uid, &pins);
-
-                if (pins)
-                {
-                    //If second sample show CTS high it either
-                    //1) happened BEFORE gpiote enable and uart should be disabled.
-                    //(m_cts_high_disconnect == true).
-                    //2) happened AFTER gpiote enable and an interrupt low->high has occured then
-                    //uart should NOT be disabled as the ISR has disabled the UART.
-                    //(m_cts_high_disconnect == false).
-                    if (m_cts_high_disconnect == true)
-                    {
-                        m_cts_high_disconnect = false;
-                        uart_peripheral_disable();
-                    }
-                }
-            }
-        }
-        else
-        {
-            uart_peripheral_connect_flow();
-        }
-
-        tx_complete_event_send();
-    }
-    else if (m_tx_state == UART_STALL)
-    {
-        if (m_tx_stream_index == m_tx_stream_length)
-        {
-            tx_complete_event_send();
-        }
-        else
-        {
-            m_tx_pending = true;
-        }
-    }
-    else
-    {
-        //Do nothing.
-    }
-}
-
-
-static __INLINE void on_cts_high(void)
-{
-    if (m_cts_high_disconnect == true)
-    {
-        m_cts_high_disconnect = false;
-
-        if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE)
-        {
-            if (m_tx_stream_index == m_tx_stream_length)
-            {
-                uart_peripheral_disable();
-            }
-        }
-    }
-}
-
-
-static __INLINE void on_cts_low(void)
-{
-    m_cts_high_disconnect = false;
-    (void) app_gpiote_user_disable(m_gpiote_uid);
-
-    if (m_tx_state == UART_STALL)
-    {
-        m_tx_pending = true;
-    }
-    else if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-    {
-        m_tx_state = UART_TX_COMPLETE;
-        uart_tx_send();
-    }
-    else if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE)
-    {
-        NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-        nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-        uart_peripheral_enable();
-    }
-}
-
-
-static void uart_rxdrdy_handle(void)
-{
-    if (m_rx_state == UART_IDLE)
-    {
-        m_rx_state = UART_RX;
-    }
-
-    //Set proper size and buff at the beginning of receiving header
-    if ((m_rx_stream_header == true) && !m_rx_stream_index)
-    {
-        m_rx_stream_length = SER_PHY_HEADER_SIZE;
-        mp_rx_stream       = m_rx_length_buf;
-    }
-
-    if (mp_rx_stream != NULL)
-    {
-        bool tx_dual_end = false;
-
-        NRF_UART0->EVENTS_RXDRDY = 0;
-
-        //Second last byte received.
-        //Disconnect CTS before pulling the byte and receiving the final byte.
-        if ((m_rx_stream_header == false) && ((m_rx_stream_index) == (m_rx_stream_length - 2)))
-        {
-            nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-
-            //Last byte is waiting for tansmission. Thus dual end TX case.
-            //
-            if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-            {
-                m_tx_state = UART_STALL;
-                (void) app_gpiote_user_disable(m_gpiote_uid);
-
-                //Checking pending state.
-                //- If pending is true then CTS have become low after we stalled the UART and final byte should be transmitted here.
-                //- If pending is false we should check if final byte was tranmitted and if not, the do the transmission her.
-                if ((m_tx_pending == true) || (m_tx_stream_index == (m_tx_stream_length - 1)))
-                {
-                    tx_dual_end      = true;
-                    NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-                    uart_tx_send();
-                }
-            }
-
-            if (!tx_dual_end)
-            {
-                NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS;
-            }
-            m_tx_state = UART_STALL;
-
-            NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED;
-            NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED;
-            NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-        }
-
-        if (m_rx_stream_index < (m_rx_stream_length - 1))
-        {
-            if (mp_rx_stream != m_rx_drop_buf)
-            {
-                mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD;
-            }
-            else
-            {
-                mp_rx_stream[0] = NRF_UART0->RXD;
-                m_rx_stream_index++;
-            }
-
-            if (m_tx_stream_index == (m_tx_stream_length - 1))
-            {
-                //Toggle CTS line to indicate ack.
-                //If CTS is connected to UART this code will have no effect.
-                //But on edge case on bi-directional last byte transfer this avoids lock-up.
-                NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-                nrf_delay_us(4);
-                NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS;
-            }
-        }
-        else
-        {
-            if (m_rx_stream_header == false)
-            {
-                NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-
-                if (mp_rx_stream != m_rx_drop_buf)
-                {
-                    mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD;
-                }
-                else
-                {
-                    mp_rx_stream[0] = NRF_UART0->RXD;
-                    m_rx_stream_index++;
-                }
-                m_rx_state = UART_IDLE;
-
-                //Last byte of payload received - notify that next transmission will be header
-                m_rx_stream_header = true;
-
-                //Prepare event
-                if (mp_rx_stream != m_rx_drop_buf)
-                {
-                    m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-                    m_ser_phy_event_rx.evt_params.rx_pkt_received.num_of_bytes = m_rx_stream_index;
-                    m_ser_phy_event_rx.evt_params.rx_pkt_received.p_buffer     = mp_rx_stream;
-                }
-                else
-                {
-                    m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-                }
-
-                m_rx_stream_length = 0;
-                m_rx_stream_index  = 0;
-            }
-            else
-            {
-                mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD;
-
-                //Last byte of header received - notify that next transmission will be payload
-                m_rx_stream_header = false;
-
-                mp_rx_stream = NULL;
-
-                //Clear index before receiving payload
-                m_rx_stream_index = 0;
-
-                //Prepare event
-                m_rx_stream_length = uint16_decode(m_rx_length_buf);
-                m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_BUF_REQUEST;
-                m_ser_phy_event_rx.evt_params.rx_buf_request.num_of_bytes = m_rx_stream_length;
-            }
-
-            //Notify upwards
-            m_ser_phy_event_handler(m_ser_phy_event_rx);
-
-            //UART TX was stalled while receiving final byte. Restart tx.
-            if (m_tx_state == UART_STALL)
-            {
-                if (m_tx_stream_length == m_tx_stream_index)
-                {
-                    m_tx_state = UART_IDLE;
-                }
-                else if (m_tx_stream_index == (m_tx_stream_length - 1))
-                {
-                    m_tx_state = UART_TX_LAST_BYTE_WAIT;
-                }
-                else
-                {
-                    m_tx_state = UART_TX_SEND;
-                }
-
-                //Critical region for avoiding timing issues in 'simultaneous RX end and TX start'
-                CRITICAL_REGION_ENTER();
-                if (m_tx_pending == true)
-                {
-                    m_tx_pending = false;
-                    uart_tx_start();
-
-                    if (m_tx_state == UART_TX_SEND)
-                    {
-                        uart_tx_send();
-                    }
-                    else if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-                    {
-                        uart_tx_last_byte();
-                    }
-                }
-                CRITICAL_REGION_EXIT();
-
-                if (m_tx_state == UART_IDLE)
-                {
-                    uart_peripheral_disable();
-                }
-            }
-        }
-    }
-    else
-    {
-        m_rx_state = UART_RX_PENDING;
-    }
-}
-
-
-static __INLINE void uart_error_handle(void)
-{
-    uint32_t error_source;
-
-    //Clear UART ERROR event flag.
-    NRF_UART0->EVENTS_ERROR = 0;
-
-    //Clear error source.
-    error_source        = NRF_UART0->ERRORSRC;
-    NRF_UART0->ERRORSRC = error_source;
-
-    m_ser_phy_event_rx.evt_type                       = SER_PHY_EVT_HW_ERROR;
-    m_ser_phy_event_rx.evt_params.hw_error.error_code = error_source;
-
-    m_ser_phy_event_handler(m_ser_phy_event_rx);
-}
-
-
-/**@brief Function for handling the GPIOTE event.
- *
- * @param[in] event_pins_low_to_high   Mask telling which pin(s) generated an event from low->high.
- * @param[in] event_pins_high_to_low   Mask telling which pin(s) generated an event from high->low.
- */
-static void gpiote_uart_event_handler(uint32_t event_pins_low_to_high,
-                                      uint32_t event_pins_high_to_low)
-{
-    if ((event_pins_high_to_low & m_pin_cts_mask) != 0)
-    {
-        on_cts_low();
-    }
-
-    if ((event_pins_low_to_high & m_pin_cts_mask) != 0)
-    {
-        on_cts_high();
-    }
-}
-
-
-/**@brief Function for handling the UART Interrupt.
- *
- * @details UART interrupt handler to process TX Ready when TXD is available, RX Ready when a byte
- *          is received, or in case of error when receiving a byte.
- */
-void UART0_IRQHandler(void)
-{
-    //Handle Reception.
-    if (NRF_UART0->EVENTS_RXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_RXDRDY_Msk))
-    {
-        uart_rxdrdy_handle();
-    }
-
-    //Handle transmission.
-    if (NRF_UART0->EVENTS_TXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_TXDRDY_Msk))
-    {
-        uart_txdrdy_handle();
-    }
-
-    //Handle errors.
-    if (NRF_UART0->EVENTS_ERROR != 0 && (NRF_UART0->INTENSET & UART_INTENSET_ERROR_Msk))
-    {
-        uart_error_handle();
-    }
-}
-
-
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    uint32_t gpiote_pin_low_high_mask = 0;
-    uint32_t gpiote_pin_high_low_mask = 0;
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    //Check if function was not called before
-    if (m_ser_phy_event_handler != NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    //Configure GPIOTE with one user for the UART flow control feature.
-    APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);
-
-    //GPIO Setup
-    nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL);
-
-    NRF_GPIO->OUTSET = 1 << SER_PHY_UART_TX;
-    nrf_gpio_cfg_output(SER_PHY_UART_TX);
-
-    //Setup the gpiote to handle pin events on cts-pin.
-    //For the UART we want to detect both low->high and high->low transitions in order to
-    //know when to activate/de-activate the TX/RX in the UART.
-    //Configure pin.
-    m_pin_cts_mask = (1 << SER_PHY_UART_CTS);
-    nrf_gpio_cfg_sense_input(SER_PHY_UART_CTS,
-                             NRF_GPIO_PIN_PULLUP,
-                             NRF_GPIO_PIN_SENSE_LOW);
-
-    nrf_gpio_cfg_sense_input(SER_PHY_UART_RX,
-                             NRF_GPIO_PIN_PULLUP,
-                             NRF_GPIO_PIN_NOSENSE);
-
-    gpiote_pin_low_high_mask = (1 << SER_PHY_UART_CTS);
-    gpiote_pin_high_low_mask = (1 << SER_PHY_UART_CTS);
-
-    (void)app_gpiote_user_register(&m_gpiote_uid,
-                                   gpiote_pin_low_high_mask,
-                                   gpiote_pin_high_low_mask,
-                                   gpiote_uart_event_handler);
-
-    (void)app_gpiote_user_enable(m_gpiote_uid);
-
-    m_rx_state = UART_IDLE;
-    m_tx_state = UART_IDLE;
-
-    //Set header flag
-    m_rx_stream_header = true;
-
-    //UART setup
-    NRF_UART0->PSELRXD  = SER_PHY_UART_RX;
-    NRF_UART0->PSELTXD  = SER_PHY_UART_TX;
-    NRF_UART0->PSELCTS  = UART_PIN_DISCONNECTED;
-    NRF_UART0->PSELRTS  = UART_PIN_DISCONNECTED;
-    NRF_UART0->BAUDRATE = SER_PHY_UART_BAUDRATE;
-    NRF_UART0->CONFIG   = (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-    NRF_UART0->ENABLE   = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos);
-
-    //Enable UART interrupt
-    NRF_UART0->INTENCLR = 0xFFFFFFFF;
-    NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos) |
-                          (UART_INTENSET_RXDRDY_Set << UART_INTENSET_RXDRDY_Pos) |
-                          (UART_INTENSET_ERROR_Set << UART_INTENSET_ERROR_Pos);
-
-    NVIC_ClearPendingIRQ(UART0_IRQn);
-    NVIC_SetPriority(UART0_IRQn, APP_IRQ_PRIORITY_LOW);
-    NVIC_EnableIRQ(UART0_IRQn);
-
-    m_ser_phy_event_handler = events_handler;
-
-    return NRF_SUCCESS;
-}
-
-
-void ser_phy_close(void)
-{
-    //Disable UART interrupt.
-    NRF_UART0->INTENCLR = 0xFFFFFFFF;
-
-    //Unregister callback.
-    m_ser_phy_event_handler = NULL;
-
-    //Will not check err_code here as we will still continue with closure of UART despite errors.
-    //Note that any error will still be reported back in the system.
-    (void)app_gpiote_user_disable(m_gpiote_uid);
-
-    uart_peripheral_disable();
-
-    //Clear internal UART states
-    m_rx_state = UART_IDLE;
-    m_tx_state = UART_IDLE;
-
-    mp_tx_stream       = NULL;
-    m_tx_stream_length = 0;
-    m_tx_stream_index  = 0;
-
-    mp_rx_stream       = NULL;
-    m_rx_stream_length = 0;
-    m_rx_stream_index  = 0;
-}
-
-
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    if (num_of_bytes == 0)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (mp_tx_stream != NULL)
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    m_tx_pending = true;
-
-    (void) uint16_encode(num_of_bytes, m_tx_length_buf);
-    mp_tx_stream       = (uint8_t *)p_buffer;
-    m_tx_stream_length = num_of_bytes + SER_PHY_HEADER_SIZE;
-
-    //Critical region for avoiding timing issues in 'simultaneous RX end and TX start'
-    CRITICAL_REGION_ENTER();
-    if ((!m_rx_stream_length) || (m_rx_stream_index < (m_rx_stream_length - 2)))
-    {
-        if (m_tx_state != UART_STALL)
-        {
-            if (m_tx_pending == true)
-            {
-                m_tx_pending = false;
-                uart_tx_start();
-                //As no tx can be ongoing, then it is safe to call tx_send here.
-                uart_tx_send();
-            }
-        }
-    }
-    CRITICAL_REGION_EXIT();
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    if (m_ser_phy_event_rx.evt_type != SER_PHY_EVT_RX_BUF_REQUEST)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_buffer != NULL)
-    {
-        mp_rx_stream = p_buffer;
-    }
-    else
-    {
-        mp_rx_stream = m_rx_drop_buf;
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-void ser_phy_interrupts_enable(void)
-{
-    NVIC_EnableIRQ(UART0_IRQn);
-}
-
-
-void ser_phy_interrupts_disable(void)
-{
-    NVIC_DisableIRQ(UART0_IRQn);
-}

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/serialization/common/transport/ser_phy/spi_5W_master.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/spi_5W_master.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/spi_5W_master.c
deleted file mode 100644
index f8276ab..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/spi_5W_master.c
+++ /dev/null
@@ -1,603 +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 ser_phy_spi_5W_hw_driver_master spi_5W_master.c
- * @{
- * @ingroup ser_phy_spi_5W_hw_driver_master
- *
- * @brief SPI_5W_RAW hardware driver.
- */
-
-#include "app_error.h"
-#include "app_util_platform.h"
-#include "nrf_gpio.h"
-#include "nrf.h"
-#include "spi_5W_master.h"
-#include "ser_config_5W_app.h"
-#include "ser_phy_debug_app.h"
-
-
-#define _static
-
-#define DOUBLE_BUFFERED /**< A flag for enabling double buffering. */
-
-#define SPI_PIN_DISCONNECTED 0xFFFFFFFF /**< A value used to the PIN deinitialization. */
-#define SPI_DEFAULT_TX_BYTE  0x00       /**< Default byte (used to clock transmission
-                                             from slave to the master) */
-
-typedef struct
-{
-    NRF_SPI_Type * p_nrf_spi; /**< A pointer to the NRF SPI master */
-    IRQn_Type      irq_type;  /**< A type of NVIC IRQn */
-
-    uint8_t * p_tx_buffer; /**< A pointer to TX buffer. */
-    uint16_t  tx_length;   /**< A length of TX buffer. */
-    uint16_t  tx_index;    /**< A index of the current element in the TX buffer. */
-
-    uint8_t * p_rx_buffer; /**< A pointer to RX buffer. */
-    uint16_t  rx_length;   /**< A length RX buffer. */
-    uint16_t  rx_index;    /**< A index of the current element in the RX buffer. */
-
-    uint16_t max_length; /**< Max length (Max of the TX and RX length). */
-    uint16_t bytes_count;
-    uint8_t  pin_slave_select; /**< A pin for Slave Select. */
-
-    spi_master_event_handler_t callback_event_handler; /**< A handler for event callback function. */
-    spi_master_state_t         state;                  /**< A state of an instance of SPI master. */
-    bool                       start_flag;
-    bool                       abort_flag;
-
-} spi_master_instance_t;
-
-#ifdef _SPI_5W_
-typedef enum
-{
-    HOOK_STATE_DISABLED,
-    HOOK_STATE_IDLE,
-    HOOK_STATE_GUARDED,
-    HOOK_STATE_ABORTED,
-    HOOK_STATE_RESTARTED,
-    HOOK_STATE_PASSING
-} spi_hook_state_t;
-
-
-_static spi_master_event_handler_t m_ser_phy_event_handler;
-_static spi_master_hw_instance_t   m_spi_master_hw_instance;
-_static spi_hook_state_t           m_hook_state = HOOK_STATE_DISABLED;
-#endif
-
-#ifdef SER_PHY_DEBUG_APP_ENABLE
-_static spi_master_raw_callback_t m_debug_callback;
-#endif
-
-_static spi_master_instance_t m_spi_master_instances[SPI_MASTER_HW_ENABLED_COUNT];
-
-static __INLINE spi_master_instance_t * spi_master_get_instance(
-    const spi_master_hw_instance_t spi_master_hw_instance);
-static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance);
-static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance,
-                                           spi_master_evt_type_t         event_type,
-                                           const uint16_t                data);
-
-#ifdef SPI_MASTER_0_ENABLE
-/**
- * @brief SPI0 interrupt handler.
- */
-void SPI0_TWI0_IRQHandler(void)
-{
-    if (NRF_SPI0->EVENTS_READY != 0)
-    {
-        NRF_SPI0->EVENTS_READY = 0;
-
-        spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_0);
-
-        spi_master_send_recv_irq(p_spi_instance);
-    }
-}
-#endif //SPI_MASTER_0_ENABLE
-
-#ifdef SPI_MASTER_1_ENABLE
-/**
- * @brief SPI0 interrupt handler.
- */
-void SPI1_TWI1_IRQHandler(void)
-{
-    if (NRF_SPI1->EVENTS_READY != 0)
-    {
-        NRF_SPI1->EVENTS_READY = 0;
-
-        spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_1);
-
-        spi_master_send_recv_irq(p_spi_instance);
-    }
-}
-#endif //SPI_MASTER_1_ENABLE
-
-#if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-
-/**@brief Function for getting an instance of SPI master. */
-static __INLINE spi_master_instance_t * spi_master_get_instance(
-    const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    return &(m_spi_master_instances[(uint8_t)spi_master_hw_instance]);
-}
-
-/** @brief Function for initializing instance of SPI master by default values. */
-static __INLINE void spi_master_init_hw_instance(NRF_SPI_Type *          p_nrf_spi,
-                                                 IRQn_Type               irq_type,
-                                                 spi_master_instance_t * p_spi_instance)
-{
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-
-    p_spi_instance->p_nrf_spi = p_nrf_spi;
-    p_spi_instance->irq_type  = irq_type;
-
-    p_spi_instance->p_tx_buffer = NULL;
-    p_spi_instance->tx_length   = 0;
-    p_spi_instance->tx_index    = 0;
-
-    p_spi_instance->p_rx_buffer = NULL;
-    p_spi_instance->rx_length   = 0;
-    p_spi_instance->rx_index    = 0;
-
-    p_spi_instance->bytes_count      = 0;
-    p_spi_instance->max_length       = 0;
-    p_spi_instance->pin_slave_select = 0;
-
-    p_spi_instance->callback_event_handler = NULL;
-
-    p_spi_instance->state      = SPI_MASTER_STATE_DISABLED;
-    p_spi_instance->abort_flag = false;
-    p_spi_instance->start_flag = false;
-}
-
-/**@brief Function for initializing TX or RX buffer. */
-static __INLINE void spi_master_buffer_init(uint8_t * const  p_buf,
-                                            const uint16_t   buf_len,
-                                            uint8_t * *      pp_buf,
-                                            uint16_t * const p_buf_len,
-                                            uint16_t * const p_index)
-{
-    APP_ERROR_CHECK_BOOL(pp_buf != NULL);
-    APP_ERROR_CHECK_BOOL(p_buf_len != NULL);
-    APP_ERROR_CHECK_BOOL(p_index != NULL);
-
-    *pp_buf    = p_buf;
-    *p_buf_len = (p_buf != NULL) ? buf_len : 0;
-    *p_index   = 0;
-}
-
-/**@brief Function for releasing TX or RX buffer. */
-static __INLINE void spi_master_buffer_release(uint8_t * * const pp_buf, uint16_t * const p_buf_len)
-{
-    APP_ERROR_CHECK_BOOL(pp_buf != NULL);
-    APP_ERROR_CHECK_BOOL(p_buf_len != NULL);
-
-    *pp_buf    = NULL;
-    *p_buf_len = 0;
-}
-
-/**@brief Function for sending events by callback. */
-static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance,
-                                           spi_master_evt_type_t         event_type,
-                                           const uint16_t                data)
-{
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-
-    if (p_spi_instance->callback_event_handler != NULL)
-    {
-        spi_master_evt_t event = {SPI_MASTER_EVT_TYPE_MAX, 0};
-        event.type = event_type;
-        event.data = data;
-        p_spi_instance->callback_event_handler(event);
-    }
-}
-
-/**@brief Function insert to a TX buffer another byte or two bytes (depends on flag @ref DOUBLE_BUFFERED). */
-static __INLINE void spi_master_send_initial_bytes(spi_master_instance_t * const p_spi_instance)
-{
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-
-    p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) &&
-                                      (p_spi_instance->tx_index < p_spi_instance->tx_length)) ?
-                                     p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] :
-                                     SPI_DEFAULT_TX_BYTE;
-    (p_spi_instance->tx_index)++;
-
-    #ifdef DOUBLE_BUFFERED
-
-    if (p_spi_instance->tx_index < p_spi_instance->max_length)
-    {
-        p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) &&
-                                          (p_spi_instance->tx_index < p_spi_instance->tx_length)) ?
-                                         p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] :
-                                         SPI_DEFAULT_TX_BYTE;
-        (p_spi_instance->tx_index)++;
-    }
-    #endif
-}
-
-/**@brief Function for receiving and sending data from IRQ. (The same for both IRQs). */
-static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance)
-{
-
-    uint8_t rx_byte;
-
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-    APP_ERROR_CHECK_BOOL(p_spi_instance->state == SPI_MASTER_STATE_BUSY);
-
-    p_spi_instance->bytes_count++;
-    rx_byte = p_spi_instance->p_nrf_spi->RXD;
-
-    if (p_spi_instance->start_flag)
-    {
-        p_spi_instance->start_flag = false;
-        spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_FIRST_BYTE_RECEIVED, (uint16_t)rx_byte);
-    }
-    else if (p_spi_instance->abort_flag  ) //this is tricky, but callback for SPI_MASTER_EVT_FIRST_BYTE_RECEIVED will set this flag for a first byte, which is bad because there is still byte in a buffer
-    {                                      //and for a single byte transaction you will get XFERDONE event to restart
-        p_spi_instance->abort_flag = false;
-        p_spi_instance->state      = SPI_MASTER_STATE_ABORTED;
-        nrf_gpio_pin_set(p_spi_instance->pin_slave_select);
-        spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_ABORTED, 0);
-        return;
-    }
-
-    if ((p_spi_instance->p_rx_buffer != NULL) &&
-        (p_spi_instance->rx_index < p_spi_instance->rx_length))
-    {
-        p_spi_instance->p_rx_buffer[p_spi_instance->rx_index++] = rx_byte;
-    }
-
-    if ((p_spi_instance->tx_index < p_spi_instance->max_length) && (!(p_spi_instance->abort_flag))) //do not TX if you know that there is an abort to be done - this should work for a DOUBLE BUFFERING ???
-    {
-        p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) &&
-                                          (p_spi_instance->tx_index < p_spi_instance->tx_length)) ?
-                                         p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] :
-                                         SPI_DEFAULT_TX_BYTE;
-        (p_spi_instance->tx_index)++;
-    }
-
-    if (p_spi_instance->bytes_count >= p_spi_instance->max_length)
-    {
-        APP_ERROR_CHECK_BOOL(p_spi_instance->bytes_count == p_spi_instance->max_length);
-        nrf_gpio_pin_set(p_spi_instance->pin_slave_select);
-        p_spi_instance->state = SPI_MASTER_STATE_IDLE;
-        spi_master_signal_evt(p_spi_instance,
-                              SPI_MASTER_EVT_TRANSFER_COMPLETED,
-                              p_spi_instance->tx_index);
-    }
-    return;
-}
-#endif //defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-
-
-/**
- * @brief Function for opening and initializing a SPI master driver. */
-uint32_t spi_master_open(const spi_master_hw_instance_t    spi_master_hw_instance,
-                         spi_master_config_t const * const p_spi_master_config)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-
-
-    if (p_spi_master_config == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    switch (spi_master_hw_instance)
-    {
-    #ifdef SPI_MASTER_0_ENABLE
-        case SPI_MASTER_0:
-            spi_master_init_hw_instance(NRF_SPI0, SPI0_TWI0_IRQn, p_spi_instance);
-            break;
-    #endif //SPI_MASTER_0_ENABLE
-
-    #ifdef SPI_MASTER_1_ENABLE
-        case SPI_MASTER_1:
-            spi_master_init_hw_instance(NRF_SPI1, SPI1_TWI1_IRQn, p_spi_instance);
-            break;
-    #endif //SPI_MASTER_1_ENABLE
-
-        default:
-            break;
-    }
-
-    //A Slave select must be set as high before setting it as output,
-    //because during connect it to the pin it causes glitches.
-    nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS);
-    nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SS);
-    nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS);
-
-    //Configure GPIO
-    nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SCK);
-    nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_MOSI);
-    nrf_gpio_cfg_input(p_spi_master_config->SPI_Pin_MISO, NRF_GPIO_PIN_NOPULL);
-    p_spi_instance->pin_slave_select = p_spi_master_config->SPI_Pin_SS;
-
-    /* Configure SPI hardware */
-    p_spi_instance->p_nrf_spi->PSELSCK  = p_spi_master_config->SPI_Pin_SCK;
-    p_spi_instance->p_nrf_spi->PSELMOSI = p_spi_master_config->SPI_Pin_MOSI;
-    p_spi_instance->p_nrf_spi->PSELMISO = p_spi_master_config->SPI_Pin_MISO;
-
-    p_spi_instance->p_nrf_spi->FREQUENCY = p_spi_master_config->SPI_Freq;
-
-    p_spi_instance->p_nrf_spi->CONFIG =
-        (uint32_t)(p_spi_master_config->SPI_CPHA << SPI_CONFIG_CPHA_Pos) |
-        (p_spi_master_config->SPI_CPOL << SPI_CONFIG_CPOL_Pos) |
-        (p_spi_master_config->SPI_ORDER << SPI_CONFIG_ORDER_Pos);
-
-
-    /* Clear waiting interrupts and events */
-    p_spi_instance->p_nrf_spi->EVENTS_READY = 0;
-
-    NVIC_ClearPendingIRQ(p_spi_instance->irq_type);
-    NVIC_SetPriority(p_spi_instance->irq_type, APP_IRQ_PRIORITY_MID);
-
-    /* Clear event handler */
-    p_spi_instance->callback_event_handler = NULL;
-
-    /* Enable interrupt */
-    p_spi_instance->p_nrf_spi->INTENSET = (SPI_INTENSET_READY_Set << SPI_INTENCLR_READY_Pos);
-    NVIC_EnableIRQ(p_spi_instance->irq_type);
-
-    /* Enable SPI hardware */
-    p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos);
-
-    /* Change state to IDLE */
-    p_spi_instance->state = SPI_MASTER_STATE_IDLE;
-
-    return NRF_SUCCESS;
-    #else
-    return NRF_ERROR_NOT_SUPPORTED;
-    #endif
-}
-
-/**
- * @brief Function for closing a SPI master driver.
- */
-void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    /* Disable interrupt */
-    NVIC_ClearPendingIRQ(p_spi_instance->irq_type);
-    NVIC_DisableIRQ(p_spi_instance->irq_type);
-
-    p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos);
-
-    /* Disconnect pin slave select */
-    nrf_gpio_pin_clear(p_spi_instance->pin_slave_select);
-    p_spi_instance->pin_slave_select = (uint8_t)0xFF;
-
-    /* Disconnect pins from SPI hardware */
-    p_spi_instance->p_nrf_spi->PSELSCK  = (uint32_t)SPI_PIN_DISCONNECTED;
-    p_spi_instance->p_nrf_spi->PSELMOSI = (uint32_t)SPI_PIN_DISCONNECTED;
-    p_spi_instance->p_nrf_spi->PSELMISO = (uint32_t)SPI_PIN_DISCONNECTED;
-
-    /* Reset to default values */
-    spi_master_init_hw_instance(NULL, (IRQn_Type)0, p_spi_instance);
-    #else
-    return;
-    #endif
-}
-
-/**
- * @brief Function for getting current state of the SPI master driver.
- */
-__INLINE spi_master_state_t spi_master_get_state(
-    const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance);
-    return spi_instance->state;
-    #else
-    return SPI_MASTER_STATE_DISABLED;
-    #endif
-}
-
-/**
- * @brief Function for event handler registration.
- */
-__INLINE void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                         spi_master_event_handler_t     event_handler)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance);
-    spi_instance->callback_event_handler = event_handler;
-    #else
-    return;
-    #endif
-}
-
-/**
- * @brief Function for transmitting data between SPI master and SPI slave.
- */
-uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance,
-                              uint8_t * const p_tx_buf, const uint16_t tx_buf_len,
-                              uint8_t * const p_rx_buf, const uint16_t rx_buf_len)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    uint32_t err_code   = NRF_SUCCESS;
-    uint16_t max_length = 0;
-
-    if (p_spi_instance->state == SPI_MASTER_STATE_IDLE)
-    {
-        NVIC_DisableIRQ(p_spi_instance->irq_type);
-
-        max_length = (rx_buf_len > tx_buf_len) ? rx_buf_len : tx_buf_len;
-
-        if (max_length > 0)
-        {
-            p_spi_instance->state       = SPI_MASTER_STATE_BUSY;
-            p_spi_instance->start_flag  = true; //abort_flag should set by abort and cleared only by restart
-            p_spi_instance->bytes_count = 0;
-            p_spi_instance->max_length  = max_length;
-            spi_master_buffer_release(&(p_spi_instance->p_tx_buffer), &(p_spi_instance->tx_length));
-            spi_master_buffer_release(&(p_spi_instance->p_rx_buffer), &(p_spi_instance->rx_length));
-            /* Initialize buffers */
-            spi_master_buffer_init(p_tx_buf, tx_buf_len, &(p_spi_instance->p_tx_buffer),
-                                   &(p_spi_instance->tx_length), &(p_spi_instance->tx_index));
-            spi_master_buffer_init(p_rx_buf, rx_buf_len, &(p_spi_instance->p_rx_buffer),
-                                   &(p_spi_instance->rx_length), &(p_spi_instance->rx_index));
-            nrf_gpio_pin_clear(p_spi_instance->pin_slave_select);
-            spi_master_send_initial_bytes(p_spi_instance);
-            spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_STARTED, max_length);
-        }
-        else
-        {
-            err_code = NRF_ERROR_INVALID_PARAM;
-        }
-
-        NVIC_EnableIRQ(p_spi_instance->irq_type);
-    }
-    else
-    {
-        err_code = NRF_ERROR_BUSY;
-    }
-
-    return err_code;
-    #else
-    return NRF_ERROR_NOT_SUPPORTED;
-    #endif
-}
-
-#ifdef _SPI_5W_
-
-/**
- * @brief Function for aborting transfer
- */
-uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    NVIC_DisableIRQ(p_spi_instance->irq_type);
-
-    if (p_spi_instance->state == SPI_MASTER_STATE_BUSY)
-    {
-        //set_flag - but only when there are events pending
-        //ignore when in IDLE - must be able to restart a completed transfer
-        p_spi_instance->abort_flag = true;
-    }
-    NVIC_EnableIRQ(p_spi_instance->irq_type);
-    return NRF_SUCCESS;
-}
-
-/**
- * @brief Function for restarting transfer
- */
-uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    NVIC_DisableIRQ(p_spi_instance->irq_type);
-    spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_RESTARTED, 0);
-    p_spi_instance->state       = SPI_MASTER_STATE_BUSY;
-    p_spi_instance->bytes_count = 0;
-    p_spi_instance->tx_index    = 0;
-    p_spi_instance->rx_index    = 0;
-    p_spi_instance->start_flag  = true;
-    p_spi_instance->abort_flag  = false; //you should force clearing abort flag - no other way for 1 byte transfer
-    nrf_gpio_pin_clear(p_spi_instance->pin_slave_select);
-    spi_master_send_initial_bytes(p_spi_instance);
-    NVIC_EnableIRQ(p_spi_instance->irq_type);
-
-    return NRF_SUCCESS;
-}
-
-static void spi_5W_master_event_handler(spi_master_evt_t evt)
-{
-
-    switch (m_hook_state)
-    {
-        case HOOK_STATE_IDLE:
-
-            if (evt.type == SPI_MASTER_EVT_TRANSFER_STARTED)
-            {
-                DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0);
-                m_hook_state = HOOK_STATE_GUARDED;
-                m_ser_phy_event_handler(evt);
-            }
-            break;
-
-        case HOOK_STATE_GUARDED:
-
-            if (evt.type == SPI_MASTER_EVT_FIRST_BYTE_RECEIVED)
-            {
-                if (evt.data == 0)
-                {
-                    DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(0);
-                    m_hook_state = HOOK_STATE_PASSING;
-                }
-                else
-                {
-                    DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(0);
-                    m_hook_state = HOOK_STATE_ABORTED;
-                    (void)spi_master_abort(m_spi_master_hw_instance);
-                }
-            }
-            break;
-
-        case HOOK_STATE_ABORTED:
-
-            if ((evt.type == SPI_MASTER_EVT_TRANSFER_ABORTED) ||
-                (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED))
-            {
-                DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(0);
-                m_hook_state = HOOK_STATE_RESTARTED;
-                (void)spi_master_restart(m_spi_master_hw_instance);
-            }
-            break;
-
-        case HOOK_STATE_RESTARTED:
-
-            if (evt.type == SPI_MASTER_EVT_TRANSFER_RESTARTED)
-            {
-                DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0);
-                m_hook_state = HOOK_STATE_GUARDED;
-            }
-            break;
-
-        case HOOK_STATE_PASSING:
-
-            if (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED)
-            {
-                m_hook_state = HOOK_STATE_IDLE;
-                m_ser_phy_event_handler(evt); //this is the only way to get a signal from complete transaction
-            }
-            break;
-
-        default:
-            break;
-    }
-}
-
-void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                   spi_master_event_handler_t     event_handler)
-{
-    m_ser_phy_event_handler  = event_handler;
-    m_spi_master_hw_instance = spi_master_hw_instance;
-    m_hook_state             = HOOK_STATE_IDLE;
-    spi_master_evt_handler_reg(spi_master_hw_instance, spi_5W_master_event_handler);
-    return;
-}
-
-#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/serialization/common/transport/ser_phy/spi_5W_master.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/spi_5W_master.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/spi_5W_master.h
deleted file mode 100644
index 501eeff..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/spi_5W_master.h
+++ /dev/null
@@ -1,178 +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.
- *
- */
- 
-#ifndef APP_SPI_MASTER_H
-#define APP_SPI_MASTER_H
-
-#include <stdint.h>
-#include <stdlib.h>
-#include "boards.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define _SPI_5W_
-
-/**@brief Struct containing configuration parameters of the SPI master. */
-typedef struct
-{
-    uint32_t SPI_Freq;      /**< SPI frequency. */
-    uint32_t SPI_Pin_SCK;   /**< SCK pin number. */
-    uint32_t SPI_Pin_MISO;  /**< MISO pin number. */
-    uint32_t SPI_Pin_MOSI;  /**< MOSI pin number .*/
-    uint32_t SPI_Pin_SS;    /**< Slave select pin number. */
-    uint8_t SPI_ORDER;      /**< Bytes order MSBFIRST or LSBFIRST. */
-    uint8_t SPI_CPOL;       /**< Serial clock polarity ACTIVEHIGH or ACTIVELOW. */
-    uint8_t SPI_CPHA;       /**< Serial clock phase LEADING or TRAILING. */
- } spi_master_config_t;
-
-/**@brief SPI master driver events types. */
-typedef enum
-{
-    SPI_MASTER_EVT_TRANSFER_STARTED = 0, /**< An event indicating that transfer has been started */
-    SPI_MASTER_EVT_TRANSFER_COMPLETED,   /**< An event indicating that transfer has been completed */
-    SPI_MASTER_EVT_TRANSFER_ABORTED,   /**< An event indicating that transfer has been aborted */
-    SPI_MASTER_EVT_TRANSFER_RESTARTED,   /**< An event indicating that transfer has been resumed */
-    SPI_MASTER_EVT_FIRST_BYTE_RECEIVED,   /**< An event indicating end of one byte transfer  */
-    SPI_MASTER_EVT_TYPE_MAX              /**< Enumeration upper bound. */
-} spi_master_evt_type_t;
- 
-/**@brief Struct containing parameters of the SPI MASTER event */
- typedef struct
- {
-   spi_master_evt_type_t type; /**< Type of an event */
-   uint16_t data;                   /**< event data - context dependent */
- } spi_master_evt_t;
-
- /**@brief SPI MASTER internal states types. */
- typedef enum
- {
-   SPI_MASTER_STATE_DISABLED, /**< A state indicating that SPI master is disabled. */
-   SPI_MASTER_STATE_BUSY,     /**< A state indicating that SPI master is sending now. */
-   SPI_MASTER_STATE_ABORTED,
-   SPI_MASTER_STATE_IDLE      /**< A state indicating that SPI master is idle now. */
- } spi_master_state_t;
-
- /**@brief Instances of SPI master module. */
- typedef enum
- {
-     #ifdef SPI_MASTER_0_ENABLE
-        SPI_MASTER_0,   /**< A instance of SPI master 0. */
-     #endif
-     
-     #ifdef SPI_MASTER_1_ENABLE
-        SPI_MASTER_1,   /**< A instance of SPI master 1. */
-     #endif 
-     
-     SPI_MASTER_HW_ENABLED_COUNT    /**< A number of enabled instances of SPI master. */
- } spi_master_hw_instance_t;
- 
-/**@brief Type of generic callback function handler to be used by all SPI MASTER driver events.
- *
- * @param[in] spi_master_evt    SPI MASTER driver event.
- */
-typedef void (*spi_master_event_handler_t) (spi_master_evt_t spi_master_evt);
-
-
-/**@brief Function for opening and initializing a SPI master driver.
- *
- * @note  Function initializes SPI master hardware and internal module states, unregister events callback.
- *
- * @warning If the function has been already called, the function @ref spi_master_close has to be
- *          called before spi_master_open can be called again.
- *
- * @param[in] spi_master_hw_instance    Instance of SPI master module.
- * @param[in] p_spi_master_config       Pointer to configuration structure which will be used 
- *                                      to initialize SPI MASTER hardware.
- *
- * @retval NRF_SUCCESS                Operation success.
- * @retval NRF_ERROR_INVALID_STATE    Operation failure. The function has been already called.
- *                                    To call it again the function @ref spi_master_close 
- *                                    has to be called previously.
- * @retval NRF_ERROR_NULL             Operation failure. NULL pointer supplied.
- */
-uint32_t spi_master_open(const spi_master_hw_instance_t spi_master_hw_instance,
-                         spi_master_config_t const * const p_spi_master_config);
-
- 
-/**@brief Function for closing a SPI MASTER driver.
- *
- * @note  Function disable hardware, reset internal module states and unregister events callback
- *        function.
- *
- * @param[in] spi_master_hw_instance    A instance of SPI master.
- */
-void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance);
-
- 
-/**@brief Function for transferring data between SPI master and SPI slave
- *
- * @note  Function registers buffers pointed by p_tx_buf and p_rx_buf parameters, after that starts transmission.
- *        Function generates an event of type @ref SPI_MASTER_EVT_TRANSFER_STARTED when transfer has been started
- *        and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED when transfer has been completed.
- *
- * @param[in]  spi_master_hw_instance    Instance of SPI master module.
- * @param[in]  p_tx_buf                  Pointer to a transmit buffer.
- * @param[in]  tx_buf_len                Number of octets to the transfer.
- * @param[out] p_rx_buf                  Pointer to a receive buffer.
- * @param[in]  rx_buf_len                Number of octets to be received.
- *
- * @retval NRF_SUCCESS                Operation success. Packet was registered to the transmission
- *                                    and event will be send upon transmission completion.
- * @retval NRF_ERROR_BUSY             Operation failure. Transmitting of a data is in progress.
- */
- uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance,
-                               uint8_t * const p_tx_buf, const uint16_t tx_buf_len,
-                               uint8_t * const p_rx_buf, const uint16_t rx_buf_len);
-
-
-/**@brief Function for registration event handler.
-*
-* @note  Function registers a event handler to be used by SPI MASTER driver for sending events.
-*        @ref SPI_MASTER_EVT_TRANSFER_STARTED and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED.
-*
-* @param[in] spi_master_hw_instance    Instance of SPI master module.
-* @param[in] event_handler             Generic callback function handler to be used 
-*                                      by all SPI master driver events.
-*/
-void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                spi_master_event_handler_t event_handler);
-
-
-/**@brief Function for getting current state of the SPI master driver.
- *
- * @note  Function gets current state of the SPI master driver.
- * 
- * @param[in] spi_master_hw_instance   Instance of SPI master module.
- *
- * @retval SPI_MASTER_STATE_DISABLED   SPI MASTER is disabled.
- * @retval SPI_MASTER_STATE_BUSY       SPI_MASTER is sending now. 
- * @retval SPI_MASTER_STATE_IDLE       SPI_MASTER is idle now. 
- */
-spi_master_state_t spi_master_get_state(const spi_master_hw_instance_t spi_master_hw_instance);
-
-#ifdef _SPI_5W_
-
-uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance);
-
-uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance);
-
-void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                         spi_master_event_handler_t event_handler);
-#endif
-
-#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/serialization/common/transport/ser_phy_debug_comm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy_debug_comm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy_debug_comm.h
deleted file mode 100644
index 5cd6c1e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy_debug_comm.h
+++ /dev/null
@@ -1,175 +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.
- *
- */
-
-#ifndef SER_PHY_DEBUG_COMM_H__
-#define SER_PHY_DEBUG_COMM_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef SER_PHY_HCI_DEBUG_ENABLE
-
-// empty definitions here
-#define DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(data)
-#define DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(data)
-#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(data)
-#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(data)
-#define DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(data)
-#define DEBUG_EVT_SLIP_PACKET_TX(data)
-#define DEBUG_EVT_SLIP_ACK_TX(data)
-#define DEBUG_EVT_SLIP_PACKET_TXED(data)
-#define DEBUG_EVT_SLIP_ACK_TXED(data)
-#define DEBUG_EVT_SLIP_PACKET_RXED(data)
-#define DEBUG_EVT_SLIP_ACK_RXED(data)
-#define DEBUG_EVT_SLIP_ERR_RXED(data)
-#define DEBUG_EVT_TIMEOUT(data)
-#define DEBUG_HCI_RETX(data)
-#define DEBUG_EVT_MAIN_BUSY(data)
-#define DEBUG_EVT_TX_REQ(data)
-
-#else
-#include <stdint.h>
-
-//Low level hardware events
-typedef enum
-{
-    HCI_PHY_EVT_TX_PKT_SENT,
-    HCI_PHY_EVT_BUF_REQUEST,
-    HCI_PHY_EVT_RX_PKT_RECEIVED,
-    HCI_PHY_EVT_RX_PKT_DROPPED,
-    HCI_PHY_EVT_TX_ERROR,
-    HCI_SLIP_EVT_PACKET_TX,
-    HCI_SLIP_EVT_ACK_TX,
-    HCI_SLIP_EVT_PACKET_TXED,
-    HCI_SLIP_EVT_ACK_TXED,
-    HCI_SLIP_EVT_PACKET_RXED,
-    HCI_SLIP_EVT_ACK_RXED,
-    HCI_SLIP_EVT_ERR_RXED,
-    HCI_TIMER_EVT_TIMEOUT,
-    HCI_RETX,
-    HCI_MAIN_BUSY,
-    HCI_TX_REQ,
-    HCI_PHY_EVT_MAX
-} hci_dbg_evt_type_t;
-
-
-//Low level hardware event definition
-typedef struct
-{
-    hci_dbg_evt_type_t   evt;
-    uint32_t              data;
-} hci_dbg_evt_t;
-
-typedef void (*hci_dbg_event_handler_t)(hci_dbg_evt_t event);
-
-void debug_init(hci_dbg_event_handler_t evt_callback);
-
-void debug_evt(hci_dbg_evt_type_t evt, uint32_t data);
-
-
-#define DEBUG_EVT(event_type, data)    \
-do {                            \
-    debug_evt(event_type, data);       \
-} while(0);
-
-
-#define DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(data)      \
-do {                                                 \
-    DEBUG_EVT(HCI_PHY_EVT_TX_PKT_SENT, data);        \
-} while (0);
-
-
-#define DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(data)       \
-do {                                                  \
-    DEBUG_EVT(HCI_PHY_EVT_BUF_REQUEST, data);         \
-} while (0);
-
-
-#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(data)   \
-do {                                                  \
-    DEBUG_EVT(HCI_PHY_EVT_RX_PKT_RECEIVED, data);     \
-} while (0);
-
-
-#define DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(data)    \
-do {                                                  \
-    DEBUG_EVT(HCI_PHY_EVT_RX_PKT_DROPPED, data);      \
-} while (0);
-
-#define DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(data)          \
-do {                                                  \
-    DEBUG_EVT(HCI_PHY_EVT_TX_ERROR, data);            \
-} while (0);
-
-#define DEBUG_EVT_SLIP_PACKET_TX(data)                \
-do {                                                  \
-    DEBUG_EVT(HCI_SLIP_EVT_PACKET_TX, data);          \
-} while (0);
-
-#define DEBUG_EVT_SLIP_ACK_TX(data)                   \
-do {                                                  \
-    DEBUG_EVT(HCI_SLIP_EVT_ACK_TX, data);             \
-} while (0);
-
-#define DEBUG_EVT_SLIP_PACKET_TXED(data)              \
-do {                                                  \
-    DEBUG_EVT(HCI_SLIP_EVT_PACKET_TXED, data);        \
-} while (0);
-
-#define DEBUG_EVT_SLIP_ACK_TXED(data)                 \
-do {                                                  \
-    DEBUG_EVT(HCI_SLIP_EVT_ACK_TXED, data);           \
-} while (0);
-
-#define DEBUG_EVT_SLIP_PACKET_RXED(data)              \
-do {                                                  \
-    DEBUG_EVT(HCI_SLIP_EVT_PACKET_RXED, data);        \
-} while (0);
-
-#define DEBUG_EVT_SLIP_ACK_RXED(data)                 \
-do {                                                  \
-    DEBUG_EVT(HCI_SLIP_EVT_ACK_RXED, data);           \
-} while (0);
-
-#define DEBUG_EVT_SLIP_ERR_RXED(data)                 \
-do {                                                  \
-    DEBUG_EVT(HCI_SLIP_EVT_ERR_RXED, data);           \
-} while (0);
-
-#define DEBUG_EVT_TIMEOUT(data)                       \
-do {                                                  \
-    DEBUG_EVT(HCI_TIMER_EVT_TIMEOUT, data);           \
-} while (0);
-
-#define DEBUG_HCI_RETX(data)                          \
-do {                                                  \
-    DEBUG_EVT(HCI_RETX, data);                        \
-} while (0);
-
-#define DEBUG_EVT_MAIN_BUSY(data)                     \
-do {                                                  \
-    DEBUG_EVT(HCI_MAIN_BUSY, data);                   \
-} while (0);
-
-#define DEBUG_EVT_TX_REQ(data)                        \
-do {                                                  \
-    DEBUG_EVT(HCI_TX_REQ, data);                      \
-} while (0);
-
-#endif  // SER_PHY_HCI_DEBUG_ENABLE
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif  // SER_PHY_DEBUG_COMM_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/serialization/connectivity/codecs/common/ble_dtm_conn.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/ble_dtm_conn.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/ble_dtm_conn.h
deleted file mode 100644
index 0ea2677..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/ble_dtm_conn.h
+++ /dev/null
@@ -1,85 +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.
- *
- */
-
-#ifndef BLE_DTM_CONN_H__
-#define BLE_DTM_CONN_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_conn_common_codecs Connectivity common codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_dtm_conn DTM Connectivity command request decoder and command response encoder
- * @{
- * @ingroup  ser_conn_common_codecs
- *
- * @brief   DTM Connectivity command request decoder and command response encoder
- */
-
-#include "dtm_uart.h"
-
-/**@brief Decodes @ref ble_dtm_init command request.
- *
- * @sa @ref nrf51_dtm_init_encoding_sec for packet format,
- *     @ref ble_dtm_init_rsp_enc for response encoding.
- *
- * @param[in] p_buf               Pointer to beginning of command request packet.
- * @param[in] packet_len             Length (in bytes) of request packet.
- * @param[in] p_comm_params       Pointer to the structure with DTM Uart configuration.
-
- *
- * @retval NRF_SUCCESS                Decoding success.
- * @retval NRF_ERROR_NULL             Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Decoding failure. Incorrect buffer length.
- */
-uint32_t ble_dtm_init_req_dec(uint8_t const * const           p_buf,
-                              uint16_t                        packet_len,
-                              app_uart_stream_comm_params_t * p_comm_params);
-
-
-/**@brief Encodes @ref ble_dtm_init command response.
- *
- * @sa @ref nrf51_dtm_init_encoding_sec for packet format.
- *     @ref ble_dtm_init_req_dec for request decoding.
- *
- * @param[in] return_code         Return code indicating if command was successful or not.
- * @param[out] p_buf              Pointer to buffer where encoded data command response will be
- *                                returned.
- * @param[in,out] p_buf_len       \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command response packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_dtm_init_rsp_enc(uint32_t         return_code,
-                              uint8_t * const  p_buf,
-                              uint32_t * const p_buf_len);
-
-/** @} */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BLE_DTM_CONN_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/serialization/connectivity/codecs/common/ble_dtm_init.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/ble_dtm_init.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/ble_dtm_init.c
deleted file mode 100644
index 2c46424..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/ble_dtm_init.c
+++ /dev/null
@@ -1,56 +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.
- *
- */
-
-#include "ble_dtm_conn.h"
-#include "dtm_uart.h"
-#include "nrf_error.h"
-#include "ble_serialization.h"
-
-uint32_t ble_dtm_init_req_dec(uint8_t const * const p_buf, uint16_t packet_len,
-                              app_uart_stream_comm_params_t * p_comm_params)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_comm_params);
-
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &p_comm_params->tx_pin_no);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &p_comm_params->rx_pin_no);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &p_comm_params->baud_rate);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT(index == packet_len, NRF_ERROR_INVALID_LENGTH);
-
-    return err_code;
-}
-
-uint32_t ble_dtm_init_rsp_enc(uint32_t return_code, uint8_t * const p_buf,
-                              uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint32_t_enc(&return_code, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}

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/serialization/connectivity/codecs/common/conn_mw.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/conn_mw.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/conn_mw.c
deleted file mode 100644
index 36660c4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/conn_mw.c
+++ /dev/null
@@ -1,84 +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.
- *
- */
-#include <stddef.h>
-
-#include "ble_serialization.h"
-#include "nrf_soc.h"
-#include "ble.h"
-#include "ble_l2cap.h"
-#include "ble_gap.h"
-#include "ble_gattc.h"
-#include "ble_gatts.h"
-
-/**@brief Connectivity middleware handler type. */
-typedef uint32_t (*conn_mw_handler_t)(uint8_t const * const p_rx_buf,
-                                      uint32_t              rx_buf_len,
-                                      uint8_t * const       p_tx_buf,
-                                      uint32_t * const      p_tx_buf_len);
-
-/**@brief Connectivity middleware item. */
-typedef struct
-{
-    uint8_t           opcode;     /**< Opcode by which specific codec is identified */
-    conn_mw_handler_t fp_handler; /**< Function pointer to handler associated with given opcode */
-} conn_mw_item_t;
-
-/* Include handlers for given softdevice */
-#include "conn_mw_items.c"
-
-/**@brief Number of registered connectivity middleware handlers. */
-static const uint32_t conn_mw_item_len = sizeof (conn_mw_item) / sizeof (conn_mw_item[0]);
-
-/**@brief Local function for finding connectivity middleware handler in the table.. */
-static conn_mw_handler_t conn_mw_handler_get(uint8_t opcode)
-{
-    conn_mw_handler_t fp_handler = NULL;
-    uint32_t          i;
-
-    for (i = 0; i < conn_mw_item_len; i++)
-    {
-        if (opcode == conn_mw_item[i].opcode)
-        {
-            fp_handler = conn_mw_item[i].fp_handler;
-            break;
-        }
-    }
-
-    return fp_handler;
-}
-
-uint32_t conn_mw_handler(uint8_t const * const p_rx_buf,
-                         uint32_t              rx_buf_len,
-                         uint8_t * const       p_tx_buf,
-                         uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    conn_mw_handler_t fp_handler;
-    uint32_t          err_code = NRF_SUCCESS;
-    uint8_t           opcode   = p_rx_buf[SER_CMD_OP_CODE_POS];
-
-    fp_handler = conn_mw_handler_get(opcode);
-
-    if (fp_handler)
-    {
-        err_code = fp_handler(p_rx_buf, rx_buf_len, p_tx_buf, p_tx_buf_len);
-    }
-    else
-    {
-        err_code = NRF_ERROR_NOT_SUPPORTED;
-    }
-
-    return err_code;
-}

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/serialization/connectivity/codecs/common/conn_mw.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/conn_mw.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/conn_mw.h
deleted file mode 100644
index 047dddf..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/common/conn_mw.h
+++ /dev/null
@@ -1,46 +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.
- *
- */
-#ifndef _CONN_MW_H
-#define _CONN_MW_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Connectivity Middleware dispatcher function
- *
- * @details It will handle decode the opcode from RX buffer and based on the opcode it will search
- *          for registered handler. Handler is called once it is found.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- * @retval NRF_ERROR_NOT_SUPPORTED    Handler failure. Opcode not supported.
- */
-uint32_t conn_mw_handler (uint8_t const * const p_rx_buf,
-                          uint32_t              rx_buf_len,
-                          uint8_t * const       p_tx_buf,
-                          uint32_t      * const p_tx_buf_len);
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_CONN_MW_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/serialization/connectivity/codecs/s130/middleware/conn_mw.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw.h
deleted file mode 100644
index 047dddf..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw.h
+++ /dev/null
@@ -1,46 +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.
- *
- */
-#ifndef _CONN_MW_H
-#define _CONN_MW_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Connectivity Middleware dispatcher function
- *
- * @details It will handle decode the opcode from RX buffer and based on the opcode it will search
- *          for registered handler. Handler is called once it is found.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- * @retval NRF_ERROR_NOT_SUPPORTED    Handler failure. Opcode not supported.
- */
-uint32_t conn_mw_handler (uint8_t const * const p_rx_buf,
-                          uint32_t              rx_buf_len,
-                          uint8_t * const       p_tx_buf,
-                          uint32_t      * const p_tx_buf_len);
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_CONN_MW_H


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c
deleted file mode 100644
index e03daf1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c
+++ /dev/null
@@ -1,57 +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.
- *
- */
-
-#include "ble_gatts_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "cond_field_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-
-uint32_t ble_gatts_rw_authorize_reply_req_enc(
-    uint16_t conn_handle,
-    ble_gatts_rw_authorize_reply_params_t const * const
-    p_reply_params,
-    uint8_t * const
-    p_buf,
-    uint32_t * const
-    p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index    = 0;
-    uint32_t buf_len  = *p_buf_len;
-    uint8_t  opcode   = SD_BLE_GATTS_RW_AUTHORIZE_REPLY;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_reply_params, p_buf, buf_len, &index,
-                              ble_gatts_rw_authorize_reply_params_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf,
-                                              uint32_t              packet_len,
-                                              uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_RW_AUTHORIZE_REPLY, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c
deleted file mode 100644
index c450be1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c
+++ /dev/null
@@ -1,83 +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 "ble_gatts_app.h"
-#include "ble_serialization.h"
-#include "ble_gatts.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_service_add_req_enc(uint8_t                  type,
-                                       ble_uuid_t const * const p_uuid,
-                                       uint16_t const * const   p_conn_handle,
-                                       uint8_t * const          p_buf,
-                                       uint32_t * const         p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTS_SERVICE_ADD;
-    p_buf[index++] = type;
-
-    p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_uuid != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
-        index         += uint16_encode(p_uuid->uuid, &p_buf[index]);
-        p_buf[index++] = p_uuid->type;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-    p_buf[index++] = (p_conn_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf,
-                                       uint32_t              packet_len,
-                                       uint16_t * const      p_conn_handle,
-                                       uint32_t * const      p_result_code)
-{
-    uint32_t index = 0;
-
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                             SD_BLE_GATTS_SERVICE_ADD,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_NOT_NULL(p_conn_handle);
-
-    SER_ASSERT_LENGTH_LEQ(index + 2, packet_len);
-    uint16_dec(p_buf, packet_len, &index, p_conn_handle);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return decode_result;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c
deleted file mode 100644
index 92400c8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c
+++ /dev/null
@@ -1,55 +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.
- *
- */
-
-#include "ble_gatts_app.h"
-#include "ble_serialization.h"
-#include "ble_gatts.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_service_changed_req_enc(uint16_t         conn_handle,
-                                           uint16_t         start_handle,
-                                           uint16_t         end_handle,
-                                           uint8_t * const  p_buf,
-                                           uint32_t * const p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code;
-    uint8_t  opcode = SD_BLE_GATTS_SERVICE_CHANGED;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&start_handle, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&end_handle, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf,
-                                           uint32_t              packet_len,
-                                           uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SERVICE_CHANGED, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c
deleted file mode 100644
index 81a35d4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c
+++ /dev/null
@@ -1,113 +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 "ble_gatts_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t               conn_handle,
-                                        uint8_t const * const  p_sys_attr_data,
-                                        uint16_t const * const p_sys_attr_data_len,
-                                        uint32_t               flags,
-                                        uint8_t * const        p_buf,
-                                        uint32_t *             p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1 + 4, *p_buf_len);
-    p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_GET;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-
-    p_buf[index++] = (p_sys_attr_data_len != NULL) ? SER_FIELD_PRESENT :
-                     SER_FIELD_NOT_PRESENT;
-
-    if (p_sys_attr_data_len != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
-        index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]);
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-    p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-    
-    err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint8_t * const       p_sys_attr_data,
-                                        uint16_t * const      p_sys_attr_data_len,
-                                        uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GATTS_SYS_ATTR_GET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len);
-
-    uint16_t sys_attr_len;
-    uint16_dec(p_buf, packet_len, &index, &sys_attr_len);
-
-    if (p_buf[index++] == SER_FIELD_PRESENT)
-    {
-        SER_ASSERT_NOT_NULL(p_sys_attr_data);
-        SER_ASSERT_NOT_NULL(p_sys_attr_data_len);
-        SER_ASSERT(sys_attr_len <= *p_sys_attr_data_len, NRF_ERROR_DATA_SIZE);
-
-        SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, packet_len);
-        memcpy(p_sys_attr_data, &p_buf[index], sys_attr_len);
-        *p_sys_attr_data_len = sys_attr_len;
-        index               += sys_attr_len;
-    }
-    else
-    {
-        if (p_sys_attr_data_len != NULL)
-        {
-            *p_sys_attr_data_len = sys_attr_len;
-        }
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c
deleted file mode 100644
index e0467e0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c
+++ /dev/null
@@ -1,65 +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 "ble_gatts_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gatts.h"
-#include "app_util.h"
-
-
-uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t              conn_handle,
-                                        uint8_t const * const p_sys_attr_data,
-                                        uint16_t              sys_attr_data_len,
-                                        uint32_t              flags,
-                                        uint8_t * const       p_buf,
-                                        uint32_t * const      p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 8, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_SET;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-
-    p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_sys_attr_data != NULL)
-    {
-        //lint -save -esym(670,memcpy)
-        SER_ERROR_CHECK(sys_attr_data_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM);
-        SER_ASSERT_LENGTH_LEQ(index + 2 + sys_attr_data_len + 4, *p_buf_len);
-        index += uint16_encode(sys_attr_data_len, &p_buf[index]);
-        memcpy(&(p_buf[index]), p_sys_attr_data, sys_attr_data_len);
-        //lint -restore
-        index += sys_attr_data_len;
-    }
-    
-    err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SYS_ATTR_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c
deleted file mode 100644
index add50b9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright (c) Nordic Semiconductor ASA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. This software must only be used in a processor manufactured by Nordic
- * Semiconductor ASA, or in a processor manufactured by a third party that
- * is used in combination with a processor manufactured by Nordic Semiconductor.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "ble_gatts_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "cond_field_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-
-uint32_t ble_gatts_value_get_req_enc(uint16_t                        conn_handle,
-                                     uint16_t                        handle,
-                                     ble_gatts_value_t const * const p_value,
-                                     uint8_t * const                 p_buf,
-                                     uint32_t * const                p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index     = 0;
-    uint32_t err_code  = NRF_SUCCESS;
-    uint32_t total_len = *p_buf_len;
-
-    SER_ASSERT_LENGTH_LEQ(1 + 2 + 2 + 1, total_len);
-    p_buf[index++] = SD_BLE_GATTS_VALUE_GET;
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index); 
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&handle, p_buf, total_len, &index); 
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_value != NULL)
-    {
-        p_buf[index++] = SER_FIELD_PRESENT;
-        err_code = uint16_t_enc(&(p_value->len), p_buf, total_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        err_code = uint16_t_enc(&(p_value->offset), p_buf, total_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        SER_ASSERT_LENGTH_LEQ(1, total_len - index);
-        if (p_value->p_value != NULL)
-        {
-            p_buf[index++] = SER_FIELD_PRESENT;
-        }
-        else
-        {
-            p_buf[index++] = SER_FIELD_NOT_PRESENT;
-        }
-    }
-    else
-    {
-        p_buf[index++] = SER_FIELD_NOT_PRESENT;
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const     p_buf,
-                                     uint32_t                  packet_len,
-                                     ble_gatts_value_t * const p_value,
-                                     uint32_t * const          p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    SER_ASSERT_NOT_NULL(p_value);
-
-    uint32_t err_code;
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index,
-                                                             packet_len, SD_BLE_GATTS_VALUE_GET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c
deleted file mode 100644
index 44b1b16..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c
+++ /dev/null
@@ -1,84 +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 "ble_gatts_app.h"
-#include <string.h>
-#include "nrf_error.h"
-#include "cond_field_serialization.h"
-#include "ble_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_gatts_value_set_req_enc(uint16_t             conn_handle,
-                                     uint16_t             handle,
-                                     ble_gatts_value_t *  p_value, 
-                                     uint8_t * const      p_buf,
-                                     uint32_t * const     p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(1 + 2 + 2, *p_buf_len);
-    p_buf[index++] = SD_BLE_GATTS_VALUE_SET;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-    index         += uint16_encode(handle, &p_buf[index]);
-
-    if(p_value != NULL)
-    {
-        SER_ERROR_CHECK(p_value->len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM);
-    }
-    err_code = cond_field_enc(p_value, p_buf, *p_buf_len, &index, ble_gatts_value_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const       p_buf,
-                                     uint32_t                    packet_len,
-                                     ble_gatts_value_t * const   p_value,
-                                     uint32_t * const            p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index         = 0;
-    uint32_t err_code      = NRF_SUCCESS;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GATTS_VALUE_SET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_l2cap_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h
deleted file mode 100644
index 806a53d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is confidential property of Nordic Semiconductor. The use,
- * copying, transfer or disclosure of such information is prohibited except by express written
- * agreement with Nordic Semiconductor.
- *
- */
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_l2cap_app L2CAP Application command request encoders and command response decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    L2CAP Application command request encoders and command response decoders.
- */
-
-#ifndef BLE_L2CAP_APP_H__
-#define BLE_L2CAP_APP_H__
-
-#include "ble.h"
-#include "ble_types.h"
-#include "ble_ranges.h"
-#include "ble_err.h"
-#include "ble_l2cap.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Register a CID with L2CAP.
- *
- * @details This registers a higher protocol layer with the L2CAP multiplexer, and is requried prior to all operations on the CID.
- *
- * @param[in]     cid L2CAP CID.
- * @param[in]     p_buf          Pointer to beginning of command response packet.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_l2cap_cid_register_req_enc(uint16_t         cid,
-                                        uint8_t * const  p_buf,
-                                        uint32_t * const p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_l2cap_cid_register command.
- *
- * @sa @ref nrf51_adv_start_encoding for packet format,
- *     @ref ble_l2cap_cid_register_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code);
-
-/**@brief Unregister a CID with L2CAP.
- *
- * @details This unregisters a previously registered higher protocol layer with the L2CAP multiplexer.
- *
- * @param[in]     cid L2CAP CID.
- * @param[in]     p_buf          Pointer to beginning of command response packet.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t         cid,
-                                          uint8_t * const  p_buf,
-                                          uint32_t * const p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_l2cap_cid_unregister command.
- *
- * @sa @ref nrf51_adv_start_encoding for packet format,
- *     @ref ble_l2cap_cid_unregister_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          uint32_t * const      p_result_code);
-
-/**@brief Transmit an L2CAP packet.
- *
- * @note    It is important to note that a call to this function will <b>consume an application buffer</b>, and will therefore
- *          generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted.
- *          Please see the documentation of @ref sd_ble_tx_packet_count_get for more details.
- *
- * @param[in]     conn_handle Connection Handle.
- * @param[in]     p_l2cap_header    Pointer to a packet header containing length and CID.
- * @param[in]     p_data      Pointer to the data to be transmitted.
- * @param[in]     p_buf          Pointer to beginning of command response packet.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @return @ref NRF_SUCCESS Successfully queued an L2CAP packet for transmission.
- * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
- * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register.
- * @return @ref NRF_ERROR_NOT_FOUND CID not found.
- * @return @ref NRF_ERROR_NO_MEM Not enough memory to complete operation.
- * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF.
- */
-uint32_t ble_l2cap_tx_req_enc(uint16_t                         conn_handle,
-                              ble_l2cap_header_t const * const p_l2cap_header,
-                              uint8_t const * const            p_data,
-                              uint8_t * const                  p_buf,
-                              uint32_t * const                 p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_l2cap_tx command.
- *
- * @sa @ref nrf51_adv_start_encoding for packet format,
- *     @ref ble_l2cap_tx_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf,
-                              uint32_t              packet_len,
-                              uint32_t * const      p_result_code);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //BLE_L2CAP_APP_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/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c
deleted file mode 100644
index 0ce42ff..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c
+++ /dev/null
@@ -1,45 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-uint32_t ble_l2cap_cid_register_req_enc(uint16_t         cid,
-                                        uint8_t * const  p_buf,
-                                        uint32_t * const p_buf_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_L2CAP_CID_REGISTER;
-    err_code       = uint16_t_enc(&cid, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_REGISTER, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c
deleted file mode 100644
index 44315cc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c
+++ /dev/null
@@ -1,45 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t         cid,
-                                          uint8_t * const  p_buf,
-                                          uint32_t * const p_buf_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_L2CAP_CID_UNREGISTER;
-    err_code       = uint16_t_enc(&cid, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf,
-                                          uint32_t              packet_len,
-                                          uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_CID_UNREGISTER, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h
deleted file mode 100644
index 3c32be8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h
+++ /dev/null
@@ -1,69 +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.
- *
- */
-#ifndef BLE_L2CAP_EVT_APP_H__
-#define BLE_L2CAP_EVT_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_l2cap_evt_app L2CAP Application event decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    L2CAP Application event decoders.
- */
-#include "ble.h"
-
-/**
- * @brief Decodes ble_l2cap_evt_rx event.
- *
- * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf,
-                              uint32_t              packet_len,
-                              ble_evt_t * const     p_event,
-                              uint32_t * const      p_event_len);
-
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c
deleted file mode 100644
index a064d45..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c
+++ /dev/null
@@ -1,56 +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.
- *
- */
-
-#include "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "app_util.h"
-#include "ble_l2cap_evt_app.h"
-
-uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf,
-                              uint32_t              packet_len,
-                              ble_evt_t * const     p_event,
-                              uint32_t * const      p_event_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t index        = 0;
-    uint32_t in_event_len = *p_event_len;
-
-    *p_event_len = offsetof(ble_l2cap_evt_t, params);
-
-    uint16_t evt_id;
-
-    uint32_t err_code = uint16_t_dec(p_buf, packet_len, &index, &evt_id);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    void * p_rx = NULL;
-
-    if (p_event)
-    {
-        err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.l2cap_evt.conn_handle));
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        p_rx = &(p_event->evt.l2cap_evt.params.rx);
-    }
-
-    uint32_t struct_len = in_event_len - *p_event_len;
-    err_code = ble_l2cap_evt_rx_t_dec(p_buf, packet_len, &index, &struct_len, p_rx);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_event_len += struct_len;
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c
deleted file mode 100644
index 0beae1c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c
+++ /dev/null
@@ -1,61 +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.
- *
- */
-
-#include <string.h>
-#include "ble_l2cap_app.h"
-#include "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-#include "cond_field_serialization.h"
-
-uint32_t ble_l2cap_tx_req_enc(uint16_t                         conn_handle,
-                              ble_l2cap_header_t const * const p_l2cap_header,
-                              uint8_t const * const            p_data,
-                              uint8_t * const                  p_buf,
-                              uint32_t * const                 p_buf_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(1, *p_buf_len);
-    p_buf[index++] = SD_BLE_L2CAP_TX;
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_l2cap_header, p_buf, *p_buf_len, &index, ble_l2cap_header_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_l2cap_header != NULL)
-    {
-        err_code = buf_enc(p_data, p_l2cap_header->len, p_buf, *p_buf_len, &index);
-    }
-    else
-    {
-        err_code = buf_enc(NULL, 0, p_buf, *p_buf_len, &index);
-    }
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf,
-                              uint32_t              packet_len,
-                              uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_L2CAP_TX, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_opt_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_get.c
deleted file mode 100644
index 6df45f5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_get.c
+++ /dev/null
@@ -1,126 +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.
- *
- */
-
-#include "ble_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_opt_get_req_enc(uint32_t                opt_id,
-                             ble_opt_t const * const p_opt,
-                             uint8_t * const         p_buf,
-                             uint32_t * const        p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-    SER_ASSERT_LENGTH_LEQ(1+4+1, *p_buf_len);                       // [OPCODE][OP_ID][PRESENT]
-    SER_ASSERT(((opt_id == BLE_COMMON_OPT_CONN_BW)         ||
-                (opt_id == BLE_GAP_OPT_CH_MAP)             ||
-                (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) ||
-                (opt_id == BLE_GAP_OPT_PASSKEY)            ||
-                (opt_id == BLE_GAP_OPT_PRIVACY)            ||
-                (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT)    ||
-                (opt_id == BLE_GAP_OPT_COMPAT_MODE))  , NRF_ERROR_INVALID_PARAM);
-
-    p_buf[index++] = SD_BLE_OPT_GET;
-
-    err_code = uint32_t_enc(&opt_id, p_buf, *p_buf_len, &index);
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    p_buf[index++] = (p_opt == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf,
-                             uint32_t              packet_len,
-                             uint32_t      * const p_opt_id,
-                             ble_opt_t     * const p_opt,
-                             uint32_t      * const p_result_code)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_opt_id);
-    SER_ASSERT_NOT_NULL(p_opt);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                           SD_BLE_OPT_GET,
-                                                           p_result_code);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    (void) uint32_t_dec(p_buf, packet_len, &index, p_opt_id);
-    SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_CONN_BW)         ||
-                (*p_opt_id == BLE_GAP_OPT_CH_MAP)             ||
-                (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) ||
-                (*p_opt_id == BLE_GAP_OPT_PASSKEY)            ||
-                (*p_opt_id == BLE_GAP_OPT_PRIVACY)            ||
-                (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT)    ||
-                (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM);
-
-    switch (*p_opt_id)
-    {
-      case BLE_COMMON_OPT_CONN_BW:
-          err_code = ble_common_opt_conn_bw_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->common_opt.conn_bw));
-      break;
-      case BLE_GAP_OPT_CH_MAP:
-          err_code = ble_gap_opt_ch_map_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.ch_map));
-      break;
-      case BLE_GAP_OPT_LOCAL_CONN_LATENCY:
-          err_code = ble_gap_opt_local_conn_latency_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.local_conn_latency));
-      break;
-      case BLE_GAP_OPT_PASSKEY:
-          err_code = ble_gap_opt_passkey_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.passkey));
-      break;
-      case BLE_GAP_OPT_PRIVACY:
-          err_code = ble_gap_opt_privacy_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.privacy));
-      break;
-      case BLE_GAP_OPT_SCAN_REQ_REPORT:
-          err_code = ble_gap_opt_scan_req_report_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.scan_req_report));
-      break;
-      case BLE_GAP_OPT_COMPAT_MODE:
-          err_code = ble_gap_opt_compat_mode_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.compat_mode));
-      break;
-    }
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}
-
-

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/serialization/application/codecs/s130/serializers/ble_opt_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_set.c
deleted file mode 100644
index d7228d4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_set.c
+++ /dev/null
@@ -1,117 +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 "ble_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "ble_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_opt_set_req_enc(uint32_t const          opt_id,
-                             ble_opt_t const * const p_opt,
-                             uint8_t * const         p_buf,
-                             uint32_t * const        p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t initial_buf_len = *p_buf_len;
-
-    SER_ASSERT_LENGTH_LEQ(1 + 4 + 1, initial_buf_len);
-
-    SER_ASSERT(((opt_id == BLE_COMMON_OPT_CONN_BW) ||
-                (opt_id == BLE_GAP_OPT_CH_MAP)             ||
-                (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) ||
-                (opt_id == BLE_GAP_OPT_PASSKEY)            ||
-                (opt_id == BLE_GAP_OPT_PRIVACY)            ||
-                (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT)    ||
-                (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM);
-
-    p_buf[index++] = SD_BLE_OPT_SET;
-
-    err_code = uint32_t_enc(&opt_id, p_buf, initial_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_opt != NULL)
-    {
-        p_buf[index++] = SER_FIELD_PRESENT;
-        
-        switch(opt_id)
-        {
-            case BLE_COMMON_OPT_CONN_BW:
-                err_code = ble_common_opt_conn_bw_t_enc(&(p_opt->common_opt.conn_bw),p_buf, initial_buf_len, &index);
-                break;
-            case BLE_GAP_OPT_CH_MAP:
-                err_code = ble_gap_opt_ch_map_t_enc(&(p_opt->gap_opt.ch_map),p_buf, initial_buf_len, &index);
-                break;
-            case BLE_GAP_OPT_LOCAL_CONN_LATENCY:
-                err_code = ble_gap_opt_local_conn_latency_t_enc(&(p_opt->gap_opt.local_conn_latency),p_buf, initial_buf_len, &index);
-                break;
-            case BLE_GAP_OPT_PASSKEY:
-                err_code = ble_gap_opt_passkey_t_enc(&(p_opt->gap_opt.passkey),p_buf, initial_buf_len, &index);
-                break;
-            case BLE_GAP_OPT_PRIVACY:
-                err_code = ble_gap_opt_privacy_t_enc(&(p_opt->gap_opt.privacy),p_buf, initial_buf_len, &index);
-                break;
-            case BLE_GAP_OPT_SCAN_REQ_REPORT:
-                err_code = ble_gap_opt_scan_req_report_t_enc(&(p_opt->gap_opt.scan_req_report),p_buf, initial_buf_len, &index);
-                break;
-            case BLE_GAP_OPT_COMPAT_MODE:
-                err_code = ble_gap_opt_compat_mode_t_enc(&(p_opt->gap_opt.compat_mode),p_buf, initial_buf_len, &index);
-                break;
-        }
-    }
-    else
-    {
-        p_buf[index++] = SER_FIELD_NOT_PRESENT;
-    }
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf,
-                             uint32_t              packet_len,
-                             uint32_t * const      p_result_code)
-{
-    uint32_t index = 0;
-    uint32_t error_code;
-
-    error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                 SD_BLE_OPT_SET, p_result_code);
-
-    if (error_code != NRF_SUCCESS)
-    {
-        return error_code;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c
deleted file mode 100644
index 6dacfc1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c
+++ /dev/null
@@ -1,72 +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.
- *
- */
-
-#include "ble_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "cond_field_serialization.h"
-
-uint32_t ble_tx_packet_count_get_req_enc(uint16_t              conn_handle,
-                                         uint8_t const * const p_count,
-                                         uint8_t * const       p_buf,
-                                         uint32_t * const      p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index  = 0;
-    uint8_t  opcode = SD_BLE_TX_PACKET_COUNT_GET;
-    uint32_t err_code;
-    uint32_t total_len = *p_buf_len;
-
-    err_code = uint8_t_enc(&opcode, p_buf, total_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_count, p_buf, total_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_tx_packet_count_get_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         uint8_t * * const     pp_count,
-                                         uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index    = 0;
-    uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                        SD_BLE_TX_PACKET_COUNT_GET, p_result_code);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, uint8_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c
deleted file mode 100644
index 7321434..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c
+++ /dev/null
@@ -1,65 +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 "ble_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_user_mem_reply_req_enc(uint16_t                     conn_handle,
-                                    ble_user_mem_block_t const * p_block,
-                                    uint8_t * const              p_buf,
-                                    uint32_t * const             p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    p_buf[index++] = SD_BLE_USER_MEM_REPLY;
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if(p_block != NULL)
-    {
-        p_buf[index++] = SER_FIELD_PRESENT;
-
-        // Encoding order is different than structure elements order because
-        // mem block length should be sent first
-        err_code = uint16_t_enc(&(p_block->len), p_buf, *p_buf_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        err_code = cond_field_enc(p_block->p_mem, p_buf, *p_buf_len, &index, NULL);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    }
-    else
-    {
-        p_buf[index++] = SER_FIELD_NOT_PRESENT;
-    }
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t      * const p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_USER_MEM_REPLY, p_result_code);
-}
-
-

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/serialization/application/codecs/s130/serializers/ble_uuid_decode.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c
deleted file mode 100644
index 1bfa233..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c
+++ /dev/null
@@ -1,84 +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.
- *
- */
-
-#include "ble_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "ble_struct_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_uuid_decode_req_enc(uint8_t               uuid_le_len,
-                                 uint8_t const * const p_uuid_le,
-                                 ble_uuid_t * const    p_uuid,
-                                 uint8_t * const       p_buf,
-                                 uint32_t * const      p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t err_code;
-    uint32_t index   = 0;
-    uint32_t buf_len = *p_buf_len;
-    uint8_t  opcode  = SD_BLE_UUID_DECODE;
-
-    err_code = uint8_t_enc((void *)&opcode, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = len8data_enc(p_uuid_le, uuid_le_len, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc((void *)p_uuid, p_buf, buf_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 ble_uuid_t * * const  pp_uuid,
-                                 uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t err_code;
-    uint32_t index = 0;
-
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             buf_len,
-                                                             SD_BLE_UUID_DECODE,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, buf_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, buf_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_uuid_encode.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c
deleted file mode 100644
index f7a25d8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c
+++ /dev/null
@@ -1,93 +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 "ble_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid,
-                                 uint8_t const * const    p_uuid_le_len,
-                                 uint8_t const * const    p_uuid_le,
-                                 uint8_t * const          p_buf,
-                                 uint32_t * const         p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_UUID_ENCODE;
-
-    p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_uuid != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
-        index         += uint16_encode(p_uuid->uuid, &p_buf[index]);
-        p_buf[index++] = p_uuid->type;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
-    p_buf[index++] = (p_uuid_le_len == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-    p_buf[index++] = (p_uuid_le == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 uint8_t * const       p_uuid_le_len,
-                                 uint8_t * const       p_uuid_le,
-                                 uint32_t * const      p_result_code)
-{
-    uint32_t index = 0;
-    uint32_t error_code;
-
-    error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                 SD_BLE_UUID_ENCODE, p_result_code);
-
-    if (error_code != NRF_SUCCESS)
-    {
-        return error_code;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, packet_len);
-    uint8_t uuid_le_len = p_buf[index++];
-
-    if (p_uuid_le_len != NULL)
-    {
-        if (p_uuid_le != NULL)
-        {
-            SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, packet_len);
-            memcpy(p_uuid_le, &(p_buf[index]), uuid_le_len);
-            index += uuid_le_len;
-        }
-        *p_uuid_le_len = uuid_le_len;
-    }
-
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c
deleted file mode 100644
index 6b392d6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c
+++ /dev/null
@@ -1,83 +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.
- */
-
-#include "ble_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "ble_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid,
-                                 uint8_t * const             p_uuid_type,
-                                 uint8_t * const             p_buf,
-                                 uint32_t * const            p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t err_code;
-    uint32_t index   = 0;
-    uint32_t buf_len = *p_buf_len;
-    uint8_t  opcode  = SD_BLE_UUID_VS_ADD;
-
-    err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc((void *)p_vs_uuid, p_buf, buf_len, &index, ble_uuid128_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc((void *)p_uuid_type, p_buf, buf_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint8_t * * const     pp_uuid_type,
-                                 uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    SER_ASSERT_NOT_NULL(pp_uuid_type);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t index    = 0;
-
-    err_code = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                               &index,
-                                               buf_len,
-                                               SD_BLE_UUID_VS_ADD,
-                                               p_result_code);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, buf_len);
-        return NRF_SUCCESS;
-    }
-
-    err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, uint8_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, buf_len);
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_version_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_version_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_version_get.c
deleted file mode 100644
index e55b876..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_version_get.c
+++ /dev/null
@@ -1,73 +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.
- *
- */
-
-#include "ble_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_version_get_req_enc(ble_version_t const * const p_version,
-                                 uint8_t * const             p_buf,
-                                 uint32_t * const            p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_VERSION_GET;
-
-    SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
-
-    p_buf[index++] = (p_version == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_version_t *       p_version,
-                                 uint32_t * const      p_result_code)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                           SD_BLE_VERSION_GET,
-                                                           p_result_code);
-
-    if (status_code != NRF_SUCCESS)
-    {
-        return status_code;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-    uint8_dec(p_buf, packet_len, &index, &(p_version->version_number));
-    uint16_dec(p_buf, packet_len, &index, &(p_version->company_id));
-    uint16_dec(p_buf, packet_len, &index, &p_version->subversion_number);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return status_code;
-}
-
-

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/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c
deleted file mode 100644
index bc499df..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c
+++ /dev/null
@@ -1,79 +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 "nrf_soc_app.h"
-#include "nrf_soc.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "nrf_soc_struct_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ecb_block_encrypt_req_enc(nrf_ecb_hal_data_t * p_ecb_data,
-                                     uint8_t * const              p_buf,
-                                     uint32_t * const             p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code;
-    uint32_t buf_len = *p_buf_len;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t opcode = SD_ECB_BLOCK_ENCRYPT;
-
-    err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_ecb_data, p_buf, buf_len, &index,nrf_ecb_hal_data_t_in_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ecb_block_encrypt_rsp_dec(uint8_t const * const  p_buf,
-                                   uint32_t               packet_len,
-                                   nrf_ecb_hal_data_t *   p_ecb_data,
-                                   uint32_t * const       p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_ECB_BLOCK_ENCRYPT,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    uint32_t err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&p_ecb_data, nrf_ecb_hal_data_t_out_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/nrf_soc_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h
deleted file mode 100644
index bef156e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h
+++ /dev/null
@@ -1,134 +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.
- *
- */
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup soc_app SOC Application command request encoders and command response decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    SOC Application command request encoders and command response decoders.
- */
- 
-#ifndef NRF_SOC_APP_H__
-#define NRF_SOC_APP_H__
-
-#include <stdint.h>
-#include "nrf_soc.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Encodes @ref sd_power_system_off command request.
- *
- * @sa @ref nrf51_sd_power_off for packet format.
- *
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: size of p_buf buffer. \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len);
-
-
-/**@brief Encodes @ref sd_temp_get command request.
- *
- * @sa @ref nrf51_sd_temp_get for packet format.
-       @ref temp_get_rsp_dec for command response decoder.
- *
- * @param[in] p_temp         Pointer to result of temperature measurement.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: size of p_buf buffer. \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t temp_get_req_enc(int32_t const * const p_temp,
-                          uint8_t * const       p_buf,
-                          uint32_t * const      p_buf_len);
-
-/**@brief Decodes response to @ref sd_temp_get command.
- *
- * @sa @ref nrf51_sd_temp_get for packet format,
- *     @ref temp_get_req_enc for command request encoder.
- *
- * @param[in] p_buf        Pointer to beginning of command response packet.
- * @param[in] packet_len   Length (in bytes) of response packet.
- * @param[out] p_result_code     Command result code.
- * @param[out] p_temp      Pointer to result of temperature measurement.
- *
- * @return NRF_SUCCESS              Version information stored successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Length of \p p_event is too small to
- *                                  hold decoded event.
- */
-uint32_t temp_get_rsp_dec(uint8_t const * const p_buf,
-                          uint32_t              packet_len,
-                          uint32_t * const      p_result_code,
-                          int32_t * const       p_temp);
-
-/**@brief Encodes @ref sd_ecb_block_encrypt command request.
- *
- * @sa @ref nrf51_sd_ecb_block_encrypt for packet format.
-       @ref ecb_block_encrypt_rsp_dec for command response decoder.
- *
- * @param[in] p_ecb_data     Pointer to ECB data.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: size of p_buf buffer. \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ecb_block_encrypt_req_enc(nrf_ecb_hal_data_t * p_ecb_data,
-                                     uint8_t * const              p_buf,
-                                     uint32_t * const             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ecb_block_encrypt command.
- *
- * @sa @ref nrf51_sd_ecb_block_encrypt for packet format,
- *     @ref ecb_block_encrypt_req_enc for command request encoder.
- *
- * @param[in] p_buf            Pointer to beginning of command response packet.
- * @param[in] packet_len       Length (in bytes) of response packet.
- * @param[out] p_ecb_data      Pointer to ECB data.
- * @param[out] p_result_code   Command result code.
- *
- * @return NRF_SUCCESS              Version information stored successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Length of \p p_event is too small to
- *                                  hold decoded event.
- */
-uint32_t ecb_block_encrypt_rsp_dec(uint8_t const * const  p_buf,
-                                   uint32_t               packet_len,
-                                   nrf_ecb_hal_data_t *   p_ecb_data,
-                                   uint32_t * const       p_result_code);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_SOC_APP_H__


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

Posted by cc...@apache.org.
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/pwm/app_pwm.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/pwm/app_pwm.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/pwm/app_pwm.c
deleted file mode 100644
index 091fb70..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/pwm/app_pwm.c
+++ /dev/null
@@ -1,876 +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 "app_pwm.h"
-#include "nrf_drv_timer.h"
-#include "nrf_drv_ppi.h"
-#include "nrf_drv_common.h"
-#include "nrf_drv_gpiote.h"
-#include "nrf_gpiote.h"
-#include "nrf_gpio.h"
-#include "app_util.h"
-#include "app_util_platform.h"
-#include "nrf_assert.h"
-
-#define APP_PWM_CHANNEL_INITIALIZED                1
-#define APP_PWM_CHANNEL_UNINITIALIZED              0
-
-#define APP_PWM_CHANNEL_ENABLED                    1
-#define APP_PWM_CHANNEL_DISABLED                   0
-
-#define TIMER_PRESCALER_MAX                        9
-#define TIMER_MAX_PULSEWIDTH_US_ON_16M             4095
-
-#define APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE 2
-#define APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL  2
-
-#define UNALLOCATED                                0xFFFFFFFFUL
-#define BUSY_STATE_CHANGING                        0xFE
-#define BUSY_STATE_IDLE                            0xFF
-
-#define PWM_MAIN_CC_CHANNEL                        2
-#define PWM_SECONDARY_CC_CHANNEL                   3
-
-#ifdef NRF52
-    static bool m_use_ppi_delay_workaround;
-#endif
-
-
-/**
- * @brief PWM busy status
- *
- * Stores the number of a channel being currently updated.
- *
- */
-static volatile uint8_t  m_pwm_busy[TIMER_COUNT];
-
-
-/**
- * @brief New duty cycle value
- *
- * When the channel duty cycle reaches this value, the update process is complete.
- */
-static volatile uint32_t m_pwm_target_value[TIMER_COUNT];
-
-
-/**
- * @brief PWM ready counter
- *
- * The value in this counter is decremented in every PWM cycle after initiating the update.
- * If an event handler function was specified by the user, it is being called
- * after two cycle events (at least one full PWM cycle).
- */
-volatile uint8_t m_pwm_ready_counter[TIMER_COUNT][APP_PWM_CHANNELS_PER_INSTANCE];
-
-/**
- * @brief Pointers to instances
- *
- * This array connects any active timer instance number with the pointer to the PWM instance.
- * It is used by the interrupt runtime.
- */
-static const app_pwm_t * m_instances[TIMER_COUNT];
-
-// Macros for getting the polarity of given instance/channel.
-#define POLARITY_ACTIVE(INST,CH)   (( ((INST)->p_cb)->channels_cb[(CH)].polarity == \
-                 APP_PWM_POLARITY_ACTIVE_LOW)?(0):(1))
-#define POLARITY_INACTIVE(INST,CH) (( ((INST)->p_cb)->channels_cb[(CH)].polarity == \
-                 APP_PWM_POLARITY_ACTIVE_LOW)?(1):(0))
-
-//lint -save -e534
-
-/**
- * @brief Workaround for PAN-73.
- *
- * @param[in] timer     Timer.
- * @param[in] enable    Enable or disable.
- */
-static void pan73_workaround(NRF_TIMER_Type * p_timer, bool enable)
-{
-#ifdef NRF51
-    if (p_timer == NRF_TIMER0)
-    {
-        *(uint32_t *)0x40008C0C = (enable ? 1 : 0);
-    }
-    else if (p_timer == NRF_TIMER1)
-    {
-        *(uint32_t *)0x40009C0C = (enable ? 1 : 0);
-    }
-    else if (p_timer == NRF_TIMER2)
-    {
-        *(uint32_t *)0x4000AC0C = (enable ? 1 : 0);
-    }
-#endif
-    return;
-}
-
-bool app_pwm_busy_check(app_pwm_t const * const p_instance)
-{
-    uint8_t busy_state = (m_pwm_busy[p_instance->p_timer->instance_id]);
-    bool busy = true;
-    if (busy_state != BUSY_STATE_IDLE)
-    {
-        if (busy_state != BUSY_STATE_CHANGING)
-        {
-            if (nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) busy_state) 
-                == m_pwm_target_value[p_instance->p_timer->instance_id])
-            {
-                m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
-                busy = false;
-            }
-        }
-    }
-    else
-    {
-        busy = false;
-    }
-    return busy;
-}
-
-
-/**
- * @brief Function for enabling the IRQ for a given PWM instance.
- *
- * @param[in] p_instance  PWM instance.
- */
-__STATIC_INLINE void pwm_irq_enable(app_pwm_t const * const p_instance)
-{
-    nrf_drv_timer_compare_int_enable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
-}
-
-
-/**
- * @brief Function for disabling the IRQ for a given PWM instance.
- *
- * @param[in] p_instance  PWM instance.
- */
-__STATIC_INLINE void pwm_irq_disable(app_pwm_t const * const p_instance)
-{
-    nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
-}
-
-
-/**
- * @brief Function for disabling PWM channel PPI.
- *
- * @param[in] p_instance  PWM instance.
- */
-__STATIC_INLINE void pwm_channel_ppi_disable(app_pwm_t const * const p_instance, uint8_t channel)
-{
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    nrf_drv_ppi_channel_disable(p_cb->channels_cb[channel].ppi_channels[0]);
-    nrf_drv_ppi_channel_disable(p_cb->channels_cb[channel].ppi_channels[1]);
-}
-
-
-/**
- * @brief Function for disabling PWM PPI.
- *
- * @param[in] p_instance  PWM instance.
- */
-__STATIC_INLINE void pwm_ppi_disable(app_pwm_t const * const p_instance)
-{
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    nrf_drv_ppi_channel_disable(p_cb->ppi_channels[0]);
-    nrf_drv_ppi_channel_disable(p_cb->ppi_channels[1]);
-}
-
-
-/**
- * @brief This function is called on interrupt after duty set.
- *
- * @param[in] timer                 Timer used by PWM.
- * @param[in] timer_instance_id     Timer index.
- */
-void pwm_ready_tick(nrf_timer_event_t event_type, void * p_context)
-{
-    uint32_t timer_instance_id = (uint32_t)p_context;
-    uint8_t disable = 1;
-    
-    for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel)
-    {
-        if (m_pwm_ready_counter[timer_instance_id][channel])
-        {
-            --m_pwm_ready_counter[timer_instance_id][channel];
-            if (!m_pwm_ready_counter[timer_instance_id][channel])
-            {
-                app_pwm_cb_t * p_cb = m_instances[timer_instance_id]->p_cb;
-                p_cb->p_ready_callback(timer_instance_id);
-            }
-            else
-            {
-                disable = 0;
-            }
-        }
-    }
-    
-    if (disable)
-    {
-        pwm_irq_disable(m_instances[timer_instance_id]);
-    }
-}
-
-
-/**
- * @brief Function for resource de-allocation.
- *
- * @param[in] p_instance       PWM instance.
- */
-//lint -e{650}
-static void pwm_dealloc(app_pwm_t const * const p_instance)
-{
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i)
-    {
-        if (p_cb->ppi_channels[i] != (nrf_ppi_channel_t)(uint8_t)(UNALLOCATED))
-        {
-            nrf_drv_ppi_channel_free(p_cb->ppi_channels[i]);
-        }
-    }
-    if (p_cb->ppi_group != (nrf_ppi_channel_group_t)UNALLOCATED)
-    {
-        nrf_drv_ppi_group_free(p_cb->ppi_group);
-    }
-
-    for (uint8_t ch = 0; ch < APP_PWM_CHANNELS_PER_INSTANCE; ++ch)
-    {
-        for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL; ++i)
-        {
-            if (p_cb->channels_cb[ch].ppi_channels[i] != (nrf_ppi_channel_t)UNALLOCATED)
-            {
-                nrf_drv_ppi_channel_free(p_cb->channels_cb[ch].ppi_channels[i]);
-                p_cb->channels_cb[ch].ppi_channels[i] = (nrf_ppi_channel_t)UNALLOCATED;
-            }
-        }
-        if (p_cb->channels_cb[ch].gpio_pin != UNALLOCATED)
-        {
-            nrf_drv_gpiote_out_uninit(p_cb->channels_cb[ch].gpio_pin);
-            p_cb->channels_cb[ch].gpio_pin = UNALLOCATED;
-        }
-        p_cb->channels_cb[ch].initialized = APP_PWM_CHANNEL_UNINITIALIZED;
-    }
-    nrf_drv_timer_uninit(p_instance->p_timer);
-    return;
-}
-
-
-/**
- * @brief PWM state transition from (0%, 100%) to 0% or 100%.
- *
- * @param[in] p_instance       PWM instance.
- * @param[in] channel          PWM channel number.
- * @param[in] ticks            Number of clock ticks.
- */
-static void pwm_transition_n_to_0or100(app_pwm_t const * const p_instance,
-                                       uint8_t channel, uint16_t ticks)
-{
-    app_pwm_cb_t            * p_cb     = p_instance->p_cb;
-    app_pwm_channel_cb_t    * p_ch_cb  = &p_cb->channels_cb[channel];
-    nrf_ppi_channel_group_t   p_ppigrp = p_cb->ppi_group;
-
-    pwm_ppi_disable(p_instance);
-    nrf_drv_ppi_group_clear(p_ppigrp);
-    nrf_drv_ppi_channels_include_in_group(
-            nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0]) | 
-            nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[1]),
-            p_ppigrp);
-
-    if (!ticks)
-    {
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
-                    nrf_drv_ppi_task_addr_group_disable_get(p_ppigrp));
-        nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 0, false);
-        m_pwm_target_value[p_instance->p_timer->instance_id] =
-            nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) channel);
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
-                    nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
-    }
-    else
-    {
-        ticks = p_cb->period;
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
-                    nrf_drv_ppi_task_addr_group_disable_get(p_ppigrp));
-        // Set secondary CC channel to non-zero value:
-        nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 1, false);
-        m_pwm_target_value[p_instance->p_timer->instance_id] = 0;
-        // The captured value will be equal to 0, because timer clear on main PWM CC channel compare is enabled.
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
-                    nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
-    }
-    
-    nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]);
-    nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]);
-    
-    p_ch_cb->pulsewidth = ticks;
-    m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL;
-}
-
-
-/**
- * @brief PWM state transition from (0%, 100%) to (0%, 100%).
- *
- * @param[in] p_instance       PWM instance.
- * @param[in] channel          PWM channel number.
- * @param[in] ticks            Number of clock ticks.
- */
-static void pwm_transition_n_to_m(app_pwm_t const * const p_instance,
-                                  uint8_t channel, uint16_t ticks)
-{
-    app_pwm_cb_t            * p_cb     = p_instance->p_cb;
-    app_pwm_channel_cb_t    * p_ch_cb  = &p_cb->channels_cb[channel];
-    nrf_ppi_channel_group_t   p_ppigrp = p_cb->ppi_group;
-
-    pwm_ppi_disable(p_instance);
-    nrf_drv_ppi_group_clear(p_ppigrp);
-    nrf_drv_ppi_channels_include_in_group(
-        nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[0]) | 
-        nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[1]),
-        p_ppigrp);
-
-    nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
-                nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL),
-                nrf_drv_timer_capture_task_address_get(p_instance->p_timer, channel));
-
-#ifdef NRF52
-    if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == 
-        (m_use_ppi_delay_workaround ? NRF_TIMER_FREQ_8MHz : NRF_TIMER_FREQ_16MHz) ) ? 1 : 0)
-        < p_ch_cb->pulsewidth)
-#else
-    if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1 : 0)
-        < p_ch_cb->pulsewidth)
-#endif
-    {
-        // For lower value, we need one more transition. Timer task delay is included.
-        // If prescaler is disabled, one tick must be added because of 1 PCLK16M clock cycle delay.
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
-                nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL),
-                nrf_drv_gpiote_out_task_addr_get(p_ch_cb->gpio_pin));
-    }
-    else
-    {
-        nrf_drv_ppi_channel_remove_from_group(p_cb->ppi_channels[1], p_ppigrp);
-    }
-    p_ch_cb->pulsewidth = ticks;
-    nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, ticks, false);
-    nrf_drv_ppi_group_enable(p_ppigrp);
-    
-    m_pwm_target_value[p_instance->p_timer->instance_id] = ticks;
-    m_pwm_busy[p_instance->p_timer->instance_id] = channel;
-}
-
-
-/**
- * @brief PWM state transition from 0% or 100% to (0%, 100%).
- *
- * @param[in] p_instance       PWM instance.
- * @param[in] channel          PWM channel number.
- * @param[in] ticks            Number of clock ticks.
- */
-static void pwm_transition_0or100_to_n(app_pwm_t const * const p_instance,
-                                       uint8_t channel, uint16_t ticks)
-{
-    app_pwm_cb_t            * p_cb      = p_instance->p_cb;
-    app_pwm_channel_cb_t    * p_ch_cb   = &p_cb->channels_cb[channel];
-    nrf_ppi_channel_group_t   p_ppigrp  = p_cb->ppi_group;
-    nrf_timer_cc_channel_t    pwm_ch_cc = (nrf_timer_cc_channel_t)(channel);
-
-    pwm_ppi_disable(p_instance);
-    pwm_channel_ppi_disable(p_instance, channel);
-
-    nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false);
-    nrf_drv_ppi_group_clear(p_ppigrp);
-    nrf_drv_ppi_channels_include_in_group(
-        nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0])|
-        nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[1]),
-        p_ppigrp);
-
-    if (!p_ch_cb->pulsewidth)
-    {
-        // Channel is at 0%.
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
-                    nrf_drv_ppi_task_addr_group_enable_get(p_ppigrp));
-        nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 0, false);
-        m_pwm_target_value[p_instance->p_timer->instance_id] = 
-            nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) channel);
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
-                    nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
-       
-    }
-    else
-    {
-        // Channel is at 100%.
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
-                    nrf_drv_ppi_task_addr_group_enable_get(p_ppigrp));
-        // Set secondary CC channel to non-zero value:
-        nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 1, false);
-        m_pwm_target_value[p_instance->p_timer->instance_id] = 0;
-        // The captured value will be equal to 0, because timer clear on main PWM CC channel compare is enabled.
-        nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
-                    nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
-                    nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
-    }
-    nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]);
-    nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]);
-    
-    p_ch_cb->pulsewidth = ticks;
-    m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL;
-}
-
-
-/**
- * @brief PWM state transition from 0% or 100% to 0% or 100%.
- *
- * @param[in] p_instance       PWM instance.
- * @param[in] channel          PWM channel number.
- * @param[in] ticks            Number of clock ticks.
- */
-static void pwm_transition_0or100_to_0or100(app_pwm_t const * const p_instance,
-                                            uint8_t channel, uint16_t ticks)
-{
-    app_pwm_cb_t         * p_cb      = p_instance->p_cb;
-    app_pwm_channel_cb_t * p_ch_cb   = &p_cb->channels_cb[channel];
-    nrf_timer_cc_channel_t pwm_ch_cc = (nrf_timer_cc_channel_t)(channel);
-
-    pwm_ppi_disable(p_instance);
-    pwm_channel_ppi_disable(p_instance, channel);
-    if (!ticks)
-    {
-        // Set to 0%.
-        nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_INACTIVE(p_instance, channel));
-    }
-    else if (ticks >= p_cb->period)
-    {
-        // Set to 100%.
-        ticks = p_cb->period;
-        nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_ACTIVE(p_instance, channel));
-    }
-    nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false);
-    p_ch_cb->pulsewidth = ticks;
-    
-    m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
-    return;
-}
-
-
-ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance,
-                                          uint8_t           channel,
-                                          uint16_t          ticks)
-{
-    app_pwm_cb_t         * p_cb    = p_instance->p_cb;
-    app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
-
-    ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE);
-    ASSERT(p_ch_cb->initialized == APP_PWM_CHANNEL_INITIALIZED);
-
-    if (p_cb->state != NRF_DRV_STATE_POWERED_ON)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if (ticks == p_ch_cb->pulsewidth)
-    {
-        if (p_cb->p_ready_callback)
-        {
-            p_cb->p_ready_callback(p_instance->p_timer->instance_id);
-        }
-        return NRF_SUCCESS;     // No action required.
-    }
-    if (app_pwm_busy_check(p_instance))
-    {
-        return NRF_ERROR_BUSY;  // PPI channels for synchronization are still in use.
-    }
-    
-    m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_CHANGING;
-
-    // Pulse width change sequence:
-    if (!p_ch_cb->pulsewidth || p_ch_cb->pulsewidth >= p_cb->period)
-    {
-        // Channel is disabled (0%) or at 100%.
-        if (!ticks || ticks >= p_cb->period)
-        {
-            // Set to 0 or 100%.
-            pwm_transition_0or100_to_0or100(p_instance, channel, ticks);
-        }
-        else
-        {
-            // Other value.
-            pwm_transition_0or100_to_n(p_instance, channel, ticks);
-        }
-    }
-    else
-    {
-        // Channel is at other value.
-        if (!ticks || ticks >= p_cb->period)
-        {
-            // Disable channel (set to 0%) or set to 100%.
-            pwm_transition_n_to_0or100(p_instance, channel, ticks);
-        }
-        else
-        {
-            // Set to any other value.
-            pwm_transition_n_to_m(p_instance, channel, ticks);
-        }
-    }
-    if (p_instance->p_cb->p_ready_callback)
-    {
-        //PWM ready interrupt handler will be called after one full period.
-        m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 2;
-        pwm_irq_enable(p_instance);
-    }
-    return NRF_SUCCESS;
-}
-
-uint16_t app_pwm_channel_duty_ticks_get(app_pwm_t const * const p_instance, uint8_t channel)
-{
-    app_pwm_cb_t         * p_cb      = p_instance->p_cb;
-    app_pwm_channel_cb_t * p_ch_cb   = &p_cb->channels_cb[channel];
-
-    return p_ch_cb->pulsewidth;
-}
-
-uint16_t app_pwm_cycle_ticks_get(app_pwm_t const * const p_instance)
-{
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    return (uint16_t)p_cb->period;
-}
-
-ret_code_t app_pwm_channel_duty_set(app_pwm_t const * const p_instance,
-                                  uint8_t channel, app_pwm_duty_t duty)
-{
-    uint32_t ticks = ((uint32_t)app_pwm_cycle_ticks_get(p_instance) * (uint32_t)duty) / 100UL;
-    return app_pwm_channel_duty_ticks_set(p_instance, channel, ticks);
-}
-
-
-app_pwm_duty_t app_pwm_channel_duty_get(app_pwm_t const * const p_instance, uint8_t channel)
-{
-    uint32_t value = ((uint32_t)app_pwm_channel_duty_ticks_get(p_instance, channel) * 100UL) \
-                     / (uint32_t)app_pwm_cycle_ticks_get(p_instance);
-
-    return (app_pwm_duty_t)value;
-}
-
-
-/**
- * @brief Function for initializing the PWM channel.
- *
- * @param[in] p_instance       PWM instance.
- * @param[in] channel          Channel number.
- * @param[in] pin              GPIO pin number.
- *
- * @retval    NRF_SUCCESS If initialization was successful.
- * @retval    NRF_ERROR_NO_MEM If there were not enough free resources.
- * @retval    NRF_ERROR_INVALID_STATE If the timer is already in use or initialization failed.
- */
-static ret_code_t app_pwm_channel_init(app_pwm_t const * const p_instance, uint8_t channel,
-                                     uint32_t pin, app_pwm_polarity_t polarity)
-{
-    ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE);
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-    app_pwm_channel_cb_t * p_channel_cb = &p_cb->channels_cb[channel];
-
-    if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    p_channel_cb->pulsewidth = 0;
-    p_channel_cb->polarity   = polarity;
-    ret_code_t err_code;
-
-    /* GPIOTE setup: */
-    nrf_drv_gpiote_out_config_t out_cfg = GPIOTE_CONFIG_OUT_TASK_TOGGLE( POLARITY_INACTIVE(p_instance, channel) );
-    err_code = nrf_drv_gpiote_out_init((nrf_drv_gpiote_pin_t)pin,&out_cfg);
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    p_cb->channels_cb[channel].gpio_pin = pin;
-
-    // Set output to inactive state.
-    if (polarity)
-    {
-        nrf_gpio_pin_clear(pin);
-    }
-    else
-    {
-        nrf_gpio_pin_set(pin);
-    }
-
-    /* PPI setup: */
-    for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL; ++i)
-    {
-        if (nrf_drv_ppi_channel_alloc(&p_channel_cb->ppi_channels[i]) != NRF_SUCCESS)
-        {
-            return NRF_ERROR_NO_MEM; // Resource de-allocation is done by callee.
-        }
-    }
-
-    nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[0]);
-    nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[1]);
-    nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[0],
-                               nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
-                               nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin));
-    nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[1],
-                               nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
-                               nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin));
-
-    p_channel_cb->initialized = APP_PWM_CHANNEL_INITIALIZED;
-    m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 0;
-
-    return NRF_SUCCESS;
-}
-
-
-/**
- * @brief Function for calculating target timer frequency, which will allow to set given period length.
- *
- * @param[in] period_us       Desired period in microseconds.
- *
- * @retval    Timer frequency.
- */
-__STATIC_INLINE nrf_timer_frequency_t pwm_calculate_timer_frequency(uint32_t period_us)
-{
-    uint32_t f   = (uint32_t) NRF_TIMER_FREQ_16MHz;
-    uint32_t min = (uint32_t) NRF_TIMER_FREQ_31250Hz;
-
-    while ((period_us > TIMER_MAX_PULSEWIDTH_US_ON_16M) && (f < min))
-    {
-        period_us >>= 1;
-        ++f;
-    }
-
-#ifdef NRF52
-    if ((m_use_ppi_delay_workaround) && (f == (uint32_t) NRF_TIMER_FREQ_16MHz))
-    {
-        f = (uint32_t) NRF_TIMER_FREQ_8MHz;
-    }
-#endif
-
-    return (nrf_timer_frequency_t) f;
-}
-
-
-ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t const * const p_config,
-                        app_pwm_callback_t p_ready_callback)
-{
-    ASSERT(p_instance);
-
-    if (!p_config)
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    uint32_t err_code = nrf_drv_ppi_init();
-    if ((err_code != NRF_SUCCESS) && (err_code != MODULE_ALREADY_INITIALIZED))
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-
-    if (!nrf_drv_gpiote_is_init())
-    {
-        err_code = nrf_drv_gpiote_init();
-        if (err_code != NRF_SUCCESS)
-		{
-			return NRF_ERROR_INTERNAL;
-		}
-    }
-
-#ifdef NRF52
-    if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30)
-    {
-        m_use_ppi_delay_workaround = false;
-    }
-    else
-    {
-        m_use_ppi_delay_workaround = true;
-    }
-#endif
-    
-    // Innitialize resource status:
-    p_cb->ppi_channels[0] = (nrf_ppi_channel_t)UNALLOCATED;
-    p_cb->ppi_channels[1] = (nrf_ppi_channel_t)UNALLOCATED;
-    p_cb->ppi_group       = (nrf_ppi_channel_group_t)UNALLOCATED;
-
-    for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i)
-    {
-        p_cb->channels_cb[i].initialized     = APP_PWM_CHANNEL_UNINITIALIZED;
-        p_cb->channels_cb[i].ppi_channels[0] = (nrf_ppi_channel_t)UNALLOCATED;
-        p_cb->channels_cb[i].ppi_channels[1] = (nrf_ppi_channel_t)UNALLOCATED;
-        p_cb->channels_cb[i].gpio_pin        = UNALLOCATED;
-    }
-
-    // Allocate PPI channels and groups:
-    for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i)
-    {
-        if (nrf_drv_ppi_channel_alloc(&p_cb->ppi_channels[i]) != NRF_SUCCESS)
-        {
-            pwm_dealloc(p_instance);
-            return NRF_ERROR_NO_MEM;
-        }
-    }
-    if (nrf_drv_ppi_group_alloc(&p_cb->ppi_group) != NRF_SUCCESS)
-    {
-        pwm_dealloc(p_instance);
-        return NRF_ERROR_NO_MEM;
-    }
-
-    // Initialize channels:
-    for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i)
-    {
-        if (p_config->pins[i] != APP_PWM_NOPIN)
-        {
-            err_code = app_pwm_channel_init(p_instance, i, p_config->pins[i], p_config->pin_polarity[i]);
-            if (err_code != NRF_SUCCESS)
-            {
-                pwm_dealloc(p_instance);
-                return err_code;
-            }
-            app_pwm_channel_duty_ticks_set(p_instance, i, 0);
-        }
-    }
-
-    // Initialize timer:
-    nrf_timer_frequency_t  timer_freq = pwm_calculate_timer_frequency(p_config->period_us);
-    nrf_drv_timer_config_t timer_cfg  = {
-        .frequency          = timer_freq,
-        .mode               = NRF_TIMER_MODE_TIMER,
-        .bit_width          = NRF_TIMER_BIT_WIDTH_16,
-        .interrupt_priority = APP_IRQ_PRIORITY_LOW,
-        .p_context          = (void *) (uint32_t) p_instance->p_timer->instance_id
-    };
-    err_code = nrf_drv_timer_init(p_instance->p_timer, &timer_cfg,
-                                  pwm_ready_tick);
-    if (err_code != NRF_SUCCESS)
-    {
-        pwm_dealloc(p_instance);
-        return err_code;
-    }
-
-    uint32_t ticks = nrf_drv_timer_us_to_ticks(p_instance->p_timer, p_config->period_us);
-    p_cb->period = ticks;
-    nrf_drv_timer_clear(p_instance->p_timer);
-    nrf_drv_timer_extended_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_MAIN_CC_CHANNEL,
-                                    ticks, NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK, true);
-    nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
-
-    p_cb->p_ready_callback = p_ready_callback;
-    m_instances[p_instance->p_timer->instance_id] = p_instance;
-    m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-
-void app_pwm_enable(app_pwm_t const * const p_instance)
-{
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-
-    for (uint32_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel)
-    {
-        app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
-        m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 0;
-        if (p_ch_cb->initialized)
-        {
-            nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_INACTIVE(p_instance, channel));
-            nrf_drv_gpiote_out_task_enable(p_ch_cb->gpio_pin);
-            p_ch_cb->pulsewidth = 0;
-        }
-    }
-    m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
-    pan73_workaround(p_instance->p_timer->p_reg, true);
-    nrf_drv_timer_clear(p_instance->p_timer);
-    nrf_drv_timer_enable(p_instance->p_timer);
-
-    p_cb->state = NRF_DRV_STATE_POWERED_ON;
-    return;
-}
-
-
-void app_pwm_disable(app_pwm_t const * const p_instance)
-{
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-
-    nrf_drv_timer_disable(p_instance->p_timer);
-    pwm_irq_disable(p_instance);
-    for (uint8_t ppi_channel = 0; ppi_channel < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++ppi_channel)
-    {
-        nrf_drv_ppi_channel_disable(p_cb->ppi_channels[ppi_channel]);
-    }
-    for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel)
-    {
-        app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
-        if (p_ch_cb->initialized)
-        {
-            uint8_t polarity = POLARITY_INACTIVE(p_instance, channel);
-            if (polarity)
-            {
-                nrf_gpio_pin_set(p_ch_cb->gpio_pin);
-            }
-            else
-            {
-                nrf_gpio_pin_clear(p_ch_cb->gpio_pin);
-            }
-            nrf_drv_gpiote_out_task_disable(p_ch_cb->gpio_pin);
-            nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[0]);
-            nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[1]);
-        }
-    }
-    pan73_workaround(p_instance->p_timer->p_reg, false);
-
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-    return;
-}
-
-
-ret_code_t app_pwm_uninit(app_pwm_t const * const p_instance)
-{
-    app_pwm_cb_t * p_cb = p_instance->p_cb;
-
-    if (p_cb->state == NRF_DRV_STATE_POWERED_ON)
-    {
-        app_pwm_disable(p_instance);
-    }
-    else if (p_cb->state == NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    pwm_dealloc(p_instance);
-
-    p_cb->state = NRF_DRV_STATE_UNINITIALIZED;
-    return NRF_SUCCESS;
-}
-
-
-//lint -restore

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/pwm/app_pwm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/pwm/app_pwm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/pwm/app_pwm.h
deleted file mode 100644
index eb3c1d4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/pwm/app_pwm.h
+++ /dev/null
@@ -1,303 +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
- *
- * @defgroup app_pwm Pulse-width modulation (PWM)
- * @{
- * @ingroup app_common
- *
- * @brief Module for generating a pulse-width modulated output signal.
- *
- * @details This module provides a PWM implementation using timers, GPIOTE, and PPI.
- *
- * Resource usage:
- * - 2 PPI channels per instance + 2 PPI channels per PWM channel.
- * - 1 PPI group per instance.
- * - 1 GPIOTE channel per PWM channel.
- *
- * For example, a PWM instance with two channels will consume 2+4 PPI channels, 1 PPI group, and 2 GPIOTE channels.
- *
- * The maximum number of PWM channels per instance is 2.
- */
-
-#ifndef APP_PWM_H__
-#define APP_PWM_H__
-
-#include <stdint.h>
-#include "sdk_errors.h"
-#include "nrf_drv_timer.h"
-#include "nrf_drv_common.h"
-#include "nrf_drv_ppi.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define APP_PWM_NOPIN                 0xFFFFFFFF
-
-/** @brief Number of channels for one timer instance (fixed to 2 due to timer properties).*/
-#define APP_PWM_CHANNELS_PER_INSTANCE 2
-
-/**@brief Macro for creating a PWM instance. */
-#define APP_PWM_INSTANCE(name, num)                                           \
-    const nrf_drv_timer_t m_pwm_##name##_timer = NRF_DRV_TIMER_INSTANCE(num); \
-    app_pwm_cb_t m_pwm_##name##_cb;                                           \
-    /*lint -e{545}*/                                                          \
-    const app_pwm_t name = {                                                  \
-        .p_cb    = &m_pwm_##name##_cb,                                        \
-        .p_timer = &m_pwm_##name##_timer,                                     \
-    }
-
-
-/**@brief PWM instance default configuration (1 channel). */
-#define APP_PWM_DEFAULT_CONFIG_1CH(period_in_us, pin)                                  \
-    {                                                                                  \
-        .pins            = {pin, APP_PWM_NOPIN},                                       \
-        .pin_polarity    = {APP_PWM_POLARITY_ACTIVE_LOW, APP_PWM_POLARITY_ACTIVE_LOW}, \
-        .num_of_channels = 1,                                                          \
-        .period_us       = period_in_us                                                \
-    }
-
-/**@brief PWM instance default configuration (2 channels). */
-#define APP_PWM_DEFAULT_CONFIG_2CH(period_in_us, pin0, pin1)                           \
-    {                                                                                  \
-        .pins            = {pin0, pin1},                                               \
-        .pin_polarity    = {APP_PWM_POLARITY_ACTIVE_LOW, APP_PWM_POLARITY_ACTIVE_LOW}, \
-        .num_of_channels = 2,                                                          \
-        .period_us       = period_in_us                                                \
-    }
-
-typedef uint16_t app_pwm_duty_t;
-
-/**
- * @brief PWM callback that is executed when a PWM duty change has been completed.
- *
- * @param[in] pwm_id  PWM instance ID.
- */
-typedef void (* app_pwm_callback_t)(uint32_t);
-
-/**
- * @brief Channel polarity.
- */
-typedef enum
-{
-    APP_PWM_POLARITY_ACTIVE_LOW  = 0,
-    APP_PWM_POLARITY_ACTIVE_HIGH = 1
-} app_pwm_polarity_t;
-
-/**@brief PWM configuration structure used for initialization. */
-typedef struct
-{
-    uint32_t           pins[APP_PWM_CHANNELS_PER_INSTANCE];         //!< Pins configured as PWM output.
-    app_pwm_polarity_t pin_polarity[APP_PWM_CHANNELS_PER_INSTANCE]; //!< Polarity of active state on pin.
-    uint32_t           num_of_channels;                             //!< Number of channels that can be used.
-    uint32_t           period_us;                                   //!< PWM signal output period to configure (in microseconds).
-} app_pwm_config_t;
-
-
-/**
- * @cond (NODOX)
- * @defgroup app_pwm_internal Auxiliary internal types declarations
- * @{
- * @internal
- *
- * @brief Module for internal usage inside the library only
- *
- * There are some definitions that must be included in the header file because 
- * of the way the library is set up. In this way, the are accessible to the user.
- * However, any functions and variables defined here may change at any time 
- * without a warning, so you should not access them directly.
- */
-
-    /**
-     * @brief PWM channel instance
-     *
-     * This structure holds all data needed by a single PWM channel.
-     */
-    typedef struct
-    {
-        uint32_t           gpio_pin;        //!< Pin that is used by this PWM channel.
-        uint32_t           pulsewidth;      //!< The copy of duty currently set (in ticks).
-        nrf_ppi_channel_t  ppi_channels[2]; //!< PPI channels used by the PWM channel to clear and set the output.
-        app_pwm_polarity_t polarity;        //!< The active state of the pin.
-        uint8_t            initialized;     //!< The internal information if the selected channel was initialized.
-    } app_pwm_channel_cb_t;
-
-    /**
-     * @brief Variable part of PWM instance
-     *
-     * This structure holds instance data that may change.
-     */
-    typedef struct
-    {
-        app_pwm_channel_cb_t    channels_cb[APP_PWM_CHANNELS_PER_INSTANCE]; //!< Channels data
-        uint32_t                period;                                     //!< Selected period in ticks
-        app_pwm_callback_t      p_ready_callback;                           //!< Callback function called on PWM readiness
-        nrf_ppi_channel_t       ppi_channels[2];                            //!< PPI channels used temporary while changing duty
-        nrf_ppi_channel_group_t ppi_group;                                  //!< PPI group used to synchronize changes on channels
-        nrf_drv_state_t         state;                                      //!< Current driver status
-    } app_pwm_cb_t;
-/** @}
- * @endcond
- */
-
-
-/**@brief PWM instance structure. */
-typedef struct
-{
-    app_pwm_cb_t *p_cb;                    //!< Pointer to control block internals.
-    nrf_drv_timer_t const * const p_timer; //!< Timer used by this PWM instance.
-} app_pwm_t;
-
-/**
- * @brief Function for checking if the PWM instance is busy updating the duty cycle.
- *
- * @param[in] p_instance  PWM instance.
- *
- * @retval True  If the PWM instance is ready for duty cycle changes.
- * @retval False If a change operation is in progress.
- */
-bool app_pwm_busy_check(app_pwm_t const * const p_instance);
-
-/**
- * @brief Function for initializing a PWM instance.
- *
- * @param[in] p_instance        PWM instance.
- * @param[in] p_config          Initial configuration.
- * @param[in] p_ready_callback  Pointer to ready callback function (or NULL to disable).
- *
- * @retval    NRF_SUCCESS If initialization was successful.
- * @retval    NRF_ERROR_NO_MEM If there were not enough free resources.
- * @retval    NRF_ERROR_INVALID_PARAM If an invalid configuration structure was passed.
- * @retval    NRF_ERROR_INVALID_STATE If the timer/PWM is already in use or if initialization failed.
- */
-ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t const * const p_config,
-                        app_pwm_callback_t p_ready_callback);
-
-
-/**
- * @brief Function for uninitializing a PWM instance and releasing the allocated resources.
- *
- * @param[in] p_instance  PWM instance.
- *
- * @retval    NRF_SUCCESS If uninitialization was successful.
- * @retval    NRF_ERROR_INVALID_STATE If the given instance was not initialized.
- */
-ret_code_t app_pwm_uninit(app_pwm_t const * const p_instance);
-
-/**
- * @brief Function for enabling a PWM instance after initialization.
- *
- * @param[in] p_instance  PWM instance.
- */
-void app_pwm_enable(app_pwm_t const * const p_instance);
-
-/**
- * @brief Function for disabling a PWM instance after initialization.
- *
- * @param[in] p_instance  PWM instance.
- */
-void app_pwm_disable(app_pwm_t const * const p_instance);
-
-/**
- * @brief Function for setting the PWM channel duty cycle in percents.
- *
- * A duty cycle change requires one full PWM clock period to finish.
- * If another change is attempted for any channel of given instance before
- * the current change is complete, the new attempt will result in the error
- * NRF_ERROR_BUSY.
- *
- * @param[in] p_instance  PWM instance.
- * @param[in] channel     Channel number.
- * @param[in] duty        Duty cycle (0 - 100).
- *
- * @retval    NRF_SUCCESS If the operation was successful.
- * @retval    NRF_ERROR_BUSY If the PWM is not ready yet.
- * @retval    NRF_ERROR_INVALID_STATE If the given instance was not initialized.
- *
- */
-ret_code_t app_pwm_channel_duty_set(app_pwm_t const * const p_instance,
-                                  uint8_t channel, app_pwm_duty_t duty);
-
-/**
- * @brief Function for retrieving the PWM channel duty cycle in percents.
- *
- * @param[in] p_instance  PWM instance.
- * @param[in] channel     Channel number.
- *
- * @return    Duty cycle value.
- */
-app_pwm_duty_t app_pwm_channel_duty_get(app_pwm_t const * const p_instance, uint8_t channel);
-
-
-/**
- * @name Functions accessing values in ticks
- *
- * Auxiliary functions that allow to get values in actual timer ticks.
- * @{
- */
-
-    /**
-     * @brief Function for setting PWM channel duty cycle in clock ticks.
-     *
-     * @note      Duty cycle changes require one full PWM clock period to finish.
-     *            Until that, the next change attempt (for any channel of given instance)
-     *            will result in an NRF_ERROR_BUSY error.
-     *
-     * @param[in] p_instance  PWM instance.
-     * @param[in] channel     Channel number.
-     * @param[in] ticks       Number of PWM clock ticks.
-     *
-     * @retval    NRF_SUCCESS If the operation was successful.
-     * @retval    NRF_ERROR_BUSY If PWM is not ready yet.
-     * @retval    NRF_ERROR_INVALID_STATE If the given instance was not initialized.
-     */
-    ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance,
-                                              uint8_t           channel,
-                                              uint16_t          ticks);
-
-
-    /**
-     * @brief Function for retrieving the PWM channel duty cycle in ticks.
-     *
-     * This function retrieves the real, currently set duty cycle in ticks.
-     * For one full PWM cycle the value might be different than the value set by the last
-     * @ref app_pwm_channel_duty_ticks_set function call.
-     *
-     * @param[in] p_instance  PWM instance.
-     * @param[in] channel     Channel number.
-     *
-     * @return    Number of ticks set for selected channel.
-     *
-     */
-    uint16_t app_pwm_channel_duty_ticks_get(app_pwm_t const * const p_instance, uint8_t channel);
-
-    /**
-     * @brief Function for returning the number of ticks in a whole cycle.
-     *
-     * @param[in] p_instance  PWM instance.
-     *
-     * @return    Number of ticks that corresponds to 100% of the duty cycle.
-     */
-    uint16_t app_pwm_cycle_ticks_get(app_pwm_t const * const p_instance);
-/** @} */
-
-
-#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/scheduler/app_scheduler.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler.c
deleted file mode 100644
index 829d7f9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright (c) 2012 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 "app_scheduler.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include "nrf_soc.h"
-#include "nrf_assert.h"
-#include "app_util.h"
-#include "app_util_platform.h"
-
-/**@brief Structure for holding a scheduled event header. */
-typedef struct
-{
-    app_sched_event_handler_t handler;          /**< Pointer to event handler to receive the event. */
-    uint16_t                  event_data_size;  /**< Size of event data. */
-} event_header_t;
-
-STATIC_ASSERT(sizeof(event_header_t) <= APP_SCHED_EVENT_HEADER_SIZE);
-
-static event_header_t * m_queue_event_headers;  /**< Array for holding the queue event headers. */
-static uint8_t        * m_queue_event_data;     /**< Array for holding the queue event data. */
-static volatile uint8_t m_queue_start_index;    /**< Index of queue entry at the start of the queue. */
-static volatile uint8_t m_queue_end_index;      /**< Index of queue entry at the end of the queue. */
-static uint16_t         m_queue_event_size;     /**< Maximum event size in queue. */
-static uint16_t         m_queue_size;           /**< Number of queue entries. */
-
-#ifdef APP_SCHEDULER_WITH_PROFILER
-static uint16_t m_max_queue_utilization;    /**< Maximum observed queue utilization. */
-#endif
-
-/**@brief Function for incrementing a queue index, and handle wrap-around.
- *
- * @param[in]   index   Old index.
- *
- * @return      New (incremented) index.
- */
-static __INLINE uint8_t next_index(uint8_t index)
-{
-    return (index < m_queue_size) ? (index + 1) : 0;
-}
-
-
-static __INLINE uint8_t app_sched_queue_full()
-{
-  uint8_t tmp = m_queue_start_index;
-  return next_index(m_queue_end_index) == tmp;
-}
-
-/**@brief Macro for checking if a queue is full. */
-#define APP_SCHED_QUEUE_FULL() app_sched_queue_full()
-
-
-static __INLINE uint8_t app_sched_queue_empty()
-{
-  uint8_t tmp = m_queue_start_index;
-  return m_queue_end_index == tmp;
-}
-
-/**@brief Macro for checking if a queue is empty. */
-#define APP_SCHED_QUEUE_EMPTY() app_sched_queue_empty()
-
-
-uint32_t app_sched_init(uint16_t event_size, uint16_t queue_size, void * p_event_buffer)
-{
-    uint16_t data_start_index = (queue_size + 1) * sizeof(event_header_t);
-
-    // Check that buffer is correctly aligned
-    if (!is_word_aligned(p_event_buffer))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    // Initialize event scheduler
-    m_queue_event_headers = p_event_buffer;
-    m_queue_event_data    = &((uint8_t *)p_event_buffer)[data_start_index];
-    m_queue_end_index     = 0;
-    m_queue_start_index   = 0;
-    m_queue_event_size    = event_size;
-    m_queue_size          = queue_size;
-
-#ifdef APP_SCHEDULER_WITH_PROFILER
-    m_max_queue_utilization = 0;
-#endif
-
-    return NRF_SUCCESS;
-}
-
-
-#ifdef APP_SCHEDULER_WITH_PROFILER
-static void queue_utilization_check(void)
-{
-    uint16_t start = m_queue_start_index;
-    uint16_t end   = m_queue_end_index;
-    uint16_t queue_utilization = (end >= start) ? (end - start) :
-        (m_queue_size + 1 - start + end);
-
-    if (queue_utilization > m_max_queue_utilization)
-    {
-        m_max_queue_utilization = queue_utilization;
-    }
-}
-
-uint16_t app_sched_queue_utilization_get(void)
-{
-    return m_max_queue_utilization;
-}
-#endif
-
-
-uint32_t app_sched_event_put(void                    * p_event_data,
-                             uint16_t                  event_data_size,
-                             app_sched_event_handler_t handler)
-{
-    uint32_t err_code;
-
-    if (event_data_size <= m_queue_event_size)
-    {
-        uint16_t event_index = 0xFFFF;
-
-        CRITICAL_REGION_ENTER();
-
-        if (!APP_SCHED_QUEUE_FULL())
-        {
-            event_index       = m_queue_end_index;
-            m_queue_end_index = next_index(m_queue_end_index);
-
-        #ifdef APP_SCHEDULER_WITH_PROFILER
-            // This function call must be protected with critical region because
-            // it modifies 'm_max_queue_utilization'.
-            queue_utilization_check();
-        #endif
-        }
-
-        CRITICAL_REGION_EXIT();
-
-        if (event_index != 0xFFFF)
-        {
-            // NOTE: This can be done outside the critical region since the event consumer will
-            //       always be called from the main loop, and will thus never interrupt this code.
-            m_queue_event_headers[event_index].handler = handler;
-            if ((p_event_data != NULL) && (event_data_size > 0))
-            {
-                memcpy(&m_queue_event_data[event_index * m_queue_event_size],
-                       p_event_data,
-                       event_data_size);
-                m_queue_event_headers[event_index].event_data_size = event_data_size;
-            }
-            else
-            {
-                m_queue_event_headers[event_index].event_data_size = 0;
-            }
-
-            err_code = NRF_SUCCESS;
-        }
-        else
-        {
-            err_code = NRF_ERROR_NO_MEM;
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_INVALID_LENGTH;
-    }
-
-    return err_code;
-}
-
-
-/**@brief Function for reading the next event from specified event queue.
- *
- * @param[out]  pp_event_data       Pointer to pointer to event data.
- * @param[out]  p_event_data_size   Pointer to size of event data.
- * @param[out]  p_event_handler     Pointer to event handler function pointer.
- *
- * @return      NRF_SUCCESS if new event, NRF_ERROR_NOT_FOUND if event queue is empty.
- */
-static uint32_t app_sched_event_get(void                     ** pp_event_data,
-                                    uint16_t *                  p_event_data_size,
-                                    app_sched_event_handler_t * p_event_handler)
-{
-    uint32_t err_code = NRF_ERROR_NOT_FOUND;
-
-    if (!APP_SCHED_QUEUE_EMPTY())
-    {
-        uint16_t event_index;
-
-        // NOTE: There is no need for a critical region here, as this function will only be called
-        //       from app_sched_execute() from inside the main loop, so it will never interrupt
-        //       app_sched_event_put(). Also, updating of (i.e. writing to) the start index will be
-        //       an atomic operation.
-        event_index         = m_queue_start_index;
-        m_queue_start_index = next_index(m_queue_start_index);
-
-        *pp_event_data     = &m_queue_event_data[event_index * m_queue_event_size];
-        *p_event_data_size = m_queue_event_headers[event_index].event_data_size;
-        *p_event_handler   = m_queue_event_headers[event_index].handler;
-
-        err_code = NRF_SUCCESS;
-    }
-
-    return err_code;
-}
-
-
-void app_sched_execute(void)
-{
-    void                    * p_event_data;
-    uint16_t                  event_data_size;
-    app_sched_event_handler_t event_handler;
-
-    // Get next event (if any), and execute handler
-    while ((app_sched_event_get(&p_event_data, &event_data_size, &event_handler) == NRF_SUCCESS))
-    {
-        event_handler(p_event_data, event_data_size);
-    }
-}

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/scheduler/app_scheduler.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler.h
deleted file mode 100644
index 40cb562..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Copyright (c) 2012 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 app_scheduler Scheduler
- * @{
- * @ingroup app_common
- *
- * @brief The scheduler is used for transferring execution from the interrupt context to the main
- *        context.
- *
- * @details See @ref seq_diagrams_sched for sequence diagrams illustrating the flow of events
- *          when using the Scheduler.
- *
- * @section app_scheduler_req Requirements:
- *
- * @subsection main_context_logic Logic in main context:
- *
- *   - Define an event handler for each type of event expected.
- *   - Initialize the scheduler by calling the APP_SCHED_INIT() macro before entering the
- *     application main loop.
- *   - Call app_sched_execute() from the main loop each time the application wakes up because of an
- *     event (typically when sd_app_evt_wait() returns).
- *
- * @subsection int_context_logic Logic in interrupt context:
- *
- *   - In the interrupt handler, call app_sched_event_put()
- *     with the appropriate data and event handler. This will insert an event into the
- *     scheduler's queue. The app_sched_execute() function will pull this event and call its
- *     handler in the main context.
- *
- * @if (PERIPHERAL)
- * For an example usage of the scheduler, see the implementations of
- * @ref ble_sdk_app_hids_mouse and @ref ble_sdk_app_hids_keyboard.
- * @endif
- *
- * @image html scheduler_working.jpg The high level design of the scheduler
- */
-
-#ifndef APP_SCHEDULER_H__
-#define APP_SCHEDULER_H__
-
-#include <stdint.h>
-#include "app_error.h"
-#include "app_util.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define APP_SCHED_EVENT_HEADER_SIZE 8       /**< Size of app_scheduler.event_header_t (only for use inside APP_SCHED_BUF_SIZE()). */
-
-/**@brief Compute number of bytes required to hold the scheduler buffer.
- *
- * @param[in] EVENT_SIZE   Maximum size of events to be passed through the scheduler.
- * @param[in] QUEUE_SIZE   Number of entries in scheduler queue (i.e. the maximum number of events
- *                         that can be scheduled for execution).
- *
- * @return    Required scheduler buffer size (in bytes).
- */
-#define APP_SCHED_BUF_SIZE(EVENT_SIZE, QUEUE_SIZE)                                                 \
-            (((EVENT_SIZE) + APP_SCHED_EVENT_HEADER_SIZE) * ((QUEUE_SIZE) + 1))
-            
-/**@brief Scheduler event handler type. */
-typedef void (*app_sched_event_handler_t)(void * p_event_data, uint16_t event_size);
-
-/**@brief Macro for initializing the event scheduler.
- *
- * @details It will also handle dimensioning and allocation of the memory buffer required by the
- *          scheduler, making sure the buffer is correctly aligned.
- *
- * @param[in] EVENT_SIZE   Maximum size of events to be passed through the scheduler.
- * @param[in] QUEUE_SIZE   Number of entries in scheduler queue (i.e. the maximum number of events
- *                         that can be scheduled for execution).
- *
- * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it
- *       several times as long as it is from the same location, e.g. to do a reinitialization).
- */
-#define APP_SCHED_INIT(EVENT_SIZE, QUEUE_SIZE)                                                     \
-    do                                                                                             \
-    {                                                                                              \
-        static uint32_t APP_SCHED_BUF[CEIL_DIV(APP_SCHED_BUF_SIZE((EVENT_SIZE), (QUEUE_SIZE)),     \
-                                               sizeof(uint32_t))];                                 \
-        uint32_t ERR_CODE = app_sched_init((EVENT_SIZE), (QUEUE_SIZE), APP_SCHED_BUF);             \
-        APP_ERROR_CHECK(ERR_CODE);                                                                 \
-    } while (0)
-
-/**@brief Function for initializing the Scheduler.
- *
- * @details It must be called before entering the main loop.
- *
- * @param[in]   max_event_size   Maximum size of events to be passed through the scheduler.
- * @param[in]   queue_size       Number of entries in scheduler queue (i.e. the maximum number of
- *                               events that can be scheduled for execution).
- * @param[in]   p_evt_buffer   Pointer to memory buffer for holding the scheduler queue. It must
- *                               be dimensioned using the APP_SCHED_BUFFER_SIZE() macro. The buffer
- *                               must be aligned to a 4 byte boundary.
- *
- * @note Normally initialization should be done using the APP_SCHED_INIT() macro, as that will both
- *       allocate the scheduler buffer, and also align the buffer correctly.
- *
- * @retval      NRF_SUCCESS               Successful initialization.
- * @retval      NRF_ERROR_INVALID_PARAM   Invalid parameter (buffer not aligned to a 4 byte
- *                                        boundary).
- */
-uint32_t app_sched_init(uint16_t max_event_size, uint16_t queue_size, void * p_evt_buffer);
-
-/**@brief Function for executing all scheduled events.
- *
- * @details This function must be called from within the main loop. It will execute all events
- *          scheduled since the last time it was called.
- */
-void app_sched_execute(void);
-
-/**@brief Function for scheduling an event.
- *
- * @details Puts an event into the event queue.
- *
- * @param[in]   p_event_data   Pointer to event data to be scheduled.
- * @param[in]   event_size   Size of event data to be scheduled.
- * @param[in]   handler        Event handler to receive the event.
- *
- * @return      NRF_SUCCESS on success, otherwise an error code.
- */
-uint32_t app_sched_event_put(void *                    p_event_data,
-                             uint16_t                  event_size,
-                             app_sched_event_handler_t handler);
-
-#ifdef APP_SCHEDULER_WITH_PROFILER
-/**@brief Function for getting the maximum observed queue utilization.
- *
- * Function for tuning the module and determining QUEUE_SIZE value and thus module RAM usage.
- *
- * @return Maximum number of events in queue observed so far.
- */
-uint16_t app_sched_queue_utilization_get(void);
-#endif
-
-#ifdef APP_SCHEDULER_WITH_PAUSE
-/**@brief A function to pause the scheduler.
- *
- * @details When the scheduler is paused events are not pulled from the scheduler queue for
- *          processing. The function can be called multiple times. To unblock the scheduler the
- *          function @ref app_sched_resume has to be called the same number of times.
- */
-void app_sched_pause(void);
-
-/**@brief A function to resume a scheduler.
- *
- * @details To unblock the scheduler this function has to be called the same number of times as
- *          @ref app_sched_pause function.
- */
-void app_sched_resume(void);
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_SCHEDULER_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/scheduler/app_scheduler_serconn.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler_serconn.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler_serconn.c
deleted file mode 100644
index f411eff..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/scheduler/app_scheduler_serconn.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* Copyright (c) 2012 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 "app_scheduler.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include "nrf_soc.h"
-#include "nrf_assert.h"
-#include "app_util.h"
-#include "app_util_platform.h"
-
-/**@brief Structure for holding a scheduled event header. */
-typedef struct
-{
-    app_sched_event_handler_t handler;         /**< Pointer to event handler to receive the event. */
-    uint16_t                  event_data_size; /**< Size of event data. */
-} event_header_t;
-
-STATIC_ASSERT(sizeof (event_header_t) <= APP_SCHED_EVENT_HEADER_SIZE);
-
-static event_header_t * m_queue_event_headers; /**< Array for holding the queue event headers. */
-static uint8_t *        m_queue_event_data;    /**< Array for holding the queue event data. */
-static volatile uint8_t m_queue_start_index;   /**< Index of queue entry at the start of the queue. */
-static volatile uint8_t m_queue_end_index;     /**< Index of queue entry at the end of the queue. */
-static uint16_t         m_queue_event_size;    /**< Maximum event size in queue. */
-static uint16_t         m_queue_size;          /**< Number of queue entries. */
-
-#ifdef APP_SCHEDULER_WITH_PROFILER
-static uint16_t m_max_queue_utilization;    /**< Maximum observed queue utilization. */
-#endif
-
-static uint32_t m_scheduler_paused_counter = 0; /**< Counter storing the difference between pausing
-                                                     and resuming the scheduler. */
-
-/**@brief Function for incrementing a queue index, and handle wrap-around.
- *
- * @param[in]   index   Old index.
- *
- * @return      New (incremented) index.
- */
-static __INLINE uint8_t next_index(uint8_t index)
-{
-    return (index < m_queue_size) ? (index + 1) : 0;
-}
-
-static __INLINE uint8_t app_sched_queue_full(void)
-{
-  uint8_t tmp = m_queue_start_index;
-  return next_index(m_queue_end_index) == tmp;
-}
-
-/**@brief Macro for checking if a queue is full. */
-#define APP_SCHED_QUEUE_FULL() app_sched_queue_full()
-
-static __INLINE uint8_t app_sched_queue_empty(void)
-{
-  uint8_t tmp = m_queue_start_index;
-  return m_queue_end_index == tmp;
-}
-
-/**@brief Macro for checking if a queue is empty. */
-#define APP_SCHED_QUEUE_EMPTY() app_sched_queue_empty()
-
-
-uint32_t app_sched_init(uint16_t event_size, uint16_t queue_size, void * p_event_buffer)
-{
-    uint16_t data_start_index = (queue_size + 1) * sizeof (event_header_t);
-
-    //Check that buffer is correctly aligned
-    if (!is_word_aligned(p_event_buffer))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    //Initialize event scheduler
-    m_queue_event_headers = p_event_buffer;
-    m_queue_event_data    = &((uint8_t *)p_event_buffer)[data_start_index];
-    m_queue_end_index     = 0;
-    m_queue_start_index   = 0;
-    m_queue_event_size    = event_size;
-    m_queue_size          = queue_size;
-
-#ifdef APP_SCHEDULER_WITH_PROFILER
-    m_max_queue_utilization = 0;
-#endif
-
-    return NRF_SUCCESS;
-}
-
-
-#ifdef APP_SCHEDULER_WITH_PROFILER
-static void check_queue_utilization(void)
-{
-    uint16_t start = m_queue_start_index;
-    uint16_t end   = m_queue_end_index;
-    uint16_t queue_utilization = (end >= start) ? (end - start) :
-        (m_queue_size + 1 - start + end);
-
-    if (queue_utilization > m_max_queue_utilization)
-    {
-        m_max_queue_utilization = queue_utilization;
-    }
-}
-
-uint16_t app_sched_queue_utilization_get(void)
-{
-    return m_max_queue_utilization;
-}
-#endif
-
-
-uint32_t app_sched_event_put(void *                    p_event_data,
-                             uint16_t                  event_data_size,
-                             app_sched_event_handler_t handler)
-{
-    uint32_t err_code;
-
-    if (event_data_size <= m_queue_event_size)
-    {
-        uint16_t event_index = 0xFFFF;
-
-        CRITICAL_REGION_ENTER();
-
-        if (!APP_SCHED_QUEUE_FULL())
-        {
-            event_index       = m_queue_end_index;
-            m_queue_end_index = next_index(m_queue_end_index);
-        }
-
-        CRITICAL_REGION_EXIT();
-
-        if (event_index != 0xFFFF)
-        {
-            //NOTE: This can be done outside the critical region since the event consumer will
-            //always be called from the main loop, and will thus never interrupt this code.
-            m_queue_event_headers[event_index].handler = handler;
-
-            if ((p_event_data != NULL) && (event_data_size > 0))
-            {
-                memcpy(&m_queue_event_data[event_index * m_queue_event_size],
-                       p_event_data,
-                       event_data_size);
-                m_queue_event_headers[event_index].event_data_size = event_data_size;
-            }
-            else
-            {
-                m_queue_event_headers[event_index].event_data_size = 0;
-            }
-
-        #ifdef APP_SCHEDULER_WITH_PROFILER
-            check_queue_utilization();
-        #endif
-
-            err_code = NRF_SUCCESS;
-        }
-        else
-        {
-            err_code = NRF_ERROR_NO_MEM;
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_INVALID_LENGTH;
-    }
-
-    return err_code;
-}
-
-
-/**@brief Function for reading the next event from specified event queue.
- *
- * @param[out]  pp_event_data       Pointer to pointer to event data.
- * @param[out]  p_event_data_size   Pointer to size of event data.
- * @param[out]  p_event_handler     Pointer to event handler function pointer.
- *
- * @return      NRF_SUCCESS if new event, NRF_ERROR_NOT_FOUND if event queue is empty.
- */
-static uint32_t app_sched_event_get(void * *                    pp_event_data,
-                                    uint16_t *                  p_event_data_size,
-                                    app_sched_event_handler_t * p_event_handler)
-{
-    uint32_t err_code = NRF_ERROR_NOT_FOUND;
-
-    if (!APP_SCHED_QUEUE_EMPTY())
-    {
-        uint16_t event_index;
-
-        //NOTE: There is no need for a critical region here, as this function will only be called
-        //from app_sched_execute() from inside the main loop, so it will never interrupt
-        //app_sched_event_put(). Also, updating of (i.e. writing to) the start index will be
-        //an atomic operation.
-        event_index         = m_queue_start_index;
-        m_queue_start_index = next_index(m_queue_start_index);
-
-        *pp_event_data     = &m_queue_event_data[event_index * m_queue_event_size];
-        *p_event_data_size = m_queue_event_headers[event_index].event_data_size;
-        *p_event_handler   = m_queue_event_headers[event_index].handler;
-
-        err_code = NRF_SUCCESS;
-    }
-
-    return err_code;
-}
-
-
-void app_sched_pause(void)
-{
-    CRITICAL_REGION_ENTER();
-
-    if (m_scheduler_paused_counter < UINT32_MAX)
-    {
-        m_scheduler_paused_counter++;
-    }
-    CRITICAL_REGION_EXIT();
-}
-
-
-void app_sched_resume(void)
-{
-    CRITICAL_REGION_ENTER();
-
-    if (m_scheduler_paused_counter > 0)
-    {
-        m_scheduler_paused_counter--;
-    }
-    CRITICAL_REGION_EXIT();
-}
-
-/**@brief Function for checking if scheduler is paused which means that should break processing
- *        events.
- *
- * @return    Boolean value - true if scheduler is paused, false otherwise.
- */
-static __INLINE bool is_app_sched_paused(void)
-{
-    return (m_scheduler_paused_counter > 0);
-}
-
-
-void app_sched_execute(void)
-{
-    void *                    p_event_data;
-    uint16_t                  event_data_size;
-    app_sched_event_handler_t event_handler;
-
-    //Get next event (if any), and execute handler
-    while ((!is_app_sched_paused()) &&
-           (app_sched_event_get(&p_event_data, &event_data_size, &event_handler) == NRF_SUCCESS))
-    {
-        event_handler(p_event_data, event_data_size);
-    }
-}

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/sensorsim/sensorsim.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sensorsim/sensorsim.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sensorsim/sensorsim.c
deleted file mode 100644
index e584666..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sensorsim/sensorsim.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (c) 2012 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 "sensorsim.h"
-
-
-void sensorsim_init(sensorsim_state_t     * p_state,
-                    const sensorsim_cfg_t * p_cfg)
-{
-    if (p_cfg->start_at_max)
-    {
-        p_state->current_val   = p_cfg->max;
-        p_state->is_increasing = false;
-    }
-    else
-    {
-        p_state->current_val   = p_cfg->min;
-        p_state->is_increasing = true;
-    }
-}
-
-
-uint32_t sensorsim_measure(sensorsim_state_t     * p_state,
-                           const sensorsim_cfg_t * p_cfg)
-{
-    if (p_state->is_increasing)
-    {
-        sensorsim_increment(p_state, p_cfg);
-    }
-    else
-    {
-        sensorsim_decrement(p_state, p_cfg);
-    }
-    return p_state->current_val;
-}
-
-void sensorsim_increment(sensorsim_state_t *     p_state,
-                         const sensorsim_cfg_t * p_cfg)
-{
-    if (p_cfg->max - p_state->current_val > p_cfg->incr)
-    {
-        p_state->current_val += p_cfg->incr;
-    }
-    else
-    {
-        p_state->current_val   = p_cfg->max;
-        p_state->is_increasing = false;
-    }
-}
-
-
-void sensorsim_decrement(sensorsim_state_t *     p_state,
-                         const sensorsim_cfg_t * p_cfg)
-{
-    if (p_state->current_val - p_cfg->min > p_cfg->incr)
-    {
-        p_state->current_val -= p_cfg->incr;
-    }
-    else
-    {
-        p_state->current_val   = p_cfg->min;
-        p_state->is_increasing = true;
-    }
-}

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/sensorsim/sensorsim.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sensorsim/sensorsim.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sensorsim/sensorsim.h
deleted file mode 100644
index b018e30..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sensorsim/sensorsim.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright (c) 2012 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 ble_sdk_lib_sensorsim Sensor Data Simulator
- * @{
- * @ingroup ble_sdk_lib
- * @brief Functions for simulating sensor data.
- *
- * @details Currently only a triangular waveform simulator is implemented.
- */
-
-#ifndef SENSORSIM_H__
-#define SENSORSIM_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Triangular waveform sensor simulator configuration. */
-typedef struct
-{
-    uint32_t min;                       /**< Minimum simulated value. */
-    uint32_t max;                       /**< Maximum simulated value. */
-    uint32_t incr;                      /**< Increment between each measurement. */
-    bool     start_at_max;              /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */
-} sensorsim_cfg_t;
-
-/**@brief Triangular waveform sensor simulator state. */
-typedef struct
-{
-    uint32_t current_val;               /**< Current sensor value. */
-    bool     is_increasing;             /**< TRUE if the simulator is in increasing state, FALSE otherwise. */
-} sensorsim_state_t;
-
-/**@brief Function for initializing a triangular waveform sensor simulator.
- *
- * @param[out]  p_state  Current state of simulator.
- * @param[in]   p_cfg    Simulator configuration.
- */
-void sensorsim_init(sensorsim_state_t *     p_state, 
-                        const sensorsim_cfg_t * p_cfg);
-
-/**@brief Function for generating a simulated sensor measurement using a triangular waveform generator.
- *
- * @param[in,out]  p_state  Current state of simulator.
- * @param[in]      p_cfg    Simulator configuration.
- *
- * @return         Simulator output.
- */
-uint32_t sensorsim_measure(sensorsim_state_t *     p_state,
-                               const sensorsim_cfg_t * p_cfg);
-
-/**@brief Function for incrementing a simulated sensor measurement value.
- *
- * @param[in,out]  p_state  Current state of simulator.
- * @param[in]      p_cfg    Simulator configuration.
- *
- * @return         Simulator output.
- */
-void sensorsim_increment(sensorsim_state_t *     p_state,
-                         const sensorsim_cfg_t * p_cfg);
-
-/**@brief Function for decrementing a simulated sensor measurement value.
- *
- * @param[in,out]  p_state  Current state of simulator.
- * @param[in]      p_cfg    Simulator configuration.
- *
- * @return         Simulator output.
- */
-void sensorsim_decrement(sensorsim_state_t *     p_state,
-                         const sensorsim_cfg_t * p_cfg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SENSORSIM_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/sha256/sha256.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sha256/sha256.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sha256/sha256.c
deleted file mode 100644
index 79b4484..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sha256/sha256.c
+++ /dev/null
@@ -1,183 +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 <stdlib.h>
-#include "sha256.h"
-#include "sdk_errors.h"
-#include "sdk_common.h"
-
-
-#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b))))
-#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b))))
-
-#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z)))
-#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
-#define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22))
-#define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25))
-#define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3))
-#define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10))
-
-
-static const uint32_t k[64] = {
-    0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
-    0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
-    0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
-    0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
-    0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
-    0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
-    0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
-    0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
-};
-
-
-/**@brief Function for calculating the hash of a 64-byte section of data.
- *
- * @param[in,out] ctx   Hash instance.
- * @param[in]     data  Aray with data to be hashed. Assumed to be 64 bytes long.
- */
-void sha256_transform(sha256_context_t *ctx, const uint8_t * data)
-{
-    uint32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
-
-    for (i = 0, j = 0; i < 16; ++i, j += 4)
-        m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]);
-    for ( ; i < 64; ++i)
-        m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];
-
-    a = ctx->state[0];
-    b = ctx->state[1];
-    c = ctx->state[2];
-    d = ctx->state[3];
-    e = ctx->state[4];
-    f = ctx->state[5];
-    g = ctx->state[6];
-    h = ctx->state[7];
-
-    for (i = 0; i < 64; ++i) {
-        t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i];
-        t2 = EP0(a) + MAJ(a,b,c);
-        h = g;
-        g = f;
-        f = e;
-        e = d + t1;
-        d = c;
-        c = b;
-        b = a;
-        a = t1 + t2;
-    }
-
-    ctx->state[0] += a;
-    ctx->state[1] += b;
-    ctx->state[2] += c;
-    ctx->state[3] += d;
-    ctx->state[4] += e;
-    ctx->state[5] += f;
-    ctx->state[6] += g;
-    ctx->state[7] += h;
-}
-
-
-ret_code_t sha256_init(sha256_context_t *ctx)
-{
-    VERIFY_PARAM_NOT_NULL(ctx);
-
-    ctx->datalen = 0;
-    ctx->bitlen = 0;
-    ctx->state[0] = 0x6a09e667;
-    ctx->state[1] = 0xbb67ae85;
-    ctx->state[2] = 0x3c6ef372;
-    ctx->state[3] = 0xa54ff53a;
-    ctx->state[4] = 0x510e527f;
-    ctx->state[5] = 0x9b05688c;
-    ctx->state[6] = 0x1f83d9ab;
-    ctx->state[7] = 0x5be0cd19;
-
-    return NRF_SUCCESS;
-}
-
-
-ret_code_t sha256_update(sha256_context_t *ctx, const uint8_t * data, size_t len)
-{
-    VERIFY_PARAM_NOT_NULL(ctx);
-    if (((len > 0) && (data == NULL)))
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    uint32_t i;
-
-    for (i = 0; i < len; ++i) {
-        ctx->data[ctx->datalen] = data[i];
-        ctx->datalen++;
-        if (ctx->datalen == 64) {
-            sha256_transform(ctx, ctx->data);
-            ctx->bitlen += 512;
-            ctx->datalen = 0;
-        }
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-ret_code_t sha256_final(sha256_context_t *ctx, uint8_t * hash)
-{
-    VERIFY_PARAM_NOT_NULL(ctx);
-    VERIFY_PARAM_NOT_NULL(hash);
-
-    uint32_t i;
-
-    i = ctx->datalen;
-
-    // Pad whatever data is left in the buffer.
-    if (ctx->datalen < 56) {
-        ctx->data[i++] = 0x80;
-        while (i < 56)
-            ctx->data[i++] = 0x00;
-    }
-    else {
-        ctx->data[i++] = 0x80;
-        while (i < 64)
-            ctx->data[i++] = 0x00;
-        sha256_transform(ctx, ctx->data);
-        memset(ctx->data, 0, 56);
-    }
-
-    // Append to the padding the total message's length in bits and transform.
-    ctx->bitlen += (uint64_t)ctx->datalen * 8;
-    ctx->data[63] = ctx->bitlen;
-    ctx->data[62] = ctx->bitlen >> 8;
-    ctx->data[61] = ctx->bitlen >> 16;
-    ctx->data[60] = ctx->bitlen >> 24;
-    ctx->data[59] = ctx->bitlen >> 32;
-    ctx->data[58] = ctx->bitlen >> 40;
-    ctx->data[57] = ctx->bitlen >> 48;
-    ctx->data[56] = ctx->bitlen >> 56;
-    sha256_transform(ctx, ctx->data);
-
-    // Since this implementation uses little endian uint8_t ordering and SHA uses big endian,
-    // reverse all the uint8_ts when copying the final state to the output hash.
-    for (i = 0; i < 4; ++i) {
-        hash[i]      = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff;
-        hash[i + 4]  = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff;
-        hash[i + 8]  = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff;
-        hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff;
-        hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff;
-        hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff;
-        hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff;
-        hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff;
-    }
-
-    return NRF_SUCCESS;
-}

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/sha256/sha256.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sha256/sha256.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sha256/sha256.h
deleted file mode 100644
index ae95fc0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/sha256/sha256.h
+++ /dev/null
@@ -1,99 +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
- *
- * @defgroup sha256 SHA-256 hash library
- * @{
- * @ingroup app_common
- *
- * @brief  This module calculates SHA-256 (SHA-2, FIPS-180) hashes.
- *
- * @details To use this module, first call @ref sha256_init on a @ref sha256_context_t instance. Then call @ref
- *          sha256_update with the data to be hashed. This step can optionally be done with multiple
- *          calls to @ref sha256_update, each with a section of the data (in the correct order).
- *          After all data has been passed to @ref sha256_update, call @ref sha256_final to finalize
- *          and extract the hash value.
- *
- *          This code is adapted from code by Brad Conte, retrieved from
- *          https://github.com/B-Con/crypto-algorithms.
- *
- */
-
-#ifndef SHA256_H
-#define SHA256_H
-
-
-#include <stdint.h>
-#include "sdk_errors.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Current state of a hash operation.
- */
-typedef struct {
-    uint8_t data[64];
-    uint32_t datalen;
-    uint64_t bitlen;
-    uint32_t state[8];
-} sha256_context_t;
-
-
-/**@brief Function for initializing a @ref sha256_context_t instance.
- *
- * @param[out] ctx  Context instance to be initialized.
- *
- * @retval NRF_SUCCESS     If the instance was successfully initialized.
- * @retval NRF_ERROR_NULL  If the parameter was NULL.
- */
-ret_code_t sha256_init(sha256_context_t *ctx);
-
-/**@brief Function for calculating the hash of an array of uint8_t data.
- *
- * @details This function can be called multiple times in sequence. This is equivalent to calling 
- *          the function once on a concatenation of the data from the different calls.
- *
- * @param[in,out] ctx   Hash instance.
- * @param[in]     data  Data to be hashed.
- * @param[in]     len   Length of the data to be hashed.
- *
- * @retval NRF_SUCCESS     If the data was successfully hashed.
- * @retval NRF_ERROR_NULL  If the ctx parameter was NULL or the data parameter was NULL,  while the len parameter was not zero.
- */
-ret_code_t sha256_update(sha256_context_t *ctx, const uint8_t * data, const size_t len);
-
-/**@brief Function for extracting the hash value from a hash instance.
- *
- * @details This function should be called after all data to be hashed has been passed to the hash
- *          instance (by one or more calls to @ref sha256_update).
- *
- * Do not call @ref sha256_update again after @ref sha256_final has been called.
- *
- * @param[in,out] ctx   Hash instance.
- * @param[out]    hash  Array to hold the extracted hash value (assumed to be 32 bytes long).
- *
- * @retval NRF_SUCCESS     If the has value was successfully extracted.
- * @retval NRF_ERROR_NULL  If a parameter was NULL.
- */
-ret_code_t sha256_final(sha256_context_t *ctx, uint8_t * hash);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif   // SHA256_H
-
-/** @} */


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

Posted by cc...@apache.org.
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/pstorage/pstorage.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage.h
deleted file mode 100644
index ac713dd..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage.h
+++ /dev/null
@@ -1,389 +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 persistent_storage Persistent Storage Interface
- * @{
- * @ingroup app_common
- * @brief Abstracted flash interface.
- *
- * @details  An abstracted interface is provided by the module to easily port the application and 
- *           SDK modules to an alternate option. This ensures that the SDK and application are moved 
- *           to alternate persistent storage instead of the one provided by default.
- */
-
-#ifndef PSTORAGE_H__
-#define PSTORAGE_H__
-
-#include "pstorage_platform.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@defgroup ps_opcode Persistent Storage Access Operation Codes
- * @{
- * @brief    Persistent Storage Access Operation Codes. 
- *
- * @details  Persistent Storage Access Operation Codes are used by Persistent storage operation 
- *           completion callback @ref pstorage_ntf_cb_t to identify the operation type requested by 
- *           the application.
- */
-#define PSTORAGE_STORE_OP_CODE    0x01  /**< Store Operation type. */
-#define PSTORAGE_LOAD_OP_CODE     0x02  /**< Load Operation type. */
-#define PSTORAGE_CLEAR_OP_CODE    0x03  /**< Clear Operation type. */
-#define PSTORAGE_UPDATE_OP_CODE   0x04  /**< Update Operation type. */
-
-/**@} */
-
-/**@defgroup pstorage_data_types Persistent Memory Interface Data Types
- * @{
- * @brief Data Types needed for interfacing with persistent memory.
- *
- * @details Data Types needed for interfacing with persistent memory.
- */
-
-/**@brief Persistent storage operation completion callback function type.
- *
- * @details The persistent storage operation completion callback is used by the interface to report
- *          success or failure of a flash operation. Since data is not copied for a store operation, 
- *          a callback is an indication that the resident memory can now be reused or freed.
- * 
- * @param[in] handle   Identifies the module and block for the callback that is received.
- * @param[in] op_code  Identifies the operation for the event that is notified.
- * @param[in] result   Identifies the result of a flash access operation. NRF_SUCCESS implies 
- *                     operation succeeded.
- *
- *                     @note Unmanaged (abnormal behaviour) error codes from the SoftDevice flash 
- *                     access API are forwarded as is and are expected to be handled by the 
- *                     application. For details refer to the implementation file and corresponding 
- *                     SoftDevice flash API documentation.
- *                     
- * @param[in] p_data   Identifies the application data pointer. For a store operation, this points 
- *                     to the resident source of application memory that the application can now 
- *                     free or reuse. When there is a clear operation, this is NULL since no 
- *                     application pointer is needed for this operation.
- * @param[in] data_len Length data the application provided for the operation. 
- */
-typedef void (*pstorage_ntf_cb_t)(pstorage_handle_t * p_handle,
-                                  uint8_t             op_code,
-                                  uint32_t            result,
-                                  uint8_t *           p_data,
-                                  uint32_t            data_len);
-
-/**@brief Struct containing module registration context. */
-typedef struct
-{
-    pstorage_ntf_cb_t cb;             /**< Persistent storage operation completion callback function @ref pstorage_ntf_cb_t.  */
-    pstorage_size_t   block_size;     /**< Desired block size for persistent memory storage. For example, if a module has a table with 10 entries, and each entry is 64 bytes in size,
-                                       *   it can request 10 blocks with a block size of 64 bytes. The module can also request one block that is 640 bytes depending 
-                                       *   on how it would like to access or alter the memory in persistent memory.
-                                       *   The first option is preferred when it is a single entry that needs to be updated often and doesn't impact the other entries.
-                                       *   The second option is preferred when table entries are not changed individually but have a common point of loading and storing
-                                       *   data. */
-    pstorage_size_t   block_count;    /** Number of blocks requested by the module; minimum values is 1. */
-} pstorage_module_param_t;
-
-/**@} */
-
-/**@defgroup pstorage_routines Persistent Storage Access Routines
- * @{
- * @brief Functions/Interface SDK modules used to persistently store data.
- *
- * @details Interface for the Application and SDK modules to load/store information persistently.
- *          Note: While implementation of each of the persistent storage access functions
- *          depends on the system and is specific to system/solution, the signature of the
- *          interface routines should not be altered.
- */
-
-/**@brief Function for initializing the module.
- *
- * @details Function for initializing the module. This function is called once before any other APIs 
- *          of the module are used.
- *
- * @retval     NRF_SUCCESS             Operation success.
- */
-uint32_t pstorage_init(void);
-
-/**@brief Function for registering with persistent storage interface.
- *
- * @param[in]  p_module_param Module registration parameter.
- * @param[out] p_block_id     Block identifier to identify persistent memory blocks when 
- *                            registration succeeds. Application is expected to use the block IDs 
- *                            for subsequent operations on requested persistent memory. Maximum 
- *                            registrations permitted is determined by the configuration of the 
- *                            parameter PSTORAGE_NUM_OF_PAGES. If more than one memory block is 
- *                            requested, the identifier provided here is the base identifier for the 
- *                            first block and used to identify the subsequent block. The application 
- *                            uses \@ref pstorage_block_identifier_get with this base identifier and 
- *                            block number. Therefore if 10 blocks of size 64 are requested and the 
- *                            application wishes to store memory in the 6th block, it shall use
- *                            \@ref pstorage_block_identifier_get with the base ID and provide a 
- *                            block number of 5. This way the application is only expected to 
- *                            remember the base block identifier.
- *
- * @retval     NRF_SUCCESS             Operation success.
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. Additional registrations can't be 
- *                                     supported.
- */
-uint32_t pstorage_register(pstorage_module_param_t * p_module_param,
-                           pstorage_handle_t *       p_block_id);
-
-/**@brief Function for getting block ID with reference to base block identifier provided at the time 
- *        of registration.
- *
- * @details Function to get the block ID with reference to base block identifier provided at the 
- *          time of registration.
- *          If more than one memory block was requested when registering, the identifier provided 
- *          here is the base identifier for the first block which is used to identify subsequent
- *          blocks. The application shall use this routine to get the block identifier, providing 
- *          input as base identifier and block number. Therefore, if 10 blocks of size 64 are 
- *          requested and the application wishes to store memory in the 6th block, it shall use
- *          \@ref pstorage_block_identifier_get with the base ID and provide a block number of 5.
- *          This way the application is only expected to remember the base block identifier.
- *
- * @param[in]  p_base_id  Base block ID received at the time of registration.
- * @param[in]  block_num  Block Number, with first block numbered zero.
- * @param[out] p_block_id Block identifier for the block number requested when the API succeeds.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- */
-uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id,
-                                       pstorage_size_t     block_num,
-                                       pstorage_handle_t * p_block_id);
-
-/**@brief Function for persistently storing data of length 'size' contained in the 'p_src' address
- *        in the storage module at 'p_dest' address. Equivalent to Storage Write.
- *
- * @param[in]  p_dest Destination address where data is to be stored persistently.
- * @param[in]  p_src  Source address containing data to be stored. API assumes this to be resident
- *                    memory and no intermediate copy of data is made by the API. Must be word 
- *                    aligned.
- * @param[in]  size   Size of data to be stored expressed in bytes. Must be word aligned and size + 
- *                    offset must be <= block size.                      
- * @param[in]  offset Offset in bytes to be applied when writing to the block.
- *                    For example, if within a block of 100 bytes, the application wishes to
- *                    write 20 bytes at an offset of 12, then this field should be set to 12.
- *                    Must be word aligned.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_INVALID_ADDR  Operation failure. Parameter is not aligned.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. No storage space available.
- *
- * @warning    No copy of the data is made, meaning memory provided for the data source that is to 
- *             be written to flash cannot be freed or reused by the application until this procedure
- *             is complete. The application is notified when the procedure is finished using the
- *             notification callback registered by the application.
- */
-uint32_t pstorage_store(pstorage_handle_t * p_dest,
-                        uint8_t *           p_src,
-                        pstorage_size_t     size,
-                        pstorage_size_t     offset);
-
-/**@brief Function for updating persistently stored data of length 'size' contained in the 'p_src' 
- *        address in the storage module at 'p_dest' address.
- *
- * @param[in]  p_dest Destination address where data is to be updated.
- * @param[in]  p_src  Source address containing data to be stored. API assumes this to be resident
- *                    memory and no intermediate copy of data is made by the API.
- * @param[in]  size   Size of data to be stored expressed in bytes. Must be word aligned and size + 
- *                    offset must be <= block size.
- * @param[in]  offset Offset in bytes to be applied when writing to the block.
- *                    For example, if within a block of 100 bytes, the application wishes to
- *                    write 20 bytes at an offset of 12 bytes, then this field should be set to 12.
- *                    Must be word aligned.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_INVALID_ADDR  Operation failure. Parameter is not aligned.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. No storage space available.
- *
- * @warning    No copy of the data is made, meaning memory provided for the data source that is to 
- *             be written to flash cannot be freed or reused by the application until this procedure
- *             is complete. The application is notified when the procedure is finished using the
- *             notification callback registered by the application.
- */
-uint32_t pstorage_update(pstorage_handle_t * p_dest,
-                         uint8_t *           p_src,
-                         pstorage_size_t     size,
-                         pstorage_size_t     offset);
-
-/**@brief Function for loading persistently stored data of length 'size' from 'p_src' address
- *        to 'p_dest' address. Equivalent to Storage Read.
- *
- * @param[in]  p_dest Destination address where persistently stored data is to be loaded.
- * @param[in]  p_src  Source where data is loaded from persistent memory.
- * @param[in]  size   Size of data to be loaded from persistent memory expressed in bytes.
- *                    Should be word aligned.
- * @param[in]  offset Offset in bytes, to be applied when loading from the block.
- *                    For example, if within a block of 100 bytes, the application wishes to
- *                    load 20 bytes from offset of 12 bytes, then this field should be set to 12.
- *                    Should be word aligned.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_INVALID_ADDR  Operation failure. Parameter is not aligned.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. No storage space available.
- */
-uint32_t pstorage_load(uint8_t *           p_dest,
-                       pstorage_handle_t * p_src,
-                       pstorage_size_t     size,
-                       pstorage_size_t     offset);
-
-/**@brief Function for clearing data in persistent memory.
- *
- * @param[in]  p_base_id Base block identifier in persistent memory that needs to be cleared;
- *                       equivalent to an Erase Operation.
- * @param[in]  size      Size of data to be cleared from persistent memory expressed in bytes.
- *                       This parameter is to provision for clearing of certain blocks
- *                       of memory, or all memory blocks in a registered module. If the total size 
- *                       of the application module is used (blocks * block size) in combination with
- *                       the identifier for the first block in the module, all blocks in the 
- *                       module will be erased. Must be multiple of block size.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_INVALID_ADDR  Operation failure. Parameter is not aligned.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. No storage space available.
- *
- * @note       Clear operations may take time. This API however, does not block until the clear
- *             procedure is complete. The application is notified of procedure completion using
- *             a notification callback registered by the application. The 'result' parameter of the
- *             callback indicates if the procedure was successful or not.
- */
-uint32_t pstorage_clear(pstorage_handle_t * p_base_id, pstorage_size_t size);
-
-/**@brief Function for getting the number of pending operations with the module.
- *
- * @param[out] p_count Number of storage operations pending with the module. If 0, there are no 
- *                     outstanding requests.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- */
-uint32_t pstorage_access_status_get(uint32_t * p_count);
-
-#ifdef PSTORAGE_RAW_MODE_ENABLE
-
-/**@brief Function for registering with the persistent storage interface.
- *
- * @param[in]  p_module_param Module registration parameter.
- * @param[out] p_block_id     Block identifier used to identify persistent memory blocks upon 
- *                            successful registration. The application is expected to use the block 
- *                            IDs for subsequent operations on requested persistent memory. When 
- *                            more than one memory block is requested, this identifier is the base 
- *                            identifier for the first block and used to identify subsequent blocks. 
- *                            The application shall use \@ref pstorage_block_identifier_get with 
- *                            this base identifier and block number. Therefore if 10 blocks of size 
- *                            64 are requested and the application wishes to store memory in the 6th 
- *                            block, it shall use \@ref pstorage_block_identifier_get with the base 
- *                            ID and provide a block number of 5. Therefore, the application is only 
- *                            expected to remember the base block identifier.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. No storage space available.
- */
-uint32_t pstorage_raw_register(pstorage_module_param_t * p_module_param,
-                               pstorage_handle_t *       p_block_id);
-
-/**@brief Function for persistently storing data of length 'size' contained in 'p_src' address in 
- *        storage module at 'p_dest' address. Equivalent to Storage Write.
- *
- * @param[in]  p_dest Destination address where data is to be stored persistently.
- * @param[in]  p_src  Source address containing data to be stored. The API assumes this is resident
- *                    memory and no intermediate copy of data is made by the API. Must be word 
- *                    aligned.
- * @param[in]  size   Size of data to be stored expressed in bytes. Must be word aligned.
- * @param[in]  offset Offset in bytes to be applied when writing to the block.
- *                    For example, if within a block of 100 bytes, the application wishes to
- *                    write 20 bytes at an offset of 12 bytes, this field should be set to 12.
- *                    Must be word aligned.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_INVALID_ADDR  Operation failure. Parameter is not aligned.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. No storage space available.
- *
- * @warning    No copy of the data is made, meaning memory provided for data source that is to be 
- *             written to flash cannot be freed or reused by the application until this procedure
- *             is complete. The application is notified when the procedure is finished using the
- *             notification callback registered by the application.
- */
-uint32_t pstorage_raw_store(pstorage_handle_t * p_dest,
-                            uint8_t *           p_src,
-                            pstorage_size_t     size,
-                            pstorage_size_t     offset);
-
-/**@brief Function for clearing data in persistent memory in raw mode.
- *
- * @param[in]  p_dest Base block identifier in persistent memory that needs to be cleared.
- *                    Equivalent to an Erase Operation.
- * @param[in]  size   Size of data to be cleared from persistent memory expressed in bytes. 
- *                    Not used.
- *
- * @retval     NRF_SUCCESS             Operation success. 
- * @retval     NRF_ERROR_INVALID_STATE Operation failure. API is called without module 
- *                                     initialization.
- * @retval     NRF_ERROR_NULL          Operation failure. NULL parameter has been passed.
- * @retval     NRF_ERROR_INVALID_PARAM Operation failure. Invalid parameter has been passed.
- * @retval     NRF_ERROR_NO_MEM        Operation failure. No storage space available.
- *
- * @note       Clear operations may take time. This API, however, does not block until the clear
- *             procedure is complete. The application is notified of procedure completion using
- *             a notification callback registered by the application. The 'result' parameter of the
- *             callback indicates if the procedure was successful or not.
- */
-uint32_t pstorage_raw_clear(pstorage_handle_t * p_dest, pstorage_size_t size);
-
-#endif // PSTORAGE_RAW_MODE_ENABLE
-
-/**@} */
-/**@} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // PSTORAGE_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/pstorage/pstorage_nosd.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage_nosd.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage_nosd.c
deleted file mode 100644
index dafa64e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage_nosd.c
+++ /dev/null
@@ -1,525 +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 "pstorage.h"
-#include "nordic_common.h"
-#include "nrf_error.h"
-#include "ble_flash.h"
-#include "app_util.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-
-#define no_SUPPORT_MODULES_LARGER_THAN_PAGE
-
-/**
- * @defgroup api_param_check API Parameters check macros.
- *
- * @details Macros that verify parameters passed to the module in the APIs. These macros
- *          could be mapped to nothing in final versions of code to save execution and size.
- *
- * @{
- */
-/**
- * @brief Checks if API parameters are null. Mostly used for pointer parameters.
- */
-#define NULL_PARAM_CHECK(PARAM)                                                                   \
-        if ((PARAM) == NULL)                                                                      \
-        {                                                                                         \
-            return NRF_ERROR_NULL;                                                                \
-        }
-
-/**@brief Verifies the module identifier supplied by the application is within permissible
- *        range.
- */
-#define MODULE_ID_RANGE_CHECK(ID)                                                                 \
-        if ((PSTORAGE_NUM_OF_PAGES <= ((ID)->module_id)) ||                                       \
-            (m_app_table[(ID)->module_id].cb == NULL))                                            \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies the block identifier supplied by the application is within the permissible
- *        range.
- */
-#define BLOCK_ID_RANGE_CHECK(ID)                                                                  \
-        if (                                                                                      \
-            (                                                                                     \
-             m_app_table[(ID)->module_id].base_id                                                 \
-             +                                                                                    \
-             (                                                                                    \
-              m_app_table[(ID)->module_id].block_count                                            \
-              *                                                                                   \
-              MODULE_BLOCK_SIZE(ID)                                                               \
-             )                                                                                    \
-            )                                                                                     \
-            <=                                                                                    \
-            ((ID)->block_id)                                                                      \
-           )                                                                                      \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-
-/**@brief Verifies the block size requested by the application can be supported by the module. */
-#define BLOCK_SIZE_CHECK(X)                                                                       \
-        if (((X) > PSTORAGE_MAX_BLOCK_SIZE) || ((X) < PSTORAGE_MIN_BLOCK_SIZE))                   \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies block size requested by Application in registration API */
-#define BLOCK_COUNT_CHECK(COUNT, SIZE)                                                            \
-        if (((COUNT) == 0) || ((m_next_page_addr + ((COUNT) *(SIZE)) > PSTORAGE_DATA_END_ADDR)))  \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies size parameter provided by application in API. */
-#define SIZE_CHECK(ID, SIZE)                                                                      \
-        if(((SIZE) == 0) || ((SIZE) > MODULE_BLOCK_SIZE(ID)))                                     \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief Verifies offset parameter provided by application in API. */
-#define OFFSET_CHECK(ID, OFFSET, SIZE)                                                            \
-        if(((SIZE) + (OFFSET)) > MODULE_BLOCK_SIZE(ID))                                           \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@brief SET BASE by masking offset bits for a address within page */
-#define PAGE_BASE_ADDR(flash_address)  ((flash_address)&(~((uint32_t)PSTORAGE_FLASH_PAGE_SIZE-1)))
-
-/**@brief Verifies the total module size requested by the application can be supported by the module. */
-#define MODULE_SIZE_CHECK(X)                                                                      \
-        if ((X) > PSTORAGE_FLASH_PAGE_SIZE)                   									  \
-        {                                                                                         \
-            return NRF_ERROR_INVALID_PARAM;                                                       \
-        }
-
-/**@} */
-
- /**@brief    Verify module's initialization status.
- *
- * @details   Verify module's initialization status. Returns NRF_ERROR_INVALID_STATE in case a
- *            module API is called without initializing the module.
- */
-#define VERIFY_MODULE_INITIALIZED()                                                               \
-        do                                                                                        \
-        {                                                                                         \
-            if (!m_module_initialized)                                                            \
-            {                                                                                     \
-                 return NRF_ERROR_INVALID_STATE;                                                  \
-            }                                                                                     \
-        } while(0)
-
-/**@brief Macro to fetch the block size registered for the module. */
-#define MODULE_BLOCK_SIZE(ID) (m_app_table[(ID)->module_id].block_size)
-
-/**@} */
-
-/**
- * @brief   Application registration information.
- *
- * @details Abstracts application specific information that application needs to maintain to be able
- *          to process requests from each one of them.
- *
- */
-typedef struct ps_module_table
-{
-    pstorage_ntf_cb_t      cb;             /**< Callback registered with the module to be notified of any error occurring in persistent memory management */
-    pstorage_block_t       base_id;        /**< Base block id assigned to the module */
-    uint16_t               block_size;     /**< Size of block for the module */
-    uint16_t               block_count;    /**< Number of block requested by application */
-    uint16_t               no_of_pages;    /**< Variable to remember how many pages have been allocated for this module. This information is used for clearing of block, so that application does not need to have knowledge of number of pages its using. */
-} pstorage_module_table_t;
-
-static pstorage_module_table_t m_app_table[PSTORAGE_NUM_OF_PAGES];        /**< Registered application information table. */
-
-static uint32_t m_next_app_instance;                                      /**< Points to the application module instance that can be allocated next */
-static uint32_t m_next_page_addr;                                         /**< Points to the flash address that can be allocated to a module next, this is needed as blocks of a module can span across flash pages. */
-
-static bool     m_module_initialized = false;                             /**< Flag for checking if module has been initialized. */
-
-
-/**
- * @brief Routine to notify application of any errors.
- *
- * @param[in] result Result of event being notified.
- */
-static __INLINE void app_notify(pstorage_handle_t    * p_handle,
-                                uint8_t              * p_addr,
-                                uint8_t                op_code,
-                                pstorage_size_t        size,
-                                uint32_t               result)
-{
-    pstorage_ntf_cb_t  ntf_cb;
-
-    ntf_cb = m_app_table[p_handle->module_id].cb;
-
-    // Indicate result to client.
-    // For PSTORAGE_CLEAR_OP_CODE no size is returned as the size field is used only internally
-    // for clients registering multiple pages.
-    ntf_cb(p_handle,
-           op_code,
-           result,
-           p_addr,
-           size);
-}
-
-
-uint32_t pstorage_init(void)
-{
-    m_next_app_instance  = 0;
-    m_next_page_addr     = PSTORAGE_DATA_START_ADDR;
-    m_module_initialized = true;
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_register(pstorage_module_param_t * p_module_param,
-                           pstorage_handle_t       * p_block_id)
-{
-
-
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_module_param);
-    NULL_PARAM_CHECK(p_block_id);
-    NULL_PARAM_CHECK(p_module_param->cb);
-    BLOCK_SIZE_CHECK(p_module_param->block_size);
-    BLOCK_COUNT_CHECK(p_module_param->block_count, p_module_param->block_size);
-
-#ifndef SUPPORT_MODULES_LARGER_THAN_PAGE
-    MODULE_SIZE_CHECK(((uint16_t)(p_module_param->block_size)*(p_module_param->block_count)));
-#endif
-
-
-    if (m_next_app_instance == PSTORAGE_NUM_OF_PAGES)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-    p_block_id->module_id                        = m_next_app_instance;
-    p_block_id->block_id                         = m_next_page_addr;
-
-    m_app_table[m_next_app_instance].base_id     = p_block_id->block_id;
-    m_app_table[m_next_app_instance].cb          = p_module_param->cb;
-    m_app_table[m_next_app_instance].block_size  = p_module_param->block_size;
-    m_app_table[m_next_app_instance].block_count = p_module_param->block_count;
-
-    // Calculate number of flash pages allocated for the device.
-
-
-#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE
-    uint16_t page_count = 0;
-    uint32_t total_size;
-    total_size = p_module_param->block_size * p_module_param->block_count;
-    do
-    {
-        page_count++;
-
-        if (total_size > PSTORAGE_FLASH_PAGE_SIZE)
-        {
-            total_size -= PSTORAGE_FLASH_PAGE_SIZE;
-        }
-        else
-        {
-            total_size = 0;
-        }
-
-        m_next_page_addr += PSTORAGE_FLASH_PAGE_SIZE;
-
-    } while (total_size >= PSTORAGE_FLASH_PAGE_SIZE);
-    m_app_table[m_next_app_instance].no_of_pages = page_count;
-#else
-    m_app_table[m_next_app_instance].no_of_pages = 1;
-    m_next_page_addr += PSTORAGE_FLASH_PAGE_SIZE;
-#endif
-    m_next_app_instance++;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id,
-                                       pstorage_size_t     block_num,
-                                       pstorage_handle_t * p_block_id)
-{
-    pstorage_handle_t temp_id;
-
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_base_id);
-    NULL_PARAM_CHECK(p_block_id);
-    MODULE_ID_RANGE_CHECK(p_base_id);
-
-    temp_id           = (*p_base_id);
-    temp_id.block_id += (block_num * MODULE_BLOCK_SIZE(p_base_id));
-
-    BLOCK_ID_RANGE_CHECK(&temp_id);
-
-    (*p_block_id) = temp_id;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_store(pstorage_handle_t * p_dest,
-                        uint8_t           * p_src,
-                        pstorage_size_t     size,
-                        pstorage_size_t     offset)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_src);
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK(p_dest);
-    BLOCK_ID_RANGE_CHECK(p_dest);
-    SIZE_CHECK(p_dest, size);
-    OFFSET_CHECK(p_dest, offset, size);
-
-    // Verify word alignment.
-    if ((!is_word_aligned(p_src)) || (!is_word_aligned((void *)(uint32_t)offset)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    uint32_t storage_addr = p_dest->block_id + offset;
-
-    uint32_t retval = ble_flash_block_write((uint32_t *)storage_addr,
-                                            (uint32_t *)p_src,
-                                            (size /sizeof(uint32_t)));
-
-    app_notify(p_dest, p_src, PSTORAGE_STORE_OP_CODE, size, retval);
-    
-    return retval;
-}
-
-/** @brief Function for handling flash updates using swap page
- *
- * __________________________________________________
- * |              Page1                            |
- * |_______________________________________________|
- * | head |    body (to be updated )        | tail |
- * |______|_________________________________|______|
- *
- * ________________________________________________________________________________________
- * |              Page1                            |             Page2                    |
- * |_______________________________________________|______________________________________|
- * | head           |          body (to be updated )         | tail                       |
- * |________________|________________________________________|____________________________|
- *
- *
- * ToDo:  pointers not uint32_t for addresses
- *
- */
-
-uint32_t pstorage_update(pstorage_handle_t * p_dest,
-                        uint8_t           * p_src,
-                        pstorage_size_t     size,
-                        pstorage_size_t     offset)
-{
-
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_src);
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK(p_dest);
-    BLOCK_ID_RANGE_CHECK(p_dest);
-    SIZE_CHECK(p_dest, size);
-    OFFSET_CHECK(p_dest, offset, size);
-
-    uint32_t *p_swap_addr = (uint32_t *)PSTORAGE_SWAP_ADDR;
-    uint32_t *p_page_addr1 =  (uint32_t *) PAGE_BASE_ADDR(p_dest->block_id + offset);
-#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE
-    uint32_t *p_page_addr2 =  (uint32_t *) PAGE_BASE_ADDR(p_dest->block_id + offset + size-1);
-#endif
-    // block may not be aligned with page, so head must include all trailing blocks
-    uint16_t head_word_count =  (uint32_t)((uint32_t *)p_dest->block_id - p_page_addr1) + (offset)/sizeof(uint32_t);
-    uint16_t body_word_count =  size/sizeof(uint32_t);
-    uint16_t tail_word_count;
-    uint32_t retval;
-
-    // Verify word alignment.
-    if ((!is_word_aligned(p_src)) || (!is_word_aligned((void *)(uint32_t)offset)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-    // erase swap page
-    (void) ble_flash_page_erase(PSTORAGE_SWAP_ADDR / BLE_FLASH_PAGE_SIZE);
-#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE
-    if (p_page_addr1 == p_page_addr2)
-    {
-#endif
-    	// tail is in the same page as head
-        tail_word_count = BLE_FLASH_PAGE_SIZE/sizeof(uint32_t) - head_word_count - body_word_count;
-    	// copy of the head
-        if (head_word_count)
-        {
-        	retval = ble_flash_block_write(p_swap_addr, p_page_addr1, head_word_count );
-        	if (retval != NRF_SUCCESS)
-        	{
-        		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-        		return retval;
-        	}
-        }
-        // copy of the body
-        retval = ble_flash_block_write(p_swap_addr+head_word_count, (uint32_t *)p_src, body_word_count);
-        if (retval != NRF_SUCCESS)
-        {
-          app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-          return retval;
-        }
-        // copy of the tail
-        if (tail_word_count)
-        {
-        	retval = ble_flash_block_write(p_swap_addr+head_word_count+body_word_count, p_page_addr1+head_word_count+body_word_count, tail_word_count );
-        	if (retval != NRF_SUCCESS)
-        	{
-        		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-        		return retval;
-        	}
-        }
-        // erase active page
-        (void) ble_flash_page_erase((uint32_t)p_page_addr1 / BLE_FLASH_PAGE_SIZE);
-        // restore updated page
-        retval = ble_flash_block_write(p_page_addr1, p_swap_addr, BLE_FLASH_PAGE_SIZE/sizeof(uint32_t));
-#ifdef SUPPORT_MODULES_LARGER_THAN_PAGE
-    }
-    else
-    {
-    	// tail is in NOT in the same page as head - need to swap twice
-    	uint16_t body1_word_count =  BLE_FLASH_PAGE_SIZE/sizeof(uint32_t) - head_word_count;
-    	uint16_t body2_word_count =  body_word_count - body1_word_count;
-        tail_word_count = BLE_FLASH_PAGE_SIZE/sizeof(uint32_t) - body2_word_count;
-        // copy head
-        retval = ble_flash_block_write(p_swap_addr, p_page_addr1, head_word_count );
-    	if (retval != NRF_SUCCESS)
-    	{
-    		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-    		return retval;
-    	}
-        // copy body1
-        retval = ble_flash_block_write(p_swap_addr, (uint32_t *)p_src, body1_word_count );
-    	if (retval != NRF_SUCCESS)
-    	{
-    		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-    		return retval;
-    	}
-        // erase active page
-        (void) ble_flash_page_erase((uint32_t)p_page_addr1 / BLE_FLASH_PAGE_SIZE);
-        // restore updated page1
-        retval = ble_flash_block_write(p_page_addr1, p_swap_addr, BLE_FLASH_PAGE_SIZE/sizeof(uint32_t));
-    	if (retval != NRF_SUCCESS)
-    	{
-    		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-    		return retval;
-    	}
-        // erase swap page
-        (void) ble_flash_page_erase(PSTORAGE_SWAP_ADDR / BLE_FLASH_PAGE_SIZE);
-        // copy body2
-        retval = ble_flash_block_write(p_swap_addr, (uint32_t *)p_src + body1_word_count, body2_word_count );
-    	if (retval != NRF_SUCCESS)
-    	{
-    		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-    		return retval;
-    	}
-        // copy tail
-        retval = ble_flash_block_write(p_swap_addr, p_page_addr2+body2_word_count, tail_word_count );
-    	if (retval != NRF_SUCCESS)
-    	{
-    		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-    		return retval;
-    	}
-        // erase active page
-        (void) ble_flash_page_erase((uint32_t)p_page_addr2 / BLE_FLASH_PAGE_SIZE);
-        // restore updated page2
-        retval = ble_flash_block_write(p_page_addr2, p_swap_addr, BLE_FLASH_PAGE_SIZE/sizeof(uint32_t));
-    	if (retval != NRF_SUCCESS)
-    	{
-    		app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-    		return retval;
-    	}
-    }
-#endif
-    app_notify(p_dest, p_src, PSTORAGE_UPDATE_OP_CODE, size, retval);
-    return retval;
-
-}
-
-uint32_t pstorage_load(uint8_t *           p_dest,
-                       pstorage_handle_t * p_src,
-                       pstorage_size_t     size,
-                       pstorage_size_t     offset)
-{
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_src);
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK (p_src);
-    BLOCK_ID_RANGE_CHECK(p_src);
-    SIZE_CHECK(p_src,size);
-    OFFSET_CHECK(p_src,offset,size);
-
-    // Verify word alignment.
-    if ((!is_word_aligned(p_dest)) || (!is_word_aligned((void *)(uint32_t)offset)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    memcpy(p_dest, (((uint8_t *)p_src->block_id) + offset), size);
-
-    app_notify(p_src, p_dest, PSTORAGE_LOAD_OP_CODE, size, NRF_SUCCESS);
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size)
-{
-    uint32_t page_addr;
-    uint32_t retval;
-    uint16_t page_count;
-
-    VERIFY_MODULE_INITIALIZED();
-    NULL_PARAM_CHECK(p_dest);
-    MODULE_ID_RANGE_CHECK(p_dest);
-
-    page_addr = p_dest->block_id / BLE_FLASH_PAGE_SIZE;
-
-    retval = NRF_SUCCESS;
-
-    for (page_count = 0; page_count < m_app_table[p_dest->module_id].no_of_pages; page_count++)
-    {
-        retval = ble_flash_page_erase(page_addr);
-        page_addr++;
-        if (retval != NRF_SUCCESS)
-        {
-            break;
-        }
-    }
-    app_notify(p_dest, NULL, PSTORAGE_CLEAR_OP_CODE, size, retval);
-    return retval;
-}
-
-void pstorage_sys_event_handler(uint32_t sys_evt)
-{
-
-}
-
-uint32_t pstorage_access_status_get(uint32_t * p_count)
-{
-    if (p_count)
-    {
-        *p_count = 0;
-    }
-    return NRF_SUCCESS;
-}

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/pstorage/pstorage_raw.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage_raw.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage_raw.c
deleted file mode 100644
index ac12f7c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pstorage/pstorage_raw.c
+++ /dev/null
@@ -1,471 +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 "pstorage.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include "nordic_common.h"
-#include "nrf_error.h"
-#include "nrf_assert.h"
-#include "nrf.h"
-#include "nrf_soc.h"
-#include "app_util.h"
-
-/** @file
- *
- * @defgroup persistent_storage_raw Persistent Storage Interface - Raw Mode Implementation
- * @{
- * @ingroup persistent_storage
- * @brief Persistent Storage Interface - Raw Mode Implementation.
- *
- * @details This file contains the source code for raw mode implementation of pstorage.
- * It is intended for special use cases where flash size is critical or the application must have
- * full control of the flash, such as DFU. The registration function in this implementation only
- * allocates a module id for the queue but does not locate any flash pages for the registrant.
- * This implementation provides no safety checking of addresses when clearing or storing data into
- * flash. The application is responsible for handling flash addresses and care must therefore be 
- * taken in application not to erase application area.
- * This implementation does not support the @ref pstorage_update function.
- */
-
-#define INVALID_OPCODE              0x00    /**< Invalid op code identifier. */
-
-#ifdef NRF51
-#define SOC_MAX_WRITE_SIZE          1024    /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF51. */
-#elif NRF52
-#define SOC_MAX_WRITE_SIZE          4096    /**< Maximum write size allowed for a single call to \ref sd_flash_write as specified in the SoC API on the nRF52. */
-#else
-#error No target defined
-#endif
-
-
-/**
- * @brief Application registration information.
- *
- * @details Define application specific information that application needs to maintain to be able
- *          to process requests from each one of them.
- */
-typedef struct
-{
-    pstorage_ntf_cb_t cb;   /**< Callback registered with the module to be notified of result of flash access.  */
-} pstorage_module_table_t;
-
-
-/**
- * @brief Defines command queue element.
- *
- * @details Defines command queue element. Each element encapsulates needed information to process
- *          a flash access command.
- */
-typedef struct
-{
-    uint8_t              op_code;       /**< Identifies flash access operation being queued. Element is free is op-code is INVALID_OPCODE */
-    pstorage_size_t      size;          /**< Identifies size in bytes requested for the operation. */
-    pstorage_size_t      offset;        /**< Offset requested by the application for access operation. */    
-    pstorage_handle_t    storage_addr;  /**< Address/Identifier for persistent memory. */
-    uint8_t            * p_data_addr;   /**< Address/Identifier for data memory. This is assumed to be resident memory. */    
-} cmd_queue_element_t;
-
-
-/**
- * @brief Defines command queue, an element is free is op_code field is not invalid.
- *
- * @details Defines commands enqueued for flash access. At any point of time, this queue has one or
- *          more flash access operation pending if the count field is not zero. When the queue is
- *          not empty, the rp (read pointer) field points to the flash access command in progress
- *          or to requested next. The queue implements a simple first in first out algorithm.
- *          Data addresses are assumed to be resident.
- */
-typedef struct
-{
-    uint8_t              rp;                              /**< Read pointer, pointing to flash access that is ongoing or to be requested next. */
-    uint8_t              count;                           /**< Number of elements in the queue.  */
-    bool                 flash_access;                    /**< Flag to ensure an flash event received is for an request issued by the module. */
-    cmd_queue_element_t  cmd[PSTORAGE_CMD_QUEUE_SIZE];    /**< Array to maintain flash access operation details */
-}cmd_queue_t;
-
-static cmd_queue_t             m_cmd_queue;                             /**< Flash operation request queue. */
-static pstorage_module_table_t m_app_table[PSTORAGE_NUM_OF_PAGES];      /**< Registered application information table. */
-static pstorage_size_t         m_next_app_instance;                     /**< Points to the application module instance that can be allocated next */
-static pstorage_size_t         m_round_val;                             /**< Round value for multiple round operations. For erase operations, the round value will contain current round counter which is identical to number of pages erased. For store operations, the round value contains current round of operation * SOC_MAX_WRITE_SIZE to ensure each store to the SoC Flash API is within the SoC limit. */
-
-/**
- * @brief Function for processing of commands and issuing flash access request to the SoftDevice.
- *
- * @return The return value received from SoftDevice.
- */
-static uint32_t cmd_process(void);
-
-
-/**
- * @brief Function for notifying application of any errors.
- *
- * @param[in] result Result of event being notified.
- * @param[in] p_elem Pointer to the element for which a notification should be given.
- */
-static void app_notify(uint32_t result, cmd_queue_element_t * p_elem);
-
-
-/**
- * @defgroup utility_functions Utility internal functions.
- * @{
- * @details Utility functions needed for interfacing with flash through SoC APIs.
- * SoC APIs are non blocking and provide the result of flash access through an event.
- *
- * @note Only one flash access operation is permitted at a time by SoC. Hence a queue is
- * maintained by this module.
- */
- 
-/**
- * @brief Function for initializing a command queue element.
- *
- * @param[in] index Index identifying element to be initialized.
- */
-static void cmd_queue_element_init(uint32_t index)
-{
-    // Internal function and checks on range of index can be avoided
-    m_cmd_queue.cmd[index].op_code                = INVALID_OPCODE;
-    m_cmd_queue.cmd[index].size                   = 0;
-    m_cmd_queue.cmd[index].storage_addr.module_id = PSTORAGE_NUM_OF_PAGES;
-    m_cmd_queue.cmd[index].storage_addr.block_id  = 0;
-    m_cmd_queue.cmd[index].p_data_addr            = NULL;
-    m_cmd_queue.cmd[index].offset                 = 0;
-}
-
-
-/**
- * @brief Function for initializing the command queue.
- */
-static void cmd_queue_init(void)
-{
-    uint32_t cmd_index;
-
-    m_round_val              = 0;
-    m_cmd_queue.rp           = 0;
-    m_cmd_queue.count        = 0;
-    m_cmd_queue.flash_access = false;
-
-    for(cmd_index = 0; cmd_index < PSTORAGE_CMD_QUEUE_SIZE; cmd_index++)
-    {
-        cmd_queue_element_init(cmd_index);
-    }
-}
-
-
-/**
- * @brief Function for enqueueing a flash access operation.
- *
- * @param[in] opcode         Operation code for the command to queue.
- * @param[in] p_storage_addr Pointer to the destination address.
- * @param[in] p_data_addr    Pointer to the source address containing the data.
- * @param[in] size           Size of data clear or write.
- * @param[in] offset         Offset to the address identified by the source data address.
- *
- * @retval NRF_SUCCESS      If the enqueueing succeeded.
- * @retval NRF_ERROR_NO_MEM In case the queue is full.
- * @return Any error returned by the SoftDevice flash API.
- */
-static uint32_t cmd_queue_enqueue(uint8_t             opcode,
-                                  pstorage_handle_t * p_storage_addr,
-                                  uint8_t           * p_data_addr,
-                                  pstorage_size_t     size,
-                                  pstorage_size_t     offset)
-{
-    uint32_t retval;
-
-    if (m_cmd_queue.count != PSTORAGE_CMD_QUEUE_SIZE)
-    {
-        uint8_t write_index = m_cmd_queue.rp + m_cmd_queue.count;
-
-        if (write_index >= PSTORAGE_CMD_QUEUE_SIZE)
-        {
-            write_index -= PSTORAGE_CMD_QUEUE_SIZE;
-        }
-
-        m_cmd_queue.cmd[write_index].op_code      = opcode;
-        m_cmd_queue.cmd[write_index].p_data_addr  = p_data_addr;
-        m_cmd_queue.cmd[write_index].storage_addr = (*p_storage_addr);
-        m_cmd_queue.cmd[write_index].size         = size;
-        m_cmd_queue.cmd[write_index].offset       = offset;
-        retval                                    = NRF_SUCCESS;
-        if (m_cmd_queue.flash_access == false)
-        {
-            retval = cmd_process();
-            if (retval == NRF_ERROR_BUSY)
-            {
-                // In case of busy error code, it is possible to attempt to access flash.
-                retval = NRF_SUCCESS;
-            }
-        }
-        m_cmd_queue.count++;
-    }
-    else
-    {
-        retval = NRF_ERROR_NO_MEM;
-    }
-
-    return retval;
-}
-
-
-/**
- * @brief Function for dequeueing a command element.
- *
- * @retval NRF_SUCCESS If the dequeueing succeeded and next command was processed.
- * @return Any error returned by the SoftDevice flash API.
- */
-static uint32_t cmd_queue_dequeue(void)
-{
-    uint32_t retval = NRF_SUCCESS;
-
-    // If any flash operation is enqueued, schedule
-    if ((m_cmd_queue.count > 0) && (m_cmd_queue.flash_access == false))
-    {
-        retval = cmd_process();
-        if (retval != NRF_SUCCESS)
-        {
-            // Flash could be accessed by other modules, hence a busy error is
-            // acceptable, but any other error needs to be indicated.
-            if (retval == NRF_ERROR_BUSY)
-            {
-                // In case of busy error code, it is possible to attempt to access flash.
-                retval = NRF_SUCCESS;
-            }
-        }
-    }
-    else
-    {
-        // No flash access request pending.
-    }
-
-    return retval;
-}
-
-
-/**
- * @brief Function for notifying application of any errors.
- *
- * @param[in] result Result of event being notified.
- * @param[in] p_elem Pointer to the element for which a notification should be given.
- */
-static void app_notify(uint32_t result, cmd_queue_element_t * p_elem)
-{
-    pstorage_ntf_cb_t ntf_cb;
-    uint8_t           op_code = p_elem->op_code;
-    
-    ntf_cb = m_app_table[p_elem->storage_addr.module_id].cb;
-
-    // Indicate result to client.
-    ntf_cb(&p_elem->storage_addr,
-           op_code,
-           result,
-           p_elem->p_data_addr,
-           p_elem->size);
-}
-
-
-/**
- * @brief Function for handling of system events from SoftDevice.
- *
- * @param[in] sys_evt System event received.
- */
-void pstorage_sys_event_handler(uint32_t sys_evt)
-{
-    uint32_t retval = NRF_SUCCESS;
-
-    // The event shall only be processed if requested by this module.
-    if (m_cmd_queue.flash_access == true)
-    {
-        cmd_queue_element_t * p_cmd;
-        m_cmd_queue.flash_access = false;
-        switch (sys_evt)
-        {
-            case NRF_EVT_FLASH_OPERATION_SUCCESS:
-            {
-                p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp];
-                m_round_val++;
-            
-                bool command_finished = ((m_round_val * SOC_MAX_WRITE_SIZE) >= p_cmd->size);
-
-                if (command_finished)
-                {
-                    uint8_t queue_rp = m_cmd_queue.rp;
-                    
-                    m_round_val = 0;
-                    m_cmd_queue.count--;
-                    m_cmd_queue.rp++;
-
-                    if (m_cmd_queue.rp >= PSTORAGE_CMD_QUEUE_SIZE)
-                    {
-                        m_cmd_queue.rp -= PSTORAGE_CMD_QUEUE_SIZE;
-                    }
-
-                    app_notify(retval, &m_cmd_queue.cmd[queue_rp]);
-
-                    // Initialize/free the element as it is now processed.
-                    cmd_queue_element_init(queue_rp);
-                }
-                // Schedule any queued flash access operations.
-                retval = cmd_queue_dequeue();
-                if (retval != NRF_SUCCESS)
-                {
-                    app_notify(retval, &m_cmd_queue.cmd[m_cmd_queue.rp]);
-                }
-            }
-            break;
-                
-            case NRF_EVT_FLASH_OPERATION_ERROR:
-                app_notify(NRF_ERROR_TIMEOUT, &m_cmd_queue.cmd[m_cmd_queue.rp]);
-                break;
-            
-            default:
-                // No implementation needed.
-                break;
-        }
-    }
-}
-
-
-/**
- * @brief Function for processing of commands and issuing flash access request to the SoftDevice.
- *
- * @return The return value received from SoftDevice.
- */
-static uint32_t cmd_process(void)
-{
-    uint32_t              retval;
-    uint32_t              storage_addr;
-    cmd_queue_element_t * p_cmd;
-
-    retval = NRF_ERROR_FORBIDDEN;
-
-    p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp];
-
-    storage_addr = p_cmd->storage_addr.block_id;
-
-    switch (p_cmd->op_code)
-    {
-        case PSTORAGE_STORE_OP_CODE:
-        {
-            uint32_t  size;
-            uint32_t  offset;
-            uint8_t * p_data_addr = p_cmd->p_data_addr;
-
-            offset        = (m_round_val * SOC_MAX_WRITE_SIZE);
-            size          = p_cmd->size - offset;
-            p_data_addr  += offset;
-            storage_addr += (p_cmd->offset + offset);
-
-            if (size < SOC_MAX_WRITE_SIZE)
-            {
-                retval = sd_flash_write(((uint32_t *)storage_addr),
-                                        (uint32_t *)p_data_addr,
-                                        size / sizeof(uint32_t));
-            }
-            else
-            {
-                retval = sd_flash_write(((uint32_t *)storage_addr),
-                                        (uint32_t *)p_data_addr,
-                                        SOC_MAX_WRITE_SIZE / sizeof(uint32_t));
-            }
-        }
-        break;
-        
-        case PSTORAGE_CLEAR_OP_CODE:
-        {
-            uint32_t page_number;
-
-            page_number =  ((storage_addr / PSTORAGE_FLASH_PAGE_SIZE) +
-                            m_round_val);
-
-            retval = sd_flash_page_erase(page_number);
-        }
-        break;
-    
-        default:
-            // Should never reach here.
-            break;
-    }
-    
-    if (retval == NRF_SUCCESS)
-    {
-       m_cmd_queue.flash_access = true;
-    }
-
-    return retval;
-}
-/** @} */
-
-
-uint32_t pstorage_init(void)
-{
-    cmd_queue_init();
-    
-    m_next_app_instance = 0;
-    m_round_val         = 0;
-
-    for(unsigned int index = 0; index < PSTORAGE_NUM_OF_PAGES; index++)
-    {
-        m_app_table[index].cb          = NULL;
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_register(pstorage_module_param_t * p_module_param,
-                           pstorage_handle_t       * p_block_id)
-{
-    if (m_next_app_instance == PSTORAGE_NUM_OF_PAGES)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-    p_block_id->module_id                 = m_next_app_instance;
-    m_app_table[m_next_app_instance++].cb = p_module_param->cb;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t pstorage_block_identifier_get(pstorage_handle_t * p_base_id,
-                                       pstorage_size_t     block_num,
-                                       pstorage_handle_t * p_block_id)
-{
-    return NRF_ERROR_NOT_SUPPORTED;
-}
-
-
-uint32_t pstorage_store(pstorage_handle_t * p_dest,
-                        uint8_t           * p_src,
-                        pstorage_size_t     size,
-                        pstorage_size_t     offset)
-{
-    // Verify word alignment.
-    if ((!is_word_aligned(p_src)) || (!is_word_aligned(p_src+offset)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    return cmd_queue_enqueue(PSTORAGE_STORE_OP_CODE, p_dest, p_src, size, offset);
-}
-
-
-uint32_t pstorage_clear(pstorage_handle_t * p_dest, pstorage_size_t size)
-{
-    return cmd_queue_enqueue(PSTORAGE_CLEAR_OP_CODE, p_dest, NULL , size, 0);
-}
-
-
-/**
- * @}
- */

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/pwm/nrf_drv_pwm.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pwm/nrf_drv_pwm.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pwm/nrf_drv_pwm.c
deleted file mode 100644
index bfca607..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pwm/nrf_drv_pwm.c
+++ /dev/null
@@ -1,350 +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 <string.h>
-#include "nrf_drv_pwm.h"
-#include "nrf_drv_common.h"
-#include "nrf_gpio.h"
-#include "app_util_platform.h"
-
-#if (PWM_COUNT == 0)
-    #error "No PWM instances enabled in the driver configuration file."
-#endif
-
-
-// Control block - driver instance local data.
-typedef struct
-{
-    nrf_drv_pwm_handler_t    handler;
-    nrf_drv_state_t volatile state;
-} pwm_control_block_t;
-static pwm_control_block_t m_cb[PWM_COUNT];
-
-static nrf_drv_pwm_config_t const m_default_config[PWM_COUNT] = {
-#if PWM0_ENABLED
-    NRF_DRV_PWM_DEFAULT_CONFIG(0),
-#endif
-#if PWM1_ENABLED
-    NRF_DRV_PWM_DEFAULT_CONFIG(1),
-#endif
-#if PWM2_ENABLED
-    NRF_DRV_PWM_DEFAULT_CONFIG(2),
-#endif
-};
-
-
-static void configure_pins(nrf_drv_pwm_t const * const p_instance,
-                           nrf_drv_pwm_config_t const * p_config)
-{
-    uint32_t out_pins[NRF_PWM_CHANNEL_COUNT];
-    uint8_t i;
-
-    for (i = 0; i < NRF_PWM_CHANNEL_COUNT; ++i)
-    {
-        uint8_t output_pin = p_config->output_pins[i];
-        if (output_pin != NRF_DRV_PWM_PIN_NOT_USED)
-        {
-            bool inverted = output_pin &  NRF_DRV_PWM_PIN_INVERTED;
-            out_pins[i]   = output_pin & ~NRF_DRV_PWM_PIN_INVERTED;
-
-            if (inverted)
-            {
-                nrf_gpio_pin_set(out_pins[i]);
-            }
-            else
-            {
-                nrf_gpio_pin_clear(out_pins[i]);
-            }
-
-            nrf_gpio_cfg_output(out_pins[i]);
-        }
-        else
-        {
-            out_pins[i] = NRF_PWM_PIN_NOT_CONNECTED;
-        }
-    }
-
-    nrf_pwm_pins_set(p_instance->p_registers, out_pins);
-}
-
-
-ret_code_t nrf_drv_pwm_init(nrf_drv_pwm_t const * const p_instance,
-                            nrf_drv_pwm_config_t const * p_config,
-                            nrf_drv_pwm_handler_t        handler)
-{
-    pwm_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-
-    if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config[p_instance->drv_inst_idx];
-    }
-
-    p_cb->handler = handler;
-
-    configure_pins(p_instance, p_config);
-
-    nrf_pwm_enable(p_instance->p_registers);
-    nrf_pwm_configure(p_instance->p_registers,
-        p_config->base_clock, p_config->count_mode, p_config->top_value);
-    nrf_pwm_decoder_set(p_instance->p_registers,
-        p_config->load_mode, p_config->step_mode);
-
-    nrf_pwm_shorts_set(p_instance->p_registers, 0);
-    nrf_pwm_int_set(p_instance->p_registers, 0);
-    nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_LOOPSDONE);
-    nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_SEQEND0);
-    nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_SEQEND1);
-    nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_STOPPED);
-
-    if (p_cb->handler)
-    {
-        nrf_drv_common_irq_enable(nrf_drv_get_IRQn(p_instance->p_registers),
-            p_config->irq_priority);
-    }
-
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_pwm_uninit(nrf_drv_pwm_t const * const p_instance)
-{
-    pwm_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-
-    nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_instance->p_registers));
-
-    nrf_pwm_disable(p_instance->p_registers);
-
-    p_cb->state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-
-static void start_playback(nrf_drv_pwm_t const * const p_instance,
-                           pwm_control_block_t * p_cb,
-                           uint8_t               flags,
-                           nrf_pwm_task_t        starting_task)
-{
-    p_cb->state = NRF_DRV_STATE_POWERED_ON;
-
-    if (p_cb->handler)
-    {
-        // The notification about finished playback is by default enabled, but
-        // this can be suppressed. The notification that the peripheral has been
-        // stopped is always enable.
-        uint32_t int_mask = NRF_PWM_INT_LOOPSDONE_MASK |
-                            NRF_PWM_INT_STOPPED_MASK;
-
-        if (flags & NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ0)
-        {
-            int_mask |= NRF_PWM_INT_SEQEND0_MASK;
-        }
-        if (flags & NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ1)
-        {
-            int_mask |= NRF_PWM_INT_SEQEND1_MASK;
-        }
-        if (flags & NRF_DRV_PWM_FLAG_NO_EVT_FINISHED)
-        {
-            int_mask &= ~NRF_PWM_INT_LOOPSDONE_MASK;
-        }
-
-        nrf_pwm_int_set(p_instance->p_registers, int_mask);
-    }
-
-    nrf_pwm_event_clear(p_instance->p_registers, NRF_PWM_EVENT_STOPPED);
-
-    nrf_pwm_task_trigger(p_instance->p_registers, starting_task);
-}
-
-
-void nrf_drv_pwm_simple_playback(nrf_drv_pwm_t const * const p_instance,
-                                 nrf_pwm_sequence_t const * p_sequence,
-                                 uint16_t                   playback_count,
-                                 uint32_t                   flags)
-{
-    pwm_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(playback_count > 0);
-    ASSERT(nrf_drv_is_in_RAM(p_sequence->values.p_raw));
-
-    // To take advantage of the looping mechanism, we need to use both sequences
-    // (single sequence can be played back only once).
-    nrf_pwm_sequence_set(p_instance->p_registers, 0, p_sequence);
-    nrf_pwm_sequence_set(p_instance->p_registers, 1, p_sequence);
-    bool odd = (playback_count & 1);
-    nrf_pwm_loop_set(p_instance->p_registers, playback_count/2 + (odd ? 1 : 0));
-
-    uint32_t shorts_mask;
-    if (flags & NRF_DRV_PWM_FLAG_STOP)
-    {
-        shorts_mask = NRF_PWM_SHORT_LOOPSDONE_STOP_MASK;
-    }
-    else if (flags & NRF_DRV_PWM_FLAG_LOOP)
-    {
-        shorts_mask = odd ? NRF_PWM_SHORT_LOOPSDONE_SEQSTART1_MASK
-                          : NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK;
-    }
-    else
-    {
-        shorts_mask = 0;
-    }
-    nrf_pwm_shorts_set(p_instance->p_registers, shorts_mask);
-
-    start_playback(p_instance, p_cb, flags, odd ? NRF_PWM_TASK_SEQSTART1
-                                                : NRF_PWM_TASK_SEQSTART0);
-}
-
-
-void nrf_drv_pwm_complex_playback(nrf_drv_pwm_t const * const p_instance,
-                                  nrf_pwm_sequence_t const * p_sequence_0,
-                                  nrf_pwm_sequence_t const * p_sequence_1,
-                                  uint16_t                   playback_count,
-                                  uint32_t                   flags)
-{
-    pwm_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(playback_count > 0);
-    ASSERT(nrf_drv_is_in_RAM(p_sequence_0->values.p_raw));
-    ASSERT(nrf_drv_is_in_RAM(p_sequence_1->values.p_raw));
-
-    nrf_pwm_sequence_set(p_instance->p_registers, 0, p_sequence_0);
-    nrf_pwm_sequence_set(p_instance->p_registers, 1, p_sequence_1);
-    nrf_pwm_loop_set(p_instance->p_registers, playback_count);
-
-    uint32_t shorts_mask;
-    if (flags & NRF_DRV_PWM_FLAG_STOP)
-    {
-        shorts_mask = NRF_PWM_SHORT_LOOPSDONE_STOP_MASK;
-    }
-    else if (flags & NRF_DRV_PWM_FLAG_LOOP)
-    {
-        shorts_mask = NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK;
-    }
-    else
-    {
-        shorts_mask = 0;
-    }
-    nrf_pwm_shorts_set(p_instance->p_registers, shorts_mask);
-
-    start_playback(p_instance, p_cb, flags, NRF_PWM_TASK_SEQSTART0);
-}
-
-
-bool nrf_drv_pwm_stop(nrf_drv_pwm_t const * const p_instance,
-                      bool wait_until_stopped)
-{
-    ASSERT(m_cb[p_instance->drv_inst_idx].state != NRF_DRV_STATE_UNINITIALIZED);
-
-    if (nrf_drv_pwm_is_stopped(p_instance))
-    {
-        return true;
-    }
-
-    nrf_pwm_task_trigger(p_instance->p_registers, NRF_PWM_TASK_STOP);
-
-    do {
-        if (nrf_drv_pwm_is_stopped(p_instance))
-        {
-            return true;
-        }
-    } while (wait_until_stopped);
-
-    return false;
-}
-
-
-bool nrf_drv_pwm_is_stopped(nrf_drv_pwm_t const * const p_instance)
-{
-    pwm_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-
-    // If the event handler is used (interrupts are enabled), the state will
-    // be changed in interrupt handler when the STOPPED event occurs.
-    if (p_cb->state != NRF_DRV_STATE_POWERED_ON)
-    {
-        return true;
-    }
-    // If interrupts are disabled, we must check the STOPPED event here.
-    if (nrf_pwm_event_check(p_instance->p_registers, NRF_PWM_EVENT_STOPPED))
-    {
-        p_cb->state = NRF_DRV_STATE_INITIALIZED;
-        return true;
-    }
-
-    return false;
-}
-
-
-static void irq_handler(NRF_PWM_Type * p_pwm, pwm_control_block_t * p_cb)
-{
-    ASSERT(p_cb->handler);
-
-    // The SEQEND0 and SEQEND1 events are only handled when the user asked for
-    // it (by setting proper flags when starting the playback).
-    if (nrf_pwm_int_enable_check(p_pwm, NRF_PWM_INT_SEQEND0_MASK) &&
-        nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_SEQEND0))
-    {
-        nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_SEQEND0);
-        p_cb->handler(NRF_DRV_PWM_EVT_END_SEQ0);
-    }
-    if (nrf_pwm_int_enable_check(p_pwm, NRF_PWM_INT_SEQEND1_MASK) &&
-        nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_SEQEND1))
-    {
-        nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_SEQEND1);
-        p_cb->handler(NRF_DRV_PWM_EVT_END_SEQ1);
-    }
-
-    // The LOOPSDONE event is handled by default, but this can be disabled.
-    if (nrf_pwm_int_enable_check(p_pwm, NRF_PWM_INT_LOOPSDONE_MASK) &&
-        nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_LOOPSDONE))
-    {
-        nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_LOOPSDONE);
-        p_cb->handler(NRF_DRV_PWM_EVT_FINISHED);
-    }
-
-    if (nrf_pwm_event_check(p_pwm, NRF_PWM_EVENT_STOPPED))
-    {
-        nrf_pwm_event_clear(p_pwm, NRF_PWM_EVENT_STOPPED);
-
-        p_cb->state = NRF_DRV_STATE_INITIALIZED;
-
-        p_cb->handler(NRF_DRV_PWM_EVT_STOPPED);
-    }
-}
-
-
-#if PWM0_ENABLED
-void PWM0_IRQHandler(void)
-{
-    irq_handler(NRF_PWM0, &m_cb[PWM0_INSTANCE_INDEX]);
-}
-#endif
-
-#if PWM1_ENABLED
-void PWM1_IRQHandler(void)
-{
-    irq_handler(NRF_PWM1, &m_cb[PWM1_INSTANCE_INDEX]);
-}
-#endif
-
-#if PWM2_ENABLED
-void PWM2_IRQHandler(void)
-{
-    irq_handler(NRF_PWM2, &m_cb[PWM2_INSTANCE_INDEX]);
-}
-#endif


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

Posted by cc...@apache.org.
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/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c
deleted file mode 100644
index 6944011..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.c
+++ /dev/null
@@ -1,312 +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.
- *
- */
-#include "ble_conn.h"
-#include "conn_mw_ble.h"
-#include "ble_serialization.h"
-#include "conn_ble_user_mem.h"
-
-extern sercon_ble_user_mem_t m_conn_user_mem_table[];
-
-uint32_t conn_mw_ble_tx_packet_count_get(uint8_t const * const p_rx_buf,
-                                         uint32_t              rx_buf_len,
-                                         uint8_t * const       p_tx_buf,
-                                         uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint8_t   count;
-    uint16_t  conn_handle;
-    uint8_t * p_count = &count;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_tx_packet_count_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_tx_packet_count_get(conn_handle, p_count);
-
-    err_code = ble_tx_packet_count_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    ble_uuid128_t   uuid;
-    ble_uuid128_t * p_uuid = &uuid;
-    uint8_t         uuid_type;
-    uint8_t *       p_uuid_type = &uuid_type;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_uuid_vs_add_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_type);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_uuid_vs_add(p_uuid, p_uuid_type);
-
-    err_code = ble_uuid_vs_add_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid_type);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    return err_code;
-}
-
-uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint8_t      raw_uuid[16];
-    uint8_t      uuid_len   = sizeof (raw_uuid);
-    uint8_t *    p_raw_uuid = raw_uuid;
-    ble_uuid_t   uuid;
-    ble_uuid_t * p_uuid   = &uuid;
-    uint32_t     err_code = NRF_SUCCESS;
-    uint32_t     sd_err_code;
-
-    err_code = ble_uuid_decode_req_dec(p_rx_buf, rx_buf_len, &uuid_len, &p_raw_uuid, &p_uuid);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_uuid_decode(uuid_len, p_raw_uuid, p_uuid);
-
-    err_code = ble_uuid_decode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_uuid);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint8_t      raw_uuid[16];
-    uint8_t      uuid_len   = sizeof (raw_uuid);
-    uint8_t *    p_uuid_len = &uuid_len;
-    uint8_t *    p_raw_uuid = raw_uuid;
-    ble_uuid_t   uuid;
-    ble_uuid_t * p_uuid   = &uuid;
-    uint32_t     err_code = NRF_SUCCESS;
-    uint32_t     sd_err_code;
-
-    err_code = ble_uuid_encode_req_dec(p_rx_buf, rx_buf_len, &p_uuid, &p_uuid_len, &p_raw_uuid);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_uuid_encode(p_uuid, p_uuid_len, p_raw_uuid);
-
-    err_code = ble_uuid_encode_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, uuid_len, p_raw_uuid);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    ble_version_t   version;
-    ble_version_t * p_version = &version;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_version_get_req_dec(p_rx_buf, rx_buf_len, &p_version);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_version_get(p_version);
-
-    err_code = ble_version_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_version);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf,
-                             uint32_t              rx_buf_len,
-                             uint8_t * const       p_tx_buf,
-                             uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t   opt_id;
-    ble_opt_t  opt;
-    ble_opt_t *p_opt = &opt;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_opt_get_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_opt_get(opt_id, p_opt);
-
-    err_code = ble_opt_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, opt_id, p_opt);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf,
-                             uint32_t              rx_buf_len,
-                             uint8_t * const       p_tx_buf,
-                             uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t      opt_id = 0xFFFFFFFF;
-    uint16_t      act_latency;
-    uint8_t       passkey[BLE_GAP_PASSKEY_LEN];
-    ble_gap_irk_t irk = {{0}};
-    uint32_t      err_code = NRF_SUCCESS;
-
-    /* Pre-decode type of ble_opt_t union */
-    err_code = ble_opt_id_pre_dec(p_rx_buf, rx_buf_len, &opt_id);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    ble_opt_t  opt;
-    ble_opt_t *p_opt = &opt;
-    /* Initialaize appropriate pointers inside opt union based on opt_id */
-    switch(opt_id)
-    {
-        case BLE_GAP_OPT_LOCAL_CONN_LATENCY:
-            opt.gap_opt.local_conn_latency.p_actual_latency = &act_latency;
-            break;
-        case BLE_GAP_OPT_PASSKEY:
-            opt.gap_opt.passkey.p_passkey = passkey;
-            break;
-        case BLE_GAP_OPT_PRIVACY:
-            opt.gap_opt.privacy.p_irk = &irk;
-            break;
-    }
-
-    uint32_t   sd_err_code;
-
-    err_code = ble_opt_set_req_dec(p_rx_buf, rx_buf_len, &opt_id, &p_opt);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_opt_set(opt_id, p_opt);
-
-    err_code = ble_opt_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf,
-                            uint32_t              rx_buf_len,
-                            uint8_t * const       p_tx_buf,
-                            uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t app_ram_base;
-
-/*lint --e{10} --e{19} --e{27} --e{40} --e{529} -save suppress Error 27: Illegal character */
-#if defined(_WIN32) ||  defined(__unix) || defined(__APPLE__)
-    uint32_t ram_start = 0;
-#elif defined ( __CC_ARM )
-    extern uint32_t Image$$RW_IRAM1$$Base;
-    volatile uint32_t ram_start = (uint32_t) &Image$$RW_IRAM1$$Base;
-#elif defined ( __ICCARM__ )
-    extern uint32_t __ICFEDIT_region_RAM_start__;
-    volatile uint32_t ram_start = (uint32_t) &__ICFEDIT_region_RAM_start__;
-#elif defined   ( __GNUC__ )
-    extern uint32_t __start_fs_data;
-    volatile uint32_t ram_start = (uint32_t) &__start_fs_data;
-#endif
-    app_ram_base = ram_start;
-
-    ble_enable_params_t   params;
-    ble_enable_params_t * p_params = &params;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_enable_req_dec(p_rx_buf, rx_buf_len, &p_params);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    //disabled till codec is adopted.
-    sd_err_code = sd_ble_enable(p_params, &app_ram_base);
-
-    err_code = ble_enable_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf,
-                                    uint32_t              rx_buf_len,
-                                    uint8_t * const       p_tx_buf,
-                                    uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    ble_user_mem_block_t   mem_block;
-    ble_user_mem_block_t * p_mem_block = &mem_block;
-    uint32_t               err_code = NRF_SUCCESS;
-    uint32_t               user_mem_tab_index;
-    uint16_t               conn_handle;
-    /* Allocate user memory context for SoftDevice */
-
-    uint32_t   sd_err_code;
-
-    err_code = ble_user_mem_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_mem_block);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_mem_block != NULL)
-    {
-    	//Use the context if p_mem_block was not null
-		err_code = conn_ble_user_mem_context_create(&user_mem_tab_index);
-		SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-		m_conn_user_mem_table[user_mem_tab_index].conn_handle = conn_handle;
-		m_conn_user_mem_table[user_mem_tab_index].mem_block.len = p_mem_block->len;
-		p_mem_block = &(m_conn_user_mem_table[user_mem_tab_index].mem_block);
-    }
-
-    sd_err_code = sd_ble_user_mem_reply(conn_handle, p_mem_block);
-
-    err_code = ble_user_mem_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}

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/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h
deleted file mode 100644
index 4decac2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble.h
+++ /dev/null
@@ -1,187 +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.
- *
- */
-#ifndef _CONN_MW_BLE_H
-#define _CONN_MW_BLE_H
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Handles @ref sd_ble_tx_packet_count_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_tx_packet_count_get(uint8_t const * const p_rx_buf,
-                                         uint32_t rx_buf_len,
-                                         uint8_t * const p_tx_buf,
-                                         uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_uuid_vs_add command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_uuid_vs_add(uint8_t const * const p_rx_buf,
-                                 uint32_t rx_buf_len,
-                                 uint8_t * const p_tx_buf,
-                                 uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_uuid_decode command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_uuid_decode(uint8_t const * const p_rx_buf,
-                                 uint32_t rx_buf_len,
-                                 uint8_t * const p_tx_buf,
-                                 uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_uuid_encode command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_uuid_encode(uint8_t const * const p_rx_buf,
-                                 uint32_t rx_buf_len,
-                                 uint8_t * const p_tx_buf,
-                                 uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_version_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_version_get(uint8_t const * const p_rx_buf,
-                                 uint32_t rx_buf_len,
-                                 uint8_t * const p_tx_buf,
-                                 uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_opt_get command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_opt_get(uint8_t const * const p_rx_buf,
-                             uint32_t rx_buf_len,
-                             uint8_t * const p_tx_buf,
-                             uint32_t * const p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_opt_set command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_opt_set(uint8_t const * const p_rx_buf,
-                             uint32_t              rx_buf_len,
-                             uint8_t * const       p_tx_buf,
-                             uint32_t * const      p_tx_buf_len);
-                             
-/**@brief Handles @ref sd_ble_enable command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_enable(uint8_t const * const p_rx_buf,
-                            uint32_t              rx_buf_len,
-                            uint8_t * const       p_tx_buf,
-                            uint32_t * const      p_tx_buf_len);
-
-/**@brief Handles @ref sd_ble_user_mem_reply command and prepares response.
- *
- * @param[in]     p_rx_buf            Pointer to input buffer.
- * @param[in]     rx_buf_len          Size of p_rx_buf.
- * @param[out]    p_tx_buf            Pointer to output buffer.
- * @param[in,out] p_tx_buf_len        \c in: size of \p p_tx_buf buffer.
- *                                    \c out: Length of valid data in \p p_tx_buf.
- *
- * @retval NRF_SUCCESS                Handler success.
- * @retval NRF_ERROR_NULL             Handler failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Handler failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Handler failure. Invalid operation type.
- */
-uint32_t conn_mw_ble_user_mem_reply(uint8_t const * const p_rx_buf,
-                                     uint32_t              rx_buf_len,
-                                     uint8_t * const       p_tx_buf,
-                                     uint32_t * const      p_tx_buf_len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_CONN_MW_BLE_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/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c
deleted file mode 100644
index 8e4e2d1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/connectivity/codecs/s130/middleware/conn_mw_ble_gap.c
+++ /dev/null
@@ -1,967 +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.
- *
- */
-
-#include "ble_gap_conn.h"
-#include "conn_mw_ble_gap.h"
-#include "ble_serialization.h"
-#include "conn_ble_gap_sec_keys.h"
-#include <stddef.h>
-
-extern ser_ble_gap_conn_keyset_t m_conn_keys_table[SER_MAX_CONNECTIONS];
-
-uint32_t conn_mw_ble_gap_address_set(uint8_t const * const p_rx_buf,
-                                     uint32_t              rx_buf_len,
-                                     uint8_t * const       p_tx_buf,
-                                     uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-    
-    uint8_t addr_cycle_mode;
-    
-    ble_gap_addr_t   addr;
-    ble_gap_addr_t * p_addr = &addr;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_gap_address_set_req_dec(p_rx_buf, rx_buf_len, &addr_cycle_mode, &p_addr);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_address_set(addr_cycle_mode, p_addr);
-
-    err_code = ble_gap_address_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_connect(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-    
-    ble_gap_addr_t   addr;
-    ble_gap_addr_t * p_addr = &addr;
-    
-    ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
-    ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
-    
-    ble_gap_addr_t addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
-    ble_gap_irk_t  irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
-    
-    for (uint8_t i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; ++i)
-    {
-        pp_addr_tab[i] = &addr_tab[i];
-    }
-    for (uint8_t i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; ++i)
-    {
-        pp_irk_tab[i] = &irk_tab[i];
-    }
-
-    ble_gap_whitelist_t whitelist;
-    whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
-    whitelist.pp_addrs   = pp_addr_tab;
-    whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
-    whitelist.pp_irks    = pp_irk_tab;
-
-    ble_gap_scan_params_t scan_params;
-    scan_params.p_whitelist = &whitelist;
-    ble_gap_scan_params_t * p_scan_params = &scan_params;
-
-    ble_gap_conn_params_t conn_params;
-    ble_gap_conn_params_t * p_conn_params = &conn_params;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_gap_connect_req_dec(p_rx_buf, rx_buf_len, &p_addr, &p_scan_params, &p_conn_params);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_connect(p_addr, p_scan_params, p_conn_params);
-
-    err_code = ble_gap_connect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_connect_cancel(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t * const       p_tx_buf,
-                                        uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-    
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    sd_err_code = sd_ble_gap_connect_cancel();
-
-    err_code = ble_gap_connect_cancel_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_scan_start(uint8_t const * const p_rx_buf,
-                                    uint32_t              rx_buf_len,
-                                    uint8_t * const       p_tx_buf,
-                                    uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-    
-    ble_gap_addr_t * pp_addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
-    ble_gap_irk_t * pp_irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
-    
-    ble_gap_addr_t addr_tab[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
-    ble_gap_irk_t  irk_tab[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
-    
-    for (uint8_t i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; ++i)
-    {
-        pp_addr_tab[i] = &addr_tab[i];
-    }
-    for (uint8_t i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; ++i)
-    {
-        pp_irk_tab[i] = &irk_tab[i];
-    }
-
-    ble_gap_whitelist_t whitelist;
-    whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
-    whitelist.pp_addrs   = pp_addr_tab;
-    whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
-    whitelist.pp_irks    = pp_irk_tab;
-
-    ble_gap_scan_params_t scan_params;
-    scan_params.p_whitelist = &whitelist;
-    ble_gap_scan_params_t * p_scan_params = &scan_params;
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    err_code = ble_gap_scan_start_req_dec(p_rx_buf, rx_buf_len, &p_scan_params);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_scan_start(p_scan_params);
-
-    err_code = ble_gap_scan_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_address_get(uint8_t const * const p_rx_buf,
-                                    uint32_t              rx_buf_len,
-                                    uint8_t * const       p_tx_buf,
-                                    uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   ble_gap_addr_t   addr;
-   ble_gap_addr_t * p_addr = &addr;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_address_get_req_dec(p_rx_buf, rx_buf_len, &p_addr);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_address_get(p_addr);
-
-   err_code = ble_gap_address_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_addr);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_adv_data_set(uint8_t const * const p_rx_buf,
-                                     uint32_t              rx_buf_len,
-                                     uint8_t * const       p_tx_buf,
-                                     uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint8_t   data[BLE_GAP_ADV_MAX_SIZE];
-   uint8_t * p_data = data;
-   uint8_t   dlen   = sizeof (data);
-
-   uint8_t   sr_data[BLE_GAP_ADV_MAX_SIZE];
-   uint8_t * p_sr_data = sr_data;
-   uint8_t   srdlen    = sizeof (sr_data);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_adv_data_set_req_dec(p_rx_buf,
-                                           rx_buf_len,
-                                           &p_data,
-                                           &dlen,
-                                           &p_sr_data,
-                                           &srdlen);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_adv_data_set(p_data, dlen, p_sr_data, srdlen);
-
-   err_code = ble_gap_adv_data_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_adv_start(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t * const       p_tx_buf,
-                                  uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   ble_gap_addr_t *       p_addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
-   ble_gap_addr_t         addresses[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
-   ble_gap_irk_t *        p_irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
-   ble_gap_irk_t          irks[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
-   ble_gap_addr_t         peer_addr;
-   ble_gap_whitelist_t    whitelist;
-   ble_gap_adv_params_t   adv_params;
-   ble_gap_adv_params_t * p_adv_params;
-
-   uint32_t i = 0;
-
-   for (i = 0; i < BLE_GAP_WHITELIST_ADDR_MAX_COUNT; i++)
-   {
-       p_addresses[i] = &(addresses[i]);
-   }
-
-   for (i = 0; i < BLE_GAP_WHITELIST_IRK_MAX_COUNT; i++)
-   {
-       p_irks[i] = &(irks[i]);
-   }
-
-   whitelist.pp_addrs = &p_addresses[0];
-   whitelist.pp_irks  = &p_irks[0];
-
-   adv_params.p_peer_addr = &peer_addr;
-   adv_params.p_whitelist = &whitelist;
-
-   p_adv_params = &adv_params;
-
-   err_code = ble_gap_adv_start_req_dec(p_rx_buf, rx_buf_len, &p_adv_params);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_adv_start(p_adv_params);
-
-   err_code = ble_gap_adv_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_adv_stop(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   sd_err_code = sd_ble_gap_adv_stop();
-
-   err_code = ble_gap_adv_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_conn_param_update(uint8_t const * const p_rx_buf,
-                                          uint32_t              rx_buf_len,
-                                          uint8_t * const       p_tx_buf,
-                                          uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint16_t                conn_handle;
-   ble_gap_conn_params_t   conn_params;
-   ble_gap_conn_params_t * p_conn_params = &conn_params;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_conn_param_update_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_params);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_conn_param_update(conn_handle, p_conn_params);
-
-   err_code = ble_gap_conn_param_update_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_disconnect(uint8_t const * const p_rx_buf,
-                                   uint32_t              rx_buf_len,
-                                   uint8_t * const       p_tx_buf,
-                                   uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint16_t conn_handle;
-   uint8_t  hci_status_code;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_disconnect_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &hci_status_code);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_disconnect(conn_handle, hci_status_code);
-
-   err_code = ble_gap_disconnect_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_tx_power_set(uint8_t const * const p_rx_buf,
-                                     uint32_t              rx_buf_len,
-                                     uint8_t * const       p_tx_buf,
-                                     uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   int8_t tx_power;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_tx_power_set_req_dec(p_rx_buf, rx_buf_len, &tx_power);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_tx_power_set(tx_power);
-
-   err_code = ble_gap_tx_power_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_appearance_set(uint8_t const * const p_rx_buf,
-                                       uint32_t              rx_buf_len,
-                                       uint8_t * const       p_tx_buf,
-                                       uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint16_t appearance;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_appearance_set_req_dec(p_rx_buf, rx_buf_len, &appearance);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_appearance_set(appearance);
-
-   err_code = ble_gap_appearance_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_appearance_get(uint8_t const * const p_rx_buf,
-                                       uint32_t              rx_buf_len,
-                                       uint8_t * const       p_tx_buf,
-                                       uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint16_t   appearance;
-   uint16_t * p_appearance = &appearance;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_appearance_get_req_dec(p_rx_buf, rx_buf_len, &p_appearance);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_appearance_get(p_appearance);
-
-   err_code = ble_gap_appearance_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_appearance);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-
-uint32_t conn_mw_ble_gap_ppcp_set(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   ble_gap_conn_params_t   conn_params;
-   ble_gap_conn_params_t * p_conn_params = &conn_params;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_ppcp_set_req_dec(p_rx_buf, rx_buf_len, &p_conn_params);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_ppcp_set(p_conn_params);
-
-   err_code = ble_gap_ppcp_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_ppcp_get(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   ble_gap_conn_params_t   conn_params;
-   ble_gap_conn_params_t * p_conn_params = &conn_params;
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   err_code = ble_gap_ppcp_get_req_dec(p_rx_buf, rx_buf_len, &p_conn_params);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_ppcp_get(p_conn_params);
-
-   err_code = ble_gap_ppcp_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_conn_params);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-
-uint32_t conn_mw_ble_gap_device_name_get(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t * const       p_tx_buf,
-                                        uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint8_t   dev_name[BLE_GAP_DEVNAME_MAX_LEN];
-   uint8_t * p_dev_name = dev_name;
-
-   uint16_t   len;
-   uint16_t * p_len = &len;
-
-   err_code = ble_gap_device_name_get_req_dec(p_rx_buf, rx_buf_len, &p_dev_name, &p_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_device_name_get(p_dev_name, p_len);
-
-   err_code = ble_gap_device_name_get_rsp_enc(sd_err_code, p_dev_name, len, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_device_name_set(uint8_t const * const p_rx_buf,
-                                        uint32_t              rx_buf_len,
-                                        uint8_t * const       p_tx_buf,
-                                        uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   ble_gap_conn_sec_mode_t   write_perm;
-   ble_gap_conn_sec_mode_t * p_write_perm = &write_perm;
-
-   uint8_t   dev_name[BLE_GAP_DEVNAME_MAX_LEN];
-   uint8_t * p_dev_name = dev_name;
-
-   uint16_t len = BLE_GAP_DEVNAME_MAX_LEN;
-
-   err_code = ble_gap_device_name_set_req_dec(p_rx_buf,
-                                              rx_buf_len,
-                                              &p_write_perm,
-                                              &p_dev_name,
-                                              &len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_device_name_set(p_write_perm, p_dev_name, len);
-
-   err_code = ble_gap_device_name_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_authenticate(uint8_t const * const p_rx_buf,
-                                     uint32_t              rx_buf_len,
-                                     uint8_t * const       p_tx_buf,
-                                     uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint16_t conn_handle;
-
-   ble_gap_sec_params_t   sec_params;
-   ble_gap_sec_params_t * p_sec_params = &sec_params;
-
-   err_code = ble_gap_authenticate_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_sec_params);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_authenticate(conn_handle, p_sec_params);
-
-   err_code = ble_gap_authenticate_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_sec_params_reply(uint8_t const * const p_rx_buf,
-                                          uint32_t              rx_buf_len,
-                                          uint8_t * const       p_tx_buf,
-                                          uint32_t * const      p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-    uint32_t sec_tab_index = 0;
-
-    uint16_t * p_conn_handle;
-    uint8_t    sec_status;
-
-    ble_gap_sec_params_t   sec_params;
-    ble_gap_sec_params_t * p_sec_params = &sec_params;
-  
-    // Allocate global security context for soft device
-    err_code = conn_ble_gap_sec_context_create(&sec_tab_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_conn_handle = &(m_conn_keys_table[sec_tab_index].conn_handle);
-
-    // Set up global structure for command decoder
-    ble_gap_sec_keyset_t * p_sec_keyset = &(m_conn_keys_table[sec_tab_index].keyset);
-
-    p_sec_keyset->keys_own.p_enc_key   = &(m_conn_keys_table[sec_tab_index].enc_key_own);
-    p_sec_keyset->keys_own.p_id_key    = &(m_conn_keys_table[sec_tab_index].id_key_own);
-    p_sec_keyset->keys_own.p_sign_key  = &(m_conn_keys_table[sec_tab_index].sign_key_own);
-    p_sec_keyset->keys_own.p_pk        = &(m_conn_keys_table[sec_tab_index].pk_own);
-    p_sec_keyset->keys_peer.p_enc_key  = &(m_conn_keys_table[sec_tab_index].enc_key_peer);
-    p_sec_keyset->keys_peer.p_id_key   = &(m_conn_keys_table[sec_tab_index].id_key_peer);
-    p_sec_keyset->keys_peer.p_sign_key = &(m_conn_keys_table[sec_tab_index].sign_key_peer);
-    p_sec_keyset->keys_peer.p_pk       = &(m_conn_keys_table[sec_tab_index].pk_peer);
-
-    err_code = ble_gap_sec_params_reply_req_dec(p_rx_buf,
-                                                rx_buf_len,
-                                                p_conn_handle,
-                                                &sec_status,
-                                                &p_sec_params,
-                                                &p_sec_keyset);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_sec_params_reply(*p_conn_handle, sec_status, p_sec_params, p_sec_keyset);
-
-    err_code = ble_gap_sec_params_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, p_sec_keyset);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_auth_key_reply(uint8_t const * const p_rx_buf,
-                                       uint32_t              rx_buf_len,
-                                       uint8_t * const       p_tx_buf,
-                                       uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint16_t conn_handle;
-   uint8_t  key_type;
-
-   uint8_t   key[BLE_GAP_SEC_KEY_LEN];
-   uint8_t * p_key = key;
-
-   err_code = ble_gap_auth_key_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &key_type, &p_key);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_auth_key_reply(conn_handle, key_type, p_key);
-
-   err_code = ble_gap_auth_key_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_sec_info_reply(uint8_t const * const p_rx_buf,
-                                       uint32_t              rx_buf_len,
-                                       uint8_t * const       p_tx_buf,
-                                       uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint16_t conn_handle;
-
-   ble_gap_enc_info_t   enc_info;
-   ble_gap_enc_info_t * p_enc_info = &enc_info;
-   
-   ble_gap_irk_t   id_info;
-   ble_gap_irk_t * p_id_info = &id_info;
-
-   ble_gap_sign_info_t   sign_info;
-   ble_gap_sign_info_t * p_sign_info = &sign_info;
-
-   err_code = ble_gap_sec_info_reply_req_dec(p_rx_buf,
-                                             rx_buf_len,
-                                             &conn_handle,
-                                             &p_enc_info,
-                                             &p_id_info,
-                                             &p_sign_info);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_sec_info_reply(conn_handle, p_enc_info, p_id_info, p_sign_info);
-
-   err_code = ble_gap_sec_info_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_conn_sec_get(uint8_t const * const p_rx_buf,
-                                     uint32_t              rx_buf_len,
-                                     uint8_t * const       p_tx_buf,
-                                     uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint16_t conn_handle;
-
-   ble_gap_conn_sec_t   conn_sec;
-   ble_gap_conn_sec_t * p_conn_sec = &conn_sec;
-
-   err_code = ble_gap_conn_sec_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_conn_sec);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_conn_sec_get(conn_handle, p_conn_sec);
-
-   err_code = ble_gap_conn_sec_get_rsp_enc(sd_err_code, p_conn_sec, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_rssi_start(uint8_t const * const p_rx_buf,
-                                   uint32_t              rx_buf_len,
-                                   uint8_t * const       p_tx_buf,
-                                   uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint16_t conn_handle;
-   uint8_t  threshold_dbm;
-   uint8_t  skip_count;
-
-   err_code = ble_gap_rssi_start_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &threshold_dbm, &skip_count);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_rssi_start(conn_handle, threshold_dbm, skip_count);
-
-   err_code = ble_gap_rssi_start_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_rssi_stop(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t * const       p_tx_buf,
-                                  uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint16_t conn_handle;
-
-   err_code = ble_gap_rssi_stop_req_dec(p_rx_buf, rx_buf_len, &conn_handle);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_rssi_stop(conn_handle);
-
-   err_code = ble_gap_rssi_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_scan_stop(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t * const       p_tx_buf,
-                                 uint32_t * const      p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   sd_err_code = sd_ble_gap_scan_stop();
-
-   err_code = ble_gap_scan_stop_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_encrypt(uint8_t const * const p_rx_buf,
-                                 uint32_t              rx_buf_len,
-                                 uint8_t       * const p_tx_buf,
-                                 uint32_t      * const p_tx_buf_len)
-{
-   SER_ASSERT_NOT_NULL(p_rx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf);
-   SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-   uint32_t err_code = NRF_SUCCESS;
-   uint32_t sd_err_code;
-
-   uint16_t conn_handle;
-
-   ble_gap_master_id_t master_id;
-   ble_gap_master_id_t *p_master_id = &master_id;
-
-   ble_gap_enc_info_t  enc_info;
-   ble_gap_enc_info_t *p_enc_info  = &enc_info;
-
-   err_code = ble_gap_encrypt_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_master_id, &p_enc_info);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   sd_err_code = sd_ble_gap_encrypt(conn_handle, p_master_id, p_enc_info);
-
-   err_code = ble_gap_encrypt_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-   SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-   return err_code;
-}
-
-uint32_t conn_mw_ble_gap_rssi_get(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    uint16_t conn_handle;
-    int8_t   rssi;
-    int8_t * p_rssi = &rssi;
-
-    err_code = ble_gap_rssi_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_rssi);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_rssi_get(conn_handle, p_rssi);
-
-    err_code = ble_gap_rssi_get_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len, rssi);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_keypress_notify(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    uint16_t conn_handle;
-    uint8_t  kp_not;
-
-    err_code = ble_gap_keypress_notify_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &kp_not);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_keypress_notify(conn_handle, kp_not);
-
-    err_code = ble_gap_keypress_notify_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_lesc_dhkey_reply(uint8_t const * const p_rx_buf,
-                                  uint32_t              rx_buf_len,
-                                  uint8_t       * const p_tx_buf,
-                                  uint32_t      * const p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    uint16_t conn_handle;
-    ble_gap_lesc_dhkey_t  dhkey;
-    ble_gap_lesc_dhkey_t * p_dhkey = &dhkey;
-
-    err_code = ble_gap_lesc_dhkey_reply_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_dhkey);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_lesc_dhkey_reply(conn_handle, p_dhkey);
-
-    err_code = ble_gap_lesc_dhkey_reply_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_lesc_oob_data_set(uint8_t const * const p_rx_buf,
-                                           uint32_t              rx_buf_len,
-                                           uint8_t       * const p_tx_buf,
-                                           uint32_t      * const p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    uint16_t conn_handle;
-    ble_gap_lesc_oob_data_t own;
-    ble_gap_lesc_oob_data_t peer;
-    ble_gap_lesc_oob_data_t * p_own = &own;
-    ble_gap_lesc_oob_data_t * p_peer = &peer;
-
-    err_code = ble_gap_lesc_oob_data_set_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_own, &p_peer);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_lesc_oob_data_set(conn_handle, p_own, p_peer);
-
-    err_code = ble_gap_lesc_oob_data_set_rsp_enc(sd_err_code, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t conn_mw_ble_gap_lesc_oob_data_get(uint8_t const * const p_rx_buf,
-                                           uint32_t              rx_buf_len,
-                                           uint8_t       * const p_tx_buf,
-                                           uint32_t      * const p_tx_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_rx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf);
-    SER_ASSERT_NOT_NULL(p_tx_buf_len);
-
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t sd_err_code;
-
-    uint16_t conn_handle;
-    ble_gap_lesc_oob_data_t own;
-    ble_gap_lesc_oob_data_t * p_own = &own;
-    ble_gap_lesc_p256_pk_t  pk;
-    ble_gap_lesc_p256_pk_t * p_pk = &pk;
-
-    err_code = ble_gap_lesc_oob_data_get_req_dec(p_rx_buf, rx_buf_len, &conn_handle, &p_pk, &p_own);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    sd_err_code = sd_ble_gap_lesc_oob_data_get(conn_handle, p_pk, p_own);
-
-    err_code = ble_gap_lesc_oob_data_get_rsp_enc(sd_err_code, p_own, p_tx_buf, p_tx_buf_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}


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

Posted by cc...@apache.org.
Remove non-Apache-compatible Nordic SDK files.

Portions of the Nordic SDK are now located at:

REPO:
    repository.mynewt_nordic:
        type: github
        vers: 0-latest
        user: runtimeinc
        repo: mynewt_nordic

PACKAGE:
    @mynewt_nordic/hw/mcu/nordic_sdk


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a1481cb2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a1481cb2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a1481cb2

Branch: refs/heads/1_0_0_b1_dev
Commit: a1481cb22eaf37e325c3d23b3b1078a79d3985b6
Parents: 19e8e79
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Nov 21 19:15:12 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Nov 21 19:24:49 2016 -0800

----------------------------------------------------------------------
 .../include/bsp/nrf_drv_config.h                |  472 ----
 hw/bsp/bmd300eval/include/bsp/nrf_drv_config.h  |  471 ----
 .../include/bsp/nrf_drv_config.h                |  474 ----
 .../nrf51-blenano/include/bsp/nrf_drv_config.h  |  472 ----
 .../include/bsp/nrf_drv_config.h                |  474 ----
 hw/bsp/nrf51dk/include/bsp/nrf_drv_config.h     |  472 ----
 hw/bsp/nrf52dk/include/bsp/nrf_drv_config.h     |  471 ----
 hw/bsp/rb-nano2/include/bsp/nrf_drv_config.h    |  471 ----
 hw/mcu/nordic/nrf51xxx/pkg.yml                  |    6 +-
 hw/mcu/nordic/nrf52xxx/pkg.yml                  |    6 +-
 .../components/drivers_nrf/adc/nrf_drv_adc.c    |  253 ---
 .../components/drivers_nrf/adc/nrf_drv_adc.h    |  298 ---
 .../drivers_nrf/ble_flash/ble_flash.c           |  286 ---
 .../drivers_nrf/ble_flash/ble_flash.h           |  150 --
 .../drivers_nrf/clock/nrf_drv_clock.c           |  479 ----
 .../drivers_nrf/clock/nrf_drv_clock.h           |  254 ---
 .../drivers_nrf/common/nrf_drv_common.c         |  208 --
 .../drivers_nrf/common/nrf_drv_common.h         |  202 --
 .../components/drivers_nrf/comp/nrf_drv_comp.c  |  174 --
 .../components/drivers_nrf/comp/nrf_drv_comp.h  |  276 ---
 .../drivers_nrf/config/nrf_drv_config.h         |  472 ----
 .../config/nrf_drv_config_validation.h          |   91 -
 .../components/drivers_nrf/delay/nrf_delay.c    |   26 -
 .../components/drivers_nrf/delay/nrf_delay.h    |  250 ---
 .../drivers_nrf/gpiote/nrf_drv_gpiote.c         |  580 -----
 .../drivers_nrf/gpiote/nrf_drv_gpiote.h         |  317 ---
 .../components/drivers_nrf/hal/nrf_adc.c        |   78 -
 .../components/drivers_nrf/hal/nrf_adc.h        |  424 ----
 .../components/drivers_nrf/hal/nrf_clock.h      |  422 ----
 .../components/drivers_nrf/hal/nrf_comp.h       |  477 ----
 .../components/drivers_nrf/hal/nrf_ecb.c        |   74 -
 .../components/drivers_nrf/hal/nrf_ecb.h        |   74 -
 .../components/drivers_nrf/hal/nrf_egu.h        |  294 ---
 .../components/drivers_nrf/hal/nrf_gpio.h       |  655 ------
 .../components/drivers_nrf/hal/nrf_gpiote.h     |  399 ----
 .../components/drivers_nrf/hal/nrf_i2s.h        |  531 -----
 .../components/drivers_nrf/hal/nrf_lpcomp.h     |  375 ----
 .../components/drivers_nrf/hal/nrf_nvmc.c       |  117 -
 .../components/drivers_nrf/hal/nrf_nvmc.h       |   98 -
 .../components/drivers_nrf/hal/nrf_pdm.h        |  367 ----
 .../components/drivers_nrf/hal/nrf_ppi.h        |  410 ----
 .../components/drivers_nrf/hal/nrf_pwm.h        |  669 ------
 .../components/drivers_nrf/hal/nrf_qdec.h       |  476 ----
 .../components/drivers_nrf/hal/nrf_rng.h        |  219 --
 .../components/drivers_nrf/hal/nrf_rtc.h        |  312 ---
 .../components/drivers_nrf/hal/nrf_saadc.c      |   31 -
 .../components/drivers_nrf/hal/nrf_saadc.h      |  562 -----
 .../components/drivers_nrf/hal/nrf_spi.h        |  342 ---
 .../components/drivers_nrf/hal/nrf_spim.h       |  528 -----
 .../components/drivers_nrf/hal/nrf_spis.h       |  520 -----
 .../components/drivers_nrf/hal/nrf_temp.h       |   63 -
 .../components/drivers_nrf/hal/nrf_timer.h      |  584 -----
 .../components/drivers_nrf/hal/nrf_twi.h        |  410 ----
 .../components/drivers_nrf/hal/nrf_twim.h       |  486 -----
 .../components/drivers_nrf/hal/nrf_twis.h       |  684 ------
 .../components/drivers_nrf/hal/nrf_uart.h       |  479 ----
 .../components/drivers_nrf/hal/nrf_uarte.h      |  542 -----
 .../components/drivers_nrf/hal/nrf_wdt.h        |  307 ---
 .../components/drivers_nrf/i2s/nrf_drv_i2s.c    |  355 ---
 .../components/drivers_nrf/i2s/nrf_drv_i2s.h    |  227 --
 .../drivers_nrf/lpcomp/nrf_drv_lpcomp.c         |  151 --
 .../drivers_nrf/lpcomp/nrf_drv_lpcomp.h         |  115 -
 .../drivers_nrf/nrf_soc_nosd/nrf_error.h        |   56 -
 .../drivers_nrf/nrf_soc_nosd/nrf_nvic.c         |   96 -
 .../drivers_nrf/nrf_soc_nosd/nrf_nvic.h         |  138 --
 .../drivers_nrf/nrf_soc_nosd/nrf_soc.c          |   21 -
 .../drivers_nrf/nrf_soc_nosd/nrf_soc.h          |   52 -
 .../components/drivers_nrf/pdm/nrf_drv_pdm.c    |  170 --
 .../components/drivers_nrf/pdm/nrf_drv_pdm.h    |  175 --
 .../components/drivers_nrf/ppi/nrf_drv_ppi.c    |  427 ----
 .../components/drivers_nrf/ppi/nrf_drv_ppi.h    |  292 ---
 .../pstorage/config/pstorage_platform.h         |   80 -
 .../components/drivers_nrf/pstorage/pstorage.c  | 1572 -------------
 .../components/drivers_nrf/pstorage/pstorage.h  |  389 ----
 .../drivers_nrf/pstorage/pstorage_nosd.c        |  525 -----
 .../drivers_nrf/pstorage/pstorage_raw.c         |  471 ----
 .../components/drivers_nrf/pwm/nrf_drv_pwm.c    |  350 ---
 .../components/drivers_nrf/pwm/nrf_drv_pwm.h    |  434 ----
 .../components/drivers_nrf/qdec/nrf_drv_qdec.c  |  168 --
 .../components/drivers_nrf/qdec/nrf_drv_qdec.h  |  157 --
 .../drivers_nrf/radio_config/radio_config.c     |  160 --
 .../drivers_nrf/radio_config/radio_config.h     |   29 -
 .../components/drivers_nrf/rng/nrf_drv_rng.c    |  250 ---
 .../components/drivers_nrf/rng/nrf_drv_rng.h    |  123 --
 .../components/drivers_nrf/rtc/nrf_drv_rtc.c    |  290 ---
 .../components/drivers_nrf/rtc/nrf_drv_rtc.h    |  333 ---
 .../drivers_nrf/saadc/nrf_drv_saadc.c           |  509 -----
 .../drivers_nrf/saadc/nrf_drv_saadc.h           |  311 ---
 .../drivers_nrf/sdio/config/sdio_config.h       |   26 -
 .../components/drivers_nrf/sdio/sdio.c          |  217 --
 .../components/drivers_nrf/sdio/sdio.h          |   77 -
 .../drivers_nrf/spi_master/nrf_drv_spi.c        |  655 ------
 .../drivers_nrf/spi_master/nrf_drv_spi.h        |  376 ----
 .../drivers_nrf/spi_master/spi_5W_master.c      |  602 -----
 .../drivers_nrf/spi_master/spi_5W_master.h      |  178 --
 .../drivers_nrf/spi_slave/nrf_drv_spis.c        |  396 ----
 .../drivers_nrf/spi_slave/nrf_drv_spis.h        |  231 --
 .../components/drivers_nrf/swi/nrf_drv_swi.c    |  326 ---
 .../components/drivers_nrf/swi/nrf_drv_swi.h    |  175 --
 .../drivers_nrf/timer/nrf_drv_timer.c           |  280 ---
 .../drivers_nrf/timer/nrf_drv_timer.h           |  380 ----
 .../deprecated/config/twi_master_config.h       |   26 -
 .../twi_master/deprecated/twi_hw_master.c       |  304 ---
 .../twi_master/deprecated/twi_master.h          |  109 -
 .../twi_master/deprecated/twi_sw_master.c       |  492 -----
 .../drivers_nrf/twi_master/nrf_drv_twi.c        | 1014 ---------
 .../drivers_nrf/twi_master/nrf_drv_twi.h        |  415 ----
 .../drivers_nrf/twis_slave/nrf_drv_twis.c       |  881 --------
 .../drivers_nrf/twis_slave/nrf_drv_twis.h       |  406 ----
 .../twis_slave/nrf_drv_twis_inst.def            |   20 -
 .../components/drivers_nrf/uart/nrf_drv_uart.c  |  851 --------
 .../components/drivers_nrf/uart/nrf_drv_uart.h  |  301 ---
 .../components/drivers_nrf/wdt/nrf_drv_wdt.c    |  118 -
 .../components/drivers_nrf/wdt/nrf_drv_wdt.h    |  132 --
 .../ble_transport/hci_mem_pool_internal.h       |   40 -
 .../libraries/bootloader_dfu/bootloader.c       |  382 ----
 .../libraries/bootloader_dfu/bootloader.h       |  105 -
 .../bootloader_dfu/bootloader_settings.c        |   63 -
 .../bootloader_dfu/bootloader_settings.h        |   43 -
 .../libraries/bootloader_dfu/bootloader_types.h |   67 -
 .../libraries/bootloader_dfu/bootloader_util.c  |  152 --
 .../libraries/bootloader_dfu/bootloader_util.h  |   46 -
 .../components/libraries/bootloader_dfu/dfu.h   |  142 --
 .../libraries/bootloader_dfu/dfu_app_handler.c  |  192 --
 .../libraries/bootloader_dfu/dfu_app_handler.h  |   94 -
 .../bootloader_dfu/dfu_bank_internal.h          |   95 -
 .../libraries/bootloader_dfu/dfu_ble_svc.h      |   88 -
 .../bootloader_dfu/dfu_ble_svc_internal.h       |   51 -
 .../libraries/bootloader_dfu/dfu_dual_bank.c    |  834 -------
 .../libraries/bootloader_dfu/dfu_init.h         |  142 --
 .../bootloader_dfu/dfu_init_template.c          |  155 --
 .../libraries/bootloader_dfu/dfu_single_bank.c  |  783 -------
 .../libraries/bootloader_dfu/dfu_transport.h    |   48 -
 .../bootloader_dfu/dfu_transport_ble.c          | 1100 ----------
 .../bootloader_dfu/dfu_transport_serial.c       |  306 ---
 .../libraries/bootloader_dfu/dfu_types.h        |  176 --
 .../experimental/dfu_init_template_signing.c    |  210 --
 .../bootloader_dfu/experimental/nrf_sec.h       |  116 -
 .../hci_transport/hci_mem_pool_internal.h       |   40 -
 .../hci_transport/hci_transport_config.h        |   53 -
 .../components/libraries/button/app_button.c    |  191 --
 .../components/libraries/button/app_button.h    |  120 -
 .../components/libraries/crc16/crc16.c          |   31 -
 .../components/libraries/crc16/crc16.h          |   52 -
 .../components/libraries/crc32/crc32.c          |   31 -
 .../components/libraries/crc32/crc32.h          |   51 -
 .../experimental_section_vars/section_vars.h    |  271 ---
 .../libraries/fds/config/fds_config.h           |   71 -
 .../components/libraries/fds/fds.c              | 2058 ------------------
 .../components/libraries/fds/fds.h              |  741 -------
 .../libraries/fds/fds_internal_defs.h           |  313 ---
 .../components/libraries/fifo/app_fifo.c        |  186 --
 .../components/libraries/fifo/app_fifo.h        |  153 --
 .../libraries/fstorage/config/fstorage_config.h |   67 -
 .../components/libraries/fstorage/fstorage.c    |  494 -----
 .../components/libraries/fstorage/fstorage.h    |  243 ---
 .../libraries/fstorage/fstorage_internal_defs.h |  143 --
 .../libraries/fstorage/fstorage_nosd.c          |    0
 .../components/libraries/gpiote/app_gpiote.c    |  260 ---
 .../components/libraries/gpiote/app_gpiote.h    |  227 --
 .../libraries/gpiote/app_gpiote_fast_detect.c   |  527 -----
 .../components/libraries/hardfault/hardfault.h  |   68 -
 .../hardfault/hardfault_implementation.c        |   47 -
 .../nrf51/handler/hardfault_handler_gcc.c       |   52 -
 .../nrf51/handler/hardfault_handler_iar.c       |   65 -
 .../nrf51/handler/hardfault_handler_keil.c      |   61 -
 .../nrf52/handler/hardfault_handler_gcc.c       |   49 -
 .../nrf52/handler/hardfault_handler_iar.c       |   64 -
 .../nrf52/handler/hardfault_handler_keil.c      |   60 -
 .../hci/config/hci_mem_pool_internal.h          |   40 -
 .../libraries/hci/config/hci_transport_config.h |   48 -
 .../components/libraries/hci/hci_mem_pool.c     |  235 --
 .../components/libraries/hci/hci_mem_pool.h     |  140 --
 .../components/libraries/hci/hci_slip.c         |  428 ----
 .../components/libraries/hci/hci_slip.h         |  137 --
 .../components/libraries/hci/hci_transport.c    |  779 -------
 .../components/libraries/hci/hci_transport.h    |  228 --
 .../components/libraries/ic_info/nrf_ic_info.c  |   67 -
 .../components/libraries/ic_info/nrf_ic_info.h  |   65 -
 .../libraries/led_softblink/led_softblink.c     |  201 --
 .../libraries/led_softblink/led_softblink.h     |  139 --
 .../libraries/low_power_pwm/low_power_pwm.c     |  216 --
 .../libraries/low_power_pwm/low_power_pwm.h     |  176 --
 .../components/libraries/mailbox/app_mailbox.c  |  152 --
 .../components/libraries/mailbox/app_mailbox.h  |  151 --
 .../libraries/mailbox/app_mailbox_local.h       |   41 -
 .../libraries/mem_manager/mem_manager.c         |  925 --------
 .../libraries/mem_manager/mem_manager.h         |  147 --
 .../components/libraries/pwm/app_pwm.c          |  876 --------
 .../components/libraries/pwm/app_pwm.h          |  303 ---
 .../libraries/scheduler/app_scheduler.c         |  227 --
 .../libraries/scheduler/app_scheduler.h         |  171 --
 .../libraries/scheduler/app_scheduler_serconn.c |  262 ---
 .../components/libraries/sensorsim/sensorsim.c  |   73 -
 .../components/libraries/sensorsim/sensorsim.h  |   93 -
 .../components/libraries/sha256/sha256.c        |  183 --
 .../components/libraries/sha256/sha256.h        |   99 -
 .../libraries/simple_timer/app_simple_timer.c   |  187 --
 .../libraries/simple_timer/app_simple_timer.h   |  106 -
 .../components/libraries/slip/slip.c            |  112 -
 .../components/libraries/slip/slip.h            |   74 -
 .../components/libraries/timer/app_timer.c      | 1152 ----------
 .../components/libraries/timer/app_timer.h      |  295 ---
 .../libraries/timer/app_timer_appsh.c           |   34 -
 .../libraries/timer/app_timer_appsh.h           |   52 -
 .../libraries/timer/app_timer_ble_gzll.c        | 1119 ----------
 .../libraries/timer/app_timer_freertos.c        |  230 --
 .../components/libraries/trace/app_trace.c      |   43 -
 .../components/libraries/twi/app_twi.c          |  376 ----
 .../components/libraries/twi/app_twi.h          |  298 ---
 .../components/libraries/uart/app_uart.c        |  132 --
 .../components/libraries/uart/app_uart.h        |  235 --
 .../components/libraries/uart/app_uart_fifo.c   |  191 --
 .../components/libraries/uart/retarget.c        |  101 -
 .../components/libraries/util/app_error.c       |  124 --
 .../components/libraries/util/app_error.h       |  209 --
 .../components/libraries/util/app_error_weak.c  |   53 -
 .../components/libraries/util/app_error_weak.h  |   59 -
 .../components/libraries/util/app_util.h        |  501 -----
 .../components/libraries/util/app_util_bds.h    |  421 ----
 .../libraries/util/app_util_platform.c          |   60 -
 .../libraries/util/app_util_platform.h          |  219 --
 .../components/libraries/util/common.h          |   46 -
 .../components/libraries/util/nordic_common.h   |  116 -
 .../components/libraries/util/nrf_assert.c      |   28 -
 .../components/libraries/util/sdk_common.h      |  182 --
 .../components/libraries/util/sdk_errors.h      |  123 --
 .../components/libraries/util/sdk_macros.h      |   80 -
 .../libraries/util/sdk_mapped_flags.c           |  161 --
 .../libraries/util/sdk_mapped_flags.h           |  161 --
 .../components/libraries/util/sdk_os.h          |   48 -
 .../components/libraries/util/sdk_resources.h   |   58 -
 .../application/codecs/common/ble_dtm_app.c     |   73 -
 .../application/codecs/common/ble_dtm_app.h     |   92 -
 .../application/codecs/common/ble_dtm_init.c    |   56 -
 .../codecs/common/conn_systemreset.c            |   42 -
 .../codecs/common/conn_systemreset.h            |   51 -
 .../codecs/s130/middleware/app_mw_ble.c         |  498 -----
 .../codecs/s130/middleware/app_mw_ble_gap.c     | 1453 -------------
 .../codecs/s130/middleware/app_mw_ble_gattc.c   |  467 ----
 .../codecs/s130/middleware/app_mw_ble_gatts.c   |  665 ------
 .../codecs/s130/middleware/app_mw_ble_l2cap.c   |  165 --
 .../codecs/s130/middleware/app_mw_nrf_soc.c     |  144 --
 .../s130/serializers/app_ble_gap_sec_keys.c     |   73 -
 .../s130/serializers/app_ble_gap_sec_keys.h     |   89 -
 .../codecs/s130/serializers/app_ble_user_mem.c  |   74 -
 .../codecs/s130/serializers/app_ble_user_mem.h  |   89 -
 .../codecs/s130/serializers/ble_app.h           |  455 ----
 .../codecs/s130/serializers/ble_enable.c        |   50 -
 .../codecs/s130/serializers/ble_event.c         |  262 ---
 .../codecs/s130/serializers/ble_evt_app.h       |  119 -
 .../s130/serializers/ble_evt_tx_complete.c      |   49 -
 .../s130/serializers/ble_evt_user_mem_release.c |   78 -
 .../s130/serializers/ble_evt_user_mem_request.c |   52 -
 .../s130/serializers/ble_gap_address_get.c      |   75 -
 .../s130/serializers/ble_gap_address_set.c      |   60 -
 .../s130/serializers/ble_gap_adv_data_set.c     |   52 -
 .../codecs/s130/serializers/ble_gap_adv_start.c |   72 -
 .../codecs/s130/serializers/ble_gap_adv_stop.c  |   40 -
 .../codecs/s130/serializers/ble_gap_app.h       | 1328 -----------
 .../s130/serializers/ble_gap_appearance_get.c   |   70 -
 .../s130/serializers/ble_gap_appearance_set.c   |   44 -
 .../s130/serializers/ble_gap_auth_key_reply.c   |   76 -
 .../s130/serializers/ble_gap_authenticate.c     |   52 -
 .../serializers/ble_gap_conn_param_update.c     |   55 -
 .../s130/serializers/ble_gap_conn_sec_get.c     |   74 -
 .../codecs/s130/serializers/ble_gap_connect.c   |   54 -
 .../s130/serializers/ble_gap_connect_cancel.c   |   42 -
 .../s130/serializers/ble_gap_device_name_get.c  |   84 -
 .../s130/serializers/ble_gap_device_name_set.c  |   66 -
 .../s130/serializers/ble_gap_disconnect.c       |   45 -
 .../codecs/s130/serializers/ble_gap_encrypt.c   |   68 -
 .../s130/serializers/ble_gap_evt_adv_report.c   |   72 -
 .../codecs/s130/serializers/ble_gap_evt_app.h   |  466 ----
 .../serializers/ble_gap_evt_auth_key_request.c  |   53 -
 .../s130/serializers/ble_gap_evt_auth_status.c  |   72 -
 .../serializers/ble_gap_evt_conn_param_update.c |   58 -
 .../ble_gap_evt_conn_param_update_request.c     |   59 -
 .../serializers/ble_gap_evt_conn_sec_update.c   |   57 -
 .../s130/serializers/ble_gap_evt_connected.c    |   53 -
 .../s130/serializers/ble_gap_evt_disconnected.c |   48 -
 .../s130/serializers/ble_gap_evt_key_pressed.c  |   52 -
 .../ble_gap_evt_lesc_dhkey_request.c            |   71 -
 .../serializers/ble_gap_evt_passkey_display.c   |   63 -
 .../s130/serializers/ble_gap_evt_rssi_changed.c |   53 -
 .../serializers/ble_gap_evt_scan_req_report.c   |   58 -
 .../serializers/ble_gap_evt_sec_info_request.c  |   55 -
 .../ble_gap_evt_sec_params_request.c            |   55 -
 .../s130/serializers/ble_gap_evt_sec_request.c  |   59 -
 .../s130/serializers/ble_gap_evt_timeout.c      |   52 -
 .../s130/serializers/ble_gap_keypress_notify.c  |   52 -
 .../s130/serializers/ble_gap_lesc_dhkey_reply.c |   52 -
 .../serializers/ble_gap_lesc_oob_data_get.c     |   77 -
 .../serializers/ble_gap_lesc_oob_data_set.c     |   56 -
 .../codecs/s130/serializers/ble_gap_ppcp_get.c  |   68 -
 .../codecs/s130/serializers/ble_gap_ppcp_set.c  |   54 -
 .../codecs/s130/serializers/ble_gap_rssi_get.c  |   80 -
 .../s130/serializers/ble_gap_rssi_start.c       |   53 -
 .../codecs/s130/serializers/ble_gap_rssi_stop.c |   45 -
 .../s130/serializers/ble_gap_scan_start.c       |   45 -
 .../codecs/s130/serializers/ble_gap_scan_stop.c |   40 -
 .../s130/serializers/ble_gap_sec_info_reply.c   |   78 -
 .../s130/serializers/ble_gap_sec_params_reply.c |   87 -
 .../s130/serializers/ble_gap_tx_power_set.c     |   45 -
 .../codecs/s130/serializers/ble_gattc_app.h     |  451 ----
 .../serializers/ble_gattc_attr_info_discover.c  |   49 -
 .../ble_gattc_char_value_by_uuid_read.c         |   61 -
 .../serializers/ble_gattc_char_values_read.c    |   48 -
 .../ble_gattc_characteristics_discover.c        |   57 -
 .../ble_gattc_descriptors_discover.c            |   53 -
 .../codecs/s130/serializers/ble_gattc_evt_app.h |  319 ---
 .../ble_gattc_evt_attr_info_disc_rsp.c          |   62 -
 .../serializers/ble_gattc_evt_char_disc_rsp.c   |  103 -
 .../ble_gattc_evt_char_val_by_uuid_read_rsp.c   |   78 -
 .../ble_gattc_evt_char_vals_read_rsp.c          |   66 -
 .../serializers/ble_gattc_evt_desc_disc_rsp.c   |   95 -
 .../codecs/s130/serializers/ble_gattc_evt_hvx.c |   65 -
 .../ble_gattc_evt_prim_srvc_disc_rsp.c          |   78 -
 .../s130/serializers/ble_gattc_evt_read_rsp.c   |   66 -
 .../serializers/ble_gattc_evt_rel_disc_rsp.c    |   65 -
 .../s130/serializers/ble_gattc_evt_timeout.c    |   75 -
 .../s130/serializers/ble_gattc_evt_write_rsp.c  |   66 -
 .../s130/serializers/ble_gattc_hv_confirm.c     |   49 -
 .../ble_gattc_primary_services_discover.c       |   59 -
 .../codecs/s130/serializers/ble_gattc_read.c    |   47 -
 .../ble_gattc_relationships_discover.c          |   57 -
 .../codecs/s130/serializers/ble_gattc_write.c   |   68 -
 .../codecs/s130/serializers/ble_gatts_app.h     |  639 ------
 .../s130/serializers/ble_gatts_attr_get.c       |   86 -
 .../serializers/ble_gatts_characteristic_add.c  |   89 -
 .../s130/serializers/ble_gatts_descriptor_add.c |   91 -
 .../codecs/s130/serializers/ble_gatts_evt_app.h |  194 --
 .../codecs/s130/serializers/ble_gatts_evt_hvc.c |   51 -
 .../ble_gatts_evt_rw_authorize_request.c        |   78 -
 .../s130/serializers/ble_gatts_evt_sc_confirm.c |   49 -
 .../ble_gatts_evt_sys_attr_missing.c            |   51 -
 .../s130/serializers/ble_gatts_evt_timeout.c    |   50 -
 .../s130/serializers/ble_gatts_evt_write.c      |   78 -
 .../codecs/s130/serializers/ble_gatts_hvx.c     |  115 -
 .../s130/serializers/ble_gatts_include_add.c    |   74 -
 .../ble_gatts_initial_user_handle_get.c         |   78 -
 .../serializers/ble_gatts_rw_authorize_reply.c  |   57 -
 .../s130/serializers/ble_gatts_service_add.c    |   83 -
 .../serializers/ble_gatts_service_changed.c     |   55 -
 .../s130/serializers/ble_gatts_sys_attr_get.c   |  113 -
 .../s130/serializers/ble_gatts_sys_attr_set.c   |   65 -
 .../s130/serializers/ble_gatts_value_get.c      |  126 --
 .../s130/serializers/ble_gatts_value_set.c      |   84 -
 .../codecs/s130/serializers/ble_l2cap_app.h     |  170 --
 .../s130/serializers/ble_l2cap_cid_register.c   |   45 -
 .../s130/serializers/ble_l2cap_cid_unregister.c |   45 -
 .../codecs/s130/serializers/ble_l2cap_evt_app.h |   69 -
 .../codecs/s130/serializers/ble_l2cap_evt_rx.c  |   56 -
 .../codecs/s130/serializers/ble_l2cap_tx.c      |   61 -
 .../codecs/s130/serializers/ble_opt_get.c       |  126 --
 .../codecs/s130/serializers/ble_opt_set.c       |  117 -
 .../s130/serializers/ble_tx_packet_count_get.c  |   72 -
 .../s130/serializers/ble_user_mem_reply.c       |   65 -
 .../codecs/s130/serializers/ble_uuid_decode.c   |   84 -
 .../codecs/s130/serializers/ble_uuid_encode.c   |   93 -
 .../codecs/s130/serializers/ble_uuid_vs_add.c   |   83 -
 .../codecs/s130/serializers/ble_version_get.c   |   73 -
 .../codecs/s130/serializers/ecb_block_encrypt.c |   79 -
 .../codecs/s130/serializers/nrf_soc_app.h       |  134 --
 .../codecs/s130/serializers/power_system_off.c  |   32 -
 .../codecs/s130/serializers/temp_get.c          |   71 -
 .../application/hal/arm_startup_nrf51.s         |  240 --
 .../serialization/application/hal/ser_app_hal.h |   88 -
 .../application/hal/ser_app_hal_nrf51.c         |  139 --
 .../application/hal/ser_app_power_system_off.c  |   35 -
 .../application/hal/ser_app_power_system_off.h  |   32 -
 .../application/transport/ser_sd_transport.c    |  259 ---
 .../application/transport/ser_sd_transport.h    |  161 --
 .../transport/ser_softdevice_handler.c          |  200 --
 .../transport/ser_softdevice_handler.h          |   52 -
 .../serialization/common/ble_serialization.c    |  520 -----
 .../serialization/common/ble_serialization.h    |  590 -----
 .../common/cond_field_serialization.c           |   62 -
 .../common/cond_field_serialization.h           |   64 -
 .../serialization/common/ser_config.h           |  121 -
 .../s130/ble_gap_struct_serialization.c         | 1495 -------------
 .../s130/ble_gap_struct_serialization.h         |  383 ----
 .../s130/ble_gattc_struct_serialization.c       |  523 -----
 .../s130/ble_gattc_struct_serialization.h       |  125 --
 .../s130/ble_gatts_struct_serialization.c       |  899 --------
 .../s130/ble_gatts_struct_serialization.h       |  158 --
 .../struct_ser/s130/ble_struct_serialization.c  |  571 -----
 .../struct_ser/s130/ble_struct_serialization.h  |  135 --
 .../s130/nrf_soc_struct_serialization.c         |   82 -
 .../s130/nrf_soc_struct_serialization.h         |   33 -
 .../transport/debug/debug_hci_config_nrf6310.h  |   52 -
 .../common/transport/debug/debug_hci_nrf6310.c  |  228 --
 .../common/transport/dtm_uart_params.h          |   65 -
 .../common/transport/ser_hal_transport.c        |  460 ----
 .../common/transport/ser_hal_transport.h        |  239 --
 .../ser_phy/config/ser_config_5W_app.h          |   24 -
 .../ser_phy/config/ser_phy_config_app_nrf51.h   |   78 -
 .../ser_phy/config/ser_phy_config_conn_nrf51.h  |   50 -
 .../ser_phy/config/ser_phy_debug_app.h          |  170 --
 .../ser_phy/config/ser_phy_debug_conn.h         |  138 --
 .../common/transport/ser_phy/ser_phy.c          |   61 -
 .../common/transport/ser_phy/ser_phy.h          |  264 ---
 .../common/transport/ser_phy/ser_phy_hci.c      | 1668 --------------
 .../common/transport/ser_phy/ser_phy_hci.h      |  155 --
 .../common/transport/ser_phy/ser_phy_hci_slip.c |  634 ------
 .../common/transport/ser_phy/ser_phy_nohci.c    |  356 ---
 .../ser_phy/ser_phy_nrf51_nrf_drv_spi.c         |  784 -------
 .../ser_phy/ser_phy_nrf51_spi_5W_master.c       |  803 -------
 .../ser_phy/ser_phy_nrf51_spi_5W_slave.c        |  618 ------
 .../transport/ser_phy/ser_phy_nrf51_spi_slave.c |  580 -----
 .../transport/ser_phy/ser_phy_nrf51_uart.c      |  440 ----
 .../ser_phy/ser_phy_nrf51_uart_stm_app.c        |  754 -------
 .../ser_phy/ser_phy_nrf51_uart_stm_conn.c       |  784 -------
 .../common/transport/ser_phy/spi_5W_master.c    |  603 -----
 .../common/transport/ser_phy/spi_5W_master.h    |  178 --
 .../common/transport/ser_phy_debug_comm.h       |  175 --
 .../connectivity/codecs/common/ble_dtm_conn.h   |   85 -
 .../connectivity/codecs/common/ble_dtm_init.c   |   56 -
 .../connectivity/codecs/common/conn_mw.c        |   84 -
 .../connectivity/codecs/common/conn_mw.h        |   46 -
 .../codecs/s130/middleware/conn_mw.h            |   46 -
 .../codecs/s130/middleware/conn_mw_ble.c        |  312 ---
 .../codecs/s130/middleware/conn_mw_ble.h        |  187 --
 .../codecs/s130/middleware/conn_mw_ble_gap.c    |  967 --------
 .../codecs/s130/middleware/conn_mw_ble_gap.h    |  615 ------
 .../codecs/s130/middleware/conn_mw_ble_gattc.c  |  322 ---
 .../codecs/s130/middleware/conn_mw_ble_gattc.h  |  204 --
 .../codecs/s130/middleware/conn_mw_ble_gatts.c  |  463 ----
 .../codecs/s130/middleware/conn_mw_ble_gatts.h  |  260 ---
 .../codecs/s130/middleware/conn_mw_ble_l2cap.c  |   91 -
 .../codecs/s130/middleware/conn_mw_ble_l2cap.h  |   80 -
 .../codecs/s130/middleware/conn_mw_items.c      |   83 -
 .../codecs/s130/middleware/conn_mw_nrf_soc.c    |   86 -
 .../codecs/s130/middleware/conn_mw_nrf_soc.h    |   82 -
 .../codecs/s130/serializers/ble_conn.h          |  457 ----
 .../codecs/s130/serializers/ble_enable.c        |   46 -
 .../codecs/s130/serializers/ble_event.c         |  193 --
 .../codecs/s130/serializers/ble_evt_conn.h      |  103 -
 .../s130/serializers/ble_evt_tx_complete.c      |   38 -
 .../s130/serializers/ble_evt_user_mem_release.c |   56 -
 .../s130/serializers/ble_evt_user_mem_request.c |   46 -
 .../s130/serializers/ble_gap_address_get.c      |   79 -
 .../s130/serializers/ble_gap_address_set.c      |   52 -
 .../s130/serializers/ble_gap_adv_data_set.c     |   49 -
 .../codecs/s130/serializers/ble_gap_adv_start.c |   88 -
 .../codecs/s130/serializers/ble_gap_adv_stop.c  |   23 -
 .../s130/serializers/ble_gap_appearance_get.c   |   76 -
 .../s130/serializers/ble_gap_appearance_set.c   |   42 -
 .../s130/serializers/ble_gap_auth_key_reply.c   |   68 -
 .../s130/serializers/ble_gap_authenticate.c     |   57 -
 .../codecs/s130/serializers/ble_gap_conn.h      | 1212 -----------
 .../serializers/ble_gap_conn_param_update.c     |   71 -
 .../s130/serializers/ble_gap_conn_sec_get.c     |   75 -
 .../codecs/s130/serializers/ble_gap_connect.c   |   55 -
 .../s130/serializers/ble_gap_connect_cancel.c   |   25 -
 .../s130/serializers/ble_gap_device_name_get.c  |   92 -
 .../s130/serializers/ble_gap_device_name_set.c  |   61 -
 .../s130/serializers/ble_gap_disconnect.c       |   52 -
 .../codecs/s130/serializers/ble_gap_encrypt.c   |   60 -
 .../s130/serializers/ble_gap_evt_adv_report.c   |   61 -
 .../serializers/ble_gap_evt_auth_key_request.c  |   49 -
 .../s130/serializers/ble_gap_evt_auth_status.c  |   64 -
 .../codecs/s130/serializers/ble_gap_evt_conn.h  |  384 ----
 .../serializers/ble_gap_evt_conn_param_update.c |   49 -
 .../ble_gap_evt_conn_param_update_request.c     |   49 -
 .../serializers/ble_gap_evt_conn_sec_update.c   |   51 -
 .../s130/serializers/ble_gap_evt_connected.c    |   49 -
 .../s130/serializers/ble_gap_evt_disconnected.c |   49 -
 .../s130/serializers/ble_gap_evt_key_pressed.c  |   46 -
 .../ble_gap_evt_lesc_dhkey_request.c            |   52 -
 .../serializers/ble_gap_evt_passkey_display.c   |   47 -
 .../s130/serializers/ble_gap_evt_rssi_changed.c |   38 -
 .../serializers/ble_gap_evt_scan_req_report.c   |   49 -
 .../serializers/ble_gap_evt_sec_info_request.c  |   51 -
 .../ble_gap_evt_sec_params_request.c            |   51 -
 .../s130/serializers/ble_gap_evt_sec_request.c  |   49 -
 .../s130/serializers/ble_gap_evt_timeout.c      |   38 -
 .../s130/serializers/ble_gap_keypress_notify.c  |   56 -
 .../s130/serializers/ble_gap_lesc_dhkey_reply.c |   56 -
 .../serializers/ble_gap_lesc_oob_data_get.c     |   75 -
 .../serializers/ble_gap_lesc_oob_data_set.c     |   61 -
 .../codecs/s130/serializers/ble_gap_ppcp_get.c  |   80 -
 .../codecs/s130/serializers/ble_gap_ppcp_set.c  |   64 -
 .../codecs/s130/serializers/ble_gap_rssi_get.c  |   77 -
 .../s130/serializers/ble_gap_rssi_start.c       |   49 -
 .../codecs/s130/serializers/ble_gap_rssi_stop.c |   39 -
 .../s130/serializers/ble_gap_scan_start.c       |   44 -
 .../codecs/s130/serializers/ble_gap_scan_stop.c |   23 -
 .../s130/serializers/ble_gap_sec_info_reply.c   |   72 -
 .../s130/serializers/ble_gap_sec_params_reply.c |   90 -
 .../s130/serializers/ble_gap_tx_power_set.c     |   39 -
 .../serializers/ble_gattc_attr_info_discover.c  |   59 -
 .../ble_gattc_char_value_by_uuid_read.c         |   65 -
 .../serializers/ble_gattc_char_values_read.c    |   53 -
 .../ble_gattc_characteristics_discover.c        |   63 -
 .../codecs/s130/serializers/ble_gattc_conn.h    |  442 ----
 .../ble_gattc_descriptors_discover.c            |   62 -
 .../ble_gattc_evt_attr_info_disc_rsp.c          |   51 -
 .../serializers/ble_gattc_evt_char_disc_rsp.c   |   73 -
 .../ble_gattc_evt_char_val_by_uuid_read_rsp.c   |   52 -
 .../ble_gattc_evt_char_vals_read_rsp.c          |   59 -
 .../s130/serializers/ble_gattc_evt_conn.h       |  264 ---
 .../serializers/ble_gattc_evt_desc_disc_rsp.c   |   53 -
 .../codecs/s130/serializers/ble_gattc_evt_hvx.c |   52 -
 .../ble_gattc_evt_prim_srvc_disc_rsp.c          |   62 -
 .../s130/serializers/ble_gattc_evt_read_rsp.c   |   52 -
 .../serializers/ble_gattc_evt_rel_disc_rsp.c    |   51 -
 .../s130/serializers/ble_gattc_evt_timeout.c    |   37 -
 .../s130/serializers/ble_gattc_evt_write_rsp.c  |   53 -
 .../s130/serializers/ble_gattc_hv_confirm.c     |   45 -
 .../ble_gattc_primary_services_discover.c       |   67 -
 .../codecs/s130/serializers/ble_gattc_read.c    |   49 -
 .../ble_gattc_relationships_discover.c          |   64 -
 .../codecs/s130/serializers/ble_gattc_write.c   |   59 -
 .../s130/serializers/ble_gatts_attr_get.c       |   80 -
 .../serializers/ble_gatts_characteristic_add.c  |   88 -
 .../codecs/s130/serializers/ble_gatts_conn.h    |  599 -----
 .../s130/serializers/ble_gatts_descriptor_add.c |   94 -
 .../s130/serializers/ble_gatts_evt_conn.h       |  164 --
 .../codecs/s130/serializers/ble_gatts_evt_hvc.c |   38 -
 .../ble_gatts_evt_rw_authorize_request.c        |   59 -
 .../s130/serializers/ble_gatts_evt_sc_confirm.c |   37 -
 .../ble_gatts_evt_sys_attr_missing.c            |   37 -
 .../s130/serializers/ble_gatts_evt_timeout.c    |   37 -
 .../s130/serializers/ble_gatts_evt_write.c      |   63 -
 .../codecs/s130/serializers/ble_gatts_hvx.c     |   81 -
 .../s130/serializers/ble_gatts_include_add.c    |   74 -
 .../ble_gatts_initial_user_handle_get.c         |   69 -
 .../serializers/ble_gatts_rw_authorize_reply.c  |   53 -
 .../s130/serializers/ble_gatts_service_add.c    |   76 -
 .../serializers/ble_gatts_service_changed.c     |   55 -
 .../s130/serializers/ble_gatts_sys_attr_get.c   |  125 --
 .../s130/serializers/ble_gatts_sys_attr_set.c   |   76 -
 .../s130/serializers/ble_gatts_value_get.c      |  105 -
 .../s130/serializers/ble_gatts_value_set.c      |   74 -
 .../s130/serializers/ble_l2cap_cid_register.c   |   46 -
 .../s130/serializers/ble_l2cap_cid_unregister.c |   46 -
 .../codecs/s130/serializers/ble_l2cap_conn.h    |  164 --
 .../s130/serializers/ble_l2cap_evt_conn.h       |   64 -
 .../codecs/s130/serializers/ble_l2cap_evt_rx.c  |   50 -
 .../codecs/s130/serializers/ble_l2cap_tx.c      |   67 -
 .../codecs/s130/serializers/ble_opt_get.c       |  130 --
 .../s130/serializers/ble_opt_id_pre_decoder.c   |   36 -
 .../codecs/s130/serializers/ble_opt_set.c       |  109 -
 .../s130/serializers/ble_tx_packet_count_get.c  |   69 -
 .../s130/serializers/ble_user_mem_reply.c       |   66 -
 .../codecs/s130/serializers/ble_uuid_decode.c   |   77 -
 .../codecs/s130/serializers/ble_uuid_encode.c   |  117 -
 .../codecs/s130/serializers/ble_uuid_vs_add.c   |   73 -
 .../codecs/s130/serializers/ble_version_get.c   |   77 -
 .../s130/serializers/conn_ble_gap_sec_keys.c    |   73 -
 .../s130/serializers/conn_ble_gap_sec_keys.h    |   96 -
 .../codecs/s130/serializers/conn_ble_user_mem.c |   78 -
 .../codecs/s130/serializers/conn_ble_user_mem.h |   89 -
 .../codecs/s130/serializers/ecb_block_encrypt.c |   72 -
 .../codecs/s130/serializers/nrf_soc_conn.h      |  135 --
 .../codecs/s130/serializers/power_system_off.c  |   28 -
 .../codecs/s130/serializers/temp_get.c          |   72 -
 .../serialization/connectivity/hal/dtm_uart.c   |  233 --
 .../serialization/connectivity/hal/dtm_uart.h   |   31 -
 .../connectivity/pstorage_platform.h            |   78 -
 .../connectivity/ser_conn_cmd_decoder.c         |   97 -
 .../connectivity/ser_conn_cmd_decoder.h         |   61 -
 .../connectivity/ser_conn_dtm_cmd_decoder.c     |   94 -
 .../connectivity/ser_conn_dtm_cmd_decoder.h     |   70 -
 .../connectivity/ser_conn_error_handling.c      |  104 -
 .../connectivity/ser_conn_event_encoder.c       |   75 -
 .../connectivity/ser_conn_event_encoder.h       |   58 -
 .../connectivity/ser_conn_handlers.c            |  129 --
 .../connectivity/ser_conn_handlers.h            |   92 -
 .../connectivity/ser_conn_pkt_decoder.c         |   86 -
 .../connectivity/ser_conn_pkt_decoder.h         |   62 -
 .../connectivity/ser_conn_reset_cmd_decoder.c   |   20 -
 .../connectivity/ser_conn_reset_cmd_decoder.h   |   53 -
 .../startup/arm/arm_startup_nrf51.s             |  240 --
 575 files changed, 6 insertions(+), 113400 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/arduino_primo_nrf52/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/arduino_primo_nrf52/include/bsp/nrf_drv_config.h b/hw/bsp/arduino_primo_nrf52/include/bsp/nrf_drv_config.h
deleted file mode 100644
index 643d968..0000000
--- a/hw/bsp/arduino_primo_nrf52/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,472 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 0
-
-#define SPI0_CONFIG_SCK_PIN         2
-#define SPI0_CONFIG_MOSI_PIN        3
-#define SPI0_CONFIG_MISO_PIN        4
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 1
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         2
-#define SPIS0_CONFIG_MOSI_PIN        3
-#define SPIS0_CONFIG_MISO_PIN        4
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 0
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_SCK_PIN         2
-#define SPIS1_CONFIG_MOSI_PIN        3
-#define SPIS1_CONFIG_MISO_PIN        4
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          0
-#define TWI0_CONFIG_SDA          1
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 1
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 1
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 0
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 1
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 1
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 1
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/bmd300eval/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/bmd300eval/include/bsp/nrf_drv_config.h b/hw/bsp/bmd300eval/include/bsp/nrf_drv_config.h
deleted file mode 100644
index 5341c32..0000000
--- a/hw/bsp/bmd300eval/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,471 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 1
-#define SPI0_CONFIG_SCK_PIN         23
-#define SPI0_CONFIG_MOSI_PIN        24
-#define SPI0_CONFIG_MISO_PIN        25
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 1
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         23
-#define SPIS0_CONFIG_MOSI_PIN        24
-#define SPIS0_CONFIG_MISO_PIN        25
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 0
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_SCK_PIN         2
-#define SPIS1_CONFIG_MOSI_PIN        3
-#define SPIS1_CONFIG_MISO_PIN        4
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          0
-#define TWI0_CONFIG_SDA          1
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 1
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 1
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 0
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 1
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 1
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 1
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/bsp/nrf51-arduino_101/include/bsp/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51-arduino_101/include/bsp/nrf_drv_config.h b/hw/bsp/nrf51-arduino_101/include/bsp/nrf_drv_config.h
deleted file mode 100644
index d111ac3..0000000
--- a/hw/bsp/nrf51-arduino_101/include/bsp/nrf_drv_config.h
+++ /dev/null
@@ -1,474 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  1
-
-/* CLOCK */
-#define CLOCK_ENABLED 1
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 1
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 1
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
-
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 1
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 1
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 1
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 0
-/* NOTE: SCK definitions match NRF51 DK product brief */
-#define SPI0_CONFIG_CSN_PIN         24 /* Note: not defined by SDK */
-#define SPI0_CONFIG_SCK_PIN         29
-#define SPI0_CONFIG_MOSI_PIN        25
-#define SPI0_CONFIG_MISO_PIN        28
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 0
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         2
-#define SPIS0_CONFIG_MOSI_PIN        3
-#define SPIS0_CONFIG_MISO_PIN        4
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 1
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_CSN_PIN         24 /* Note: not defined by SDK */
-#define SPIS1_CONFIG_SCK_PIN         29
-#define SPIS1_CONFIG_MOSI_PIN        25
-#define SPIS1_CONFIG_MISO_PIN        28
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 1
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 1
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          0
-#define TWI0_CONFIG_SDA          1
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 0
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 0
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 1
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 1
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 0
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 0
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 1
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 1
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 0
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_H


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

Posted by cc...@apache.org.
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__ 
-
-/**@} */


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

Posted by cc...@apache.org.
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/fds/fds.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds.h
deleted file mode 100644
index 1fe54ec..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds.h
+++ /dev/null
@@ -1,741 +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.
- *
- */
-
-#ifndef FDS_H__
-#define FDS_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup flash_data_storage Flash Data Storage
- * @ingroup app_common
- * @{
- *
- * @brief   Flash Data Storage (FDS).
- *
- * @details Flash Data Storage is a minimalistic, record-oriented file system for the on-chip
- *          flash. Files are stored as a collection of  records of variable length. FDS supports
- *          synchronous read operations and asynchronous write operations (write, update,
- *          and delete). FDS can be used from multiple threads.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "sdk_errors.h"
-
-
-/**@brief   Invalid file ID.
- *
- * This value must not be used as a file ID by the application.
- */
-#define FDS_FILE_ID_INVALID     (0xFFFF)
-
-
-/**@brief   Record key for deleted records.
- *
- * This key is used to flag a record as "dirty", which means that it should be removed during
- * the next garbage collection. This value must not be used as a record key by the application.
- */
-#define FDS_RECORD_KEY_DIRTY    (0x0000)
-
-
-/**@brief   FDS return values.
- */
-enum
-{
-    FDS_SUCCESS = NRF_SUCCESS,  //!< The operation completed successfully.
-    FDS_ERR_OPERATION_TIMEOUT,  //!< Error. The operation timed out.
-    FDS_ERR_NOT_INITIALIZED,    //!< Error. The module has not been initialized.
-    FDS_ERR_UNALIGNED_ADDR,     //!< Error. The input data is not aligned to a word boundary.
-    FDS_ERR_INVALID_ARG,        //!< Error. The parameter contains invalid data.
-    FDS_ERR_NULL_ARG,           //!< Error. The parameter is NULL.
-    FDS_ERR_NO_OPEN_RECORDS,    //!< Error. The record is not open, so it cannot be closed.
-    FDS_ERR_NO_SPACE_IN_FLASH,  //!< Error. There is no space in flash memory.
-    FDS_ERR_NO_SPACE_IN_QUEUES, //!< Error. There is no space in the internal queues.
-    FDS_ERR_RECORD_TOO_LARGE,   //!< Error. The record exceeds the maximum allowed size.
-    FDS_ERR_NOT_FOUND,          //!< Error. The record was not found.
-    FDS_ERR_NO_PAGES,           //!< Error. No flash pages are available.
-    FDS_ERR_USER_LIMIT_REACHED, //!< Error. The maximum number of users has been reached.
-    FDS_ERR_CRC_CHECK_FAILED,   //!< Error. The CRC check failed.
-    FDS_ERR_BUSY,               //!< Error. The underlying flash subsystem was busy.
-    FDS_ERR_INTERNAL,           //!< Error. An internal error occurred.
-};
-
-
-/**@brief   Part of the record metadata.
- *
- * Contains the record key and the length of the record data.
- */
-typedef struct
-{
-    uint16_t record_key;    //!< The record key (must be in the range 0x0001 - 0xBFFF).
-    uint16_t length_words;  //!< The length of the record data (in 4-byte words).
-} fds_tl_t;
-
-
-/**@brief   Part of the record metadata.
- *
- * Contains the ID of the file that the record belongs to and the CRC16 check value of the record.
- */
-typedef struct
-{
-    uint16_t file_id;   //!< The ID of the file that the record belongs to.
-
-    /**@brief   CRC16 check value.
-     *
-     * The CRC is calculated over the entire record as stored in flash (including the record
-     * metadata except the CRC field itself). The CRC standard employed is CRC-16-CCITT.
-     */
-    uint16_t crc16;
-} fds_ic_t;
-
-
-/**@brief   The record metadata as stored in flash.
- */
-typedef struct
-{
-    fds_tl_t tl;        //!< See @ref fds_tl_t.
-    fds_ic_t ic;        //!< See @ref fds_ic_t.
-    uint32_t record_id; //!< The unique record ID (32 bits).
-} fds_header_t;
-
-
-/**@brief   The record descriptor structure that is used to manipulate records.
- *
- * This structure is used by the FDS module. You must provide the descriptor to the module when
- * you manipulate existing records. However, you should never modify it or use any of its fields.
- *
- * @note Never reuse the same descriptor for different records.
- */
-typedef struct
-{
-    uint32_t         record_id;         //!< The unique record ID.
-    uint32_t const * p_record;          //!< The last known location of the record in flash.
-    uint16_t         gc_run_count;      //!< Number of times garbage collection has been run.
-    bool             record_is_open;    //!< Whether the record is currently open.
-} fds_record_desc_t;
-
-
-/**@brief   Structure that can be used to read the contents of a record stored in flash.
- *
- * This structure does not reflect the physical layout of a record in flash, but it points 
- * to the locations where the record header (metadata) and the record data are stored.
- */
-typedef struct
-{
-    fds_header_t const * p_header;  //!< Location of the record header in flash.
-    void         const * p_data;    //!< Location of the record data in flash.
-} fds_flash_record_t;
-
-
-/**@brief   A chunk of record data to be written to flash.
- *
- * @p p_data must be aligned to a word boundary. Make sure to keep it in 
- * memory until the operation has completed, which is indicated by the respective FDS event.
- */
-typedef struct
-{
-    void     const * p_data;        //!< Pointer to the data to store. Must be word-aligned.
-    uint16_t         length_words;  //!< Length of data pointed to by @p p_data (in 4-byte words).
-} fds_record_chunk_t;
-
-
-/**@brief   A record to be written to flash.
- */
-typedef struct
-{
-    uint16_t file_id;                           //!< The ID of the file that the record belongs to.
-    uint16_t key;                               //!< The record key.
-    struct
-    {
-        fds_record_chunk_t const * p_chunks;    //!< The chunks that make up the record data.
-        uint16_t                   num_chunks;  //!< The number of chunks that make up the data.
-    } data;
-} fds_record_t;
-
-
-/**@brief   A token to a reserved space in flash, created by @ref fds_reserve.
- *
- * This token can be used to write the record in the reserved space (@ref fds_record_write_reserved)
- * or to cancel the reservation (@ref fds_reserve_cancel).
- */
-typedef struct
-{
-    uint16_t page;           //!< The logical ID of the page where space was reserved.
-    uint16_t length_words;   //!< The amount of space reserved (in 4-byte words).
-} fds_reserve_token_t;
-
-
-/**@brief   A token to keep information about the progress of @ref fds_record_find,
- *          @ref fds_record_find_by_key, and @ref fds_record_find_in_file.
- *
- * @note    Always zero-initialize the token before using it for the first time.
- * @note    Never reuse the same token to search for different records.
- */
-typedef struct
-{
-    uint32_t const * p_addr;
-    uint16_t         page;
-} fds_find_token_t;
-
-
-/**@brief   FDS event IDs.
- */
-typedef enum
-{
-    FDS_EVT_INIT,       //!< Event for @ref fds_init.
-    FDS_EVT_WRITE,      //!< Event for @ref fds_record_write and @ref fds_record_write_reserved.
-    FDS_EVT_UPDATE,     //!< Event for @ref fds_record_update.
-    FDS_EVT_DEL_RECORD, //!< Event for @ref fds_record_delete.
-    FDS_EVT_DEL_FILE,   //!< Event for @ref fds_file_delete.
-    FDS_EVT_GC          //!< Event for @ref fds_gc.
-} fds_evt_id_t;
-
-
-#if defined(__CC_ARM)
-    #pragma push
-    #pragma anon_unions
-#elif defined(__ICCARM__)
-    #pragma language=extended
-#elif defined(__GNUC__)
-    /* anonymous unions are enabled by default */
-#endif
-
-/**@brief   An FDS event.
- */
-typedef struct
-{
-    fds_evt_id_t id;        //!< The event ID. See @ref fds_evt_id_t.
-    ret_code_t   result;    //!< The result of the operation related to this event.
-    union
-    {
-        struct
-        {
-            /* Currently not used. */
-            uint16_t pages_not_mounted;
-        } init;
-        struct
-        {
-            uint32_t record_id;
-            uint16_t file_id;
-            uint16_t record_key;
-            bool     is_record_updated;
-        } write; //!< Information for @ref FDS_EVT_WRITE and @ref FDS_EVT_UPDATE events.
-        struct
-        {
-            uint32_t record_id;
-            uint16_t file_id;
-            uint16_t record_key;
-            uint16_t records_deleted_count;
-        } del; //!< Information for @ref FDS_EVT_DEL_RECORD and @ref FDS_EVT_DEL_FILE events.
-        struct
-        {
-            /* Currently not used. */
-            uint16_t pages_skipped;
-            uint16_t space_reclaimed;
-        } gc;
-    };
-} fds_evt_t;
-
-#if defined(__CC_ARM)
-    #pragma pop
-#elif defined(__ICCARM__)
-    /* leave anonymous unions enabled */
-#elif defined(__GNUC__)
-    /* anonymous unions are enabled by default */
-#endif
-
-
-/**@brief   File system statistics. */
-typedef struct
-{
-    uint16_t open_records;      //!< The number of open records.
-    uint16_t valid_records;     //!< The number of valid records.
-    uint16_t dirty_records;     //!< The number of deleted ("dirty") records.
-    uint16_t words_reserved;    //!< The number of words reserved by @ref fds_reserve().
-
-    /**@brief The number of words written to flash, including those reserved for future writes.
-     */
-    uint16_t words_used;
-
-    /**@brief The largest number of free contiguous words in the file system.
-     *
-     * This number determines the largest record that can be stored by FDS.
-     * It takes into account all reservations for future writes.
-     */
-    uint16_t largest_contig;
-
-    /**@brief The largest number of words that can be reclaimed by garbage collection.
-     *
-     * The actual amount of space freed by garbage collection might be less than this value if
-     * records are open while garbage collection is run.
-     */
-    uint16_t freeable_words;
-} fds_stat_t;
-
-
-/**@brief   FDS event handler function prototype.
- *
- * @param   p_evt   The event.
- */
-typedef void (*fds_cb_t)(fds_evt_t const * const p_evt);
-
-
-/**@brief   Function for registering an FDS event handler.
- *
- * The maximum amount of handlers that can be registered can be configured by changing the value
- * of @ref FDS_MAX_USERS in fds_config.h.
- * 
- * @param[in]   cb  The event handler function.
- *
- * @retval  FDS_SUCCESS                 If the event handler was registered successfully.
- * @retval  FDS_ERR_USER_LIMIT_REACHED  If the maximum number of registered callbacks is reached.
- */
-ret_code_t fds_register(fds_cb_t cb);
-
-
-/**@brief   Function for initializing the module.
- *
- * This function initializes the module and installs the file system (unless it is installed
- * already).
- *
- * This function is asynchronous. Completion is reported through an event. Make sure to call
- * @ref fds_register before calling @ref fds_init so that you receive the completion event.
- *
- * @retval  FDS_SUCCESS         If the operation was queued successfully.
- * @retval  FDS_ERR_NO_PAGES    If there is no space available in flash memory to install the
- *                              file system.
- */
-ret_code_t fds_init(void);
-
-
-/**@brief   Function for writing a record to flash.
- *
- * There are no restrictions on the file ID and the record key, except that the record key must be
- * different from @ref FDS_RECORD_KEY_DIRTY and the file ID must be different from
- * @ref FDS_FILE_ID_INVALID. In particular, no restrictions are made regarding the uniqueness of
- * the file ID or the record key. All records with the same file ID are grouped into one file.
- * If no file with the specified ID exists, it is created. There can be multiple records with the
- * same record key in a file.
- *
- * Record data can consist of multiple chunks. The data must be aligned to a 4 byte boundary, and
- * because it is not buffered internally, it must be kept in memory until the callback for the
- * operation has been received. The length of the data must not exceed @ref FDS_VIRTUAL_PAGE_SIZE
- * words minus 14 bytes.
- *
- * This function is asynchronous. Completion is reported through an event that is sent to
- * the registered event handler function.
- *
- * @param[out]  p_desc      The descriptor of the record that was written. Pass NULL if you do not
- *                          need the descriptor.
- * @param[in]   p_record    The record to be written to flash.
- *
- * @retval  FDS_SUCCESS                 If the operation was queued successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_record is NULL.
- * @retval  FDS_ERR_INVALID_ARG         If the file ID or the record key is invalid.
- * @retval  FDS_ERR_UNALIGNED_ADDR      If the record data is not aligned to a 4 byte boundary.
- * @retval  FDS_ERR_RECORD_TOO_LARGE    If the record data exceeds the maximum length.
- * @retval  FDS_ERR_NO_SPACE_IN_QUEUES  If the operation queue is full or there are more record
- *                                      chunks than can be buffered.
- * @retval  FDS_ERR_NO_SPACE_IN_FLASH   If there is not enough free space in flash to store the
- *                                      record.
- */
-ret_code_t fds_record_write(fds_record_desc_t       * const p_desc,
-                            fds_record_t      const * const p_record);
-
-
-/**@brief   Function for reserving space in flash.
- *
- * This function can be used to reserve space in flash memory. To write a record into the reserved
- * space, use @ref fds_record_write_reserved. Alternatively, use @ref fds_reserve_cancel to cancel
- * a reservation.
- *
- * Note that this function does not write any data to flash.
- *
- * @param[out]  p_token         A token that can be used to write a record in the reserved space or
- *                              cancel the reservation.
- * @param[in]   length_words    The length of the record data (in 4-byte words).
- *
- * @retval  FDS_SUCCESS                 If the flash space was reserved successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_token is NULL instead of a valid token address.
- * @retval  FDS_ERR_RECORD_TOO_LARGE    If the record length exceeds the maximum length.
- * @retval  FDS_ERR_NO_SPACE_IN_FLASH   If there is not enough free space in flash to store the
- *                                      record.
- */
-ret_code_t fds_reserve(fds_reserve_token_t * const p_token, uint16_t length_words);
-
-
-/**@brief   Function for canceling an @ref fds_reserve operation.
- *
- * @param[in]   p_token     The token that identifies the reservation, produced by @ref fds_reserve.
- *
- * @retval  FDS_SUCCESS             If the reservation was canceled.
- * @retval  FDS_ERR_NOT_INITIALIZED If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG        If @p p_token is NULL instead of a valid token address.
- * @retval  FDS_ERR_INVALID_ARG     If @p p_token contains invalid data.
- */
-ret_code_t fds_reserve_cancel(fds_reserve_token_t * const p_token);
-
-
-/**@brief   Function for writing a record to a space in flash that was reserved using
- *          @ref fds_reserve.
- *
- * There are no restrictions on the file ID and the record key, except that the record key must be
- * different from @ref FDS_RECORD_KEY_DIRTY and the file ID must be different from
- * @ref FDS_FILE_ID_INVALID. In particular, no restrictions are made regarding the uniqueness of
- * the file ID or the record key. All records with the same file ID are grouped into one file.
- * If no file with the specified ID exists, it is created. There can be multiple records with the
- * same record key in a file.
- *
- * Record data can consist of multiple chunks. The data must be aligned to a 4 byte boundary, and
- * because it is not buffered internally, it must be kept in memory until the callback for the
- * operation has been received. The length of the data must not exceed @ref FDS_VIRTUAL_PAGE_SIZE
- * words minus 14 bytes.
- *
- * This function is asynchronous. Completion is reported through an event that is sent to the
- * registered event handler function.
- *
- * @note
- * This function behaves similarly to @ref fds_record_write, with the exception that it never
- * fails with the error @ref FDS_ERR_NO_SPACE_IN_FLASH.
- *
- * @param[out]  p_desc      The descriptor of the record that was written. Pass NULL if you do not
- *                          need the descriptor.
- * @param[in]   p_record    The record to be written to flash.
- * @param[in]   p_token     The token that identifies the space reserved in flash.
- *
- * @retval  FDS_SUCCESS                 If the operation was queued successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_token is NULL instead of a valid token address.
- * @retval  FDS_ERR_INVALID_ARG         If the file ID or the record key is invalid.
- * @retval  FDS_ERR_UNALIGNED_ADDR      If the record data is not aligned to a 4 byte boundary.
- * @retval  FDS_ERR_RECORD_TOO_LARGE    If the record data exceeds the maximum length.
- * @retval  FDS_ERR_NO_SPACE_IN_QUEUES  If the operation queue is full or there are more record
- *                                      chunks than can be buffered.
- */
-ret_code_t fds_record_write_reserved(fds_record_desc_t         * const p_desc,
-                                     fds_record_t        const * const p_record,
-                                     fds_reserve_token_t const * const p_token);
-
-
-/**@brief   Function for deleting a record.
- *
- * Deleted records cannot be located using @ref fds_record_find, @ref fds_record_find_by_key, or
- * @ref fds_record_find_in_file. Additionally, they can no longer be opened using
- * @ref fds_record_open.
- *
- * Note that deleting a record does not free the space it occupies in flash memory.
- * To reclaim flash space used by deleted records, call @ref fds_gc to run garbage collection.
- *
- * This function is asynchronous. Completion is reported through an event that is sent to the
- * registered event handler function.
- *
- * @param[in]   p_desc      The descriptor of the record that should be deleted.
- *
- * @retval  FDS_SUCCESS                 If the operation was queued successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If the specified record descriptor @p p_desc is NULL.
- * @retval  FDS_ERR_NO_SPACE_IN_QUEUES  If the operation queue is full.
- */
-ret_code_t fds_record_delete(fds_record_desc_t * const p_desc);
-
-
-/**@brief   Function for deleting all records in a file.
- *
- * This function deletes a file, including all its records. Deleted records cannot be located
- * using @ref fds_record_find, @ref fds_record_find_by_key, or @ref fds_record_find_in_file.
- * Additionally, they can no longer be opened using @ref fds_record_open.
- *
- * Note that deleting records does not free the space they occupy in flash memory.
- * To reclaim flash space used by deleted records, call @ref fds_gc to run garbage collection.
- *
- * This function is asynchronous. Completion is reported through an event that is sent to the
- * registered event handler function.
- *
- * @param[in]   file_id     The ID of the file to be deleted.
- *
- * @retval  FDS_SUCCESS                 If the operation was queued successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_INVALID_ARG         If the specified @p file_id is invalid.
- * @retval  FDS_ERR_NO_SPACE_IN_QUEUES  If the operation queue is full.
- */
-ret_code_t fds_file_delete(uint16_t file_id);
-
-
-/**@brief   Function for updating a record.
- *
- * Updating a record first writes a new record (@p p_record) to flash and then deletes the
- * old record (identified by @p p_desc).
- *
- * There are no restrictions on the file ID and the record key, except that the record key must be
- * different from @ref FDS_RECORD_KEY_DIRTY and the file ID must be different from
- * @ref FDS_FILE_ID_INVALID. In particular, no restrictions are made regarding the uniqueness of
- * the file ID or the record key. All records with the same file ID are grouped into one file.
- * If no file with the specified ID exists, it is created. There can be multiple records with the
- * same record key in a file.
- *
- * Record data can consist of multiple chunks. The data must be aligned to a 4 byte boundary, and
- * because it is not buffered internally, it must be kept in memory until the callback for the
- * operation has been received. The length of the data must not exceed @ref FDS_VIRTUAL_PAGE_SIZE
- * words minus 14 bytes.
- *
- * This function is asynchronous. Completion is reported through an event that is sent to the
- * registered event handler function.
- * 
- * @param[in, out]  p_desc      The descriptor of the record to update. When the function 
- *                              returns with FDS_SUCCESS, this parameter contains the
- *                              descriptor of the newly written record.
- * @param[in]       p_record    The updated record to be written to flash.
- *
- * @retval  FDS_SUCCESS                 If the operation was queued successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_INVALID_ARG         If the file ID or the record key is invalid.
- * @retval  FDS_ERR_UNALIGNED_ADDR      If the record data is not aligned to a 4 byte boundary.
- * @retval  FDS_ERR_RECORD_TOO_LARGE    If the record data exceeds the maximum length.
- * @retval  FDS_ERR_NO_SPACE_IN_QUEUES  If the operation queue is full or there are more record
- *                                      chunks than can be buffered.
- * @retval  FDS_ERR_NO_SPACE_IN_FLASH   If there is not enough free space in flash to store the
- *                                      updated record.
- */
-ret_code_t fds_record_update(fds_record_desc_t       * const p_desc,
-                             fds_record_t      const * const p_record);
-
-
-/**@brief   Function for iterating through all records in flash.
- *
- * To search for the next record, call the function again and supply the same @ref fds_find_token_t
- * structure to resume searching from the last record that was found.
- *
- * Note that the order with which records are iterated is not defined.
- *
- * @param[out]  p_desc      The descriptor of the record that was found.
- * @param[out]  p_token     A token containing information about the progress of the operation.
- *
- * @retval  FDS_SUCCESS                 If a record was found.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_desc or @p p_token is NULL.
- * @retval  FDS_ERR_NOT_FOUND           If no matching record was found.
- */
-ret_code_t fds_record_iterate(fds_record_desc_t * const p_desc,
-                              fds_find_token_t  * const p_token);
-
-
-/**@brief   Function for searching for records with a given record key in a file.
- *
- * This function finds the first record in a file that has the given record key. To search for the
- * next record with the same key in the file, call the function again and supply the same
- * @ref fds_find_token_t structure to resume searching from the last record that was found.
- *
- * @param[in]   file_id     The file ID.
- * @param[in]   record_key  The record key.
- * @param[out]  p_desc      The descriptor of the record that was found.
- * @param[out]  p_token     A token containing information about the progress of the operation.
- *
- * @retval  FDS_SUCCESS                 If a record was found.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_desc or @p p_token is NULL.
- * @retval  FDS_ERR_NOT_FOUND           If no matching record was found.
- */
-ret_code_t fds_record_find(uint16_t                  file_id,
-                           uint16_t                  record_key,
-                           fds_record_desc_t * const p_desc,
-                           fds_find_token_t  * const p_token);
-
-
-/**@brief   Function for searching for records with a given record key.
- *
- * This function finds the first record with a given record key, independent of the file it
- * belongs to. To search for the next record with the same key, call the function again and supply
- * the same @ref fds_find_token_t structure to resume searching from the last record that was found.
- *
- * @param[in]   record_key  The record key.
- * @param[out]  p_desc      The descriptor of the record that was found.
- * @param[out]  p_token     A token containing information about the progress of the operation.
- *
- * @retval  FDS_SUCCESS                 If a record was found.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_desc or @p p_token is NULL.
- * @retval  FDS_ERR_NOT_FOUND           If no record with the given key was found.
- */
-ret_code_t fds_record_find_by_key(uint16_t                  record_key,
-                                  fds_record_desc_t * const p_desc,
-                                  fds_find_token_t  * const p_token);
-
-
-/**@brief   Function for searching for any record in a file.
- *
- * This function finds the first record in a file, independent of its record key.
- * To search for the next record in the same file, call the function again and supply the same
- * @ref fds_find_token_t structure to resume searching from the last record that was found.
- *
- * @param[in]   file_id     The file ID.
- * @param[out]  p_desc      The descriptor of the record that was found.
- * @param[out]  p_token     A token containing information about the progress of the operation.
- *
- * @retval  FDS_SUCCESS                 If a record was found.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_desc or @p p_token is NULL.
- * @retval  FDS_ERR_NOT_FOUND           If no matching record was found.
- */
-ret_code_t fds_record_find_in_file(uint16_t                  file_id,
-                                   fds_record_desc_t * const p_desc,
-                                   fds_find_token_t  * const p_token);
-
-
-/**@brief   Function for opening a record for reading.
- *
- * This function opens a record that is stored in flash, so that it can be read. The function
- * initializes an @ref fds_flash_record_t structure, which can be used to access the record data as
- * well as its associated metadata. The pointers provided in the @ref fds_flash_record_t structure
- * are pointers to flash memory.
- *
- * Opening a record with @ref fds_record_open prevents garbage collection to run on the virtual
- * flash page in which record is stored, so that the contents of the memory pointed by fields in
- * @ref fds_flash_record_t are guaranteed to remain unmodified as long as the record is kept open.
- *
- * When you are done reading a record, call @ref fds_record_close to close it. Garbage collection
- * can then reclaim space on the virtual page where the record is stored. Note that you must
- * provide the same descriptor for @ref fds_record_close as you did for this function.
- *
- * @param[in]   p_desc          The descriptor of the record to open.
- * @param[out]  p_flash_record  The record, as stored in flash.
- *
- * @retval  FDS_SUCCESS                 If the record was opened successfully.
- * @retval  FDS_ERR_NULL_ARG            If @p p_desc or @p p_flash_record is NULL.
- * @retval  FDS_ERR_NOT_FOUND           If the record was not found. It might have been deleted, or
- *                                      it might not have been written yet.
- * @retval  FDS_ERR_CRC_CHECK_FAILED    If the CRC check for the record failed.
- */
-ret_code_t fds_record_open(fds_record_desc_t  * const p_desc,
-                           fds_flash_record_t * const p_flash_record);
-
-
-/**@brief   Function for closing a record.
- *
- * Closing a record allows garbage collection to run on the virtual page in which the record is
- * stored (if no other records remain open on that page). The descriptor passed as an argument
- * must be the same as the one used to open the record using @ref fds_record_open.
- *
- * Note that closing a record does not invalidate its descriptor. You can still supply the
- * descriptor to all functions that accept a record descriptor as a parameter.
- *
- * @param[in]   p_desc  The descriptor of the record to close.
- *
- * @retval  FDS_SUCCESS             If the record was closed successfully.
- * @retval  FDS_ERR_NULL_ARG        If @p p_desc is NULL.
- * @retval  FDS_ERR_NO_OPEN_RECORDS If the record is not open.
- * @retval  FDS_ERR_NOT_FOUND       If the record could not be found.
- */
-ret_code_t fds_record_close(fds_record_desc_t * const p_desc);
-
-
-/**@brief   Function for running garbage collection.
- *
- * Garbage collection reclaims the flash space that is occupied by records that have been deleted,
- * or that failed to be completely written due to, for example, a power loss.
- *
- * This function is asynchronous. Completion is reported through an event that is sent to the
- * registered event handler function.
- *
- * @retval  FDS_SUCCESS                 If the operation was queued successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NO_SPACE_IN_QUEUES  If the operation queue is full.
- */
-ret_code_t fds_gc(void);
-
-
-/**@brief   Function for obtaining a descriptor from a record ID.
- *
- * This function can be used to reconstruct a descriptor from a record ID, like the one that is
- * passed to the callback function.
- *
- * @note
- * This function does not check whether a record with the given record ID exists.
- * If a non-existing record ID is supplied, the resulting descriptor is invalid and will cause
- * other functions to fail when it is supplied as parameter.
- *
- * @param[out]  p_desc      The descriptor of the record with the given record ID.
- * @param[in]   record_id   The record ID for which a descriptor should be returned.
- *
- * @retval  FDS_SUCCESS         If a descriptor was returned.
- * @retval  FDS_ERR_NULL_ARG    If @p p_desc is NULL.
- */
-ret_code_t fds_descriptor_from_rec_id(fds_record_desc_t * const p_desc,
-                                      uint32_t                  record_id);
-
-
-/**@brief   Function for obtaining a record ID from a record descriptor.
- *
- * This function can be used to extract a record ID from a descriptor. For example, you could use
- * it in the callback function to compare the record ID of an event to the record IDs of the
- * records for which you have a descriptor.
- *
- * @warning
- * This function does not check whether the record descriptor is valid. If the descriptor is not
- * initialized or has been tampered with, the resulting record ID might be invalid.
- *
- * @param[in]   p_desc          The descriptor from which the record ID should be extracted.
- * @param[out]  p_record_id     The record ID that is contained in the given descriptor.
- *
- * @retval  FDS_SUCCESS         If a record ID was returned.
- * @retval  FDS_ERR_NULL_ARG    If @p p_desc or @p p_record_id is NULL.
- */
-ret_code_t fds_record_id_from_desc(fds_record_desc_t const * const p_desc,
-                                   uint32_t                * const p_record_id);
-
-
-/**@brief   Function for retrieving file system statistics.
- *
- * This function retrieves file system statistics, such as the number of open records, the space
- * that can be reclaimed by garbage collection, and others.
- *
- * @param[out]  p_stat      File system statistics.
- *
- * @retval  FDS_SUCCESS                 If the statistics were returned successfully.
- * @retval  FDS_ERR_NOT_INITIALIZED     If the module is not initialized.
- * @retval  FDS_ERR_NULL_ARG            If @p p_stat is NULL.
- */
-ret_code_t fds_stat(fds_stat_t * const p_stat);
-
-
-#if defined(FDS_CRC_ENABLED)
-
-/**@brief   Function for enabling and disabling CRC verification for write operations.
- *
- * CRC verification ensures that data that is queued for writing does not change before the write
- * actually happens. Use this function to enable or disable CRC verification. If verification is
- * enabled, the error @ref FDS_ERR_CRC_CHECK_FAILED is returned in the event for
- * @ref fds_record_write, @ref fds_record_write_reserved, or @ref fds_record_update if
- * verification fails.
- *
- * @note
- * CRC verification is enabled or disabled globally, thus for all users of the FDS module.
- *
- * @param[in]   enabled     1 to enable CRC verification. 0 to disable CRC verification.
- *
- * @retval  FDS_SUCCESS     If CRC verification was enabled or disabled successfully.
- */
-ret_code_t fds_verify_crc_on_writes(bool enabled);
-
-#endif
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // FDS_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/fds/fds_internal_defs.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds_internal_defs.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds_internal_defs.h
deleted file mode 100644
index 7dd31ea..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/fds_internal_defs.h
+++ /dev/null
@@ -1,313 +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.
- *
- */
-
-#ifndef FDS_INTERNAL_DEFS_H__
-#define FDS_INTERNAL_DEFS_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "fds_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined (FDS_THREADS)
-    #include "nrf_soc.h"
-    #include "app_util_platform.h"
-#endif
-
-#define FDS_PAGE_TAG_SIZE       (2) // Page tag size, in 4-byte words.
-#define FDS_PAGE_TAG_WORD_0     (0) // Offset of the first word in the page tag from the page address.
-#define FDS_PAGE_TAG_WORD_1     (1) // Offset of the second word in the page tag from the page address.
-
-// Page tag constants
-#define FDS_PAGE_TAG_MAGIC      (0xDEADC0DE)
-#define FDS_PAGE_TAG_SWAP       (0xF11E01FF)
-#define FDS_PAGE_TAG_DATA       (0xF11E01FE)
-
-#define FDS_ERASED_WORD         (0xFFFFFFFF)
-
-#define FDS_OFFSET_TL           (0) // Offset of TL from the record base address, in 4-byte words.
-#define FDS_OFFSET_IC           (1) // Offset of IC from the record base address, in 4-byte words.
-#define FDS_OFFSET_ID           (2) // Offset of ID from the record base address, in 4-byte words.
-#define FDS_OFFSET_DATA         (3) // Offset of the data (chunks) from the record base address, in 4-byte words.
-
-#define FDS_HEADER_SIZE_TL      (1) // Size of the TL part of the header, in 4-byte words.
-#define FDS_HEADER_SIZE_IC      (1) // Size of the IC part of the header, in 4-byte words.
-#define FDS_HEADER_SIZE_ID      (1) // Size of the record ID in the header, in 4-byte words.
-#define FDS_HEADER_SIZE         (3) // Size of the whole header, in 4-byte words.
-
-#define FDS_OP_EXECUTING        (FS_SUCCESS)
-#define FDS_OP_COMPLETED        (0x1D1D)
-
-// The size of a physical page, in 4-byte words.
-#if   defined(NRF51)
-    #define FDS_PHY_PAGE_SIZE   (256)
-#elif defined(NRF52)
-    #define FDS_PHY_PAGE_SIZE   (1024)
-#endif
-
-// The number of physical pages to be used. This value is configured indirectly.
-#define FDS_PHY_PAGES               ((FDS_VIRTUAL_PAGES * FDS_VIRTUAL_PAGE_SIZE) / FDS_PHY_PAGE_SIZE)
-
-// The size of a virtual page, in number of physical pages.
-#define FDS_PHY_PAGES_IN_VPAGE      (FDS_VIRTUAL_PAGE_SIZE / FDS_PHY_PAGE_SIZE)
-
-// The number of pages available to store data; which is the total minus one (the swap).
-#define FDS_MAX_PAGES               (FDS_VIRTUAL_PAGES - 1)
-
- // Just a shorter name for the size, in words, of a virtual page.
-#define FDS_PAGE_SIZE               (FDS_VIRTUAL_PAGE_SIZE)
-
-
-#if (FDS_VIRTUAL_PAGE_SIZE % FDS_PHY_PAGE_SIZE != 0)
-    #error "FDS_VIRTUAL_PAGE_SIZE must be a multiple of the size of a physical page."
-#endif
-
-#if (FDS_VIRTUAL_PAGES < 2)
-    #error "FDS requires at least two virtual pages."
-#endif
-
-
-// FDS internal status flags.
-typedef enum
-{
-    FDS_FLAG_INITIALIZING   = (1 << 0),  // The module is initializing.
-    FDS_FLAG_INITIALIZED    = (1 << 1),  // The module is initialized.
-    FDS_FLAG_PROCESSING     = (1 << 2),  // The queue is being processed.
-    FDS_FLAG_VERIFY_CRC     = (1 << 3),  // Verify CRC upon writing a record.
-} fds_flags_t;
-
-
-// Page types.
-typedef enum
-{
-    FDS_PAGE_DATA,      // Page is ready for storage.
-    FDS_PAGE_SWAP,      // Page is reserved for garbage collection.
-    FDS_PAGE_ERASED,    // Page is erased.
-    FDS_PAGE_UNDEFINED, // Undefined page type.
-} fds_page_type_t;
-
-
-typedef struct
-{
-    fds_page_type_t         page_type;      // The page type.
-    uint32_t        const * p_addr;         // The address of the page.
-    uint16_t                write_offset;   // The page write offset, in 4-byte words.
-    uint16_t                words_reserved; // The amount of words reserved by fds_write_reserve().
-    uint16_t                records_open;   // The number of records opened using fds_open().
-    bool                    can_gc;         // Indicates that there are some records that have been deleted.
-} fds_page_t;
-
-
-typedef struct
-{
-    uint32_t const * p_addr;
-    uint16_t         write_offset;
-} fds_swap_page_t;
-
-
-// FDS op-codes.
-typedef enum
-{
-    FDS_OP_NONE,
-    FDS_OP_INIT,        // Initialize the module.
-    FDS_OP_WRITE,       // Write a record to flash.
-    FDS_OP_UPDATE,      // Update a record.
-    FDS_OP_DEL_RECORD,  // Delete a record.
-    FDS_OP_DEL_FILE,    // Delete a file.
-    FDS_OP_GC           // Run garbage collection.
-} fds_op_code_t;
-
-
-typedef enum
-{
-    FDS_OP_INIT_TAG_SWAP,
-    FDS_OP_INIT_TAG_DATA,
-    FDS_OP_INIT_ERASE_SWAP,
-    FDS_OP_INIT_PROMOTE_SWAP,
-} fds_init_step_t;
-
-
-typedef enum
-{
-    FDS_OP_WRITE_HEADER_BEGIN,      // Write the record key and length.
-    FDS_OP_WRITE_HEADER_FINALIZE,   // Write the file ID and CRC.
-    FDS_OP_WRITE_RECORD_ID,         // Write the record ID.
-    FDS_OP_WRITE_CHUNKS,            // Write the record data.
-    FDS_OP_WRITE_FIND_RECORD,
-    FDS_OP_WRITE_FLAG_DIRTY,        // Flag a record as dirty (as part of an update operation).
-    FDS_OP_WRITE_DONE,
-} fds_write_step_t;
-
-
-typedef enum
-{
-    FDS_OP_DEL_RECORD_FLAG_DIRTY,   // Flag a record as dirty.
-    FDS_OP_DEL_FILE_FLAG_DIRTY,     // Flag multiple records as dirty.
-    FDS_OP_DEL_DONE,
-} fds_delete_step_t;
-
-
-#if defined(__CC_ARM)
-    #pragma push
-    #pragma anon_unions
-#elif defined(__ICCARM__)
-    #pragma language=extended
-#elif defined(__GNUC__)
-    // anonymous unions are enabled by default
-#endif
-
-typedef struct
-{
-    fds_op_code_t op_code;                      // The opcode for the operation.
-    union
-    {
-        struct
-        {
-            fds_init_step_t step;               // The current step the operation is at.
-        } init;
-        struct
-        {
-            fds_header_t     header;
-            fds_write_step_t step;              // The current step the operation is at.
-            uint16_t         page;              // The page the flash space for this command was reserved.
-            uint16_t         chunk_offset;      // Offset used for writing record chunks, in 4-byte words.
-            uint8_t          chunk_count;       // Number of chunks to be written.
-            uint32_t         record_to_delete;  // The record to delete in case this is an update.
-        } write;
-        struct
-        {
-            fds_delete_step_t step;
-            uint16_t          file_id;
-            uint16_t          record_key;
-            uint32_t          record_to_delete;
-        } del;
-    };
-} fds_op_t;
-
-#if defined(__CC_ARM)
-    #pragma pop
-#elif defined(__ICCARM__)
-    // leave anonymous unions enabled
-#elif defined(__GNUC__)
-    // anonymous unions are enabled by default
-#endif
-
-
-typedef struct
-{
-    fds_op_t op[FDS_OP_QUEUE_SIZE];    // Queued flash operations.
-    uint32_t rp;                       // The index of the command being executed.
-    uint32_t count;                    // Number of elements in the queue.
-} fds_op_queue_t;
-
-
-typedef struct
-{
-    fds_record_chunk_t chunk[FDS_CHUNK_QUEUE_SIZE];
-    uint32_t           rp;
-    uint32_t           count;
-} fds_chunk_queue_t;
-
-
-enum
-{
-    PAGE_ERASED = 0x1,
-    PAGE_DATA   = 0x2,
-    SWAP_EMPTY  = 0x4,
-    SWAP_DIRTY  = 0x8,
-};
-
-
-typedef enum
-{
-    // This is a fatal error.
-    NO_PAGES,
-
-    // All pages are erased. Perform a fresh installation.
-    FRESH_INSTALL     = (PAGE_ERASED),
-
-    // Swap is missing. Tag an erased page as swap.
-    TAG_SWAP          = (PAGE_ERASED | PAGE_DATA),
-
-    // Swap is empty. Tag all erased pages as data.
-    TAG_DATA         = (PAGE_ERASED | SWAP_EMPTY),
-
-    // Swap is empty. Tag all remaining erased pages as data.
-    TAG_DATA_INST    = (PAGE_ERASED | PAGE_DATA | SWAP_EMPTY),
-
-    // The swap is dirty. This indicates that the device powered off during GC. However, since there
-    // is also an erased page, it is possible to assume that that page had been entirely garbage
-    // collected. Hence, tag the swap as data, one erased page as swap and any remaining pages as data.
-    PROMOTE_SWAP      = (PAGE_ERASED | SWAP_DIRTY),
-
-    // Similar to the above. Tag the swap as data, one erased page as swap, and any remain
-    // pages as data.
-    PROMOTE_SWAP_INST = (PAGE_ERASED | PAGE_DATA | SWAP_DIRTY),
-
-    // The swap is dirty (written) and there are no erased pages. This indicates that the device
-    // was powered off during GC. It is safe to discard (erase) the swap, since data that was
-    // swapped out lies in one of the valid pages.
-    DISCARD_SWAP      = (PAGE_DATA  | SWAP_DIRTY),
-
-    // Do nothing.
-    ALREADY_INSTALLED = (PAGE_DATA  | SWAP_EMPTY),
-
-} fds_init_opts_t;
-
-
-typedef enum
-{
-    GC_BEGIN,               // Begin GC.
-    GC_NEXT_PAGE,           // GC a page.
-    GC_FIND_NEXT_RECORD,    // Find a valid record to copy.
-    GC_COPY_RECORD,         // Copy a valid record to swap.
-    GC_ERASE_PAGE,          // Erase the page being garbage collected.
-    GC_DISCARD_SWAP,        // Erase (discard) the swap page.
-    GC_PROMOTE_SWAP,        // Tag the swap as valid.
-    GC_TAG_NEW_SWAP         // Tag a freshly erased (GCed) page as swap.
-} fds_gc_state_t;
-
-
-// Holds garbage collection status and related data.
-typedef struct
-{
-    fds_gc_state_t   state;                     // The current GC step.
-    uint16_t         cur_page;                  // The current page being garbage collected.
-    uint32_t const * p_record_src;              // The current record being copied to swap.
-    uint16_t         run_count;                 // Total number of times GC was run.
-    bool             do_gc_page[FDS_MAX_PAGES]; // Controls which pages to garbage collect.
-    bool             resume;                    // Whether or not GC should be resumed.
-} fds_gc_data_t;
-
-
-// Macros to enable and disable application interrupts.
-#if defined (FDS_THREADS)
-
-    #define CRITICAL_SECTION_ENTER()    CRITICAL_REGION_ENTER()
-    #define CRITICAL_SECTION_EXIT()     CRITICAL_REGION_EXIT()
-
-#else
-
-    #define CRITICAL_SECTION_ENTER()
-    #define CRITICAL_SECTION_EXIT()
-
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // FDS_INTERNAL_DEFS_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/fifo/app_fifo.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/app_fifo.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/app_fifo.c
deleted file mode 100644
index e0cfe9e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/app_fifo.c
+++ /dev/null
@@ -1,186 +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 "app_fifo.h"
-#include "sdk_common.h"
-#include "nordic_common.h"
-
-static __INLINE uint32_t fifo_length(app_fifo_t * p_fifo)
-{
-    uint32_t tmp = p_fifo->read_pos;
-    return p_fifo->write_pos - tmp;
-}
-
-
-#define FIFO_LENGTH fifo_length(p_fifo)  /**< Macro for calculating the FIFO length. */
-
-
-/**@brief Put one byte to the FIFO. */
-static __INLINE void fifo_put(app_fifo_t * p_fifo, uint8_t byte)
-{
-    p_fifo->p_buf[p_fifo->write_pos & p_fifo->buf_size_mask] = byte;
-    p_fifo->write_pos++;
-}
-
-
-/**@brief Look at one byte in the FIFO. */
-static __INLINE void fifo_peek(app_fifo_t * p_fifo, uint16_t index, uint8_t * p_byte)
-{
-    *p_byte = p_fifo->p_buf[(p_fifo->read_pos + index) & p_fifo->buf_size_mask];
-}
-
-
-/**@brief Get one byte from the FIFO. */
-static __INLINE void fifo_get(app_fifo_t * p_fifo, uint8_t * p_byte)
-{
-    fifo_peek(p_fifo, 0, p_byte);
-    p_fifo->read_pos++;
-}
-
-
-uint32_t app_fifo_init(app_fifo_t * p_fifo, uint8_t * p_buf, uint16_t buf_size)
-{
-    // Check buffer for null pointer.
-    if (p_buf == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    // Check that the buffer size is a power of two.
-    if (!IS_POWER_OF_TWO(buf_size))
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    p_fifo->p_buf         = p_buf;
-    p_fifo->buf_size_mask = buf_size - 1;
-    p_fifo->read_pos      = 0;
-    p_fifo->write_pos     = 0;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_fifo_put(app_fifo_t * p_fifo, uint8_t byte)
-{
-    if (FIFO_LENGTH <= p_fifo->buf_size_mask)
-    {
-        fifo_put(p_fifo, byte);
-        return NRF_SUCCESS;
-    }
-
-    return NRF_ERROR_NO_MEM;
-}
-
-
-uint32_t app_fifo_get(app_fifo_t * p_fifo, uint8_t * p_byte)
-{
-    if (FIFO_LENGTH != 0)
-    {
-        fifo_get(p_fifo, p_byte);
-        return NRF_SUCCESS;
-    }
-
-    return NRF_ERROR_NOT_FOUND;
-
-}
-
-
-uint32_t app_fifo_peek(app_fifo_t * p_fifo, uint16_t index, uint8_t * p_byte)
-{
-    if (FIFO_LENGTH > index)
-    {
-        fifo_peek(p_fifo, index, p_byte);
-        return NRF_SUCCESS;
-    }
-
-    return NRF_ERROR_NOT_FOUND;
-}
-
-
-uint32_t app_fifo_flush(app_fifo_t * p_fifo)
-{
-    p_fifo->read_pos = p_fifo->write_pos;
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_fifo_read(app_fifo_t * p_fifo, uint8_t * p_byte_array, uint32_t * p_size)
-{
-    VERIFY_PARAM_NOT_NULL(p_fifo);
-    VERIFY_PARAM_NOT_NULL(p_size);
-
-    const uint32_t byte_count    = fifo_length(p_fifo);
-    const uint32_t requested_len = (*p_size);
-    uint32_t       index         = 0;
-    uint32_t       read_size     = MIN(requested_len, byte_count);
-
-    (*p_size) = byte_count;
-
-    // Check if the FIFO is empty.
-    if (byte_count == 0)
-    {
-        return NRF_ERROR_NOT_FOUND;
-    }
-
-    // Check if application has requested only the size.
-    if (p_byte_array == NULL)
-    {
-        return NRF_SUCCESS;
-    }
-
-    // Fetch bytes from the FIFO.
-    while (index < read_size)
-    {
-        fifo_get(p_fifo, &p_byte_array[index++]);
-    }
-
-    (*p_size) = read_size;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_fifo_write(app_fifo_t * p_fifo, uint8_t const * p_byte_array, uint32_t * p_size)
-{
-    VERIFY_PARAM_NOT_NULL(p_fifo);
-    VERIFY_PARAM_NOT_NULL(p_size);
-
-    const uint32_t available_count = p_fifo->buf_size_mask - fifo_length(p_fifo) + 1;
-    const uint32_t requested_len   = (*p_size);
-    uint32_t       index           = 0;
-    uint32_t       write_size      = MIN(requested_len, available_count);
-
-    (*p_size) = available_count;
-
-    // Check if the FIFO is FULL.
-    if (available_count == 0)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-    // Check if application has requested only the size.
-    if (p_byte_array == NULL)
-    {
-        return NRF_SUCCESS;
-    }
-
-    //Fetch bytes from the FIFO.
-    while (index < write_size)
-    {
-        fifo_put(p_fifo, p_byte_array[index++]);
-    }
-
-    (*p_size) = write_size;
-
-    return NRF_SUCCESS;
-}

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/fifo/app_fifo.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/app_fifo.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/app_fifo.h
deleted file mode 100644
index 2011cab..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fifo/app_fifo.h
+++ /dev/null
@@ -1,153 +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 app_fifo FIFO implementation
- * @{
- * @ingroup app_common
- *
- * @brief FIFO implementation.
- */
-
-#ifndef APP_FIFO_H__
-#define APP_FIFO_H__
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief   A FIFO instance structure.
- * @details Keeps track of which bytes to read and write next.
- *          Also, it keeps the information about which memory is allocated for the buffer
- *          and its size. This structure must be initialized by app_fifo_init() before use.
- */
-typedef struct
-{
-    uint8_t *          p_buf;           /**< Pointer to FIFO buffer memory.                      */
-    uint16_t           buf_size_mask;   /**< Read/write index mask. Also used for size checking. */
-    volatile uint32_t  read_pos;        /**< Next read position in the FIFO buffer.              */
-    volatile uint32_t  write_pos;       /**< Next write position in the FIFO buffer.             */
-} app_fifo_t;
-
-/**@brief Function for initializing the FIFO.
- *
- * @param[out] p_fifo   FIFO object.
- * @param[in]  p_buf    FIFO buffer for storing data. The buffer size must be a power of two.
- * @param[in]  buf_size Size of the FIFO buffer provided. This size must be a power of two.
- *
- * @retval     NRF_SUCCESS              If initialization was successful.
- * @retval     NRF_ERROR_NULL           If a NULL pointer is provided as buffer.
- * @retval     NRF_ERROR_INVALID_LENGTH If size of buffer provided is not a power of two.
- */
-uint32_t app_fifo_init(app_fifo_t * p_fifo, uint8_t * p_buf, uint16_t buf_size);
-
-/**@brief Function for adding an element to the FIFO.
- *
- * @param[in]  p_fifo   Pointer to the FIFO.
- * @param[in]  byte     Data byte to add to the FIFO.
- *
- * @retval     NRF_SUCCESS              If an element has been successfully added to the FIFO.
- * @retval     NRF_ERROR_NO_MEM         If the FIFO is full.
- */
-uint32_t app_fifo_put(app_fifo_t * p_fifo, uint8_t byte);
-
-/**@brief Function for getting the next element from the FIFO.
- *
- * @param[in]  p_fifo   Pointer to the FIFO.
- * @param[out] p_byte   Byte fetched from the FIFO.
- *
- * @retval     NRF_SUCCESS              If an element was returned.
- * @retval     NRF_ERROR_NOT_FOUND      If there are no more elements in the queue.
- */
-uint32_t app_fifo_get(app_fifo_t * p_fifo, uint8_t * p_byte);
-
-/**@brief Function for looking at an element in the FIFO, without consuming it.
- *
- * @param[in]  p_fifo   Pointer to the FIFO.
- * @param[in]  index    Which element to look at. The lower the index, the earlier it was put.
- * @param[out] p_byte   Byte fetched from the FIFO.
- *
- * @retval     NRF_SUCCESS              If an element was returned.
- * @retval     NRF_ERROR_NOT_FOUND      If there are no more elements in the queue, or the index was
- *                                      too large.
- */
-uint32_t app_fifo_peek(app_fifo_t * p_fifo, uint16_t index, uint8_t * p_byte);
-
-/**@brief Function for flushing the FIFO.
- *
- * @param[in]  p_fifo   Pointer to the FIFO.
- *
- * @retval     NRF_SUCCESS              If the FIFO was flushed successfully.
- */
-uint32_t app_fifo_flush(app_fifo_t * p_fifo);
-
-/**@brief Function for reading bytes from the FIFO.
- *
- * This function can also be used to get the number of bytes in the FIFO.
- *
- * @param[in]    p_fifo        Pointer to the FIFO. Must not be NULL.
- * @param[out]   p_byte_array  Memory pointer where the read bytes are fetched from the FIFO.
- *                             Can be NULL. If NULL, the number of bytes that can be read in the FIFO
- *                             are returned in the p_size parameter.
- * @param[inout] p_size        Address to memory indicating the maximum number of bytes to be read.
- *                             The provided memory is overwritten with the actual number of bytes
- *                             read if the procedure was successful. This field must not be NULL.
- *                             If p_byte_array is set to NULL by the application, this parameter
- *                             returns the number of bytes in the FIFO.
- *
- * @retval     NRF_SUCCESS          If the procedure is successful. The actual number of bytes read might
- *                                  be less than the requested maximum, depending on how many elements exist
- *                                  in the FIFO. Even if less bytes are returned, the procedure is considered
- *                                  successful.
- * @retval     NRF_ERROR_NULL       If a NULL parameter was passed for a parameter that must not
- *                                  be NULL.
- * @retval     NRF_ERROR_NOT_FOUND  If the FIFO is empty.
- */
-uint32_t app_fifo_read(app_fifo_t * p_fifo, uint8_t * p_byte_array, uint32_t * p_size);
-
-/**@brief Function for writing bytes to the FIFO.
- *
- * This function can also be used to get the available size on the FIFO.
- *
- * @param[in]  p_fifo       Pointer to the FIFO. Must not be NULL.
- * @param[in]  p_byte_array Memory pointer containing the bytes to be written to the FIFO.
- *                          Can be NULL. If NULL, this function returns the number of bytes
- *                          that can be written to the FIFO.
- * @param[inout] p_size     Address to memory indicating the maximum number of bytes to be written.
- *                          The provided memory is overwritten with the number of bytes that were actually
- *                          written if the procedure is successful. This field must not be NULL.
- *                          If p_byte_array is set to NULL by the application, this parameter
- *                          returns the number of bytes available in the FIFO.
- *
- * @retval     NRF_SUCCESS       If the procedure is successful. The actual number of bytes written might
- *                               be less than the requested maximum, depending on how much room there is in
- *                               the FIFO. Even if less bytes are written, the procedure is considered
- *                               successful. If the write was partial, the application should use
- *                               subsequent calls to attempt writing the data again.
- * @retval     NRF_ERROR_NULL    If a NULL parameter was passed for a parameter that must not
- *                               be NULL.
- * @retval     NRF_ERROR_NO_MEM  If the FIFO is full.
- *
- */
-uint32_t app_fifo_write(app_fifo_t * p_fifo, uint8_t const * p_byte_array, uint32_t * p_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_FIFO_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/fstorage/config/fstorage_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/config/fstorage_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/config/fstorage_config.h
deleted file mode 100644
index c552142..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/config/fstorage_config.h
+++ /dev/null
@@ -1,67 +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.
- *
- */
-
-#ifndef FS_CONFIG_H__
-#define FS_CONFIG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup fstorage_config fstorage configuration
- * @ingroup fstorage
- * @{
- *
- * @brief fstorage configuration options.
- */
-
-
-/**@brief   Configures the size of fstorage internal queue.
- * @details Increase this if there are many users, or if it is likely that many operation will be
- *          queued at once without waiting for the previous operations to complete. In general,
- *          increase the queue size if you frequently receive @ref FS_ERR_QUEUE_FULL errors when
- *          calling @ref fs_store or @ref fs_erase.
- */
-#define FS_QUEUE_SIZE       (4)
-
-/**@brief   Configures how many times should fstorage attempt to execute an operation if
- *          the SoftDevice fails to schedule flash access due to high BLE activity.
- * @details Increase this value if fstorage events return the @ref FS_ERR_OPERATION_TIMEOUT error
- *          often.
- */
-#define FS_OP_MAX_RETRIES   (3)
-
-
-/**@brief   Configures the maximum number of words to be written to flash in a single operation.
- *          If data length exceeds this value, the data will be written down in several chunks,
- *          as necessary.
- *
- * @details Tweaking this value can increase the chances of the SoftDevice being able to fit
- *          flash operations in between radio activity. This value is bound by the maximum number
- *          of words which the SoftDevice can write to flash in a single call to
- *          @ref sd_flash_write, which is 256 words for nRF51 ICs and 1024 words for nRF52 ICs.
- */
-#if   defined (NRF51)
-    #define FS_MAX_WRITE_SIZE_WORDS     (256)
-#elif defined (NRF52)
-    #define FS_MAX_WRITE_SIZE_WORDS     (1024)
-#endif
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // FS_CONFIG_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/fstorage/fstorage.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage.c
deleted file mode 100644
index b414597..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage.c
+++ /dev/null
@@ -1,494 +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 "fstorage.h"
-#include "fstorage_config.h"
-#include "fstorage_internal_defs.h"
-
-#include <stdint.h>
-#include <string.h>
-#include <stdbool.h>
-#include "nrf_error.h"
-#include "nrf_soc.h"
-
-
-static uint8_t       m_flags;       // fstorage status flags.
-static fs_op_queue_t m_queue;       // Queue of requested operations.
-static uint8_t       m_retry_count; // Number of times the last flash operation was retried.
-
-
-// Sends events to the application.
-static void send_event(fs_op_t const * const p_op, fs_ret_t result)
-{
-    fs_evt_t evt;
-    memset(&evt, 0x00, sizeof(fs_evt_t));
-
-    switch (p_op->op_code)
-    {
-        case FS_OP_STORE:
-            evt.id                 = FS_EVT_STORE;
-            evt.store.p_data       = p_op->store.p_dest;
-            evt.store.length_words = p_op->store.length_words;
-            break;
-
-        case FS_OP_ERASE:
-            evt.id               = FS_EVT_ERASE;
-            evt.erase.first_page = p_op->erase.page - p_op->erase.pages_erased;
-            evt.erase.last_page  = p_op->erase.page;
-            break;
-
-        default:
-            // Should not happen.
-            break;
-    }
-
-    p_op->p_config->callback(&evt, result);
-}
-
-
-// Checks that a configuration is non-NULL and within section variable bounds.
-static bool check_config(fs_config_t const * const config)
-{
-    if ((config != NULL) &&
-        (FS_SECTION_VARS_START_ADDR <= (uint32_t)config) &&
-        (FS_SECTION_VARS_END_ADDR   >  (uint32_t)config))
-    {
-        return true;
-    }
-   
-    return false;
-}
-
-
-// Executes a store operation.
-static uint32_t store_execute(fs_op_t const * const p_op)
-{
-    uint16_t chunk_len;
-
-    if ((p_op->store.length_words - p_op->store.offset) < FS_MAX_WRITE_SIZE_WORDS)
-    {
-        chunk_len = p_op->store.length_words - p_op->store.offset;
-    }
-    else
-    {
-        chunk_len = FS_MAX_WRITE_SIZE_WORDS;
-    }
-
-    return sd_flash_write((uint32_t*)p_op->store.p_dest + p_op->store.offset,
-                          (uint32_t*)p_op->store.p_src  + p_op->store.offset,
-                          chunk_len);
-}
-
-
-// Executes an erase operation.
-static uint32_t erase_execute(fs_op_t const * const p_op)
-{
-    return sd_flash_page_erase(p_op->erase.page);
-}
-
-
-// Advances the queue, wrapping around if necessary.
-// If no elements are left in the queue, clears the FS_FLAG_PROCESSING flag.
-static void queue_advance(void)
-{
-    if (--m_queue.count == 0)
-    {
-        m_flags &= ~FS_FLAG_PROCESSING;
-    }
-
-    if (++m_queue.rp == FS_QUEUE_SIZE)
-    {
-        m_queue.rp = 0;
-    }
-}
-
-
-// Processes the current element in the queue. If the queue is empty, does nothing.
-static void queue_process(void)
-{
-    uint32_t         ret;
-    fs_op_t  * const p_op = &m_queue.op[m_queue.rp];
-
-    if (m_queue.count > 0)
-    {
-        switch (p_op->op_code)
-        {
-            case FS_OP_STORE:
-                ret = store_execute(p_op);
-                break;
-
-            case FS_OP_ERASE:
-                ret = erase_execute(p_op);
-                break;
-
-             default:
-                ret = FS_ERR_INTERNAL;
-                break;
-        }
-
-        // There is a pending flash operation which was not initiated by this module.
-        // Stop processing the queue and wait for a system event.
-        if (ret == NRF_ERROR_BUSY)
-        {
-            m_flags &= ~FS_FLAG_PROCESSING;
-            m_flags |= FS_FLAG_FLASH_REQ_PENDING;
-        }
-        else if (ret != NRF_SUCCESS)
-        {
-            // An error has occurred.
-            send_event(p_op, FS_ERR_INTERNAL);
-        }
-        else
-        {
-            // Operation is executing.
-        }
-    }
-}
-
-
-// Starts processing the queue if there are no pending flash operations, both inside and
-// outside this module. Returns immediately otherwise.
-static void queue_start(void)
-{
-    if (!(m_flags & FS_FLAG_PROCESSING) &&
-        !(m_flags & FS_FLAG_FLASH_REQ_PENDING))
-    {
-        m_flags |= FS_FLAG_PROCESSING;
-        queue_process();
-    }
-}
-
-
-// Flash operation success callback handler. Keeps track of the progress of an operation.
-// If it has finished, advances the queue and notifies the application.
-static void on_operation_success(fs_op_t * const p_op)
-{
-    m_retry_count = 0;
-
-    switch (p_op->op_code)
-    {
-        case FS_OP_STORE:
-        {
-            uint16_t chunk_len;
-
-            if ((p_op->store.length_words - p_op->store.offset) < FS_MAX_WRITE_SIZE_WORDS)
-            {
-                chunk_len = p_op->store.length_words - p_op->store.offset;
-            }
-            else
-            {
-                chunk_len = FS_MAX_WRITE_SIZE_WORDS;
-            }
-
-            p_op->store.offset += chunk_len;
-
-            if (p_op->store.offset == p_op->store.length_words)
-            {
-                // The operation has finished.
-                send_event(p_op, FS_SUCCESS);
-                queue_advance();
-            }
-        }
-        break;
-
-        case FS_OP_ERASE:
-        {
-            p_op->erase.page++;
-            p_op->erase.pages_erased++;
-
-            if (p_op->erase.pages_erased == p_op->erase.pages_to_erase)
-            {
-                send_event(p_op, FS_SUCCESS);
-                queue_advance();
-            }
-        }
-        break;
-
-        default:
-            // Should not happen.
-            break;
-    }
-}
-
-
-// Flash operation failure callback handler. If the maximum number of retries has
-// been reached, notifies the application and advances the queue.
-static void on_operation_failure(fs_op_t const * const p_op)
-{
-    if (++m_retry_count > FS_OP_MAX_RETRIES)
-    {
-        m_retry_count = 0;
-
-        send_event(p_op, FS_ERR_OPERATION_TIMEOUT);
-        queue_advance();
-    }
-}
-
-
-// Retrieves a pointer to the next free element in the queue.
-// Additionally, increases the number of elements stored in the queue.
-static bool queue_get_next_free(fs_op_t ** p_op)
-{
-    uint32_t idx;
-
-    if (m_queue.count == FS_QUEUE_SIZE)
-    {
-        return false;
-    }
-
-    idx = ((m_queue.rp + m_queue.count) < FS_QUEUE_SIZE) ?
-           (m_queue.rp + m_queue.count) : 0;
-
-    m_queue.count++;
-
-    // Zero the element so that unassigned fields will be zero.
-    memset(&m_queue.op[idx], 0x00, sizeof(fs_op_t));
-
-    *p_op = &m_queue.op[idx];
-
-    return true;
-}
-
-
-fs_ret_t fs_init(void)
-{
-    uint32_t const   users         = FS_SECTION_VARS_COUNT;
-    uint32_t const * p_current_end = FS_PAGE_END_ADDR;
-    uint32_t         index_max     = 0x00;
-    uint32_t         index_last    = 0xFFFFFFFF;
-
-    if (m_flags & FS_FLAG_INITIALIZED)
-    {
-        return FS_SUCCESS;
-    }
-
-    #if 0
-    // Check for configurations with duplicate priority.
-    for (uint32_t i = 0; i < users; i++)
-    {
-        for (uint32_t j = i + 1; j < users; j++)
-        {
-            fs_config_t const * const p_config_i = FS_SECTION_VARS_GET(i);
-            fs_config_t const * const p_config_j = FS_SECTION_VARS_GET(j);
-
-            if (p_config_i->page_order == p_config_j->page_order)
-            {
-                // Error.
-                return FS_ERR_INVALID_CFG;
-            }
-        }
-    }
-    #endif
-
-    // Assign pages to registered users, beginning with the ones with the highest
-    // priority, which will be assigned pages with the highest memory address.
-
-    for (uint32_t i = 0; i < users; i++)
-    {
-        uint8_t max_priority  = 0x00;
-
-        for (uint32_t j = 0; j < users; j++)
-        {
-            fs_config_t * const p_config = FS_SECTION_VARS_GET(j);
-
-            // Skip the one assigned during last iteration.
-            if (j == index_last)
-            {
-                continue;
-            }
-
-            if (p_config->priority >= max_priority)
-            {
-                max_priority = p_config->priority;
-                index_max    = j;
-            }
-        }
-
-        fs_config_t * const p_config = FS_SECTION_VARS_GET(index_max);
-
-        p_config->p_end_addr   = p_current_end;
-        p_config->p_start_addr = p_current_end - (p_config->num_pages * FS_PAGE_SIZE_WORDS);
-
-        p_current_end = p_config->p_start_addr;
-
-        index_last = index_max;
-    }
-
-    m_flags |= FS_FLAG_INITIALIZED;
-
-    return FS_SUCCESS;
-}
-
-
-fs_ret_t fs_store(fs_config_t const * const p_config,
-                  uint32_t    const * const p_dest,
-                  uint32_t    const * const p_src,
-                  uint16_t    const         length_words)
-{
-    fs_op_t * p_op;
-
-    if (!(m_flags & FS_FLAG_INITIALIZED))
-    {
-        return FS_ERR_NOT_INITIALIZED;
-    }
-
-    if (!check_config(p_config))
-    {
-        return FS_ERR_INVALID_CFG;
-    }
-
-    if ((p_src == NULL) || (p_dest == NULL))
-    {
-        return FS_ERR_NULL_ARG;
-    }
-
-    // Check that both pointers are word aligned.
-    if (((uint32_t)p_src  & 0x03) ||
-        ((uint32_t)p_dest & 0x03))
-    {
-        return FS_ERR_UNALIGNED_ADDR;
-    }
-
-    // Check that the operation doesn't go outside the client's memory boundaries.
-    if ((p_config->p_start_addr > p_dest) ||
-        (p_config->p_end_addr   < (p_dest + length_words)))
-    {
-        return FS_ERR_INVALID_ADDR;
-    }
-
-    if (length_words == 0)
-    {
-        return FS_ERR_INVALID_ARG;
-    }
-
-    if (!queue_get_next_free(&p_op))
-    {
-        return FS_ERR_QUEUE_FULL;
-    }
-
-    // Initialize the operation.
-    p_op->p_config           = p_config;
-    p_op->op_code            = FS_OP_STORE;
-    p_op->store.p_src        = p_src;
-    p_op->store.p_dest       = p_dest;
-    p_op->store.length_words = length_words;
-
-    queue_start();
-
-    return FS_SUCCESS;
-}
-
-
-fs_ret_t fs_erase(fs_config_t const * const p_config,
-                  uint32_t    const * const p_page_addr,
-                  uint16_t    const         num_pages)
-{
-    fs_op_t * p_op;
-
-    if (!(m_flags & FS_FLAG_INITIALIZED))
-    {
-        return FS_ERR_NOT_INITIALIZED;
-    }
-
-    if (!check_config(p_config))
-    {
-        return FS_ERR_INVALID_CFG;
-    }
-
-    if (p_page_addr == NULL)
-    {
-        return FS_ERR_NULL_ARG;
-    }
-
-    // Check that the page is aligned to a page boundary.
-    if (((uint32_t)p_page_addr % FS_PAGE_SIZE) != 0)
-    {
-        return FS_ERR_UNALIGNED_ADDR;
-    }
-
-    // Check that the operation doesn't go outside the client's memory boundaries.
-    if ((p_page_addr < p_config->p_start_addr) ||
-        (p_page_addr + (FS_PAGE_SIZE_WORDS * num_pages) > p_config->p_end_addr))
-    {
-        return FS_ERR_INVALID_ADDR;
-    }
-
-    if (num_pages == 0)
-    {
-        return FS_ERR_INVALID_ARG;
-    }
-
-    if (!queue_get_next_free(&p_op))
-    {
-        return FS_ERR_QUEUE_FULL;
-    }
-
-    // Initialize the operation.
-    p_op->p_config             = p_config;
-    p_op->op_code              = FS_OP_ERASE;
-    p_op->erase.page           = ((uint32_t)p_page_addr / FS_PAGE_SIZE);
-    p_op->erase.pages_to_erase = num_pages;
-
-    queue_start();
-
-    return FS_SUCCESS;
-}
-
-
-fs_ret_t fs_queued_op_count_get(uint32_t * const p_op_count)
-{
-    if (p_op_count == NULL)
-    {
-        return FS_ERR_NULL_ARG;
-    }
-
-    *p_op_count = m_queue.count;
-
-    return FS_SUCCESS;
-}
-
-
-void fs_sys_event_handler(uint32_t sys_evt)
-{
-    fs_op_t * const p_op = &m_queue.op[m_queue.rp];
-    
-    if (m_flags & FS_FLAG_PROCESSING)
-    {
-        // A flash operation was initiated by this module. Handle the result.
-        switch (sys_evt)
-        {
-            case NRF_EVT_FLASH_OPERATION_SUCCESS:
-                on_operation_success(p_op);
-                break;
-
-            case NRF_EVT_FLASH_OPERATION_ERROR:
-                on_operation_failure(p_op);
-                break;
-        }
-    }
-    else if ((m_flags & FS_FLAG_FLASH_REQ_PENDING))
-    {
-        // A flash operation was initiated outside this module.
-        // A callback which indicates that it has finished was received.
-        m_flags &= ~FS_FLAG_FLASH_REQ_PENDING;
-
-        // If there are any elements left in the queue, set FS_FLAG_PROCESSING.
-        if (m_queue.count > 0)
-        {
-           m_flags |= FS_FLAG_PROCESSING;
-        }
-    }
-
-    // Resume processing the queue, if necessary.
-    queue_process();
-}
-

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/fstorage/fstorage.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage.h
deleted file mode 100644
index a078cb8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage.h
+++ /dev/null
@@ -1,243 +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.
- *
- */
-
-#ifndef FSTORAGE_H__
-#define FSTORAGE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup fstorage fstorage
- * @ingroup app_common
- * @{
- *
- * @brief   Module which provides functionality to store data to flash and erase flash pages.
- */
-
-#include <stdint.h>
-#include "section_vars.h"
-
-
-/**@brief   fstorage return values. */
-typedef enum
-{
-    FS_SUCCESS,
-    FS_ERR_NOT_INITIALIZED,     //!< Error. The module is not initialized.
-    FS_ERR_INVALID_CFG,         //!< Error. Invalid fstorage configuration.
-    FS_ERR_NULL_ARG,            //!< Error. Argument is NULL.
-    FS_ERR_INVALID_ARG,         //!< Error. Argument contains invalid data.
-    FS_ERR_INVALID_ADDR,        //!< Error. Address out of bounds.
-    FS_ERR_UNALIGNED_ADDR,      //!< Error. Unaligned address.
-    FS_ERR_QUEUE_FULL,          //!< Error. Queue is full.
-    FS_ERR_OPERATION_TIMEOUT,   //!< Error. The operation has timed out.
-    FS_ERR_INTERNAL,            //!< Error. Internal error.
-} fs_ret_t;
-
-
-/**@brief   fstorage event IDs. */
-typedef enum
-{
-    FS_EVT_STORE,   //!< Event for @ref fs_store.
-    FS_EVT_ERASE    //!< Event for @ref fs_erase.
-} fs_evt_id_t;
-
-
-#if defined(__CC_ARM)
-  #pragma push
-  #pragma anon_unions
-#elif defined(__ICCARM__)
-  #pragma language=extended
-#elif defined(__GNUC__)
-  /* anonymous unions are enabled by default */
-#endif
-
-/**@brief   An fstorage event. */
-typedef struct
-{
-    fs_evt_id_t id;                         //!< The event ID.
-    union
-    {
-        struct
-        {
-            uint32_t const * p_data;        //!< Pointer to the data stored in flash.
-            uint16_t         length_words;  //!< Length of the data, in 4-byte words.
-        } store;
-        struct
-        {
-            uint16_t first_page;            //!< First page erased.
-            uint16_t last_page;             //!< Last page erased.
-        } erase;
-    };
-} fs_evt_t;
-
-#if defined(__CC_ARM)
-  #pragma pop
-#elif defined(__ICCARM__)
-  /* leave anonymous unions enabled */
-#elif defined(__GNUC__)
-  /* anonymous unions are enabled by default */
-#endif
-
-
-/**@brief   fstorage event handler function prototype.
- *
- * @param[in]   evt     The event.
- * @param[in]   result  The result of the operation.
- */
-typedef void (*fs_cb_t)(fs_evt_t const * const evt, fs_ret_t result);
-
-
-/**@brief   fstorage application-specific configuration.
- *
- * @details Specifies the callback to invoke when an operation completes, the number of flash pages
- *          requested by the application and the priority with which these are to be assigned, with
- *          respect to other applications. Additionally, the configuration specifies the boundaries
- *          of the flash space assigned to an application. The configuration must be provided as an
- *          argument when invoking @ref fs_store and @ref fs_erase.
- *
- * @note    The fields @p p_start_addr and @p p_end_address are set by @ref fs_init, based on the
- *          value of the field @p priority.
- */
-typedef struct
-{
-    /**@brief   The beginning of the flash space assigned to the application which registered this
-     *          configuration. This field is set by @ref fs_init.
-     */
-    uint32_t const * p_start_addr;
-
-    /**@brief   The end of the flash space assigned to the application which registered this
-     *          configuration. This field is set by @ref fs_init.
-     */
-    uint32_t const * p_end_addr;
-
-    fs_cb_t  const   callback;    //!< Callback to run when a flash operation has completed.
-    uint8_t  const   num_pages;   //!< The number of flash pages requested.
-
-    /**@brief   The priority with which fstorage should assign flash pages to this application,
-     *          with respect to other applications. Applications with higher priority will be
-     *          assigned flash pages with a higher memory address. The highest priority is
-     *          reserved. Must be unique among configurations.
-     */
-    uint8_t  const   priority;
-} fs_config_t;
-
-
-/**@brief   Macro for registering with an fstorage configuration.
- *          Applications which use fstorage must register with the module using this macro.
- *          Registering involves defining a variable which holds the configuration of fstorage
- *          specific to the application which invokes the macro.
- *
- * @details This macro places the configuration variable in a section named "fs_data" that
- *          fstorage uses during initialization and regular operation.
- *
- * @param[in]   cfg_var     A @e definition of a @ref fs_config_t variable.
- */
-#define FS_REGISTER_CFG(cfg_var) NRF_SECTION_VARS_ADD(fs_data, cfg_var)
-
-
-/**@brief   Function for initializing the module.
- *
- * @details This functions assigns pages in flash according to all registered configurations.
- *
- * @retval  FS_SUCCESS    If the module was successfully initialized.
- */
-fs_ret_t fs_init(void);
-
-
-/**@brief   Function for storing data in flash.
- *
- * @details Copies @p length_words words from @p p_src to the location pointed by @p p_dest.
- *          If the length of the data exceeds @ref FS_MAX_WRITE_SIZE_WORDS, the data will be
- *          written down in several chunks, as necessary. Only one event will be sent to the
- *          application upon completion. Both the source and the destination of the data must be
- *          word aligned. This function is asynchronous, completion is reported via an event sent
- *          the the callback function specified in the supplied configuration.
- *
- * @warning The data to be written to flash has to be kept in memory until the operation has
- *          terminated, i.e., an event is received.
- *
- * @param[in]   p_config        fstorage configuration registered by the application.
- * @param[in]   p_dest          The address in flash memory where to store the data.
- * @param[in]   p_src           Pointer to the data to store in flash.
- * @param[in]   length_words    Length of the data to store, in words.
- *
- * @retval  FS_SUCCESS              If the operation was queued successfully.
- * @retval  FS_ERR_NOT_INITIALIZED  If the module is not initialized.
- * @retval  FS_ERR_INVALID_CFG      If @p p_config is NULL or contains invalid data.
- * @retval  FS_ERR_NULL_ARG         If @p p_dest or @p p_src are NULL.
- * @retval  FS_ERR_INVALID_ARG      If @p length_words is zero.
- * @retval  FS_ERR_INVALID_ADDR     If @p p_dest or @p p_src are outside of the flash memory
- *                                  boundaries specified in @p p_config.
- * @retval  FS_ERR_UNALIGNED_ADDR   If @p p_dest or @p p_src are not aligned to a word boundary.
- * @retval  FS_ERR_QUEUE_FULL       If the internal operation queue is full.
- */
-fs_ret_t fs_store(fs_config_t const * const p_config,
-                  uint32_t    const * const p_dest,
-                  uint32_t    const * const p_src,
-                  uint16_t                  length_words);
-
-
-/**@brief   Function for erasing flash pages.
- *
- * @details Starting from the page at @p p_page_addr, erases @p num_pages flash pages.
- *          @p p_page_addr must be aligned to a page boundary. All pages to be erased must be
- *          within the bounds specified in the supplied fstorage configuration.
- *          This function is asynchronous. Completion is reported via an event.
- *
- * @param[in]   p_config        fstorage configuration registered by the application.
- * @param[in]   p_page_addr     Address of the page to erase. Must be aligned to a page boundary.
- * @param[in]   num_pages       Number of pages to erase. May not be zero.
- *
- * @retval  FS_SUCCESS              If the operation was queued successfully.
- * @retval  FS_ERR_NOT_INITIALIZED  If the module is not initialized.
- * @retval  FS_ERR_INVALID_CFG      If @p p_config is NULL or contains invalid data.
- * @retval  FS_ERR_NULL_ARG         If @p p_page_addr is NULL.
- * @retval  FS_ERR_INVALID_ARG      If @p num_pages is zero.
- * @retval  FS_ERR_INVALID_ADDR     If the operation would go beyond the flash memory boundaries
- *                                  specified in @p p_config.
- * @retval  FS_ERR_UNALIGNED_ADDR   If @p p_page_addr is not aligned to a page boundary.
- * @retval  FS_ERR_QUEUE_FULL       If the internal operation queue is full.
- */
-fs_ret_t fs_erase(fs_config_t const * const p_config,
-                  uint32_t    const * const p_page_addr,
-                  uint16_t                  num_pages);
-
-
-/**@brief Function for retrieving the number of queued flash operations.
- *
- * @param[out]  p_op_count    The number of queued flash operations.
- *
- * @retval  FS_SUCCESS          If the number of queued operations was retrieved successfully.
- * @retval  FS_ERR_NULL_ARG     If @p p_op_count is NULL.
- */
-fs_ret_t fs_queued_op_count_get(uint32_t * const p_op_count);
-
-
-/**@brief   Function for handling system events from the SoftDevice.
- *
- * @details If any of the modules used by the application rely on fstorage, the application should
- *          dispatch system events to fstorage using this function.
- *
- * @param[in]   sys_evt     System event from the SoftDevice.
- */
-void fs_sys_event_handler(uint32_t sys_evt);
-
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // FSTORAGE_H__


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

Posted by cc...@apache.org.
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/timer/app_timer_ble_gzll.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_ble_gzll.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_ble_gzll.c
deleted file mode 100644
index 08a2066..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_ble_gzll.c
+++ /dev/null
@@ -1,1119 +0,0 @@
-/* Copyright (c) 2012 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 "app_timer.h"
-#include <stdlib.h>
-#include "nrf.h"
-#include "nrf_soc.h"
-#include "nrf_delay.h"
-#include "app_util_platform.h"
-#include "sdk_common.h"
-
-#define RTC1_IRQ_PRI            APP_IRQ_PRIORITY_LOW                        /**< Priority of the RTC1 interrupt (used for checking for timeouts and executing timeout handlers). */
-#define SWI_IRQ_PRI             APP_IRQ_PRIORITY_LOW                        /**< Priority of the SWI  interrupt (used for updating the timer list). */
-
-// The current design assumes that both interrupt handlers run at the same interrupt level.
-// If this is to be changed, protection must be added to prevent them from interrupting each other
-// (e.g. by using guard/trigger flags).
-STATIC_ASSERT(RTC1_IRQ_PRI == SWI_IRQ_PRI);
-
-#define MAX_RTC_COUNTER_VAL     0x00FFFFFF                                  /**< Maximum value of the RTC counter. */
-
-#define APP_HIGH_USER_ID        0                                           /**< User Id for the Application High "user". */
-#define APP_LOW_USER_ID         1                                           /**< User Id for the Application Low "user". */
-#define THREAD_MODE_USER_ID     2                                           /**< User Id for the Thread Mode "user". */
-
-#define RTC_COMPARE_OFFSET_MIN  3                                           /**< Minimum offset between the current RTC counter value and the Capture Compare register. Although the nRF51 Series User Specification recommends this value to be 2, we use 3 to be safer.*/
-
-#define MAX_RTC_TASKS_DELAY     47                                          /**< Maximum delay until an RTC task is executed. */
-
-#ifdef NRF51
-#define SWI_IRQn SWI1_IRQn
-#define SWI_IRQHandler SWI1_IRQHandler
-#elif defined NRF52
-#define SWI_IRQn SWI1_EGU1_IRQn
-#define SWI_IRQHandler SWI1_EGU1_IRQHandler
-#endif
-
-/**@brief Timer node type. The nodes will be used form a linked list of running timers. */
-typedef struct
-{
-    uint32_t                    ticks_to_expire;                            /**< Number of ticks from previous timer interrupt to timer expiry. */
-    uint32_t                    ticks_at_start;                             /**< Current RTC counter value when the timer was started. */
-    uint32_t                    ticks_first_interval;                       /**< Number of ticks in the first timer interval. */
-    uint32_t                    ticks_periodic_interval;                    /**< Timer period (for repeating timers). */
-    bool                        is_running;                                 /**< True if timer is running, False otherwise. */
-    app_timer_mode_t            mode;                                       /**< Timer mode. */
-    app_timer_timeout_handler_t p_timeout_handler;                          /**< Pointer to function to be executed when the timer expires. */
-    void *                      p_context;                                  /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */
-    void *                      next;                                       /**< Pointer to the next node. */
-} timer_node_t;
-
-STATIC_ASSERT(sizeof(timer_node_t) == APP_TIMER_NODE_SIZE);
-
-/**@brief Set of available timer operation types. */
-typedef enum
-{
-    TIMER_USER_OP_TYPE_NONE,                                                /**< Invalid timer operation type. */
-    TIMER_USER_OP_TYPE_START,                                               /**< Timer operation type Start. */
-    TIMER_USER_OP_TYPE_STOP,                                                /**< Timer operation type Stop. */
-    TIMER_USER_OP_TYPE_STOP_ALL                                             /**< Timer operation type Stop All. */
-} timer_user_op_type_t;
-
-/**@brief Structure describing a timer start operation. */
-typedef struct
-{
-    uint32_t ticks_at_start;                                                /**< Current RTC counter value when the timer was started. */
-    uint32_t ticks_first_interval;                                          /**< Number of ticks in the first timer interval. */
-    uint32_t ticks_periodic_interval;                                       /**< Timer period (for repeating timers). */
-    void *   p_context;                                                     /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */
-} timer_user_op_start_t;
-
-/**@brief Structure describing a timer operation. */
-typedef struct
-{
-    timer_user_op_type_t op_type;                                             /**< Id of timer on which the operation is to be performed. */
-    timer_node_t *       p_node;
-    union
-    {
-        timer_user_op_start_t start;                                        /**< Structure describing a timer start operation. */
-    } params;
-} timer_user_op_t;
-
-STATIC_ASSERT(sizeof(timer_user_op_t) <= APP_TIMER_USER_OP_SIZE);
-STATIC_ASSERT(sizeof(timer_user_op_t) % 4 == 0);
-
-/**@brief Structure describing a timer user.
- *
- * @details For each user of the timer module, there will be a timer operations queue. This queue
- *          will hold timer operations issued by this user until the timer interrupt handler
- *          processes these operations. For the current implementation, there will be one user for
- *          each interrupt level available to the application (APP_HIGH, APP_LOW and THREAD_MODE),
- *          but the module can easily be modified to e.g. have one queue per process when using an
- *          RTOS. The purpose of the queues is to be able to have a completely lockless timer
- *          implementation.
- */
-typedef struct
-{
-    uint8_t           first;                                                    /**< Index of first entry to have been inserted in the queue (i.e. the next entry to be executed). */
-    uint8_t           last;                                                     /**< Index of last entry to have been inserted in the queue. */
-    uint8_t           user_op_queue_size;                                       /**< Queue size. */
-    timer_user_op_t * p_user_op_queue;                                          /**< Queue buffer. */
-} timer_user_t;
-
-STATIC_ASSERT(sizeof(timer_user_t) == APP_TIMER_USER_SIZE);
-STATIC_ASSERT(sizeof(timer_user_t) % 4 == 0);
-
-/**@brief User id type.
- *
- * @details In the current implementation, this will automatically be generated from the current
- *          interrupt level.
- */
-typedef uint32_t timer_user_id_t;
-
-#define CONTEXT_QUEUE_SIZE_MAX      (2)                 
-
-static uint8_t                       m_user_array_size;                         /**< Size of timer user array. */
-static timer_user_t *                mp_users = NULL;                           /**< Array of timer users. */
-static timer_node_t *                mp_timer_id_head;                          /**< First timer in list of running timers. */
-static uint32_t                      m_ticks_latest;                            /**< Last known RTC counter value. */
-static uint32_t                      m_ticks_elapsed[CONTEXT_QUEUE_SIZE_MAX];   /**< Timer internal elapsed ticks queue. */
-static uint8_t                       m_ticks_elapsed_q_read_ind;                /**< Timer internal elapsed ticks queue read index. */
-static uint8_t                       m_ticks_elapsed_q_write_ind;               /**< Timer internal elapsed ticks queue write index. */
-static app_timer_evt_schedule_func_t m_evt_schedule_func;                       /**< Pointer to function for propagating timeout events to the scheduler. */
-static bool                          m_rtc1_running;                            /**< Boolean indicating if RTC1 is running. */
-static bool                          m_rtc1_reset;                              /**< Boolean indicating if RTC1 counter has been reset due to last timer removed from timer list during the timer list handling. */
- 
-
-#define MODULE_INITIALIZED (mp_users != NULL)
-#include "sdk_macros.h"
-
-
-/**@brief Function for initializing the RTC1 counter.
- *
- * @param[in] prescaler   Value of the RTC1 PRESCALER register. Set to 0 for no prescaling.
- */
-static void rtc1_init(uint32_t prescaler)
-{
-    NRF_RTC1->PRESCALER = prescaler;
-    NVIC_SetPriority(RTC1_IRQn, RTC1_IRQ_PRI);
-}
-
-
-/**@brief Function for starting the RTC1 timer.
- */
-static void rtc1_start(void)
-{
-    NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE0_Msk;
-    NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk;
-
-    NVIC_ClearPendingIRQ(RTC1_IRQn);
-    NVIC_EnableIRQ(RTC1_IRQn);
-
-    NRF_RTC1->TASKS_START = 1;
-    nrf_delay_us(MAX_RTC_TASKS_DELAY);
-
-    m_rtc1_running = true;
-}
-
-
-/**@brief Function for stopping the RTC1 timer.
- */
-static void rtc1_stop(void)
-{
-    NVIC_DisableIRQ(RTC1_IRQn);
-
-    NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE0_Msk;
-    NRF_RTC1->INTENCLR = RTC_INTENSET_COMPARE0_Msk;
-
-    NRF_RTC1->TASKS_STOP = 1;
-    nrf_delay_us(MAX_RTC_TASKS_DELAY);
-
-    NRF_RTC1->TASKS_CLEAR = 1;
-    m_ticks_latest        = 0;
-    nrf_delay_us(MAX_RTC_TASKS_DELAY);
-
-    m_rtc1_running = false;
-}
-
-
-/**@brief Function for returning the current value of the RTC1 counter.
- *
- * @return     Current value of the RTC1 counter.
- */
-static __INLINE uint32_t rtc1_counter_get(void)
-{
-    return NRF_RTC1->COUNTER;
-}
-
-
-/**@brief Function for computing the difference between two RTC1 counter values.
- *
- * @return     Number of ticks elapsed from ticks_old to ticks_now.
- */
-static __INLINE uint32_t ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old)
-{
-    return ((ticks_now - ticks_old) & MAX_RTC_COUNTER_VAL);
-}
-
-
-/**@brief Function for setting the RTC1 Capture Compare register 0, and enabling the corresponding
- *        event.
- *
- * @param[in] value   New value of Capture Compare register 0.
- */
-static __INLINE void rtc1_compare0_set(uint32_t value)
-{
-    NRF_RTC1->CC[0] = value;
-}
-
-
-/**@brief Function for inserting a timer in the timer list.
- *
- * @param[in]  timer_id   Id of timer to insert.
- */
-static void timer_list_insert(timer_node_t * p_timer)
-{
-    if (mp_timer_id_head == NULL)
-    {
-        mp_timer_id_head = p_timer;
-    }
-    else
-    {
-        if (p_timer->ticks_to_expire <= mp_timer_id_head->ticks_to_expire)
-        {
-            mp_timer_id_head->ticks_to_expire -= p_timer->ticks_to_expire;
-            
-            p_timer->next   = mp_timer_id_head;
-            mp_timer_id_head = p_timer;
-        }
-        else
-        {
-            timer_node_t * p_previous;
-            timer_node_t * p_current;
-            uint32_t       ticks_to_expire;
-
-            ticks_to_expire   = p_timer->ticks_to_expire;
-            p_previous        = mp_timer_id_head;
-            p_current         = mp_timer_id_head;
-            
-            while ((p_current != NULL) && (ticks_to_expire > p_current->ticks_to_expire))
-            {
-                ticks_to_expire   -= p_current->ticks_to_expire;
-                p_previous         = p_current;
-                p_current          = p_current->next;
-            }
-
-            if (p_current != NULL)
-            {
-                p_current->ticks_to_expire -= ticks_to_expire;
-            }
-
-            p_timer->ticks_to_expire = ticks_to_expire;
-            p_timer->next            = p_current;
-            p_previous->next         = p_timer;
-        }
-    }
-}
-
-
-/**@brief Function for removing a timer from the timer queue.
- *
- * @param[in]  timer_id   Id of timer to remove.
- */
-static void timer_list_remove(timer_node_t * p_timer)
-{
-    timer_node_t * p_previous;
-    timer_node_t * p_current;
-    uint32_t       timeout;
-
-    // Find the timer's position in timer list.
-    p_previous = mp_timer_id_head;
-    p_current  = p_previous;
-    
-    while (p_current != NULL)
-    {
-        if (p_current == p_timer)
-        {
-            break;
-        }
-        p_previous = p_current;
-        p_current  = p_current->next;
-    }
-
-    // Timer not in active list.
-    if (p_current == NULL)
-    {
-        return;
-    }
-
-    // Timer is the first in the list
-    if (p_previous == p_current)
-    {
-        mp_timer_id_head = mp_timer_id_head->next;
-
-        // No more timers in the list. Reset RTC1 in case Start timer operations are present in the queue.
-        if (mp_timer_id_head == NULL)
-        {
-            NRF_RTC1->TASKS_CLEAR = 1;
-            m_ticks_latest        = 0;
-            m_rtc1_reset          = true;
-        }
-    }
-
-    // Remaining timeout between next timeout.
-    timeout = p_current->ticks_to_expire;
-
-    // Link previous timer with next of this timer, i.e. removing the timer from list.
-    p_previous->next = p_current->next;
-
-    // If this is not the last timer, increment the next timer by this timer timeout.
-    p_current = p_previous->next;
-    if (p_current != NULL)
-    {
-        p_current->ticks_to_expire += timeout;
-    }
-}
-
-
-/**@brief Function for scheduling a check for timeouts by generating a RTC1 interrupt.
- */
-static void timer_timeouts_check_sched(void)
-{
-    NVIC_SetPendingIRQ(RTC1_IRQn);
-}
-
-
-/**@brief Function for scheduling a timer list update by generating a SWI interrupt.
- */
-static void timer_list_handler_sched(void)
-{
-    NVIC_SetPendingIRQ(SWI_IRQn);
-}
-
-
-/**@brief Function for executing an application timeout handler, either by calling it directly, or
- *        by passing an event to the @ref app_scheduler.
- *
- * @param[in]  p_timer   Pointer to expired timer.
- */
-static void timeout_handler_exec(timer_node_t * p_timer)
-{
-    if (m_evt_schedule_func != NULL)
-    {
-        uint32_t err_code = m_evt_schedule_func(p_timer->p_timeout_handler, p_timer->p_context);
-        APP_ERROR_CHECK(err_code);
-    }
-    else
-    {
-        p_timer->p_timeout_handler(p_timer->p_context);
-    }
-}
-
-
-/**@brief Function for checking for expired timers.
- */
-static void timer_timeouts_check(void)
-{
-    // Handle expired of timer 
-    if (mp_timer_id_head != NULL)
-    {
-        timer_node_t *  p_timer;
-        timer_node_t *  p_previous_timer;
-        uint32_t        ticks_elapsed;
-        uint32_t        ticks_expired;
-
-        // Initialize actual elapsed ticks being consumed to 0.
-        ticks_expired = 0;
-
-        // ticks_elapsed is collected here, job will use it.
-        ticks_elapsed = ticks_diff_get(rtc1_counter_get(), m_ticks_latest);
-
-        // Auto variable containing the head of timers expiring.
-        p_timer = mp_timer_id_head;
-
-        // Expire all timers within ticks_elapsed and collect ticks_expired.
-        while (p_timer != NULL)
-        {
-            // Do nothing if timer did not expire.
-            if (ticks_elapsed < p_timer->ticks_to_expire)
-            {
-                break;
-            }
-
-            // Decrement ticks_elapsed and collect expired ticks.
-            ticks_elapsed -= p_timer->ticks_to_expire;
-            ticks_expired += p_timer->ticks_to_expire;
-
-            // Move to next timer.
-            p_previous_timer = p_timer;
-            p_timer = p_timer->next;
-
-            // Execute Task.
-            timeout_handler_exec(p_previous_timer);
-        }
-
-        // Prepare to queue the ticks expired in the m_ticks_elapsed queue.
-        if (m_ticks_elapsed_q_read_ind == m_ticks_elapsed_q_write_ind)
-        {
-            // The read index of the queue is equal to the write index. This means the new
-            // value of ticks_expired should be stored at a new location in the m_ticks_elapsed
-            // queue (which is implemented as a double buffer).
-
-            // Check if there will be a queue overflow.
-            if (++m_ticks_elapsed_q_write_ind == CONTEXT_QUEUE_SIZE_MAX)
-            {
-                // There will be a queue overflow. Hence the write index should point to the start
-                // of the queue.
-                m_ticks_elapsed_q_write_ind = 0;
-            }
-        }
-
-        // Queue the ticks expired.
-        m_ticks_elapsed[m_ticks_elapsed_q_write_ind] = ticks_expired;
-
-        timer_list_handler_sched();
-    }
-}
-
-
-/**@brief Function for acquiring the number of ticks elapsed.
- *
- * @param[out] p_ticks_elapsed   Number of ticks elapsed.
- *
- * @return     TRUE if elapsed ticks was read from queue, FALSE otherwise.
- */
-static bool elapsed_ticks_acquire(uint32_t * p_ticks_elapsed)
-{
-    // Pick the elapsed value from queue.
-    if (m_ticks_elapsed_q_read_ind != m_ticks_elapsed_q_write_ind)
-    {
-        // Dequeue elapsed value.
-        m_ticks_elapsed_q_read_ind++;
-        if (m_ticks_elapsed_q_read_ind == CONTEXT_QUEUE_SIZE_MAX)
-        {
-            m_ticks_elapsed_q_read_ind = 0;
-        }
-
-        *p_ticks_elapsed = m_ticks_elapsed[m_ticks_elapsed_q_read_ind];
-
-        m_ticks_latest += *p_ticks_elapsed;
-        m_ticks_latest &= MAX_RTC_COUNTER_VAL;
-
-        return true;
-    }
-    else
-    {
-        // No elapsed value in queue.
-        *p_ticks_elapsed = 0;
-        return false;
-    }
-}
-
-
-/**@brief Function for handling the timer list deletions.
- *
- * @return     TRUE if Capture Compare register must be updated, FALSE otherwise.
- */
-static bool list_deletions_handler(void)
-{
-    timer_node_t * p_timer_old_head;
-    uint8_t        user_id;
-
-    // Remember the old head, so as to decide if new compare needs to be set.
-    p_timer_old_head = mp_timer_id_head;
-
-    user_id = m_user_array_size;
-    while (user_id--)
-    {
-        timer_user_t * p_user         = &mp_users[user_id];
-        uint8_t        user_ops_first = p_user->first;
-        
-        while (user_ops_first != p_user->last)
-        {
-            timer_node_t *    p_timer;
-            timer_user_op_t * p_user_op = &p_user->p_user_op_queue[user_ops_first];
-
-            // Traverse to next operation in queue.
-            user_ops_first++;
-            if (user_ops_first == p_user->user_op_queue_size)
-            {
-                user_ops_first = 0;
-            }
-
-            switch (p_user_op->op_type)
-            {
-                case TIMER_USER_OP_TYPE_STOP:
-                    // Delete node if timer is running.
-                    p_timer = p_user_op->p_node;
-                    if (p_timer->is_running)
-                    {
-                        timer_list_remove(p_user_op->p_node);
-                        p_timer->is_running = false;
-                    }
-                    break;
-                    
-                case TIMER_USER_OP_TYPE_STOP_ALL:
-                    // Delete list of running timers, and mark all timers as not running.
-                    while (mp_timer_id_head != NULL)
-                    {
-                        timer_node_t * p_head = mp_timer_id_head;
-
-                        p_head->is_running = false;
-                        mp_timer_id_head    = p_head->next;
-                    }
-                    break;
-                    
-                default:
-                    // No implementation needed.
-                    break;
-            }
-        }
-    }
-
-    // Detect change in head of the list.
-    return (mp_timer_id_head != p_timer_old_head);
-}
-
-
-/**@brief Function for updating the timer list for expired timers.
- *
- * @param[in]  ticks_elapsed         Number of elapsed ticks.
- * @param[in]  ticks_previous        Previous known value of the RTC counter.
- * @param[out] p_restart_list_head   List of repeating timers to be restarted.
- */
-static void expired_timers_handler(uint32_t         ticks_elapsed,
-                                   uint32_t         ticks_previous,
-                                   timer_node_t **  p_restart_list_head)
-{
-    uint32_t ticks_expired = 0;
-
-    while (mp_timer_id_head != NULL)
-    {
-        timer_node_t * p_timer;
-        timer_node_t * p_timer_expired;
-
-        // Auto variable for current timer node.
-        p_timer = mp_timer_id_head;
-
-        // Do nothing if timer did not expire 
-        if (ticks_elapsed < p_timer->ticks_to_expire)
-        {
-            p_timer->ticks_to_expire -= ticks_elapsed;
-            break;
-        }
-
-        // Decrement ticks_elapsed and collect expired ticks.
-        ticks_elapsed -= p_timer->ticks_to_expire;
-        ticks_expired += p_timer->ticks_to_expire;
-
-        // Timer expired, set ticks_to_expire zero.
-        p_timer->ticks_to_expire = 0;
-        p_timer->is_running      = false;
-
-        // Remove the expired timer from head.
-        p_timer_expired  = mp_timer_id_head;
-        mp_timer_id_head = p_timer->next;
-
-        // Timer will be restarted if periodic.
-        if (p_timer->ticks_periodic_interval != 0)
-        {
-            p_timer->ticks_at_start       = (ticks_previous + ticks_expired) & MAX_RTC_COUNTER_VAL;
-            p_timer->ticks_first_interval = p_timer->ticks_periodic_interval;
-            p_timer->next                 = *p_restart_list_head;
-            *p_restart_list_head          = p_timer_expired;
-        }
-    }
-}
-
-
-/**@brief Function for handling timer list insertions.
- *
- * @param[in]  p_restart_list_head   List of repeating timers to be restarted.
- *
- * @return     TRUE if Capture Compare register must be updated, FALSE otherwise.
- */
-static bool list_insertions_handler(timer_node_t * p_restart_list_head)
-{
-    timer_node_t * p_timer_id_old_head;
-    uint8_t        user_id;
-
-    // Remember the old head, so as to decide if new compare needs to be set.
-    p_timer_id_old_head = mp_timer_id_head;
-
-    user_id = m_user_array_size;
-    while (user_id--)
-    {
-        timer_user_t * p_user = &mp_users[user_id];
-
-        // Handle insertions of timers.
-        while ((p_restart_list_head != NULL) || (p_user->first != p_user->last))
-        {
-            timer_node_t * p_timer;
-
-            if (p_restart_list_head != NULL)
-            {
-                p_timer           = p_restart_list_head;
-                p_restart_list_head = p_timer->next;
-            }
-            else
-            {
-                timer_user_op_t * p_user_op = &p_user->p_user_op_queue[p_user->first];
-
-                p_user->first++;
-                if (p_user->first == p_user->user_op_queue_size)
-                {
-                    p_user->first = 0;
-                }
-
-                p_timer = p_user_op->p_node;
-
-                if ((p_user_op->op_type != TIMER_USER_OP_TYPE_START) || p_timer->is_running)
-                {
-                    continue;
-                }
-
-                p_timer->ticks_at_start          = p_user_op->params.start.ticks_at_start;
-                p_timer->ticks_first_interval    = p_user_op->params.start.ticks_first_interval;
-                p_timer->ticks_periodic_interval = p_user_op->params.start.ticks_periodic_interval;
-                p_timer->p_context               = p_user_op->params.start.p_context;
-
-                if (m_rtc1_reset)
-                {
-                    p_timer->ticks_at_start = 0;
-                }
-            }
-
-            // Prepare the node to be inserted.
-            if (
-                 ((p_timer->ticks_at_start - m_ticks_latest) & MAX_RTC_COUNTER_VAL)
-                 <
-                 (MAX_RTC_COUNTER_VAL / 2)
-                )
-            {
-                p_timer->ticks_to_expire = ticks_diff_get(p_timer->ticks_at_start, m_ticks_latest) + 
-                                           p_timer->ticks_first_interval;
-            }
-            else
-            {
-                uint32_t delta_current_start;
-
-                delta_current_start = ticks_diff_get(m_ticks_latest, p_timer->ticks_at_start);
-                if (p_timer->ticks_first_interval > delta_current_start)
-                {
-                    p_timer->ticks_to_expire = p_timer->ticks_first_interval - delta_current_start;
-                }
-                else
-                {
-                    p_timer->ticks_to_expire = 0;
-                }
-            }
-
-            p_timer->ticks_at_start       = 0;
-            p_timer->ticks_first_interval = 0;
-            p_timer->is_running           = true;
-            p_timer->next                 = NULL;
-
-            // Insert into list 
-            timer_list_insert(p_timer);
-        }
-    }
-    
-    return (mp_timer_id_head != p_timer_id_old_head);
-}
-
-
-/**@brief Function for updating the Capture Compare register.
- */
-static void compare_reg_update(timer_node_t * p_timer_id_head_old)
-{
-    // Setup the timeout for timers on the head of the list 
-    if (mp_timer_id_head != NULL)
-    {
-        uint32_t ticks_to_expire = mp_timer_id_head->ticks_to_expire;
-        uint32_t pre_counter_val = rtc1_counter_get();
-        uint32_t cc              = m_ticks_latest;
-        uint32_t ticks_elapsed   = ticks_diff_get(pre_counter_val, cc) + RTC_COMPARE_OFFSET_MIN;
-
-        if (!m_rtc1_running)
-        {
-            // No timers were already running, start RTC
-            rtc1_start();
-        }
-
-        cc += (ticks_elapsed < ticks_to_expire) ? ticks_to_expire : ticks_elapsed;
-        cc &= MAX_RTC_COUNTER_VAL;
-        
-        rtc1_compare0_set(cc);
-
-        uint32_t post_counter_val = rtc1_counter_get();
-
-        if (
-            (ticks_diff_get(post_counter_val, pre_counter_val) + RTC_COMPARE_OFFSET_MIN)
-            >
-            ticks_diff_get(cc, pre_counter_val)
-           )
-        {
-            // When this happens the COMPARE event may not be triggered by the RTC.
-            // The nRF51 Series User Specification states that if the COUNTER value is N
-            // (i.e post_counter_val = N), writing N or N+1 to a CC register may not trigger a
-            // COMPARE event. Hence the RTC interrupt is forcefully pended by calling the following
-            // function.
-            timer_timeouts_check_sched();
-        }
-    }
-    else
-    {
-        // No timers are running, stop RTC
-        rtc1_stop();
-    }
-}
-
-
-/**@brief Function for handling changes to the timer list.
- */
-static void timer_list_handler(void)
-{
-    timer_node_t * p_restart_list_head = NULL;
-
-    uint32_t       ticks_elapsed;
-    uint32_t       ticks_previous;
-    bool           ticks_have_elapsed;
-    bool           compare_update;
-    timer_node_t * p_timer_id_head_old;
-    
-    // Back up the previous known tick and previous list head
-    ticks_previous    = m_ticks_latest;
-    p_timer_id_head_old = mp_timer_id_head;
-    
-    // Get number of elapsed ticks
-    ticks_have_elapsed = elapsed_ticks_acquire(&ticks_elapsed);
-
-    // Handle list deletions
-    compare_update = list_deletions_handler();
-    
-    // Handle expired timers
-    if (ticks_have_elapsed)
-    {
-        expired_timers_handler(ticks_elapsed, ticks_previous, &p_restart_list_head);
-        compare_update = true;
-    }
-    
-    // Handle list insertions
-    if (list_insertions_handler(p_restart_list_head))
-    {
-        compare_update = true;
-    }
-
-    // Update compare register if necessary
-    if (compare_update)
-    {
-        compare_reg_update(p_timer_id_head_old);
-    }
-    m_rtc1_reset = false;
-}
-
-
-/**@brief Function for enqueueing a new operations queue entry.
- *
- * @param[in]  p_user     User that the entry is to be enqueued for.
- * @param[in]  last_index Index of the next last index to be enqueued.
- */
-static void user_op_enque(timer_user_t * p_user, uint8_t last_index)
-{
-    p_user->last = last_index;
-}
-
-
-/**@brief Function for allocating a new operations queue entry.
- *
- * @param[in]  p_user       User that the entry is to be allocated for.
- * @param[out] p_last_index Index of the next last index to be enqueued.
- *
- * @return     Pointer to allocated queue entry, or NULL if queue is full.
- */
-static timer_user_op_t * user_op_alloc(timer_user_t * p_user, uint8_t * p_last_index)
-{        
-    uint8_t           last;
-    timer_user_op_t * p_user_op;
-    
-    last = p_user->last + 1;
-    if (last == p_user->user_op_queue_size)
-    {
-        // Overflow case.
-        last = 0;
-    }
-    if (last == p_user->first)
-    {
-        // Queue is full.
-        return NULL;
-    }
-    
-    *p_last_index = last;    
-    p_user_op     = &p_user->p_user_op_queue[p_user->last];
-        
-    return p_user_op;
-}
-
-
-/**@brief Function for scheduling a Timer Start operation.
- *
- * @param[in]  user_id           Id of user calling this function.
- * @param[in]  timer_id          Id of timer to start.
- * @param[in]  timeout_initial   Time (in ticks) to first timer expiry.
- * @param[in]  timeout_periodic  Time (in ticks) between periodic expiries.
- * @param[in]  p_context         General purpose pointer. Will be passed to the timeout handler when
- *                               the timer expires.
- * @return     NRF_SUCCESS on success, otherwise an error code.
- */
-static uint32_t timer_start_op_schedule(timer_user_id_t user_id,
-                                        timer_node_t * p_node,
-                                        uint32_t        timeout_initial,
-                                        uint32_t        timeout_periodic,
-                                        void *          p_context)
-{
-    uint8_t last_index;
-    
-    timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index);
-    if (p_user_op == NULL)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    
-    p_user_op->op_type                              = TIMER_USER_OP_TYPE_START;
-    p_user_op->p_node                               = p_node;
-    p_user_op->params.start.ticks_at_start          = rtc1_counter_get();
-    p_user_op->params.start.ticks_first_interval    = timeout_initial;
-    p_user_op->params.start.ticks_periodic_interval = timeout_periodic;
-    p_user_op->params.start.p_context               = p_context;
-    
-    user_op_enque(&mp_users[user_id], last_index);    
-
-    timer_list_handler_sched();
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for scheduling a Timer Stop operation.
- *
- * @param[in]  user_id    Id of user calling this function.
- * @param[in]  timer_id   Id of timer to stop.
- *
- * @return NRF_SUCCESS on successful scheduling a timer stop operation. NRF_ERROR_NO_MEM when there
- *         is no memory left to schedule the timer stop operation.
- */
-static uint32_t timer_stop_op_schedule(timer_user_id_t user_id, timer_node_t * p_node)
-{
-    uint8_t last_index;
-    
-    timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index);
-    if (p_user_op == NULL)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    
-    p_user_op->op_type  = TIMER_USER_OP_TYPE_STOP;
-    p_user_op->p_node = p_node;
-    
-    user_op_enque(&mp_users[user_id], last_index);        
-
-    timer_list_handler_sched();
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for scheduling a Timer Stop All operation.
- *
- * @param[in]  user_id    Id of user calling this function.
- */
-static uint32_t timer_stop_all_op_schedule(timer_user_id_t user_id)
-{
-    uint8_t last_index;
-    
-    timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index);
-    if (p_user_op == NULL)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    
-    p_user_op->op_type  = TIMER_USER_OP_TYPE_STOP_ALL;
-    p_user_op->p_node = NULL;
-    
-    user_op_enque(&mp_users[user_id], last_index);        
-
-    timer_list_handler_sched();
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for handling the RTC1 interrupt.
- *
- * @details Checks for timeouts, and executes timeout handlers for expired timers.
- */
-void RTC1_IRQHandler(void)
-{
-    // Clear all events (also unexpected ones)
-    NRF_RTC1->EVENTS_COMPARE[0] = 0;
-    NRF_RTC1->EVENTS_COMPARE[1] = 0;
-    NRF_RTC1->EVENTS_COMPARE[2] = 0;
-    NRF_RTC1->EVENTS_COMPARE[3] = 0;
-    NRF_RTC1->EVENTS_TICK       = 0;
-    NRF_RTC1->EVENTS_OVRFLW     = 0;
-
-    // Check for expired timers
-    timer_timeouts_check();
-}
-
-
-/**@brief Function for handling the SWI interrupt.
- *
- * @details Performs all updates to the timer list.
- */
-void SWI_IRQHandler(void)
-{
-    timer_list_handler();
-}
-
-
-uint32_t app_timer_init(uint32_t                      prescaler,
-                        uint8_t                       op_queues_size,
-                        void *                        p_buffer,
-                        app_timer_evt_schedule_func_t evt_schedule_func)
-{
-    int i;
-
-    // Check that buffer is correctly aligned
-    if (!is_word_aligned(p_buffer))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    // Check for NULL buffer
-    if (p_buffer == NULL)
-    {
-        mp_users = NULL;
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    
-    // Stop RTC to prevent any running timers from expiring (in case of reinitialization)
-    rtc1_stop();
-    
-    m_evt_schedule_func = evt_schedule_func;
-    
-    // Initialize users array
-    m_user_array_size = APP_TIMER_INT_LEVELS;
-    mp_users          = p_buffer;
-    
-    // Skip user array
-    p_buffer = &((uint8_t *)p_buffer)[APP_TIMER_INT_LEVELS * sizeof(timer_user_t)];
-
-    // Initialize operation queues
-    for (i = 0; i < APP_TIMER_INT_LEVELS; i++)
-    {
-        timer_user_t * p_user = &mp_users[i];
-        
-        p_user->first              = 0;
-        p_user->last               = 0;
-        p_user->user_op_queue_size = op_queues_size;
-        p_user->p_user_op_queue    = p_buffer;
-    
-        // Skip operation queue
-        p_buffer = &((uint8_t *)p_buffer)[op_queues_size * sizeof(timer_user_op_t)];
-    }
-
-    mp_timer_id_head             = NULL;
-    m_ticks_elapsed_q_read_ind  = 0;
-    m_ticks_elapsed_q_write_ind = 0;
-
-    NVIC_ClearPendingIRQ(SWI_IRQn);
-    NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI);
-    NVIC_EnableIRQ(SWI_IRQn);
-
-    rtc1_init(prescaler);
-
-    m_ticks_latest = rtc1_counter_get();
-    
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_timer_create(app_timer_id_t const *      p_timer_id,
-                          app_timer_mode_t            mode,
-                          app_timer_timeout_handler_t timeout_handler)
-{
-    // Check state and parameters
-    VERIFY_MODULE_INITIALIZED();
-
-    if (timeout_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (p_timer_id == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (((timer_node_t*)*p_timer_id)->is_running)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    timer_node_t * p_node     = (timer_node_t *)*p_timer_id;
-    p_node->is_running        = false;
-    p_node->mode              = mode;
-    p_node->p_timeout_handler = timeout_handler;
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for creating a timer user id from the current interrupt level.
- *
- * @return     Timer user id.
-*/
-static timer_user_id_t user_id_get(void)
-{
-    timer_user_id_t ret;
-
-    STATIC_ASSERT(APP_TIMER_INT_LEVELS == 3);
-    
-    switch (current_int_priority_get())
-    {
-        case APP_IRQ_PRIORITY_HIGH:
-            ret = APP_HIGH_USER_ID;
-            break;
-            
-        case APP_IRQ_PRIORITY_LOW:
-            ret = APP_LOW_USER_ID;
-            break;
-            
-        default:
-            ret = THREAD_MODE_USER_ID;
-            break;
-    }
-    
-    return ret;
-}
-
-
-uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context)
-{
-    uint32_t timeout_periodic;
-    timer_node_t * p_node = (timer_node_t*)timer_id;
-    
-    // Check state and parameters
-    VERIFY_MODULE_INITIALIZED();
-
-    if (timer_id == 0)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (p_node->p_timeout_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    // Schedule timer start operation
-    timeout_periodic = (p_node->mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0;
-
-    return timer_start_op_schedule(user_id_get(),
-                                   p_node,
-                                   timeout_ticks,
-                                   timeout_periodic,
-                                   p_context);
-}
-
-
-uint32_t app_timer_stop(app_timer_id_t timer_id)
-{
-    timer_node_t * p_node = (timer_node_t*)timer_id;
-    // Check state and parameters
-    VERIFY_MODULE_INITIALIZED();
-
-    if ((timer_id == NULL) || (p_node->p_timeout_handler == NULL))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    // Schedule timer stop operation
-    return timer_stop_op_schedule(user_id_get(), p_node);
-}
-
-
-uint32_t app_timer_stop_all(void)
-{
-    // Check state
-    VERIFY_MODULE_INITIALIZED();
-
-    return timer_stop_all_op_schedule(user_id_get());
-}
-
-
-uint32_t app_timer_cnt_get(uint32_t * p_ticks)
-{
-    *p_ticks = rtc1_counter_get();
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_timer_cnt_diff_compute(uint32_t   ticks_to,
-                                    uint32_t   ticks_from,
-                                    uint32_t * p_ticks_diff)
-{
-    *p_ticks_diff = ticks_diff_get(ticks_to, ticks_from);
-    return NRF_SUCCESS;
-}
-

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/timer/app_timer_freertos.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_freertos.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_freertos.c
deleted file mode 100644
index 9c68bfb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_freertos.c
+++ /dev/null
@@ -1,230 +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.
- *
- */
-
-#include "FreeRTOS.h"
-#include "task.h"
-#include "timers.h"
-
-#include "app_timer.h"
-#include <stdlib.h>
-#include <string.h>
-#include "nrf.h"
-#include "app_error.h"
-#include "app_util.h"
-#include "nordic_common.h"
-
-/* Check if RTC FreeRTOS version is used */
-#if configTICK_SOURCE != FREERTOS_USE_RTC
-#error app_timer in FreeRTOS variant have to be used with RTC tick source configuration. Default configuration have to be used in other case.
-#endif
-
-/**
- * @brief Waiting time for the timer queue
- *
- * Number of system ticks to wait for the timer queue to put the message.
- * It is strongly recommended to set this to the value bigger than 1.
- * In other case if timer message queue is full - any operation on timer may fail.
- * @note
- * Timer functions called from interrupt context would never wait.
- */
-#define APP_TIMER_WAIT_FOR_QUEUE 2
-
-/**@brief This structure keeps information about osTimer.*/
-typedef struct
-{
-    void                      * argument;
-    TimerHandle_t               osHandle;
-    app_timer_timeout_handler_t func;
-    /**
-     * This member is to make sure that timer function is only called if timer is running.
-     * FreeRTOS may have timer running even after stop function is called,
-     * because it processes commands in Timer task and stopping function only puts command into the queue. */
-    bool                        active;
-}app_timer_info_t;
-
-/**
- * @brief Prescaler that was set by the user
- *
- * In FreeRTOS version of app_timer the prescaler setting is constant and done by the operating system.
- * But the application expect the prescaler to be set according to value given in setup and then
- * calculate required ticks using this value.
- * For compatibility we remember the value set and use it for recalculation of required timer setting.
- */
-static uint32_t m_prescaler;
-
-/* Check if freeRTOS timers are activated */
-#if configUSE_TIMERS == 0
-    #error app_timer for freeRTOS requires configUSE_TIMERS option to be activated.
-#endif
-
-/* Check if app_timer_t variable type can held our app_timer_info_t structure */
-STATIC_ASSERT(sizeof(app_timer_info_t) <= sizeof(app_timer_t));
-
-
-/**
- * @brief Internal callback function for the system timer
- *
- * Internal function that is called from the system timer.
- * It gets our parameter from timer data and sends it to user function.
- * @param[in] xTimer Timer handler
- */
-static void app_timer_callback(TimerHandle_t xTimer)
-{
-    app_timer_info_t * pinfo = (app_timer_info_t*)(pvTimerGetTimerID(xTimer));
-    ASSERT(pinfo->osHandle == xTimer);
-    ASSERT(pinfo->func != NULL);
-
-    if(pinfo->active)
-        pinfo->func(pinfo->argument);
-}
-
-
-uint32_t app_timer_init(uint32_t                      prescaler,
-                        uint8_t                       op_queues_size,
-                        void                        * p_buffer,
-                        app_timer_evt_schedule_func_t evt_schedule_func)
-{
-    UNUSED_PARAMETER(op_queues_size);
-    UNUSED_PARAMETER(p_buffer);
-    UNUSED_PARAMETER(evt_schedule_func);
-
-    m_prescaler = prescaler + 1;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_timer_create(app_timer_id_t const *      p_timer_id,
-                          app_timer_mode_t            mode,
-                          app_timer_timeout_handler_t timeout_handler)
-{
-    app_timer_info_t * pinfo = (app_timer_info_t*)(*p_timer_id);
-    uint32_t      err_code = NRF_SUCCESS;
-    unsigned long timer_mode;
-
-    if((timeout_handler == NULL) || (p_timer_id == NULL))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if(pinfo->active)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if(pinfo->osHandle == NULL)
-    {
-        /* New timer is created */
-        memset(pinfo, 0, sizeof(pinfo));
-
-        if(mode == APP_TIMER_MODE_SINGLE_SHOT)
-            timer_mode = pdFALSE;
-        else
-            timer_mode = pdTRUE;
-
-        pinfo->func = timeout_handler;
-        pinfo->osHandle = xTimerCreate(" ", 1000, timer_mode, pinfo, app_timer_callback);
-
-        if(pinfo->osHandle == NULL)
-            err_code = NRF_ERROR_NULL;
-    }
-    else
-    {
-        /* Timer cannot be reinitialized using FreeRTOS API */
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    return err_code;
-}
-
-
-uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context)
-{
-    app_timer_info_t * pinfo = (app_timer_info_t*)(timer_id);
-    TimerHandle_t hTimer = pinfo->osHandle;
-    uint32_t rtc_prescaler = portNRF_RTC_REG->PRESCALER  + 1;
-    /* Get back the microseconds to wait */
-    uint32_t timeout_corrected = ROUNDED_DIV(timeout_ticks*m_prescaler, rtc_prescaler);
-
-    if(hTimer == NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if(pinfo->active && (xTimerIsTimerActive(hTimer) != pdFALSE))
-    {
-        // Timer already running - exit silently
-        return NRF_SUCCESS;
-    }
-
-    pinfo->argument = p_context;
-
-    if(__get_IPSR() != 0)
-    {
-        BaseType_t yieldReq = pdFALSE;
-        if(xTimerChangePeriodFromISR(hTimer, timeout_corrected, &yieldReq) != pdPASS)
-        {
-            return NRF_ERROR_NO_MEM;
-        }
-
-        if( xTimerStartFromISR(hTimer, &yieldReq) != pdPASS )
-        {
-            return NRF_ERROR_NO_MEM;
-        }
-
-        portYIELD_FROM_ISR(yieldReq);
-    }
-    else
-    {
-        if(xTimerChangePeriod(hTimer, timeout_corrected, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS)
-        {
-            return NRF_ERROR_NO_MEM;
-        }
-
-        if(xTimerStart(hTimer, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS)
-        {
-            return NRF_ERROR_NO_MEM;
-        }
-    }
-
-    pinfo->active = true;
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_timer_stop(app_timer_id_t timer_id)
-{
-    app_timer_info_t * pinfo = (app_timer_info_t*)(timer_id);
-    TimerHandle_t hTimer = pinfo->osHandle;
-    if(hTimer == NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if(__get_IPSR() != 0)
-    {
-        BaseType_t yieldReq = pdFALSE;
-        if(xTimerStopFromISR(timer_id, &yieldReq) != pdPASS)
-        {
-            return NRF_ERROR_NO_MEM;
-        }
-        portYIELD_FROM_ISR(yieldReq);
-    }
-    else
-    {
-        if(xTimerStop(timer_id, APP_TIMER_WAIT_FOR_QUEUE) != pdPASS)
-        {
-            return NRF_ERROR_NO_MEM;
-        }
-    }
-
-    pinfo->active = false;
-    return NRF_SUCCESS;
-}

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/trace/app_trace.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/trace/app_trace.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/trace/app_trace.c
deleted file mode 100644
index 2f510f8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/trace/app_trace.c
+++ /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.
- *
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <stdarg.h>
-
-
-#ifdef ENABLE_DEBUG_LOG_SUPPORT
-#include "app_trace.h"
-#include "nrf_log.h"
-
-void app_trace_init(void)
-{
-    (void)NRF_LOG_INIT();
-}
-
-void app_trace_dump(uint8_t * p_buffer, uint32_t len)
-{
-    app_trace_log("\r\n");
-    for (uint32_t index = 0; index <  len; index++)
-    {
-        app_trace_log("0x%02X ", p_buffer[index]);
-    }
-    app_trace_log("\r\n");
-}
-
-#endif // ENABLE_DEBUG_LOG_SUPPORT
-
-/**
- *@}
- **/
-

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/twi/app_twi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/twi/app_twi.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/twi/app_twi.c
deleted file mode 100644
index 9402d28..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/twi/app_twi.c
+++ /dev/null
@@ -1,376 +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 "app_twi.h"
-#include "nrf_assert.h"
-#include "app_util_platform.h"
-#include "sdk_common.h"
-
-
-// Increase specified queue index and when it goes outside the queue move it
-// on the beginning of the queue.
-#define INCREASE_IDX(idx, p_queue)  \
-    do { \
-        ++idx; \
-        p_queue->idx = (idx > p_queue->size) ? 0 : idx; \
-    } while (0)
-
-
-static bool queue_put(app_twi_queue_t *             p_queue,
-                      app_twi_transaction_t const * p_transaction)
-{
-    // [use a local variable to avoid using two volatile variables in one
-    //  expression]
-    uint8_t write_idx = p_queue->write_idx;
-
-    // If the queue is already full, we cannot put any more elements into it.
-    if ((write_idx == p_queue->size && p_queue->read_idx == 0) ||
-        write_idx == p_queue->read_idx-1)
-    {
-        return false;
-    }
-
-    // Write the new element on the position specified by the write index.
-    p_queue->p_buffer[write_idx] = p_transaction;
-    // Increase the write index and when it goes outside the queue move it
-    // on the beginning.
-    INCREASE_IDX(write_idx, p_queue);
-
-    return true;
-}
-
-
-static app_twi_transaction_t const * queue_get(app_twi_queue_t * p_queue)
-{
-    // [use a local variable to avoid using two volatile variables in one
-    //  expression]
-    uint8_t read_idx = p_queue->read_idx;
-
-    // If the queue is empty, we cannot return any more elements from it.
-    if (read_idx == p_queue->write_idx)
-    {
-        return NULL;
-    }
-
-    // Read the element from the position specified by the read index.
-    app_twi_transaction_t const * p_transaction = p_queue->p_buffer[read_idx];
-    // Increase the read index and when it goes outside the queue move it
-    // on the beginning.
-    INCREASE_IDX(read_idx, p_queue);
-
-    return p_transaction;
-}
-
-
-static ret_code_t start_transfer(app_twi_t * p_app_twi)
-{
-    ASSERT(p_app_twi != NULL);
-
-    // [use a local variable to avoid using two volatile variables in one
-    //  expression]
-    uint8_t current_transfer_idx = p_app_twi->current_transfer_idx;
-    app_twi_transfer_t const * p_transfer =
-        &p_app_twi->p_current_transaction->p_transfers[current_transfer_idx];
-    uint8_t address = APP_TWI_OP_ADDRESS(p_transfer->operation);
-
-    nrf_drv_twi_xfer_desc_t xfer_desc;
-    uint32_t                flags;
-
-    xfer_desc.address       = address;
-    xfer_desc.p_primary_buf = p_transfer->p_data;
-    xfer_desc.primary_length = p_transfer->length;
-
-    /* If it is possible try to bind two transfers together. They can be combined if:
-     * - there is no stop condition after current transfer.
-     * - current transfer is TX.
-     * - there is at least one more transfer in the transaction.
-     * - address of next trnasfer is the same as current transfer.
-     */
-    if ((p_transfer->flags & APP_TWI_NO_STOP) &&
-        !APP_TWI_IS_READ_OP(p_transfer->operation) &&
-        ((current_transfer_idx+1) < p_app_twi->p_current_transaction->number_of_transfers) &&
-        APP_TWI_OP_ADDRESS(p_transfer->operation) ==
-        APP_TWI_OP_ADDRESS(p_app_twi->p_current_transaction->p_transfers[current_transfer_idx+1].operation)
-    )
-    {
-        app_twi_transfer_t const * p_second_transfer =
-            &p_app_twi->p_current_transaction->p_transfers[current_transfer_idx+1];
-        xfer_desc.p_secondary_buf = p_second_transfer->p_data;
-        xfer_desc.secondary_length = p_second_transfer->length;
-        xfer_desc.type = APP_TWI_IS_READ_OP(p_second_transfer->operation) ? NRF_DRV_TWI_XFER_TXRX :
-                                                                            NRF_DRV_TWI_XFER_TXTX;
-        flags = (p_second_transfer->flags & APP_TWI_NO_STOP) ? NRF_DRV_TWI_FLAG_TX_NO_STOP : 0;
-        p_app_twi->current_transfer_idx++;
-    }
-    else
-    {
-        xfer_desc.type = APP_TWI_IS_READ_OP(p_transfer->operation) ? NRF_DRV_TWI_XFER_RX :
-                NRF_DRV_TWI_XFER_TX;
-        xfer_desc.p_secondary_buf = NULL;
-        xfer_desc.secondary_length = 0;
-        flags = (p_transfer->flags & APP_TWI_NO_STOP) ? NRF_DRV_TWI_FLAG_TX_NO_STOP : 0;
-    }
-
-    return nrf_drv_twi_xfer(&p_app_twi->twi, &xfer_desc, flags);
-}
-
-
-static void signal_end_of_transaction(app_twi_t const * p_app_twi,
-                                      ret_code_t        result)
-{
-    ASSERT(p_app_twi != NULL);
-
-    if (p_app_twi->p_current_transaction->callback)
-    {
-        // [use a local variable to avoid using two volatile variables in one
-        //  expression]
-        void * p_user_data = p_app_twi->p_current_transaction->p_user_data;
-        p_app_twi->p_current_transaction->callback(result, p_user_data);
-    }
-}
-
-
-// This function starts pending transaction if there is no current one or
-// when 'switch_transaction' parameter is set to true. It is important to
-// switch to new transaction without setting 'p_app_twi->p_current_transaction'
-// to NULL in between, since this pointer is used to check idle status - see
-// 'app_twi_is_idle()'.
-static void start_pending_transaction(app_twi_t * p_app_twi,
-                                      bool        switch_transaction)
-{
-    ASSERT(p_app_twi != NULL);
-
-    for (;;)
-    {
-        bool start_transaction = false;
-
-        CRITICAL_REGION_ENTER();
-        if (switch_transaction || app_twi_is_idle(p_app_twi))
-        {
-            p_app_twi->p_current_transaction = queue_get(&p_app_twi->queue);
-            if (p_app_twi->p_current_transaction != NULL)
-            {
-                start_transaction = true;
-            }
-        }
-        CRITICAL_REGION_EXIT();
-
-        if (!start_transaction)
-        {
-            return;
-        }
-        else
-        {
-            ret_code_t result;
-
-            // Try to start first transfer for this new transaction.
-            p_app_twi->current_transfer_idx = 0;
-            result = start_transfer(p_app_twi);
-
-            // If it started successfully there is nothing more to do here now.
-            if (result == NRF_SUCCESS)
-            {
-                return;
-            }
-
-            // Transfer failed to start - notify user that this transaction
-            // cannot be started and try with next one (in next iteration of
-            // the loop).
-            signal_end_of_transaction(p_app_twi, result);
-
-            switch_transaction = true;
-        }
-    }
-}
-
-
-static void twi_event_handler(nrf_drv_twi_evt_t const * p_event,
-                              void *                    p_context)
-{
-    ASSERT(p_event != NULL);
-
-    app_twi_t * p_app_twi = (app_twi_t *)p_context;
-    ret_code_t result;
-
-    // This callback should be called only during transaction.
-    ASSERT(p_app_twi->p_current_transaction != NULL);
-
-    if (p_event->type == NRF_DRV_TWI_EVT_DONE)
-    {
-        result = NRF_SUCCESS;
-
-        // Transfer finished successfully. If there is another one to be
-        // performed in the current transaction, start it now.
-        // [use a local variable to avoid using two volatile variables in one
-        //  expression]
-        uint8_t current_transfer_idx = p_app_twi->current_transfer_idx;
-        ++current_transfer_idx;
-        if (current_transfer_idx <
-                p_app_twi->p_current_transaction->number_of_transfers)
-        {
-            p_app_twi->current_transfer_idx = current_transfer_idx;
-
-            result = start_transfer(p_app_twi);
-
-            if (result == NRF_SUCCESS)
-            {
-                // The current transaction goes on and we've successfully
-                // started its next transfer -> there is nothing more to do.
-                return;
-            }
-
-            // [if the next transfer could not be started due to some error
-            //  we finish the transaction with this error code as the result]
-        }
-    }
-    else
-    {
-        result = NRF_ERROR_INTERNAL;
-    }
-
-    // The current transaction has been completed or interrupted by some error.
-    // Notify the user and start next one (if there is any).
-    signal_end_of_transaction(p_app_twi, result);
-    // [we switch transactions here ('p_app_twi->p_current_transaction' is set
-    //  to NULL only if there is nothing more to do) in order to not generate
-    //  spurious idle status (even for a moment)]
-    start_pending_transaction(p_app_twi, true);
-}
-
-
-ret_code_t app_twi_init(app_twi_t *                     p_app_twi,
-                        nrf_drv_twi_config_t const *    p_twi_config,
-                        uint8_t                         queue_size,
-                        app_twi_transaction_t const * * p_queue_buffer)
-{
-    ASSERT(p_app_twi != NULL);
-    ASSERT(queue_size != 0);
-    ASSERT(p_queue_buffer != NULL);
-
-    ret_code_t err_code;
-
-    err_code = nrf_drv_twi_init(&p_app_twi->twi,
-                                p_twi_config,
-                                twi_event_handler,
-                                p_app_twi);
-    VERIFY_SUCCESS(err_code);
-
-    nrf_drv_twi_enable(&p_app_twi->twi);
-
-    p_app_twi->queue.p_buffer  = p_queue_buffer;
-    p_app_twi->queue.size      = queue_size;
-    p_app_twi->queue.read_idx  = 0;
-    p_app_twi->queue.write_idx = 0;
-
-    p_app_twi->internal_transaction_in_progress = false;
-    p_app_twi->p_current_transaction            = NULL;
-
-    return NRF_SUCCESS;
-}
-
-
-void app_twi_uninit(app_twi_t * p_app_twi)
-{
-    ASSERT(p_app_twi != NULL);
-
-    nrf_drv_twi_uninit(&(p_app_twi->twi));
-
-    p_app_twi->p_current_transaction = NULL;
-}
-
-
-ret_code_t app_twi_schedule(app_twi_t *                   p_app_twi,
-                            app_twi_transaction_t const * p_transaction)
-{
-    ASSERT(p_app_twi != NULL);
-    ASSERT(p_transaction != NULL);
-    ASSERT(p_transaction->p_transfers != NULL);
-    ASSERT(p_transaction->number_of_transfers != 0);
-
-    ret_code_t result = NRF_SUCCESS;
-
-    CRITICAL_REGION_ENTER();
-    if (!queue_put(&p_app_twi->queue, p_transaction))
-    {
-        result = NRF_ERROR_BUSY;
-    }
-    CRITICAL_REGION_EXIT();
-
-    if (result == NRF_SUCCESS)
-    {
-        // New transaction has been successfully added to queue,
-        // so if we are currently idle it's time to start the job.
-        start_pending_transaction(p_app_twi, false);
-    }
-
-    return result;
-}
-
-
-static void internal_transaction_cb(ret_code_t result, void * p_user_data)
-{
-    app_twi_t * p_app_twi = (app_twi_t *)p_user_data;
-
-    p_app_twi->internal_transaction_result      = result;
-    p_app_twi->internal_transaction_in_progress = false;
-}
-
-
-ret_code_t app_twi_perform(app_twi_t *                p_app_twi,
-                           app_twi_transfer_t const * p_transfers,
-                           uint8_t                    number_of_transfers,
-                           void (* user_function)(void))
-{
-    ASSERT(p_app_twi != NULL);
-    ASSERT(p_transfers != NULL);
-    ASSERT(number_of_transfers != 0);
-
-    bool busy = false;
-
-    CRITICAL_REGION_ENTER();
-    if (p_app_twi->internal_transaction_in_progress)
-    {
-        busy = true;
-    }
-    else
-    {
-        p_app_twi->internal_transaction_in_progress = true;
-    }
-    CRITICAL_REGION_EXIT();
-
-    if (busy)
-    {
-        return NRF_ERROR_BUSY;
-    }
-    else
-    {
-        app_twi_transaction_t internal_transaction =
-        {
-            .callback            = internal_transaction_cb,
-            .p_user_data         = p_app_twi,
-            .p_transfers         = p_transfers,
-            .number_of_transfers = number_of_transfers,
-        };
-        ret_code_t result = app_twi_schedule(p_app_twi, &internal_transaction);
-        VERIFY_SUCCESS(result);
-
-        while (p_app_twi->internal_transaction_in_progress)
-        {
-            if (user_function)
-            {
-                user_function();
-            }
-        }
-
-        return p_app_twi->internal_transaction_result;
-    }
-}

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/twi/app_twi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/twi/app_twi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/twi/app_twi.h
deleted file mode 100644
index 65bbf45..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/twi/app_twi.h
+++ /dev/null
@@ -1,298 +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.
- *
- */
-
-#ifndef APP_TWI_H__
-#define APP_TWI_H__
-
-#include <stdint.h>
-#include "nrf_drv_twi.h"
-#include "sdk_errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup app_twi TWI transaction manager
- * @{
- * @ingroup app_common
- *
- * @brief Module for scheduling TWI transactions.
- */
-
-/**
- * @brief Flag indicating that a given transfer should not be ended
- *        with a stop condition.
- *
- * Use this flag when a stop condition is undesirable between two transfers,
- * for example, when the first transfer is a write that sets an address in the slave
- * device and the second one is a read that fetches certain data using this
- * address. In this case, the second transfer should follow directly after the 
- * first transfer, with a repeated start condition instead of a stop and then
- * a new start condition.
- */
-#define APP_TWI_NO_STOP     0x01
-
-/**
- * @brief Macro for creating a write transfer.
- *
- * @param     address Slave address.
- * @param[in] p_data  Pointer to the data to be sent.
- * @param     length  Number of bytes to transfer.
- * @param     flags   Transfer flags (see @ref APP_TWI_NO_STOP).
- */
-#define APP_TWI_WRITE(address, p_data, length, flags) \
-    APP_TWI_TRANSFER(APP_TWI_WRITE_OP(address), p_data, length, flags)
-
-/**
- * @brief Macro for creating a read transfer.
- *
- * @param     address Slave address.
- * @param[in] p_data  Pointer to the buffer where received data should be placed.
- * @param     length  Number of bytes to transfer.
- * @param     flags   Transfer flags (see @ref APP_TWI_NO_STOP).
- */
-#define APP_TWI_READ(address, p_data, length, flags) \
-    APP_TWI_TRANSFER(APP_TWI_READ_OP(address), p_data, length, flags)
-
-/**
- * @brief Helper macro, should not be used directly.
- */
-#define APP_TWI_TRANSFER(_operation, _p_data, _length, _flags) \
-{                                      \
-    .p_data    = (uint8_t *)(_p_data), \
-    .length    = _length,              \
-    .operation = _operation,           \
-    .flags     = _flags                \
-}
-/**
- * @brief Helper macro, should not be used directly.
- */
-#define APP_TWI_WRITE_OP(address)      (((address) << 1) | 0)
-/**
- * @brief Helper macro, should not be used directly.
- */
-#define APP_TWI_READ_OP(address)       (((address) << 1) | 1)
-/**
- * @brief Helper macro, should not be used directly.
- */
-#define APP_TWI_IS_READ_OP(operation)  ((operation) & 1)
-/**
- * @brief Helper macro, should not be used directly.
- */
-#define APP_TWI_OP_ADDRESS(operation)  ((operation) >> 1)
-
-/**
- * @brief TWI transaction callback prototype.
- *
- * @param     result      Result of operation (NRF_SUCCESS on success,
- *                        otherwise a relevant error code).
- * @param[in] p_user_data Pointer to user data defined in transaction
- *                        descriptor.
- */
-typedef void (* app_twi_callback_t)(ret_code_t result, void * p_user_data);
-
-/**
- * @brief TWI transfer descriptor.
- */
-typedef struct {
-    uint8_t * p_data;     ///< Pointer to the buffer holding the data.
-    uint8_t   length;     ///< Number of bytes to transfer.
-    uint8_t   operation;  ///< Device address combined with transfer direction.
-    uint8_t   flags;      ///< Transfer flags (see @ref APP_TWI_NO_STOP).
-} app_twi_transfer_t;
-
-/**
- * @brief TWI transaction descriptor.
- */
-typedef struct {
-    app_twi_callback_t         callback;
-    ///< User-specified function to be called after the transaction is finished.
-
-    void *                     p_user_data;
-    ///< Pointer to user data to be passed to the callback.
-
-    app_twi_transfer_t const * p_transfers;
-    ///< Pointer to the array of transfers that make up the transaction.
-
-    uint8_t                    number_of_transfers;
-    ///< Number of transfers that make up the transaction.
-} app_twi_transaction_t;
-
-/**
- * @brief TWI transaction queue.
- */
-typedef struct {
-    app_twi_transaction_t const * volatile * p_buffer;
-    uint8_t          size;
-    uint8_t volatile read_idx;
-    uint8_t volatile write_idx;
-} app_twi_queue_t;
-
-/**
- * @brief TWI transaction manager instance.
- */
-typedef struct {
-    app_twi_queue_t  queue;
-    ///< Transaction queue.
-
-    uint8_t volatile current_transfer_idx;
-    ///< Index of currently performed transfer (within current transaction).
-
-    bool    volatile internal_transaction_in_progress;
-    ///< Informs that an internal transaction is being performed (by app_twi_perform()).
-
-    uint8_t volatile internal_transaction_result;
-    ///< Used to pass the result of the internal transaction realized by app_twi_perform().
-
-    app_twi_transaction_t const * volatile p_current_transaction;
-    ///< Currently realized transaction.
-
-    nrf_drv_twi_t const twi;
-    ///< TWI master driver instance.
-} app_twi_t;
-
-/**
- * @brief Macro for creating an instance of the TWI transaction manager.
- *
- * @param[in] twi_idx Index of the TWI master driver instance to be utilized
- *                    by this manager instance.
- */
-#define APP_TWI_INSTANCE(twi_idx) \
-{                                        \
-    .twi = NRF_DRV_TWI_INSTANCE(twi_idx) \
-}
-
-/**
- * @brief Macro that simplifies the initialization of a TWI transaction manager
- *        instance.
- *
- * This macro allocates a static buffer for the transaction queue.
- * Therefore, it should be used in only one place in the code for a given
- * instance.
- *
- * @param[in]  p_app_twi    Pointer to the instance to be initialized.
- * @param[in]  p_twi_config Pointer to the TWI master driver configuration.
- * @param      queue_size   Size of the transaction queue (maximum number
- *                          of pending transactions).
- *                          See @ref app_twi_init_note "this note".
- * @param[out] err_code     The result of the app_twi_init() function call
- *                          is written to this parameter.
- */
-#define APP_TWI_INIT(p_app_twi, p_twi_config, queue_size, err_code) \
-    do {                                                                   \
-        static app_twi_transaction_t const * queue_buffer[queue_size + 1]; \
-        err_code = app_twi_init(p_app_twi, p_twi_config,                   \
-                                queue_size, queue_buffer);                 \
-    } while (0)
-
-/**
- * @brief Function for initializing a TWI transaction manager instance.
- *
- * This function initializes the utilized TWI master driver instance and
- * prepares the transaction queue.
- *
- * @anchor app_twi_init_note
- * @note The queue size is the maximum number of pending transactions
- *       not counting the one that is currently realized. This means that
- *       for an empty queue with size of, for example, 4 elements, it is 
- *       possible to schedule up to 5 transactions.
- *
- * @param[in] p_app_twi      Pointer to the instance to be initialized.
- * @param[in] p_twi_config   Pointer to the TWI master driver configuration.
- * @param     queue_size     Size of the transaction queue (maximum number
- *                           of pending transactions).
- * @param[in] p_queue_buffer Pointer to a buffer for queued transactions
- *                           storage. Due to the queue implementation, the buffer must
- *                           be big enough to hold queue_size + 1 entries
- *                           (pointers to transaction descriptors).
- *
- * @retval NRF_SUCCESS If initialization was successful. Otherwise, the error code
- *         returned by the nrf_drv_twi_init() function is returned.
- */
-ret_code_t app_twi_init(app_twi_t *                     p_app_twi,
-                        nrf_drv_twi_config_t const *    p_twi_config,
-                        uint8_t                         queue_size,
-                        app_twi_transaction_t const * * p_queue_buffer);
-
-/**
- * @brief Function for uninitializing a TWI transaction manager instance.
- *
- * @param[in] p_app_twi Pointer to the instance to be uninitialized.
- */
-void       app_twi_uninit(app_twi_t * p_app_twi);
-
-/**
- * @brief Function for scheduling a TWI transaction.
- *
- * The transaction is enqueued and started as soon as the TWI bus is
- * available, thus when all previously scheduled transactions have been
- * finished (possibly immediately).
- *
- * @param[in] p_app_twi     Pointer to the TWI transaction manager instance.
- * @param[in] p_transaction Pointer to the descriptor of the transaction to be
- *                          scheduled.
- *
- * @retval NRF_SUCCESS    If the transaction has been successfully scheduled.
- * @retval NRF_ERROR_BUSY If the limit of pending transactions has been reached
- *                        (the transaction queue is full).
- */
-ret_code_t app_twi_schedule(app_twi_t *                   p_app_twi,
-                            app_twi_transaction_t const * p_transaction);
-
-/**
- * @brief Function for scheduling a transaction and waiting until it is finished.
- *
- * This function schedules a transaction that consists of one or more transfers 
- * and waits until it is finished.
- *
- * @param[in] p_app_twi           Pointer to the TWI transaction manager instance.
- * @param[in] p_transfers         Pointer to an array of transfers to be performed.
- * @param     number_of_transfers Number of transfers to be performed.
- * @param     user_function       User-specified function to be called while
- *                                waiting. NULL if such functionality
- *                                is not needed.
- *
- * @retval NRF_SUCCESS    If the transfers have been successfully realized.
- * @retval NRF_ERROR_BUSY If some transfers are already performed (if this function
- *                        was called from another context).
- * @retval -              Other error codes mean that the transaction has ended
- *                        with the error that is specified in the error code.
- */
-ret_code_t app_twi_perform(app_twi_t *                p_app_twi,
-                           app_twi_transfer_t const * p_transfers,
-                           uint8_t                    number_of_transfers,
-                           void (* user_function)(void));
-
-/**
- * @brief Function for getting the current state of a TWI transaction manager
- *        instance.
- *
- * @param[in] p_app_twi Pointer to the TWI transaction manager instance.
- *
- * @retval true  If all scheduled transactions have been finished.
- * @retval false Otherwise.
- */
-__STATIC_INLINE bool app_twi_is_idle(app_twi_t * p_app_twi)
-{
-    return (p_app_twi->p_current_transaction == NULL);
-}
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_TWI_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/uart/app_uart.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart.c
deleted file mode 100644
index 944ff21..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart.c
+++ /dev/null
@@ -1,132 +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 "app_uart.h"
-#include "nrf_drv_uart.h"
-#include "nrf_assert.h"
-#include "sdk_common.h"
-
-static uint8_t tx_buffer[1];
-static uint8_t rx_buffer[1];
-static volatile bool rx_done;
-static app_uart_event_handler_t   m_event_handler;            /**< Event handler function. */
-
-void uart_event_handler(nrf_drv_uart_event_t * p_event, void* p_context)
-{
-    if (p_event->type == NRF_DRV_UART_EVT_RX_DONE)
-    {
-        app_uart_evt_t app_uart_event;
-        app_uart_event.evt_type   = APP_UART_DATA;
-        app_uart_event.data.value = p_event->data.rxtx.p_data[0];
-        (void)nrf_drv_uart_rx(rx_buffer,1);
-        rx_done = true;
-        m_event_handler(&app_uart_event);
-    }
-    else if (p_event->type == NRF_DRV_UART_EVT_ERROR)
-    {
-        app_uart_evt_t app_uart_event;
-        app_uart_event.evt_type                 = APP_UART_COMMUNICATION_ERROR;
-        app_uart_event.data.error_communication = p_event->data.error.error_mask;
-        (void)nrf_drv_uart_rx(rx_buffer,1);
-        m_event_handler(&app_uart_event);
-    }
-    else if (p_event->type == NRF_DRV_UART_EVT_TX_DONE)
-    {
-       // Last byte from FIFO transmitted, notify the application.
-       // Notify that new data is available if this was first byte put in the buffer.
-       app_uart_evt_t app_uart_event;
-       app_uart_event.evt_type = APP_UART_TX_EMPTY;
-       m_event_handler(&app_uart_event);
-    }
-}
-
-uint32_t app_uart_init(const app_uart_comm_params_t * p_comm_params,
-                       app_uart_buffers_t           * p_buffers,
-                       app_uart_event_handler_t       event_handler,
-                       app_irq_priority_t             irq_priority)
-{
-    nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG;
-    config.baudrate = (nrf_uart_baudrate_t)p_comm_params->baud_rate;
-    config.hwfc = (p_comm_params->flow_control == APP_UART_FLOW_CONTROL_DISABLED) ?
-            NRF_UART_HWFC_DISABLED : NRF_UART_HWFC_ENABLED;
-    config.interrupt_priority = irq_priority;
-    config.parity = p_comm_params->use_parity ? NRF_UART_PARITY_INCLUDED : NRF_UART_PARITY_EXCLUDED;
-    config.pselcts = p_comm_params->cts_pin_no;
-    config.pselrts = p_comm_params->rts_pin_no;
-    config.pselrxd = p_comm_params->rx_pin_no;
-    config.pseltxd = p_comm_params->tx_pin_no;
-
-    m_event_handler = event_handler;
-
-    rx_done = false;
-
-    if (p_comm_params->flow_control == APP_UART_FLOW_CONTROL_LOW_POWER)
-    {
-        return NRF_ERROR_NOT_SUPPORTED;
-    }
-
-    uint32_t err_code = nrf_drv_uart_init(&config, uart_event_handler);
-    VERIFY_SUCCESS(err_code);
-
-#ifdef NRF52
-    if (!config.use_easy_dma)
-#endif
-    {
-        nrf_drv_uart_rx_enable();
-    }
-    return nrf_drv_uart_rx(rx_buffer,1);
-}
-
-
-uint32_t app_uart_get(uint8_t * p_byte)
-{
-    ASSERT(p_byte);
-    uint32_t err_code = NRF_SUCCESS;
-    if (rx_done)
-    {
-        *p_byte = rx_buffer[0];
-    }
-    else
-    {
-        err_code = NRF_ERROR_NOT_FOUND;
-    }
-    return err_code;
-}
-
-uint32_t app_uart_put(uint8_t byte)
-{
-    tx_buffer[0] = byte;
-    ret_code_t ret =  nrf_drv_uart_tx(tx_buffer,1);
-    if (NRF_ERROR_BUSY == ret)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    else if (ret != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INTERNAL;
-    }
-    else
-    {
-        return NRF_SUCCESS;
-    }
-}
-
-uint32_t app_uart_flush(void)
-{
-    return NRF_SUCCESS;
-}
-
-uint32_t app_uart_close(void)
-{
-    nrf_drv_uart_uninit();
-    return NRF_SUCCESS;
-}


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

Posted by cc...@apache.org.
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/simple_timer/app_simple_timer.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/simple_timer/app_simple_timer.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/simple_timer/app_simple_timer.c
deleted file mode 100644
index eef38ec..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/simple_timer/app_simple_timer.c
+++ /dev/null
@@ -1,187 +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 "app_simple_timer.h"
-#include "nrf.h"
-#include "app_util_platform.h"
-#include "app_error.h"
-#include "nrf_timer.h"
-#include "nrf_drv_timer.h"
-#include "sdk_common.h"
-
-/**@brief States of simple timer state machine.
- */
-typedef enum
-{
-    SIMPLE_TIMER_STATE_IDLE = 0,
-    SIMPLE_TIMER_STATE_INITIALIZED,
-    SIMPLE_TIMER_STATE_STOPPED,
-    SIMPLE_TIMER_STATE_STARTED
-}simple_timer_states_t;
-
-static app_simple_timer_mode_t            m_mode;                                               /**< Registered timer mode. */
-static app_simple_timer_timeout_handler_t m_timeout_handler          = NULL;                    /**< Registered time-out handler. */
-static void *                             mp_timeout_handler_context = NULL;                    /**< Registered time-out handler context. */
-static simple_timer_states_t              m_simple_timer_state       = SIMPLE_TIMER_STATE_IDLE; /**< State machine state. */
-
-#define APP_SIMPLE_TIMER_INSTANCE 1
-
-#if (APP_SIMPLE_TIMER_INSTANCE == 0)
-    #if (TIMER_CONFIG_MODE(0) != TIMER_MODE_MODE_Timer)
-        #error "Unsupported timer mode."
-    #endif
-    #if (TIMER_CONFIG_BIT_WIDTH(0) != TIMER_BITMODE_BITMODE_16Bit)
-        #error "Unsupported timer bit width."
-    #endif
-    const nrf_drv_timer_t SIMPLE_TIMER = NRF_DRV_TIMER_INSTANCE(0);
-#elif (APP_SIMPLE_TIMER_INSTANCE == 1)
-    #if (TIMER_CONFIG_MODE(1) != TIMER_MODE_MODE_Timer)
-        #error "Unsupported timer mode."
-    #endif
-    #if (TIMER_CONFIG_BIT_WIDTH(1) != TIMER_BITMODE_BITMODE_16Bit)
-        #error "Unsupported timer bit width."
-    #endif
-    const nrf_drv_timer_t SIMPLE_TIMER = NRF_DRV_TIMER_INSTANCE(1);
-#elif (APP_SIMPLE_TIMER_INSTANCE == 2)
-    #if (TIMER_CONFIG_MODE(2) != TIMER_MODE_MODE_Timer)
-        #error "Unsupported timer mode."
-    #endif
-    #if (TIMER_CONFIG_BIT_WIDTH(2) != TIMER_BITMODE_BITMODE_16Bit)
-        #error "Unsupported timer bit width."
-    #endif
-    const nrf_drv_timer_t SIMPLE_TIMER = NRF_DRV_TIMER_INSTANCE(2);
-#else
-    #error "Wrong timer instance id."
-#endif
-
-/**
- * @brief Handler for timer events.
- */
-static void app_simple_timer_event_handler(nrf_timer_event_t event_type, void * p_context)
-{
-    switch(event_type)
-    {
-        case NRF_TIMER_EVENT_COMPARE0:
-            if (m_mode == APP_SIMPLE_TIMER_MODE_SINGLE_SHOT)
-            {
-                m_simple_timer_state = SIMPLE_TIMER_STATE_STOPPED;
-            }
-
-            //@note: No NULL check required as performed in timer_start(...).
-            m_timeout_handler(mp_timeout_handler_context);
-            break;
-
-        default:
-            //Do nothing.
-            break;
-    }
-}
-
-uint32_t app_simple_timer_init(void)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = nrf_drv_timer_init(&SIMPLE_TIMER, NULL, app_simple_timer_event_handler);
-
-    if(NRF_SUCCESS == err_code)
-    {
-        m_simple_timer_state = SIMPLE_TIMER_STATE_INITIALIZED;
-    }
-
-    return err_code;
-}
-
-uint32_t app_simple_timer_start(app_simple_timer_mode_t            mode, 
-                                app_simple_timer_timeout_handler_t timeout_handler,
-                                uint16_t                           timeout_ticks,
-                                void *                             p_context)
-{
-    uint32_t err_code = NRF_SUCCESS;
-    nrf_timer_short_mask_t timer_short;
-
-    VERIFY_PARAM_NOT_NULL(timeout_handler);
-
-    if (APP_SIMPLE_TIMER_MODE_REPEATED == mode)
-    {
-        timer_short = NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK;
-    }
-    else if(APP_SIMPLE_TIMER_MODE_SINGLE_SHOT == mode)
-    {
-        timer_short = NRF_TIMER_SHORT_COMPARE0_STOP_MASK;
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if(SIMPLE_TIMER_STATE_IDLE == m_simple_timer_state)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if(SIMPLE_TIMER_STATE_STARTED == m_simple_timer_state)
-    {
-        err_code = app_simple_timer_stop();
-        APP_ERROR_CHECK(err_code);
-    }
-
-    if(SIMPLE_TIMER_STATE_STOPPED == m_simple_timer_state)
-    {
-        nrf_drv_timer_clear(&SIMPLE_TIMER);
-    }
-
-    m_mode                      = mode;
-    m_timeout_handler           = timeout_handler;
-    mp_timeout_handler_context  = p_context;
-
-    nrf_drv_timer_extended_compare(
-            &SIMPLE_TIMER, NRF_TIMER_CC_CHANNEL0, (uint32_t)timeout_ticks, timer_short, true);
-
-    if (m_simple_timer_state == SIMPLE_TIMER_STATE_STOPPED)
-    {
-        nrf_drv_timer_resume(&SIMPLE_TIMER);
-    }
-    else
-    {
-        nrf_drv_timer_enable(&SIMPLE_TIMER);
-    }
-
-
-    m_simple_timer_state = SIMPLE_TIMER_STATE_STARTED;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t app_simple_timer_stop(void)
-{
-    if(SIMPLE_TIMER_STATE_STARTED == m_simple_timer_state)
-    {
-        nrf_drv_timer_pause(&SIMPLE_TIMER);
-
-        m_simple_timer_state = SIMPLE_TIMER_STATE_STOPPED;
-    }
-
-    return NRF_SUCCESS;
-}
-
-uint32_t app_simple_timer_uninit(void)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    if(SIMPLE_TIMER_STATE_IDLE != m_simple_timer_state)
-    {
-        nrf_drv_timer_uninit(&SIMPLE_TIMER);
-        m_simple_timer_state = SIMPLE_TIMER_STATE_IDLE;
-    }
-
-    return err_code;
-}

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/simple_timer/app_simple_timer.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/simple_timer/app_simple_timer.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/simple_timer/app_simple_timer.h
deleted file mode 100644
index 9bb6c59..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/simple_timer/app_simple_timer.h
+++ /dev/null
@@ -1,106 +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
- *
- * @defgroup lib_driver_simple_timer Simple Timer
- * @{
- * @ingroup  app_common
- *
- * @brief    Simple timer module.
- *
- * Supported features and limitations:
- * - Two modes: single shot mode and repeated mode.
- * - No more than one timer can run simultaneously.
- * - The timer is hard-coded to use the TIMER1 peripheral and compare channel 0.
- */
-
-#ifndef TIMER_H__
-#define TIMER_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Timer time-out handler type. */
-typedef void (*app_simple_timer_timeout_handler_t)(void * p_context);
-
-/**@brief Timer modes. */
-typedef enum
-{
-    APP_SIMPLE_TIMER_MODE_SINGLE_SHOT,   /**< The timer will expire only once. */
-    APP_SIMPLE_TIMER_MODE_REPEATED       /**< The timer will restart each time it expires. */
-} app_simple_timer_mode_t;
-
-/**@brief Function for configuring and setting up the timer hardware. 
- *
- * @note  Configuration parameters should be set in nrf_drv_config.h file.
- *        The TIMER1_CONFIG_MODE has to be set to NRF_TIMER_MODE_TIMER value.
- *        The TIMER1_CONFIG_BIT_WIDTH has to be set to NRF_TIMER_BIT_WIDTH_16 value.
- *
- * @retval NRF_SUCCESS             If the operation is successful.
- * @retval NRF_ERROR_INVALID_STATE If the operation fails because the timer is already initialized.
- * @retval NRF_ERROR_INVALID_PARAM If the operation fails because some configuration parameter is
- *                                 not valid.
- */
-uint32_t app_simple_timer_init(void);
-
-/**@brief Function for starting a timer.
- *
- * @note  If this function is called for a timer that is already running, the currently running 
- *        timer is stopped before starting the new one.
- *
- * @param[in] mode                 Timer mode (see @ref app_simple_timer_mode_t).
- * @param[in] timeout_handler      Function to be executed when the timer expires 
- *                                 (see @ref app_simple_timer_timeout_handler_t).
- * @param[in] timeout_ticks        Number of timer ticks to time-out event.
- * @param[in] p_context            General purpose pointer. Will be passed to the time-out handler 
- *                                 when the timer expires.
- * 
- * @retval NRF_SUCCESS             If the operation is successful.
- * @retval NRF_ERROR_INVALID_STATE If the operation fails because @ref app_simple_timer_init has not
- *                                 been called and the operation is not allowed in this state.
- * @retval NRF_ERROR_NULL          If the operation fails because timeout_handler is NULL.
- * @retval NRF_ERROR_INVALID_PARAM If the operation fails because "mode" parameter is not valid.
- */
- 
-uint32_t app_simple_timer_start(app_simple_timer_mode_t            mode,
-                                app_simple_timer_timeout_handler_t timeout_handler,
-                                uint16_t                           timeout_ticks,
-                                void *                             p_context);
-
-/**@brief Function for stopping the timer.
- *
- * @retval NRF_SUCCESS             If the operation is successful.
- */
-uint32_t app_simple_timer_stop(void);
-
-/**@brief Function for uninitializing the timer. Should be called also when the timer is not used
- *        anymore to reach lowest power consumption in system.
- *
- * @note  The function switches off the internal core of the timer to reach lowest power consumption
- *        in system. The startup time from this state may be longer compared to starting the timer
- *        from the stopped state.
- *
- * @retval NRF_SUCCESS             If the operation is successful.
- */
-uint32_t app_simple_timer_uninit(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // TIMER_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/slip/slip.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/slip/slip.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/slip/slip.c
deleted file mode 100644
index 8e5bad8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/slip/slip.c
+++ /dev/null
@@ -1,112 +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 "slip.h"
-#include "nrf_error.h"
-
-#define SLIP_END             0300    /* indicates end of packet */
-#define SLIP_ESC             0333    /* indicates byte stuffing */
-#define SLIP_ESC_END         0334    /* ESC ESC_END means END data byte */
-#define SLIP_ESC_ESC         0335    /* ESC ESC_ESC means ESC data byte */
-
-
-uint32_t slip_encode(uint8_t * p_output,  uint8_t * p_input, uint32_t input_length, uint32_t output_buffer_length)
-{
-    uint32_t input_index;
-    uint32_t output_index;
-    
-    for (input_index = 0, output_index = 0; input_index < input_length && output_index < output_buffer_length; input_index++)
-    {
-        switch (p_input[input_index])
-        {
-            case SLIP_END:
-                p_output[output_index++] = SLIP_END;
-                p_output[output_index++] = SLIP_ESC_END;
-                break;
-            
-            case SLIP_ESC:
-                p_output[output_index++] = SLIP_ESC;
-                p_output[output_index++] = SLIP_ESC_ESC;
-                break;
-                
-            default:
-                p_output[output_index++] = p_input[input_index];
-        }
-    }
-    p_output[output_index++] = (uint8_t)SLIP_END;
-    p_output[output_index++] = (uint8_t)SLIP_END; // clarify that the packet has ended.
-    
-    return output_index;
-}
-
-
-uint32_t slip_decoding_add_char(uint8_t c, buffer_t * p_buf, slip_state_t * current_state)
-{   
-    switch (*current_state)
-    {
-        case SLIP_DECODING:
-            if (c == SLIP_END)
-            {
-                *current_state = SLIP_END_RECEIVED;
-            }
-            else if (c == SLIP_ESC)
-            {
-                *current_state = SLIP_END_RECEIVED;
-            }
-            else 
-            {
-                p_buf->p_buffer[p_buf->current_index++] = c;
-                p_buf->current_length++;
-            }
-            break;
-        
-        case SLIP_ESC_RECEIVED:
-            if (c == SLIP_ESC_ESC)
-            {
-                p_buf->p_buffer[p_buf->current_index++] = SLIP_ESC; 
-                p_buf->current_length++;  
-                *current_state = SLIP_DECODING;                
-            }
-            else
-            {
-                // violation of protocol
-                *current_state = SLIP_CLEARING_INVALID_PACKET;
-                return NRF_ERROR_INVALID_DATA;
-            }
-            break;
-            
-        case SLIP_END_RECEIVED:
-            if (c == SLIP_ESC_END)
-            {
-                p_buf->p_buffer[p_buf->current_index++] = SLIP_END;
-                p_buf->current_length++;
-                *current_state = SLIP_DECODING;
-            }
-            else 
-            {
-                // packet is finished
-                *current_state = SLIP_DECODING;                 
-                return NRF_SUCCESS;
-            }
-            break;       
-        
-        case SLIP_CLEARING_INVALID_PACKET:
-            if (c == SLIP_END)
-            {
-                *current_state = SLIP_DECODING;        
-                p_buf->current_index = 0;
-                p_buf->current_length = 0;
-            }
-            break;
-    } 
-    return NRF_ERROR_BUSY;
-}

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/slip/slip.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/slip/slip.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/slip/slip.h
deleted file mode 100644
index ac8b7f8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/slip/slip.h
+++ /dev/null
@@ -1,74 +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.
- *
- */
- 
-#ifndef SLIP_H__
-#define SLIP_H__
-
-#include <stdint.h>
-#include "app_fifo.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @file
- *
- * @defgroup slip SLIP encoding decoding
- * @{
- * @ingroup app_common
- *
- * @brief  This module encodes and decodes slip packages (RFC1055).
- *
- * @details The standard is described in https://tools.ietf.org/html/rfc1055
- */
-  
-typedef enum {
-    SLIP_DECODING,
-    SLIP_END_RECEIVED,
-    SLIP_ESC_RECEIVED,
-    SLIP_CLEARING_INVALID_PACKET,
-} slip_state_t;
-
-typedef struct {
-    uint8_t * p_buffer;
-    uint32_t current_index;
-    uint32_t current_length;
-    uint32_t len;
-} buffer_t; 
-  
-/**@brief Encodes a slip packet.
- * 
- * @details Note that the encoded output data will be longer than the input data. 
- *
- * @retval The length of the encoded packet. If it is smaller than the input length, an error has occurred. 
- */
-uint32_t slip_encode(uint8_t * p_output,  uint8_t * p_input, uint32_t input_length, uint32_t output_buffer_length);
-
-/**@brief Decodes a slip packet.
- * 
- * @details When decoding a slip packet, a state must be preserved. Initial state must be set to SLIP_DECODING.
- *
- * @retval NRF_SUCCESS when a packet is parsed. The length of the packet can be read out from p_buf->current_index
- * @retval NRF_ERROR_BUSY when packet is not finished parsing
- * @retval NRF_ERROR_INVALID_DATA when packet is encoded wrong. 
-           This moves the decoding to SLIP_CLEARING_INVALID_PACKET, and will stay in this state until SLIP_END is encountered.
- */
-uint32_t slip_decoding_add_char(uint8_t c, buffer_t * p_buf, slip_state_t * current_state);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SLIP_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/timer/app_timer.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer.c
deleted file mode 100644
index d19f009..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-/* Copyright (c) 2012 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 "app_timer.h"
-#include <stdlib.h>
-#include "nrf.h"
-#include "nrf_soc.h"
-#include "app_error.h"
-#include "nrf_delay.h"
-#include "app_util_platform.h"
-#include "sdk_common.h"
-
-#define RTC1_IRQ_PRI            APP_IRQ_PRIORITY_LOW                        /**< Priority of the RTC1 interrupt (used for checking for timeouts and executing timeout handlers). */
-#define SWI_IRQ_PRI             APP_IRQ_PRIORITY_LOW                        /**< Priority of the SWI  interrupt (used for updating the timer list). */
-
-// The current design assumes that both interrupt handlers run at the same interrupt level.
-// If this is to be changed, protection must be added to prevent them from interrupting each other
-// (e.g. by using guard/trigger flags).
-STATIC_ASSERT(RTC1_IRQ_PRI == SWI_IRQ_PRI);
-
-#define MAX_RTC_COUNTER_VAL     0x00FFFFFF                                  /**< Maximum value of the RTC counter. */
-
-#define APP_HIGH_USER_ID        0                                           /**< User Id for the Application High "user". */
-#define APP_LOW_USER_ID         1                                           /**< User Id for the Application Low "user". */
-#define THREAD_MODE_USER_ID     2                                           /**< User Id for the Thread Mode "user". */
-
-#define RTC_COMPARE_OFFSET_MIN  3                                           /**< Minimum offset between the current RTC counter value and the Capture Compare register. Although the nRF51 Series User Specification recommends this value to be 2, we use 3 to be safer.*/
-
-#define MAX_RTC_TASKS_DELAY     47                                          /**< Maximum delay until an RTC task is executed. */
-
-#ifdef NRF51
-#define SWI_IRQn SWI0_IRQn
-#define SWI_IRQHandler SWI0_IRQHandler
-#elif defined NRF52
-#define SWI_IRQn SWI0_EGU0_IRQn
-#define SWI_IRQHandler SWI0_EGU0_IRQHandler
-#endif
-
-/**@brief Timer node type. The nodes will be used form a linked list of running timers. */
-typedef struct
-{
-    uint32_t                    ticks_to_expire;                            /**< Number of ticks from previous timer interrupt to timer expiry. */
-    uint32_t                    ticks_at_start;                             /**< Current RTC counter value when the timer was started. */
-    uint32_t                    ticks_first_interval;                       /**< Number of ticks in the first timer interval. */
-    uint32_t                    ticks_periodic_interval;                    /**< Timer period (for repeating timers). */
-    bool                        is_running;                                 /**< True if timer is running, False otherwise. */
-    app_timer_mode_t            mode;                                       /**< Timer mode. */
-    app_timer_timeout_handler_t p_timeout_handler;                          /**< Pointer to function to be executed when the timer expires. */
-    void *                      p_context;                                  /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */
-    void *                      next;                                       /**< Pointer to the next node. */
-} timer_node_t;
-
-STATIC_ASSERT(sizeof(timer_node_t) == APP_TIMER_NODE_SIZE);
-
-/**@brief Set of available timer operation types. */
-typedef enum
-{
-    TIMER_USER_OP_TYPE_NONE,                                                /**< Invalid timer operation type. */
-    TIMER_USER_OP_TYPE_START,                                               /**< Timer operation type Start. */
-    TIMER_USER_OP_TYPE_STOP,                                                /**< Timer operation type Stop. */
-    TIMER_USER_OP_TYPE_STOP_ALL                                             /**< Timer operation type Stop All. */
-} timer_user_op_type_t;
-
-/**@brief Structure describing a timer start operation. */
-typedef struct
-{
-    uint32_t ticks_at_start;                                                /**< Current RTC counter value when the timer was started. */
-    uint32_t ticks_first_interval;                                          /**< Number of ticks in the first timer interval. */
-    uint32_t ticks_periodic_interval;                                       /**< Timer period (for repeating timers). */
-    void *   p_context;                                                     /**< General purpose pointer. Will be passed to the timeout handler when the timer expires. */
-} timer_user_op_start_t;
-
-/**@brief Structure describing a timer operation. */
-typedef struct
-{
-    timer_user_op_type_t op_type;                                             /**< Id of timer on which the operation is to be performed. */
-    timer_node_t *       p_node;
-    union
-    {
-        timer_user_op_start_t start;                                        /**< Structure describing a timer start operation. */
-    } params;
-} timer_user_op_t;
-
-STATIC_ASSERT(sizeof(timer_user_op_t) <= APP_TIMER_USER_OP_SIZE);
-STATIC_ASSERT(sizeof(timer_user_op_t) % 4 == 0);
-
-/**@brief Structure describing a timer user.
- *
- * @details For each user of the timer module, there will be a timer operations queue. This queue
- *          will hold timer operations issued by this user until the timer interrupt handler
- *          processes these operations. For the current implementation, there will be one user for
- *          each interrupt level available to the application (APP_HIGH, APP_LOW and THREAD_MODE),
- *          but the module can easily be modified to e.g. have one queue per process when using an
- *          RTOS. The purpose of the queues is to be able to have a completely lockless timer
- *          implementation.
- */
-typedef struct
-{
-    uint8_t           first;                                                    /**< Index of first entry to have been inserted in the queue (i.e. the next entry to be executed). */
-    uint8_t           last;                                                     /**< Index of last entry to have been inserted in the queue. */
-    uint8_t           user_op_queue_size;                                       /**< Queue size. */
-    timer_user_op_t * p_user_op_queue;                                          /**< Queue buffer. */
-} timer_user_t;
-
-STATIC_ASSERT(sizeof(timer_user_t) == APP_TIMER_USER_SIZE);
-STATIC_ASSERT(sizeof(timer_user_t) % 4 == 0);
-
-/**@brief User id type.
- *
- * @details In the current implementation, this will automatically be generated from the current
- *          interrupt level.
- */
-typedef uint32_t timer_user_id_t;
-
-#define CONTEXT_QUEUE_SIZE_MAX      (2)                 
-
-static uint8_t                       m_user_array_size;                         /**< Size of timer user array. */
-static timer_user_t *                mp_users = NULL;                           /**< Array of timer users. */
-static timer_node_t *                mp_timer_id_head;                          /**< First timer in list of running timers. */
-static uint32_t                      m_ticks_latest;                            /**< Last known RTC counter value. */
-static uint32_t                      m_ticks_elapsed[CONTEXT_QUEUE_SIZE_MAX];   /**< Timer internal elapsed ticks queue. */
-static uint8_t                       m_ticks_elapsed_q_read_ind;                /**< Timer internal elapsed ticks queue read index. */
-static uint8_t                       m_ticks_elapsed_q_write_ind;               /**< Timer internal elapsed ticks queue write index. */
-static app_timer_evt_schedule_func_t m_evt_schedule_func;                       /**< Pointer to function for propagating timeout events to the scheduler. */
-static bool                          m_rtc1_running;                            /**< Boolean indicating if RTC1 is running. */
-static bool                          m_rtc1_reset;                              /**< Boolean indicating if RTC1 counter has been reset due to last timer removed from timer list during the timer list handling. */
-
-#ifdef APP_TIMER_WITH_PROFILER
-static uint8_t                      m_max_user_op_queue_utilization;                  /**< Maximum observed timer user operations queue utilization. */
-#endif
-
-#define MODULE_INITIALIZED (mp_users != NULL)
-#include "sdk_macros.h"
-
-/**@brief Function for initializing the RTC1 counter.
- *
- * @param[in] prescaler   Value of the RTC1 PRESCALER register. Set to 0 for no prescaling.
- */
-static void rtc1_init(uint32_t prescaler)
-{
-    NRF_RTC1->PRESCALER = prescaler;
-    NVIC_SetPriority(RTC1_IRQn, RTC1_IRQ_PRI);
-}
-
-
-/**@brief Function for starting the RTC1 timer.
- */
-static void rtc1_start(void)
-{
-    NRF_RTC1->EVTENSET = RTC_EVTEN_COMPARE0_Msk;
-    NRF_RTC1->INTENSET = RTC_INTENSET_COMPARE0_Msk;
-
-    NVIC_ClearPendingIRQ(RTC1_IRQn);
-    NVIC_EnableIRQ(RTC1_IRQn);
-
-    NRF_RTC1->TASKS_START = 1;
-    nrf_delay_us(MAX_RTC_TASKS_DELAY);
-
-    m_rtc1_running = true;
-}
-
-
-/**@brief Function for stopping the RTC1 timer.
- */
-static void rtc1_stop(void)
-{
-    NVIC_DisableIRQ(RTC1_IRQn);
-
-    NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE0_Msk;
-    NRF_RTC1->INTENCLR = RTC_INTENSET_COMPARE0_Msk;
-
-    NRF_RTC1->TASKS_STOP = 1;
-    nrf_delay_us(MAX_RTC_TASKS_DELAY);
-
-    NRF_RTC1->TASKS_CLEAR = 1;
-    m_ticks_latest        = 0;
-    nrf_delay_us(MAX_RTC_TASKS_DELAY);
-
-    m_rtc1_running = false;
-}
-
-
-/**@brief Function for returning the current value of the RTC1 counter.
- *
- * @return     Current value of the RTC1 counter.
- */
-static __INLINE uint32_t rtc1_counter_get(void)
-{
-    return NRF_RTC1->COUNTER;
-}
-
-
-/**@brief Function for computing the difference between two RTC1 counter values.
- *
- * @return     Number of ticks elapsed from ticks_old to ticks_now.
- */
-static __INLINE uint32_t ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old)
-{
-    return ((ticks_now - ticks_old) & MAX_RTC_COUNTER_VAL);
-}
-
-
-/**@brief Function for setting the RTC1 Capture Compare register 0, and enabling the corresponding
- *        event.
- *
- * @param[in] value   New value of Capture Compare register 0.
- */
-static __INLINE void rtc1_compare0_set(uint32_t value)
-{
-    NRF_RTC1->CC[0] = value;
-}
-
-
-/**@brief Function for inserting a timer in the timer list.
- *
- * @param[in]  timer_id   Id of timer to insert.
- */
-static void timer_list_insert(timer_node_t * p_timer)
-{
-    if (mp_timer_id_head == NULL)
-    {
-        mp_timer_id_head = p_timer;
-    }
-    else
-    {
-        if (p_timer->ticks_to_expire <= mp_timer_id_head->ticks_to_expire)
-        {
-            mp_timer_id_head->ticks_to_expire -= p_timer->ticks_to_expire;
-            
-            p_timer->next   = mp_timer_id_head;
-            mp_timer_id_head = p_timer;
-        }
-        else
-        {
-            timer_node_t * p_previous;
-            timer_node_t * p_current;
-            uint32_t       ticks_to_expire;
-
-            ticks_to_expire   = p_timer->ticks_to_expire;
-            p_previous        = mp_timer_id_head;
-            p_current         = mp_timer_id_head;
-            
-            while ((p_current != NULL) && (ticks_to_expire > p_current->ticks_to_expire))
-            {
-                ticks_to_expire   -= p_current->ticks_to_expire;
-                p_previous         = p_current;
-                p_current          = p_current->next;
-            }
-
-            if (p_current != NULL)
-            {
-                p_current->ticks_to_expire -= ticks_to_expire;
-            }
-
-            p_timer->ticks_to_expire = ticks_to_expire;
-            p_timer->next            = p_current;
-            p_previous->next         = p_timer;
-        }
-    }
-}
-
-
-/**@brief Function for removing a timer from the timer queue.
- *
- * @param[in]  timer_id   Id of timer to remove.
- */
-static void timer_list_remove(timer_node_t * p_timer)
-{
-    timer_node_t * p_previous;
-    timer_node_t * p_current;
-    uint32_t       timeout;
-
-    // Find the timer's position in timer list.
-    p_previous = mp_timer_id_head;
-    p_current  = p_previous;
-    
-    while (p_current != NULL)
-    {
-        if (p_current == p_timer)
-        {
-            break;
-        }
-        p_previous = p_current;
-        p_current  = p_current->next;
-    }
-
-    // Timer not in active list.
-    if (p_current == NULL)
-    {
-        return;
-    }
-
-    // Timer is the first in the list
-    if (p_previous == p_current)
-    {
-        mp_timer_id_head = mp_timer_id_head->next;
-
-        // No more timers in the list. Reset RTC1 in case Start timer operations are present in the queue.
-        if (mp_timer_id_head == NULL)
-        {
-            NRF_RTC1->TASKS_CLEAR = 1;
-            m_ticks_latest        = 0;
-            m_rtc1_reset          = true;
-        }
-    }
-
-    // Remaining timeout between next timeout.
-    timeout = p_current->ticks_to_expire;
-
-    // Link previous timer with next of this timer, i.e. removing the timer from list.
-    p_previous->next = p_current->next;
-
-    // If this is not the last timer, increment the next timer by this timer timeout.
-    p_current = p_previous->next;
-    if (p_current != NULL)
-    {
-        p_current->ticks_to_expire += timeout;
-    }
-}
-
-
-/**@brief Function for scheduling a check for timeouts by generating a RTC1 interrupt.
- */
-static void timer_timeouts_check_sched(void)
-{
-    NVIC_SetPendingIRQ(RTC1_IRQn);
-}
-
-
-/**@brief Function for scheduling a timer list update by generating a SWI interrupt.
- */
-static void timer_list_handler_sched(void)
-{
-    NVIC_SetPendingIRQ(SWI_IRQn);
-}
-
-
-/**@brief Function for executing an application timeout handler, either by calling it directly, or
- *        by passing an event to the @ref app_scheduler.
- *
- * @param[in]  p_timer   Pointer to expired timer.
- */
-static void timeout_handler_exec(timer_node_t * p_timer)
-{
-    if (m_evt_schedule_func != NULL)
-    {
-        uint32_t err_code = m_evt_schedule_func(p_timer->p_timeout_handler, p_timer->p_context);
-        APP_ERROR_CHECK(err_code);
-    }
-    else
-    {
-        p_timer->p_timeout_handler(p_timer->p_context);
-    }
-}
-
-
-/**@brief Function for checking for expired timers.
- */
-static void timer_timeouts_check(void)
-{
-    // Handle expired of timer 
-    if (mp_timer_id_head != NULL)
-    {
-        timer_node_t *  p_timer;
-        timer_node_t *  p_previous_timer;
-        uint32_t        ticks_elapsed;
-        uint32_t        ticks_expired;
-
-        // Initialize actual elapsed ticks being consumed to 0.
-        ticks_expired = 0;
-
-        // ticks_elapsed is collected here, job will use it.
-        ticks_elapsed = ticks_diff_get(rtc1_counter_get(), m_ticks_latest);
-
-        // Auto variable containing the head of timers expiring.
-        p_timer = mp_timer_id_head;
-
-        // Expire all timers within ticks_elapsed and collect ticks_expired.
-        while (p_timer != NULL)
-        {
-            // Do nothing if timer did not expire.
-            if (ticks_elapsed < p_timer->ticks_to_expire)
-            {
-                break;
-            }
-
-            // Decrement ticks_elapsed and collect expired ticks.
-            ticks_elapsed -= p_timer->ticks_to_expire;
-            ticks_expired += p_timer->ticks_to_expire;
-
-            // Move to next timer.
-            p_previous_timer = p_timer;
-            p_timer = p_timer->next;
-
-            // Execute Task.
-            if (p_previous_timer->is_running)
-            {
-                p_previous_timer->is_running = false;
-                timeout_handler_exec(p_previous_timer);
-            }
-        }
-
-        // Prepare to queue the ticks expired in the m_ticks_elapsed queue.
-        if (m_ticks_elapsed_q_read_ind == m_ticks_elapsed_q_write_ind)
-        {
-            // The read index of the queue is equal to the write index. This means the new
-            // value of ticks_expired should be stored at a new location in the m_ticks_elapsed
-            // queue (which is implemented as a double buffer).
-
-            // Check if there will be a queue overflow.
-            if (++m_ticks_elapsed_q_write_ind == CONTEXT_QUEUE_SIZE_MAX)
-            {
-                // There will be a queue overflow. Hence the write index should point to the start
-                // of the queue.
-                m_ticks_elapsed_q_write_ind = 0;
-            }
-        }
-
-        // Queue the ticks expired.
-        m_ticks_elapsed[m_ticks_elapsed_q_write_ind] = ticks_expired;
-
-        timer_list_handler_sched();
-    }
-}
-
-
-/**@brief Function for acquiring the number of ticks elapsed.
- *
- * @param[out] p_ticks_elapsed   Number of ticks elapsed.
- *
- * @return     TRUE if elapsed ticks was read from queue, FALSE otherwise.
- */
-static bool elapsed_ticks_acquire(uint32_t * p_ticks_elapsed)
-{
-    // Pick the elapsed value from queue.
-    if (m_ticks_elapsed_q_read_ind != m_ticks_elapsed_q_write_ind)
-    {
-        // Dequeue elapsed value.
-        m_ticks_elapsed_q_read_ind++;
-        if (m_ticks_elapsed_q_read_ind == CONTEXT_QUEUE_SIZE_MAX)
-        {
-            m_ticks_elapsed_q_read_ind = 0;
-        }
-
-        *p_ticks_elapsed = m_ticks_elapsed[m_ticks_elapsed_q_read_ind];
-
-        m_ticks_latest += *p_ticks_elapsed;
-        m_ticks_latest &= MAX_RTC_COUNTER_VAL;
-
-        return true;
-    }
-    else
-    {
-        // No elapsed value in queue.
-        *p_ticks_elapsed = 0;
-        return false;
-    }
-}
-
-
-/**@brief Function for handling the timer list deletions.
- *
- * @return     TRUE if Capture Compare register must be updated, FALSE otherwise.
- */
-static bool list_deletions_handler(void)
-{
-    timer_node_t * p_timer_old_head;
-    uint8_t        user_id;
-
-    // Remember the old head, so as to decide if new compare needs to be set.
-    p_timer_old_head = mp_timer_id_head;
-
-    user_id = m_user_array_size;
-    while (user_id--)
-    {
-        timer_user_t * p_user         = &mp_users[user_id];
-        uint8_t        user_ops_first = p_user->first;
-        
-        while (user_ops_first != p_user->last)
-        {
-            timer_user_op_t * p_user_op = &p_user->p_user_op_queue[user_ops_first];
-
-            // Traverse to next operation in queue.
-            user_ops_first++;
-            if (user_ops_first == p_user->user_op_queue_size)
-            {
-                user_ops_first = 0;
-            }
-
-            switch (p_user_op->op_type)
-            {
-                case TIMER_USER_OP_TYPE_STOP:
-                    // Delete node if timer is running.
-                    timer_list_remove(p_user_op->p_node);
-                    break;
-                    
-                case TIMER_USER_OP_TYPE_STOP_ALL:
-                    // Delete list of running timers, and mark all timers as not running.
-                    while (mp_timer_id_head != NULL)
-                    {
-                        timer_node_t * p_head = mp_timer_id_head;
-
-                        p_head->is_running = false;
-                        mp_timer_id_head    = p_head->next;
-                    }
-                    break;
-                    
-                default:
-                    // No implementation needed.
-                    break;
-            }
-        }
-    }
-
-    // Detect change in head of the list.
-    return (mp_timer_id_head != p_timer_old_head);
-}
-
-
-/**@brief Function for updating the timer list for expired timers.
- *
- * @param[in]  ticks_elapsed         Number of elapsed ticks.
- * @param[in]  ticks_previous        Previous known value of the RTC counter.
- * @param[out] p_restart_list_head   List of repeating timers to be restarted.
- */
-static void expired_timers_handler(uint32_t         ticks_elapsed,
-                                   uint32_t         ticks_previous,
-                                   timer_node_t **  p_restart_list_head)
-{
-    uint32_t ticks_expired = 0;
-
-    while (mp_timer_id_head != NULL)
-    {
-        timer_node_t * p_timer;
-        timer_node_t * p_timer_expired;
-
-        // Auto variable for current timer node.
-        p_timer = mp_timer_id_head;
-
-        // Do nothing if timer did not expire 
-        if (ticks_elapsed < p_timer->ticks_to_expire)
-        {
-            p_timer->ticks_to_expire -= ticks_elapsed;
-            break;
-        }
-
-        // Decrement ticks_elapsed and collect expired ticks.
-        ticks_elapsed -= p_timer->ticks_to_expire;
-        ticks_expired += p_timer->ticks_to_expire;
-
-        // Timer expired, set ticks_to_expire zero.
-        p_timer->ticks_to_expire = 0;
-
-        // Remove the expired timer from head.
-        p_timer_expired  = mp_timer_id_head;
-        mp_timer_id_head = p_timer->next;
-
-        // Timer will be restarted if periodic.
-        if (p_timer->ticks_periodic_interval != 0)
-        {
-            p_timer->ticks_at_start       = (ticks_previous + ticks_expired) & MAX_RTC_COUNTER_VAL;
-            p_timer->ticks_first_interval = p_timer->ticks_periodic_interval;
-            p_timer->next                 = *p_restart_list_head;
-            *p_restart_list_head          = p_timer_expired;
-        }
-    }
-}
-
-
-/**@brief Function for handling timer list insertions.
- *
- * @param[in]  p_restart_list_head   List of repeating timers to be restarted.
- *
- * @return     TRUE if Capture Compare register must be updated, FALSE otherwise.
- */
-static bool list_insertions_handler(timer_node_t * p_restart_list_head)
-{
-    timer_node_t * p_timer_id_old_head;
-    uint8_t        user_id;
-
-    // Remember the old head, so as to decide if new compare needs to be set.
-    p_timer_id_old_head = mp_timer_id_head;
-
-    user_id = m_user_array_size;
-    while (user_id--)
-    {
-        timer_user_t * p_user = &mp_users[user_id];
-
-        // Handle insertions of timers.
-        while ((p_restart_list_head != NULL) || (p_user->first != p_user->last))
-        {
-            timer_node_t * p_timer;
-
-            if (p_restart_list_head != NULL)
-            {
-                p_timer           = p_restart_list_head;
-                p_restart_list_head = p_timer->next;
-            }
-            else
-            {
-                timer_user_op_t * p_user_op = &p_user->p_user_op_queue[p_user->first];
-
-                p_user->first++;
-                if (p_user->first == p_user->user_op_queue_size)
-                {
-                    p_user->first = 0;
-                }
-
-                p_timer = p_user_op->p_node;
-
-                if ((p_user_op->op_type != TIMER_USER_OP_TYPE_START) || p_timer->is_running)
-                {
-                    continue;
-                }
-
-                p_timer->ticks_at_start          = p_user_op->params.start.ticks_at_start;
-                p_timer->ticks_first_interval    = p_user_op->params.start.ticks_first_interval;
-                p_timer->ticks_periodic_interval = p_user_op->params.start.ticks_periodic_interval;
-                p_timer->p_context               = p_user_op->params.start.p_context;
-
-                if (m_rtc1_reset)
-                {
-                    p_timer->ticks_at_start = 0;
-                }
-            }
-
-            // Prepare the node to be inserted.
-            if (
-                 ((p_timer->ticks_at_start - m_ticks_latest) & MAX_RTC_COUNTER_VAL)
-                 <
-                 (MAX_RTC_COUNTER_VAL / 2)
-                )
-            {
-                p_timer->ticks_to_expire = ticks_diff_get(p_timer->ticks_at_start, m_ticks_latest) + 
-                                           p_timer->ticks_first_interval;
-            }
-            else
-            {
-                uint32_t delta_current_start;
-
-                delta_current_start = ticks_diff_get(m_ticks_latest, p_timer->ticks_at_start);
-                if (p_timer->ticks_first_interval > delta_current_start)
-                {
-                    p_timer->ticks_to_expire = p_timer->ticks_first_interval - delta_current_start;
-                }
-                else
-                {
-                    p_timer->ticks_to_expire = 0;
-                }
-            }
-
-            p_timer->ticks_at_start       = 0;
-            p_timer->ticks_first_interval = 0;
-            p_timer->is_running           = true;
-            p_timer->next                 = NULL;
-
-            // Insert into list 
-            timer_list_insert(p_timer);
-        }
-    }
-    
-    return (mp_timer_id_head != p_timer_id_old_head);
-}
-
-
-/**@brief Function for updating the Capture Compare register.
- */
-static void compare_reg_update(timer_node_t * p_timer_id_head_old)
-{
-    // Setup the timeout for timers on the head of the list 
-    if (mp_timer_id_head != NULL)
-    {
-        uint32_t ticks_to_expire = mp_timer_id_head->ticks_to_expire;
-        uint32_t pre_counter_val = rtc1_counter_get();
-        uint32_t cc              = m_ticks_latest;
-        uint32_t ticks_elapsed   = ticks_diff_get(pre_counter_val, cc) + RTC_COMPARE_OFFSET_MIN;
-
-        if (!m_rtc1_running)
-        {
-            // No timers were already running, start RTC
-            rtc1_start();
-        }
-
-        cc += (ticks_elapsed < ticks_to_expire) ? ticks_to_expire : ticks_elapsed;
-        cc &= MAX_RTC_COUNTER_VAL;
-        
-        rtc1_compare0_set(cc);
-
-        uint32_t post_counter_val = rtc1_counter_get();
-
-        if (
-            (ticks_diff_get(post_counter_val, pre_counter_val) + RTC_COMPARE_OFFSET_MIN)
-            >
-            ticks_diff_get(cc, pre_counter_val)
-           )
-        {
-            // When this happens the COMPARE event may not be triggered by the RTC.
-            // The nRF51 Series User Specification states that if the COUNTER value is N
-            // (i.e post_counter_val = N), writing N or N+1 to a CC register may not trigger a
-            // COMPARE event. Hence the RTC interrupt is forcefully pended by calling the following
-            // function.
-            rtc1_compare0_set(rtc1_counter_get());  // this should prevent CC to fire again in the background while the code is in RTC-ISR
-            nrf_delay_us(MAX_RTC_TASKS_DELAY);
-            timer_timeouts_check_sched();
-        }
-    }
-    else
-    {
-        // No timers are running, stop RTC
-        rtc1_stop();
-    }
-}
-
-
-/**@brief Function for handling changes to the timer list.
- */
-static void timer_list_handler(void)
-{
-    timer_node_t * p_restart_list_head = NULL;
-
-    uint32_t       ticks_elapsed;
-    uint32_t       ticks_previous;
-    bool           ticks_have_elapsed;
-    bool           compare_update;
-    timer_node_t * p_timer_id_head_old;
-    
-#ifdef APP_TIMER_WITH_PROFILER
-    {
-        unsigned int i;
-
-        for (i = 0; i < APP_TIMER_INT_LEVELS; i++)
-        {
-            timer_user_t *p_user = &mp_users[i];
-            uint8_t size = p_user->user_op_queue_size;
-            uint8_t first = p_user->first;
-            uint8_t last = p_user->last;
-            uint8_t utilization = (first <= last) ? (last - first) : (size + 1 - first + last);
-
-            if (utilization > m_max_user_op_queue_utilization)
-            {
-                m_max_user_op_queue_utilization = utilization;
-            }
-        }
-    }
-#endif
-
-    // Back up the previous known tick and previous list head
-    ticks_previous    = m_ticks_latest;
-    p_timer_id_head_old = mp_timer_id_head;
-    
-    // Get number of elapsed ticks
-    ticks_have_elapsed = elapsed_ticks_acquire(&ticks_elapsed);
-
-    // Handle list deletions
-    compare_update = list_deletions_handler();
-    
-    // Handle expired timers
-    if (ticks_have_elapsed)
-    {
-        expired_timers_handler(ticks_elapsed, ticks_previous, &p_restart_list_head);
-        compare_update = true;
-    }
-    
-    // Handle list insertions
-    if (list_insertions_handler(p_restart_list_head))
-    {
-        compare_update = true;
-    }
-
-    // Update compare register if necessary
-    if (compare_update)
-    {
-        compare_reg_update(p_timer_id_head_old);
-    }
-    m_rtc1_reset = false;
-}
-
-
-/**@brief Function for enqueueing a new operations queue entry.
- *
- * @param[in]  p_user     User that the entry is to be enqueued for.
- * @param[in]  last_index Index of the next last index to be enqueued.
- */
-static void user_op_enque(timer_user_t * p_user, uint8_t last_index)
-{
-    p_user->last = last_index;
-}
-
-
-/**@brief Function for allocating a new operations queue entry.
- *
- * @param[in]  p_user       User that the entry is to be allocated for.
- * @param[out] p_last_index Index of the next last index to be enqueued.
- *
- * @return     Pointer to allocated queue entry, or NULL if queue is full.
- */
-static timer_user_op_t * user_op_alloc(timer_user_t * p_user, uint8_t * p_last_index)
-{        
-    uint8_t           last;
-    timer_user_op_t * p_user_op;
-    
-    last = p_user->last + 1;
-    if (last == p_user->user_op_queue_size)
-    {
-        // Overflow case.
-        last = 0;
-    }
-    if (last == p_user->first)
-    {
-        // Queue is full.
-        return NULL;
-    }
-    
-    *p_last_index = last;    
-    p_user_op     = &p_user->p_user_op_queue[p_user->last];
-        
-    return p_user_op;
-}
-
-
-/**@brief Function for scheduling a Timer Start operation.
- *
- * @param[in]  user_id           Id of user calling this function.
- * @param[in]  timer_id          Id of timer to start.
- * @param[in]  timeout_initial   Time (in ticks) to first timer expiry.
- * @param[in]  timeout_periodic  Time (in ticks) between periodic expiries.
- * @param[in]  p_context         General purpose pointer. Will be passed to the timeout handler when
- *                               the timer expires.
- * @return     NRF_SUCCESS on success, otherwise an error code.
- */
-static uint32_t timer_start_op_schedule(timer_user_id_t user_id,
-                                        timer_node_t * p_node,
-                                        uint32_t        timeout_initial,
-                                        uint32_t        timeout_periodic,
-                                        void *          p_context)
-{
-    uint8_t last_index;
-    
-    timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index);
-    if (p_user_op == NULL)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    
-    p_user_op->op_type                              = TIMER_USER_OP_TYPE_START;
-    p_user_op->p_node                               = p_node;
-    p_user_op->params.start.ticks_at_start          = rtc1_counter_get();
-    p_user_op->params.start.ticks_first_interval    = timeout_initial;
-    p_user_op->params.start.ticks_periodic_interval = timeout_periodic;
-    p_user_op->params.start.p_context               = p_context;
-    
-    user_op_enque(&mp_users[user_id], last_index);    
-
-    timer_list_handler_sched();
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for scheduling a Timer Stop operation.
- *
- * @param[in]  user_id    Id of user calling this function.
- * @param[in]  timer_id   Id of timer to stop.
- *
- * @return NRF_SUCCESS on successful scheduling a timer stop operation. NRF_ERROR_NO_MEM when there
- *         is no memory left to schedule the timer stop operation.
- */
-static uint32_t timer_stop_op_schedule(timer_user_id_t user_id, timer_node_t * p_node)
-{
-    uint8_t last_index;
-    
-    timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index);
-    if (p_user_op == NULL)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    
-    p_user_op->op_type  = TIMER_USER_OP_TYPE_STOP;
-    p_user_op->p_node = p_node;
-    
-    user_op_enque(&mp_users[user_id], last_index);        
-
-    timer_list_handler_sched();
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for scheduling a Timer Stop All operation.
- *
- * @param[in]  user_id    Id of user calling this function.
- */
-static uint32_t timer_stop_all_op_schedule(timer_user_id_t user_id)
-{
-    uint8_t last_index;
-    
-    timer_user_op_t * p_user_op = user_op_alloc(&mp_users[user_id], &last_index);
-    if (p_user_op == NULL)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-    
-    p_user_op->op_type  = TIMER_USER_OP_TYPE_STOP_ALL;
-    p_user_op->p_node = NULL;
-    
-    user_op_enque(&mp_users[user_id], last_index);        
-
-    timer_list_handler_sched();
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for handling the RTC1 interrupt.
- *
- * @details Checks for timeouts, and executes timeout handlers for expired timers.
- */
-void RTC1_IRQHandler(void)
-{
-    // Clear all events (also unexpected ones)
-    NRF_RTC1->EVENTS_COMPARE[0] = 0;
-    NRF_RTC1->EVENTS_COMPARE[1] = 0;
-    NRF_RTC1->EVENTS_COMPARE[2] = 0;
-    NRF_RTC1->EVENTS_COMPARE[3] = 0;
-    NRF_RTC1->EVENTS_TICK       = 0;
-    NRF_RTC1->EVENTS_OVRFLW     = 0;
-
-    // Check for expired timers
-    timer_timeouts_check();
-}
-
-
-/**@brief Function for handling the SWI interrupt.
- *
- * @details Performs all updates to the timer list.
- */
-void SWI_IRQHandler(void)
-{
-    timer_list_handler();
-}
-
-
-uint32_t app_timer_init(uint32_t                      prescaler,
-                        uint8_t                       op_queues_size,
-                        void *                        p_buffer,
-                        app_timer_evt_schedule_func_t evt_schedule_func)
-{
-    int i;
-
-    // Check that buffer is correctly aligned
-    if (!is_word_aligned(p_buffer))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    // Check for NULL buffer
-    if (p_buffer == NULL)
-    {
-        mp_users = NULL;
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    
-    // Stop RTC to prevent any running timers from expiring (in case of reinitialization)
-    rtc1_stop();
-    
-    m_evt_schedule_func = evt_schedule_func;
-    
-    // Initialize users array
-    m_user_array_size = APP_TIMER_INT_LEVELS;
-    mp_users          = p_buffer;
-    
-    // Skip user array
-    p_buffer = &((uint8_t *)p_buffer)[APP_TIMER_INT_LEVELS * sizeof(timer_user_t)];
-
-    // Initialize operation queues
-    for (i = 0; i < APP_TIMER_INT_LEVELS; i++)
-    {
-        timer_user_t * p_user = &mp_users[i];
-        
-        p_user->first              = 0;
-        p_user->last               = 0;
-        p_user->user_op_queue_size = op_queues_size;
-        p_user->p_user_op_queue    = p_buffer;
-    
-        // Skip operation queue
-        p_buffer = &((uint8_t *)p_buffer)[op_queues_size * sizeof(timer_user_op_t)];
-    }
-
-    mp_timer_id_head             = NULL;
-    m_ticks_elapsed_q_read_ind  = 0;
-    m_ticks_elapsed_q_write_ind = 0;
-
-#ifdef APP_TIMER_WITH_PROFILER
-    m_max_user_op_queue_utilization   = 0;
-#endif
-
-    NVIC_ClearPendingIRQ(SWI_IRQn);
-    NVIC_SetPriority(SWI_IRQn, SWI_IRQ_PRI);
-    NVIC_EnableIRQ(SWI_IRQn);
-
-    rtc1_init(prescaler);
-
-    m_ticks_latest = rtc1_counter_get();
-    
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_timer_create(app_timer_id_t const *      p_timer_id,
-                          app_timer_mode_t            mode,
-                          app_timer_timeout_handler_t timeout_handler)
-{
-    // Check state and parameters
-    VERIFY_MODULE_INITIALIZED();
-
-    if (timeout_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (p_timer_id == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (((timer_node_t*)*p_timer_id)->is_running)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    timer_node_t * p_node     = (timer_node_t *)*p_timer_id;
-    p_node->is_running        = false;
-    p_node->mode              = mode;
-    p_node->p_timeout_handler = timeout_handler;
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for creating a timer user id from the current interrupt level.
- *
- * @return     Timer user id.
-*/
-static timer_user_id_t user_id_get(void)
-{
-    timer_user_id_t ret;
-
-    STATIC_ASSERT(APP_TIMER_INT_LEVELS == 3);
-    
-    switch (current_int_priority_get())
-    {
-        case APP_IRQ_PRIORITY_HIGH:
-            ret = APP_HIGH_USER_ID;
-            break;
-            
-        case APP_IRQ_PRIORITY_LOW:
-            ret = APP_LOW_USER_ID;
-            break;
-            
-        default:
-            ret = THREAD_MODE_USER_ID;
-            break;
-    }
-    
-    return ret;
-}
-
-
-uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context)
-{
-    uint32_t timeout_periodic;
-    timer_node_t * p_node = (timer_node_t*)timer_id;
-    
-    // Check state and parameters
-    VERIFY_MODULE_INITIALIZED();
-
-    if (timer_id == 0)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if (timeout_ticks < APP_TIMER_MIN_TIMEOUT_TICKS)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (p_node->p_timeout_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    // Schedule timer start operation
-    timeout_periodic = (p_node->mode == APP_TIMER_MODE_REPEATED) ? timeout_ticks : 0;
-
-    return timer_start_op_schedule(user_id_get(),
-                                   p_node,
-                                   timeout_ticks,
-                                   timeout_periodic,
-                                   p_context);
-}
-
-
-uint32_t app_timer_stop(app_timer_id_t timer_id)
-{
-    timer_node_t * p_node = (timer_node_t*)timer_id;
-    // Check state and parameters
-    VERIFY_MODULE_INITIALIZED();
-
-    if ((timer_id == NULL) || (p_node->p_timeout_handler == NULL))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    p_node->is_running = false;
-    // Schedule timer stop operation
-    return timer_stop_op_schedule(user_id_get(), p_node);
-}
-
-
-uint32_t app_timer_stop_all(void)
-{
-    // Check state
-    VERIFY_MODULE_INITIALIZED();
-
-    return timer_stop_all_op_schedule(user_id_get());
-}
-
-
-uint32_t app_timer_cnt_get(uint32_t * p_ticks)
-{
-    *p_ticks = rtc1_counter_get();
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_timer_cnt_diff_compute(uint32_t   ticks_to,
-                                    uint32_t   ticks_from,
-                                    uint32_t * p_ticks_diff)
-{
-    *p_ticks_diff = ticks_diff_get(ticks_to, ticks_from);
-    return NRF_SUCCESS;
-}
-
-#ifdef APP_TIMER_WITH_PROFILER
-uint8_t app_timer_op_queue_utilization_get(void)
-{
-    return m_max_user_op_queue_utilization;
-}
-#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/timer/app_timer.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer.h
deleted file mode 100644
index 37393eb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer.h
+++ /dev/null
@@ -1,295 +0,0 @@
-/* Copyright (c) 2012 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 app_timer Application Timer
- * @{
- * @ingroup app_common
- *
- * @brief Application timer functionality.
- *
- * @details This module enables the application to create multiple timer instances based on the RTC1
- *          peripheral. Checking for time-outs and invokation of user time-out handlers is performed
- *          in the RTC1 interrupt handler. List handling is done using a software interrupt (SWI0).
- *          Both interrupt handlers are running in APP_LOW priority level.
- *
- * @details When calling app_timer_start() or app_timer_stop(), the timer operation is just queued,
- *          and the software interrupt is triggered. The actual timer start/stop operation is
- *          executed by the SWI0 interrupt handler. Since the SWI0 interrupt is running in APP_LOW,
- *          if the application code calling the timer function is running in APP_LOW or APP_HIGH,
- *          the timer operation will not be performed until the application handler has returned.
- *          This will be the case, for example, when stopping a timer from a time-out handler when not using
- *          the scheduler.
- *
- * @details Use the USE_SCHEDULER parameter of the APP_TIMER_INIT() macro to select if the
- *          @ref app_scheduler should be used or not. Even if the scheduler is 
- *          not used, app_timer.h will include app_scheduler.h, so when
- *          compiling, app_scheduler.h must be available in one of the compiler include paths.
- */
-
-#ifndef APP_TIMER_H__
-#define APP_TIMER_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include "app_error.h"
-#include "app_util.h"
-#include "compiler_abstraction.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define APP_TIMER_CLOCK_FREQ         32768                      /**< Clock frequency of the RTC timer used to implement the app timer module. */
-#define APP_TIMER_MIN_TIMEOUT_TICKS  5                          /**< Minimum value of the timeout_ticks parameter of app_timer_start(). */
-
-#define APP_TIMER_NODE_SIZE          32                         /**< Size of app_timer.timer_node_t (used to allocate data). */
-#define APP_TIMER_USER_OP_SIZE       24                         /**< Size of app_timer.timer_user_op_t (only for use inside APP_TIMER_BUF_SIZE()). */
-#define APP_TIMER_USER_SIZE          8                          /**< Size of app_timer.timer_user_t (only for use inside APP_TIMER_BUF_SIZE()). */
-#define APP_TIMER_INT_LEVELS         3                          /**< Number of interrupt levels from where timer operations may be initiated (only for use inside APP_TIMER_BUF_SIZE()). */
-
-/**@brief Compute number of bytes required to hold the application timer data structures.
- *
- * @param[in]  OP_QUEUE_SIZE   Size of queues holding timer operations that are pending execution.
- *                             Note that due to the queue implementation, this size must be one more
- *                             than the size that is actually needed.
- *
- * @return     Required application timer buffer size (in bytes).
- */
-#define APP_TIMER_BUF_SIZE(OP_QUEUE_SIZE)                                              \
-    (                                                                                              \
-        (                                                                                          \
-            APP_TIMER_INT_LEVELS                                                                   \
-            *                                                                                      \
-            (APP_TIMER_USER_SIZE + ((OP_QUEUE_SIZE) + 1) * APP_TIMER_USER_OP_SIZE)                 \
-        )                                                                                          \
-    )
-
-/**@brief Convert milliseconds to timer ticks.
- *
- * This macro uses 64-bit integer arithmetic, but as long as the macro parameters are
- *       constants (i.e. defines), the computation will be done by the preprocessor.
- * 
- * When using this macro, ensure that the 
- *         values provided as input result in an output value that is supported by the
- *         @ref app_timer_start function. For example, when the ticks for 1 ms is needed, the
- *         maximum possible value of PRESCALER must be 6, when @ref APP_TIMER_CLOCK_FREQ is 32768.
- *         This will result in a ticks value as 5. Any higher value for PRESCALER will result in a
- *         ticks value that is not supported by this module.
- *
- * @param[in]  MS          Milliseconds.
- * @param[in]  PRESCALER   Value of the RTC1 PRESCALER register (must be the same value that was
- *                         passed to APP_TIMER_INIT()). 
- *
- * @return     Number of timer ticks.
- */
-#define APP_TIMER_TICKS(MS, PRESCALER)\
-            ((uint32_t)ROUNDED_DIV((MS) * (uint64_t)APP_TIMER_CLOCK_FREQ, ((PRESCALER) + 1) * 1000))
-
-typedef struct app_timer_t { uint32_t data[CEIL_DIV(APP_TIMER_NODE_SIZE, sizeof(uint32_t))]; } app_timer_t;
-
-/**@brief Timer ID type.
- * Never declare a variable of this type, but use the macro @ref APP_TIMER_DEF instead.*/
-typedef app_timer_t * app_timer_id_t;
-
-/**
- * @brief Create a timer identifier and statically allocate memory for the timer.
- *
- * @param timer_id Name of the timer identifier variable that will be used to control the timer.
- */
-#define APP_TIMER_DEF(timer_id)                                  \
-    static app_timer_t timer_id##_data = { {0} };                  \
-    static const app_timer_id_t timer_id = &timer_id##_data
-
-
-/**@brief Application time-out handler type. */
-typedef void (*app_timer_timeout_handler_t)(void * p_context);
-
-/**@brief Type of function for passing events from the timer module to the scheduler. */
-typedef uint32_t (*app_timer_evt_schedule_func_t) (app_timer_timeout_handler_t timeout_handler,
-                                                   void *                      p_context);
-
-/**@brief Timer modes. */
-typedef enum
-{
-    APP_TIMER_MODE_SINGLE_SHOT,                 /**< The timer will expire only once. */
-    APP_TIMER_MODE_REPEATED                     /**< The timer will restart each time it expires. */
-} app_timer_mode_t;
-
-/**@brief Initialize the application timer module.
- *
- * @details This macro handles dimensioning and allocation of the memory buffer required by the timer,
- *          making sure that the buffer is correctly aligned. It will also connect the timer module
- *          to the scheduler (if specified).
- *
- * @note    This module assumes that the LFCLK is already running. If it is not, the module will 
- *          be non-functional, since the RTC will not run. If you do not use a SoftDevice, you 
- *          must start the LFCLK manually. See the rtc_example's lfclk_config() function 
- *          for an example of how to do this. If you use a SoftDevice, the LFCLK is started on 
- *          SoftDevice init. 
- *
- *
- * @param[in]  PRESCALER        Value of the RTC1 PRESCALER register. This will decide the
- *                              timer tick rate. Set to 0 for no prescaling.
- * @param[in]  OP_QUEUES_SIZE   Size of queues holding timer operations that are pending execution.
- * @param[in]  SCHEDULER_FUNC   Pointer to scheduler event handler
- *
- * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it
- *       several times as long as it is from the same location, for example, to do a re-initialization).
- */
-/*lint -emacro(506, APP_TIMER_INIT) */ /* Suppress "Constant value Boolean */
-#define APP_TIMER_INIT(PRESCALER, OP_QUEUES_SIZE, SCHEDULER_FUNC)                                  \
-    do                                                                                             \
-    {                                                                                              \
-        static uint32_t APP_TIMER_BUF[CEIL_DIV(APP_TIMER_BUF_SIZE((OP_QUEUES_SIZE) + 1),           \
-                                               sizeof(uint32_t))];                                 \
-        uint32_t ERR_CODE = app_timer_init((PRESCALER),                                            \
-                                           (OP_QUEUES_SIZE) + 1,                                   \
-                                           APP_TIMER_BUF,                                          \
-                                           SCHEDULER_FUNC);                                        \
-        APP_ERROR_CHECK(ERR_CODE);                                                                 \
-    } while (0)
-
-
-
-/**@brief Function for initializing the timer module.
- *
- * Normally, initialization should be done using the APP_TIMER_INIT() macro, because that macro will both
- *       allocate the buffers needed by the timer module (including aligning the buffers correctly)
- *       and take care of connecting the timer module to the scheduler (if specified).
- *
- * @param[in]  prescaler           Value of the RTC1 PRESCALER register. Set to 0 for no prescaling.
- * @param[in]  op_queues_size      Size of queues holding timer operations that are pending
- *                                 execution. Note that due to the queue implementation, this size must
- *                                 be one more than the size that is actually needed.
- * @param[in]  p_buffer            Pointer to memory buffer for internal use in the app_timer
- *                                 module. The size of the buffer can be computed using the
- *                                 APP_TIMER_BUF_SIZE() macro. The buffer must be aligned to a
- *                                 4 byte boundary.
- * @param[in]  evt_schedule_func   Function for passing time-out events to the scheduler. Point to
- *                                 app_timer_evt_schedule() to connect to the scheduler. Set to NULL
- *                                 to make the timer module call the time-out handler directly from
- *                                 the timer interrupt handler.
- *
- * @retval     NRF_SUCCESS               If the module was initialized successfully.
- * @retval     NRF_ERROR_INVALID_PARAM   If a parameter was invalid (buffer not aligned to a 4 byte
- *                                       boundary or NULL).
- */
-uint32_t app_timer_init(uint32_t                      prescaler, 
-                        uint8_t                       op_queues_size,
-                        void *                        p_buffer,
-                        app_timer_evt_schedule_func_t evt_schedule_func);
-
-/**@brief Function for creating a timer instance.
- *
- * @param[in]  p_timer_id        Pointer to timer identifier.
- * @param[in]  mode              Timer mode.
- * @param[in]  timeout_handler   Function to be executed when the timer expires.
- *
- * @retval     NRF_SUCCESS               If the timer was successfully created.
- * @retval     NRF_ERROR_INVALID_PARAM   If a parameter was invalid.
- * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized or
- *                                       the timer is running.
- *
- * @note This function does the timer allocation in the caller's context. It is also not protected
- *       by a critical region. Therefore care must be taken not to call it from several interrupt
- *       levels simultaneously.
- * @note The function can be called again on the timer instance and will re-initialize the instance if
- *       the timer is not running.
- * @attention The FreeRTOS and RTX app_timer implementation does not allow app_timer_create to
- *       be called on the previously initialized instance.
- */
-uint32_t app_timer_create(app_timer_id_t const *      p_timer_id,
-                          app_timer_mode_t            mode,
-                          app_timer_timeout_handler_t timeout_handler);
-
-/**@brief Function for starting a timer.
- *
- * @param[in]       timer_id      Timer identifier.
- * @param[in]       timeout_ticks Number of ticks (of RTC1, including prescaling) to time-out event
- *                                (minimum 5 ticks).
- * @param[in]       p_context     General purpose pointer. Will be passed to the time-out handler when
- *                                the timer expires.
- *
- * @retval     NRF_SUCCESS               If the timer was successfully started.
- * @retval     NRF_ERROR_INVALID_PARAM   If a parameter was invalid.
- * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized or the timer
- *                                       has not been created.
- * @retval     NRF_ERROR_NO_MEM          If the timer operations queue was full.
- *
- * @note The minimum timeout_ticks value is 5.
- * @note For multiple active timers, time-outs occurring in close proximity to each other (in the
- *       range of 1 to 3 ticks) will have a positive jitter of maximum 3 ticks.
- * @note When calling this method on a timer that is already running, the second start operation
- *       is ignored.
- */
-uint32_t app_timer_start(app_timer_id_t timer_id, uint32_t timeout_ticks, void * p_context);
-
-/**@brief Function for stopping the specified timer.
- *
- * @param[in]  timer_id                  Timer identifier.
- *
- * @retval     NRF_SUCCESS               If the timer was successfully stopped.
- * @retval     NRF_ERROR_INVALID_PARAM   If a parameter was invalid.
- * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized or the timer
- *                                       has not been created.
- * @retval     NRF_ERROR_NO_MEM          If the timer operations queue was full.
- */
-uint32_t app_timer_stop(app_timer_id_t timer_id);
-
-/**@brief Function for stopping all running timers.
- *
- * @retval     NRF_SUCCESS               If all timers were successfully stopped.
- * @retval     NRF_ERROR_INVALID_STATE   If the application timer module has not been initialized.
- * @retval     NRF_ERROR_NO_MEM          If the timer operations queue was full.
- */
-uint32_t app_timer_stop_all(void);
-
-/**@brief Function for returning the current value of the RTC1 counter.
- *
- * @param[out] p_ticks   Current value of the RTC1 counter.
- *
- * @retval     NRF_SUCCESS   If the counter was successfully read.
- */
-uint32_t app_timer_cnt_get(uint32_t * p_ticks);
-
-/**@brief Function for computing the difference between two RTC1 counter values.
- *
- * @param[in]  ticks_to       Value returned by app_timer_cnt_get().
- * @param[in]  ticks_from     Value returned by app_timer_cnt_get().
- * @param[out] p_ticks_diff   Number of ticks from ticks_from to ticks_to.
- *
- * @retval     NRF_SUCCESS   If the counter difference was successfully computed.
- */
-uint32_t app_timer_cnt_diff_compute(uint32_t   ticks_to,
-                                    uint32_t   ticks_from,
-                                    uint32_t * p_ticks_diff);
-
-#ifdef APP_TIMER_WITH_PROFILER
-/**@brief Function for getting the maximum observed operation queue utilization.
- *
- * Function for tuning the module and determining OP_QUEUE_SIZE value and thus module RAM usage.
- *
- * @return Maximum number of events in queue observed so far.
- */
-uint16_t app_timer_op_queue_utilization_get(void);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_TIMER_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/timer/app_timer_appsh.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_appsh.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_appsh.c
deleted file mode 100644
index 9755d78..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_appsh.c
+++ /dev/null
@@ -1,34 +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.
- *
- */
-
-#include "app_timer_appsh.h"
-#include "app_scheduler.h"
-
-static void app_timer_evt_get(void * p_event_data, uint16_t event_size)
-{
-    app_timer_event_t * p_timer_event = (app_timer_event_t *)p_event_data;
-    
-    APP_ERROR_CHECK_BOOL(event_size == sizeof(app_timer_event_t));
-    p_timer_event->timeout_handler(p_timer_event->p_context);
-}
-
-uint32_t app_timer_evt_schedule(app_timer_timeout_handler_t timeout_handler,
-                                void *                      p_context)
-{
-    app_timer_event_t timer_event;
-
-    timer_event.timeout_handler = timeout_handler;
-    timer_event.p_context       = p_context;
-    
-    return app_sched_event_put(&timer_event, sizeof(timer_event), app_timer_evt_get);
-}
-

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/timer/app_timer_appsh.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_appsh.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_appsh.h
deleted file mode 100644
index 77a5951..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/timer/app_timer_appsh.h
+++ /dev/null
@@ -1,52 +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.
- *
- */
-
- #ifndef APP_TIMER_APPSH_H
- #define APP_TIMER_APPSH_H
-
-#include "app_timer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define APP_TIMER_SCHED_EVT_SIZE     sizeof(app_timer_event_t)  /**< Size of button events being passed through the scheduler (is to be used for computing the maximum size of scheduler events). */
-
-/**@brief Macro for initializing the application timer module to use with app_scheduler.
- *
- * @param[in]  PRESCALER        Value of the RTC1 PRESCALER register. This will decide the
- *                              timer tick rate. Set to 0 for no prescaling.
- * @param[in]  OP_QUEUES_SIZE   Size of queues holding timer operations that are pending execution.
- * @param[in]  USE_SCHEDULER    TRUE if the application is using the app_scheduler,
- *                              FALSE otherwise.
- *
- * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it
- *       several times as long as it is from the same location, e.g. to do a reinitialization).
- */
-#define APP_TIMER_APPSH_INIT(PRESCALER, OP_QUEUES_SIZE, USE_SCHEDULER)                 \
-    APP_TIMER_INIT(PRESCALER, OP_QUEUES_SIZE,                                          \
-                                (USE_SCHEDULER) ? app_timer_evt_schedule : NULL)
-
-typedef struct
-{
-    app_timer_timeout_handler_t timeout_handler;
-    void *                      p_context;
-} app_timer_event_t;
-
-uint32_t app_timer_evt_schedule(app_timer_timeout_handler_t timeout_handler,
-                                void *                      p_context);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_TIMER_APPSH_H
- 


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

Posted by cc...@apache.org.
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/timer/nrf_drv_timer.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/timer/nrf_drv_timer.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/timer/nrf_drv_timer.h
deleted file mode 100644
index f0ab9b4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/timer/nrf_drv_timer.h
+++ /dev/null
@@ -1,380 +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_timer Timer HAL and driver
- * @ingroup    nrf_drivers
- * @brief      Timer APIs.
- * @details    The timer HAL provides basic APIs for accessing the registers
- *             of the timer. The timer driver provides APIs on a higher level.
- *
- * @defgroup   lib_driver_timer Timer driver
- * @{
- * @ingroup    nrf_timer
- * @brief      Multi-instance timer driver.
- */
-
-#ifndef NRF_DRV_TIMER_H__
-#define NRF_DRV_TIMER_H__
-
-#include "nordic_common.h"
-#include "nrf_drv_config.h"
-#include "nrf_timer.h"
-#include "sdk_errors.h"
-#include "nrf_assert.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Timer driver instance data structure.
- */
-typedef struct
-{
-    NRF_TIMER_Type * p_reg;            ///< Pointer to the structure with TIMER peripheral instance registers.
-    uint8_t          instance_id;      ///< Driver instance index.
-    uint8_t          cc_channel_count; ///< Number of capture/compare channels.
-} nrf_drv_timer_t;
-
-/**
- * @brief Macro for creating a timer driver instance.
- */
-#define NRF_DRV_TIMER_INSTANCE(id) \
-{                                                             \
-    .p_reg            = CONCAT_2(NRF_TIMER, id),              \
-    .instance_id      = CONCAT_3(TIMER, id, _INSTANCE_INDEX), \
-    .cc_channel_count = NRF_TIMER_CC_CHANNEL_COUNT(id),       \
-}
-
-/**
- * @brief Timer driver instance configuration structure.
- */
-typedef struct
-{
-    nrf_timer_frequency_t frequency;          ///< Frequency.
-    nrf_timer_mode_t      mode;               ///< Mode of operation.
-    nrf_timer_bit_width_t bit_width;          ///< Bit width.
-    uint8_t               interrupt_priority; ///< Interrupt priority.
-    void *                p_context;          ///< Context passed to interrupt handler.
-} nrf_drv_timer_config_t;
-
-#define TIMER_CONFIG_FREQUENCY(id)    CONCAT_3(TIMER, id, _CONFIG_FREQUENCY)
-#define TIMER_CONFIG_MODE(id)         CONCAT_3(TIMER, id, _CONFIG_MODE)
-#define TIMER_CONFIG_BIT_WIDTH(id)    CONCAT_3(TIMER, id, _CONFIG_BIT_WIDTH)
-#define TIMER_CONFIG_IRQ_PRIORITY(id) CONCAT_3(TIMER, id, _CONFIG_IRQ_PRIORITY)
-
-/**
- * @brief Timer driver instance default configuration.
- */
-#define NRF_DRV_TIMER_DEFAULT_CONFIG(id) \
-{                                                                            \
-    .frequency          = TIMER_CONFIG_FREQUENCY(id),                        \
-    .mode               = (nrf_timer_mode_t)TIMER_CONFIG_MODE(id),           \
-    .bit_width          = (nrf_timer_bit_width_t)TIMER_CONFIG_BIT_WIDTH(id), \
-    .interrupt_priority = TIMER_CONFIG_IRQ_PRIORITY(id),                     \
-    .p_context          = NULL                                               \
-}
-
-/**
- * @brief Timer driver event handler type.
- *
- * @param[in] event_type Timer event.
- * @param[in] p_context  General purpose parameter set during initialization of
- *                       the timer. This parameter can be used to pass 
- *                       additional information to the handler function, for 
- *                       example, the timer ID.
- */
-typedef void (* nrf_timer_event_handler_t)(nrf_timer_event_t event_type,
-                                           void * p_context);
-
-/**
- * @brief Function for initializing the timer.
- *
- * @param[in] p_instance          Timer instance.
- * @param[in] p_config            Initial configuration.
- *                                If NULL, the default configuration is used.
- * @param[in] timer_event_handler Event handler provided by the user.
- *                                Must not be NULL.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the instance is already initialized.
- * @retval NRF_ERROR_INVALID_PARAM If no handler was provided.
- */
-ret_code_t nrf_drv_timer_init(nrf_drv_timer_t const * const p_instance,
-                              nrf_drv_timer_config_t const * p_config,
-                              nrf_timer_event_handler_t timer_event_handler);
-
-/**
- * @brief Function for uninitializing the timer.
- *
- * @param[in] p_instance Timer instance.
- */
-void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance);
-
-/**
- * @brief Function for turning on the timer.
- *
- * @param[in] p_instance Timer instance.
- */
-void nrf_drv_timer_enable(nrf_drv_timer_t const * const p_instance);
-
-/**
- * @brief Function for turning off the timer.
- *
- * Note that the timer will allow to enter the lowest possible SYSTEM_ON state 
- * only after this function is called.
- *
- * @param[in] p_instance Timer instance.
- */
-void nrf_drv_timer_disable(nrf_drv_timer_t const * const p_instance);
-
-/**
- * @brief Function for pausing the timer.
- *
- * @param[in] p_instance Timer instance.
- */
-void nrf_drv_timer_pause(nrf_drv_timer_t const * const p_instance);
-
-/**
- * @brief Function for resuming the timer.
- *
- * @param[in] p_instance Timer instance.
- */
-void nrf_drv_timer_resume(nrf_drv_timer_t const * const p_instance);
-
-/**
- * @brief Function for clearing the timer.
- *
- * @param[in] p_instance Timer instance.
- */
-void nrf_drv_timer_clear(nrf_drv_timer_t const * const p_instance);
-
-/**
- * @brief Function for incrementing the timer.
- *
- * @param[in] p_instance Timer instance.
- */
-void nrf_drv_timer_increment(nrf_drv_timer_t const * const p_instance);
-
-/**
- * @brief Function for returning the address of a specific timer task.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] timer_task Timer task.
- *
- * @return Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_timer_task_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       nrf_timer_task_t timer_task);
-
-/**
- * @brief Function for returning the address of a specific timer capture task.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] channel    Capture channel number.
- *
- * @return Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_timer_capture_task_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t channel);
-
-/**
- * @brief Function for returning the address of a specific timer event.
- *
- * @param[in] p_instance  Timer instance.
- * @param[in] timer_event Timer event.
- *
- * @return Event address.
- */
-__STATIC_INLINE uint32_t nrf_drv_timer_event_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       nrf_timer_event_t timer_event);
-
-/**
- * @brief Function for returning the address of a specific timer compare event.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] channel    Compare channel number.
- *
- * @return Event address.
- */
-__STATIC_INLINE uint32_t nrf_drv_timer_compare_event_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t channel);
-
-/**
- * @brief Function for capturing the timer value.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] cc_channel Capture channel number.
- *
- * @return Captured value.
- */
-uint32_t nrf_drv_timer_capture(nrf_drv_timer_t const * const p_instance,
-                               nrf_timer_cc_channel_t cc_channel);
-
-/**
- * @brief Function for returning the capture value from a specific channel.
- *
- * Use this function to read channel values when PPI is used for capturing.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] cc_channel Capture channel number.
- *
- * @return Captured value.
- */
-__STATIC_INLINE uint32_t nrf_drv_timer_capture_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       nrf_timer_cc_channel_t cc_channel);
-
-/**
- * @brief Function for setting the timer channel in compare mode.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] cc_channel Compare channel number.
- * @param[in] cc_value   Compare value.
- * @param[in] enable_int Enable or disable the interrupt for the compare channel.
- */
-void nrf_drv_timer_compare(nrf_drv_timer_t const * const p_instance,
-                           nrf_timer_cc_channel_t cc_channel,
-                           uint32_t               cc_value,
-                           bool                   enable_int);
-
-/**
- * @brief Function for setting the timer channel in extended compare mode.
- *
- * @param[in] p_instance       Timer instance.
- * @param[in] cc_channel       Compare channel number.
- * @param[in] cc_value         Compare value.
- * @param[in] timer_short_mask Shortcut between the compare event on the channel
- *                             and the timer task (STOP or CLEAR).
- * @param[in] enable_int       Enable or disable the interrupt for the compare
- *                             channel.
- */
-void nrf_drv_timer_extended_compare(nrf_drv_timer_t const * const p_instance,
-                                    nrf_timer_cc_channel_t cc_channel,
-                                    uint32_t               cc_value,
-                                    nrf_timer_short_mask_t timer_short_mask,
-                                    bool                   enable_int);
-
-/**
- * @brief Function for converting time in microseconds to timer ticks.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] time_us    Time in microseconds.
- *
- * @return Number of ticks.
- */
-__STATIC_INLINE uint32_t nrf_drv_timer_us_to_ticks(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t time_us);
-
-/**
- * @brief Function for converting time in milliseconds to timer ticks.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] time_ms    Time in milliseconds.
- *
- * @return Number of ticks.
- */
-__STATIC_INLINE uint32_t nrf_drv_timer_ms_to_ticks(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t time_ms);
-
-/**
- * @brief Function for enabling timer compare interrupt.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] channel    Compare channel.
- */
-void nrf_drv_timer_compare_int_enable(nrf_drv_timer_t const * const p_instance,
-                                      uint32_t channel);
-
-/**
- * @brief Function for disabling timer compare interrupt.
- *
- * @param[in] p_instance Timer instance.
- * @param[in] channel    Compare channel.
- */
-void nrf_drv_timer_compare_int_disable(nrf_drv_timer_t const * const p_instance,
-                                       uint32_t channel);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE uint32_t nrf_drv_timer_task_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       nrf_timer_task_t timer_task)
-{
-    return (uint32_t)nrf_timer_task_address_get(p_instance->p_reg, timer_task);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_timer_capture_task_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t channel)
-{
-    ASSERT(channel < p_instance->cc_channel_count);
-    return (uint32_t)nrf_timer_task_address_get(p_instance->p_reg,
-                         nrf_timer_capture_task_get(channel));
-}
-
-__STATIC_INLINE uint32_t nrf_drv_timer_event_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       nrf_timer_event_t timer_event)
-{
-    return (uint32_t)nrf_timer_event_address_get(p_instance->p_reg, timer_event);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_timer_compare_event_address_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t channel)
-{
-    ASSERT(channel < p_instance->cc_channel_count);
-    return (uint32_t)nrf_timer_event_address_get(p_instance->p_reg,
-                         nrf_timer_compare_event_get(channel));
-}
-
-__STATIC_INLINE uint32_t nrf_drv_timer_capture_get(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       nrf_timer_cc_channel_t cc_channel)
-{
-    return nrf_timer_cc_read(p_instance->p_reg, cc_channel);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_timer_us_to_ticks(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t timer_us)
-{
-    return nrf_timer_us_to_ticks(timer_us,
-        nrf_timer_frequency_get(p_instance->p_reg));
-}
-
-__STATIC_INLINE uint32_t nrf_drv_timer_ms_to_ticks(
-                                       nrf_drv_timer_t const * const p_instance,
-                                       uint32_t timer_ms)
-{
-    return nrf_timer_ms_to_ticks(timer_ms,
-        nrf_timer_frequency_get(p_instance->p_reg));
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_TIMER_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/twi_master/deprecated/config/twi_master_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/config/twi_master_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/config/twi_master_config.h
deleted file mode 100644
index 7d2b169..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/config/twi_master_config.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (c) 2012 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.
- *
- */
-#ifndef TWI_MASTER_CONFIG
-#define TWI_MASTER_CONFIG
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER (24U)
-#define TWI_MASTER_CONFIG_DATA_PIN_NUMBER (25U)
-
-#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/drivers_nrf/twi_master/deprecated/twi_hw_master.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_hw_master.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_hw_master.c
deleted file mode 100644
index bf54bb7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_hw_master.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* Copyright (c) 2009 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 "twi_master.h"
-#include "twi_master_config.h"
-#include <stdbool.h>
-#include <stdint.h>
-#include "nrf.h"
-#include "nrf_delay.h"
-#include "nrf_gpio.h"
-
-/* Max cycles approximately to wait on RXDREADY and TXDREADY event,
- * This is optimized way instead of using timers, this is not power aware. */
-#define MAX_TIMEOUT_LOOPS (20000UL) /**< MAX while loops to wait for RXD/TXD event */
-
-static bool twi_master_write(uint8_t * data, uint8_t data_length, bool issue_stop_condition)
-{
-    uint32_t timeout = MAX_TIMEOUT_LOOPS; /* max loops to wait for EVENTS_TXDSENT event*/
-
-    if (data_length == 0)
-    {
-        /* Return false for requesting data of size 0 */
-        return false;
-    }
-
-    NRF_TWI1->TXD           = *data++;
-    NRF_TWI1->TASKS_STARTTX = 1;
-
-    /** @snippet [TWI HW master write] */
-    while (true)
-    {
-        while (NRF_TWI1->EVENTS_TXDSENT == 0 && NRF_TWI1->EVENTS_ERROR == 0 && (--timeout))
-        {
-            // Do nothing.
-        }
-
-        if (timeout == 0 || NRF_TWI1->EVENTS_ERROR != 0)
-        {
-            // Recover the peripheral as indicated by PAN 56: "TWI: TWI module lock-up." found at
-            // Product Anomaly Notification document found at 
-            // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads
-            NRF_TWI1->EVENTS_ERROR = 0;
-            NRF_TWI1->ENABLE       = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos; 
-            NRF_TWI1->POWER        = 0;
-            nrf_delay_us(5);
-            NRF_TWI1->POWER        = 1;
-            NRF_TWI1->ENABLE       = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos;
-
-            (void)twi_master_init();
-
-            return false;
-        }
-        NRF_TWI1->EVENTS_TXDSENT = 0;
-        if (--data_length == 0)
-        {
-            break;
-        }
-
-        NRF_TWI1->TXD = *data++;
-    }
-    /** @snippet [TWI HW master write] */
-
-    if (issue_stop_condition)
-    {
-        NRF_TWI1->EVENTS_STOPPED = 0;
-        NRF_TWI1->TASKS_STOP     = 1;
-        /* Wait until stop sequence is sent */ 
-        while(NRF_TWI1->EVENTS_STOPPED == 0) 
-        {
-            // Do nothing.
-        }
-    }
-    return true;
-}
-
-
-/** @brief Function for read by twi_master. 
- */
-static bool twi_master_read(uint8_t * data, uint8_t data_length, bool issue_stop_condition)
-{
-    uint32_t timeout = MAX_TIMEOUT_LOOPS; /* max loops to wait for RXDREADY event*/
-
-    if (data_length == 0)
-    {
-        /* Return false for requesting data of size 0 */
-        return false;
-    }
-    else if (data_length == 1)
-    {
-        NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_STOP;
-    }
-    else
-    {
-        NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_SUSPEND;
-    }
-
-    NRF_PPI->CHENSET          = PPI_CHENSET_CH0_Msk;
-    NRF_TWI1->EVENTS_RXDREADY = 0;
-    NRF_TWI1->TASKS_STARTRX   = 1;
-
-    /** @snippet [TWI HW master read] */
-    while (true)
-    {
-        while (NRF_TWI1->EVENTS_RXDREADY == 0 && NRF_TWI1->EVENTS_ERROR == 0 && (--timeout))
-        {
-            // Do nothing.
-        }
-        NRF_TWI1->EVENTS_RXDREADY = 0;
-
-        if (timeout == 0 || NRF_TWI1->EVENTS_ERROR != 0)
-        {
-            // Recover the peripheral as indicated by PAN 56: "TWI: TWI module lock-up." found at
-            // Product Anomaly Notification document found at
-            // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads
-            NRF_TWI1->EVENTS_ERROR = 0;
-            NRF_TWI1->ENABLE       = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos;
-            NRF_TWI1->POWER        = 0;
-            nrf_delay_us(5);
-            NRF_TWI1->POWER        = 1;
-            NRF_TWI1->ENABLE       = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos;
-
-            (void)twi_master_init();
-
-            return false;
-        }
-
-        *data++ = NRF_TWI1->RXD;
-
-        /* Configure PPI to stop TWI master before we get last BB event */
-        if (--data_length == 1)
-        {
-            NRF_PPI->CH[0].TEP = (uint32_t)&NRF_TWI1->TASKS_STOP;
-        }
-
-        if (data_length == 0)
-        {
-            break;
-        }
-
-        // Recover the peripheral as indicated by PAN 56: "TWI: TWI module lock-up." found at
-        // Product Anomaly Notification document found at
-        // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads
-        nrf_delay_us(20);
-        NRF_TWI1->TASKS_RESUME = 1;
-    }
-    /** @snippet [TWI HW master read] */
-
-    /* Wait until stop sequence is sent */
-    while(NRF_TWI1->EVENTS_STOPPED == 0)
-    {
-        // Do nothing.
-    }
-    NRF_TWI1->EVENTS_STOPPED = 0;
-
-    NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Msk;
-    return true;
-}
-
-
-/**
- * @brief Function for detecting stuck slaves (SDA = 0 and SCL = 1) and tries to clear the bus.
- *
- * @return
- * @retval false Bus is stuck.
- * @retval true Bus is clear.
- */
-static bool twi_master_clear_bus(void)
-{
-    uint32_t twi_state;
-    bool     bus_clear;
-    uint32_t clk_pin_config;
-    uint32_t data_pin_config;
-
-    // Save and disable TWI hardware so software can take control over the pins.
-    twi_state        = NRF_TWI1->ENABLE;
-    NRF_TWI1->ENABLE = TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos;
-
-    clk_pin_config = \
-        NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER];
-    NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] =      \
-        (GPIO_PIN_CNF_SENSE_Disabled  << GPIO_PIN_CNF_SENSE_Pos) \
-      | (GPIO_PIN_CNF_DRIVE_S0D1    << GPIO_PIN_CNF_DRIVE_Pos)   \
-      | (GPIO_PIN_CNF_PULL_Pullup   << GPIO_PIN_CNF_PULL_Pos)    \
-      | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos)   \
-      | (GPIO_PIN_CNF_DIR_Output    << GPIO_PIN_CNF_DIR_Pos);
-
-    data_pin_config = \
-        NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER];
-    NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] =       \
-        (GPIO_PIN_CNF_SENSE_Disabled  << GPIO_PIN_CNF_SENSE_Pos) \
-      | (GPIO_PIN_CNF_DRIVE_S0D1    << GPIO_PIN_CNF_DRIVE_Pos)   \
-      | (GPIO_PIN_CNF_PULL_Pullup   << GPIO_PIN_CNF_PULL_Pos)    \
-      | (GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos)   \
-      | (GPIO_PIN_CNF_DIR_Output    << GPIO_PIN_CNF_DIR_Pos);
-
-    TWI_SDA_HIGH();
-    TWI_SCL_HIGH();
-    TWI_DELAY();
-
-    if ((TWI_SDA_READ() == 1) && (TWI_SCL_READ() == 1))
-    {
-        bus_clear = true;
-    }
-    else
-    {
-        uint_fast8_t i;
-        bus_clear = false;
-
-        // Clock max 18 pulses worst case scenario(9 for master to send the rest of command and 9
-        // for slave to respond) to SCL line and wait for SDA come high.
-        for (i=18; i--;)
-        {
-            TWI_SCL_LOW();
-            TWI_DELAY();
-            TWI_SCL_HIGH();
-            TWI_DELAY();
-
-            if (TWI_SDA_READ() == 1)
-            {
-                bus_clear = true;
-                break;
-            }
-        }
-    }
-
-    NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] = clk_pin_config;
-    NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER]  = data_pin_config;
-
-    NRF_TWI1->ENABLE = twi_state;
-
-    return bus_clear;
-}
-
-
-/** @brief Function for initializing the twi_master.
- */
-bool twi_master_init(void)
-{
-    /* To secure correct signal levels on the pins used by the TWI
-       master when the system is in OFF mode, and when the TWI master is
-       disabled, these pins must be configured in the GPIO peripheral.
-    */
-    NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] =     \
-        (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
-      | (GPIO_PIN_CNF_DRIVE_S0D1     << GPIO_PIN_CNF_DRIVE_Pos) \
-      | (GPIO_PIN_CNF_PULL_Pullup    << GPIO_PIN_CNF_PULL_Pos)  \
-      | (GPIO_PIN_CNF_INPUT_Connect  << GPIO_PIN_CNF_INPUT_Pos) \
-      | (GPIO_PIN_CNF_DIR_Input      << GPIO_PIN_CNF_DIR_Pos);
-
-    NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] =      \
-        (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
-      | (GPIO_PIN_CNF_DRIVE_S0D1     << GPIO_PIN_CNF_DRIVE_Pos) \
-      | (GPIO_PIN_CNF_PULL_Pullup    << GPIO_PIN_CNF_PULL_Pos)  \
-      | (GPIO_PIN_CNF_INPUT_Connect  << GPIO_PIN_CNF_INPUT_Pos) \
-      | (GPIO_PIN_CNF_DIR_Input      << GPIO_PIN_CNF_DIR_Pos);
-
-    NRF_TWI1->EVENTS_RXDREADY = 0;
-    NRF_TWI1->EVENTS_TXDSENT  = 0;
-    NRF_TWI1->PSELSCL         = TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER;
-    NRF_TWI1->PSELSDA         = TWI_MASTER_CONFIG_DATA_PIN_NUMBER;
-    NRF_TWI1->FREQUENCY       = TWI_FREQUENCY_FREQUENCY_K100 << TWI_FREQUENCY_FREQUENCY_Pos;
-    NRF_PPI->CH[0].EEP        = (uint32_t)&NRF_TWI1->EVENTS_BB;
-    NRF_PPI->CH[0].TEP        = (uint32_t)&NRF_TWI1->TASKS_SUSPEND;
-    NRF_PPI->CHENCLR          = PPI_CHENCLR_CH0_Msk;
-    NRF_TWI1->ENABLE          = TWI_ENABLE_ENABLE_Enabled << TWI_ENABLE_ENABLE_Pos;
-
-    return twi_master_clear_bus();
-}
-
-
-/** @brief  Function for transfer by twi_master.
- */
-bool twi_master_transfer(uint8_t   address,
-                         uint8_t * data,
-                         uint8_t   data_length,
-                         bool      issue_stop_condition)
-{
-    bool transfer_succeeded = false;
-    if (data_length > 0 && twi_master_clear_bus())
-    {
-        NRF_TWI1->ADDRESS = (address >> 1);
-
-        if ((address & TWI_READ_BIT))
-        {
-            transfer_succeeded = twi_master_read(data, data_length, issue_stop_condition);
-        }
-        else
-        {
-            transfer_succeeded = twi_master_write(data, data_length, issue_stop_condition);
-        }
-    }
-    return transfer_succeeded;
-}
-
-/*lint --flb "Leave library region" */

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/twi_master/deprecated/twi_master.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_master.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_master.h
deleted file mode 100644
index 2ac62cc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_master.h
+++ /dev/null
@@ -1,109 +0,0 @@
- /* Copyright (c) 2009 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.
- *
- */
-
-#ifndef TWI_MASTER_H
-#define TWI_MASTER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*lint ++flb "Enter library region" */
-
-#include <stdbool.h>
-#include <stdint.h>
-
-/** @file
-* @brief Software controlled TWI Master driver.
-*
-*
-* @defgroup lib_driver_twi_master Software controlled TWI Master driver
-* @{
-* @ingroup nrf_twi
-* @brief Software controlled TWI Master driver (deprecated).
-*
-* @warning This module is deprecated.
-*
-* Supported features:
-* - Repeated start
-* - No multi-master
-* - Only 7-bit addressing
-* - Supports clock stretching (with optional SMBus style slave timeout)
-* - Tries to handle slaves stuck in the middle of transfer
-*/
-
-#define TWI_READ_BIT                 (0x01)        //!< If this bit is set in the address field, transfer direction is from slave to master.
-
-#define TWI_ISSUE_STOP               ((bool)true)  //!< Parameter for @ref twi_master_transfer
-#define TWI_DONT_ISSUE_STOP          ((bool)false) //!< Parameter for @ref twi_master_transfer
-
-/* These macros are needed to see if the slave is stuck and we as master send dummy clock cycles to end its wait */
-/*lint -e717 -save "Suppress do {} while (0) for these macros" */
-/*lint ++flb "Enter library region" */
-#define TWI_SCL_HIGH()   do { NRF_GPIO->OUTSET = (1UL << TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER); } while(0)   /*!< Pulls SCL line high */
-#define TWI_SCL_LOW()    do { NRF_GPIO->OUTCLR = (1UL << TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER); } while(0)   /*!< Pulls SCL line low  */
-#define TWI_SDA_HIGH()   do { NRF_GPIO->OUTSET = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER);  } while(0)   /*!< Pulls SDA line high */
-#define TWI_SDA_LOW()    do { NRF_GPIO->OUTCLR = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER);  } while(0)   /*!< Pulls SDA line low  */
-#define TWI_SDA_INPUT()  do { NRF_GPIO->DIRCLR = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER);  } while(0)   /*!< Configures SDA pin as input  */
-#define TWI_SDA_OUTPUT() do { NRF_GPIO->DIRSET = (1UL << TWI_MASTER_CONFIG_DATA_PIN_NUMBER);  } while(0)   /*!< Configures SDA pin as output */
-#define TWI_SCL_OUTPUT() do { NRF_GPIO->DIRSET = (1UL << TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER); } while(0)   /*!< Configures SCL pin as output */
-/*lint -restore */
-
-#define TWI_SDA_READ() ((NRF_GPIO->IN >> TWI_MASTER_CONFIG_DATA_PIN_NUMBER) & 0x1UL)                     /*!< Reads current state of SDA */
-#define TWI_SCL_READ() ((NRF_GPIO->IN >> TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER) & 0x1UL)                    /*!< Reads current state of SCL */
-
-#define TWI_DELAY() nrf_delay_us(4) /*!< Time to wait when pin states are changed. For fast-mode the delay can be zero and for standard-mode 4 us delay is sufficient. */
-
-
-/**
- * @brief Function for initializing TWI bus IO pins and checks if the bus is operational.
- *
- * Both pins are configured as Standard-0, No-drive-1 (open drain).
- *
- * @return
- * @retval true TWI bus is clear for transfers.
- * @retval false TWI bus is stuck.
- */
-bool twi_master_init(void);
-
-/**
- * @brief Function for transferring data over TWI bus.
- *
- * If TWI master detects even one NACK from the slave or timeout occurs, STOP condition is issued
- * and the function returns false.
- * Bit 0 (@ref TWI_READ_BIT) in the address parameter controls transfer direction;
- * - If 1, master reads data_length number of bytes from the slave
- * - If 0, master writes data_length number of bytes to the slave.
- *
- * @note Make sure at least data_length number of bytes is allocated in data if TWI_READ_BIT is set.
- * @note @ref TWI_ISSUE_STOP
- *
- * @param address Data transfer direction (LSB) / Slave address (7 MSBs).
- * @param data Pointer to data.
- * @param data_length Number of bytes to transfer.
- * @param issue_stop_condition If @ref TWI_ISSUE_STOP, STOP condition is issued before exiting function. If @ref TWI_DONT_ISSUE_STOP, STOP condition is not issued before exiting function. If transfer failed for any reason, STOP condition will be issued in any case.
- * @return
- * @retval true Data transfer succeeded without errors.
- * @retval false Data transfer failed.
- */
-bool twi_master_transfer(uint8_t address, uint8_t *data, uint8_t data_length, bool issue_stop_condition);
-
-/**
- *@}
- **/
-
-/*lint --flb "Leave library region" */
-#ifdef __cplusplus
-}
-#endif
-
-#endif //TWI_MASTER_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/twi_master/deprecated/twi_sw_master.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_sw_master.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_sw_master.c
deleted file mode 100644
index cbd1432..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/deprecated/twi_sw_master.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* Copyright (c) 2009 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 <stdbool.h>
-#include <stdint.h>
-#include "twi_master.h"
-#include "nrf_delay.h"
-
-#include "twi_master_config.h"
-
-/*lint -e415 -e845 -save "Out of bounds access" */
-#define TWI_SDA_STANDARD0_NODRIVE1() do { \
-        NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_DATA_PIN_NUMBER] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
-        |(GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos)    \
-        |(GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos)  \
-        |(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \
-        |(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);  \
-} while (0) /*!< Configures SDA pin to Standard-0, No-drive 1 */
-
-
-#define TWI_SCL_STANDARD0_NODRIVE1() do { \
-        NRF_GPIO->PIN_CNF[TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER] = (GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos) \
-        |(GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos)    \
-        |(GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos)  \
-        |(GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) \
-        |(GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos);  \
-} while (0) /*!< Configures SCL pin to Standard-0, No-drive 1 */
-
-
-/*lint -restore */
-
-#ifndef TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE
-#define TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE (0UL) //!< Unit is number of empty loops. Timeout for SMBus devices is 35 ms. Set to zero to disable slave timeout altogether.
-#endif
-
-static bool twi_master_clear_bus(void);
-static bool twi_master_issue_startcondition(void);
-static bool twi_master_issue_stopcondition(void);
-static bool twi_master_clock_byte(uint_fast8_t databyte);
-static bool twi_master_clock_byte_in(uint8_t * databyte, bool ack);
-static bool twi_master_wait_while_scl_low(void);
-
-bool twi_master_init(void)
-{
-    // Configure both pins to output Standard 0, No-drive (open-drain) 1
-    TWI_SDA_STANDARD0_NODRIVE1(); /*lint !e416 "Creation of out of bounds pointer" */
-    TWI_SCL_STANDARD0_NODRIVE1(); /*lint !e416 "Creation of out of bounds pointer" */
-
-    // Configure SCL as output
-    TWI_SCL_HIGH();
-    TWI_SCL_OUTPUT();
-
-    // Configure SDA as output
-    TWI_SDA_HIGH();
-    TWI_SDA_OUTPUT();
-
-    return twi_master_clear_bus();
-}
-
-bool twi_master_transfer(uint8_t address, uint8_t * data, uint8_t data_length, bool issue_stop_condition)
-{
-    bool transfer_succeeded = true;
-
-    transfer_succeeded &= twi_master_issue_startcondition();
-    transfer_succeeded &= twi_master_clock_byte(address);
-
-    if (address & TWI_READ_BIT)
-    {
-        /* Transfer direction is from Slave to Master */
-        while (data_length-- && transfer_succeeded)
-        {
-            // To indicate to slave that we've finished transferring last data byte
-            // we need to NACK the last transfer.
-            if (data_length == 0)
-            {
-                transfer_succeeded &= twi_master_clock_byte_in(data, (bool)false);
-            }
-            else
-            {
-                transfer_succeeded &= twi_master_clock_byte_in(data, (bool)true);
-            }
-            data++;
-        }
-    }
-    else
-    {
-        /* Transfer direction is from Master to Slave */
-        while (data_length-- && transfer_succeeded)
-        {
-            transfer_succeeded &= twi_master_clock_byte(*data);
-            data++;
-        }
-    }
-
-    if (issue_stop_condition || !transfer_succeeded)
-    {
-        transfer_succeeded &= twi_master_issue_stopcondition();
-    }
-
-    return transfer_succeeded;
-}
-
-/**
- * @brief Function for detecting stuck slaves and tries to clear the bus.
- *
- * @return
- * @retval false Bus is stuck.
- * @retval true Bus is clear.
- */
-static bool twi_master_clear_bus(void)
-{
-    bool bus_clear;
-
-    TWI_SDA_HIGH();
-    TWI_SCL_HIGH();
-    TWI_DELAY();
-
-
-    if (TWI_SDA_READ() == 1 && TWI_SCL_READ() == 1)
-    {
-        bus_clear = true;
-    }
-    else if (TWI_SCL_READ() == 1)
-    {
-        bus_clear = false;
-        // Clock max 18 pulses worst case scenario(9 for master to send the rest of command and 9 for slave to respond) to SCL line and wait for SDA come high
-        for (uint_fast8_t i = 18; i--;)
-        {
-            TWI_SCL_LOW();
-            TWI_DELAY();
-            TWI_SCL_HIGH();
-            TWI_DELAY();
-
-            if (TWI_SDA_READ() == 1)
-            {
-                bus_clear = true;
-                break;
-            }
-        }
-    }
-    else
-    {
-        bus_clear = false;
-    }
-
-    return bus_clear;
-}
-
-/**
- * @brief Function for issuing TWI START condition to the bus.
- *
- * START condition is signaled by pulling SDA low while SCL is high. After this function SCL and SDA will be low.
- *
- * @return
- * @retval false Timeout detected
- * @retval true Clocking succeeded
- */
-static bool twi_master_issue_startcondition(void)
-{
-#if 0
-    if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 1)
-    {
-        // Pull SDA low
-        TWI_SDA_LOW();
-    }
-    else if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 0)
-    {
-        // Issue Stop by pulling SDA high
-        TWI_SDA_HIGH();
-        TWI_DELAY();
-
-        // Then Start by pulling SDA low
-        TWI_SDA_LOW();
-    }
-    else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 0)
-    {
-        // First pull SDA high
-        TWI_SDA_HIGH();
-
-        // Then SCL high
-        if (!twi_master_wait_while_scl_low())
-        {
-            return false;
-        }
-
-        // Then SDA low
-        TWI_SDA_LOW();
-    }
-    else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 1)
-    {
-        // SCL high
-        if (!twi_master_wait_while_scl_low())
-        {
-            return false;
-        }
-
-        // Then SDA low
-        TWI_SDA_LOW();
-    }
-
-    TWI_DELAY();
-    TWI_SCL_LOW();
-#endif
-
-    // Make sure both SDA and SCL are high before pulling SDA low.
-    TWI_SDA_HIGH();
-    TWI_DELAY();
-    if (!twi_master_wait_while_scl_low())
-    {
-        return false;
-    }
-
-    TWI_SDA_LOW();
-    TWI_DELAY();
-
-    // Other module function expect SCL to be low
-    TWI_SCL_LOW();
-    TWI_DELAY();
-
-    return true;
-}
-
-/**
- * @brief Function for issuing TWI STOP condition to the bus.
- *
- * STOP condition is signaled by pulling SDA high while SCL is high. After this function SDA and SCL will be high.
- *
- * @return
- * @retval false Timeout detected
- * @retval true Clocking succeeded
- */
-static bool twi_master_issue_stopcondition(void)
-{
-#if 0
-    if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 1)
-    {
-        // Issue start, then issue stop
-
-        // Pull SDA low to issue START
-        TWI_SDA_LOW();
-        TWI_DELAY();
-
-        // Pull SDA high while SCL is high to issue STOP
-        TWI_SDA_HIGH();
-    }
-    else if (TWI_SCL_READ() == 1 && TWI_SDA_READ() == 0)
-    {
-        // Pull SDA high while SCL is high to issue STOP
-        TWI_SDA_HIGH();
-    }
-    else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 0)
-    {
-        if (!twi_master_wait_while_scl_low())
-        {
-            return false;
-        }
-
-        // Pull SDA high while SCL is high to issue STOP
-        TWI_SDA_HIGH();
-    }
-    else if (TWI_SCL_READ() == 0 && TWI_SDA_READ() == 1)
-    {
-        TWI_SDA_LOW();
-        TWI_DELAY();
-
-        // SCL high
-        if (!twi_master_wait_while_scl_low())
-        {
-            return false;
-        }
-
-        // Pull SDA high while SCL is high to issue STOP
-        TWI_SDA_HIGH();
-    }
-
-    TWI_DELAY();
-#endif
-
-    TWI_SDA_LOW();
-    TWI_DELAY();
-    if (!twi_master_wait_while_scl_low())
-    {
-        return false;
-    }
-
-    TWI_SDA_HIGH();
-    TWI_DELAY();
-
-    return true;
-}
-
-/**
- * @brief Function for clocking one data byte out and reads slave acknowledgment.
- *
- * Can handle clock stretching.
- * After calling this function SCL is low and SDA low/high depending on the
- * value of LSB of the data byte.
- * SCL is expected to be output and low when entering this function.
- *
- * @param databyte Data byte to clock out.
- * @return
- * @retval true Slave acknowledged byte.
- * @retval false Timeout or slave didn't acknowledge byte.
- */
-static bool twi_master_clock_byte(uint_fast8_t databyte)
-{
-    bool transfer_succeeded = true;
-
-    /** @snippet [TWI SW master write] */
-    // Make sure SDA is an output
-    TWI_SDA_OUTPUT();
-
-    // MSB first
-    for (uint_fast8_t i = 0x80; i != 0; i >>= 1)
-    {
-        TWI_SCL_LOW();
-        TWI_DELAY();
-
-        if (databyte & i)
-        {
-            TWI_SDA_HIGH();
-        }
-        else
-        {
-            TWI_SDA_LOW();
-        }
-
-        if (!twi_master_wait_while_scl_low())
-        {
-            transfer_succeeded = false; // Timeout
-            break;
-        }
-    }
-
-    // Finish last data bit by pulling SCL low
-    TWI_SCL_LOW();
-    TWI_DELAY();
-
-    /** @snippet [TWI SW master write] */
-
-    // Configure TWI_SDA pin as input for receiving the ACK bit
-    TWI_SDA_INPUT();
-
-    // Give some time for the slave to load the ACK bit on the line
-    TWI_DELAY();
-
-    // Pull SCL high and wait a moment for SDA line to settle
-    // Make sure slave is not stretching the clock
-    transfer_succeeded &= twi_master_wait_while_scl_low();
-
-    // Read ACK/NACK. NACK == 1, ACK == 0
-    transfer_succeeded &= !(TWI_SDA_READ());
-
-    // Finish ACK/NACK bit clock cycle and give slave a moment to release control
-    // of the SDA line
-    TWI_SCL_LOW();
-    TWI_DELAY();
-
-    // Configure TWI_SDA pin as output as other module functions expect that
-    TWI_SDA_OUTPUT();
-
-    return transfer_succeeded;
-}
-
-
-/**
- * @brief Function for clocking one data byte in and sends ACK/NACK bit.
- *
- * Can handle clock stretching.
- * SCL is expected to be output and low when entering this function.
- * After calling this function, SCL is high and SDA low/high depending if ACK/NACK was sent.
- *
- * @param databyte Data byte to clock out.
- * @param ack If true, send ACK. Otherwise send NACK.
- * @return
- * @retval true Byte read succesfully
- * @retval false Timeout detected
- */
-static bool twi_master_clock_byte_in(uint8_t *databyte, bool ack)
-{
-    uint_fast8_t byte_read          = 0;
-    bool         transfer_succeeded = true;
-
-    /** @snippet [TWI SW master read] */
-    // Make sure SDA is an input
-    TWI_SDA_INPUT();
-
-    // SCL state is guaranteed to be high here
-
-    // MSB first
-    for (uint_fast8_t i = 0x80; i != 0; i >>= 1)
-    {
-        if (!twi_master_wait_while_scl_low())
-        {
-            transfer_succeeded = false;
-            break;
-        }
-
-        if (TWI_SDA_READ())
-        {
-            byte_read |= i;
-        }
-        else
-        {
-            // No need to do anything
-        }
-
-        TWI_SCL_LOW();
-        TWI_DELAY();
-    }
-
-    // Make sure SDA is an output before we exit the function
-    TWI_SDA_OUTPUT();
-    /** @snippet [TWI SW master read] */
-
-    *databyte = (uint8_t)byte_read;
-
-    // Send ACK bit
-
-    // SDA high == NACK, SDA low == ACK
-    if (ack)
-    {
-        TWI_SDA_LOW();
-    }
-    else
-    {
-        TWI_SDA_HIGH();
-    }
-
-    // Let SDA line settle for a moment
-    TWI_DELAY();
-
-    // Drive SCL high to start ACK/NACK bit transfer
-    // Wait until SCL is high, or timeout occurs
-    if (!twi_master_wait_while_scl_low())
-    {
-        transfer_succeeded = false; // Timeout
-    }
-
-    // Finish ACK/NACK bit clock cycle and give slave a moment to react
-    TWI_SCL_LOW();
-    TWI_DELAY();
-
-    return transfer_succeeded;
-}
-
-
-/**
- * @brief Function for pulling SCL high and waits until it is high or timeout occurs.
- *
- * SCL is expected to be output before entering this function.
- * @note If TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE is set to zero, timeout functionality is not compiled in.
- * @return
- * @retval true SCL is now high.
- * @retval false Timeout occurred and SCL is still low.
- */
-static bool twi_master_wait_while_scl_low(void)
-{
-#if TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE != 0
-    uint32_t volatile timeout_counter = TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE;
-#endif
-
-    // Pull SCL high just in case if something left it low
-    TWI_SCL_HIGH();
-    TWI_DELAY();
-
-    while (TWI_SCL_READ() == 0)
-    {
-        // If SCL is low, one of the slaves is busy and we must wait
-
-#if TWI_MASTER_TIMEOUT_COUNTER_LOAD_VALUE != 0
-        if (timeout_counter-- == 0)
-        {
-            // If timeout_detected, return false
-            return false;
-        }
-#endif
-    }
-
-    return true;
-}
-
-/*lint --flb "Leave library region" */

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/twi_master/nrf_drv_twi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/nrf_drv_twi.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/nrf_drv_twi.c
deleted file mode 100644
index 2a9c2e4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/nrf_drv_twi.c
+++ /dev/null
@@ -1,1014 +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_twi.h"
-#include "nrf_drv_common.h"
-#include "nrf_gpio.h"
-#include "nrf_assert.h"
-#include "app_util_platform.h"
-#include "nrf_delay.h"
-
-#include <stdio.h>
-
-#define TWI0_IRQ_HANDLER    SPI0_TWI0_IRQHandler
-#define TWI1_IRQ_HANDLER    SPI1_TWI1_IRQHandler
-
-#if (defined(TWIM_IN_USE) && defined(TWI_IN_USE))
-    // TWIM and TWI combined
-    #define CODE_FOR_TWIM(code) if (p_instance->use_easy_dma) { code }
-    #define CODE_FOR_TWI(code)  else { code }
-#elif (defined(TWIM_IN_USE) && !defined(TWI_IN_USE))
-    // TWIM only
-    #define CODE_FOR_TWIM(code) { code }
-    #define CODE_FOR_TWI(code)
-#elif (!defined(TWIM_IN_USE) && defined(TWI_IN_USE))
-    // TWI only
-    #define CODE_FOR_TWIM(code)
-    #define CODE_FOR_TWI(code)  { code }
-#else
-    #error "Wrong configuration."
-#endif
-
-// All interrupt flags
-#define DISABLE_ALL  0xFFFFFFFF
-
-#define SCL_PIN_CONF        ((GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)    \
-                            | (GPIO_PIN_CNF_DRIVE_S0D1     << GPIO_PIN_CNF_DRIVE_Pos)   \
-                            | (GPIO_PIN_CNF_PULL_Pullup    << GPIO_PIN_CNF_PULL_Pos)    \
-                            | (GPIO_PIN_CNF_INPUT_Connect  << GPIO_PIN_CNF_INPUT_Pos)   \
-                            | (GPIO_PIN_CNF_DIR_Input      << GPIO_PIN_CNF_DIR_Pos))
-
-#define SDA_PIN_CONF        SCL_PIN_CONF
-
-#define SCL_PIN_CONF_CLR    ((GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos)    \
-                            | (GPIO_PIN_CNF_DRIVE_S0D1     << GPIO_PIN_CNF_DRIVE_Pos)   \
-                            | (GPIO_PIN_CNF_PULL_Pullup    << GPIO_PIN_CNF_PULL_Pos)    \
-                            | (GPIO_PIN_CNF_INPUT_Connect  << GPIO_PIN_CNF_INPUT_Pos)   \
-                            | (GPIO_PIN_CNF_DIR_Output     << GPIO_PIN_CNF_DIR_Pos))
-
-#define SDA_PIN_CONF_CLR    SCL_PIN_CONF_CLR
-
-// Control block - driver instance local data.
-typedef struct
-{
-    nrf_drv_twi_evt_handler_t handler;
-    void *                    p_context;
-    volatile uint32_t         int_mask;
-    nrf_drv_twi_xfer_desc_t   xfer_desc;
-    uint32_t                  flags;
-    uint8_t *                 p_curr_buf;
-    uint8_t                   curr_length;
-    bool                      curr_no_stop;
-    nrf_drv_state_t           state;
-    bool                      error;
-    volatile bool             busy;
-    bool                      repeated;
-    uint8_t                   bytes_transferred;
-} twi_control_block_t;
-
-static twi_control_block_t m_cb[TWI_COUNT];
-
-static nrf_drv_twi_config_t const m_default_config[TWI_COUNT] = {
-#if TWI0_ENABLED
-    NRF_DRV_TWI_DEFAULT_CONFIG(0),
-#endif
-#if TWI1_ENABLED
-    NRF_DRV_TWI_DEFAULT_CONFIG(1),
-#endif
-};
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n
-    #define IRQ_HANDLER(n)      static void IRQ_HANDLER_NAME(n)(void)
-
-    #if TWI0_ENABLED
-        IRQ_HANDLER(0);
-    #endif
-    #if TWI1_ENABLED
-        IRQ_HANDLER(1);
-    #endif
-    static nrf_drv_irq_handler_t const m_irq_handlers[TWI_COUNT] = {
-    #if TWI0_ENABLED
-        IRQ_HANDLER_NAME(0),
-    #endif
-    #if TWI1_ENABLED
-        IRQ_HANDLER_NAME(1),
-    #endif
-    };
-#else
-    #define IRQ_HANDLER(n) void SPI##n##_TWI##n##_IRQHandler(void)
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-static void twi_clear_bus(nrf_drv_twi_t const * const p_instance,
-                          nrf_drv_twi_config_t const * p_config)
-{
-    NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF;
-    NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF;
-
-    nrf_gpio_pin_set(p_config->scl);
-    nrf_gpio_pin_set(p_config->sda);
-
-    NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF_CLR;
-    NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF_CLR;
-
-    nrf_delay_us(4);
-
-    for(int i = 0; i < 9; i++)
-    {
-        if (nrf_gpio_pin_read(p_config->sda))
-        {
-            if(i == 0)
-            {
-                return;
-            }
-            else
-            {
-                break;
-            }
-        }
-        nrf_gpio_pin_clear(p_config->scl);
-        nrf_delay_us(4);
-        nrf_gpio_pin_set(p_config->scl);
-        nrf_delay_us(4);
-    }
-    nrf_gpio_pin_clear(p_config->sda);
-    nrf_delay_us(4);
-    nrf_gpio_pin_set(p_config->sda);
-}
-
-ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const *        p_instance,
-                            nrf_drv_twi_config_t const * p_config,
-                            nrf_drv_twi_evt_handler_t    event_handler,
-                            void *                       p_context)
-{
-    twi_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-
-    if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config[p_instance->drv_inst_idx];
-    }
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    if (nrf_drv_common_per_res_acquire(p_instance->reg.p_twi,
-            m_irq_handlers[p_instance->drv_inst_idx]) != NRF_SUCCESS)
-    {
-        return NRF_ERROR_BUSY;
-    }
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-    p_cb->handler   = event_handler;
-    p_cb->p_context = p_context;
-    p_cb->int_mask  = 0;
-    p_cb->repeated  = false;
-    p_cb->busy      = false;
-
-    twi_clear_bus(p_instance, p_config);
-
-    /* To secure correct signal levels on the pins used by the TWI
-       master when the system is in OFF mode, and when the TWI master is
-       disabled, these pins must be configured in the GPIO peripheral.
-    */
-    NRF_GPIO->PIN_CNF[p_config->scl] = SCL_PIN_CONF;
-    NRF_GPIO->PIN_CNF[p_config->sda] = SDA_PIN_CONF;
-
-    CODE_FOR_TWIM
-    (
-        NRF_TWIM_Type * p_twim = p_instance->reg.p_twim;
-        nrf_twim_pins_set(p_twim, p_config->scl, p_config->sda);
-        nrf_twim_frequency_set(p_twim,
-            (nrf_twim_frequency_t)p_config->frequency);
-    )
-    CODE_FOR_TWI
-    (
-        NRF_TWI_Type * p_twi = p_instance->reg.p_twi;
-        nrf_twi_pins_set(p_twi, p_config->scl, p_config->sda);
-        nrf_twi_frequency_set(p_twi,
-            (nrf_twi_frequency_t)p_config->frequency);
-    )
-
-    if (p_cb->handler)
-    {
-        CODE_FOR_TWIM
-        (
-            nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twim),
-                p_config->interrupt_priority);
-        )
-        CODE_FOR_TWI
-        (
-            nrf_drv_common_irq_enable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twi),
-                p_config->interrupt_priority);
-        )
-    }
-
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_twi_uninit(nrf_drv_twi_t const * p_instance)
-{
-    twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-
-    if (p_cb->handler)
-    {
-        CODE_FOR_TWIM
-        (
-            nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twim));
-        )
-        CODE_FOR_TWI
-        (
-            nrf_drv_common_irq_disable(nrf_drv_get_IRQn((void *)p_instance->reg.p_twi));
-        )
-    }
-    nrf_drv_twi_disable(p_instance);
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    nrf_drv_common_per_res_release(p_instance->reg.p_twi);
-#endif
-
-    p_cb->state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-void nrf_drv_twi_enable(nrf_drv_twi_t const * p_instance)
-{
-    twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state == NRF_DRV_STATE_INITIALIZED);
-
-    CODE_FOR_TWIM
-    (
-        NRF_TWIM_Type * p_twim = p_instance->reg.p_twim;
-
-        nrf_twim_enable(p_twim);
-    )
-    CODE_FOR_TWI
-    (
-        NRF_TWI_Type * p_twi = p_instance->reg.p_twi;
-
-        nrf_twi_enable(p_twi);
-    )
-
-    p_cb->state = NRF_DRV_STATE_POWERED_ON;
-}
-
-void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance)
-{
-    twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-
-    CODE_FOR_TWIM
-    (
-        NRF_TWIM_Type * p_twim = p_instance->reg.p_twim;
-        p_cb->int_mask = 0;
-        nrf_twim_int_disable(p_twim, DISABLE_ALL);
-        nrf_twim_shorts_disable(p_twim, DISABLE_ALL);
-        nrf_twim_disable(p_twim);
-    )
-    CODE_FOR_TWI
-    (
-        NRF_TWI_Type * p_twi = p_instance->reg.p_twi;
-        nrf_twi_int_disable(p_twi, DISABLE_ALL);
-        nrf_twi_shorts_disable(p_twi, DISABLE_ALL);
-        nrf_twi_disable(p_twi);
-    )
-
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-}
-
-#ifdef TWI_IN_USE
-static bool twi_send_byte(NRF_TWI_Type  * p_twi,
-                          uint8_t const * p_data,
-                          uint8_t         length,
-                          uint8_t       * p_bytes_transferred,
-                          bool            no_stop)
-{
-    if (*p_bytes_transferred < length)
-    {
-        nrf_twi_txd_set(p_twi, p_data[*p_bytes_transferred]);
-        ++(*p_bytes_transferred);
-    }
-    else
-    {
-        if (no_stop)
-        {
-            nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_SUSPEND);
-            return false;
-        }
-        else
-        {
-            nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP);
-        }
-    }
-    return true;
-}
-
-static bool twi_receive_byte(NRF_TWI_Type * p_twi,
-                             uint8_t      * p_data,
-                             uint8_t        length,
-                             uint8_t      * p_bytes_transferred,
-                             bool           no_stop)
-{
-    if (*p_bytes_transferred < length)
-    {
-        p_data[*p_bytes_transferred] = nrf_twi_rxd_get(p_twi);
-
-        ++(*p_bytes_transferred);
-
-        if ((*p_bytes_transferred == length-1) && !no_stop)
-        {
-            nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_STOP_MASK);
-        }
-        else if (*p_bytes_transferred == length)
-        {
-            goto xfer_done;
-        }
-
-        nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
-
-        return true;
-    }
-
-xfer_done:
-    if (no_stop) {
-        return false;
-    } else {
-        return true;
-    }
-}
-
-static bool twi_transfer(NRF_TWI_Type  * p_twi,
-                         bool          * p_error,
-                         uint8_t       * p_bytes_transferred,
-                         uint8_t       * p_data,
-                         uint8_t         length,
-                         bool            no_stop)
-{
-    bool do_stop_check;
-
-    if ((*p_error == true) || (*p_bytes_transferred == length))
-    {
-        do_stop_check = true;
-    }
-    else
-    {
-        do_stop_check = false;
-    }
-
-    if (*p_error)
-    {
-        nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR);
-        nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT);
-        nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY);
-    }
-    else if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR))
-    {
-        nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR);
-        nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP);
-        *p_error = true;
-    }
-    else
-    {
-        if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_TXDSENT))
-        {
-            nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT);
-            if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR))
-            {
-                nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR);
-                nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP);
-                *p_error = true;
-            }
-            else
-            {
-                if (!twi_send_byte(p_twi, p_data, length, p_bytes_transferred, no_stop))
-                {
-                    return false;
-                }
-            }
-        }
-        else if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_RXDREADY))
-        {
-            nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY);
-            if (nrf_twi_event_check(p_twi, NRF_TWI_EVENT_ERROR))
-            {
-                nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR);
-                nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STOP);
-                *p_error = true;
-            }
-            else
-            {
-                if (!twi_receive_byte(p_twi, p_data, length,
-                                      p_bytes_transferred, no_stop))
-                {
-                    return false;
-                }
-            }
-        }
-    }
-
-    if (do_stop_check && nrf_twi_event_check(p_twi, NRF_TWI_EVENT_STOPPED))
-    {
-        nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED);
-        return false;
-    }
-
-    return true;
-}
-
-static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb,
-                                        NRF_TWI_Type *        p_twi,
-                                        uint8_t const *       p_data,
-                                        uint8_t               length,
-                                        bool                  no_stop)
-{
-    ret_code_t ret_code = NRF_SUCCESS;
-
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED);
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR);
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT);
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY);
-    nrf_twi_shorts_set(p_twi, 0);
-
-    p_cb->bytes_transferred = 0;
-    p_cb->error             = false;
-
-    // In case TWI is suspended resume its operation.
-    nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
-    nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTTX);
-
-    (void)twi_send_byte(p_twi, p_data, length, &p_cb->bytes_transferred, no_stop);
-
-    if (p_cb->handler)
-    {
-        p_cb->int_mask = NRF_TWI_INT_STOPPED_MASK   |
-                        NRF_TWI_INT_ERROR_MASK     |
-                        NRF_TWI_INT_TXDSENT_MASK   |
-                        NRF_TWI_INT_RXDREADY_MASK;
-        nrf_twi_int_enable(p_twi, p_cb->int_mask);
-    }
-    else
-    {
-        while (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, (uint8_t *)p_data, length, no_stop))
-        {}
-
-        if (p_cb->error)
-        {
-            ret_code = NRF_ERROR_INTERNAL;
-        }
-    }
-    return ret_code;
-}
-
-static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb,
-                                        NRF_TWI_Type *        p_twi,
-                                        uint8_t const *       p_data,
-                                        uint8_t               length)
-{
-    bool no_stop;
-    ret_code_t ret_code = NRF_SUCCESS;
-
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_STOPPED);
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_ERROR);
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_TXDSENT);
-    nrf_twi_event_clear(p_twi, NRF_TWI_EVENT_RXDREADY);
-
-    p_cb->bytes_transferred = 0;
-    p_cb->error             = false;
-
-    if (p_cb->flags & NRF_DRV_TWI_FLAG_RX_NO_STOP)
-    {
-        no_stop = true;
-    } else
-    {
-        no_stop = false;
-    }
-
-    if ((length == 1) && !no_stop)
-    {
-        nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_STOP_MASK);
-    }
-    else
-    {
-        nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_SUSPEND_MASK);
-    }
-    // In case TWI is suspended resume its operation.
-    nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
-    nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTRX);
-
-    if (p_cb->handler)
-    {
-        p_cb->int_mask = NRF_TWI_INT_STOPPED_MASK   |
-                        NRF_TWI_INT_ERROR_MASK     |
-                        NRF_TWI_INT_TXDSENT_MASK   |
-                        NRF_TWI_INT_RXDREADY_MASK;
-        nrf_twi_int_enable(p_twi, p_cb->int_mask);
-    }
-    else
-    {
-        while (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred,
-                            (uint8_t *)p_data, length, no_stop))
-        {}
-
-        if (p_cb->error)
-        {
-            ret_code = NRF_ERROR_INTERNAL;
-        }
-    }
-    return ret_code;
-}
-
-__STATIC_INLINE ret_code_t twi_xfer(twi_control_block_t           * p_cb,
-                                    NRF_TWI_Type                  * p_twi,
-                                    nrf_drv_twi_xfer_desc_t const * p_xfer_desc,
-                                    uint32_t                        flags)
-{
-    ret_code_t ret = NRF_SUCCESS;
-
-    /* Block TWI interrupts to ensure that function is not interrupted by TWI interrupt. */
-    nrf_twi_int_disable(p_twi, DISABLE_ALL);
-
-    if (p_cb->busy)
-    {
-        nrf_twi_int_enable(p_twi, p_cb->int_mask);
-        return NRF_ERROR_BUSY;
-    }
-    else
-    {
-        p_cb->busy = (NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER & flags) ? false : true;
-    }
-
-    if (flags & NRF_DRV_TWI_FLAG_HOLD_XFER)
-    {
-        return NRF_ERROR_NOT_SUPPORTED;
-    }
-
-    p_cb->flags       = flags;
-    p_cb->xfer_desc   = *p_xfer_desc;
-    p_cb->curr_length = p_xfer_desc->primary_length;
-    p_cb->p_curr_buf  = p_xfer_desc->p_primary_buf;
-    nrf_twi_address_set(p_twi, p_xfer_desc->address);
-
-    if (p_xfer_desc->type != NRF_DRV_TWI_XFER_RX)
-    {
-        p_cb->curr_no_stop = ((p_xfer_desc->type == NRF_DRV_TWI_XFER_TX) &&
-                             !(flags & NRF_DRV_TWI_FLAG_TX_NO_STOP)) ? false : true;
-        ret = twi_tx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length, p_cb->curr_no_stop);
-    }
-    else
-    {
-        p_cb->curr_no_stop = false;
-        ret = twi_rx_start_transfer(p_cb, p_twi, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length);
-    }
-    if (p_cb->handler == NULL)
-    {
-        p_cb->busy = false;
-    }
-    return ret;
-}
-#endif
-
-#ifdef TWIM_IN_USE
-__STATIC_INLINE void twim_list_enable_handle(NRF_TWIM_Type * p_twim, uint32_t flags)
-{
-    if (NRF_DRV_TWI_FLAG_TX_POSTINC & flags)
-    {
-        nrf_twim_tx_list_enable(p_twim);
-    }
-    else
-    {
-        nrf_twim_tx_list_disable(p_twim);
-    }
-
-    if (NRF_DRV_TWI_FLAG_RX_POSTINC & flags)
-    {
-        nrf_twim_rx_list_enable(p_twim);
-    }
-    else
-    {
-        nrf_twim_rx_list_disable(p_twim);
-    }
-#ifndef NRF52_PAN_46
-#endif
-}
-__STATIC_INLINE ret_code_t twim_xfer(twi_control_block_t           * p_cb,
-                                     NRF_TWIM_Type                 * p_twim,
-                                     nrf_drv_twi_xfer_desc_t const * p_xfer_desc,
-                                     uint32_t                        flags)
-{
-    ret_code_t ret = NRF_SUCCESS;
-    nrf_twim_task_t  start_task = NRF_TWIM_TASK_STARTTX;
-    nrf_twim_event_t evt_to_wait = NRF_TWIM_EVENT_STOPPED;
-
-    if (!nrf_drv_is_in_RAM(p_xfer_desc->p_primary_buf))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-    /* Block TWI interrupts to ensure that function is not interrupted by TWI interrupt. */
-    nrf_twim_int_disable(p_twim, DISABLE_ALL);
-    if (p_cb->busy)
-    {
-        nrf_twim_int_enable(p_twim, p_cb->int_mask);
-        return NRF_ERROR_BUSY;
-    }
-    else
-    {
-
-        p_cb->busy = ((NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER & flags) ||
-                      (NRF_DRV_TWI_FLAG_REPEATED_XFER & flags)) ? false: true;
-    }
-
-    p_cb->xfer_desc = *p_xfer_desc;
-    p_cb->repeated = (flags & NRF_DRV_TWI_FLAG_REPEATED_XFER) ? true : false;
-    nrf_twim_address_set(p_twim, p_xfer_desc->address);
-
-    nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_STOPPED);
-    nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR);
-
-    twim_list_enable_handle(p_twim, flags);
-    switch (p_xfer_desc->type)
-    {
-    case NRF_DRV_TWI_XFER_TXTX:
-        ASSERT(!(flags & NRF_DRV_TWI_FLAG_REPEATED_XFER));
-        ASSERT(!(flags & NRF_DRV_TWI_FLAG_HOLD_XFER));
-        ASSERT(!(flags & NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER));
-        if (!nrf_drv_is_in_RAM(p_xfer_desc->p_secondary_buf))
-        {
-            return NRF_ERROR_INVALID_ADDR;
-        }
-        nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK);
-        nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length);
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_TXSTARTED);
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_LASTTX);
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED);
-        nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
-        nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STARTTX);
-        while(!nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_TXSTARTED))
-        {}
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_TXSTARTED);
-        nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_secondary_buf, p_xfer_desc->secondary_length);
-        p_cb->int_mask = NRF_TWIM_INT_SUSPENDED_MASK | NRF_TWIM_INT_ERROR_MASK;
-        break;
-    case NRF_DRV_TWI_XFER_TXRX:
-        nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length);
-        nrf_twim_rx_buffer_set(p_twim, p_xfer_desc->p_secondary_buf, p_xfer_desc->secondary_length);
-        nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STARTRX_MASK |
-                                    NRF_TWIM_SHORT_LASTRX_STOP_MASK);
-        p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK;
-        break;
-    case NRF_DRV_TWI_XFER_TX:
-        nrf_twim_tx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length);
-        if (NRF_DRV_TWI_FLAG_TX_NO_STOP & flags)
-        {
-            nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK);
-            p_cb->int_mask = NRF_TWIM_INT_SUSPENDED_MASK | NRF_TWIM_INT_ERROR_MASK;
-            nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED);
-            evt_to_wait = NRF_TWIM_EVENT_SUSPENDED;
-        }
-        else
-        {
-            nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STOP_MASK);
-            p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK;
-        }
-        nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
-        break;
-    case NRF_DRV_TWI_XFER_RX:
-        nrf_twim_rx_buffer_set(p_twim, p_xfer_desc->p_primary_buf, p_xfer_desc->primary_length);
-        nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTRX_STOP_MASK);
-        p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK;
-        start_task = NRF_TWIM_TASK_STARTRX;
-        nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
-        break;
-    default:
-        ret = NRF_ERROR_INVALID_PARAM;
-        break;
-    }
-
-    if (!(flags & NRF_DRV_TWI_FLAG_HOLD_XFER) && (p_xfer_desc->type != NRF_DRV_TWI_XFER_TXTX))
-    {
-        nrf_twim_task_trigger(p_twim, start_task);
-    }
-
-    if (p_cb->handler)
-    {
-        if (flags & NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER)
-        {
-            p_cb->int_mask = NRF_TWIM_INT_ERROR_MASK;
-        }
-        nrf_twim_int_enable(p_twim, p_cb->int_mask);
-    }
-    else
-    {
-        while (!nrf_twim_event_check(p_twim, evt_to_wait))
-        {
-            if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_ERROR))
-            {
-                nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR);
-                nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
-                nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STOP);
-                evt_to_wait = NRF_TWIM_EVENT_STOPPED;
-            }
-        }
-
-        uint32_t errorsrc =  nrf_twim_errorsrc_get_and_clear(p_twim);
-
-        p_cb->busy = false;
-
-        if (errorsrc)
-        {
-            ret = NRF_ERROR_INTERNAL;
-        }
-    }
-    return ret;
-}
-#endif
-
-ret_code_t nrf_drv_twi_xfer(nrf_drv_twi_t           const * p_instance,
-                            nrf_drv_twi_xfer_desc_t const * p_xfer_desc,
-                            uint32_t                        flags)
-{
-    ret_code_t ret = NRF_SUCCESS;
-    twi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx];
-
-    // TXRX and TXTX transfers are support only in non-blocking mode.
-    ASSERT( !((p_cb->handler == NULL) && (p_xfer_desc->type == NRF_DRV_TWI_XFER_TXRX)));
-    ASSERT( !((p_cb->handler == NULL) && (p_xfer_desc->type == NRF_DRV_TWI_XFER_TXTX)));
-
-    CODE_FOR_TWIM
-    (
-        ret = twim_xfer(p_cb, (NRF_TWIM_Type *)p_instance->reg.p_twim, p_xfer_desc, flags);
-    )
-    CODE_FOR_TWI
-    (
-        if ( (NRF_DRV_TWI_FLAG_TX_POSTINC | NRF_DRV_TWI_FLAG_RX_POSTINC) & flags)
-        {
-            return NRF_ERROR_NOT_SUPPORTED;
-        }
-        ret = twi_xfer(p_cb, (NRF_TWI_Type  *)p_instance->reg.p_twi, p_xfer_desc, flags);
-    )
-    return ret;
-}
-
-ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance,
-                          uint8_t               address,
-                          uint8_t const *       p_data,
-                          uint8_t               length,
-                          bool                  no_stop)
-{
-    nrf_drv_twi_xfer_desc_t xfer = NRF_DRV_TWI_XFER_DESC_TX(address, (uint8_t*)p_data, length);
-
-    return nrf_drv_twi_xfer(p_instance, &xfer, no_stop ? NRF_DRV_TWI_FLAG_TX_NO_STOP : 0);
-}
-
-ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance,
-                          uint8_t               address,
-                          uint8_t *             p_data,
-                          uint8_t               length)
-{
-    nrf_drv_twi_xfer_desc_t xfer = NRF_DRV_TWI_XFER_DESC_RX(address, p_data, length);
-    return nrf_drv_twi_xfer(p_instance, &xfer, 0);
-}
-
-ret_code_t nrf_drv_twi_rx_ext(nrf_drv_twi_t const * p_instance,
-                              uint8_t               address,
-                              uint8_t *             p_data,
-                              uint8_t               length,
-                              bool                  no_stop)
-{
-    uint32_t flags;
-    nrf_drv_twi_xfer_desc_t xfer = NRF_DRV_TWI_XFER_DESC_RX(address, p_data, length);
-
-    if (no_stop) {
-        flags = NRF_DRV_TWI_FLAG_RX_NO_STOP;
-    } else {
-        flags = 0;
-    }
-    return nrf_drv_twi_xfer(p_instance, &xfer, flags);
-}
-
-
-uint32_t nrf_drv_twi_data_count_get(nrf_drv_twi_t const * const p_instance)
-{
-    CODE_FOR_TWIM
-    (
-        ASSERT(false);
-        return 0;
-    )
-    CODE_FOR_TWI
-    (
-        return m_cb[p_instance->drv_inst_idx].bytes_transferred;
-    )
-}
-uint32_t nrf_drv_twi_start_task_get(nrf_drv_twi_t const * p_instance, nrf_drv_twi_xfer_type_t xfer_type)
-{
-    CODE_FOR_TWIM
-    (
-        return (uint32_t)nrf_twim_task_address_get(p_instance->reg.p_twim,
-            (xfer_type != NRF_DRV_TWI_XFER_RX) ? NRF_TWIM_TASK_STARTTX : NRF_TWIM_TASK_STARTRX);
-    )
-    CODE_FOR_TWI
-    (
-        return (uint32_t)nrf_twi_task_address_get(p_instance->reg.p_twi,
-                (xfer_type != NRF_DRV_TWI_XFER_RX) ? NRF_TWI_TASK_STARTTX : NRF_TWI_TASK_STARTRX);
-    )
-}
-
-uint32_t nrf_drv_twi_stopped_event_get(nrf_drv_twi_t const * p_instance)
-{
-    CODE_FOR_TWIM
-    (
-        return (uint32_t)nrf_twim_event_address_get(p_instance->reg.p_twim, NRF_TWIM_EVENT_STOPPED);
-    )
-    CODE_FOR_TWI
-    (
-        return (uint32_t)nrf_twi_event_address_get(p_instance->reg.p_twi, NRF_TWI_EVENT_STOPPED);
-    )
-}
-
-#ifdef TWIM_IN_USE
-static void irq_handler_twim(NRF_TWIM_Type * p_twim, twi_control_block_t * p_cb)
-{
-    ASSERT(p_cb->handler);
-
-    if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_ERROR))
-    {
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR);
-        if (!nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_STOPPED))
-        {
-            nrf_twim_int_disable(p_twim, p_cb->int_mask);
-            p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK;
-            nrf_twim_int_enable(p_twim, p_cb->int_mask);
-
-            nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
-            nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STOP);
-            return;
-        }
-    }
-
-    nrf_drv_twi_evt_t event;
-
-    if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_STOPPED))
-    {
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_STOPPED);
-        event.xfer_desc = p_cb->xfer_desc;
-        if (p_cb->error)
-        {
-
-            event.xfer_desc.primary_length = (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_RX) ?
-                (uint8_t)nrf_twim_rxd_amount_get(p_twim) : (uint8_t)nrf_twim_txd_amount_get(p_twim);
-            event.xfer_desc.secondary_length = (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXRX) ?
-                (uint8_t)nrf_twim_rxd_amount_get(p_twim) : (uint8_t)nrf_twim_txd_amount_get(p_twim);
-
-        }
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_LASTTX);
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_LASTRX);
-        if (!p_cb->repeated || p_cb->error)
-        {
-            nrf_twim_shorts_set(p_twim, 0);
-            p_cb->int_mask = 0;
-            nrf_twim_int_disable(p_twim, DISABLE_ALL);
-        }
-    }
-    else
-    {
-        nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_SUSPENDED);
-        if (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TX)
-        {
-            event.xfer_desc = p_cb->xfer_desc;
-            if (!p_cb->repeated)
-            {
-                nrf_twim_shorts_set(p_twim, 0);
-                p_cb->int_mask = 0;
-                nrf_twim_int_disable(p_twim, DISABLE_ALL);
-            }
-        }
-        else
-        {
-            nrf_twim_shorts_set(p_twim, NRF_TWIM_SHORT_LASTTX_STOP_MASK);
-            p_cb->int_mask = NRF_TWIM_INT_STOPPED_MASK | NRF_TWIM_INT_ERROR_MASK;
-            nrf_twim_int_disable(p_twim, DISABLE_ALL);
-            nrf_twim_int_enable(p_twim, p_cb->int_mask);
-            nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STARTTX);
-            nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
-            return;
-        }
-    }
-
-    uint32_t errorsrc = nrf_twim_errorsrc_get_and_clear(p_twim);
-    if (errorsrc & NRF_TWIM_ERROR_ADDRESS_NACK)
-    {
-        event.type = NRF_DRV_TWI_EVT_ADDRESS_NACK;
-    }
-    else if (errorsrc & NRF_TWIM_ERROR_DATA_NACK)
-    {
-        event.type = NRF_DRV_TWI_EVT_DATA_NACK;
-    }
-    else
-    {
-        event.type = NRF_DRV_TWI_EVT_DONE;
-    }
-
-    if (!p_cb->repeated)
-    {
-        p_cb->busy = false;
-    }
-    p_cb->handler(&event, p_cb->p_context);
-}
-#endif // TWIM_IN_USE
-
-#ifdef TWI_IN_USE
-static void irq_handler_twi(NRF_TWI_Type * p_twi, twi_control_block_t * p_cb)
-{
-    ASSERT(p_cb->handler);
-
-    if (twi_transfer(p_twi, &p_cb->error, &p_cb->bytes_transferred, p_cb->p_curr_buf, p_cb->curr_length, p_cb->curr_no_stop ))
-    {
-        return;
-    }
-
-    if (!p_cb->error &&
-        ((p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXRX) ||
-         (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXTX)) &&
-        p_cb->p_curr_buf == p_cb->xfer_desc.p_primary_buf)
-    {
-        p_cb->p_curr_buf   = p_cb->xfer_desc.p_secondary_buf;
-        p_cb->curr_length  = p_cb->xfer_desc.secondary_length;
-        p_cb->curr_no_stop = (p_cb->flags & NRF_DRV_TWI_FLAG_TX_NO_STOP);
-
-        if (p_cb->xfer_desc.type == NRF_DRV_TWI_XFER_TXTX)
-        {
-            (void)twi_tx_start_transfer(p_cb, p_twi, p_cb->p_curr_buf, p_cb->curr_length, p_cb->curr_no_stop);
-        }
-        else
-        {
-            (void)twi_rx_start_transfer(p_cb, p_twi, p_cb->p_curr_buf, p_cb->curr_length);
-        }
-    }
-    else
-    {
-        nrf_drv_twi_evt_t event;
-        event.xfer_desc = p_cb->xfer_desc;
-
-        if (p_cb->error)
-        {
-            uint32_t errorsrc = nrf_twi_errorsrc_get_and_clear(p_twi);
-            if (errorsrc & NRF_TWI_ERROR_ADDRESS_NACK)
-            {
-                event.type = NRF_DRV_TWI_EVT_ADDRESS_NACK;
-            }
-            else if (errorsrc & NRF_TWI_ERROR_DATA_NACK)
-            {
-                event.type = NRF_DRV_TWI_EVT_DATA_NACK;
-            }
-        }
-        else
-        {
-            event.type = NRF_DRV_TWI_EVT_DONE;
-        }
-
-        p_cb->busy = false;
-
-        if (!(NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER & p_cb->flags))
-        {
-            p_cb->handler(&event, p_cb->p_context);
-        }
-    }
-
-}
-#endif // TWI_IN_USE
-
-#if TWI0_ENABLED
-IRQ_HANDLER(0)
-{
-    #if (TWI0_USE_EASY_DMA == 1) && defined(NRF52)
-        irq_handler_twim(NRF_TWIM0,
-    #else
-        irq_handler_twi(NRF_TWI0,
-    #endif
-            &m_cb[TWI0_INSTANCE_INDEX]);
-}
-#endif // TWI0_ENABLED
-
-#if TWI1_ENABLED
-IRQ_HANDLER(1)
-{
-    #if (TWI1_USE_EASY_DMA == 1)
-        irq_handler_twim(NRF_TWIM1,
-    #else
-        irq_handler_twi(NRF_TWI1,
-    #endif
-            &m_cb[TWI1_INSTANCE_INDEX]);
-}
-#endif // TWI1_ENABLED


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

Posted by cc...@apache.org.
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/fstorage/fstorage_internal_defs.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage_internal_defs.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage_internal_defs.h
deleted file mode 100644
index 148efdf..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage_internal_defs.h
+++ /dev/null
@@ -1,143 +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.
- *
- */
-
-#ifndef FSTORAGE_INTERNAL_DEFS_H__
-#define FSTORAGE_INTERNAL_DEFS_H__
-
-#include "nrf.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FS_FLAG_INITIALIZED         (1 << 0)  // The module has been initialized.
-#define FS_FLAG_PROCESSING          (1 << 1)  // The module is processing flash operations.
-// The module is waiting for a flash operation initiated by another module to complete.
-#define FS_FLAG_FLASH_REQ_PENDING   (1 << 2)
-
-#define FS_ERASED_WORD              (0xFFFFFFFF)
-
-// Helper macros for section variables.
-#define FS_SECTION_VARS_GET(i)          NRF_SECTION_VARS_GET((i), fs_config_t, fs_data)
-#define FS_SECTION_VARS_COUNT           NRF_SECTION_VARS_COUNT(fs_config_t, fs_data)
-#define FS_SECTION_VARS_START_ADDR      NRF_SECTION_VARS_START_ADDR(fs_data)
-#define FS_SECTION_VARS_END_ADDR        NRF_SECTION_VARS_END_ADDR(fs_data)
-
-
-// Register the section 'fs_data'.
-//lint -save -e19
-NRF_SECTION_VARS_REGISTER_SECTION(fs_data);
-//lint -restore
-
-// Declare symbols into the 'fs_data' section.
-NRF_SECTION_VARS_REGISTER_SYMBOLS(fs_config_t, fs_data);
-//lint -esym(526,fs_dataBase)
-//lint -esym(526,fs_dataLimit)
-
-
-// fstorage op-codes.
-typedef enum
-{
-    FS_OP_NONE,   // No operation.
-    FS_OP_STORE,  // Store data.
-    FS_OP_ERASE   // Erase one or more flash pages.
-} fs_op_code_t;
-
-
-#if defined(__CC_ARM)
-  #pragma push
-  #pragma anon_unions
-#elif defined(__ICCARM__)
-  #pragma language=extended
-#elif defined(__GNUC__)
-  // anonymous unions are enabled by default.
-#endif
-
-// fstorage operation.
-// Encapsulates details of a flash operation to be executed by this module.
-typedef struct
-{
-    fs_config_t  const * p_config;          // Application-specific fstorage configuration.
-    fs_op_code_t         op_code;           // ID of the operation.
-    union
-    {
-        struct
-        {
-            uint32_t const * p_src;         // Pointer to the data to be written to flash.
-            uint32_t const * p_dest;        // Destination of the data in flash.
-            uint16_t         length_words;  // Length of the data to be written, in words.
-            uint16_t         offset;        // Write offset.
-        } store;
-        struct
-        {
-            uint16_t page;
-            uint16_t pages_erased;
-            uint16_t pages_to_erase;
-        } erase;
-    };
-} fs_op_t;
-
-#if defined(__CC_ARM)
-  #pragma pop
-#elif defined(__ICCARM__)
-  // leave anonymous unions enabled.
-#elif defined(__GNUC__)
-  // anonymous unions are enabled by default.
-#endif
-
-
-// Queue of requested operations.
-// This queue holds flash operations requested to the module.
-// The data to be written to flash must be kept in memory until the write operation
-// is completed, i.e., an event indicating completion is received.
-typedef struct
-{
-    fs_op_t  op[FS_QUEUE_SIZE];  // Queue elements.
-    uint32_t rp;                 // Index of the operation being processed.
-    uint32_t count;              // Number of elements in the queue.
-} fs_op_queue_t;
-
-
-// Size of a flash page in bytes.
-#if   defined (NRF51)
-    #define FS_PAGE_SIZE    (1024)
-#elif defined (NRF52)
-    #define FS_PAGE_SIZE    (4096)
-#endif
-
-
-// Size of a flash page in words.
-#define FS_PAGE_SIZE_WORDS  (FS_PAGE_SIZE / sizeof(uint32_t))
-
-
-// Function to obtain the end of the flash space available to fstorage.
-static uint32_t const * fs_flash_page_end_addr()
-{
-    uint32_t const bootloader_addr = NRF_UICR->NRFFW[0];
-
-    return  (uint32_t*)((bootloader_addr != FS_ERASED_WORD) ? bootloader_addr :
-                                                              NRF_FICR->CODESIZE * FS_PAGE_SIZE);
-}
-
-
-// Macro to obtain the address of the last page.
-// If there is a bootloader present the bootloader address read from UICR
-// will act as the page beyond the end of the available flash storage.
-#define FS_PAGE_END_ADDR    (fs_flash_page_end_addr())
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__FSTORAGE_INTERNAL_DEFS_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/fstorage/fstorage_nosd.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage_nosd.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fstorage/fstorage_nosd.c
deleted file mode 100644
index e69de29..0000000

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/gpiote/app_gpiote.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote.c
deleted file mode 100644
index 2ac2c06..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote.c
+++ /dev/null
@@ -1,260 +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 "app_gpiote.h"
-#include "nrf_drv_gpiote.h"
-#include "sdk_common.h"
-
-
-/**@brief GPIOTE user type. */
-typedef struct
-{
-    uint32_t                   pins_mask;             /**< Mask defining which pins user wants to monitor. */
-    uint32_t                   pins_low_to_high_mask; /**< Mask defining which pins will generate events to this user when toggling low->high. */
-    uint32_t                   pins_high_to_low_mask; /**< Mask defining which pins will generate events to this user when toggling high->low. */
-    uint32_t                   sense_high_pins;       /**< Mask defining which pins are configured to generate GPIOTE interrupt on transition to high level. */
-    app_gpiote_event_handler_t event_handler;         /**< Pointer to function to be executed when an event occurs. */
-    bool                       enabled;               /**< Flag indicating whether user is enabled. */
-} gpiote_user_t;
-
-STATIC_ASSERT(sizeof(gpiote_user_t) <= GPIOTE_USER_NODE_SIZE);
-STATIC_ASSERT(sizeof(gpiote_user_t) % 4 == 0);
-
-static uint8_t         m_user_array_size;             /**< Size of user array. */
-static uint8_t         m_user_count;                  /**< Number of registered users. */
-static gpiote_user_t * mp_users = NULL;               /**< Array of GPIOTE users. */
-static uint32_t        m_pins;                        /**< Mask of initialized pins. */
-static uint32_t        m_last_pins_state;             /**< Most recent state of pins. */
-
-#define MODULE_INITIALIZED (mp_users != NULL)
-#include "sdk_macros.h"
-
-void gpiote_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
-{
-    int i;
-    uint32_t pin_mask = 1 << pin;
-    bool hitolo = (m_last_pins_state & pin_mask) ? true : false;
-    m_last_pins_state = nrf_gpio_pins_read();
-
-    for (i = 0; i < m_user_count; i++)
-    {
-        if (mp_users[i].enabled && (pin_mask & mp_users[i].pins_mask))
-        {
-            if ((pin_mask & mp_users[i].pins_high_to_low_mask) && hitolo)
-            {
-                mp_users[i].event_handler(0,pin_mask);
-            }
-            else if ((pin_mask & mp_users[i].pins_low_to_high_mask) && !hitolo)
-            {
-                mp_users[i].event_handler(pin_mask,0);
-            }
-        }
-    }
-}
-
-uint32_t app_gpiote_init(uint8_t max_users, void * p_buffer)
-{
-    uint32_t ret_code = NRF_SUCCESS;
-
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    // Check that buffer is correctly aligned.
-    if (!is_word_aligned(p_buffer))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    // Initialize file globals.
-    mp_users             = (gpiote_user_t *)p_buffer;
-    m_user_array_size    = max_users;
-    m_user_count         = 0;
-    m_pins              = 0;
-
-    memset(mp_users, 0, m_user_array_size * sizeof(gpiote_user_t));
-
-    if (nrf_drv_gpiote_is_init()==false)
-    {
-        ret_code = nrf_drv_gpiote_init();
-    }
-
-    return ret_code;
-}
-
-uint32_t app_gpiote_user_register(app_gpiote_user_id_t     * p_user_id,
-                                  uint32_t                   pins_low_to_high_mask,
-                                  uint32_t                   pins_high_to_low_mask,
-                                  app_gpiote_event_handler_t event_handler)
-{
-    uint32_t user_pin_mask;
-    uint32_t ret_val = NRF_SUCCESS;
-
-    // Check state and parameters.
-    VERIFY_MODULE_INITIALIZED();
-
-    if (event_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (m_user_count >= m_user_array_size)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-    user_pin_mask = pins_low_to_high_mask | pins_high_to_low_mask;
-    // Allocate new user.
-    mp_users[m_user_count].pins_mask             = user_pin_mask;
-    mp_users[m_user_count].pins_low_to_high_mask = pins_low_to_high_mask;
-    mp_users[m_user_count].pins_high_to_low_mask = pins_high_to_low_mask;
-    mp_users[m_user_count].event_handler         = event_handler;
-    mp_users[m_user_count].enabled               = false;
-
-    *p_user_id = m_user_count++;
-
-    uint32_t mask = 1;
-    uint32_t i;
-    const nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
-    for (i = 0; i < 32; i++)
-    {
-        if ((mask & user_pin_mask) & ~m_pins)
-        {
-            ret_val = nrf_drv_gpiote_in_init(i, &config, gpiote_handler);
-            VERIFY_SUCCESS(ret_val);
-            m_pins |= mask;
-        }
-        mask <<= 1;
-    }
-    return ret_val;
-}
-
-__STATIC_INLINE uint32_t error_check(app_gpiote_user_id_t user_id)
-{
-    // Check state and parameters.
-    VERIFY_MODULE_INITIALIZED();
-
-    if (user_id >= m_user_count)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    return NRF_SUCCESS;
-}
-/**
- * @brief Function for enabling event on pin (if not yet enabled) or disabling the event if no other
- *        user requires it.
- *
- * @param pin    Pin to enable
- * @param enable If true function will attempt to enable the pin else it will attempt to disable it.
- */
-static void pin_event_enable(uint32_t pin, bool enable)
-{
-    uint32_t i;
-    uint32_t pin_mask = 1UL << pin;
-    bool enabled = false;
-    //search if any user already enabled given pin
-    for (i = 0; i < m_user_count; i++)
-    {
-        if (mp_users[i].enabled && (mp_users[i].pins_mask & pin_mask))
-        {
-            enabled = true;
-            break;
-        }
-    }
-    if (!enabled)
-    {
-        if (enable)
-        {
-            m_last_pins_state = nrf_gpio_pins_read();
-            nrf_drv_gpiote_in_event_enable(pin, true);
-        }
-        else
-        {
-            nrf_drv_gpiote_in_event_disable(pin);
-        }
-    }
-}
-
-/**
- * @brief Function for enabling or disabling events for pins used by the user.
- *
- * Function will enable pin events only if they are not yet enabled. Function will disable pin
- * events only if there is no other enabled user that is using them.
- *
- * @param user_id  User id.
- * @param enable   If true function will attempt to enable the pin else it will attempt to disable it.
- */
-static uint32_t user_enable(app_gpiote_user_id_t user_id, bool enable)
-{
-    uint32_t ret_code = error_check(user_id);
-
-    if (ret_code == NRF_SUCCESS)
-    {
-        uint32_t i;
-        uint32_t mask = 1UL;
-        for (i = 0; i < 32; i++)
-        {
-            if (mp_users[user_id].pins_mask & mask)
-            {
-                pin_event_enable(i, enable);
-            }
-            mask <<= 1;
-        }
-    }
-    return ret_code;
-}
-
-uint32_t app_gpiote_user_enable(app_gpiote_user_id_t user_id)
-{
-    uint32_t ret_code = NRF_SUCCESS;
-
-    if (mp_users[user_id].enabled == false)
-    {
-        ret_code = user_enable(user_id, true);
-        VERIFY_SUCCESS(ret_code);
-
-        mp_users[user_id].enabled = true;
-        return ret_code;
-    }
-    else
-    {
-        return ret_code;
-    }
-}
-
-uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id)
-{
-    uint32_t ret_code = NRF_SUCCESS;
-
-    if (mp_users[user_id].enabled)
-    {
-        mp_users[user_id].enabled = false;
-        ret_code = user_enable(user_id, false);
-    }
-
-    return ret_code;
-}
-
-uint32_t app_gpiote_pins_state_get(app_gpiote_user_id_t user_id, uint32_t * p_pins)
-{
-    gpiote_user_t * p_user;
-    uint32_t ret_code = error_check(user_id);
-
-    if (ret_code == NRF_SUCCESS)
-    {
-        p_user  = &mp_users[user_id];
-        // Get pins.
-        *p_pins = nrf_gpio_pins_read() & p_user->pins_mask;
-
-    }
-    return ret_code;
-}

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/gpiote/app_gpiote.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote.h
deleted file mode 100644
index b67da2a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright (c) 2012 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 app_gpiote GPIOTE Handler
- * @{
- * @ingroup app_common
- *
- * @brief GPIOTE handler module.
- *
- * @details The GPIOTE handler allows several modules ("users") to share the GPIOTE interrupt,
- *          each user defining a set of pins able to generate events to the user.
- *          When a GPIOTE interrupt occurs, the GPIOTE interrupt handler will call the event handler
- *          of each user for which at least one of the pins generated an event.
- *
- *          The GPIOTE users are responsible for configuring all their corresponding pins, except
- *          the SENSE field, which should be initialized to GPIO_PIN_CNF_SENSE_Disabled.
- *          The SENSE field will be updated by the GPIOTE module when it is enabled or disabled,
- *          and also while it is enabled.
- *
- *          The module specifies on which pins events should be generated if the pin(s) goes
- *          from low->high or high->low or both directions.
- *
- * @note    Even if the application is using the @ref app_scheduler, the GPIOTE event handlers will
- *          be called directly from the GPIOTE interrupt handler.
- *
- * @warning If multiple users registers for the same pins the behavior for those pins are undefined.
- */
-
-#ifndef APP_GPIOTE_H__
-#define APP_GPIOTE_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "nrf.h"
-#include "app_error.h"
-#include "app_util.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define GPIOTE_USER_NODE_SIZE   24          /**< Size of app_gpiote.gpiote_user_t (only for use inside APP_GPIOTE_BUF_SIZE()). */
-#define NO_OF_PINS              32          /**< Number of GPIO pins on the \nRFXX chip. */
-
-/**@brief Compute number of bytes required to hold the GPIOTE data structures.
- *
- * @param[in]   MAX_USERS   Maximum number of GPIOTE users.
- *
- * @retval      Required buffer size (in bytes).
- */
-#define APP_GPIOTE_BUF_SIZE(MAX_USERS)  ((MAX_USERS) * GPIOTE_USER_NODE_SIZE)
-
-typedef uint8_t app_gpiote_user_id_t;
-
-/**@brief GPIOTE event handler type. */
-typedef void (*app_gpiote_event_handler_t)(uint32_t event_pins_low_to_high,
-                                           uint32_t event_pins_high_to_low);
-
-/**@brief GPIOTE input event handler type. */
-typedef void (*app_gpiote_input_event_handler_t)(void);
-
-/**@brief Macro for initializing the GPIOTE module.
- *
- * @details It will handle dimensioning and allocation of the memory buffer required by the module,
- *          making sure that the buffer is correctly aligned.
- *
- * @param[in]   MAX_USERS   Maximum number of GPIOTE users.
- *
- * @note Since this macro allocates a buffer, it must only be called once (it is OK to call it
- *       several times as long as it is from the same location, e.g. to do a reinitialization).
- */
-/*lint -emacro(506, APP_GPIOTE_INIT) */ /* Suppress "Constant value Boolean */
-#define APP_GPIOTE_INIT(MAX_USERS)                                                                 \
-    do                                                                                             \
-    {                                                                                              \
-        static uint32_t app_gpiote_buf[CEIL_DIV(APP_GPIOTE_BUF_SIZE(MAX_USERS), sizeof(uint32_t))];\
-        uint32_t ERR_CODE = app_gpiote_init((MAX_USERS), app_gpiote_buf);                          \
-        APP_ERROR_CHECK(ERR_CODE);                                                                 \
-    } while (0)
-
-/**@brief Function for initializing the GPIOTE module.
- *
- * @note Normally initialization should be done using the APP_GPIOTE_INIT() macro, as that will
- *       allocate the buffer needed by the GPIOTE module (including aligning the buffer correctly).
- *
- * @param[in]   max_users               Maximum number of GPIOTE users.
- * @param[in]   p_buffer                Pointer to memory buffer for internal use in the app_gpiote
- *                                      module. The size of the buffer can be computed using the
- *                                      APP_GPIOTE_BUF_SIZE() macro. The buffer must be aligned to 
- *                                      a 4 byte boundary.
- *
- * @retval      NRF_SUCCESS             Successful initialization.
- * @retval      NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte
- *                                      boundary).
- */
-uint32_t app_gpiote_init(uint8_t max_users, void * p_buffer);
-
-/**@brief Function for registering a GPIOTE user.
- *
- * @param[out]  p_user_id               Id for the new GPIOTE user.
- * @param[in]   pins_low_to_high_mask   Mask defining which pins will generate events to this user 
- *                                      when state is changed from low->high.
- * @param[in]   pins_high_to_low_mask   Mask defining which pins will generate events to this user
- *                                      when state is changed from high->low.
- * @param[in]   event_handler           Pointer to function to be executed when an event occurs.
- *
- * @retval      NRF_SUCCESS             Successful initialization.
- * @retval      NRF_ERROR_INVALID_PARAM Invalid parameter (buffer not aligned to a 4 byte boundary).
- * @retval      NRF_ERROR_INALID_STATE  If @ref app_gpiote_init has not been called on the GPIOTE
- *                                      module.
- * @retval      NRF_ERROR_NO_MEM        Returned if the application tries to register more users
- *                                      than defined when the GPIOTE module was initialized in
- *                                      @ref app_gpiote_init.
- */
-uint32_t app_gpiote_user_register(app_gpiote_user_id_t *     p_user_id,
-                                  uint32_t                   pins_low_to_high_mask,
-                                  uint32_t                   pins_high_to_low_mask,
-                                  app_gpiote_event_handler_t event_handler);
-
-/**@brief Function for informing the GPIOTE module that the specified user wants to use the GPIOTE module.
- *
- * @param[in]   user_id                 Id of user to enable.
- *
- * @retval      NRF_SUCCESS             On success.
- * @retval      NRF_ERROR_INVALID_PARAM Invalid user_id provided, No a valid user.
- * @retval      NRF_ERROR_INALID_STATE  If @ref app_gpiote_init has not been called on the GPIOTE
- *                                      module.
- */
-uint32_t app_gpiote_user_enable(app_gpiote_user_id_t user_id);
-
-/**@brief Function for informing the GPIOTE module that the specified user is done using the GPIOTE module.
- *
- * @param[in]   user_id                   Id of user to enable.
- *
- * @retval      NRF_SUCCESS               On success.
- * @retval      NRF_ERROR_INVALID_PARAM   Invalid user_id provided, No a valid user.
- * @retval      NRF_ERROR_INALID_STATE    If @ref app_gpiote_init has not been called on the GPIOTE
- *                                        module.
- */
-uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id);
-
-/**@brief Function for getting the state of the pins which are registered for the specified user.
- *
- * @param[in]   user_id         Id of user to check.
- * @param[out]  p_pins          Bit mask corresponding to the pins configured to generate events to
- *                              the specified user. All bits corresponding to pins in the state
- *                              'high' will have value '1', all others will have value '0'.
- *
- * @retval      NRF_SUCCESS               On success.
- * @retval      NRF_ERROR_INVALID_PARAM   Invalid user_id provided, No a valid user.
- * @retval      NRF_ERROR_INALID_STATE    If @ref app_gpiote_init has not been called on the GPIOTE
- *                                        module.
- */
-uint32_t app_gpiote_pins_state_get(app_gpiote_user_id_t user_id, uint32_t * p_pins);
-
-/**@brief Function for registering event handlers for GPIOTE IN events.
- *
- * @param[in] channel         GPIOTE channel [0..3].
- * @param[in] pin             Pins associated with GPIOTE channel. Changes on following pins will generate events.
- * @param[in] polarity        Specify operation on input that shall trigger IN event.
- * @param[in] event_handler   Event handler invoked on the IN event in the GPIOTE interrupt.
- *
- * @retval   NRF_SUCCESS                 On success.
- * @retval   NRF_ERROR_INVALID_PARAM     Invalid channel or pin number.
- * @retval   NRF_ERROR_NOT_SUPPORTED     Driver doesn't support IN events.
- */
-uint32_t app_gpiote_input_event_handler_register(const uint8_t channel,
-                                                 const uint32_t pin,
-                                                 const uint32_t polarity,
-                                                 app_gpiote_input_event_handler_t event_handler);
-
-/**@brief Function for unregistering event handlers for GPIOTE IN events.
- *
- * @retval   NRF_SUCCESS                 On success.
- * @retval   NRF_ERROR_NOT_SUPPORTED     Driver doesn't support IN events.
- */
-uint32_t app_gpiote_input_event_handler_unregister(const uint8_t channel);
-
-/**@brief Function for registering event handler invoked at the end of a GPIOTE interrupt.
- *
- * @param[in] event_handler    Event handler invoked at the end of the GPIOTE interrupt.
- *
- * @retval   NRF_SUCCESS                 On success.
- * @retval   NRF_ERROR_NOT_SUPPORTED     Driver doesn't support IN events.
- */
-uint32_t app_gpiote_end_irq_event_handler_register(app_gpiote_input_event_handler_t event_handler);
-
-/**@brief Function for unregistering event handler invoked at the end of a GPIOTE interrupt.
- *
- * @retval   NRF_SUCCESS                 On success.
- * @retval   NRF_ERROR_NOT_SUPPORTED     Driver doesn't support IN events.
- */
-uint32_t app_gpiote_end_irq_event_handler_unregister(void);
-
-/**@brief Function for enabling interrupts in the GPIOTE driver.
- *
- * @retval   NRF_SUCCESS                 On success.
- * @retval   NRF_ERROR_NOT_SUPPORTED     Driver doesn't support.
- */
-uint32_t app_gpiote_enable_interrupts(void);
-
-/**@brief Function for disabling interrupts in the GPIOTE driver.
- *
- * @retval   NRF_SUCCESS                 On success.
- * @retval   NRF_ERROR_NOT_SUPPORTED     Driver doesn't support.
- */
-uint32_t app_gpiote_disable_interrupts(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_GPIOTE_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/gpiote/app_gpiote_fast_detect.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote_fast_detect.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote_fast_detect.c
deleted file mode 100644
index 88b3dc2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/gpiote/app_gpiote_fast_detect.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/* Copyright (c) 2012 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 "app_gpiote.h"
-#include <stdlib.h>
-#include "app_util_platform.h"
-#include "nrf_gpio.h"
-#include "sdk_common.h"
-
-#define NRF51_GPIOTE_CHANNEL 4
-#define NRF51_PINS           31
-
-#ifdef NRF51
-#define SWI_IRQHandler SWI1_IRQHandler
-#define SWI_IRQn       SWI1_IRQn
-#elif defined NRF52
-#define SWI_IRQHandler SWI1_EGU1_IRQHAndler
-#define SWI_IRQn       SWI1_EGU1_IRQn
-#endif
-
-/**@brief GPIOTE user type. */
-typedef struct
-{
-    uint32_t                   pins_mask;             /**< Mask defining which pins user wants to monitor. */
-    uint32_t                   pins_low_to_high_mask; /**< Mask defining which pins will generate events to this user when toggling low->high. */
-    uint32_t                   pins_high_to_low_mask; /**< Mask defining which pins will generate events to this user when toggling high->low. */
-    uint32_t                   sense_high_pins;       /**< Mask defining which pins are configured to generate GPIOTE interrupt on transition to high level. */
-    app_gpiote_event_handler_t event_handler;         /**< Pointer to function to be executed when an event occurs. */
-} gpiote_user_t;
-
-STATIC_ASSERT(sizeof (gpiote_user_t) <= GPIOTE_USER_NODE_SIZE);
-STATIC_ASSERT(sizeof (gpiote_user_t) % 4 == 0);
-
-static uint32_t        m_enabled_users_mask; /**< Mask for tracking which users are enabled. */
-static uint8_t         m_user_array_size;    /**< Size of user array. */
-static uint8_t         m_user_count;         /**< Number of registered users. */
-static gpiote_user_t * mp_users = NULL;      /**< Array of GPIOTE users. */
-
-#define MODULE_INITIALIZED (mp_users != NULL)
-#include "sdk_macros.h"
-
-static app_gpiote_input_event_handler_t m_app_gpiote_input_event_handlers[4] = {0};
-
-static app_gpiote_input_event_handler_t m_app_gpiote_end_irq_event_handler = NULL;
-
-/**@brief Function for toggling sense level for specified pins.
- *
- * @param[in]   p_user   Pointer to user structure.
- * @param[in]   pins     Bitmask specifying for which pins the sense level is to be toggled.
- */
-static void sense_level_toggle(gpiote_user_t * p_user, uint32_t pins)
-{
-    uint32_t pin_no;
-
-    for (pin_no = 0; pin_no < NO_OF_PINS; pin_no++)
-    {
-        uint32_t pin_mask = (1 << pin_no);
-
-        if ((pins & pin_mask) != 0)
-        {
-            uint32_t sense;
-
-            //Invert sensing.
-            if ((p_user->sense_high_pins & pin_mask) == 0)
-            {
-                sense                    = GPIO_PIN_CNF_SENSE_High << GPIO_PIN_CNF_SENSE_Pos;
-                p_user->sense_high_pins |= pin_mask;
-            }
-            else
-            {
-                sense                    = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos;
-                p_user->sense_high_pins &= ~pin_mask;
-            }
-
-            NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
-            NRF_GPIO->PIN_CNF[pin_no] |= sense;
-        }
-    }
-}
-
-
-/**@brief Function for handling the GPIOTE interrupt.
- */
-void GPIOTE_IRQHandler(void)
-{
-    bool gpiote_in_evt   = false;
-    bool gpiote_port_evt = false;
-
-    if ((NRF_GPIOTE->EVENTS_IN[0] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN0_Msk))
-    {
-        NRF_GPIOTE->EVENTS_IN[0] = 0;
-        gpiote_in_evt            = true;
-
-        if (m_app_gpiote_input_event_handlers[0])
-        {
-            m_app_gpiote_input_event_handlers[0]();
-        }
-    }
-
-    if ((NRF_GPIOTE->EVENTS_IN[1] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN1_Msk))
-    {
-        NRF_GPIOTE->EVENTS_IN[1] = 0;
-        gpiote_in_evt            = true;
-
-        if (m_app_gpiote_input_event_handlers[1])
-        {
-            m_app_gpiote_input_event_handlers[1]();
-        }
-    }
-
-    if ((NRF_GPIOTE->EVENTS_IN[2] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN2_Msk))
-    {
-        NRF_GPIOTE->EVENTS_IN[2] = 0;
-        gpiote_in_evt            = true;
-
-        if (m_app_gpiote_input_event_handlers[2])
-        {
-            m_app_gpiote_input_event_handlers[2]();
-        }
-    }
-
-    if ((NRF_GPIOTE->EVENTS_IN[3] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN3_Msk))
-    {
-        NRF_GPIOTE->EVENTS_IN[3] = 0;
-        gpiote_in_evt            = true;
-
-        if (m_app_gpiote_input_event_handlers[3])
-        {
-            m_app_gpiote_input_event_handlers[3]();
-        }
-    }
-
-    if ((NRF_GPIOTE->EVENTS_PORT == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_PORT_Msk))
-    {
-        //Clear event.
-        NRF_GPIOTE->EVENTS_PORT = 0;
-
-        gpiote_port_evt = true;
-    }
-
-    if (m_app_gpiote_end_irq_event_handler && gpiote_in_evt)
-    {
-        m_app_gpiote_end_irq_event_handler();
-    }
-
-    if (gpiote_port_evt)
-    {
-        NVIC_SetPendingIRQ(SWI_IRQn);
-    }
-}
-
-
-/**@brief Function for handling the SWI1 interrupt.
- */
-void SWI_IRQHandler(void)
-{
-    uint8_t  i;
-    uint32_t pins_changed;
-    uint32_t pins_state = NRF_GPIO->IN;
-
-    //Check all users.
-    for (i = 0; i < m_user_count; i++)
-    {
-        gpiote_user_t * p_user = &mp_users[i];
-
-        //Check if user is enabled.
-        if (((1 << i) & m_enabled_users_mask) != 0)
-        {
-            uint32_t transition_pins;
-            uint32_t event_low_to_high;
-            uint32_t event_high_to_low;
-
-            //Find set of pins on which there has been a transition.
-            transition_pins = (pins_state ^ ~p_user->sense_high_pins) & p_user->pins_mask;
-
-            //Toggle SENSE level for all pins that have changed state.
-            sense_level_toggle(p_user, transition_pins);
-
-            //Second read after setting sense.
-            //Check if any pins have changed while serving this interrupt.
-            pins_changed = NRF_GPIO->IN ^ pins_state;
-
-            if (pins_changed)
-            {
-                //Transition pins detected in late stage.
-                uint32_t late_transition_pins;
-
-                pins_state |= pins_changed;
-
-                //Find set of pins on which there has been a transition.
-                late_transition_pins = (pins_state ^ ~p_user->sense_high_pins) & p_user->pins_mask;
-
-                //Toggle SENSE level for all pins that have changed state in last phase.
-                sense_level_toggle(p_user, late_transition_pins);
-
-                //Update pins that has changed state since the interrupt occurred.
-                transition_pins |= late_transition_pins;
-            }
-
-            //Call user event handler if an event has occurred.
-            event_high_to_low = (~pins_state & p_user->pins_high_to_low_mask) & transition_pins;
-            event_low_to_high = (pins_state & p_user->pins_low_to_high_mask) & transition_pins;
-
-            if ((event_low_to_high | event_high_to_low) != 0)
-            {
-                p_user->event_handler(event_low_to_high, event_high_to_low);
-            }
-        }
-    }
-}
-
-
-/**@brief Function for enabling interrupt SWI1.
- */
-static void app_gpiote_swi1_enable_irq(void)
-{
-    NVIC_ClearPendingIRQ(SWI_IRQn);
-    NVIC_SetPriority(SWI_IRQn, APP_IRQ_PRIORITY_LOW);
-    NVIC_EnableIRQ(SWI_IRQn);
-}
-
-/**@brief Function for disabling interrupt SWI1.
- */
-static void app_gpiote_swi1_disable_irq(void)
-{
-    NVIC_DisableIRQ(SWI_IRQn);
-}
-
-/**@brief Function for sense disabling for all pins for specified user.
- *
- * @param[in]  user_id   User id.
- */
-static void pins_sense_disable(app_gpiote_user_id_t user_id)
-{
-    uint32_t pin_no;
-
-    for (pin_no = 0; pin_no < 32; pin_no++)
-    {
-        if ((mp_users[user_id].pins_mask & (1 << pin_no)) != 0)
-        {
-            NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
-            NRF_GPIO->PIN_CNF[pin_no] |= GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos;
-        }
-    }
-}
-
-
-uint32_t app_gpiote_init(uint8_t max_users, void * p_buffer)
-{
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    //Check that buffer is correctly aligned.
-    if (!is_word_aligned(p_buffer))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    //Initialize file globals.
-    mp_users             = (gpiote_user_t *)p_buffer;
-    m_user_array_size    = max_users;
-    m_user_count         = 0;
-    m_enabled_users_mask = 0;
-
-    memset(mp_users, 0, m_user_array_size * sizeof (gpiote_user_t));
-
-    (void)app_gpiote_enable_interrupts();
-
-    return NRF_SUCCESS;
-}
-
-uint32_t app_gpiote_user_register(app_gpiote_user_id_t *     p_user_id,
-                                  uint32_t                   pins_low_to_high_mask,
-                                  uint32_t                   pins_high_to_low_mask,
-                                  app_gpiote_event_handler_t event_handler)
-{
-    //Check state and parameters.
-    VERIFY_MODULE_INITIALIZED();
-
-    if (event_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (m_user_count >= m_user_array_size)
-    {
-        return NRF_ERROR_NO_MEM;
-    }
-
-    //Allocate new user.
-    mp_users[m_user_count].pins_mask             = pins_low_to_high_mask | pins_high_to_low_mask;
-    mp_users[m_user_count].pins_low_to_high_mask = pins_low_to_high_mask;
-    mp_users[m_user_count].pins_high_to_low_mask = pins_high_to_low_mask;
-    mp_users[m_user_count].event_handler         = event_handler;
-
-    *p_user_id = m_user_count++;
-
-    //Make sure SENSE is disabled for all pins.
-    pins_sense_disable(*p_user_id);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t app_gpiote_enable_interrupts(void)
-{
-    NVIC_ClearPendingIRQ(GPIOTE_IRQn);
-    NVIC_SetPriority(GPIOTE_IRQn, APP_IRQ_PRIORITY_HIGH);
-    NVIC_EnableIRQ(GPIOTE_IRQn);
-
-    //Enable interrupt SWI1.
-    app_gpiote_swi1_enable_irq();
-
-    return NRF_SUCCESS;
-}
-
-uint32_t app_gpiote_disable_interrupts(void)
-{
-    NVIC_DisableIRQ(GPIOTE_IRQn);
-
-    //Disable interrupt SWI1.
-    app_gpiote_swi1_disable_irq();
-
-    return NRF_SUCCESS;
-}
-
-uint32_t app_gpiote_input_event_handler_register(const uint8_t                    channel,
-                                                 const uint32_t                   pin,
-                                                 const uint32_t                   polarity,
-                                                 app_gpiote_input_event_handler_t event_handler)
-{
-    if (channel < NRF51_GPIOTE_CHANNEL && pin < NRF51_PINS)
-    {
-        NRF_GPIOTE->CONFIG[channel] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) |
-                                      (pin << GPIOTE_CONFIG_PSEL_Pos) |
-                                      (polarity << GPIOTE_CONFIG_POLARITY_Pos);
-
-        switch (channel)
-        {
-            case 0:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN0_Enabled << GPIOTE_INTENSET_IN0_Pos);
-                break;
-
-            case 1:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN1_Enabled << GPIOTE_INTENSET_IN1_Pos);
-                break;
-
-            case 2:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN2_Enabled << GPIOTE_INTENSET_IN2_Pos);
-                break;
-
-            case 3:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN3_Enabled << GPIOTE_INTENSET_IN3_Pos);
-                break;
-
-            default:
-                break;
-        }
-
-        m_app_gpiote_input_event_handlers[channel] = event_handler;
-
-        return NRF_SUCCESS;
-    }
-
-    return NRF_ERROR_INVALID_PARAM;
-}
-
-uint32_t app_gpiote_input_event_handler_unregister(const uint8_t channel)
-{
-    if (channel < NRF51_GPIOTE_CHANNEL)
-    {
-        const uint32_t pin_not_connected = 31UL;
-
-        NRF_GPIOTE->CONFIG[channel] = (GPIOTE_CONFIG_MODE_Disabled << GPIOTE_CONFIG_MODE_Pos) |
-                                      (pin_not_connected << GPIOTE_CONFIG_PSEL_Pos) |
-                                      (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos);
-
-        switch (channel)
-        {
-            case 0:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN0_Disabled << GPIOTE_INTENSET_IN0_Pos);
-                break;
-
-            case 1:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN1_Disabled << GPIOTE_INTENSET_IN1_Pos);
-                break;
-
-            case 2:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN2_Disabled << GPIOTE_INTENSET_IN2_Pos);
-                break;
-
-            case 3:
-                NRF_GPIOTE->INTENSET |= (GPIOTE_INTENSET_IN3_Disabled << GPIOTE_INTENSET_IN3_Pos);
-                break;
-
-            default:
-                break;
-        }
-
-        m_app_gpiote_input_event_handlers[channel] = NULL;
-
-        return NRF_SUCCESS;
-    }
-
-    return NRF_ERROR_INVALID_PARAM;
-}
-
-uint32_t app_gpiote_end_irq_event_handler_register(app_gpiote_input_event_handler_t event_handler)
-{
-    m_app_gpiote_end_irq_event_handler = event_handler;
-    return NRF_SUCCESS;
-}
-
-uint32_t app_gpiote_end_irq_event_handler_unregister(void)
-{
-    m_app_gpiote_end_irq_event_handler = NULL;
-    return NRF_SUCCESS;
-}
-
-uint32_t app_gpiote_user_enable(app_gpiote_user_id_t user_id)
-{
-    uint32_t pin_no;
-    uint32_t pins_state;
-
-    //Check state and parameters.
-    VERIFY_MODULE_INITIALIZED();
-
-    if (user_id >= m_user_count)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    //Clear any pending event.
-    NRF_GPIOTE->EVENTS_PORT = 0;
-    pins_state              = NRF_GPIO->IN;
-
-    //Enable user.
-    if (m_enabled_users_mask == 0)
-    {
-        NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_PORT_Msk;
-    }
-    m_enabled_users_mask |= (1 << user_id);
-
-    //Enable sensing for all pins for specified user.
-    mp_users[user_id].sense_high_pins = 0;
-
-    for (pin_no = 0; pin_no < 32; pin_no++)
-    {
-        uint32_t pin_mask = (1 << pin_no);
-
-        if ((mp_users[user_id].pins_mask & pin_mask) != 0)
-        {
-            uint32_t sense;
-
-            if ((pins_state & pin_mask) != 0)
-            {
-                sense = GPIO_PIN_CNF_SENSE_Low << GPIO_PIN_CNF_SENSE_Pos;
-            }
-            else
-            {
-                sense = GPIO_PIN_CNF_SENSE_High <<
-                        GPIO_PIN_CNF_SENSE_Pos;
-                mp_users[user_id].sense_high_pins |= pin_mask;
-            }
-
-            NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk;
-            NRF_GPIO->PIN_CNF[pin_no] |= sense;
-        }
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_gpiote_user_disable(app_gpiote_user_id_t user_id)
-{
-    //Check state and parameters.
-    VERIFY_MODULE_INITIALIZED();
-
-    if (user_id >= m_user_count)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    //Disable sensing for all pins for specified user.
-    pins_sense_disable(user_id);
-
-    //Disable user.
-    m_enabled_users_mask &= ~(1UL << user_id);
-
-    if (m_enabled_users_mask == 0)
-    {
-        NRF_GPIOTE->INTENCLR = GPIOTE_INTENSET_PORT_Msk;
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_gpiote_pins_state_get(app_gpiote_user_id_t user_id, uint32_t * p_pins)
-{
-    gpiote_user_t * p_user;
-
-    //Check state and parameters.
-    VERIFY_MODULE_INITIALIZED();
-
-    if (user_id >= m_user_count)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    //Get pins.
-    p_user  = &mp_users[user_id];
-    *p_pins = NRF_GPIO->IN & p_user->pins_mask;
-
-    return NRF_SUCCESS;
-}

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/hardfault/hardfault.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/hardfault.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/hardfault.h
deleted file mode 100644
index 98704d1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/hardfault.h
+++ /dev/null
@@ -1,68 +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.
- *
- */
-#ifndef HARFAULT_H__
-#define HARFAULT_H__
-#include <stdint.h>
-#include <stddef.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup hardfault_default HardFault exception
- * @{
- * @brief Default HardFault exception implementation.
- * @ingroup app_common
- */
-
-/**
- * @brief Contents of the stack.
- *
- * This structure is used to re-create the stack layout after a HardFault exception was raised.
- */
-typedef struct HardFault_stack
-{
-    uint32_t r0;  ///< R0 register.
-    uint32_t r1;  ///< R1 register.
-    uint32_t r2;  ///< R2 register.
-    uint32_t r3;  ///< R3 register.
-    uint32_t r12; ///< R12 register.
-    uint32_t lr;  ///< Link register.
-    uint32_t pc;  ///< Program counter.
-    uint32_t psr; ///< Program status register.
-}HardFault_stack_t;
-
-/**
- * @brief Function for processing HardFault exceptions.
- *
- * An application that needs to process HardFault exceptions should provide an implementation of this function.
- * It will be called from the HardFault handler.
- * If no implementation is provided, the library uses a default one, which just restarts the MCU.
- *
- * @note If the DEBUG_NRF macro is defined, the software breakpoint is set just before the call 
- *       to this function.
- *
- * @param p_stack Pointer to the stack bottom.
- *                This pointer might be NULL if the HardFault was called when the main stack was
- *                the active stack and a stack overrun is detected.
- *                In such a situation, the stack pointer is reinitialized to the default position,
- *                and the stack content is lost.
- */
-void HardFault_process(HardFault_stack_t *p_stack);
-
-/** @} */
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HARFAULT_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/hardfault/hardfault_implementation.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/hardfault_implementation.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/hardfault_implementation.c
deleted file mode 100644
index 0a5fee8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/hardfault_implementation.c
+++ /dev/null
@@ -1,47 +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 "hardfault.h"
-#include "nrf.h"
-#include "compiler_abstraction.h"
-#include "nordic_common.h"
-#ifdef SOFTDEVICE_PRESENT
-#include "nrf_soc.h"
-#endif
-
-#if defined(DEBUG_NRF)
-/**
- * @brief Pointer to the last received stack pointer.
- *
- * This pointer is set in the debug version of the HardFault handler.
- * It helps to debug HardFault reasons.
- */
-volatile HardFault_stack_t *HardFault_p_stack;
-#endif
-
-/*lint -save -e14 */
-__WEAK void HardFault_process(HardFault_stack_t *p_stack)
-{
-    // Restart the system by default
-    NVIC_SystemReset();
-}
-/*lint -restore */
-
-void HardFault_c_handler( uint32_t *p_stack_address )
-{
-#if defined(DEBUG_NRF)
-    HardFault_p_stack = (HardFault_stack_t*)p_stack_address;
-    /* Generate breakpoint if debugger is connected */
-    __BKPT(0);
-#endif
-
-    HardFault_process((HardFault_stack_t*)p_stack_address);
-}

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/hardfault/nrf51/handler/hardfault_handler_gcc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_gcc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_gcc.c
deleted file mode 100644
index e29b6c0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_gcc.c
+++ /dev/null
@@ -1,52 +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 <stdint.h>
-
-void HardFault_Handler(void) __attribute__(( naked ));
-
-void HardFault_Handler(void)
-{
-    __asm volatile(
-    "   .syntax unified                        \n"
-
-    "   ldr   r0, =0xFFFFFFFD                  \n"
-    "   cmp   r0, lr                           \n"
-    "   bne   HardFault_Handler_ChooseMSP      \n"
-    /* Reading PSP into R0 */
-    "   mrs   r0, PSP                          \n"
-    "   b     HardFault_Handler_Continue       \n"
-    "HardFault_Handler_ChooseMSP:              \n"
-    /* Reading MSP into R0 */
-    "   mrs   r0, MSP                          \n"
-    /* -----------------------------------------------------------------
-     * If we have selected MSP check if we may use stack safetly.
-     * If not - reset the stack to the initial value. */
-    "   ldr   r1, =__StackTop                  \n"
-    "   ldr   r2, =__StackLimit                \n"
-
-    /* MSP is in the range of <__StackTop, __StackLimit) */
-    "   cmp   r0, r1                           \n"
-    "   bhi   HardFault_MoveSP                 \n"
-    "   cmp   r0, r2                           \n"
-    "   bhi   HardFault_Handler_Continue       \n"
-    /* ----------------------------------------------------------------- */
-    "HardFault_MoveSP:                         \n"
-    "   mov   SP, r1                           \n"
-    "   movs  r0, #0                           \n"
-
-    "HardFault_Handler_Continue:               \n"
-    "   ldr r3, =HardFault_c_handler           \n"
-    "   bx r3                                  \n"
-
-    "   .align                                 \n"
-    );
-}

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/hardfault/nrf51/handler/hardfault_handler_iar.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_iar.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_iar.c
deleted file mode 100644
index cfd341b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_iar.c
+++ /dev/null
@@ -1,65 +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 <stdint.h>
-
-#pragma section = "CSTACK"
-extern void HardFault_c_handler( uint32_t * );
-
-__stackless void HardFault_Handler(void);
-
-__stackless void HardFault_Handler(void)
-{
-    __asm volatile(
-    "   ldr   r0, 100f                         \n"
-    "   cmp   r0, lr                           \n"
-    "   bne   1f                               \n"
-    /* Reading PSP into R0 */
-    "   mrs   r0, PSP                          \n"
-    "   b     3f                               \n"
-    "1:                                        \n"
-    /* Reading MSP into R0 */
-    "   mrs   r0, MSP                          \n"
-    /* -----------------------------------------------------------------
-     * If we have selected MSP check if we may use stack safetly.
-     * If not - reset the stack to the initial value. */
-    "   ldr   r1, 101f                         \n"
-    "   ldr   r2, 102f                         \n"
-
-    /* MSP is in the range of <__StackTop, __StackLimit) */
-    "   cmp   r0, r1                           \n"
-    "   bhi   2f                               \n"
-    "   cmp   r0, r2                           \n"
-    "   bhi   3f                               \n"
-    /* ----------------------------------------------------------------- */
-    "2:                                        \n"
-    "   mov   SP, r1                           \n"
-    "   movs  r0, #0                           \n"
-
-    "3:                                        \n"
-    "   ldr r3, 103f                           \n"
-    "   bx r3                                  \n"
-
-    "100:                                      \n"
-    "   DC32 0xFFFFFFFD                        \n"
-    "101:                                      \n"
-    "   DC32 %c0                               \n"
-    "102:                                      \n"
-    "   DC32 %c1                               \n"
-    "103:                                      \n"
-    "   DC32 %c2                               \n"
-    : /* Outputs */
-    : /* Inputs */
-    "i"(__section_end("CSTACK")),
-    "i"(__section_begin("CSTACK")),
-    "i"(&HardFault_c_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/libraries/hardfault/nrf51/handler/hardfault_handler_keil.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_keil.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_keil.c
deleted file mode 100644
index 2b88df9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf51/handler/hardfault_handler_keil.c
+++ /dev/null
@@ -1,61 +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 <stdint.h>
-
-//lint -save -e27 -e10 -e19 -e40
-extern char STACK$$Base;
-
-/* This variable should be static but then it cannot be used in assembly code below.
- * The problem here is that the address of the section can be archived by $$ operator
- * that is not allowed in assembly code. */
-char const * HardFault_Handler_stack_bottom = &STACK$$Base;
-//lint -restore
-
-__asm void HardFault_Handler(void)
-{
-    PRESERVE8
-    EXTERN HardFault_c_handler
-    EXTERN __initial_sp
-    EXTERN HardFault_Handler_stack_bottom
-
-    ldr   r0, =0xFFFFFFFD
-    cmp   r0, lr
-    bne   HardFault_Handler_ChooseMSP
-    /* Reading PSP into R0 */
-    mrs   r0, PSP
-    b     HardFault_Handler_Continue
-HardFault_Handler_ChooseMSP
-    /* Reading MSP into R0 */
-    mrs   r0, MSP
-    /* -----------------------------------------------------------------
-     * If we have selected MSP, check if we may use stack safely.
-     * If not - reset the stack to the initial value. */
-    ldr   r1, =__initial_sp
-    ldr   r2, =HardFault_Handler_stack_bottom
-    ldr   r2, [r2]
-
-    /* MSP is in the range of <__StackTop, __StackLimit) */
-    cmp   r0, r1
-    bhi   HardFault_MoveSP
-    cmp   r0, r2
-    bhi   HardFault_Handler_Continue
-    /* ----------------------------------------------------------------- */
-HardFault_MoveSP
-    mov   SP, r1
-    movs  r0, #0
-
-HardFault_Handler_Continue
-    ldr r3, =HardFault_c_handler
-    bx r3
-
-    ALIGN
-}

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/hardfault/nrf52/handler/hardfault_handler_gcc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c
deleted file mode 100644
index 8d2bb99..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_gcc.c
+++ /dev/null
@@ -1,49 +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 <stdint.h>
-
-void HardFault_Handler(void) __attribute__(( naked ));
-
-void HardFault_Handler(void)
-{
-    __asm volatile(
-    "   ldr r3, =HardFault_c_handler            \n"
-    "   tst lr, #4                              \n"
-
-    /* PSP is quite simple and does not require additional handler */
-    "   itt ne                                  \n"
-    "   mrsne r0, psp                           \n"
-    /* Jump to the handler, do not store LR - returning from handler just exits exception */
-    "   bxne  r3                                \n"
-
-    /* Processing MSP requires stack checking */
-    "   mrs r0, msp                             \n"
-
-    "   ldr   r1, =__StackTop                   \n"
-    "   ldr   r2, =__StackLimit                 \n"
-
-    /* MSP is in the range of <__StackTop, __StackLimit) */
-    "   cmp   r0, r1                            \n"
-    "   bhi   HardFault_MoveSP                  \n"
-    "   cmp   r0, r2                            \n"
-    "   bhi   HardFault_Handler_Continue        \n"
-
-    "HardFault_MoveSP:                          \n"
-    "   mov   sp, r1                            \n"
-    "   mov   r0, #0                            \n"
-
-    "HardFault_Handler_Continue:                \n"
-    "   bx r3                                   \n"
-
-    "   .align                                  \n"
-    );
-}

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/hardfault/nrf52/handler/hardfault_handler_iar.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_iar.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_iar.c
deleted file mode 100644
index d390c4a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_iar.c
+++ /dev/null
@@ -1,64 +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 <stdint.h>
-
-#pragma section = "CSTACK"
-extern void HardFault_c_handler( uint32_t * );
-
-__stackless void HardFault_Handler(void);
-
-__stackless void HardFault_Handler(void)
-{
-    __asm volatile(
-    "   ldr.n r3, 103f                          \n"
-    "   tst   lr, #4                            \n"
-
-    /* PSP is quite simple and does not require additional handler */
-    "   itt   ne                                \n"
-    "   mrsne r0, psp                           \n"
-    /* Jump to the handler, do not store LR - returning from handler just exits exception */
-    "   bxne  r3                                \n"
-
-    /* Processing MSP requires stack checking */
-    "   mrs r0, msp                             \n"
-
-    "   ldr.n r1, 101f                          \n"
-    "   ldr.n r2, 102f                          \n"
-
-    /* MSP is in the range of <__StackTop, __StackLimit) */
-    "   cmp   r0, r1                            \n"
-    "   bhi.n 1f                                \n"
-    "   cmp   r0, r2                            \n"
-    "   bhi.n 2f                                \n"
-
-    "1:                                         \n"
-    "   mov   sp, r1                            \n"
-    "   mov   r0, #0                            \n"
-
-    "2:                                         \n"
-    "   bx r3                                   \n"
-    /* Data alignment if required */
-    "   nop                                     \n"
-
-    "101:                                       \n"
-    "   DC32 %c0                                \n"
-    "102:                                       \n"
-    "   DC32 %c1                                \n"
-    "103:                                       \n"
-    "   DC32 %c2                                \n"
-    : /* Outputs */
-    : /* Inputs */
-    "i"(__section_end("CSTACK")),
-    "i"(__section_begin("CSTACK")),
-    "i"(&HardFault_c_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/libraries/hardfault/nrf52/handler/hardfault_handler_keil.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_keil.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_keil.c
deleted file mode 100644
index ad9642c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hardfault/nrf52/handler/hardfault_handler_keil.c
+++ /dev/null
@@ -1,60 +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 <stdint.h>
-
-//lint -save -e27 -e10 -e19 -e40
-extern char STACK$$Base;
-
-/* This variable should be static but then it cannot be used in assembly code below.
- * The problem here is that the address of the section can be archived by $$ operator
- * that is not allowed in assembly code. */
-char const * HardFault_Handler_stack_bottom = &STACK$$Base;
-//lint -restore
-
-__asm void HardFault_Handler(void)
-{
-    PRESERVE8
-    EXTERN HardFault_c_handler
-    EXTERN __initial_sp
-    EXTERN HardFault_Handler_stack_bottom
-
-    ldr r3, =HardFault_c_handler
-    tst lr, #4
-
-    /* PSP is quite simple and does not require additional handler */
-    itt ne
-    mrsne r0, psp
-    /* Jump to the handler, do not store LR - returning from handler just exits exception */
-    bxne  r3
-
-    /* Processing MSP requires stack checking */
-    mrs r0, msp
-
-    ldr   r1, =__initial_sp
-    ldr   r2, =HardFault_Handler_stack_bottom
-    ldr   r2, [r2]
-
-    /* MSP is in the range of <__StackTop, __StackLimit) */
-    cmp   r0, r1
-    bhi   HardFault_MoveSP
-    cmp   r0, r2
-    bhi   HardFault_Handler_Continue
-
-HardFault_MoveSP
-    mov   sp, r1
-    mov   r0, #0
-
-HardFault_Handler_Continue
-    bx r3
-
-    ALIGN
-}

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/hci/config/hci_mem_pool_internal.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/config/hci_mem_pool_internal.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/config/hci_mem_pool_internal.h
deleted file mode 100644
index 90e968f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/config/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       600u         /**< TX buffer size in bytes. */
-#define RX_BUF_SIZE       TX_BUF_SIZE  /**< RX buffer size in bytes. */
-
-#define RX_BUF_QUEUE_SIZE 4u           /**< 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/hci/config/hci_transport_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/config/hci_transport_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/config/hci_transport_config.h
deleted file mode 100644
index 0773118..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/config/hci_transport_config.h
+++ /dev/null
@@ -1,48 +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
- *
- * @brief Definition of HCI Transport Layer configurable parameters
- */
-
-#ifndef HCI_TRANSPORT_CFG_H__
-#define HCI_TRANSPORT_CFG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** This section covers configurable parameters for the HCI Transport SLIP layer. */
-#define HCI_SLIP_UART_RX_PIN_NUMBER  1                      /**< Defines the UART RX pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_TX_PIN_NUMBER  2                      /**< Defines the UART TX pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_RTS_PIN_NUMBER 3                     /**< Defines the UART RTS pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_CTS_PIN_NUMBER 4                     /**< Defines the UART CTS pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_MODE           APP_UART_FLOW_CONTROL_ENABLED      /**< Defines the UART mode to be used. Use UART Low Power with Flow Control - Valid values are defined in \ref app_uart_flow_control_t. For further information on the UART Low Power mode, please refer to: \ref app_uart . */
-
-#define HCI_SLIP_UART_BAUDRATE       UART_BAUDRATE_BAUDRATE_Baud38400   /**< Defines the UART Baud rate. Default is 38400 baud. */
-
-/** This section covers configurable parameters for the HCI Transport layer that are used for calculating correct value for the retransmission timer timeout. */
-#define MAX_PACKET_SIZE_IN_BITS      8000u                              /**< Maximum size of a single application packet in bits. */      
-#define USED_BAUD_RATE               38400u                             /**< The used uart baudrate. */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // HCI_TRANSPORT_CFG_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/hci/hci_mem_pool.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_mem_pool.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_mem_pool.c
deleted file mode 100644
index 3d25839..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_mem_pool.c
+++ /dev/null
@@ -1,235 +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 "hci_mem_pool.h"
-#include "hci_mem_pool_internal.h"
-#include <stdbool.h>
-#include <stdio.h>
-
-/**@brief RX buffer element instance structure. 
- */
-typedef struct 
-{
-    uint8_t  rx_buffer[RX_BUF_SIZE];                                /**< RX buffer memory array. */  
-    uint32_t length;                                                /**< Length of the RX buffer memory array. */
-} rx_buffer_elem_t;
-
-/**@brief RX buffer queue element instance structure. 
- */
-typedef struct 
-{
-    rx_buffer_elem_t * p_buffer;                                    /**< Pointer to RX buffer element. */
-    uint32_t           free_window_count;                           /**< Free space element count. */
-    uint32_t           free_available_count;                        /**< Free area element count. */
-    uint32_t           read_available_count;                        /**< Read area element count. */
-    uint32_t           write_index;                                 /**< Write position index. */                                      
-    uint32_t           read_index;                                  /**< Read position index. */                                                                            
-    uint32_t           free_index;                                  /**< Free position index. */                                                                                                                  
-} rx_buffer_queue_t;
-
-static bool              m_is_tx_allocated;                         /**< Boolean value to determine if the TX buffer is allocated. */
-static rx_buffer_elem_t  m_rx_buffer_elem_queue[RX_BUF_QUEUE_SIZE]; /**< RX buffer element instances. */
-static rx_buffer_queue_t m_rx_buffer_queue;                         /**< RX buffer queue element instance. */
-
-
-uint32_t hci_mem_pool_open(void)
-{
-    m_is_tx_allocated                      = false;    
-    m_rx_buffer_queue.p_buffer             = m_rx_buffer_elem_queue;
-    m_rx_buffer_queue.free_window_count    = RX_BUF_QUEUE_SIZE;
-    m_rx_buffer_queue.free_available_count = 0;
-    m_rx_buffer_queue.read_available_count = 0;
-    m_rx_buffer_queue.write_index          = 0;    
-    m_rx_buffer_queue.read_index           = 0;        
-    m_rx_buffer_queue.free_index           = 0;            
-    
-    return NRF_SUCCESS;
-}
-
-
-uint32_t hci_mem_pool_close(void)
-{    
-    return NRF_SUCCESS;
-}
-
-
-uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer)
-{
-    static uint8_t tx_buffer[TX_BUF_SIZE];  
-
-    uint32_t err_code;
-    
-    if (pp_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-    
-    if (!m_is_tx_allocated)
-    {        
-            m_is_tx_allocated = true;
-            *pp_buffer        = tx_buffer;
-            err_code          = NRF_SUCCESS;
-    }
-    else
-    {
-        err_code              = NRF_ERROR_NO_MEM;
-    }
-    
-    return err_code;
-}
-
-
-uint32_t hci_mem_pool_tx_free(void)
-{
-    m_is_tx_allocated = false;
-    
-    return NRF_SUCCESS;
-}
-
-
-uint32_t hci_mem_pool_rx_produce(uint32_t length, void ** pp_buffer)
-{
-    uint32_t err_code; 
-
-    if (pp_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }    
-    *pp_buffer = NULL;
-    
-    if (m_rx_buffer_queue.free_window_count != 0)
-    {    
-        if (length <= RX_BUF_SIZE)
-        {    
-            --(m_rx_buffer_queue.free_window_count);            
-            ++(m_rx_buffer_queue.read_available_count);            
-
-            *pp_buffer                    = 
-                    m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.write_index].rx_buffer;
-
-            m_rx_buffer_queue.free_index |= (1u << m_rx_buffer_queue.write_index);
-
-            // @note: Adjust the write_index making use of the fact that the buffer size is of 
-            // power of two and two's complement arithmetic. For details refer example to book 
-            // "Making embedded systems: Elicia White".
-            m_rx_buffer_queue.write_index = 
-                    (m_rx_buffer_queue.write_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u);
-            
-            err_code                      = NRF_SUCCESS;
-        }
-        else
-        {
-            err_code = NRF_ERROR_DATA_SIZE;    
-        }        
-    }
-    else
-    {
-        err_code = NRF_ERROR_NO_MEM;    
-    }
-    
-    return err_code;
-}
-
-
-uint32_t hci_mem_pool_rx_consume(uint8_t * p_buffer)
-{
-    uint32_t err_code;
-    uint32_t consume_index;
-    uint32_t start_index;
-    
-    if (m_rx_buffer_queue.free_available_count != 0)
-    {
-        // Find the buffer that has been freed -
-        // Start at read_index minus free_available_count and then increment until read index.
-        err_code      = NRF_ERROR_INVALID_ADDR;
-        consume_index = (m_rx_buffer_queue.read_index - m_rx_buffer_queue.free_available_count) & 
-                        (RX_BUF_QUEUE_SIZE - 1u);
-        start_index   = consume_index;
-        
-        do
-        {
-            if (m_rx_buffer_queue.p_buffer[consume_index].rx_buffer == p_buffer)
-            {
-                m_rx_buffer_queue.free_index ^= (1u << consume_index);
-                err_code = NRF_SUCCESS;
-                break;
-            }
-            else
-            {
-                consume_index = (consume_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u);
-            }
-        }
-        while (consume_index != m_rx_buffer_queue.read_index);
-
-        while (!(m_rx_buffer_queue.free_index & (1 << start_index)) && 
-                (m_rx_buffer_queue.free_available_count != 0))
-        {
-            --(m_rx_buffer_queue.free_available_count);
-            ++(m_rx_buffer_queue.free_window_count);            
-            start_index = (consume_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u);
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_NO_MEM;
-    }
-        
-    return err_code;    
-}
-
-
-uint32_t hci_mem_pool_rx_data_size_set(uint32_t length)
-{
-    // @note: Adjust the write_index making use of the fact that the buffer size is of power
-    // of two and two's complement arithmetic. For details refer example to book 
-    // "Making embedded systems: Elicia White".
-    const uint32_t index = (m_rx_buffer_queue.write_index - 1u) & (RX_BUF_QUEUE_SIZE - 1u);
-    m_rx_buffer_queue.p_buffer[index].length = length;    
-    
-    return NRF_SUCCESS;
-}
-
-
-uint32_t hci_mem_pool_rx_extract(uint8_t ** pp_buffer, uint32_t * p_length)
-{
-    uint32_t err_code;
-    
-    if ((pp_buffer == NULL) || (p_length == NULL))
-    {
-        return NRF_ERROR_NULL;
-    }
-    
-    if (m_rx_buffer_queue.read_available_count != 0)
-    {
-        --(m_rx_buffer_queue.read_available_count);
-        ++(m_rx_buffer_queue.free_available_count);        
-        
-        *pp_buffer                   = 
-            m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.read_index].rx_buffer;
-        *p_length                    = 
-            m_rx_buffer_queue.p_buffer[m_rx_buffer_queue.read_index].length;
-        
-        // @note: Adjust the write_index making use of the fact that the buffer size is of power
-        // of two and two's complement arithmetic. For details refer example to book 
-        // "Making embedded systems: Elicia White".            
-        m_rx_buffer_queue.read_index = 
-            (m_rx_buffer_queue.read_index + 1u) & (RX_BUF_QUEUE_SIZE - 1u); 
-        
-        err_code                     = NRF_SUCCESS;
-    }
-    else
-    {
-        err_code                     = NRF_ERROR_NO_MEM;        
-    }
-    
-    return err_code;
-}

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/hci/hci_mem_pool.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_mem_pool.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_mem_pool.h
deleted file mode 100644
index 2516631..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_mem_pool.h
+++ /dev/null
@@ -1,140 +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 Memory pool
- * @{
- * @ingroup app_common
- *
- * @brief Memory pool implementation
- *
- * Memory pool implementation, based on circular buffer data structure, which supports asynchronous 
- * processing of RX data. The current default implementation supports 1 TX buffer and 4 RX buffers.
- * The memory managed by the pool is allocated from static storage instead of heap. The internal 
- * design of the circular buffer implementing the RX memory layout is illustrated in the picture 
- * below. 
- *
- * @image html memory_pool.png "Circular buffer design"
- *
- * The expected call order for the RX APIs is as follows:
- * - hci_mem_pool_rx_produce
- * - hci_mem_pool_rx_data_size_set
- * - hci_mem_pool_rx_extract
- * - hci_mem_pool_rx_consume
- *
- * @warning If the above mentioned expected call order is violated the end result can be undefined.
- *
- * \par Component specific configuration options
- *
- * The following compile time configuration options are available to suit various implementations:
- * - TX_BUF_SIZE TX buffer size in bytes. 
- * - RX_BUF_SIZE RX buffer size in bytes. 
- * - RX_BUF_QUEUE_SIZE RX buffer element size.
- */
- 
-#ifndef HCI_MEM_POOL_H__
-#define HCI_MEM_POOL_H__
-
-#include <stdint.h>
-#include "nrf_error.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for opening the module.
- *
- * @retval NRF_SUCCESS          Operation success. 
- */
-uint32_t hci_mem_pool_open(void);
-
-/**@brief Function for closing the module.
- *
- * @retval NRF_SUCCESS          Operation success. 
- */
-uint32_t hci_mem_pool_close(void);
-
-/**@brief Function for allocating requested amount of TX memory.
- *
- * @param[out] pp_buffer        Pointer to the allocated memory.
- *
- * @retval NRF_SUCCESS          Operation success. Memory was allocated.
- * @retval NRF_ERROR_NO_MEM     Operation failure. No memory available for allocation.
- * @retval NRF_ERROR_NULL       Operation failure. NULL pointer supplied.  
- */
-uint32_t hci_mem_pool_tx_alloc(void ** pp_buffer);
- 
-/**@brief Function for freeing previously allocated TX memory.
- *
- * @note Memory management follows the FIFO principle meaning that free() order must match the 
- *       alloc(...) order, which is the reason for omitting exact memory block identifier as an 
- *       input parameter.
- *
- * @retval NRF_SUCCESS          Operation success. Memory was freed.
- */
-uint32_t hci_mem_pool_tx_free(void);
- 
-/**@brief Function for producing a free RX memory block for usage.
- *
- * @note Upon produce request amount being 0, NRF_SUCCESS is returned.   
- *
- * @param[in]  length           Amount, in bytes, of free memory to be produced.
- * @param[out] pp_buffer        Pointer to the allocated memory.
- *
- * @retval NRF_SUCCESS          Operation success. Free RX memory block produced.
- * @retval NRF_ERROR_NO_MEM     Operation failure. No suitable memory available for allocation.
- * @retval NRF_ERROR_DATA_SIZE  Operation failure. Request size exceeds limit.  
- * @retval NRF_ERROR_NULL       Operation failure. NULL pointer supplied.   
- */
-uint32_t hci_mem_pool_rx_produce(uint32_t length, void ** pp_buffer);
-
-/**@brief Function for setting the length of the last produced RX memory block.
- *
- * @warning If call to this API is omitted the end result is that the following call to 
- *          mem_pool_rx_extract will return incorrect data in the p_length output parameter.
- *
- * @param[in]  length           Amount, in bytes, of actual memory used.
- *
- * @retval NRF_SUCCESS          Operation success. Length was set.
- */
-uint32_t hci_mem_pool_rx_data_size_set(uint32_t length);
- 
-/**@brief Function for extracting a packet, which has been filled with read data, for further 
- * processing.
- *
- * @param[out] pp_buffer        Pointer to the packet data.
- * @param[out] p_length         Length of packet data in bytes.  
- *
- * @retval NRF_SUCCESS          Operation success. 
- * @retval NRF_ERROR_NO_MEM     Operation failure. No packet available to extract.
- * @retval NRF_ERROR_NULL       Operation failure. NULL pointer supplied.    
- */
-uint32_t hci_mem_pool_rx_extract(uint8_t ** pp_buffer, uint32_t * p_length);
- 
-/**@brief Function for freeing previously extracted packet, which has been filled with read data.
- *
- * @param[in] p_buffer             Pointer to consumed buffer.
- *
- * @retval NRF_SUCCESS             Operation success. 
- * @retval NRF_ERROR_NO_MEM        Operation failure. No packet available to free. 
- * @retval NRF_ERROR_INVALID_ADDR  Operation failure. Not a valid pointer. 
- */
-uint32_t hci_mem_pool_rx_consume(uint8_t * p_buffer);
- 
-#ifdef __cplusplus
-}
-#endif
-
-#endif // HCI_MEM_POOL_H__
- 
-/** @} */


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

Posted by cc...@apache.org.
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/uart/app_uart.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart.h
deleted file mode 100644
index aea405c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart.h
+++ /dev/null
@@ -1,235 +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 app_uart UART module
- * @{
- * @ingroup app_common
- *
- * @brief UART module interface.
- */
-
-#ifndef APP_UART_H__
-#define APP_UART_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "app_util_platform.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define  UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */
-
-/**@brief UART Flow Control modes for the peripheral.
- */
-typedef enum
-{
-    APP_UART_FLOW_CONTROL_DISABLED, /**< UART Hw Flow Control is disabled. */
-    APP_UART_FLOW_CONTROL_ENABLED,  /**< Standard UART Hw Flow Control is enabled. */
-    APP_UART_FLOW_CONTROL_LOW_POWER /**< Specialized UART Hw Flow Control is used. The Low Power setting allows the \nRFXX to Power Off the UART module when CTS is in-active, and re-enabling the UART when the CTS signal becomes active. This allows the \nRFXX to safe power by only using the UART module when it is needed by the remote site. */
-} app_uart_flow_control_t;
-
-/**@brief UART communication structure holding configuration settings for the peripheral.
- */
-typedef struct
-{
-    uint8_t                 rx_pin_no;    /**< RX pin number. */
-    uint8_t                 tx_pin_no;    /**< TX pin number. */
-    uint8_t                 rts_pin_no;   /**< RTS pin number, only used if flow control is enabled. */
-    uint8_t                 cts_pin_no;   /**< CTS pin number, only used if flow control is enabled. */
-    app_uart_flow_control_t flow_control; /**< Flow control setting, if flow control is used, the system will use low power UART mode, based on CTS signal. */
-    bool                    use_parity;   /**< Even parity if TRUE, no parity if FALSE. */
-    uint32_t                baud_rate;    /**< Baud rate configuration. */
-} app_uart_comm_params_t;
-
-/**@brief UART buffer for transmitting/receiving data.
- */
-typedef struct
-{
-    uint8_t * rx_buf;      /**< Pointer to the RX buffer. */
-    uint32_t  rx_buf_size; /**< Size of the RX buffer. */
-    uint8_t * tx_buf;      /**< Pointer to the TX buffer. */
-    uint32_t  tx_buf_size; /**< Size of the TX buffer. */
-} app_uart_buffers_t;
-
-/**@brief Enumeration which defines events used by the UART module upon data reception or error.
- *
- * @details The event type is used to indicate the type of additional information in the event
- * @ref app_uart_evt_t.
- */
-typedef enum
-{
-    APP_UART_DATA_READY,          /**< An event indicating that UART data has been received. The data is available in the FIFO and can be fetched using @ref app_uart_get. */
-    APP_UART_FIFO_ERROR,          /**< An error in the FIFO module used by the app_uart module has occured. The FIFO error code is stored in app_uart_evt_t.data.error_code field. */
-    APP_UART_COMMUNICATION_ERROR, /**< An communication error has occured during reception. The error is stored in app_uart_evt_t.data.error_communication field. */
-    APP_UART_TX_EMPTY,            /**< An event indicating that UART has completed transmission of all available data in the TX FIFO. */
-    APP_UART_DATA,                /**< An event indicating that UART data has been received, and data is present in data field. This event is only used when no FIFO is configured. */
-} app_uart_evt_type_t;
-
-/**@brief Struct containing events from the UART module.
- *
- * @details The app_uart_evt_t is used to notify the application of asynchronous events when data
- * are received on the UART peripheral or in case an error occured during data reception.
- */
-typedef struct
-{
-    app_uart_evt_type_t evt_type; /**< Type of event. */
-    union
-    {
-        uint32_t error_communication; /**< Field used if evt_type is: APP_UART_COMMUNICATION_ERROR. This field contains the value in the ERRORSRC register for the UART peripheral. The UART_ERRORSRC_x defines from nrf5x_bitfields.h can be used to parse the error code. See also the \nRFXX Series Reference Manual for specification. */
-        uint32_t error_code;          /**< Field used if evt_type is: NRF_ERROR_x. Additional status/error code if the error event type is APP_UART_FIFO_ERROR. This error code refer to errors defined in nrf_error.h. */
-        uint8_t  value;               /**< Field used if evt_type is: NRF_ERROR_x. Additional status/error code if the error event type is APP_UART_FIFO_ERROR. This error code refer to errors defined in nrf_error.h. */
-    } data;
-} app_uart_evt_t;
-
-/**@brief Function for handling app_uart event callback.
- *
- * @details Upon an event in the app_uart module this callback function will be called to notify
- *          the application about the event.
- *
- * @param[in]   p_app_uart_event Pointer to UART event.
- */
-typedef void (* app_uart_event_handler_t) (app_uart_evt_t * p_app_uart_event);
-
-/**@brief Macro for safe initialization of the UART module in a single user instance when using
- *        a FIFO together with UART.
- *
- * @param[in]   P_COMM_PARAMS   Pointer to a UART communication structure: app_uart_comm_params_t
- * @param[in]   RX_BUF_SIZE     Size of desired RX buffer, must be a power of 2 or ZERO (No FIFO).
- * @param[in]   TX_BUF_SIZE     Size of desired TX buffer, must be a power of 2 or ZERO (No FIFO).
- * @param[in]   EVT_HANDLER   Event handler function to be called when an event occurs in the
- *                              UART module.
- * @param[in]   IRQ_PRIO        IRQ priority, app_irq_priority_t, for the UART module irq handler.
- * @param[out]  ERR_CODE        The return value of the UART initialization function will be
- *                              written to this parameter.
- *
- * @note Since this macro allocates a buffer and registers the module as a GPIOTE user when flow
- *       control is enabled, it must only be called once.
- */
-#define APP_UART_FIFO_INIT(P_COMM_PARAMS, RX_BUF_SIZE, TX_BUF_SIZE, EVT_HANDLER, IRQ_PRIO, ERR_CODE) \
-    do                                                                                             \
-    {                                                                                              \
-        app_uart_buffers_t buffers;                                                                \
-        static uint8_t     rx_buf[RX_BUF_SIZE];                                                    \
-        static uint8_t     tx_buf[TX_BUF_SIZE];                                                    \
-                                                                                                   \
-        buffers.rx_buf      = rx_buf;                                                              \
-        buffers.rx_buf_size = sizeof (rx_buf);                                                     \
-        buffers.tx_buf      = tx_buf;                                                              \
-        buffers.tx_buf_size = sizeof (tx_buf);                                                     \
-        ERR_CODE = app_uart_init(P_COMM_PARAMS, &buffers, EVT_HANDLER, IRQ_PRIO);                  \
-    } while (0)
-
-/**@brief Macro for safe initialization of the UART module in a single user instance.
- *
- * @param[in]   P_COMM_PARAMS   Pointer to a UART communication structure: app_uart_comm_params_t
- * @param[in]   EVT_HANDLER   Event handler function to be called when an event occurs in the
- *                              UART module.
- * @param[in]   IRQ_PRIO        IRQ priority, app_irq_priority_t, for the UART module irq handler.
- * @param[out]  ERR_CODE        The return value of the UART initialization function will be
- *                              written to this parameter.
- *
- * @note Since this macro allocates registers the module as a GPIOTE user when flow control is
- *       enabled, it must only be called once.
- */
-#define APP_UART_INIT(P_COMM_PARAMS, EVT_HANDLER, IRQ_PRIO, ERR_CODE)                              \
-    do                                                                                             \
-    {                                                                                              \
-        ERR_CODE = app_uart_init(P_COMM_PARAMS, NULL, EVT_HANDLER, IRQ_PRIO);                      \
-    } while (0)
-
-/**@brief Function for initializing the UART module. Use this initialization when several instances of the UART
- *        module are needed.
- *
- *
- * @note Normally single initialization should be done using the APP_UART_INIT() or
- *       APP_UART_INIT_FIFO() macro depending on whether the FIFO should be used by the UART, as
- *       that will allocate the buffers needed by the UART module (including aligning the buffer
- *       correctly).
-
- * @param[in]     p_comm_params     Pin and communication parameters.
- * @param[in]     p_buffers         RX and TX buffers, NULL is FIFO is not used.
- * @param[in]     error_handler     Function to be called in case of an error.
- * @param[in]     irq_priority      Interrupt priority level.
- *
- * @retval      NRF_SUCCESS               If successful initialization.
- * @retval      NRF_ERROR_INVALID_LENGTH  If a provided buffer is not a power of two.
- * @retval      NRF_ERROR_NULL            If one of the provided buffers is a NULL pointer.
- *
- * The below errors are propagated by the UART module to the caller upon registration when Hardware
- * Flow Control is enabled. When Hardware Flow Control is not used, these errors cannot occur.
- * @retval      NRF_ERROR_INVALID_STATE   The GPIOTE module is not in a valid state when registering
- *                                        the UART module as a user.
- * @retval      NRF_ERROR_INVALID_PARAM   The UART module provides an invalid callback function when
- *                                        registering the UART module as a user.
- *                                        Or the value pointed to by *p_uart_uid is not a valid
- *                                        GPIOTE number.
- * @retval      NRF_ERROR_NO_MEM          GPIOTE module has reached the maximum number of users.
- */
-uint32_t app_uart_init(const app_uart_comm_params_t * p_comm_params,
-                       app_uart_buffers_t *           p_buffers,
-                       app_uart_event_handler_t       error_handler,
-                       app_irq_priority_t             irq_priority);
-
-/**@brief Function for getting a byte from the UART.
- *
- * @details This function will get the next byte from the RX buffer. If the RX buffer is empty
- *          an error code will be returned and the app_uart module will generate an event upon
- *          reception of the first byte which is added to the RX buffer.
- *
- * @param[out] p_byte    Pointer to an address where next byte received on the UART will be copied.
- *
- * @retval NRF_SUCCESS          If a byte has been received and pushed to the pointer provided.
- * @retval NRF_ERROR_NOT_FOUND  If no byte is available in the RX buffer of the app_uart module.
- */
-uint32_t app_uart_get(uint8_t * p_byte);
-
-/**@brief Function for putting a byte on the UART.
- *
- * @details This call is non-blocking.
- *
- * @param[in] byte   Byte to be transmitted on the UART.
- *
- * @retval NRF_SUCCESS        If the byte was successfully put on the TX buffer for transmission.
- * @retval NRF_ERROR_NO_MEM   If no more space is available in the TX buffer.
- *                            NRF_ERROR_NO_MEM may occur if flow control is enabled and CTS signal
- *                            is high for a long period and the buffer fills up.
- * @retval NRF_ERROR_INTERNAL If UART driver reported error.
- */
-uint32_t app_uart_put(uint8_t byte);
-
-/**@brief Function for flushing the RX and TX buffers (Only valid if FIFO is used).
- *        This function does nothing if FIFO is not used.
- *
- * @retval  NRF_SUCCESS  Flushing completed (Current implementation will always succeed).
- */
-uint32_t app_uart_flush(void);
-
-/**@brief Function for closing the UART module.
- *
- * @retval  NRF_SUCCESS             If successfully closed.
- * @retval  NRF_ERROR_INVALID_PARAM If an invalid user id is provided or the user id differs from
- *                                  the current active user.
- */
-uint32_t app_uart_close(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //APP_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/libraries/uart/app_uart_fifo.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart_fifo.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart_fifo.c
deleted file mode 100644
index d4c1562..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/app_uart_fifo.c
+++ /dev/null
@@ -1,191 +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 "app_uart.h"
-#include "app_fifo.h"
-#include "nrf_drv_uart.h"
-#include "nrf_assert.h"
-#include "sdk_common.h"
-
-static __INLINE uint32_t fifo_length(app_fifo_t * const fifo)
-{
-  uint32_t tmp = fifo->read_pos;
-  return fifo->write_pos - tmp;
-}
-
-#define FIFO_LENGTH(F) fifo_length(&F)              /**< Macro to calculate length of a FIFO. */
-
-
-static app_uart_event_handler_t   m_event_handler;            /**< Event handler function. */
-static uint8_t tx_buffer[1];
-static uint8_t rx_buffer[1];
-
-static app_fifo_t                  m_rx_fifo;                               /**< RX FIFO buffer for storing data received on the UART until the application fetches them using app_uart_get(). */
-static app_fifo_t                  m_tx_fifo;                               /**< TX FIFO buffer for storing data to be transmitted on the UART when TXD is ready. Data is put to the buffer on using app_uart_put(). */
-
-static void uart_event_handler(nrf_drv_uart_event_t * p_event, void* p_context)
-{
-    app_uart_evt_t app_uart_event;
-
-    if (p_event->type == NRF_DRV_UART_EVT_RX_DONE)
-    {
-        // Write received byte to FIFO
-        uint32_t err_code = app_fifo_put(&m_rx_fifo, p_event->data.rxtx.p_data[0]);
-        if (err_code != NRF_SUCCESS)
-        {
-            app_uart_event.evt_type          = APP_UART_FIFO_ERROR;
-            app_uart_event.data.error_code   = err_code;
-            m_event_handler(&app_uart_event);
-        }
-        // Notify that new data is available if this was first byte put in the buffer.
-        else if (FIFO_LENGTH(m_rx_fifo) == 1)
-        {
-            app_uart_event.evt_type = APP_UART_DATA_READY;
-            m_event_handler(&app_uart_event);
-        }
-        else
-        {
-            // Do nothing, only send event if first byte was added or overflow in FIFO occurred.
-        }
-        if (FIFO_LENGTH(m_rx_fifo) <= m_rx_fifo.buf_size_mask)
-        {
-            (void)nrf_drv_uart_rx(rx_buffer, 1);
-        }
-    }
-    else if (p_event->type == NRF_DRV_UART_EVT_ERROR)
-    {
-        app_uart_event.evt_type                 = APP_UART_COMMUNICATION_ERROR;
-        app_uart_event.data.error_communication = p_event->data.error.error_mask;
-        (void)nrf_drv_uart_rx(rx_buffer, 1);
-        m_event_handler(&app_uart_event);
-    }
-    else if (p_event->type == NRF_DRV_UART_EVT_TX_DONE)
-    {
-        // Get next byte from FIFO.
-        if (app_fifo_get(&m_tx_fifo, tx_buffer) == NRF_SUCCESS)
-        {
-            (void)nrf_drv_uart_tx(tx_buffer, 1);
-        }
-        if (FIFO_LENGTH(m_tx_fifo) == 0)
-        {
-            // Last byte from FIFO transmitted, notify the application.
-            app_uart_event.evt_type = APP_UART_TX_EMPTY;
-            m_event_handler(&app_uart_event);
-        }
-    }
-}
-
-uint32_t app_uart_init(const app_uart_comm_params_t * p_comm_params,
-                             app_uart_buffers_t *     p_buffers,
-                             app_uart_event_handler_t event_handler,
-                             app_irq_priority_t       irq_priority)
-{
-    uint32_t err_code;
-
-    m_event_handler = event_handler;
-
-    if (p_buffers == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    // Configure buffer RX buffer.
-    err_code = app_fifo_init(&m_rx_fifo, p_buffers->rx_buf, p_buffers->rx_buf_size);
-    VERIFY_SUCCESS(err_code);
-
-    // Configure buffer TX buffer.
-    err_code = app_fifo_init(&m_tx_fifo, p_buffers->tx_buf, p_buffers->tx_buf_size);
-    VERIFY_SUCCESS(err_code);
-
-    nrf_drv_uart_config_t config = NRF_DRV_UART_DEFAULT_CONFIG;
-    config.baudrate = (nrf_uart_baudrate_t)p_comm_params->baud_rate;
-    config.hwfc = (p_comm_params->flow_control == APP_UART_FLOW_CONTROL_DISABLED) ?
-            NRF_UART_HWFC_DISABLED : NRF_UART_HWFC_ENABLED;
-    config.interrupt_priority = irq_priority;
-    config.parity = p_comm_params->use_parity ? NRF_UART_PARITY_INCLUDED : NRF_UART_PARITY_EXCLUDED;
-    config.pselcts = p_comm_params->cts_pin_no;
-    config.pselrts = p_comm_params->rts_pin_no;
-    config.pselrxd = p_comm_params->rx_pin_no;
-    config.pseltxd = p_comm_params->tx_pin_no;
-
-    err_code = nrf_drv_uart_init(&config, uart_event_handler);
-    VERIFY_SUCCESS(err_code);
-
-#ifdef NRF52
-    if (!config.use_easy_dma)
-#endif
-    {
-        nrf_drv_uart_rx_enable();
-    }
-    return nrf_drv_uart_rx(rx_buffer,1);
-}
-
-uint32_t app_uart_flush(void)
-{
-    uint32_t err_code;
-
-    err_code = app_fifo_flush(&m_rx_fifo);
-    VERIFY_SUCCESS(err_code);
-
-    err_code = app_fifo_flush(&m_tx_fifo);
-    VERIFY_SUCCESS(err_code);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t app_uart_get(uint8_t * p_byte)
-{
-    ASSERT(p_byte);
-    // If FIFO was full new request to receive one byte was not scheduled. Must be done here.
-    if (FIFO_LENGTH(m_rx_fifo) == m_rx_fifo.buf_size_mask)
-    {
-        uint32_t err_code = nrf_drv_uart_rx(rx_buffer,1);
-        if (err_code != NRF_SUCCESS)
-        {
-            return NRF_ERROR_NOT_FOUND;
-        }
-    }
-    return app_fifo_get(&m_rx_fifo, p_byte);
-}
-
-uint32_t app_uart_put(uint8_t byte)
-{
-    uint32_t err_code;
-
-    err_code = app_fifo_put(&m_tx_fifo, byte);
-    if (err_code == NRF_SUCCESS)
-    {
-        // The new byte has been added to FIFO. It will be picked up from there
-        // (in 'uart_event_handler') when all preceding bytes are transmitted.
-        // But if UART is not transmitting anything at the moment, we must start
-        // a new transmission here.
-        if (!nrf_drv_uart_tx_in_progress())
-        {
-            // This operation should be almost always successful, since we've
-            // just added a byte to FIFO, but if some bigger delay occurred
-            // (some heavy interrupt handler routine has been executed) since
-            // that time, FIFO might be empty already.
-            if (app_fifo_get(&m_tx_fifo, tx_buffer) == NRF_SUCCESS)
-            {
-                err_code = nrf_drv_uart_tx(tx_buffer, 1);
-            }
-        }
-    }
-
-    return err_code;
-}
-
-uint32_t app_uart_close(void)
-{
-    nrf_drv_uart_uninit();
-    return NRF_SUCCESS;
-}

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/uart/retarget.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/retarget.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/retarget.c
deleted file mode 100644
index a34fa1c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/uart/retarget.c
+++ /dev/null
@@ -1,101 +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.
- *
- */
-
-#if !defined(NRF_LOG_USES_RTT) || NRF_LOG_USES_RTT != 1
-#if !defined(HAS_SIMPLE_UART_RETARGET)
-
-#include <stdio.h>
-#include <stdint.h>
-#include "app_uart.h"
-#include "nordic_common.h"
-#include "nrf_error.h"
-
-#if !defined(__ICCARM__)
-struct __FILE 
-{
-    int handle;
-};
-#endif
-
-FILE __stdout;
-FILE __stdin;
-
-
-#if defined(__CC_ARM) ||  defined(__ICCARM__)
-int fgetc(FILE * p_file)
-{
-    uint8_t input;
-    while (app_uart_get(&input) == NRF_ERROR_NOT_FOUND)
-    {
-        // No implementation needed.
-    }
-    return input;
-}
-
-
-int fputc(int ch, FILE * p_file)
-{
-    UNUSED_PARAMETER(p_file);
-
-    UNUSED_VARIABLE(app_uart_put((uint8_t)ch));
-    return ch;
-}
-
-#elif defined(__GNUC__)
-
-
-int _write(int file, const char * p_char, int len)
-{
-    int i;
-
-    UNUSED_PARAMETER(file);
-
-    for (i = 0; i < len; i++)
-    {
-        UNUSED_VARIABLE(app_uart_put(*p_char++));
-    }
-
-    return len;
-}
-
-
-int _read(int file, char * p_char, int len)
-{
-    UNUSED_PARAMETER(file);
-    while (app_uart_get((uint8_t *)p_char) == NRF_ERROR_NOT_FOUND)
-    {
-        // No implementation needed.
-    }
-
-    return 1;
-}
-#endif
-
-#if defined(__ICCARM__)
-
-__ATTRIBUTES size_t __write(int file, const unsigned char * p_char, size_t len)
-{
-    int i;
-
-    UNUSED_PARAMETER(file);
-
-    for (i = 0; i < len; i++)
-    {
-        UNUSED_VARIABLE(app_uart_put(*p_char++));
-    }
-
-    return len;
-}
-
-#endif
-#endif // !defined(HAS_SIMPLE_UART_RETARGET)
-#endif // NRF_LOG_USES_RTT != 1

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/util/app_error.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error.c
deleted file mode 100644
index 8d9aaa9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error.c
+++ /dev/null
@@ -1,124 +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 app_error Common application error handler
- * @{
- * @ingroup app_common
- *
- * @brief Common application error handler.
- */
-
-#include "nrf.h"
-#include <stdio.h>
-#include "app_error.h"
-#include "nordic_common.h"
-#include "sdk_errors.h"
-#include "nrf_log.h"
-
-#ifdef DEBUG
-#include "bsp.h"
-#endif
-
-
-
-/**@brief Function for error handling, which is called when an error has occurred.
- *
- * @warning This handler is an example only and does not fit a final product. You need to analyze
- *          how your product is supposed to react in case of error.
- *
- * @param[in] error_code  Error code supplied to the handler.
- * @param[in] line_num    Line number where the handler is called.
- * @param[in] p_file_name Pointer to the file name.
- */
-
-/*lint -save -e14 */
-void app_error_handler(ret_code_t error_code, uint32_t line_num, const uint8_t * p_file_name)
-{
-    error_info_t error_info =
-    {
-        .line_num    = line_num,
-        .p_file_name = p_file_name,
-        .err_code    = error_code,
-    };
-    app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info));
-
-    UNUSED_VARIABLE(error_info);
-}
-
-/*lint -save -e14 */
-void app_error_handler_bare(ret_code_t error_code)
-{
-    error_info_t error_info =
-    {
-        .line_num    = 0,
-        .p_file_name = NULL,
-        .err_code    = error_code,
-    };
-    app_error_fault_handler(NRF_FAULT_ID_SDK_ERROR, 0, (uint32_t)(&error_info));
-
-    UNUSED_VARIABLE(error_info);
-}
-
-
-void app_error_save_and_stop(uint32_t id, uint32_t pc, uint32_t info)
-{
-    /* static error variables - in order to prevent removal by optimizers */
-    static volatile struct
-    {
-        uint32_t        fault_id;
-        uint32_t        pc;
-        uint32_t        error_info;
-        assert_info_t * p_assert_info;
-        error_info_t  * p_error_info;
-        ret_code_t      err_code;
-        uint32_t        line_num;
-        const uint8_t * p_file_name;
-    } m_error_data = {0};
-
-    // The following variable helps Keil keep the call stack visible, in addition, it can be set to
-    // 0 in the debugger to continue executing code after the error check.
-    volatile bool loop = true;
-    UNUSED_VARIABLE(loop);
-
-    m_error_data.fault_id   = id;
-    m_error_data.pc         = pc;
-    m_error_data.error_info = info;
-
-    switch (id)
-    {
-        case NRF_FAULT_ID_SDK_ASSERT:
-            m_error_data.p_assert_info = (assert_info_t *)info;
-            m_error_data.line_num      = m_error_data.p_assert_info->line_num;
-            m_error_data.p_file_name   = m_error_data.p_assert_info->p_file_name;
-            break;
-
-        case NRF_FAULT_ID_SDK_ERROR:
-            m_error_data.p_error_info = (error_info_t *)info;
-            m_error_data.err_code     = m_error_data.p_error_info->err_code;
-            m_error_data.line_num     = m_error_data.p_error_info->line_num;
-            m_error_data.p_file_name  = m_error_data.p_error_info->p_file_name;
-            break;
-    }
-
-    UNUSED_VARIABLE(m_error_data);
-
-    // If printing is disrupted, remove the irq calls, or set the loop variable to 0 in the debugger.
-    __disable_irq();
-
-    while(loop);
-
-    __enable_irq();
-}
-
-/*lint -restore */

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/util/app_error.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error.h
deleted file mode 100644
index 25510c4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error.h
+++ /dev/null
@@ -1,209 +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 app_error Common application error handler
- * @{
- * @ingroup app_common
- *
- * @brief Common application error handler and macros for utilizing a common error handler.
- */
-
-#ifndef APP_ERROR_H__
-#define APP_ERROR_H__
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include "nrf.h"
-#include "sdk_errors.h"
-#include "nordic_common.h"
-#include "nrf_log.h"
-#include "app_error_weak.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define NRF_FAULT_ID_SDK_RANGE_START 0x00004000 /**< The start of the range of error IDs defined in the SDK. */
-
-/**@defgroup APP_ERROR_FAULT_IDS Fault ID types
- * @{ */
-#define NRF_FAULT_ID_SDK_ERROR       NRF_FAULT_ID_SDK_RANGE_START + 1 /**< An error stemming from a call to @ref APP_ERROR_CHECK or @ref APP_ERROR_CHECK_BOOL. The info parameter is a pointer to an @ref error_info_t variable. */
-#define NRF_FAULT_ID_SDK_ASSERT      NRF_FAULT_ID_SDK_RANGE_START + 2 /**< An error stemming from a call to ASSERT (nrf_assert.h). The info parameter is a pointer to an @ref assert_info_t variable. */
-/**@} */
-
-/**@brief Structure containing info about an error of the type @ref NRF_FAULT_ID_SDK_ERROR.
- */
-typedef struct
-{
-    uint16_t        line_num;    /**< The line number where the error occurred. */
-    uint8_t const * p_file_name; /**< The file in which the error occurred. */
-    uint32_t        err_code;    /**< The error code representing the error that occurred. */
-} error_info_t;
-
-/**@brief Structure containing info about an error of the type @ref NRF_FAULT_ID_SDK_ASSERT.
- */
-typedef struct
-{
-    uint16_t        line_num;    /**< The line number where the error occurred. */
-    uint8_t const * p_file_name; /**< The file in which the error occurred. */
-} assert_info_t;
-
-/**@brief Function for error handling, which is called when an error has occurred.
- *
- * @param[in] error_code  Error code supplied to the handler.
- * @param[in] line_num    Line number where the handler is called.
- * @param[in] p_file_name Pointer to the file name.
- */
-void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name);
-
-/**@brief Function for error handling, which is called when an error has occurred.
- *
- * @param[in] error_code  Error code supplied to the handler.
- */
-void app_error_handler_bare(ret_code_t error_code);
-
-/**@brief       Function for saving the parameters and entering an eternal loop, for debug purposes.
- *
- * @param[in] id    Fault identifier. See @ref NRF_FAULT_IDS.
- * @param[in] pc    The program counter of the instruction that triggered the fault, or 0 if
- *                  unavailable.
- * @param[in] info  Optional additional information regarding the fault. Refer to each fault
- *                  identifier for details.
- */
-void app_error_save_and_stop(uint32_t id, uint32_t pc, uint32_t info);
-
-/**@brief       Function for printing all error info (using nrf_log).
- *
- * @details     Nrf_log library must be initialized using NRF_LOG_INIT macro before calling
- *              this function.
- *
- * @param[in] id    Fault identifier. See @ref NRF_FAULT_IDS.
- * @param[in] pc    The program counter of the instruction that triggered the fault, or 0 if
- *                  unavailable.
- * @param[in] info  Optional additional information regarding the fault. Refer to each fault
- *                  identifier for details.
- */
-static __INLINE void app_error_log(uint32_t id, uint32_t pc, uint32_t info)
-{
-    switch (id)
-    {
-        case NRF_FAULT_ID_SDK_ASSERT:
-            NRF_LOG(NRF_LOG_COLOR_RED "\n*** ASSERTION FAILED ***\n");
-            if (((assert_info_t *)(info))->p_file_name)
-            {
-                NRF_LOG_PRINTF(NRF_LOG_COLOR_WHITE "Line Number: %u\n", (unsigned int) ((assert_info_t *)(info))->line_num);
-                NRF_LOG_PRINTF("File Name:   %s\n", ((assert_info_t *)(info))->p_file_name);
-            }
-            NRF_LOG_PRINTF(NRF_LOG_COLOR_DEFAULT "\n");
-            break;
-
-        case NRF_FAULT_ID_SDK_ERROR:
-            NRF_LOG(NRF_LOG_COLOR_RED "\n*** APPLICATION ERROR *** \n" NRF_LOG_COLOR_WHITE);
-            if (((error_info_t *)(info))->p_file_name)
-            {
-                NRF_LOG_PRINTF("Line Number: %u\n", (unsigned int) ((error_info_t *)(info))->line_num);
-                NRF_LOG_PRINTF("File Name:   %s\n", ((error_info_t *)(info))->p_file_name);
-            }
-            NRF_LOG_PRINTF("Error Code:  0x%X\n" NRF_LOG_COLOR_DEFAULT "\n", (unsigned int) ((error_info_t *)(info))->err_code);
-            break;
-    }
-}
-
-/**@brief       Function for printing all error info (using printf).
- *
- * @param[in] id    Fault identifier. See @ref NRF_FAULT_IDS.
- * @param[in] pc    The program counter of the instruction that triggered the fault, or 0 if
- *                  unavailable.
- * @param[in] info  Optional additional information regarding the fault. Refer to each fault
- *                  identifier for details.
- */
-//lint -save -e438
-static __INLINE void app_error_print(uint32_t id, uint32_t pc, uint32_t info)
-{
-    unsigned int tmp = id;
-    printf("app_error_print():\r\n");
-    printf("Fault identifier:  0x%X\r\n", tmp);
-    printf("Program counter:   0x%X\r\n", tmp = pc);
-    printf("Fault information: 0x%X\r\n", tmp = info);
-
-    switch (id)
-    {
-        case NRF_FAULT_ID_SDK_ASSERT:
-            printf("Line Number: %u\r\n", tmp = ((assert_info_t *)(info))->line_num);
-            printf("File Name:   %s\r\n",       ((assert_info_t *)(info))->p_file_name);
-            break;
-
-        case NRF_FAULT_ID_SDK_ERROR:
-            printf("Line Number: %u\r\n",   tmp = ((error_info_t *)(info))->line_num);
-            printf("File Name:   %s\r\n",         ((error_info_t *)(info))->p_file_name);
-            printf("Error Code:  0x%X\r\n", tmp = ((error_info_t *)(info))->err_code);
-            break;
-    }
-}
-//lint -restore
-
-
-/**@brief Macro for calling error handler function.
- *
- * @param[in] ERR_CODE Error code supplied to the error handler.
- */
-#ifdef DEBUG
-#define APP_ERROR_HANDLER(ERR_CODE)                                    \
-    do                                                                 \
-    {                                                                  \
-        app_error_handler((ERR_CODE), __LINE__, (uint8_t*) __FILE__);  \
-    } while (0)
-#else
-#define APP_ERROR_HANDLER(ERR_CODE)                                    \
-    do                                                                 \
-    {                                                                  \
-        app_error_handler_bare((ERR_CODE));                            \
-    } while (0)
-#endif
-/**@brief Macro for calling error handler function if supplied error code any other than NRF_SUCCESS.
- *
- * @param[in] ERR_CODE Error code supplied to the error handler.
- */
-#define APP_ERROR_CHECK(ERR_CODE)                           \
-    do                                                      \
-    {                                                       \
-        const uint32_t LOCAL_ERR_CODE = (ERR_CODE);         \
-        if (LOCAL_ERR_CODE != NRF_SUCCESS)                  \
-        {                                                   \
-            APP_ERROR_HANDLER(LOCAL_ERR_CODE);              \
-        }                                                   \
-    } while (0)
-
-/**@brief Macro for calling error handler function if supplied boolean value is false.
- *
- * @param[in] BOOLEAN_VALUE Boolean value to be evaluated.
- */
-#define APP_ERROR_CHECK_BOOL(BOOLEAN_VALUE)                   \
-    do                                                        \
-    {                                                         \
-        const uint32_t LOCAL_BOOLEAN_VALUE = (BOOLEAN_VALUE); \
-        if (!LOCAL_BOOLEAN_VALUE)                             \
-        {                                                     \
-            APP_ERROR_HANDLER(0);                             \
-        }                                                     \
-    } while (0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_ERROR_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/util/app_error_weak.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error_weak.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error_weak.c
deleted file mode 100644
index eccc0a6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error_weak.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (c) 2016 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 "app_error.h"
-
-#ifdef DEBUG
-#include "bsp.h"
-#endif
- 
-/*lint -save -e14 */
-
-/**
- * Function is implemented as weak so that it can be overwritten by custom application error handler
- * when needed.
- */
-__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)
-{
-    // On assert, the system can only recover with a reset.
-#ifndef DEBUG
-    NVIC_SystemReset();
-#else
-
-#ifdef BSP_DEFINES_ONLY
-    LEDS_ON(LEDS_MASK);
-#else
-    UNUSED_VARIABLE(bsp_indication_set(BSP_INDICATE_FATAL_ERROR));
-    // This call can be used for debug purposes during application development.
-    // @note CAUTION: Activating this code will write the stack to flash on an error.
-    //                This function should NOT be used in a final product.
-    //                It is intended STRICTLY for development/debugging purposes.
-    //                The flash write will happen EVEN if the radio is active, thus interrupting
-    //                any communication.
-    //                Use with care. Uncomment the line below to use.
-    //ble_debug_assert_handler(error_code, line_num, p_file_name);
-#endif // BSP_DEFINES_ONLY
-
-    app_error_save_and_stop(id, pc, info);
-
-#endif // DEBUG
-}
-
-/*lint -restore */
-
-

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/util/app_error_weak.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error_weak.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error_weak.h
deleted file mode 100644
index 5607c73..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_error_weak.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (c) 2016 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.
- *
- */
-
-#ifndef APP_ERROR_WEAK_H__
-#define APP_ERROR_WEAK_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @file
- *
- * @defgroup app_error Common application error handler
- * @{
- * @ingroup app_common
- *
- * @brief Common application error handler.
- */
- 
-/**@brief       Callback function for asserts in the SoftDevice.
- *
- * @details     A pointer to this function will be passed to the SoftDevice. This function will be
- *              called by the SoftDevice if certain unrecoverable errors occur within the
- *              application or SoftDevice.
- *
- *              See @ref nrf_fault_handler_t for more details.
- *
- * @param[in] id    Fault identifier. See @ref NRF_FAULT_IDS.
- * @param[in] pc    The program counter of the instruction that triggered the fault, or 0 if
- *                  unavailable.
- * @param[in] info  Optional additional information regarding the fault. Refer to each fault
- *                  identifier for details.
- *
- * @remarks Function is implemented as weak so that it can be overwritten by custom application
- *          error handler when needed.
- */
-#ifdef __CC_ARM
-	     void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info);
-#else
-__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info);
-#endif
-
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_ERROR_WEAK_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/util/app_util.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util.h
deleted file mode 100644
index b418f28..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util.h
+++ /dev/null
@@ -1,501 +0,0 @@
-/* Copyright (c) 2012 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 app_util Utility Functions and Definitions
- * @{
- * @ingroup app_common
- *
- * @brief Various types and definitions available to all applications.
- */
-
-#ifndef APP_UTIL_H__
-#define APP_UTIL_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "compiler_abstraction.h"
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//lint -save -e27 -e10 -e19
-#if defined ( __CC_ARM )
-extern char STACK$$Base;
-extern char STACK$$Length;
-#define STACK_BASE    &STACK$$Base
-#define STACK_TOP    ((void*)((uint32_t)STACK_BASE + (uint32_t)&STACK$$Length))
-#elif defined ( __ICCARM__ )
-extern char CSTACK$$Base;
-extern char CSTACK$$Length;
-#define STACK_BASE    &CSTACK$$Base
-#define STACK_TOP    ((void*)((uint32_t)STACK_BASE + (uint32_t)&CSTACK$$Length))
-#elif defined   ( __GNUC__ )
-extern uint32_t __StackTop;
-extern uint32_t __StackLimit;
-#define STACK_BASE    &__StackLimit
-#define STACK_TOP     &__StackTop
-#endif
-//lint -restore
-
-enum
-{
-    UNIT_0_625_MS = 625,                                /**< Number of microseconds in 0.625 milliseconds. */
-    UNIT_1_25_MS  = 1250,                               /**< Number of microseconds in 1.25 milliseconds. */
-    UNIT_10_MS    = 10000                               /**< Number of microseconds in 10 milliseconds. */
-};
-
-
-/**@brief Implementation specific macro for delayed macro expansion used in string concatenation
-*
-* @param[in]   lhs   Left hand side in concatenation
-* @param[in]   rhs   Right hand side in concatenation
-*/
-#define STRING_CONCATENATE_IMPL(lhs, rhs) lhs ## rhs
-
-
-/**@brief Macro used to concatenate string using delayed macro expansion
-*
-* @note This macro will delay concatenation until the expressions have been resolved
-*
-* @param[in]   lhs   Left hand side in concatenation
-* @param[in]   rhs   Right hand side in concatenation
-*/
-#define STRING_CONCATENATE(lhs, rhs) STRING_CONCATENATE_IMPL(lhs, rhs)
-
-
-// Disable lint-warnings/errors for STATIC_ASSERT
-//lint --emacro(10,STATIC_ASSERT)
-//lint --emacro(18,STATIC_ASSERT)
-//lint --emacro(19,STATIC_ASSERT)
-//lint --emacro(30,STATIC_ASSERT)
-//lint --emacro(37,STATIC_ASSERT)
-//lint --emacro(42,STATIC_ASSERT)
-//lint --emacro(26,STATIC_ASSERT)
-//lint --emacro(102,STATIC_ASSERT)
-//lint --emacro(533,STATIC_ASSERT)
-//lint --emacro(534,STATIC_ASSERT)
-//lint --emacro(132,STATIC_ASSERT)
-//lint --emacro(414,STATIC_ASSERT)
-//lint --emacro(578,STATIC_ASSERT)
-//lint --emacro(628,STATIC_ASSERT)
-//lint --emacro(648,STATIC_ASSERT)
-//lint --emacro(830,STATIC_ASSERT)
-
-
-/**@brief Macro for doing static (i.e. compile time) assertion.
-*
-* @note If the EXPR isn't resolvable, then the error message won't be shown.
-*
-* @note The output of STATIC_ASSERT will be different across different compilers.
-*
-* @param[in] EXPR Constant expression to be verified.
-*/
-#if defined ( __COUNTER__ )
-
-#define STATIC_ASSERT(EXPR) \
-    ;enum { STRING_CONCATENATE(static_assert_, __COUNTER__) = 1/(!!(EXPR)) }
-
-#else
-
-#define STATIC_ASSERT(EXPR) \
-    ;enum { STRING_CONCATENATE(assert_line_, __LINE__) = 1/(!!(EXPR)) }
-
-#endif
-
-
-/**@brief Implementation details for NUM_VAR_ARGS */
-#define NUM_VA_ARGS_IMPL(                              \
-    _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10,       \
-    _11, _12, _13, _14, _15, _16, _17, _18, _19, _20,  \
-    _21, _22, _23, _24, _25, _26, _27, _28, _29, _30,  \
-    _31, _32, _33, _34, _35, _36, _37, _38, _39, _40,  \
-    _41, _42, _43, _44, _45, _46, _47, _48, _49, _50,  \
-    _51, _52, _53, _54, _55, _56, _57, _58, _59, _60,  \
-    _61, _62, N, ...) N
-
-
-/**@brief Macro to get the number of arguments in a call variadic macro call
- *
- * param[in]    ...     List of arguments
- *
- * @retval  Number of variadic arguments in the argument list
- */
-#define NUM_VA_ARGS(...) NUM_VA_ARGS_IMPL(__VA_ARGS__, 63, 62, 61,  \
-    60, 59, 58, 57, 56, 55, 54, 53, 52, 51,                         \
-    50, 49, 48, 47, 46, 45, 44, 43, 42, 41,                         \
-    40, 39, 38, 37, 36, 35, 34, 33, 32, 31,                         \
-    30, 29, 28, 27, 26, 25, 24, 23, 22, 21,                         \
-    20, 19, 18, 17, 16, 15, 14, 13, 12, 11,                         \
-    10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
-
-
-/**@brief type for holding an encoded (i.e. little endian) 16 bit unsigned integer. */
-typedef uint8_t uint16_le_t[2];
-
-/**@brief Type for holding an encoded (i.e. little endian) 32 bit unsigned integer. */
-typedef uint8_t uint32_le_t[4];
-
-/**@brief Byte array type. */
-typedef struct
-{
-    uint16_t  size;                 /**< Number of array entries. */
-    uint8_t * p_data;               /**< Pointer to array entries. */
-} uint8_array_t;
-
-
-/**@brief Macro for performing rounded integer division (as opposed to truncating the result).
- *
- * @param[in]   A   Numerator.
- * @param[in]   B   Denominator.
- *
- * @return      Rounded (integer) result of dividing A by B.
- */
-#define ROUNDED_DIV(A, B) (((A) + ((B) / 2)) / (B))
-
-
-/**@brief Macro for checking if an integer is a power of two.
- *
- * @param[in]   A   Number to be tested.
- *
- * @return      true if value is power of two.
- * @return      false if value not power of two.
- */
-#define IS_POWER_OF_TWO(A) ( ((A) != 0) && ((((A) - 1) & (A)) == 0) )
-
-
-/**@brief Macro for converting milliseconds to ticks.
- *
- * @param[in] TIME          Number of milliseconds to convert.
- * @param[in] RESOLUTION    Unit to be converted to in [us/ticks].
- */
-#define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION))
-
-
-/**@brief Macro for performing integer division, making sure the result is rounded up.
- *
- * @details One typical use for this is to compute the number of objects with size B is needed to
- *          hold A number of bytes.
- *
- * @param[in]   A   Numerator.
- * @param[in]   B   Denominator.
- *
- * @return      Integer result of dividing A by B, rounded up.
- */
-#define CEIL_DIV(A, B)      \
-    (((A) + (B) - 1) / (B))
-
-
-/**@brief Macro for creating a buffer aligned to 4 bytes.
- *
- * @param[in]   NAME        Name of the buffor.
- * @param[in]   MIN_SIZE    Size of this buffor (it will be rounded up to multiples of 4 bytes).
- */
-#define WORD_ALIGNED_MEM_BUFF(NAME, MIN_SIZE) static uint32_t NAME[CEIL_DIV(MIN_SIZE, sizeof(uint32_t))]
-
-
-/**@brief Macro for calculating the number of words that are needed to hold a number of bytes.
- *
- * @details Adds 3 and divides by 4.
- *
- * @param[in]  n_bytes  The number of bytes.
- *
- * @return The number of words that @p n_bytes take up (rounded up).
- */
-#define BYTES_TO_WORDS(n_bytes) (((n_bytes) + 3) >> 2)
-
-
-/**@brief The number of bytes in a word.
- */
-#define BYTES_PER_WORD (4)
-
-
-/**@brief Macro for increasing a number to the nearest (larger) multiple of another number.
- *
- * @param[in]  alignment  The number to align to.
- * @param[in]  number     The number to align (increase).
- *
- * @return The aligned (increased) @p number.
- */
-#define ALIGN_NUM(alignment, number) ((number - 1) + alignment - ((number - 1) % alignment))
-
-
-/**@brief Function for changing the value unit.
- *
- * @param[in]   value               Value to be rescaled.
- * @param[in]   old_unit_reversal   Reversal of the incoming unit.
- * @param[in]   new_unit_reversal   Reversal of the desired unit.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint64_t value_rescale(uint32_t value, uint32_t old_unit_reversal, uint16_t new_unit_reversal)
-{
-    return (uint64_t)ROUNDED_DIV((uint64_t)value * new_unit_reversal, old_unit_reversal);
-}
-
-/**@brief Function for encoding a uint16 value.
- *
- * @param[in]   value            Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t uint16_encode(uint16_t value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((value & 0x00FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((value & 0xFF00) >> 8);
-    return sizeof(uint16_t);
-}
-
-/**@brief Function for encoding a three-byte value.
- *
- * @param[in]   value            Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t uint24_encode(uint32_t value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((value & 0x000000FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((value & 0x0000FF00) >> 8);
-    p_encoded_data[2] = (uint8_t) ((value & 0x00FF0000) >> 16);
-    return 3;
-}
-
-/**@brief Function for encoding a uint32 value.
- *
- * @param[in]   value            Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t uint32_encode(uint32_t value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((value & 0x000000FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((value & 0x0000FF00) >> 8);
-    p_encoded_data[2] = (uint8_t) ((value & 0x00FF0000) >> 16);
-    p_encoded_data[3] = (uint8_t) ((value & 0xFF000000) >> 24);
-    return sizeof(uint32_t);
-}
-
-/**@brief Function for encoding a uint48 value.
- *
- * @param[in]   value            Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t uint48_encode(uint64_t value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((value & 0x0000000000FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((value & 0x00000000FF00) >> 8);
-    p_encoded_data[2] = (uint8_t) ((value & 0x000000FF0000) >> 16);
-    p_encoded_data[3] = (uint8_t) ((value & 0x0000FF000000) >> 24);
-    p_encoded_data[4] = (uint8_t) ((value & 0x00FF00000000) >> 32);
-    p_encoded_data[5] = (uint8_t) ((value & 0xFF0000000000) >> 40);
-    return 6;
-}
-
-/**@brief Function for decoding a uint16 value.
- *
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- *
- * @return      Decoded value.
- */
-static __INLINE uint16_t uint16_decode(const uint8_t * p_encoded_data)
-{
-        return ( (((uint16_t)((uint8_t *)p_encoded_data)[0])) |
-                 (((uint16_t)((uint8_t *)p_encoded_data)[1]) << 8 ));
-}
-
-/**@brief Function for decoding a uint16 value in big-endian format.
- *
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- *
- * @return      Decoded value.
- */
-static __INLINE uint16_t uint16_big_decode(const uint8_t * p_encoded_data)
-{
-        return ( (((uint16_t)((uint8_t *)p_encoded_data)[0]) << 8 ) |
-                 (((uint16_t)((uint8_t *)p_encoded_data)[1])) );
-}
-
-/**@brief Function for decoding a three-byte value.
- *
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- *
- * @return      Decoded value (uint32_t).
- */
-static __INLINE uint32_t uint24_decode(const uint8_t * p_encoded_data)
-{
-    return ( (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0)  |
-             (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8)  |
-             (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16));
-}
-
-/**@brief Function for decoding a uint32 value.
- *
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- *
- * @return      Decoded value.
- */
-static __INLINE uint32_t uint32_decode(const uint8_t * p_encoded_data)
-{
-    return ( (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0)  |
-             (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8)  |
-             (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16) |
-             (((uint32_t)((uint8_t *)p_encoded_data)[3]) << 24 ));
-}
-
-/**@brief Function for decoding a uint32 value in big-endian format.
- *
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- *
- * @return      Decoded value.
- */
-static __INLINE uint32_t uint32_big_decode(const uint8_t * p_encoded_data)
-{
-    return ( (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 24) |
-             (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 16) |
-             (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 8)  |
-             (((uint32_t)((uint8_t *)p_encoded_data)[3]) << 0) );
-}
-
-/**@brief Function for encoding a uint32 value in big-endian format.
- *
- * @param[in]   value            Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data will be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t uint32_big_encode(uint32_t value, uint8_t * p_encoded_data)
-{
-#ifdef NRF51
-    p_encoded_data[0] = (uint8_t) ((value & 0xFF000000) >> 24);
-    p_encoded_data[1] = (uint8_t) ((value & 0x00FF0000) >> 16);
-    p_encoded_data[2] = (uint8_t) ((value & 0x0000FF00) >> 8);
-    p_encoded_data[3] = (uint8_t) ((value & 0x000000FF) >> 0);
-#elif NRF52
-    *(uint32_t *)p_encoded_data = __REV(value);
-#endif
-    return sizeof(uint32_t);
-}
-
-/**@brief Function for decoding a uint48 value.
- *
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- *
- * @return      Decoded value. (uint64_t)
- */
-static __INLINE uint64_t uint48_decode(const uint8_t * p_encoded_data)
-{
-    return ( (((uint64_t)((uint8_t *)p_encoded_data)[0]) << 0)  |
-             (((uint64_t)((uint8_t *)p_encoded_data)[1]) << 8)  |
-             (((uint64_t)((uint8_t *)p_encoded_data)[2]) << 16) |
-             (((uint64_t)((uint8_t *)p_encoded_data)[3]) << 24) |
-             (((uint64_t)((uint8_t *)p_encoded_data)[4]) << 32) |
-             (((uint64_t)((uint8_t *)p_encoded_data)[5]) << 40 ));
-}
-
-/** @brief Function for converting the input voltage (in milli volts) into percentage of 3.0 Volts.
- *
- *  @details The calculation is based on a linearized version of the battery's discharge
- *           curve. 3.0V returns 100% battery level. The limit for power failure is 2.1V and
- *           is considered to be the lower boundary.
- *
- *           The discharge curve for CR2032 is non-linear. In this model it is split into
- *           4 linear sections:
- *           - Section 1: 3.0V - 2.9V = 100% - 42% (58% drop on 100 mV)
- *           - Section 2: 2.9V - 2.74V = 42% - 18% (24% drop on 160 mV)
- *           - Section 3: 2.74V - 2.44V = 18% - 6% (12% drop on 300 mV)
- *           - Section 4: 2.44V - 2.1V = 6% - 0% (6% drop on 340 mV)
- *
- *           These numbers are by no means accurate. Temperature and
- *           load in the actual application is not accounted for!
- *
- *  @param[in] mvolts The voltage in mV
- *
- *  @return    Battery level in percent.
-*/
-static __INLINE uint8_t battery_level_in_percent(const uint16_t mvolts)
-{
-    uint8_t battery_level;
-
-    if (mvolts >= 3000)
-    {
-        battery_level = 100;
-    }
-    else if (mvolts > 2900)
-    {
-        battery_level = 100 - ((3000 - mvolts) * 58) / 100;
-    }
-    else if (mvolts > 2740)
-    {
-        battery_level = 42 - ((2900 - mvolts) * 24) / 160;
-    }
-    else if (mvolts > 2440)
-    {
-        battery_level = 18 - ((2740 - mvolts) * 12) / 300;
-    }
-    else if (mvolts > 2100)
-    {
-        battery_level = 6 - ((2440 - mvolts) * 6) / 340;
-    }
-    else
-    {
-        battery_level = 0;
-    }
-
-    return battery_level;
-}
-
-/**@brief Function for checking if a pointer value is aligned to a 4 byte boundary.
- *
- * @param[in]   p   Pointer value to be checked.
- *
- * @return      TRUE if pointer is aligned to a 4 byte boundary, FALSE otherwise.
- */
-static __INLINE bool is_word_aligned(void const* p)
-{
-    return (((uintptr_t)p & 0x03) == 0);
-}
-
-/**
- * @brief Function for checking if provided address is located in stack space.
- *
- * @param[in]   ptr Pointer to be checked.
- *
- * @return      true if address is in stack space, false otherwise.
- */
-static __INLINE bool is_address_from_stack(void * ptr)
-{
-    if (((uint32_t)ptr >= (uint32_t)STACK_BASE) &&
-        ((uint32_t)ptr <  (uint32_t)STACK_TOP) )
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_UTIL_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/util/app_util_bds.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_bds.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_bds.h
deleted file mode 100644
index 677a8b8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_bds.h
+++ /dev/null
@@ -1,421 +0,0 @@
-/* Copyright (c) 2012 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 app_util Utility Functions and Definitions
- * @{
- * @ingroup app_common
- *
- * @brief Various types and definitions available to all applications.
- */
-
-#ifndef APP_UTIL_BDS_H__
-#define APP_UTIL_BDS_H__
-
-#include <stdint.h>
-#include <string.h>
-#include <stdbool.h>
-#include "compiler_abstraction.h"
-#include "app_util.h"
-#include "ble_srv_common.h"
-#include "nordic_common.h"
-    
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef uint8_t nibble_t;
-typedef uint32_t uint24_t;
-typedef uint64_t uint40_t;
-
-/**@brief IEEE 11073-20601 Regulatory Certification Data List Structure */
-typedef struct
-{
-    uint8_t *  p_list;                                          /**< Pointer the byte array containing the encoded opaque structure based on IEEE 11073-20601 specification. */
-    uint8_t    list_len;                                        /**< Length of the byte array. */
-} regcertdatalist_t;
-
-/**@brief SFLOAT format (IEEE-11073 16-bit FLOAT, meaning 4 bits for exponent (base 10) and 12 bits mantissa) */
-typedef struct
-{
-  int8_t exponent;                                             /**< Base 10 exponent, should be using only 4 bits */
-  int16_t mantissa;                                            /**< Mantissa, should be using only 12 bits */
-} sfloat_t;
-
-/**@brief Date and Time structure. */
-typedef struct
-{
-    uint16_t year;
-    uint8_t  month;
-    uint8_t  day;
-    uint8_t  hours;
-    uint8_t  minutes;
-    uint8_t  seconds;
-} ble_date_time_t;
-
-
-/**@brief Function for encoding a uint16 value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t bds_uint16_encode(const uint16_t * p_value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((*p_value & 0x00FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((*p_value & 0xFF00) >> 8);
-    return sizeof(uint16_t);
-}
-
-static __INLINE uint8_t bds_int16_encode(const int16_t * p_value, uint8_t * p_encoded_data)
-{
-    uint16_t tmp = *p_value;
-    return bds_uint16_encode(&tmp, p_encoded_data);
-}
-
-/**@brief Function for encoding a uint24 value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t bds_uint24_encode(const uint32_t * p_value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((*p_value & 0x000000FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((*p_value & 0x0000FF00) >> 8);
-    p_encoded_data[2] = (uint8_t) ((*p_value & 0x00FF0000) >> 16);
-    return (3);
-}
-
-    
-/**@brief Function for encoding a uint32 value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t bds_uint32_encode(const uint32_t * p_value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((*p_value & 0x000000FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((*p_value & 0x0000FF00) >> 8);
-    p_encoded_data[2] = (uint8_t) ((*p_value & 0x00FF0000) >> 16);
-    p_encoded_data[3] = (uint8_t) ((*p_value & 0xFF000000) >> 24);
-    return sizeof(uint32_t);
-}
-
-    
-/**@brief Function for encoding a uint40 value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t bds_uint40_encode(const uint64_t * p_value, uint8_t * p_encoded_data)
-{
-    p_encoded_data[0] = (uint8_t) ((*p_value & 0x00000000000000FF) >> 0);
-    p_encoded_data[1] = (uint8_t) ((*p_value & 0x000000000000FF00) >> 8);
-    p_encoded_data[2] = (uint8_t) ((*p_value & 0x0000000000FF0000) >> 16);
-    p_encoded_data[3] = (uint8_t) ((*p_value & 0x00000000FF000000) >> 24);
-    p_encoded_data[4] = (uint8_t) ((*p_value & 0x000000FF00000000) >> 32);
-    return 5;
-}
-
-/**@brief Function for encoding a sfloat value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- *
- * @return      Number of bytes written.
- */
-static __INLINE uint8_t bds_sfloat_encode(const sfloat_t * p_value, uint8_t * p_encoded_data)
-{
-    uint16_t encoded_val;
-
-    encoded_val = ((p_value->exponent << 12) & 0xF000) |
-                            ((p_value->mantissa <<  0) & 0x0FFF);
-
-    return(bds_uint16_encode(&encoded_val, p_encoded_data));
-}
-
-
-/**@brief Function for encoding a uint8_array value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
- */
-static __INLINE uint8_t bds_uint8_array_encode(const uint8_array_t * p_value, 
-                                               uint8_t             * p_encoded_data)
-{
-    memcpy(p_encoded_data, p_value->p_data, p_value->size);
-    return p_value->size;
-}    
-
-
-/**@brief Function for encoding a utf8_str value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
-
- */
-static __INLINE uint8_t bds_ble_srv_utf8_str_encode(const ble_srv_utf8_str_t * p_value,
-                                                    uint8_t                  * p_encoded_data)
-{
-    memcpy(p_encoded_data, p_value->p_str, p_value->length);
-    return p_value->length;
-}    
-
-/**@brief Function for encoding a regcertdatalist value.
- *
- * @param[in]   p_value          Value to be encoded.
- * @param[out]  p_encoded_data   Buffer where the encoded data is to be written.
-
- */
-static __INLINE uint8_t bds_regcertdatalist_encode(const regcertdatalist_t * p_value, 
-                                                   uint8_t                 * p_encoded_data)
-{
-    memcpy(p_encoded_data, p_value->p_list, p_value->list_len);
-    return p_value->list_len;
-}    
-
-
-/**@brief Function for decoding a date_time value.
- *
- * @param[in]   p_date_time    pointer to the date_time structure to encode.
- * @param[in]   p_encoded_data pointer to the encoded data
- * @return      length of the encoded field.
- */
-static __INLINE uint8_t bds_ble_date_time_encode(const ble_date_time_t * p_date_time,
-                                                 uint8_t               * p_encoded_data)
-{
-    uint8_t len = bds_uint16_encode(&p_date_time->year, &p_encoded_data[0]);
-    
-    p_encoded_data[len++] = p_date_time->month;
-    p_encoded_data[len++] = p_date_time->day;
-    p_encoded_data[len++] = p_date_time->hours;
-    p_encoded_data[len++] = p_date_time->minutes;
-    p_encoded_data[len++] = p_date_time->seconds;
-    
-    return len;
-}
-
-
-/**@brief Function for decoding a uint16 value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_uint16_decode(const uint8_t len, 
-                                          const uint8_t * p_encoded_data, 
-                                          uint16_t      * p_decoded_val)
-{
-    UNUSED_VARIABLE(len);
-    *p_decoded_val = (((uint16_t)((uint8_t *)p_encoded_data)[0])) | 
-                     (((uint16_t)((uint8_t *)p_encoded_data)[1]) << 8 );
-    return (sizeof(uint16_t));
-}
-
-
-/**@brief Function for decoding a int16 value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_int16_decode(const uint8_t len, 
-                                         const uint8_t * p_encoded_data, 
-                                         int16_t       * p_decoded_val)
-{
-    UNUSED_VARIABLE(len);
-    uint16_t tmp = 0;
-    uint8_t retval = bds_uint16_decode(len, p_encoded_data, &tmp);
-    *p_decoded_val = (int16_t)tmp;
-    return retval;
-}
-
-
-/**@brief Function for decoding a uint24 value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- *
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_uint24_decode(const uint8_t len, 
-                                          const uint8_t * p_encoded_data, 
-                                          uint32_t      * p_decoded_val)
-{
-    UNUSED_VARIABLE(len);
-    *p_decoded_val = (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0)  |
-                     (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8)  |
-                     (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16);
-    return (3);
-}
-
-
-/**@brief Function for decoding a uint32 value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- *
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_uint32_decode(const uint8_t len, 
-                                          const uint8_t * p_encoded_data, 
-                                          uint32_t      * p_decoded_val)
-{
-    UNUSED_VARIABLE(len);
-    *p_decoded_val = (((uint32_t)((uint8_t *)p_encoded_data)[0]) << 0)  |
-                     (((uint32_t)((uint8_t *)p_encoded_data)[1]) << 8)  |
-                     (((uint32_t)((uint8_t *)p_encoded_data)[2]) << 16) |
-                     (((uint32_t)((uint8_t *)p_encoded_data)[3]) << 24 );
-    return (sizeof(uint32_t));
-}
-
-
-/**@brief Function for decoding a uint40 value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- *
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_uint40_decode(const uint8_t len, 
-                                          const uint8_t * p_encoded_data, 
-                                          uint64_t      * p_decoded_val)
-{
-    UNUSED_VARIABLE(len);
-    *p_decoded_val = (((uint64_t)((uint8_t *)p_encoded_data)[0]) << 0)  |
-                     (((uint64_t)((uint8_t *)p_encoded_data)[1]) << 8)  |
-                     (((uint64_t)((uint8_t *)p_encoded_data)[2]) << 16) |
-                     (((uint64_t)((uint8_t *)p_encoded_data)[3]) << 24 )|
-                     (((uint64_t)((uint8_t *)p_encoded_data)[4]) << 32 );
-    return (40);
-}
-
-
-/**@brief Function for decoding a sfloat value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- *
- * @return      length of the decoded field.
-
- */
-static __INLINE uint8_t bds_sfloat_decode(const uint8_t len, 
-                                          const uint8_t * p_encoded_data, 
-                                          sfloat_t      * p_decoded_val)
-{
-    
-    p_decoded_val->exponent = 0;
-    bds_uint16_decode(len, p_encoded_data, (uint16_t*)&p_decoded_val->mantissa);
-    p_decoded_val->exponent = (uint8_t)((p_decoded_val->mantissa & 0xF000) >> 12);
-    p_decoded_val->mantissa &= 0x0FFF;
-    return len;
-}
-
-
-/**@brief Function for decoding a uint8_array value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- *
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_uint8_array_decode(const uint8_t len, 
-                                               const uint8_t * p_encoded_data,
-                                               uint8_array_t * p_decoded_val)
-{
-    memcpy(p_decoded_val->p_data, p_encoded_data, len);
-    p_decoded_val->size = len;
-    return p_decoded_val->size;
-}   
-
-
-/**@brief Function for decoding a utf8_str value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- *
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_ble_srv_utf8_str_decode(const uint8_t      len, 
-                                                    const uint8_t      * p_encoded_data, 
-                                                    ble_srv_utf8_str_t * p_decoded_val)
-{
-    p_decoded_val->p_str = (uint8_t*)p_encoded_data;
-    p_decoded_val->length = len;
-    return p_decoded_val->length;
-}   
-
-
-/**@brief Function for decoding a regcertdatalist value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_decoded_val    pointer to the decoded value
- *
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_regcertdatalist_decode(const uint8_t     len, 
-                                                   const uint8_t     * p_encoded_data, 
-                                                   regcertdatalist_t * p_decoded_val)
-{
-    memcpy(p_decoded_val->p_list, p_encoded_data, len);
-    p_decoded_val->list_len = len;
-    return p_decoded_val->list_len;
-}    
-
-
-/**@brief Function for decoding a date_time value.
- *
- * @param[in]   len              length of the field to be decoded.
- * @param[in]   p_encoded_data   Buffer where the encoded data is stored.
- * @param[in]   p_date_time      pointer to the decoded value
- *
- * @return      length of the decoded field.
- */
-static __INLINE uint8_t bds_ble_date_time_decode(const uint8_t   len, 
-                                                 const uint8_t   * p_encoded_data, 
-                                                 ble_date_time_t * p_date_time)
-{
-    UNUSED_VARIABLE(len);
-    uint8_t pos          = bds_uint16_decode(len, &p_encoded_data[0], &p_date_time->year);
-    p_date_time->month   = p_encoded_data[pos++];
-    p_date_time->day     = p_encoded_data[pos++];
-    p_date_time->hours   = p_encoded_data[pos++];
-    p_date_time->minutes = p_encoded_data[pos++];
-    p_date_time->seconds = p_encoded_data[pos++];
-
-    return pos;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_UTIL_BDS_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/util/app_util_platform.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_platform.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_platform.c
deleted file mode 100644
index 5e8c0ad..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_platform.c
+++ /dev/null
@@ -1,60 +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.
- *
- */
-
-#include "app_util_platform.h"
-
-static uint32_t m_in_critical_region = 0;
-
-void app_util_disable_irq(void)
-{
-    __disable_irq();    
-    m_in_critical_region++;    
-}
-
-void app_util_enable_irq(void)
-{
-    m_in_critical_region--;    
-    if (m_in_critical_region == 0)
-    {
-        __enable_irq();
-    }
-}
-
-void app_util_critical_region_enter(uint8_t *p_nested)
-{
-#ifdef NRF52
-    ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get())
-#endif
-
-#if defined(SOFTDEVICE_PRESENT)
-    /* return value can be safely ignored */
-    (void) sd_nvic_critical_region_enter(p_nested);
-#else
-    app_util_disable_irq();
-#endif
-}
-
-void app_util_critical_region_exit(uint8_t nested)
-{
-#ifdef NRF52
-    ASSERT(APP_LEVEL_PRIVILEGED == privilege_level_get())
-#endif
-
-#if defined(SOFTDEVICE_PRESENT)
-    /* return value can be safely ignored */
-    (void) sd_nvic_critical_region_exit(nested);
-#else
-    app_util_enable_irq();
-#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/util/app_util_platform.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_platform.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_platform.h
deleted file mode 100644
index 7b25e5b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/app_util_platform.h
+++ /dev/null
@@ -1,219 +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 app_util_platform Utility Functions and Definitions (Platform)
- * @{
- * @ingroup app_common
- *
- * @brief Various types and definitions available to all applications when using SoftDevice.
- */
-
-#ifndef APP_UTIL_PLATFORM_H__
-#define APP_UTIL_PLATFORM_H__
-
-#include <stdint.h>
-#include "compiler_abstraction.h"
-#include "nrf.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef SOFTDEVICE_PRESENT
-#include "nrf_soc.h"
-#include "nrf_nvic.h"
-#endif
-#include "nrf_assert.h"
-#include "app_error.h"
-
-#if defined(NRF51)
-#define _PRIO_SD_HIGH       0
-#define _PRIO_APP_HIGH      1
-#define _PRIO_APP_MID       1
-#define _PRIO_SD_LOW        2
-#define _PRIO_APP_LOW       3
-#define _PRIO_APP_LOWEST    3
-#define _PRIO_THREAD        4
-#elif defined(NRF52)
-#define _PRIO_SD_HIGH       0
-#define _PRIO_SD_MID        1
-#define _PRIO_APP_HIGH      2
-#define _PRIO_APP_MID       3
-#define _PRIO_SD_LOW        4
-#define _PRIO_SD_LOWEST     5
-#define _PRIO_APP_LOW       6
-#define _PRIO_APP_LOWEST    7
-#define _PRIO_THREAD        15
-#else
-    #error "No platform defined"
-#endif
-
-/**@brief The interrupt priorities available to the application while the SoftDevice is active. */
-typedef enum
-{
-#ifdef SOFTDEVICE_PRESENT
-    APP_IRQ_PRIORITY_HIGHEST = _PRIO_SD_HIGH,
-#else
-    APP_IRQ_PRIORITY_HIGHEST = _PRIO_APP_HIGH,
-#endif
-    APP_IRQ_PRIORITY_HIGH    = _PRIO_APP_HIGH,
-#ifndef SOFTDEVICE_PRESENT
-    APP_IRQ_PRIORITY_MID     = _PRIO_SD_LOW,
-#else
-    APP_IRQ_PRIORITY_MID     = _PRIO_APP_MID,
-#endif
-    APP_IRQ_PRIORITY_LOW     = _PRIO_APP_LOW,
-    APP_IRQ_PRIORITY_LOWEST  = _PRIO_APP_LOWEST,
-    APP_IRQ_PRIORITY_THREAD  = _PRIO_THREAD     /**< "Interrupt level" when running in Thread Mode. */
-} app_irq_priority_t;
-
-/*@brief The privilege levels available to applications in Thread Mode */
-typedef enum
-{
-    APP_LEVEL_UNPRIVILEGED,
-    APP_LEVEL_PRIVILEGED
-} app_level_t;
-
-/**@cond NO_DOXYGEN */
-#define EXTERNAL_INT_VECTOR_OFFSET 16
-/**@endcond */
-
-#define PACKED(TYPE) __packed TYPE
-
-void app_util_critical_region_enter (uint8_t *p_nested);
-void app_util_critical_region_exit (uint8_t nested);
-
-/**@brief Macro for entering a critical region.
- *
- * @note Due to implementation details, there must exist one and only one call to
- *       CRITICAL_REGION_EXIT() for each call to CRITICAL_REGION_ENTER(), and they must be located
- *       in the same scope.
- */
-#ifdef SOFTDEVICE_PRESENT
-#define CRITICAL_REGION_ENTER()                                                             \
-    {                                                                                       \
-        uint8_t __CR_NESTED = 0;                                                            \
-        app_util_critical_region_enter(&__CR_NESTED);
-#else
-#define CRITICAL_REGION_ENTER() app_util_critical_region_enter(NULL)
-#endif
-
-/**@brief Macro for leaving a critical region.
- *
- * @note Due to implementation details, there must exist one and only one call to
- *       CRITICAL_REGION_EXIT() for each call to CRITICAL_REGION_ENTER(), and they must be located
- *       in the same scope.
- */
-#ifdef SOFTDEVICE_PRESENT
-#define CRITICAL_REGION_EXIT()                                                              \
-        app_util_critical_region_exit(__CR_NESTED);                                         \
-    }
-#else
-#define CRITICAL_REGION_EXIT() app_util_critical_region_exit(0)
-#endif 
-
-/* Workaround for Keil 4 */
-#ifndef IPSR_ISR_Msk
-#define IPSR_ISR_Msk                       (0x1FFUL /*<< IPSR_ISR_Pos*/)                  /*!< IPSR: ISR Mask */
-#endif
-       
-
-
-/**@brief Macro to enable anonymous unions from a certain point in the code.
- */
-#if defined(__CC_ARM)
-    #define ANON_UNIONS_ENABLE _Pragma("push") \
-                               _Pragma("anon_unions")
-#elif defined(__ICCARM__)
-    #define ANON_UNIONS_ENABLE _Pragma("language=extended")
-#else
-    #define ANON_UNIONS_ENABLE
-    // No action will be taken.
-    // For GCC anonymous unions are enabled by default.
-#endif
-
-/**@brief Macro to disable anonymous unions from a certain point in the code.
- * @note Call only after first calling @ref ANON_UNIONS_ENABLE.
- */
-#if defined(__CC_ARM)
-    #define ANON_UNIONS_DISABLE _Pragma("pop")
-#elif defined(__ICCARM__)
-    #define ANON_UNIONS_DISABLE
-    // for IAR leave anonymous unions enabled
-#else
-    #define ANON_UNIONS_DISABLE
-    // No action will be taken.
-    // For GCC anonymous unions are enabled by default.
-#endif
-
-
-/* Workaround for Keil 4 */
-#ifndef CONTROL_nPRIV_Msk
-#define CONTROL_nPRIV_Msk                  (1UL /*<< CONTROL_nPRIV_Pos*/)                 /*!< CONTROL: nPRIV Mask */
-#endif
-
-/**@brief Function for finding the current interrupt level.
- *
- * @return   Current interrupt level.
- * @retval   APP_IRQ_PRIORITY_HIGH    We are running in Application High interrupt level.
- * @retval   APP_IRQ_PRIORITY_LOW     We are running in Application Low interrupt level.
- * @retval   APP_IRQ_PRIORITY_THREAD  We are running in Thread Mode.
- */
-static __INLINE uint8_t current_int_priority_get(void)
-{
-    uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ;
-    if (isr_vector_num > 0)
-    {
-        int32_t irq_type = ((int32_t)isr_vector_num - EXTERNAL_INT_VECTOR_OFFSET);
-        return (NVIC_GetPriority((IRQn_Type)irq_type) & 0xFF);
-    }
-    else
-    {
-        return APP_IRQ_PRIORITY_THREAD;
-    }
-}
-
-/**@brief Function for finding out the current privilege level.
- *
- * @return   Current privilege level.
- * @retval   APP_LEVEL_UNPRIVILEGED    We are running in unprivileged level.
- * @retval   APP_LEVEL_PRIVILEGED    We are running in privileged level.
- */
-static __INLINE uint8_t privilege_level_get(void)
-{
-#if defined(NRF51)
-    /* the Cortex-M0 has no concept of privilege */
-    return APP_LEVEL_PRIVILEGED;
-#elif defined(NRF52)
-    uint32_t isr_vector_num = __get_IPSR() & IPSR_ISR_Msk ;
-    if (0 == isr_vector_num)
-    {
-        /* Thread Mode, check nPRIV */
-        int32_t control = __get_CONTROL();
-        return control & CONTROL_nPRIV_Msk ? APP_LEVEL_UNPRIVILEGED : APP_LEVEL_PRIVILEGED;
-    }
-    else
-    {
-        /* Handler Mode, always privileged */
-        return APP_LEVEL_PRIVILEGED;
-    }
-#endif
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_UTIL_PLATFORM_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/util/common.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/common.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/common.h
deleted file mode 100644
index d7dbe62..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/util/common.h
+++ /dev/null
@@ -1,46 +0,0 @@
- /* Copyright (c) 2009 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.
- *
- */
-
-#ifndef COMMON_H
-#define COMMON_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*lint ++flb "Enter library region" */
-
-#include <stdbool.h>
-#include <stdint.h>
-
-/* @file
-* @brief Common header file for generic macros and definitions
- *
- */
-
-/*
- * GPIO glue macros, this can be used to define a pin number in source/header file and use that macro for pin
- * configuration using this expansion.
- * example:
- * #define RESET_PIN    8
- * NRF_GPIO->PINCNF(RESET_PIN) = XXX  ;  // Expanded NRF_GPIO->PIN_CNF[8] = XXX
- */
-#define PINX_GLUE(x, y, z)       x##y##_##z            /*!< first level glue for pin macros */
-#define PINCNF(p)                PINX_GLUE(PIN,p,CNF)  /*!< gpio configure pin number 'p' */
-#define PINOUT(p)                PINX_GLUE(PIN,p,OUT)  /*!< gpio out pin number 'p' */
-
-/*lint --flb "Leave library region" */
-#ifdef __cplusplus
-}
-#endif
-
-#endif


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/power_system_off.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/power_system_off.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/power_system_off.c
deleted file mode 100644
index 674f8e7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/power_system_off.c
+++ /dev/null
@@ -1,32 +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 "nrf_soc_app.h"
-#include "ble_serialization.h"
-#include "nrf_soc.h"
-
-
-uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(1, *p_buf_len);
-
-    p_buf[index++] = SD_POWER_SYSTEM_OFF;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/temp_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/temp_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/temp_get.c
deleted file mode 100644
index 7c5dbe6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/temp_get.c
+++ /dev/null
@@ -1,71 +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.
- */
-
-#include "nrf_soc.h"
-#include "nrf_error.h"
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-
-uint32_t temp_get_req_enc(int32_t const * const p_temp,
-                          uint8_t * const       p_buf,
-                          uint32_t * const      p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    uint32_t total_len = *p_buf_len;
-
-    SER_ASSERT_LENGTH_LEQ(1, total_len);
-    p_buf[index++] = SD_TEMP_GET;
-
-    err_code = cond_field_enc(p_temp, p_buf, total_len, &index, NULL);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t temp_get_rsp_dec(uint8_t const * const p_buf,
-                          uint32_t              packet_len,
-                          uint32_t * const      p_result_code,
-                          int32_t * const       p_temp)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-    SER_ASSERT_NOT_NULL(p_temp);
-
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                               &index,
-                                               packet_len,
-                                               SD_TEMP_GET,
-                                               p_result_code);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        return NRF_SUCCESS;
-    }
-
-    err_code = uint32_t_dec(p_buf, packet_len, &index, p_temp);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return err_code;
-}

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/serialization/application/hal/arm_startup_nrf51.s
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/arm_startup_nrf51.s b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/arm_startup_nrf51.s
deleted file mode 100644
index 441b96b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/arm_startup_nrf51.s
+++ /dev/null
@@ -1,240 +0,0 @@
-; Copyright (c) 2013, Nordic Semiconductor ASA
-; All rights reserved.
-; 
-; Redistribution and use in source and binary forms, with or without
-; modification, are permitted provided that the following conditions are met:
-; 
-; * Redistributions of source code must retain the above copyright notice, this
-;   list of conditions and the following disclaimer.
-; 
-; * Redistributions in binary form must reproduce the above copyright notice,
-;   this list of conditions and the following disclaimer in the documentation
-;   and/or other materials provided with the distribution.
-; 
-; * Neither the name of Nordic Semiconductor ASA nor the names of its
-;   contributors may be used to endorse or promote products derived from
-;   this software without specific prior written permission.
-; 
-; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 
-; NOTE: Template files (including this one) are application specific and therefore 
-; expected to be copied into the application project folder prior to its use!
-
-; Description message
-
-Stack_Size      EQU     2048
-                AREA    STACK, NOINIT, READWRITE, ALIGN=3
-Stack_Mem       SPACE   Stack_Size
-__initial_sp
-
-Heap_Size       EQU     2048
-
-                AREA    HEAP, NOINIT, READWRITE, ALIGN=3
-__heap_base
-Heap_Mem        SPACE   Heap_Size
-__heap_limit
-
-                PRESERVE8
-                THUMB
-
-; Vector Table Mapped to Address 0 at Reset
-
-                AREA    RESET, DATA, READONLY
-                EXPORT  __Vectors
-                EXPORT  __Vectors_End
-                EXPORT  __Vectors_Size
-
-__Vectors       DCD     __initial_sp              ; Top of Stack
-                DCD     Reset_Handler             ; Reset Handler
-                DCD     NMI_Handler               ; NMI Handler
-                DCD     HardFault_Handler         ; Hard Fault Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     SVC_Handler               ; SVCall Handler
-                DCD     0                         ; Reserved
-                DCD     0                         ; Reserved
-                DCD     PendSV_Handler            ; PendSV Handler
-                DCD     SysTick_Handler           ; SysTick Handler
-
-                ; External Interrupts
-                DCD      POWER_CLOCK_IRQHandler ;POWER_CLOCK
-                DCD      RADIO_IRQHandler ;RADIO
-                DCD      UART0_IRQHandler ;UART0
-                DCD      SPI0_TWI0_IRQHandler ;SPI0_TWI0
-                DCD      SPI1_TWI1_IRQHandler ;SPI1_TWI1
-                DCD      0 ;Reserved
-                DCD      GPIOTE_IRQHandler ;GPIOTE
-                DCD      ADC_IRQHandler ;ADC
-                DCD      TIMER0_IRQHandler ;TIMER0
-                DCD      TIMER1_IRQHandler ;TIMER1
-                DCD      TIMER2_IRQHandler ;TIMER2
-                DCD      RTC0_IRQHandler ;RTC0
-                DCD      TEMP_IRQHandler ;TEMP
-                DCD      RNG_IRQHandler ;RNG
-                DCD      ECB_IRQHandler ;ECB
-                DCD      CCM_AAR_IRQHandler ;CCM_AAR
-                DCD      WDT_IRQHandler ;WDT
-                DCD      RTC1_IRQHandler ;RTC1
-                DCD      QDEC_IRQHandler ;QDEC
-                DCD      LPCOMP_IRQHandler ;LPCOMP
-                DCD      SWI0_IRQHandler ;SWI0
-                DCD      SWI1_IRQHandler ;SWI1
-                DCD      SWI2_IRQHandler ;SWI2
-                DCD      SWI3_IRQHandler ;SWI3
-                DCD      SWI4_IRQHandler ;SWI4
-                DCD      SWI5_IRQHandler ;SWI5
-                DCD      0 ;Reserved
-                DCD      0 ;Reserved
-                DCD      0 ;Reserved
-                DCD      0 ;Reserved
-                DCD      0 ;Reserved
-                DCD      0 ;Reserved
-
-
-__Vectors_End
-
-__Vectors_Size  EQU     __Vectors_End - __Vectors
-
-                AREA    |.text|, CODE, READONLY
-
-; Reset Handler
-
-NRF_POWER_RAMON_ADDRESS           EQU   0x40000524  ; NRF_POWER->RAMON address
-NRF_POWER_RAMON_RAMxON_ONMODE_Msk EQU   0x3         ; All RAM blocks on in onmode bit mask
-
-Reset_Handler   PROC
-                EXPORT  Reset_Handler             [WEAK]
-                IMPORT  SystemInit
-                IMPORT  __main
-                LDR     R0, =NRF_POWER_RAMON_ADDRESS
-                LDR     R2, [R0]
-                MOVS    R1, #NRF_POWER_RAMON_RAMxON_ONMODE_Msk
-                ORRS    R2, R2, R1
-                STR     R2, [R0]
-                LDR     R0, =SystemInit
-                BLX     R0
-                LDR     R0, =__main
-                BX      R0
-                ENDP
-
-; Dummy Exception Handlers (infinite loops which can be modified)
-
-NMI_Handler     PROC
-                EXPORT  NMI_Handler               [WEAK]
-                B       .
-                ENDP
-HardFault_Handler\
-                PROC
-                EXPORT  HardFault_Handler         [WEAK]
-                B       .
-                ENDP
-SVC_Handler     PROC
-                EXPORT  SVC_Handler               [WEAK]
-                B       .
-                ENDP
-PendSV_Handler  PROC
-                EXPORT  PendSV_Handler            [WEAK]
-                B       .
-                ENDP
-SysTick_Handler PROC
-                EXPORT  SysTick_Handler           [WEAK]
-                B       .
-                ENDP
-
-Default_Handler PROC
-
-                EXPORT   POWER_CLOCK_IRQHandler [WEAK]
-                EXPORT   RADIO_IRQHandler [WEAK]
-                EXPORT   UART0_IRQHandler [WEAK]
-                EXPORT   SPI0_TWI0_IRQHandler [WEAK]
-                EXPORT   SPI1_TWI1_IRQHandler [WEAK]
-                EXPORT   GPIOTE_IRQHandler [WEAK]
-                EXPORT   ADC_IRQHandler [WEAK]
-                EXPORT   TIMER0_IRQHandler [WEAK]
-                EXPORT   TIMER1_IRQHandler [WEAK]
-                EXPORT   TIMER2_IRQHandler [WEAK]
-                EXPORT   RTC0_IRQHandler [WEAK]
-                EXPORT   TEMP_IRQHandler [WEAK]
-                EXPORT   RNG_IRQHandler [WEAK]
-                EXPORT   ECB_IRQHandler [WEAK]
-                EXPORT   CCM_AAR_IRQHandler [WEAK]
-                EXPORT   WDT_IRQHandler [WEAK]
-                EXPORT   RTC1_IRQHandler [WEAK]
-                EXPORT   QDEC_IRQHandler [WEAK]
-                EXPORT   LPCOMP_IRQHandler [WEAK]
-                EXPORT   SWI0_IRQHandler [WEAK]
-                EXPORT   SWI1_IRQHandler [WEAK]
-                EXPORT   SWI2_IRQHandler [WEAK]
-                EXPORT   SWI3_IRQHandler [WEAK]
-                EXPORT   SWI4_IRQHandler [WEAK]
-                EXPORT   SWI5_IRQHandler [WEAK]
-POWER_CLOCK_IRQHandler
-RADIO_IRQHandler
-UART0_IRQHandler
-SPI0_TWI0_IRQHandler
-SPI1_TWI1_IRQHandler
-GPIOTE_IRQHandler
-ADC_IRQHandler
-TIMER0_IRQHandler
-TIMER1_IRQHandler
-TIMER2_IRQHandler
-RTC0_IRQHandler
-TEMP_IRQHandler
-RNG_IRQHandler
-ECB_IRQHandler
-CCM_AAR_IRQHandler
-WDT_IRQHandler
-RTC1_IRQHandler
-QDEC_IRQHandler
-LPCOMP_IRQHandler
-SWI0_IRQHandler
-SWI1_IRQHandler
-SWI2_IRQHandler
-SWI3_IRQHandler
-SWI4_IRQHandler
-SWI5_IRQHandler
-
-                B .
-                ENDP
-                ALIGN
-
-; User Initial Stack & Heap
-
-                IF      :DEF:__MICROLIB
-                
-                EXPORT  __initial_sp
-                EXPORT  __heap_base
-                EXPORT  __heap_limit
-
-                ELSE
-
-                IMPORT  __use_two_region_memory
-                EXPORT  __user_initial_stackheap
-__user_initial_stackheap
-
-                LDR     R0, = Heap_Mem
-                LDR     R1, = (Stack_Mem + Stack_Size)
-                LDR     R2, = (Heap_Mem + Heap_Size)
-                LDR     R3, = Stack_Mem
-                BX      LR
-
-                ALIGN
-
-                ENDIF
-
-                END
-

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/serialization/application/hal/ser_app_hal.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_hal.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_hal.h
deleted file mode 100644
index 1ab75b4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_hal.h
+++ /dev/null
@@ -1,88 +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 ser_app_hal Serialization Application Hardware Abstraction Layer
- * @{
- * @ingroup ble_sdk_lib_serialization
- *
- * @brief Functions which set up hardware on Application board and perform the reset of the Connectivity Board.
- */
-
-#ifndef SER_APP_HAL_H_
-#define SER_APP_HAL_H_
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*ser_app_hal_flash_op_done_handler_t)(bool success);
-/**@brief Function for initializing hw modules.
- *
- * @details Function can initilize can hardware modules on application processor. It is optional to
- * implement. It is called one connectivity chip is initialized.
- *
- * @param handler Flash operation event handler
- *
- * @return @ref NRF_SUCCESS HAL initialized successfully.
- * @return @ref nrf_error "NRF_ERROR_..." HAL initialization failed.
- *
- */
-uint32_t ser_app_hal_hw_init(ser_app_hal_flash_op_done_handler_t handler);
-
-/**@brief Function for waiting for given amount of time.
- *
- * @param[in] ms Number of milliseconds to wait.
- *
- */
-void ser_app_hal_delay(uint32_t ms);
-
-/**@brief Function for clearing connectivity chip reset pin
- *
- */
-void ser_app_hal_nrf_reset_pin_clear(void);
-
-/**@brief Function for setting connectivity chip reset pin
- *
- */
-void ser_app_hal_nrf_reset_pin_set(void);
-
-
-/**@brief Function for setting softdevice event interrupt priority which is serving events incoming
- * from connectivity chip.
- *
- * @note Serialization solution on application side mimics SoC solution where events are handled in
- * the interrupt context in two ways: or directly in the interrupt context or message is posted to
- * the scheduler. However, it is possible that application processor is not using dedicated interrupt
- * for connectivity events. In that case this function can be left empty and
- * \ref ser_app_hal_nrf_evt_pending will directly call an interrupt handler function.
- */
-void ser_app_hal_nrf_evt_irq_priority_set(void);
-
-/**@brief Function for setting pending interrupt for serving events incoming from connectivity chip.
- *
- * @note The interrupt used for event from connectivity chip mimics behavior of SoC and it is not
- * intended to be triggered by any hardware event. This function should be the only source of
- * interrupt triggering.
- */
-void ser_app_hal_nrf_evt_pending(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_APP_HAL_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/serialization/application/hal/ser_app_hal_nrf51.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_hal_nrf51.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_hal_nrf51.c
deleted file mode 100644
index 507adf8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_hal_nrf51.c
+++ /dev/null
@@ -1,139 +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.
- *
- */
-
-#include "app_util_platform.h"
-#include "ser_app_hal.h"
-#include "nrf.h"
-#include "nrf_gpio.h"
-#include "nrf_soc.h"
-#include "nrf_delay.h"
-#include "nrf_nvmc.h"
-#include "boards.h"
-#include "ser_phy.h"
-#include "ser_phy_config_app_nrf51.h"
-
-#ifdef NRF51
-#define SOFTDEVICE_EVT_IRQ      SD_EVT_IRQn         /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */
-#define FLASH_WRITE_MAX_LENGTH  256
-#elif defined NRF52
-#define SOFTDEVICE_EVT_IRQ      SWI2_EGU2_IRQn
-#define FLASH_WRITE_MAX_LENGTH  1024
-#endif /* NRF51 */
-
-#define BLE_FLASH_PAGE_SIZE     ((uint16_t)NRF_FICR->CODEPAGESIZE)  /**< Size of one flash page. */
-
-static ser_app_hal_flash_op_done_handler_t m_flash_op_handler;
-uint32_t ser_app_hal_hw_init(ser_app_hal_flash_op_done_handler_t handler)
-{
-    nrf_gpio_cfg_output(CONN_CHIP_RESET_PIN_NO);
-
-    NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
-    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
-    NRF_CLOCK->TASKS_LFCLKSTART    = 1;
-
-    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
-    {
-        //No implementation needed.
-    }
-
-    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
-    m_flash_op_handler = handler;
-    return NRF_SUCCESS;
-}
-
-void ser_app_hal_delay(uint32_t ms)
-{
-    nrf_delay_ms(ms);
-}
-
-void ser_app_hal_nrf_reset_pin_clear()
-{
-    nrf_gpio_pin_clear(CONN_CHIP_RESET_PIN_NO);
-}
-
-void ser_app_hal_nrf_reset_pin_set()
-{
-    nrf_gpio_pin_set(CONN_CHIP_RESET_PIN_NO);
-}
-
-void ser_app_hal_nrf_evt_irq_priority_set()
-{
-    NVIC_SetPriority(SOFTDEVICE_EVT_IRQ, APP_IRQ_PRIORITY_LOW);
-}
-
-void ser_app_hal_nrf_evt_pending()
-{
-    NVIC_SetPendingIRQ(SOFTDEVICE_EVT_IRQ);
-}
-
-uint32_t sd_ppi_channel_enable_get(uint32_t * p_channel_enable)
-{
-    *p_channel_enable = NRF_PPI->CHEN;
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk)
-{
-    NRF_PPI->CHEN = channel_enable_set_msk;
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_ppi_channel_assign(uint8_t               channel_num,
-                               const volatile void * evt_endpoint,
-                               const volatile void * task_endpoint)
-{
-    NRF_PPI->CH[channel_num].TEP = (uint32_t)task_endpoint;
-    NRF_PPI->CH[channel_num].EEP = (uint32_t)evt_endpoint;
-    return NRF_SUCCESS;
-}
-/**
- * @brief Check if given address is in device FLASH range.
- *
- * @param[in] ptr Address to check.
- * @retval true  Given address is located in FLASH.
- * @retval false Given address is not located in FLASH.
- */
-__STATIC_INLINE bool addr_is_in_FLASH(void const * const ptr)
-{
-    return ((((uintptr_t)ptr) & 0xFF000000u) == 0x00000000u);
-}
-
-uint32_t sd_flash_page_erase(uint32_t page_number)
-{
-    uint32_t * p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_number);
-
-    if (!addr_is_in_FLASH(p_page))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    nrf_nvmc_page_erase((uint32_t) p_page);
-    m_flash_op_handler(true);
-    return NRF_SUCCESS;
-}
-
-uint32_t sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size)
-{
-    if (size > FLASH_WRITE_MAX_LENGTH)
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    if (!addr_is_in_FLASH(p_dst))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    nrf_nvmc_write_words((uint32_t) p_dst, p_src, size);
-    m_flash_op_handler(true);
-    return NRF_SUCCESS;
-}

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/serialization/application/hal/ser_app_power_system_off.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_power_system_off.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_power_system_off.c
deleted file mode 100644
index 8ae84a5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_power_system_off.c
+++ /dev/null
@@ -1,35 +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.
- *
- */
-
-#include "nrf.h"
-#include "ser_app_power_system_off.h"
-
-static bool m_power_system_off = false;
-
- 
-void ser_app_power_system_off_set(void)
-{
-    m_power_system_off = true;
-}
-
-bool ser_app_power_system_off_get(void)
-{
-    return m_power_system_off;
-}
-
-void ser_app_power_system_off_enter(void)
-{
-    NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter;
-
-    /*Only for debugging purpose, will not be reached without connected debugger*/
-    while(1);
-}

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/serialization/application/hal/ser_app_power_system_off.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_power_system_off.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_power_system_off.h
deleted file mode 100644
index 7a6b095..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/hal/ser_app_power_system_off.h
+++ /dev/null
@@ -1,32 +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.
- *
- */
-
-#ifndef APP_POWER_SYSTEM_OFF_H
-#define APP_POWER_SYSTEM_OFF_H
-
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void ser_app_power_system_off_set(void);
-
-bool ser_app_power_system_off_get(void);
-
-void ser_app_power_system_off_enter(void);
-
-#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/serialization/application/transport/ser_sd_transport.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_sd_transport.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_sd_transport.c
deleted file mode 100644
index 59f2906..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_sd_transport.c
+++ /dev/null
@@ -1,259 +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.
- *
- */
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <stddef.h>
-#include "ser_sd_transport.h"
-#include "ser_hal_transport.h"
-#include "nrf_error.h"
-#include "app_error.h"
-#include "ble_serialization.h"
-
-#include "ser_app_power_system_off.h"
-
-#include "app_util.h"
-
-#ifdef ENABLE_DEBUG_LOG_SUPPORT
-#include "app_trace.h"
-#define APPL_LOG                        app_trace_log             /**< Debug logger macro that will be used in this file to do logging of debug information over UART. */
-#else
-#define APPL_LOG(...)
-#endif //ENABLE_DEBUG_LOG_SUPPORT
-
-/** SoftDevice event handler. */
-static ser_sd_transport_evt_handler_t m_evt_handler = NULL;
-
-/** 'One time' handler called in task context while waiting for response to scheduled command. */
-static ser_sd_transport_rsp_wait_handler_t m_ot_rsp_wait_handler = NULL;
-
-/** Handler called in task context while waiting for response to scheduled command. */
-static ser_sd_transport_rsp_wait_handler_t m_os_rsp_wait_handler = NULL;
-
-/** Handler called in serial peripheral interrupt context when response is received. */
-static ser_sd_transport_rsp_set_handler_t m_os_rsp_set_handler = NULL;
-
-/** Handler called when hal_transport notifies that packet reception has started. */
-static ser_sd_transport_rx_notification_handler_t m_rx_notify_handler = NULL;
-
-/** User decoder handler for expected response packet. */
-static ser_sd_transport_rsp_handler_t m_rsp_dec_handler = NULL;
-
-/** Flag indicated whether module is waiting for response packet. */
-static volatile bool m_rsp_wait = false;
-
-/** SoftDevice call return value decoded by user decoder handler. */
-static uint32_t m_return_value;
-
-/**@brief Function for handling the rx packets comming from hal_transport.
- *
- * @details
- *  This function is called in serial peripheral interrupt context. Response packets are handled in
- *  this context. Events are passed to the application and it is up to application in which context
- *  they are handled.
- *
- * @param[in]   p_data   Pointer to received data.
- * @param[in]   length   Size of data.
- */
-static void ser_sd_transport_rx_packet_handler(uint8_t * p_data, uint16_t length)
-{
-    if (p_data && (length >= SER_PKT_TYPE_SIZE))
-    {
-        const uint8_t packet_type = p_data[SER_PKT_TYPE_POS];
-        p_data += SER_PKT_TYPE_SIZE;
-        length -= SER_PKT_TYPE_SIZE;
-
-        switch (packet_type)
-        {
-            case SER_PKT_TYPE_RESP:
-            case SER_PKT_TYPE_DTM_RESP:
-
-                if (m_rsp_wait)
-                {
-                    m_return_value = m_rsp_dec_handler(p_data, length);
-                    (void)ser_sd_transport_rx_free(p_data);
-
-                    /* Reset response flag - cmd_write function is pending on it.*/
-                    m_rsp_wait = false;
-
-                    /* If os handler is set, signal os that response has arrived.*/
-                    if (m_os_rsp_set_handler)
-                    {
-                        m_os_rsp_set_handler();
-                    }
-                }
-                else
-                {
-                    /* Unexpected packet. */
-                    (void)ser_sd_transport_rx_free(p_data);
-                    APP_ERROR_HANDLER(packet_type);
-                }
-                break;
-
-            case SER_PKT_TYPE_EVT:
-                /* It is ensured during opening that handler is not NULL. No check needed. */
-                APPL_LOG("\r\n[EVT_ID]: 0x%X \r\n", uint16_decode(&p_data[SER_EVT_ID_POS])); // p_data points to EVT_ID
-                m_evt_handler(p_data, length);
-                break;
-
-            default:
-                (void)ser_sd_transport_rx_free(p_data);
-                APP_ERROR_HANDLER(packet_type);
-                break;
-        }
-    }
-}
-
-/**@brief Function for handling the event from hal_transport.
- *
- * @param[in]   event   Event from hal_transport.
- */
-static void ser_sd_transport_hal_handler(ser_hal_transport_evt_t event)
-{
-    switch (event.evt_type)
-    {
-    case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED:
-        ser_sd_transport_rx_packet_handler(event.evt_params.rx_pkt_received.p_buffer,
-                                           event.evt_params.rx_pkt_received.num_of_bytes);
-        break;
-    case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING:
-        if (m_rx_notify_handler)
-        {
-            m_rx_notify_handler();
-        }
-        break;
-    case SER_HAL_TRANSP_EVT_TX_PKT_SENT:
-        if(ser_app_power_system_off_get() == true)
-        {
-            ser_app_power_system_off_enter();
-        }
-        break;
-    case SER_HAL_TRANSP_EVT_PHY_ERROR:
-
-        if (m_rsp_wait)
-        {
-            m_return_value = NRF_ERROR_INTERNAL;
-
-            /* Reset response flag - cmd_write function is pending on it.*/
-            m_rsp_wait = false;
-
-            /* If os handler is set, signal os that response has arrived.*/
-            if (m_os_rsp_set_handler)
-            {
-                m_os_rsp_set_handler();
-            }
-        }
-        break;
-    default:
-        break;
-    }
-}
-
-uint32_t ser_sd_transport_open(ser_sd_transport_evt_handler_t             evt_handler,
-                               ser_sd_transport_rsp_wait_handler_t        os_rsp_wait_handler,
-                               ser_sd_transport_rsp_set_handler_t         os_rsp_set_handler,
-                               ser_sd_transport_rx_notification_handler_t rx_notify_handler)
-{
-    m_os_rsp_wait_handler = os_rsp_wait_handler;
-    m_os_rsp_set_handler  = os_rsp_set_handler;
-    m_rx_notify_handler   = rx_notify_handler;
-    m_ot_rsp_wait_handler = NULL;
-    m_evt_handler         = evt_handler;
-
-    if (evt_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    return ser_hal_transport_open(ser_sd_transport_hal_handler);
-}
-
-uint32_t ser_sd_transport_close(void)
-{
-    m_evt_handler         = NULL;
-    m_os_rsp_wait_handler = NULL;
-    m_os_rsp_set_handler  = NULL;
-    m_ot_rsp_wait_handler = NULL;
-
-    ser_hal_transport_close();
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ser_sd_transport_ot_rsp_wait_handler_set(ser_sd_transport_rsp_wait_handler_t handler)
-{
-    m_ot_rsp_wait_handler = handler;
-
-    return NRF_SUCCESS;
-}
-
-bool ser_sd_transport_is_busy(void)
-{
-    return m_rsp_wait;
-}
-
-uint32_t ser_sd_transport_tx_alloc(uint8_t * * pp_data, uint16_t * p_len)
-{
-    uint32_t err_code;
-
-    if (m_rsp_wait)
-    {
-        err_code = NRF_ERROR_BUSY;
-    }
-    else
-    {
-        err_code = ser_hal_transport_tx_pkt_alloc(pp_data, p_len);
-    }
-    return err_code;
-}
-
-uint32_t ser_sd_transport_tx_free(uint8_t * p_data)
-{
-    return ser_hal_transport_tx_pkt_free(p_data);
-}
-
-uint32_t ser_sd_transport_rx_free(uint8_t * p_data)
-{
-    p_data -= SER_PKT_TYPE_SIZE;
-    return ser_hal_transport_rx_pkt_free(p_data);
-}
-
-uint32_t ser_sd_transport_cmd_write(const uint8_t *                p_buffer,
-                                    uint16_t                       length,
-                                    ser_sd_transport_rsp_handler_t cmd_rsp_decode_callback)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    m_rsp_wait        = true;
-    m_rsp_dec_handler = cmd_rsp_decode_callback;
-    err_code          = ser_hal_transport_tx_pkt_send(p_buffer, length);
-    APP_ERROR_CHECK(err_code);
-
-    /* Execute callback for response decoding only if one was provided.*/
-    if ((err_code == NRF_SUCCESS) && cmd_rsp_decode_callback)
-    {
-        if (m_ot_rsp_wait_handler)
-        {
-            m_ot_rsp_wait_handler();
-            m_ot_rsp_wait_handler = NULL;
-        }
-
-        m_os_rsp_wait_handler();
-        err_code = m_return_value;
-    }
-    else
-    {
-        m_rsp_wait = false;
-    }
-    APPL_LOG("\r\n[SD_CALL_ID]: 0x%X, err_code= 0x%X\r\n", p_buffer[1], err_code);
-    return err_code;
-}

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/serialization/application/transport/ser_sd_transport.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_sd_transport.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_sd_transport.h
deleted file mode 100644
index c6b14c7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_sd_transport.h
+++ /dev/null
@@ -1,161 +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.
- *
- */
-
-/**
- * @addtogroup ser_app Application side code
- * @ingroup ble_sdk_lib_serialization
- */
-
-/** @file
- *
- * @defgroup ser_sd_transport Serialization SoftDevice Transport
- * @{
- * @ingroup ser_app
- *
- * @brief   Serialization SoftDevice Transport on application side.
- *
- * @details This file contains declarations of functions and definitions of data structures and
- *          identifiers (typedef enum) used as API of the serialization of SoftDevice. This layer
- *          ensures atomic nature of SoftDevice calls (command and waiting for response). Packet
- *          type field of incoming packets is handled in this layer - responses are handled by
- *          ser_sd_transport (using response decoder handler provided for each SoftDevice call) but
- *          events are forwarded to the user so it is user's responsibility to free RX buffer.
- *
- */
-#ifndef SER_SD_TRANSPORT_H_
-#define SER_SD_TRANSPORT_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*ser_sd_transport_evt_handler_t)(uint8_t * p_buffer, uint16_t length);
-typedef void (*ser_sd_transport_rsp_wait_handler_t)(void);
-typedef void (*ser_sd_transport_rsp_set_handler_t)(void);
-typedef void (*ser_sd_transport_rx_notification_handler_t)(void);
-
-typedef uint32_t (*ser_sd_transport_rsp_handler_t)(const uint8_t * p_buffer, uint16_t length);
-
-/**@brief Function for opening the module.
- *
- * @note 'Wait for response' and 'Response set' callbacks can be set in RTOS environment.
- *       It enables rescheduling while waiting for connectivity chip response. In nonOS environment
- *       usually 'Wait for response' will only be used for handling incoming events or force
- *       application to low power mode.
- *
- * @param[in] evt_handler               Handler to be called when event packet is received.
- * @param[in] os_rsp_wait_handler       Handler to be called after request is send. It should.
- *                                      implement 'Wait for signal' functionality in OS environment.
- * @param[in] os_rsp_set_handler        Handler to be called after response reception. It should
- *                                      implement 'Signal Set' functionality in OS environment
- * @param[in] rx_not_handler            Handler to be called after transport layer notifies that
- *                                      there is incoming rx packet detected.
- *
- * @retval NRF_SUCCESS              Operation success.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_PARAM  Operation failure. Parameter propagated from ser_hal_transport
- *                                  opening or timer creation.
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. Parameter propagated from ser_hal_transport
- *                                  opening or timer creation.
- * @retval NRF_ERROR_INTERNAL       Operation failure.  Parameter propagated from ser_hal_transport
- *                                  opening or timer creation.
- * @retval NRF_ERROR_NO_MEM         Operation failure.  Parameter propagated from timer creation.
- */
-uint32_t ser_sd_transport_open(ser_sd_transport_evt_handler_t             evt_handler,
-                               ser_sd_transport_rsp_wait_handler_t        os_rsp_wait_handler,
-                               ser_sd_transport_rsp_set_handler_t         os_rsp_set_handler,
-                               ser_sd_transport_rx_notification_handler_t rx_not_handler);
-
-/**@brief Function setting 'One Time' handler to be called between sending next request packet and
- *        receiving response packet.
- * @note It is intended to be used in nonOS environment to implement concurrency.
- * @note It is 'One Time' handler meaning that it is valid only for next softdevice call processing.
- *
- *
- * @param[in] wait_handler       Handler to be called after request packet is sent.
- *
- * @retval NRF_SUCCESS          Operation success.
- */
-uint32_t ser_sd_transport_ot_rsp_wait_handler_set(ser_sd_transport_rsp_wait_handler_t wait_handler);
-
-
-/**@brief Function for closing the module.
- *
- * @retval NRF_SUCCESS          Operation success.
- */
-uint32_t ser_sd_transport_close(void);
-
-/**@brief Function for allocating tx packet to be used for request command.
- *
- * @param[out] pp_data       Pointer to data pointer to be set to point to allocated buffer.
- * @param[out] p_len         Pointer to allocated buffer length.
- *
- * @retval NRF_SUCCESS          Operation success.
- */
-uint32_t ser_sd_transport_tx_alloc(uint8_t * * pp_data, uint16_t * p_len);
-
-
-/**@brief Function for freeing tx packet.
- *
- * @note Function should be called once command is processed.
- *
- * @param[out] p_data       Pointer to allocated tx buffer.
- *
- * @retval NRF_SUCCESS          Operation success.
- */
-uint32_t ser_sd_transport_tx_free(uint8_t * p_data);
-
-
-/**@brief Function for freeing RX event packet.
- *
- * @note Function should be called once SoftDevice event buffer is processed.
- *
- * @param[out] p_data       Pointer to allocated rx buffer.
- *
- * @retval NRF_SUCCESS          Operation success.
- */
-uint32_t ser_sd_transport_rx_free(uint8_t * p_data);
-
-
-/**@brief Function for checking if module is busy waiting for response from connectivity side.
- *
- * @retval true      Module busy. Cannot accept next command.
- * @retval false     Module not busy. Can accept next command.
- */
-bool ser_sd_transport_is_busy(void);
-
-/**@brief Function for handling SoftDevice command.
- *
- * @note Function blocks task context until response is received and processed.
- * @note Non-blocking functionality can be achieved using os handlers or 'One Time' handler
- * @warning Function shouldn't be called from interrupt context which would block switching to
- *          serial port interrupt.
- *
- * @param[in] p_buffer                 Pointer to command.
- * @param[in] length                   Pointer to allocated buffer length.
- * @param[in] cmd_resp_decode_callback Pointer to function for decoding response packet.
- *
- * @retval NRF_SUCCESS          Operation success.
- */
-uint32_t ser_sd_transport_cmd_write(const uint8_t *                p_buffer,
-                                    uint16_t                       length,
-                                    ser_sd_transport_rsp_handler_t cmd_resp_decode_callback);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_SD_TRANSPORT_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/serialization/application/transport/ser_softdevice_handler.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_softdevice_handler.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_softdevice_handler.c
deleted file mode 100644
index 80b1ef8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_softdevice_handler.c
+++ /dev/null
@@ -1,200 +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.
- *
- */
-#include <stdlib.h>
-#include <string.h>
-#include "ble_app.h"
-#include "app_mailbox.h"
-#include "app_scheduler.h"
-#include "softdevice_handler.h"
-#include "ser_sd_transport.h"
-#include "ser_app_hal.h"
-#include "ser_config.h"
-#include "nrf_soc.h"
-
-
-#define SD_BLE_EVT_MAILBOX_QUEUE_SIZE 5 /**< Size of mailbox queue. */
-
-/** @brief Structure used to pass packet details through mailbox.
- */
-typedef struct
-{
-    uint32_t evt_data[CEIL_DIV(BLE_STACK_EVT_MSG_BUF_SIZE, sizeof (uint32_t))]; /**< Buffer for decoded event */
-} ser_sd_handler_evt_data_t;
-
-/** @brief
- *   Mailbox used for communication between event handler (called from serial stream
- *   interrupt context) and event processing function (called from scheduler or interrupt context).
- */
-APP_MAILBOX_DEF(sd_ble_evt_mailbox, SD_BLE_EVT_MAILBOX_QUEUE_SIZE, sizeof(ser_sd_handler_evt_data_t));
-
-APP_MAILBOX_DEF(sd_soc_evt_mailbox, SD_BLE_EVT_MAILBOX_QUEUE_SIZE, sizeof(uint32_t));
-
-/**
- * @brief Function to be replaced by user implementation if needed.
- *
- * Weak function - user can add different implementation of this function if application needs it.
- */
-__WEAK void os_rsp_set_handler(void)
-{
-
-}
-
-static void connectivity_reset_low(void)
-{
-    //Signal a reset to the nRF51822 by setting the reset pin on the nRF51822 low.
-    ser_app_hal_nrf_reset_pin_clear();
-    ser_app_hal_delay(CONN_CHIP_RESET_TIME);
-
-}
-
-static void connectivity_reset_high(void)
-{
-
-    //Set the reset level to high again.
-    ser_app_hal_nrf_reset_pin_set();
-
-    //Wait for nRF51822 to be ready.
-    ser_app_hal_delay(CONN_CHIP_WAKEUP_TIME);
-}
-
-static void ser_softdevice_evt_handler(uint8_t * p_data, uint16_t length)
-{
-    ser_sd_handler_evt_data_t item;
-    uint32_t                  err_code;
-    uint32_t                  len32 = sizeof (item.evt_data);
-
-    err_code = ble_event_dec(p_data, length, (ble_evt_t *)item.evt_data, &len32);
-    APP_ERROR_CHECK(err_code);
-
-    err_code = ser_sd_transport_rx_free(p_data);
-    APP_ERROR_CHECK(err_code);
-
-    err_code = app_mailbox_put(&sd_ble_evt_mailbox, &item);
-    APP_ERROR_CHECK(err_code);
-
-    ser_app_hal_nrf_evt_pending();
-}
-
-void ser_softdevice_flash_operation_success_evt(bool success)
-{
-	uint32_t evt_type = success ? NRF_EVT_FLASH_OPERATION_SUCCESS :
-			NRF_EVT_FLASH_OPERATION_ERROR;
-
-	uint32_t err_code = app_mailbox_put(&sd_soc_evt_mailbox, &evt_type);
-	APP_ERROR_CHECK(err_code);
-
-	ser_app_hal_nrf_evt_pending();
-}
-
-/**
- * @brief Function called while waiting for connectivity chip response. It handles incoming events.
- */
-static void ser_sd_rsp_wait(void)
-{
-    do
-    {
-        (void)sd_app_evt_wait();
-
-        //intern_softdevice_events_execute();
-    }
-    while (ser_sd_transport_is_busy());
-}
-
-uint32_t sd_evt_get(uint32_t * p_evt_id)
-{
-    uint32_t err_code;
-
-    err_code = app_mailbox_get(&sd_soc_evt_mailbox, p_evt_id);
-    if (err_code != NRF_SUCCESS) //if anything in the mailbox
-    {
-    	err_code = NRF_ERROR_NOT_FOUND;
-    }
-
-    return err_code;
-}
-
-uint32_t sd_ble_evt_get(uint8_t * p_data, uint16_t * p_len)
-{
-    uint32_t err_code;
-
-    err_code = app_mailbox_get(&sd_ble_evt_mailbox, p_data);
-
-    if (err_code == NRF_SUCCESS) //if anything in the mailbox
-    {
-        if (((ble_evt_t *)p_data)->header.evt_len > *p_len)
-        {
-            err_code = NRF_ERROR_DATA_SIZE;
-        }
-        else
-        {
-            *p_len = ((ble_evt_t *)p_data)->header.evt_len;
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_NOT_FOUND;
-    }
-
-    return err_code;
-}
-
-uint32_t sd_ble_evt_mailbox_length_get(uint32_t * p_mailbox_length)
-{
-    uint32_t err_code = NRF_SUCCESS;
-    
-    *p_mailbox_length = app_mailbox_length_get(&sd_ble_evt_mailbox);
-    
-    return err_code;
-}
-
-uint32_t sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg,
-                              nrf_fault_handler_t assertion_handler)
-{
-    uint32_t err_code;
-
-    err_code = ser_app_hal_hw_init(ser_softdevice_flash_operation_success_evt);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        connectivity_reset_low();
-
-        err_code = app_mailbox_create(&sd_soc_evt_mailbox);
-        if (err_code != NRF_SUCCESS)
-        {
-        	return err_code;
-        }
-
-        err_code = app_mailbox_create(&sd_ble_evt_mailbox);
-        if (err_code == NRF_SUCCESS)
-        {
-            err_code = ser_sd_transport_open(ser_softdevice_evt_handler,
-                                             ser_sd_rsp_wait,
-                                             os_rsp_set_handler,
-                                             NULL);
-            if (err_code == NRF_SUCCESS)
-            {
-              connectivity_reset_high();
-            }
-        }
-
-        ser_app_hal_nrf_evt_irq_priority_set();
-    }
-
-    return err_code;
-}
-
-
-uint32_t sd_softdevice_disable(void)
-{
-    return ser_sd_transport_close();
-}
-

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/serialization/application/transport/ser_softdevice_handler.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_softdevice_handler.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_softdevice_handler.h
deleted file mode 100644
index da9bfb3..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/transport/ser_softdevice_handler.h
+++ /dev/null
@@ -1,52 +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.
- *
- */
-
-/**
- * @addtogroup ser_app Application side code
- * @ingroup ble_sdk_lib_serialization
- */
-
-/** @file
- *
- * @defgroup ser_softdevice_handler Serialization SoftDevice Handler
- * @{
- * @ingroup ser_app
- *
- * @brief   Serialization SoftDevice Handler on application side.
- *
- */
-#ifndef SER_SOFTDEVICE_HANDLER_H_
-#define SER_SOFTDEVICE_HANDLER_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for checking if there is any more events in the internal mailbox.
- *
- * @param[in] p_mailbox_length Pointer to mailbox length.
- *
- * @retval ::NRF_SUCCESS    Length succesfully obtained.
- * @retval ::NRF_ERROR_NULL Null pointer provided.
- */
-uint32_t sd_ble_evt_mailbox_length_get(uint32_t * p_mailbox_length);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_SOFTDEVICE_HANDLER_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/serialization/common/ble_serialization.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ble_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ble_serialization.c
deleted file mode 100644
index 953dddc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ble_serialization.c
+++ /dev/null
@@ -1,520 +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 "ble_serialization.h"
-#include "nrf_error.h"
-#include "app_util.h"
-#include <stddef.h>
-#include <string.h>
-
-uint32_t ser_ble_cmd_rsp_status_code_enc(uint8_t          op_code,
-                                         uint32_t         command_status,
-                                         uint8_t * const  p_buf,
-                                         uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-    uint32_t index = 0;
-
-    SER_ASSERT_LENGTH_LEQ(SER_CMD_RSP_HEADER_SIZE, *p_buf_len);
-
-    //Encode Op Code.
-    p_buf[index++] = op_code;
-
-    //Encode Status.
-    index     += uint32_encode(command_status, &(p_buf[index]));
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ser_ble_cmd_rsp_result_code_dec(uint8_t const * const p_buf,
-                                         uint32_t * const      p_pos,
-                                         uint32_t              packet_len,
-                                         uint8_t               op_code,
-                                         uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_pos);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    if (packet_len < SER_CMD_RSP_HEADER_SIZE)
-    {
-        return NRF_ERROR_DATA_SIZE;
-    }
-
-    if (p_buf[(*p_pos)] != op_code)
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-
-    *p_result_code = uint32_decode(&(p_buf[(*p_pos) + SER_CMD_RSP_STATUS_CODE_POS]));
-    *p_pos        += SER_CMD_RSP_HEADER_SIZE;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ser_ble_cmd_rsp_dec(uint8_t const * const p_buf,
-                             uint32_t              packet_len,
-                             uint8_t               op_code,
-                             uint32_t * const      p_result_code)
-{
-    uint32_t index       = 0;
-    uint32_t result_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, op_code,
-                                                           p_result_code);
-
-    if (result_code != NRF_SUCCESS)
-    {
-        return result_code;
-    }
-
-    if (index != packet_len)
-    {
-        return NRF_ERROR_DATA_SIZE;
-    }
-
-    return NRF_SUCCESS;
-}
-
-uint32_t uint32_t_enc(void const * const p_field,
-                      uint8_t * const    p_buf,
-                      uint32_t           buf_len,
-                      uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_field);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    uint32_t * p_uint32 = (uint32_t *)p_field;
-
-    SER_ASSERT_LENGTH_LEQ(4, buf_len - *p_index);
-
-    *p_index += uint32_encode(*p_uint32, &p_buf[*p_index]);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t uint32_t_dec(uint8_t const * const p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index,
-                      void *                p_field)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_field);
-
-    uint32_t * p_uint32 = (uint32_t *)p_field;
-
-    SER_ASSERT_LENGTH_LEQ(4, ((int32_t)buf_len - *p_index));
-
-    *p_uint32 = uint32_decode(&p_buf[*p_index]);
-    *p_index += 4;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t uint16_t_enc(const void * const p_field,
-                      uint8_t * const    p_buf,
-                      uint32_t           buf_len,
-                      uint32_t * const   p_index)
-{
-    uint16_t * p_u16 = (uint16_t *)p_field;
-
-    SER_ASSERT_LENGTH_LEQ(2, buf_len - *p_index);
-
-    *p_index += uint16_encode(*p_u16, &p_buf[*p_index]);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t uint16_t_dec(uint8_t const * const p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index,
-                      void *                p_field)
-{
-    uint16_t * p_u16 = (uint16_t *)p_field;
-
-    SER_ASSERT_LENGTH_LEQ(2, ((int32_t)buf_len - *p_index));
-
-    *p_u16    = uint16_decode(&p_buf[*p_index]);
-    *p_index += 2;
-
-    return NRF_SUCCESS;
-}
-
-void uint16_dec(uint8_t const * const p_buf,
-                uint32_t              buf_len,
-                uint32_t * const      index,
-                uint16_t * const      value)
-{
-    SER_ASSERT_VOID_RETURN(*index + 2 <= buf_len);
-    *value  = uint16_decode(&p_buf[*index]);
-    *index += 2;
-}
-
-uint32_t uint8_t_enc(const void * const p_field,
-                     uint8_t * const    p_buf,
-                     uint32_t           buf_len,
-                     uint32_t * const   p_index)
-{
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-
-    uint8_t * p_u8 = (uint8_t *)p_field;
-    p_buf[*p_index] = *p_u8;
-    *p_index       += 1;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t uint8_t_dec(uint8_t const * const p_buf,
-                     uint32_t              buf_len,
-                     uint32_t * const      p_index,
-                     void *                p_field)
-{
-    uint8_t * p_u8 = (uint8_t *)p_field;
-
-    SER_ASSERT_LENGTH_LEQ(1, ((int32_t)buf_len - *p_index));
-    *p_u8     = p_buf[*p_index];
-    *p_index += 1;
-
-    return NRF_SUCCESS;
-}
-
-void uint8_dec(uint8_t const * const p_buf,
-               uint32_t              buf_len,
-               uint32_t * const      index,
-               uint8_t * const       value)
-{
-    SER_ASSERT_VOID_RETURN(*index + 1 <= buf_len);
-    *value  = p_buf[*index];
-    *index += 1;
-}
-
-
-void int8_dec(uint8_t const * const p_buf,
-              uint32_t              buf_len,
-              uint32_t * const      index,
-              int8_t * const        value)
-{
-    SER_ASSERT_VOID_RETURN(*index + 1 <= buf_len);
-    *value  = p_buf[*index];
-    *index += 1;
-}
-
-uint32_t len8data_enc(uint8_t const * const p_data,
-                      uint8_t const         dlen,
-                      uint8_t * const       p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&dlen, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = buf_enc(p_data, dlen, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t len8data_dec(uint8_t const * const p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index,
-                      uint8_t * * const     pp_data,
-                      uint8_t * const       p_len)
-{
-    uint32_t err_code    = NRF_SUCCESS;
-    uint16_t out_buf_len = *p_len;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, p_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = buf_dec(p_buf, buf_len, p_index, pp_data, out_buf_len, *p_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t len16data_enc(uint8_t const * const p_data,
-                       uint16_t const        dlen,
-                       uint8_t * const       p_buf,
-                       uint32_t              buf_len,
-                       uint32_t * const      p_index)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&dlen, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = buf_enc(p_data, dlen, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t len16data_dec(uint8_t const * const p_buf,
-                       uint32_t              buf_len,
-                       uint32_t * const      p_index,
-                       uint8_t * * const     pp_data,
-                       uint16_t * const      p_dlen)
-{
-    uint32_t err_code    = NRF_SUCCESS;
-    uint16_t out_buf_len = *p_dlen;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, p_dlen);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = buf_dec(p_buf, buf_len, p_index, pp_data, out_buf_len, *p_dlen);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t count16_cond_data16_enc(uint16_t const * const p_data,
-                                 uint16_t const         count,
-                                 uint8_t * const        p_buf,
-                                 uint32_t               buf_len,
-                                 uint32_t * const       p_index)
-{
-    uint32_t i = 0;
-
-    SER_ASSERT_LENGTH_LEQ(3, ((int32_t)buf_len - *p_index));
-    *p_index += uint16_encode(count, &p_buf[*p_index]);
-
-    if (p_data)
-    {
-        SER_ASSERT_LENGTH_LEQ((int32_t)(2 * count + 1), ((int32_t)buf_len - (int32_t)*p_index));
-        p_buf[*p_index] = SER_FIELD_PRESENT;
-        *p_index       += 1;
-
-        //memcpy may fail in case of Endianness difference between application and connectivity processor
-        for (i = 0; i < count; i++)
-        {
-            *p_index += uint16_encode(p_data[i], &p_buf[*p_index]);
-        }
-    }
-    else
-    {
-        SER_ASSERT_LENGTH_LEQ((1), ((int32_t)buf_len - *p_index));
-        p_buf[*p_index] = SER_FIELD_NOT_PRESENT;
-        *p_index       += 1;
-    }
-
-    return NRF_SUCCESS;
-}
-
-uint32_t count16_cond_data16_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 uint16_t * * const    pp_data,
-                                 uint16_t * const      p_count)
-
-{
-    uint16_t count      = 0;
-    uint8_t  is_present = 0;
-    uint16_t i;
-
-    SER_ASSERT_NOT_NULL(p_count);
-    SER_ASSERT_NOT_NULL(pp_data);
-    SER_ASSERT_NOT_NULL(*pp_data);
-
-    SER_ASSERT_LENGTH_LEQ(3, ((int32_t)buf_len - (*p_index)));
-
-    uint16_dec(p_buf, buf_len, p_index, &count);
-
-    if (count > *p_count)
-    {
-        return NRF_ERROR_DATA_SIZE;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(count, *p_count);
-
-    uint8_dec(p_buf, buf_len, p_index, &is_present);
-
-    if (!is_present)
-    {
-        *pp_data = NULL;
-        return NRF_SUCCESS;
-    }
-    else
-    {
-        for (i = 0; i < count; i++ )
-        {
-            uint16_dec(p_buf, buf_len, p_index, &((&(**pp_data))[i]) );
-        }
-        *p_count = i;
-    }
-    return NRF_SUCCESS;
-}
-
-
-
-uint32_t cond_len16_cond_data_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  uint8_t * * const     pp_data,
-                                  uint16_t * * const    pp_len)
-{
-    SER_ASSERT_NOT_NULL(pp_len);
-    SER_ASSERT_NOT_NULL(*pp_len);
-    SER_ASSERT_NOT_NULL(pp_data);
-    SER_ASSERT_NOT_NULL(*pp_data);
-
-    SER_ASSERT_LENGTH_LEQ(2, ((int32_t)buf_len - (*p_index)));
-    uint8_t is_present = 0;
-
-    uint8_dec(p_buf, buf_len, p_index, &is_present);
-
-    if (!is_present)
-    {
-        *pp_len = NULL; //if length field is not present
-        (*p_index)++;   //then data can not be present
-        *pp_data = NULL;
-        return NRF_SUCCESS;
-    }
-    else
-    {
-        return len16data_dec(p_buf, buf_len, p_index, pp_data, *pp_len);
-    }
-}
-
-uint32_t op_status_enc(uint8_t          op_code,
-                       uint32_t         return_code,
-                       uint8_t * const  p_buff,
-                       uint32_t * const p_buff_len,
-                       uint32_t * const p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buff);
-    SER_ASSERT_NOT_NULL(p_buff_len);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_LENGTH_LEQ(SER_CMD_RSP_HEADER_SIZE, *p_buff_len - *p_index);
-
-    //Encode Op Code.
-    p_buff[(*p_index)++] = op_code;
-    //Encode Status.
-    *p_index += uint32_encode(return_code, &(p_buff[*p_index]));
-    //update size of used buffer
-    *p_buff_len = *p_index;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t op_status_cond_uint16_enc(uint8_t          op_code,
-                                   uint32_t         return_code,
-                                   uint16_t         value,
-                                   uint8_t * const  p_buff,
-                                   uint32_t * const p_buff_len,
-                                   uint32_t * const p_index)
-{
-    uint32_t status_code;
-    uint32_t init_buff_len = *p_buff_len;
-
-    status_code = op_status_enc(op_code, return_code, p_buff, p_buff_len, p_index);
-    SER_ASSERT(status_code == NRF_SUCCESS, status_code);
-
-    if (return_code == NRF_SUCCESS) //Add 16bit value when return_code is a success
-    {
-        *p_buff_len = init_buff_len; //restore original value - it has been modified by op_status_enc
-        status_code = uint16_t_enc(&value, p_buff, *p_buff_len, p_index);
-        *p_buff_len = *p_index;
-        SER_ASSERT(status_code == NRF_SUCCESS, status_code);
-    }
-
-    return status_code;
-}
-
-uint32_t buf_enc(uint8_t const * const p_data,
-                 uint16_t const        dlen,
-                 uint8_t * const       p_buf,
-                 uint32_t              buf_len,
-                 uint32_t * const      p_index)
-{
-    uint32_t err_code   = NRF_SUCCESS;
-    uint8_t  is_present = (p_data == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    err_code = uint8_t_enc(&is_present, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_data)
-    {
-        SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index));
-        memcpy(&p_buf[*p_index], p_data, dlen);
-        *p_index += dlen;
-    }
-
-    return err_code;
-}
-
-uint32_t buf_dec(uint8_t const * const p_buf,
-                 uint32_t              buf_len,
-                 uint32_t * const      p_index,
-                 uint8_t * * const     pp_data,
-                 uint16_t              data_len,
-                 uint16_t              dlen)
-{
-    uint8_t is_present = 0;
-
-    SER_ASSERT_LENGTH_LEQ(1, ((int32_t)buf_len - *p_index));
-    uint8_dec(p_buf, buf_len, p_index, &is_present);
-
-    if (is_present == SER_FIELD_PRESENT)
-    {
-        SER_ASSERT_NOT_NULL(pp_data);
-        SER_ASSERT_NOT_NULL(*pp_data);
-        SER_ASSERT_LENGTH_LEQ(dlen, data_len);
-        SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index));
-        memcpy(*pp_data, &p_buf[*p_index], dlen);
-        *p_index += dlen;
-    }
-    else
-    {
-        if (pp_data)
-        {
-            *pp_data = NULL;
-        }
-    }
-    return NRF_SUCCESS;
-}
-
-uint32_t uint8_vector_enc(uint8_t const * const p_data,
-                        uint16_t const        dlen,
-                        uint8_t * const       p_buf,
-                        uint32_t              buf_len,
-                        uint32_t * const      p_index)
-{
-
-    SER_ASSERT_NOT_NULL(p_data);
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index));
-    memcpy(&p_buf[*p_index], p_data, dlen);
-    *p_index += dlen;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t uint8_vector_dec(uint8_t const * const p_buf,
-                 uint32_t              buf_len,
-                 uint32_t * const      p_index,
-                 uint8_t *  const      p_data,
-                 uint16_t              dlen)
-{
-    SER_ASSERT_NOT_NULL(p_data);
-    SER_ASSERT_LENGTH_LEQ(dlen, ((int32_t)buf_len - *p_index));
-    memcpy(p_data, &p_buf[*p_index], dlen);
-    *p_index += dlen;
-
-    return NRF_SUCCESS;
-}
-


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

Posted by cc...@apache.org.
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/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h
deleted file mode 100644
index 7b3f9b0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_debug_app.h
+++ /dev/null
@@ -1,170 +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.
- *
- */
-
-#ifndef SER_PHY_DEBUG_APP_H__
-#define SER_PHY_DEBUG_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef SER_PHY_DEBUG_APP_ENABLE
-
-#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_READY(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_API_CALL(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE(data)
-#define DEBUG_EVT_SPI_MASTER_PHY_TX_PKT_SENT(data)
-#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_DROPPED(data)
-#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_RECEIVED(data)
-#define DEBUG_EVT_SPI_MASTER_PHY_BUF_REQUEST(data)
-
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(data)
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(data)
-
-#else
-#include <stdint.h>
-
-//Low level hardware events
-typedef enum
-{
-    SPI_MASTER_RAW_READY,
-    SPI_MASTER_RAW_REQUEST,
-    SPI_MASTER_RAW_XFER_DONE,
-    SPI_MASTER_RAW_API_CALL,
-    SPI_MASTER_RAW_READY_EDGE,
-    SPI_MASTER_RAW_REQUEST_EDGE,
-    SPI_MASTER_RAW_XFER_STARTED,
-    SPI_MASTER_RAW_XFER_GUARDED,
-    SPI_MASTER_RAW_XFER_PASSED,
-    SPI_MASTER_RAW_XFER_ABORTED,
-    SPI_MASTER_RAW_XFER_RESTARTED,
-    SPI_MASTER_PHY_TX_PKT_SENT,
-    SPI_MASTER_PHY_BUF_REQUEST,
-    SPI_MASTER_PHY_RX_PKT_RECEIVED,
-    SPI_MASTER_PHY_RX_PKT_DROPPED,
-    SPI_MASTER_EVT_MAX
-} spi_master_raw_evt_type_t;
-
-
-//Low level hardware event definition
-typedef struct
-{
-    spi_master_raw_evt_type_t  evt;
-    uint32_t                   data;
-} spi_master_raw_evt_t;
-
-typedef void (*spi_master_raw_callback_t)(spi_master_raw_evt_t event);
-
-void debug_init(spi_master_raw_callback_t spi_master_raw_evt_callback);
-
-void debug_evt(spi_master_raw_evt_type_t evt, uint32_t data);
-
-
-#define DEBUG_EVT(evt, data)    \
-do {                            \
-    debug_evt(evt, data);       \
-} while(0);
-
-
-#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST(data)          \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_REQUEST, data);            \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_RAW_READY(data)            \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_READY, data);              \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(data)        \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_XFER_DONE, data);          \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_RAW_API_CALL(data)         \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_API_CALL, data);           \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE(data)       \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_READY_EDGE, data);         \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE(data)     \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_REQUEST_EDGE, data);       \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_PHY_TX_PKT_SENT(data)      \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_PHY_TX_PKT_SENT, data);        \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_DROPPED(data)   \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_PHY_RX_PKT_DROPPED, data);     \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_RECEIVED(data)  \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_PHY_RX_PKT_RECEIVED, data);    \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_MASTER_PHY_BUF_REQUEST(data)      \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_PHY_BUF_REQUEST, data);        \
-} while (0);
-
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(data)     \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_XFER_GUARDED, data);       \
-} while (0);
-
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(data)      \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_XFER_PASSED, data);        \
-} while (0);
-
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(data)     \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_XFER_ABORTED, data);       \
-} while (0);
-
-#define DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(data)   \
-do {                                                    \
-    DEBUG_EVT(SPI_MASTER_RAW_XFER_RESTARTED, data);     \
-} while (0);
-
-
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //SER_PHY_DEBUG_APP_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/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h
deleted file mode 100644
index 68ac6eb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_debug_conn.h
+++ /dev/null
@@ -1,138 +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.
- *
- */
-
-#ifndef SER_PHY_DEBUG_CONN_H__
-#define SER_PHY_DEBUG_CONN_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef SER_PHY_DEBUG_CONN_ENABLE
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(data);
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(data);
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(data);
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(data);
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_CLEARED(data);
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_BUF_REQUEST(data);
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_RECEIVED(data);
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_DROPPED(data);
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_SENT(data);
-
-#else
-
-#include <stdint.h>
-
-// low level hardware event types
-typedef enum
-{
-    SPI_SLAVE_RAW_BUFFERS_SET,
-    SPI_SLAVE_RAW_RX_XFER_DONE,
-    SPI_SLAVE_RAW_TX_XFER_DONE,
-    SPI_SLAVE_RAW_REQ_SET,
-    SPI_SLAVE_RAW_REQ_CLEARED,
-    SPI_SLAVE_PHY_BUF_REQUEST,
-    SPI_SLAVE_PHY_PKT_SENT,
-    SPI_SLAVE_PHY_PKT_RECEIVED,
-    SPI_SLAVE_PHY_PKT_DROPPED,
-    SPI_SLAVE_RAW_EVT_TYPE_MAX
-} spi_slave_raw_evt_type_t;
-
-// low level hardware event definition
-typedef struct
-{
-    spi_slave_raw_evt_type_t  evt_type;
-    uint32_t                  data;
-} spi_slave_raw_evt_t;
-
-typedef void (*spi_slave_raw_callback_t)(spi_slave_raw_evt_t event);
-
-void debug_init(spi_slave_raw_callback_t spi_slave_raw_evt_callback);
-
-void debug_evt(spi_slave_raw_evt_type_t evt_type, uint32_t data);
-
-#define DEBUG_EVT(evt, data)    \
-do {                            \
-    debug_evt(evt, data);       \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(data)  \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_RAW_RX_XFER_DONE, data);    \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(data)  \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_RAW_TX_XFER_DONE, data);    \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(data)   \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_RAW_BUFFERS_SET, data);     \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(data)       \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_RAW_REQ_SET, data);         \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_RAW_REQ_CLEARED(data)   \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_RAW_REQ_CLEARED, data);     \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_BUF_REQUEST(data)   \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_PHY_BUF_REQUEST, data);     \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_RECEIVED(data)  \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_PHY_PKT_RECEIVED, data);    \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_DROPPED(data)   \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_PHY_PKT_DROPPED, data);     \
-} while (0);
-
-
-#define DEBUG_EVT_SPI_SLAVE_PHY_PKT_SENT(data)      \
-do {                                                \
-    DEBUG_EVT(SPI_SLAVE_PHY_PKT_SENT, data);        \
-} while (0);
-
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //SER_PHY_DEBUG_CONN_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/serialization/common/transport/ser_phy/ser_phy.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy.c
deleted file mode 100644
index 3de07b1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy.c
+++ /dev/null
@@ -1,61 +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.
- *
- */
-
-#include "ser_phy.h"
-#include "app_error.h"
-
-
-__weak uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    /* A function stub. Function should be implemented according to ser_phy.h API. */
-    APP_ERROR_CHECK_BOOL(false);
-
-    return NRF_SUCCESS;
-}
-
-__weak uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    /* A function stub. Function should be implemented according to ser_phy.h API. */
-    APP_ERROR_CHECK_BOOL(false);
-
-    return NRF_SUCCESS;
-}
-
-__weak uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    /* A function stub. Function should be implemented according to ser_phy.h API. */
-    APP_ERROR_CHECK_BOOL(false);
-
-    return NRF_SUCCESS;
-}
-
-__weak void ser_phy_close(void)
-{
-    /* A function stub. Function should be implemented according to ser_phy.h API. */
-    APP_ERROR_CHECK_BOOL(false);
-}
-
-
-__weak void ser_phy_interrupts_enable(void)
-{
-    /* A function stub. Function should be implemented according to ser_phy.h API. */
-    APP_ERROR_CHECK_BOOL(false);
-}
-
-
-__weak void ser_phy_interrupts_disable(void)
-{
-    /* A function stub. Function should be implemented according to ser_phy.h API. */
-    APP_ERROR_CHECK_BOOL(false);
-}
-
-

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/serialization/common/transport/ser_phy/ser_phy.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy.h
deleted file mode 100644
index ad127ec..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy.h
+++ /dev/null
@@ -1,264 +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 ser_phy Serialization PHY
- * @{
- * @ingroup ble_sdk_lib_serialization
- *
- * @brief   PHY layer layer for serialization.
- *
- * @details This file contains declarations of functions and definitions of data structures and
- *          identifiers (typedef enum) used as API of the serialization PHY layer.
- *
- * \par Rationale
- * Each specific PHY layer (SPI, I2C, UART, low power UART etc.) should provide the same API. This
- * allows the layer above (the HAL Transport layer) which is responsible for controlling the PHY
- * layer, memory management, crc, retransmission etc. to be hardware independent.
- *
- *
- * \par Interlayer communication and control
- * The PHY layer is controlled by the HAL Transport layer by calling functions declared in this
- * file.
- * The PHY layer communicates events to the HAL Transport layer by calling a callback function.
- * A handler to this function is passed in the @ref ser_phy_open function. This callback function
- * should be called with parameter of type @ref ser_phy_evt_t  filled accordingly to an event to be
- * passed. Types of supported events are defined in @ref ser_phy_evt_type_t.
- * For example to pass an event indicating that RX packet has been successfully received first a
- * struct of type @ref ser_phy_evt_t has to be filled:
- * ser_phy_evt_t phy_evt;
- * phy_evt.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
- * phy_evt.evt_params.rx_pkt_received.p_buffer = (pointer to the RX buffer);
- * phy_evt.evt_params.rx_pkt_received.num_of_bytes = (number of received bytes);
- * and then the callback function has to be called:
- * events_handler(phy_evt);
- * All functions declared in this file are obligatory to implement. Some events specified in the
- * @ref ser_phy_evt_type_t are optional to implement.
- *
- * \par Transmitting a packet
- * Each PHY layer is responsible for adding the PHY header to a packet to be sent. This header
- * shall consists of 16-bit field carrying the packet length (the uint16_encode function defined in
- * app_util.h should be used to ensure endianness independence). A pointer to a packet to be sent
- * and a length of the packet are parameters of the @ref ser_phy_tx_pkt_send function. When a packet
- * has been transmitted an event of type @ref SER_PHY_EVT_TX_PKT_SENT should be emitted.
- *
- * \image html ser_phy_transport_tx.png "TX - interlayer communication"
- *
- *
- * \par Receiving a packet
- * The PHY layer should be able to store only the PHY header (16-bit field carrying the packet
- * length). After the PHY header has been received the transmission shall be halted and the PHY
- * layer has to sent a request to the HAL Transport layer for a memory to store a packet - an event
- * of type @ref SER_PHY_EVT_RX_BUF_REQUEST with event parameters defined in
- * @ref ser_phy_evt_rx_buf_request_params_t (the uint16_decode function defined in app_util.h should
- * be used for header decoding to ensure endianness independence). The transmission should be
- * resumed when @ref ser_phy_rx_buf_set function has been called.
- *
- * When @ref ser_phy_rx_buf_set function parameter is equal to NULL it means that there is not
- * enough memory to store the packet, however the packet shall be received to dummy location to
- * ensure continuous communication. After receiving has finished an event of type
- * @ref SER_PHY_EVT_RX_PKT_DROPPED shall be generated.
- *
- * \image html ser_phy_transport_rx_dropped.png "RX dropping - interlayer communication"
- *
- * When @ref ser_phy_rx_buf_set function parameter is different from NULL the packet should be
- * received to a buffer pointed by it. After receiving has finished an event of type
- * @ref SER_PHY_EVT_RX_PKT_RECEIVED shall be generated with event parameters defined in
- * @ref ser_phy_evt_rx_pkt_received_params_t.
- *
- * \image html ser_phy_transport_rx_received.png "RX - interlayer communication"
- *
- *
- * \par PHY layer errors
- * PHY layer errors can be signaled by an event of type @ref SER_PHY_EVT_RX_OVERFLOW_ERROR or
- * @ref SER_PHY_EVT_TX_OVERREAD_ERROR or @ref SER_PHY_EVT_HW_ERROR with event parameters defined in
- * @ref ser_phy_evt_hw_error_params_t.
- *
- */
-
-#ifndef SER_PHY_H__
-#define SER_PHY_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Serialization PHY module events types. */
-typedef enum
-{
-    SER_PHY_EVT_TX_PKT_SENT = 0,   /**< Obligatory to implement. An event indicating that TX packet
-                                    *   has been transmitted. */
-    SER_PHY_EVT_RX_BUF_REQUEST,    /**< Obligatory to implement. An event indicating that phy layer
-                                    *   needs a buffer for RX packet. A PHY flow should be blocked
-                                    *   until @ref ser_phy_rx_buf_set function is called. */
-    SER_PHY_EVT_RX_PKT_RECEIVED,   /**< Obligatory to implement. An event indicating that RX packet
-                                    *   has been successfully received. */
-    SER_PHY_EVT_RX_PKT_DROPPED,    /**< Obligatory to implement. An event indicating that RX packet
-                                    *   receiving has been finished but packet was discarded because
-                                    *   it was longer than available buffer. */
-
-    SER_PHY_EVT_RX_OVERFLOW_ERROR, /**< Optional to implement. An event indicating that more
-                                    *   information has been transmitted than phy module could
-                                    *   handle. */
-    SER_PHY_EVT_TX_OVERREAD_ERROR, /**< Optional to implement. An event indicating that phy module
-                                    *   was forced to transmit more information than possessed. */
-    SER_PHY_EVT_HW_ERROR,          /**< Optional to implement. An event indicating a hardware error
-                                    *   in phy module.  */
-    SER_PHY_EVT_TYPE_MAX           /**< Enumeration upper bound. */
-} ser_phy_evt_type_t;
-
-
-/**@brief A struct containing parameters of the event of type @ref SER_PHY_EVT_RX_BUF_REQUEST. */
-typedef struct
-{
-    uint16_t num_of_bytes;  /**< Length of a buffer in octets that layer above PHY module should
-                             *   deliver to enable PHY module to receive packet. */
-} ser_phy_evt_rx_buf_request_params_t;
-
-
-/**@brief A struct containing parameters of the event of type @ref SER_PHY_EVT_RX_PKT_RECEIVED. */
-typedef struct
-{
-    uint8_t * p_buffer;     /**< Pointer to a buffer containing received packet. */
-    uint16_t  num_of_bytes; /**< Length of a received packet in octets. */
-} ser_phy_evt_rx_pkt_received_params_t;
-
-
-/**@brief A struct containing parameters of the event of type @ref SER_PHY_EVT_HW_ERROR. */
-typedef struct
-{
-    uint32_t error_code; /**< Hardware error code - specific for any microcontroller. */
-    uint8_t * p_buffer;  /**< Pointer to the buffer that was processed when error occured. */
-} ser_phy_evt_hw_error_params_t;
-
-
-/**@brief A struct containing events from a Serialization PHY module.
- *
- * @note  Some events do not have parameters, then whole information is contained in the evt_type.
- */
-typedef struct 
-{
-    ser_phy_evt_type_t                       evt_type; /**< Type of an event. */
-
-    union  /**< Union alternative identified by evt_type in enclosing struct. */
-    {
-        /** Parameters of the event of type @ref SER_PHY_EVT_RX_BUF_REQUEST. */
-        ser_phy_evt_rx_buf_request_params_t  rx_buf_request;
-        /** Parameters of the event of type @ref SER_PHY_EVT_RX_PKT_RECEIVED. */
-        ser_phy_evt_rx_pkt_received_params_t rx_pkt_received;
-        /** Parameters of the event of type @ref SER_PHY_EVT_HW_ERROR. */
-        ser_phy_evt_hw_error_params_t        hw_error;
-    } evt_params;
-} ser_phy_evt_t;
-
-
-/**@brief A type of generic callback function handler to be used by all PHY module events.
- *
- * @param[in] event    Serialization PHY module event.
- */
-typedef void (*ser_phy_events_handler_t)(ser_phy_evt_t event);
-
-
-/**@brief A function for opening and initializing a PHY module.
- *
- * @note  The function initializes hardware and internal module states, and registers callback
- *        function to be used by all PHY module events.
- *
- * @warning If the function has been already called, the function @ref ser_phy_close has to be
- *          called before ser_phy_open can be called again.
- *
- * @param[in] events_handler    Generic callback function handler to be used by all PHY module
- *                              events.
- *
- * @retval NRF_SUCCESS                Operation success.
- * @retval NRF_ERROR_INVALID_STATE    Operation failure. The function has been already called.
- *                                    To call it again the function @ref ser_phy_close has to be
- *                                    called previously.
- * @retval NRF_ERROR_NULL             Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_PARAM    Operation failure. Hardware initialization parameters are not
- *                                    supported.
- */
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler);
-
-
-/**@brief A function for transmitting a packet.
- *
- * @note  The function adds a packet pointed by p_buffer parameter to a transmission queue and
- *        schedules generating an event of type @ref SER_PHY_EVT_TX_PKT_SENT upon transmission
- *        completion.
- *
- * @param[in] p_buffer        Pointer to a buffer to transmit.
- * @param[in] num_of_bytes    Number of octets to transmit. Must be more than 0.
- *
- * @retval NRF_SUCCESS                Operation success. Packet was added to the transmission queue
- *                                    and event will be send upon transmission completion.
- * @retval NRF_ERROR_NULL             Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_PARAM    Operation failure. The num_of_bytes parameter equal to 0.
- * @retval NRF_ERROR_BUSY             Operation failure. Transmitting of a packet in progress.
- */
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes);
-
-
-/**@brief A function for setting an RX buffer and enabling reception of data (the PHY flow).
- *
- * @note The function has to be called as a response to an event of type
- *       @ref SER_PHY_EVT_RX_BUF_REQUEST. The function sets an RX buffer and enables reception of
- *       data (enables the PHY flow).
- *       Size of a buffer pointed by the p_buffer parameter should be at least equal to the
- *       num_of_bytes parameter passed within the event (@ref ser_phy_evt_rx_buf_request_params_t)
- *       or p_buffer should be equal to NULL if there is not enough memory.
- *       When p_buffer is different from NULL and num_of_bytes octets has been received an event of
- *       type @ref SER_PHY_EVT_RX_PKT_RECEIVED is generated
- *       (@ref ser_phy_evt_rx_pkt_received_params_t).
- *       When p_buffer is equal to NULL data are received to dummy location to ensure continuous
- *       communication. Then if num_of_bytes octets has been received an event of type
- *       @ref SER_PHY_EVT_RX_PKT_DROPPED is generated.
- *
- * @param[in] p_buffer    Pointer to an RX buffer where to receive.
- *
- * @retval NRF_SUCCESS                Operation success.
- * @retval NRF_ERROR_INVALID_STATE    Operation failure. A buffer was set without request.
- */
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer);
-
-
-/**@brief A function for closing a PHY module.
- *
- * @note  The function disables hardware, resets internal module states and unregisters events
- *        callback function.
- */
-void ser_phy_close(void);
-
-
-/**@brief A function for enabling a PHY module interrupts.
- *
- * @note  The function enables all interrupts that are used by a PHY module (and only those).
- */
-void ser_phy_interrupts_enable(void);
-
-
-/**@brief A function for disabling a PHY module interrupts.
- *
- * @note  The function disables all interrupts that are used by a PHY module (and only those).
- */
-void ser_phy_interrupts_disable(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_PHY_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/serialization/common/transport/ser_phy/ser_phy_hci.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci.c
deleted file mode 100644
index a83d92e..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci.c
+++ /dev/null
@@ -1,1668 +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.
- *
- */
-
-#include <stddef.h>
-#include <string.h>
-
-#include "app_error.h"
-#include "app_util.h"
-#include "app_util_platform.h"
-#include "app_timer.h"
-#include "app_mailbox.h"
-#include "ser_phy.h"
-#include "ser_phy_hci.h"
-#include "crc16.h"
-#include "nrf_soc.h"
-#include "ser_config.h"
-#include "ser_phy_debug_comm.h"
-// hide globals for release version, expose for debug version
-#if defined(SER_PHY_HCI_DEBUG_ENABLE)
-#define _static
-#else
-#define _static static
-#endif
-
-#define PKT_HDR_SIZE            4 /**< Packet header size in number of bytes. */
-#define PKT_CRC_SIZE            2 /**< Packet CRC size in number of bytes. */
-#define MAX_PACKET_SIZE_IN_BITS (11uL * \
-                                 (SER_HAL_TRANSPORT_MAX_PKT_SIZE + PKT_HDR_SIZE + PKT_CRC_SIZE))
-#define BAUD_TIME_us            (1000000uL / SER_PHY_UART_BAUDRATE_VAL)
-
-#define TX_EVT_QUEUE_SIZE            16
-#define RX_EVT_QUEUE_SIZE            16
-#define PKT_TYPE_VENDOR_SPECIFIC     14                                                /**< Packet type vendor specific. */
-#define PKT_TYPE_ACK                 0                                                 /**< Packet type acknowledgement. */
-#define PKT_TYPE_LINK_CONTROL        15                                                /**< Packet type link control. */
-#define DATA_INTEGRITY_MASK          (1 << 6)                                          /**< Mask for data integrity bit in the packet header. */
-#define RELIABLE_PKT_MASK            (1 << 7)                                          /**< Mask for reliable packet bit in the packet header. */
-#define INITIAL_ACK_NUMBER_EXPECTED  0                                                 /**< Initial acknowledge number expected. */
-#define INITIAL_SEQ_NUMBER           INITIAL_ACK_NUMBER_EXPECTED                       /**< Initial acknowledge number transmitted. */
-#define INVALID_PKT_TYPE             0xFFFFFFFFu                                       /**< Internal invalid packet type value. */
-#define MAX_TRANSMISSION_TIME_ms     (MAX_PACKET_SIZE_IN_BITS * BAUD_TIME_us / 1000uL) /**< Max transmission time of a single application packet over UART in units of mseconds. */
-#define RETRANSMISSION_TIMEOUT_IN_ms (10uL * MAX_TRANSMISSION_TIME_ms)                 /**< Retransmission timeout for application packet in units of mseconds. */
-
-#ifdef  HCI_LINK_CONTROL
-#define HCI_PKT_SYNC        0x7E01u                                                    /**< Link Control Packet: type SYNC */
-#define HCI_PKT_SYNC_RSP    0x7D02u                                                    /**< Link Control Packet: type SYNC RESPONSE */
-#define HCI_PKT_CONFIG      0xFC03u                                                    /**< Link Control Packet: type CONFIG */
-#define HCI_PKT_CONFIG_RSP  0x7B04u                                                    /**< Link Control Packet: type CONFIG RESPONSE */
-#define HCI_CONFIG_FIELD    0x11u                                                      /**< Configuration field of CONFIG and CONFIG_RSP packet */
-#define HCI_PKT_SYNC_SIZE   6u                                                         /**< Size of SYNC and SYNC_RSP packet */
-#define HCI_PKT_CONFIG_SIZE 7u                                                         /**< Size of CONFIG and CONFIG_RSP packet */
-#define HCI_LINK_CONTROL_PKT_INVALID 0xFFFFu                                           /**< Size of CONFIG and CONFIG_RSP packet */
-#define HCI_LINK_CONTROL_TIMEOUT     1u                                                /**< Default link control timeout. */
-#endif  /* HCI_LINK_CONTROL */
-
-#ifndef APP_TIMER_PRESCALER
-#define APP_TIMER_PRESCALER 0
-#endif
-
-#define RETRANSMISSION_TIMEOUT_IN_TICKS (APP_TIMER_TICKS(RETRANSMISSION_TIMEOUT_IN_ms, \
-                                                         APP_TIMER_PRESCALER)) /**< Retransmission timeout for application packet in units of timer ticks. */
-#define MAX_RETRY_COUNT                 5                                      /**< Max retransmission retry count for application packets. */
-
-#if   (defined(HCI_TIMER0))
-#define HCI_TIMER            NRF_TIMER0
-#define HCI_TIMER_IRQn       TIMER0_IRQn
-#define HCI_TIMER_IRQHandler TIMER0_IRQHandler
-#elif (defined(HCI_TIMER1))
-#define HCI_TIMER            NRF_TIMER1
-#define HCI_TIMER_IRQn       TIMER1_IRQn
-#define HCI_TIMER_IRQHandler TIMER1_IRQHandler
-#elif (defined(HCI_TIMER2))
-#define HCI_TIMER            NRF_TIMER2
-#define HCI_TIMER_IRQn       TIMER2_IRQn
-#define HCI_TIMER_IRQHandler TIMER2_IRQHandler
-#else
-#define HCI_APP_TIMER
-#endif
-
-
-/**@brief States of the hci event driven state machine. */
-typedef enum
-{
-    HCI_TX_STATE_DISABLE,
-    HCI_TX_STATE_SEND,
-    HCI_TX_STATE_WAIT_FOR_FIRST_TX_END,
-    HCI_TX_STATE_WAIT_FOR_ACK_OR_TX_END,
-    HCI_TX_STATE_WAIT_FOR_ACK,
-    HCI_TX_STATE_WAIT_FOR_TX_END
-} hci_tx_fsm_state_t;
-
-typedef enum
-{
-    HCI_RX_STATE_DISABLE,
-    HCI_RX_STATE_RECEIVE,
-    HCI_RX_STATE_WAIT_FOR_MEM,
-    HCI_RX_STATE_WAIT_FOR_SLIP_ACK_END,
-    HCI_RX_STATE_WAIT_FOR_SLIP_NACK_END,
-} hci_rx_fsm_state_t;
-
-typedef enum
-{
-    HCI_EVT_TIMEOUT,
-} hci_timer_evt_type_t;
-
-typedef enum
-{
-    HCI_SER_PHY_TX_REQUEST,
-    HCI_SER_PHY_RX_BUF_GRANTED,
-    HCI_SER_PHY_EVT_GEN_ENABLE,
-    HCI_SER_PHY_EVT_GEN_DISABLE
-} ser_phy_int_evt_type_t;
-
-typedef enum
-{
-    HCI_SER_PHY_EVT,
-    HCI_SLIP_EVT,
-    HCI_TIMER_EVT,
-} hci_evt_source_t;
-
-#ifdef HCI_LINK_CONTROL
-typedef enum
-{
-    HCI_MODE_DISABLE,
-    HCI_MODE_UNINITIALIZED,
-    HCI_MODE_INITIALIZED,
-    HCI_MODE_ACTIVE,
-} hci_mode_t;
-#endif /*HCI_LINK_CONTROL */
-
-typedef struct
-{
-    hci_timer_evt_type_t evt_type; /**< Type of an event. */
-} hci_timer_evt_t;
-
-typedef struct
-{
-    ser_phy_int_evt_type_t evt_type; /**< Type of an event. */
-} ser_phy_int_evt_t;
-
-typedef struct
-{
-    hci_evt_source_t evt_source; /**< source of an event. */
-    union
-    {
-        ser_phy_int_evt_t      ser_phy_evt;      /**< ser_phy event. */
-        ser_phy_hci_slip_evt_t ser_phy_slip_evt; /**< ser_phy_hci event. */
-        hci_timer_evt_t        timer_evt;        /**< timer event. */
-    } evt;
-} hci_evt_t;
-
-_static uint8_t m_tx_packet_header[PKT_HDR_SIZE];
-_static uint8_t m_tx_packet_crc[PKT_CRC_SIZE];
-_static uint8_t m_tx_ack_packet[PKT_HDR_SIZE];
-#ifdef HCI_LINK_CONTROL
-_static uint8_t m_tx_link_control_header[PKT_HDR_SIZE];
-_static uint8_t m_tx_link_control_payload[HCI_PKT_CONFIG_SIZE - PKT_HDR_SIZE];
-#endif /* HCI_LINK_CONTROL */
-
-_static uint32_t m_packet_ack_number; // Sequence number counter of the packet expected to be received
-_static uint32_t m_packet_seq_number; // Sequence number counter of the transmitted packet for which acknowledgement packet is waited for
-
-
-_static uint32_t m_tx_retry_count;
-
-
-// _static uint32_t m_tx_retx_counter = 0;
-// _static uint32_t m_rx_drop_counter = 0;
-
-
-APP_MAILBOX_DEF(tx_evt_queue, TX_EVT_QUEUE_SIZE, sizeof(hci_evt_t));
-APP_MAILBOX_DEF(rx_evt_queue, RX_EVT_QUEUE_SIZE, sizeof(hci_evt_t));
-
-_static hci_tx_fsm_state_t m_hci_tx_fsm_state = HCI_TX_STATE_DISABLE;
-_static hci_rx_fsm_state_t m_hci_rx_fsm_state = HCI_RX_STATE_DISABLE;
-
-#ifdef HCI_LINK_CONTROL
-_static hci_mode_t m_hci_mode                  = HCI_MODE_DISABLE;
-_static uint16_t   m_hci_link_control_next_pkt = HCI_PKT_SYNC;
-_static bool       m_hci_other_side_active     = false;
-#endif /* HCI_LINK_CONTROL */
-
-#ifdef HCI_APP_TIMER
-APP_TIMER_DEF(m_app_timer_id);
-#endif
-
-_static bool m_tx_fsm_idle_flag = true;
-_static bool m_rx_fsm_idle_flag = true;
-
-_static bool m_buffer_reqested_flag = false;
-
-_static uint8_t * m_p_rx_buffer = NULL;
-_static uint16_t  m_rx_packet_length;
-_static uint8_t * m_p_rx_packet;
-_static uint8_t * m_p_tx_payload = NULL;
-_static uint16_t  m_tx_payload_length;
-
-_static ser_phy_events_handler_t m_ser_phy_callback = NULL;
-
-static void hci_tx_event_handler(hci_evt_t * p_event);
-static void hci_rx_event_handler(hci_evt_t * p_event);
-#ifdef HCI_LINK_CONTROL
-static void hci_link_control_event_handler(hci_evt_t * p_event);
-#endif /* HCI_LINK_CONTROL */
-
-_static bool m_hci_timer_enabled_flag  = true;
-_static bool m_hci_timout_pending_flag = false;
-_static bool m_hci_global_enable_flag  = true;
-
-#define ser_phy_hci_assert(cond) APP_ERROR_CHECK_BOOL(cond)
-
-static void hci_signal_timeout_event(void)
-{
-    hci_evt_t event;
-
-    event.evt_source             = HCI_TIMER_EVT;
-    event.evt.timer_evt.evt_type = HCI_EVT_TIMEOUT;
-    DEBUG_EVT_TIMEOUT(0);
-
-#ifndef HCI_LINK_CONTROL
-    hci_tx_event_handler(&event);
-#else
-    hci_link_control_event_handler(&event);
-    if((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active)
-    {
-        hci_tx_event_handler(&event);
-    }
-#endif /* HCI_LINK_CONTROL */
-}
-
-
-#ifndef HCI_APP_TIMER
-
-void HCI_TIMER_IRQHandler(void)
-{
-
-    if ((HCI_TIMER->EVENTS_COMPARE[1] == 1) && (HCI_TIMER->INTENSET & TIMER_INTENSET_COMPARE1_Msk))
-    {
-        HCI_TIMER->EVENTS_COMPARE[1] = 0;
-        HCI_TIMER->TASKS_CLEAR       = 1;
-
-        if (m_hci_timer_enabled_flag)
-        {
-            hci_signal_timeout_event();
-        }
-        else
-        {
-            m_hci_timout_pending_flag = true;
-        }
-    }
-}
-
-
-static void hci_timeout_setup(uint32_t count)
-{
-
-    uint32_t time_msec;
-
-    if (count)
-    {
-        HCI_TIMER->INTENCLR          = TIMER_INTENCLR_COMPARE1_Msk;
-        time_msec                    = count * RETRANSMISSION_TIMEOUT_IN_ms;
-        HCI_TIMER->CC[1]             = time_msec * 31;
-        HCI_TIMER->CC[1]            += time_msec / 4;
-        HCI_TIMER->TASKS_CLEAR       = 1; // < Clear TIMER
-        HCI_TIMER->EVENTS_COMPARE[1] = 0;
-        HCI_TIMER->TASKS_START       = 1; // < Start TIMER
-        HCI_TIMER->INTENSET          = TIMER_INTENSET_COMPARE1_Msk;
-    }
-    else
-    {
-        HCI_TIMER->INTENCLR   = TIMER_INTENCLR_COMPARE1_Msk;
-        HCI_TIMER->TASKS_STOP = 1; // < Start TIMER
-    }
-}
-
-
-#else
-
-_static bool     m_hci_timer_setup_flag = false;
-_static uint32_t m_hci_timer_counter    = 0;
-_static uint32_t m_hci_timer_setup;
-
-static void hci_timeout_setup(uint32_t count)
-{
-    m_hci_timer_setup      = count;
-    m_hci_timer_setup_flag = true;
-}
-
-
-static void hci_timeout_handler(void * p_context)
-{
-
-    if (m_hci_timer_setup_flag)
-    {
-        m_hci_timer_setup_flag = false;
-        m_hci_timer_counter    = m_hci_timer_setup; /* for 1 it will be always more than 1 tick - jitter is up to 1 tick */
-    }
-    else if ( m_hci_timer_counter )
-    {
-        m_hci_timer_counter--;
-
-        if (m_hci_timer_counter == 0)
-        {
-            if (m_hci_timer_enabled_flag)
-            {
-                hci_signal_timeout_event();
-            }
-            else
-            {
-                m_hci_timout_pending_flag = true;
-            }
-        }
-    }
-    return;
-}
-
-
-#endif
-
-
-/**@brief Function for validating a received packet.
- *
- * @param[in] p_buffer Pointer to the packet data.
- * @param[in] length   Length of packet data in bytes.
- *
- * @return true if received packet is valid, false in other case.
- */
-static bool is_rx_pkt_valid(const uint8_t * p_buffer, uint32_t length)
-{
-    // Executed packet filtering algorithm order:
-    // - verify packet overall length
-    // - verify data integrity bit set
-    // - verify reliable packet bit set
-    // - verify supported packet type
-    // - verify header checksum
-    // - verify payload length field
-    // - verify CRC
-    if (length <= PKT_HDR_SIZE)
-    {
-        return false;
-    }
-
-    if (!(p_buffer[0] & DATA_INTEGRITY_MASK))
-    {
-        return false;
-    }
-
-    if (!(p_buffer[0] & RELIABLE_PKT_MASK))
-    {
-        return false;
-    }
-
-    if ((p_buffer[1] & 0x0Fu) != PKT_TYPE_VENDOR_SPECIFIC)
-    {
-        return false;
-    }
-
-    const uint32_t expected_checksum =
-        ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu;
-
-    if (expected_checksum != 0)
-    {
-        return false;
-    }
-
-    const uint16_t crc_calculated = crc16_compute(p_buffer, (length - PKT_CRC_SIZE), NULL);
-    const uint16_t crc_received   = uint16_decode(&p_buffer[length - PKT_CRC_SIZE]);
-
-    if (crc_calculated != crc_received)
-    {
-        return false;
-    }
-
-    return true;
-}
-
-
-/**@brief Function for getting the sequence number of the next reliable packet expected.
- *
- * @return sequence number of the next reliable packet expected.
- */
-static __INLINE uint8_t packet_ack_get(void)
-{
-    return (uint8_t) m_packet_ack_number;
-}
-
-
-/**@brief Function for getting the sequence number of a reliable TX packet for which peer protocol
- * entity acknowledgment is pending.
- *
- * @return sequence number of a reliable TX packet for which peer protocol entity acknowledgement
- * is pending.
- */
-static __INLINE uint8_t packet_seq_get(void)
-{
-    return m_packet_seq_number;
-}
-
-
-static __INLINE uint8_t packet_seq_nmbr_extract(const uint8_t * p_buffer)
-{
-    return (p_buffer[0] & 0x07u);
-}
-
-
-/**@brief Function for constructing 1st byte of the packet header of the packet to be transmitted.
- *
- * @return 1st byte of the packet header of the packet to be transmitted
- */
-static __INLINE uint8_t tx_packet_byte_zero_construct(void)
-{
-    const uint32_t value = DATA_INTEGRITY_MASK | RELIABLE_PKT_MASK |
-                           (packet_ack_get() << 3u) | packet_seq_get();
-
-    return (uint8_t) value;
-}
-
-
-/**@brief Function for calculating a packet header checksum.
- *
- * @param[in] p_hdr Pointer to the packet header.
- *
- * @return          Calculated checksum.
- */
-static __INLINE uint8_t header_checksum_calculate(const uint8_t * p_hdr)
-{
-    // @note: no pointer validation check needed as already checked by calling function.
-    uint32_t checksum;
-
-    checksum  = p_hdr[0];
-    checksum += p_hdr[1];
-    checksum += p_hdr[2];
-    checksum &= 0xFFu;
-    checksum  = (~checksum + 1u);
-
-    return (uint8_t)checksum;
-}
-
-
-/**@brief Function for getting the expected ACK number.
- *
- * @return expected ACK number.
- */
-static __INLINE uint8_t expected_ack_number_get(void)
-{
-    uint8_t seq_nmbr = packet_seq_get();
-
-    ++seq_nmbr;
-    seq_nmbr &= 0x07u;
-
-    return seq_nmbr;
-}
-
-
-/**@brief Function for getting the expected ACK number.
- *
- * @return next expected ACK number.
- */
-
-static __INLINE uint8_t next_expected_ack_number_get(void)
-{
-    uint8_t seq_nmbr = expected_ack_number_get();
-
-    ++seq_nmbr;
-    seq_nmbr &= 0x07u;
-
-    return seq_nmbr;
-}
-
-
-/**@brief Function for processing a received acknowledgement packet.
- *
- * Verifies does the received acknowledgement packet has the expected acknowledgement number and
- * that the header checksum is correct.
- *
- * @param[in] p_buffer Pointer to the packet data.
- *
- * @return true if valid acknowledgement packet received.
- */
-
-static bool rx_ack_pkt_valid(const uint8_t * p_buffer)
-{
-    // @note: no pointer validation check needed as allready checked by calling function.
-
-    // Verify header checksum.
-    const uint32_t expected_checksum =
-        ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu;
-
-    if (expected_checksum != 0)
-    {
-        return false;
-    }
-
-    const uint8_t ack_number = (p_buffer[0] >> 3u) & 0x07u;
-
-    // Verify expected acknowledgment number.
-    return ( (ack_number == expected_ack_number_get()) ||
-             (ack_number == next_expected_ack_number_get()) );
-}
-
-
-/**@brief Function for decoding a packet type field.
- *
- * @param[in] p_buffer Pointer to the packet data.
- * @param[in] length   Length of packet data in bytes.
- *
- * @return Packet type field or INVALID_PKT_TYPE in case of decode error.
- */
-
-static uint32_t packet_type_decode(const uint8_t * p_buffer, uint32_t length)
-{
-    // @note: no pointer validation check needed as allready checked by calling function.
-    uint32_t return_value;
-
-    if (length >= PKT_HDR_SIZE)
-    {
-        return_value = (p_buffer[1] & 0x0Fu);
-    }
-    else
-    {
-        return_value = INVALID_PKT_TYPE;
-    }
-
-    return return_value;
-}
-
-#ifdef HCI_LINK_CONTROL
-/**@brief Function for decoding a link control packet.
- *
- * @param[in] p_buffer    Pointer to the packet data.
- * @param[in] length      Length of packet data in bytes.
- *
- * @return Link Control Packet Type if decoding successful, HCI_LINK_CONTROL_PKT_INVALID otherwise.
- */
-static uint16_t link_control_packet_decode(const uint8_t * p_buffer, uint32_t length)
-{
-    // @note: no pointer validation check needed as allready checked by calling function.
-    uint16_t packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-
- // Executed link control packet filtering algorithm order:
-    // - verify packet overall length
-    // - verify data integrity bit cleared
-    // - verify reliable packet bit cleared
-    // - verify header checksum
-    // - verify payload: length and value
-
-    if (length < HCI_PKT_SYNC_SIZE)
-    {
-        packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-    }
-
-    packet_type = p_buffer[PKT_HDR_SIZE] | (p_buffer[PKT_HDR_SIZE + 1] << 8u);
-
-    if ((p_buffer[0] & DATA_INTEGRITY_MASK) || (p_buffer[0] & RELIABLE_PKT_MASK))
-    {
-        packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-    }
-
-    const uint32_t expected_checksum =
-        ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu;
-
-    if (expected_checksum != 0)
-    {
-        packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-    }
-
-    // This is a CONFIG or CONFIG_RSP packet
-    if ((packet_type == HCI_PKT_CONFIG) || (packet_type == HCI_PKT_CONFIG_RSP))
-    {
-        if (length != HCI_PKT_CONFIG_SIZE)
-        {
-            packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-        }
-        // Verify configuration field (0x11):
-        // - Sliding Window Size       == 1,
-        // - OOF Flow Control          == 0,
-        // - Data Integrity Check Type == 1,
-        // - Version Number            == 0
-        if (p_buffer[HCI_PKT_CONFIG_SIZE - 1] != HCI_CONFIG_FIELD)
-        {
-            packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-        }
-    }
-    // This is a SYNC or SYNC_RSP packet
-    else if ((packet_type == HCI_PKT_SYNC) || (packet_type == HCI_PKT_SYNC_RSP))
-    {
-        if (length != HCI_PKT_SYNC_SIZE)
-        {
-            packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-        }
-    }
-    else
-    {
-        packet_type = HCI_LINK_CONTROL_PKT_INVALID;
-    }
-
-    return packet_type;
-}
-#endif /* HCI_LINK_CONTROL */
-
-/**@brief Function for writing an acknowledgment packet for transmission.
- */
-
-static void ack_transmit(void)
-{
-    uint32_t err_code;
-    // TX ACK packet format:
-    // - Unreliable Packet type
-    // - Payload Length set to 0
-    // - Sequence Number set to 0
-    // - Header checksum calculated
-    // - Acknowledge Number set correctly
-    m_tx_ack_packet[0] = (packet_ack_get() << 3u);
-    m_tx_ack_packet[1] = 0;
-    m_tx_ack_packet[2] = 0;
-    m_tx_ack_packet[3] = header_checksum_calculate(m_tx_ack_packet);
-
-    ser_phy_hci_pkt_params_t pkt_header;
-
-    pkt_header.p_buffer     = m_tx_ack_packet;
-    pkt_header.num_of_bytes = PKT_HDR_SIZE;
-    DEBUG_EVT_SLIP_ACK_TX(0);
-    err_code = ser_phy_hci_slip_tx_pkt_send(&pkt_header, NULL, NULL);
-    ser_phy_hci_assert(err_code == NRF_SUCCESS);
-
-    return;
-}
-
-
-static void ser_phy_event_callback(ser_phy_evt_t event)
-{
-    if (m_ser_phy_callback)
-    {
-        m_ser_phy_callback(event);
-    }
-
-    return;
-}
-
-
-static void memory_request_callback(uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(0);
-
-    event.evt_type                               = SER_PHY_EVT_RX_BUF_REQUEST;
-    event.evt_params.rx_buf_request.num_of_bytes = size;
-    ser_phy_event_callback(event);
-}
-
-
-static void packet_received_callback(uint8_t * pBuffer, uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-    event.evt_params.rx_pkt_received.num_of_bytes = size;
-    event.evt_params.rx_pkt_received.p_buffer     = pBuffer;
-    ser_phy_event_callback(event);
-}
-
-
-static void packet_dropped_callback(void)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-    ser_phy_event_callback(event);
-}
-
-
-static void packet_transmitted_callback(void)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(0);
-
-    event.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    ser_phy_event_callback(event);
-}
-
-
-static void error_callback(void)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_TX_ERROR(0);
-
-    event.evt_type = SER_PHY_EVT_HW_ERROR;
-    event.evt_params.hw_error.p_buffer = m_p_tx_payload;
-    ser_phy_event_callback(event);
-}
-
-
-static void hci_slip_event_handler(ser_phy_hci_slip_evt_t * p_event)
-{
-    hci_evt_t event;
-    uint32_t  packet_type;
-    uint32_t  err_code;
-
-    if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT )
-    {
-        DEBUG_EVT_SLIP_PACKET_TXED(0);
-        event.evt_source                    = HCI_SLIP_EVT;
-        event.evt.ser_phy_slip_evt.evt_type = p_event->evt_type;
-#ifndef HCI_LINK_CONTROL
-        hci_tx_event_handler(&event);
-#else
-        if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active)
-        {
-            hci_tx_event_handler(&event);
-        }
-#endif /*HCI_LINK_CONTROL*/
-    }
-    else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT )
-    {
-        DEBUG_EVT_SLIP_ACK_TXED(0);
-        event.evt_source                    = HCI_SLIP_EVT;
-        event.evt.ser_phy_slip_evt.evt_type = p_event->evt_type;
-#ifndef HCI_LINK_CONTROL
-        hci_rx_event_handler(&event);
-#else
-        if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active)
-        {
-            hci_rx_event_handler(&event);
-        }
-#endif /* HCI_LINK_CONTROL */
-    }
-
-    else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED )
-    {
-        event.evt_source = HCI_SLIP_EVT;
-        event.evt.ser_phy_slip_evt.evt_type                         = p_event->evt_type;
-        event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer =
-            p_event->evt_params.received_pkt.p_buffer;
-        event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes =
-            p_event->evt_params.received_pkt.num_of_bytes;
-        ser_phy_hci_assert(event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer != NULL);
-        ser_phy_hci_assert(event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes != 0);
-        packet_type = packet_type_decode(
-            event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer,
-            event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes);
-
-        if (packet_type == PKT_TYPE_ACK )
-        {
-            DEBUG_EVT_SLIP_ACK_RXED(0);
-#ifndef HCI_LINK_CONTROL
-            hci_tx_event_handler(&event);
-#else
-            if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active)
-            {
-                hci_tx_event_handler(&event);
-            }
-            else
-            {
-                err_code = ser_phy_hci_slip_rx_buf_free(
-                      event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-            }
-#endif /* HCI_LINK_CONTROL */
-        }
-        else if ( packet_type == PKT_TYPE_VENDOR_SPECIFIC )
-        {
-            if (is_rx_pkt_valid(event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer,
-                                event.evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes))
-            {
-                DEBUG_EVT_SLIP_PACKET_RXED(0);
-#ifndef HCI_LINK_CONTROL
-                hci_rx_event_handler(&event);
-#else
-                if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active)
-                {
-                    hci_rx_event_handler(&event);
-                }
-                else
-                {
-                    err_code = ser_phy_hci_slip_rx_buf_free(
-                                    event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-                }
-#endif /* HCI_LINK_CONTROL */
-            }
-            else
-            {
-                err_code = ser_phy_hci_slip_rx_buf_free(
-                    event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-                ser_phy_hci_assert(err_code == NRF_SUCCESS);
-                /* throw assert when in debug mode*/
-                DEBUG_EVT_SLIP_ERR_RXED(0);
-            }
-        }
-#ifdef HCI_LINK_CONTROL
-        else if (packet_type == PKT_TYPE_LINK_CONTROL)
-        {
-            hci_link_control_event_handler(&event);
-        }
-#endif /* HCI_LINK_CONTROL */
-        else
-        {
-            err_code = ser_phy_hci_slip_rx_buf_free(
-                event.evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-            ser_phy_hci_assert(err_code == NRF_SUCCESS);
-            /* throw assert when in debug mode*/
-            DEBUG_EVT_SLIP_ERR_RXED(0);
-        }
-    }
-
-}
-
-
-static void hci_pkt_send(void)
-{
-    uint32_t err_code;
-
-    m_tx_packet_header[0] = tx_packet_byte_zero_construct();
-    uint16_t type_and_length_fields = ((m_tx_payload_length << 4u) | PKT_TYPE_VENDOR_SPECIFIC);
-    (void)uint16_encode(type_and_length_fields, &(m_tx_packet_header[1]));
-    m_tx_packet_header[3] = header_checksum_calculate(m_tx_packet_header);
-    uint16_t crc = crc16_compute(m_tx_packet_header, PKT_HDR_SIZE, NULL);
-    crc = crc16_compute(m_p_tx_payload, m_tx_payload_length, &crc);
-    (void)uint16_encode(crc, m_tx_packet_crc);
-
-    ser_phy_hci_pkt_params_t pkt_header;
-    ser_phy_hci_pkt_params_t pkt_payload;
-    ser_phy_hci_pkt_params_t pkt_crc;
-
-    pkt_header.p_buffer      = m_tx_packet_header;
-    pkt_header.num_of_bytes  = PKT_HDR_SIZE;
-    pkt_payload.p_buffer     = m_p_tx_payload;
-    pkt_payload.num_of_bytes = m_tx_payload_length;
-    pkt_crc.p_buffer         = m_tx_packet_crc;
-    pkt_crc.num_of_bytes     = PKT_CRC_SIZE;
-    DEBUG_EVT_SLIP_PACKET_TX(0);
-    err_code = ser_phy_hci_slip_tx_pkt_send(&pkt_header, &pkt_payload, &pkt_crc);
-    ser_phy_hci_assert(err_code == NRF_SUCCESS);
-
-    return;
-}
-
-#ifdef HCI_LINK_CONTROL
-static void hci_link_control_pkt_send(void)
-{
-    uint32_t err_code;
-    uint16_t link_control_payload_len = 0;
-
-    m_tx_link_control_header[0] = 0x00u;       // SEQ, ACK, DI and RP are set to 0 for link control
-    if (m_hci_link_control_next_pkt == HCI_PKT_SYNC)
-    {
-        link_control_payload_len = HCI_PKT_SYNC_SIZE - PKT_HDR_SIZE;
-        (void)uint16_encode(HCI_PKT_SYNC, m_tx_link_control_payload);
-    }
-    else if (m_hci_link_control_next_pkt == HCI_PKT_SYNC_RSP)
-    {
-        link_control_payload_len = HCI_PKT_SYNC_SIZE - PKT_HDR_SIZE;
-        (void)uint16_encode(HCI_PKT_SYNC_RSP, m_tx_link_control_payload);
-    }
-    else if (m_hci_link_control_next_pkt == HCI_PKT_CONFIG)
-    {
-        link_control_payload_len = HCI_PKT_CONFIG_SIZE - PKT_HDR_SIZE;
-        (void)uint16_encode(HCI_PKT_CONFIG, m_tx_link_control_payload);
-        m_tx_link_control_payload[2] = HCI_CONFIG_FIELD;
-    }
-    else if (m_hci_link_control_next_pkt == HCI_PKT_CONFIG_RSP)
-    {
-        link_control_payload_len = HCI_PKT_CONFIG_SIZE - PKT_HDR_SIZE;
-        (void)uint16_encode(HCI_PKT_CONFIG_RSP, m_tx_link_control_payload);
-        m_tx_link_control_payload[2] = HCI_CONFIG_FIELD;
-    }
-    uint16_t type_and_length_fields = ((link_control_payload_len << 4u) | PKT_TYPE_LINK_CONTROL);
-    (void)uint16_encode(type_and_length_fields, &(m_tx_link_control_header[1]));
-    m_tx_link_control_header[3] = header_checksum_calculate(m_tx_link_control_header);
-
-    ser_phy_hci_pkt_params_t pkt_header;
-    ser_phy_hci_pkt_params_t pkt_payload;
-    ser_phy_hci_pkt_params_t pkt_crc;
-
-    pkt_header.p_buffer      = m_tx_link_control_header;
-    pkt_header.num_of_bytes  = PKT_HDR_SIZE;
-    pkt_payload.p_buffer     = m_tx_link_control_payload;
-    pkt_payload.num_of_bytes = link_control_payload_len;
-    pkt_crc.p_buffer         = NULL;
-    pkt_crc.num_of_bytes     = 0;
-    DEBUG_EVT_SLIP_PACKET_TX(0);
-    err_code = ser_phy_hci_slip_tx_pkt_send(&pkt_header, &pkt_payload, &pkt_crc);
-    ser_phy_hci_assert(err_code == NRF_SUCCESS);
-
-    return;
-}
-#endif /* HCI_LINK_CONTROL */
-
-static void hci_pkt_sent_upcall(void)
-{
-    m_packet_seq_number++; // incoming ACK is valid, increment SEQ
-    m_packet_seq_number &= 0x07u;
-    m_p_tx_payload       = NULL;
-    packet_transmitted_callback();
-
-    return;
-}
-
-
-static void hci_release_ack_buffer(hci_evt_t * p_event)
-{
-    uint32_t err_code;
-
-    err_code = ser_phy_hci_slip_rx_buf_free(
-        p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-    ser_phy_hci_assert(err_code == NRF_SUCCESS);
-
-    return;
-}
-
-
-static void hci_process_orphaned_ack(hci_evt_t * p_event)
-{
-    hci_release_ack_buffer(p_event);
-    return;
-}
-
-/* main tx fsm   */
-static void hci_tx_fsm_event_process(hci_evt_t * p_event)
-{
-
-    switch (m_hci_tx_fsm_state)
-    {
-        case HCI_TX_STATE_SEND:
-
-            if ((p_event->evt_source == HCI_SER_PHY_EVT) &&
-                (p_event->evt.ser_phy_evt.evt_type == HCI_SER_PHY_TX_REQUEST))
-            {
-                hci_pkt_send();
-                hci_timeout_setup(0);
-                m_tx_retry_count   = MAX_RETRY_COUNT;
-                m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_FIRST_TX_END;
-            }
-            else if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                     (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED))
-            {
-                hci_process_orphaned_ack(p_event);
-            }
-
-            break;
-
-        case HCI_TX_STATE_WAIT_FOR_FIRST_TX_END:
-
-            if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT))
-            {
-                hci_timeout_setup(1);
-                m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_ACK;
-            }
-            else if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                     (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED))
-            {
-                hci_process_orphaned_ack(p_event);
-            }
-            break;
-
-        case HCI_TX_STATE_WAIT_FOR_ACK_OR_TX_END:
-
-            if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT))
-            {
-                hci_timeout_setup(1);
-                m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_ACK;
-            }
-            else if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                     (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED))
-            {
-                if (rx_ack_pkt_valid(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer))
-                {
-                    hci_timeout_setup(0);
-                    m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_TX_END;
-                }
-                hci_release_ack_buffer(p_event);
-            }
-            break;
-
-        case HCI_TX_STATE_WAIT_FOR_ACK:
-
-            if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED))
-            {
-                if (rx_ack_pkt_valid(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer))
-                {
-                    hci_timeout_setup(0);
-                    hci_pkt_sent_upcall();
-                    m_hci_tx_fsm_state = HCI_TX_STATE_SEND;
-                }
-                hci_release_ack_buffer(p_event);
-            }
-            else if (p_event->evt_source == HCI_TIMER_EVT)
-            {
-                m_tx_retry_count--;
-                // m_tx_retx_counter++; // global retransmissions counter
-                if (m_tx_retry_count)
-                {
-                    hci_pkt_send();
-                    DEBUG_HCI_RETX(0);
-                    m_hci_tx_fsm_state = HCI_TX_STATE_WAIT_FOR_ACK_OR_TX_END;
-                }
-                else
-                {
-                    error_callback();
-                    m_hci_tx_fsm_state = HCI_TX_STATE_SEND;
-                }
-            }
-            break;
-
-        case HCI_TX_STATE_WAIT_FOR_TX_END:
-
-            if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT))
-            {
-                hci_pkt_sent_upcall();
-                m_hci_tx_fsm_state = HCI_TX_STATE_SEND;
-            }
-            else if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                     (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED))
-            {
-                hci_process_orphaned_ack(p_event);
-            }
-
-            break;
-
-#ifdef HCI_LINK_CONTROL
-        case HCI_TX_STATE_DISABLE:
-            /* This case should not happen if HCI is in ACTIVE mode */
-            if (m_hci_mode == HCI_MODE_ACTIVE)
-            {
-                ser_phy_hci_assert(false);
-            }
-            break;
-#endif /* HCI_LINK_CONTROL */
-
-        default:
-            ser_phy_hci_assert(false);
-            break;
-    }
-}
-
-
-static void hci_mem_request(hci_evt_t * p_event)
-{
-    m_buffer_reqested_flag = true;
-    m_p_rx_packet          = p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer;
-    m_rx_packet_length     = p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes;
-    ser_phy_hci_assert(m_rx_packet_length > PKT_HDR_SIZE + PKT_CRC_SIZE);
-    memory_request_callback(m_rx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE);
-    return;
-}
-
-
-static void hci_inc_ack()
-{
-    m_packet_ack_number++;
-    m_packet_ack_number &= 0x07u;
-}
-
-
-static void hci_rx_fsm_event_process(hci_evt_t * p_event)
-{
-    switch (m_hci_rx_fsm_state)
-    {
-        case HCI_RX_STATE_RECEIVE:
-
-            if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED))
-            {
-                /* type and crc and check sum are validated by slip handler */
-                uint8_t rx_seq_number = packet_seq_nmbr_extract(
-                    p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-
-                if (packet_ack_get() == rx_seq_number)
-                {
-                    hci_mem_request(p_event);
-                    m_hci_rx_fsm_state = HCI_RX_STATE_WAIT_FOR_MEM;
-                }
-                else
-                {
-                    // m_rx_drop_counter++;
-                    m_hci_rx_fsm_state = HCI_RX_STATE_WAIT_FOR_SLIP_NACK_END;
-                    (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet); // and drop a packet
-                    ack_transmit();                                     // send NACK with valid ACK
-                }
-            }
-            break;
-
-        case HCI_RX_STATE_WAIT_FOR_MEM:
-
-            if ((p_event->evt_source == HCI_SER_PHY_EVT) &&
-                (p_event->evt.ser_phy_evt.evt_type == HCI_SER_PHY_RX_BUF_GRANTED))
-            {
-                if (m_p_rx_buffer)
-                {
-                    memcpy(m_p_rx_buffer,
-                           m_p_rx_packet + PKT_HDR_SIZE,
-                           m_rx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE);
-                    (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet);
-                }
-                m_hci_rx_fsm_state = HCI_RX_STATE_WAIT_FOR_SLIP_ACK_END;
-                hci_inc_ack(); // SEQ was valid for good packet, we will send incremented SEQ as ACK
-                ack_transmit();
-            }
-
-            break;
-
-        case HCI_RX_STATE_WAIT_FOR_SLIP_ACK_END:
-
-            if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT))
-            {
-
-                if (m_p_rx_buffer)
-                {
-                    packet_received_callback(m_p_rx_buffer,
-                                             m_rx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE);
-                }
-                else
-                {
-                    packet_dropped_callback();
-                }
-                m_hci_rx_fsm_state = HCI_RX_STATE_RECEIVE;
-            }
-            else if ((p_event->evt_source == HCI_SLIP_EVT) &&
-                    (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED))
-            {
-                (void) ser_phy_hci_slip_rx_buf_free(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-            }
-            break;
-
-        case HCI_RX_STATE_WAIT_FOR_SLIP_NACK_END:
-            if ((p_event->evt_source == HCI_SLIP_EVT) &&
-               (p_event->evt.ser_phy_slip_evt.evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT))
-            {
-               m_hci_rx_fsm_state = HCI_RX_STATE_RECEIVE;
-            }
-            else
-            {
-               (void) ser_phy_hci_slip_rx_buf_free(p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-            }
-            break;
-
-
-#ifdef HCI_LINK_CONTROL
-        case HCI_RX_STATE_DISABLE:
-            if (m_hci_mode == HCI_MODE_ACTIVE)
-            {
-                ser_phy_hci_assert(false);
-            }
-            break;
-#endif /* HCI_LINK_CONTROL */
-
-        default:
-            ser_phy_hci_assert(false);
-            break;
-    }
-}
-
-
-/* this function might be entered only via hci_tx_event_handler */
-static void hci_tx_fsm(void)
-{
-    hci_evt_t event;
-    uint32_t  err_code = NRF_SUCCESS;
-
-    while (err_code == NRF_SUCCESS)
-    {
-
-        CRITICAL_REGION_ENTER();
-        err_code = app_mailbox_get(&tx_evt_queue, &event);
-
-        if (err_code != NRF_SUCCESS)
-        {
-            m_tx_fsm_idle_flag = true;
-        }
-        CRITICAL_REGION_EXIT();
-
-        if (err_code == NRF_SUCCESS)
-        {
-            hci_tx_fsm_event_process(&event); /* this is the only entry to the TX_FSM */
-        }
-    }
-    return;
-}
-
-
-/* this function might be entered only via hci_rx_event_handler */
-static void hci_rx_fsm(void)
-{
-    hci_evt_t event;
-    uint32_t  err_code = NRF_SUCCESS;
-
-    while (err_code == NRF_SUCCESS)
-    {
-        CRITICAL_REGION_ENTER();
-        err_code = app_mailbox_get(&rx_evt_queue, &event);
-
-        if (err_code != NRF_SUCCESS)
-        {
-            m_rx_fsm_idle_flag = true;
-        }
-        CRITICAL_REGION_EXIT();
-
-        if (err_code == NRF_SUCCESS)
-        {
-            hci_rx_fsm_event_process(&event); /* this is the only entry to the RX_FSM */
-        }
-    }
-    return;
-}
-
-
-/* something might have been queued by API with disabled 'PHY-interrupts' */
-static void hci_tx_reschedule()
-{
-    bool     tx_exec_flag = false;
-    uint32_t tx_queue_length;
-
-    CRITICAL_REGION_ENTER();
-    tx_queue_length = app_mailbox_length_get(&tx_evt_queue);
-
-#ifndef HCI_LINK_CONTROL
-    if (m_tx_fsm_idle_flag && m_hci_global_enable_flag && tx_queue_length)
-#else
-    if (m_tx_fsm_idle_flag && m_hci_global_enable_flag && tx_queue_length && (m_hci_mode == HCI_MODE_ACTIVE))
-#endif /* HCI_LINK_CONTROL */
-    {
-        tx_exec_flag       = true;  // FSM should be activated
-        m_tx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted
-    }
-    CRITICAL_REGION_EXIT();
-
-    if (tx_exec_flag)
-    {
-        hci_tx_fsm();
-    }
-    return;
-}
-
-
-/* entry to TX state machine, might be called asynchronously from different contexts */
-/* Puts event into the TX event queue and execute if FSM was idle */
-static void hci_tx_event_handler(hci_evt_t * p_event)
-{
-    bool     tx_exec_flag = false;
-    uint32_t err_code;
-
-    CRITICAL_REGION_ENTER();
-    err_code = app_mailbox_put(&tx_evt_queue, p_event);
-    ser_phy_hci_assert(err_code == NRF_SUCCESS);
-
-    // CRITICAL_REGION_ENTER();
-    /* only one process can acquire tx_exec_flag */
-    if (m_tx_fsm_idle_flag && m_hci_global_enable_flag)
-    {
-        tx_exec_flag       = true;  // FSM should be activated
-        m_tx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted
-    }
-    CRITICAL_REGION_EXIT();
-
-    if (tx_exec_flag)
-    {
-        hci_tx_fsm();
-    }
-    return;
-}
-
-
-/* Something might have been queued by API with disabled 'PHY-interrupts' */
-static void hci_rx_reschedule()
-{
-    bool     rx_exec_flag = false;
-    uint32_t rx_queue_length;
-
-    CRITICAL_REGION_ENTER();
-    rx_queue_length = app_mailbox_length_get(&rx_evt_queue);
-
-#ifndef HCI_LINK_CONTROL
-    if (m_rx_fsm_idle_flag && m_hci_global_enable_flag && rx_queue_length)
-#else
-    if (m_rx_fsm_idle_flag && m_hci_global_enable_flag && rx_queue_length && (m_hci_mode == HCI_MODE_ACTIVE))
-#endif /* HCI_LINK_CONTROL */
-    {
-        rx_exec_flag       = true;  // FSM should be activated
-        m_rx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted
-    }
-    CRITICAL_REGION_EXIT();
-
-    if (rx_exec_flag)
-    {
-        hci_rx_fsm();
-    }
-
-}
-
-
-/* Entry to RX state machine, might be called asynchronously from different contexts */
-/* Puts event into the RX event queue and execute if FSM was idle */
-static void hci_rx_event_handler(hci_evt_t * p_event)
-{
-    bool     rx_exec_flag = false;
-    uint32_t err_code;
-
-    CRITICAL_REGION_ENTER();
-    err_code = app_mailbox_put(&rx_evt_queue, p_event);
-    ser_phy_hci_assert(err_code == NRF_SUCCESS);
-
-    /* only one process can acquire rx_exec_flag */
-    // CRITICAL_REGION_ENTER();
-    if (m_rx_fsm_idle_flag && m_hci_global_enable_flag)
-    {
-        rx_exec_flag       = true;  // FSM should be activated
-        m_rx_fsm_idle_flag = false; // FSM will be busy from now on till the queue is exhausted
-    }
-    CRITICAL_REGION_EXIT();
-
-    if (rx_exec_flag)
-    {
-        hci_rx_fsm();
-    }
-
-    return;
-}
-
-#ifdef HCI_LINK_CONTROL
-/* Link control event handler - used only for Link Control packets */
-/* This handler will be called only in 2 cases:
-   - when SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED event is received 
-   - when HCI_TIMER_EVT event is reveived */
-static void hci_link_control_event_handler(hci_evt_t * p_event)
-{
-    uint16_t pkt_type = HCI_LINK_CONTROL_PKT_INVALID;
-
-    switch(p_event->evt_source)
-    {
-        case HCI_SLIP_EVT:
-            pkt_type = link_control_packet_decode(
-                            p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer,
-                            p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.num_of_bytes);
-            /* Perform HCI mode transition if needed */
-            CRITICAL_REGION_ENTER();
-            switch (pkt_type)
-            {
-                case HCI_PKT_SYNC:
-                    m_hci_link_control_next_pkt = HCI_PKT_SYNC_RSP;
-                    /* Restart HCI communication if it was in ACTIVE mode */
-                    if (m_hci_mode == HCI_MODE_ACTIVE)
-                    {
-                        m_hci_mode          = HCI_MODE_UNINITIALIZED;
-                        m_packet_ack_number = INITIAL_ACK_NUMBER_EXPECTED;
-                        m_packet_seq_number = INITIAL_SEQ_NUMBER;
-                        m_hci_tx_fsm_state  = HCI_TX_STATE_DISABLE;
-                        m_hci_rx_fsm_state  = HCI_RX_STATE_DISABLE;
-                        m_hci_other_side_active = false;
-                    }
-                    hci_link_control_pkt_send();
-                    hci_timeout_setup(HCI_LINK_CONTROL_TIMEOUT); // Need to trigger transmitting SYNC messages
-                    break;
-                case HCI_PKT_SYNC_RSP:
-                    if (m_hci_mode == HCI_MODE_UNINITIALIZED)
-                    {
-                        m_hci_mode                  = HCI_MODE_INITIALIZED;
-                        m_hci_link_control_next_pkt = HCI_PKT_CONFIG;
-                    }
-                    break;
-                case HCI_PKT_CONFIG:
-                    if (m_hci_mode != HCI_MODE_UNINITIALIZED)
-                    {
-                        m_hci_link_control_next_pkt = HCI_PKT_CONFIG_RSP;
-                        hci_link_control_pkt_send();
-                        m_hci_other_side_active = true;
-                    }
-                    break;
-                case HCI_PKT_CONFIG_RSP:
-                    if (m_hci_mode == HCI_MODE_INITIALIZED)
-                    {
-                        m_hci_mode          = HCI_MODE_ACTIVE;
-                        m_hci_tx_fsm_state  = HCI_TX_STATE_SEND;
-                        m_hci_rx_fsm_state  = HCI_RX_STATE_RECEIVE;                        
-                    }
-                    break;
-            }
-            CRITICAL_REGION_EXIT();
-            (void) ser_phy_hci_slip_rx_buf_free(
-                p_event->evt.ser_phy_slip_evt.evt_params.received_pkt.p_buffer);
-            /* Kick the state machine so it can start process BLE packets */
-            if ((m_hci_mode == HCI_MODE_ACTIVE) && m_hci_other_side_active)
-            {
-                hci_tx_reschedule();
-                hci_rx_reschedule();
-            }
-            break;
-
-        case HCI_TIMER_EVT:
-            /* Send one of the Link Control packets if in Unintialized or Initialized state */
-            CRITICAL_REGION_ENTER();
-            switch (m_hci_mode)
-            {
-                case HCI_MODE_UNINITIALIZED:
-                    //send packet
-                    m_hci_link_control_next_pkt = HCI_PKT_SYNC;
-                    hci_link_control_pkt_send();
-                    hci_timeout_setup(HCI_LINK_CONTROL_TIMEOUT);
-                    break;
-                case HCI_MODE_INITIALIZED:
-                    m_hci_link_control_next_pkt = HCI_PKT_CONFIG;
-                    hci_link_control_pkt_send();
-                    hci_timeout_setup(HCI_LINK_CONTROL_TIMEOUT);
-                    break;
-                case HCI_MODE_ACTIVE:
-                case HCI_MODE_DISABLE:
-                default:
-                    // No implementation needed
-                    break;
-            }
-            CRITICAL_REGION_EXIT();
-            break;
-        case HCI_SER_PHY_EVT:
-        default:
-            // No implementation needed
-            break;
-    }
-}
-#endif /* HCI_LINK_CONTROL */
-
-/* ser_phy API function */
-void ser_phy_interrupts_enable(void)
-{
-    bool pending_timer_callback_flag = false;
-
-    CRITICAL_REGION_ENTER();
-    m_hci_timer_enabled_flag = true;
-
-    if (m_hci_timout_pending_flag)
-    {
-        m_hci_timout_pending_flag   = false;
-        pending_timer_callback_flag = true;
-    }
-    CRITICAL_REGION_EXIT();
-    // this is a workaround - scheduled SER_PHY EVENTS
-    m_hci_global_enable_flag = true;
-    hci_tx_reschedule();
-    hci_rx_reschedule();
-
-    if (pending_timer_callback_flag)
-    {
-        hci_signal_timeout_event();
-    }
-
-    return;
-}
-
-
-/* ser_phy API function */
-void ser_phy_interrupts_disable(void)
-{
-    CRITICAL_REGION_ENTER();
-    m_hci_timer_enabled_flag = false;
-    // transport calls PHY API with ser_phy_interrupts_disabled
-    m_hci_global_enable_flag = false;
-    CRITICAL_REGION_EXIT();
-}
-
-
-/* ser_phy API function */
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    uint32_t  status = NRF_SUCCESS;
-    hci_evt_t event;
-
-    if (m_buffer_reqested_flag)
-    {
-        m_buffer_reqested_flag         = false;
-        m_p_rx_buffer                  = p_buffer;
-        event.evt_source               = HCI_SER_PHY_EVT;
-        event.evt.ser_phy_evt.evt_type = HCI_SER_PHY_RX_BUF_GRANTED;
-        hci_rx_event_handler(&event);
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-    return status;
-}
-
-
-/* ser_phy API function */
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    uint32_t  status = NRF_SUCCESS;
-    hci_evt_t event;
-
-    if ( p_buffer == NULL || num_of_bytes == 0)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    if ( m_p_tx_payload == NULL)
-    {
-        m_tx_payload_length = num_of_bytes;
-        m_p_tx_payload      = (uint8_t *)p_buffer;
-        DEBUG_EVT_TX_REQ(0);
-        event.evt_source               = HCI_SER_PHY_EVT;
-        event.evt.ser_phy_evt.evt_type = HCI_SER_PHY_TX_REQUEST;
-        hci_tx_event_handler(&event);
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-
-    return status;
-}
-
-
-static uint32_t  hci_timer_init(void)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-#ifdef HCI_APP_TIMER
-
-    err_code = app_timer_create(&m_app_timer_id, APP_TIMER_MODE_REPEATED, hci_timeout_handler);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INTERNAL;
-    }
-
-    err_code = app_timer_start(m_app_timer_id, RETRANSMISSION_TIMEOUT_IN_TICKS, NULL);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INTERNAL;
-    }
-
-#else
-
-    // Configure TIMER for compare[1] event
-    HCI_TIMER->PRESCALER = 9;
-    HCI_TIMER->MODE      = TIMER_MODE_MODE_Timer;
-    HCI_TIMER->BITMODE   = TIMER_BITMODE_BITMODE_16Bit;
-
-    // Clear TIMER
-    HCI_TIMER->TASKS_CLEAR = 1;
-
-    // Enable interrupt
-    HCI_TIMER->INTENCLR = 0xFFFFFFFF;
-    HCI_TIMER->INTENSET = TIMER_INTENSET_COMPARE1_Enabled << TIMER_INTENSET_COMPARE1_Pos;
-
-    NVIC_ClearPendingIRQ(HCI_TIMER_IRQn);
-    NVIC_SetPriority(HCI_TIMER_IRQn, APP_IRQ_PRIORITY_HIGH);
-    NVIC_EnableIRQ(HCI_TIMER_IRQn);
-
-#endif
-
-    return err_code;
-
-}
-
-
-/* ser_phy API function */
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    uint32_t err_code;
-
-    if ((m_hci_tx_fsm_state != HCI_TX_STATE_DISABLE) || (m_hci_rx_fsm_state != HCI_RX_STATE_DISABLE))
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    err_code = hci_timer_init();
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INTERNAL;
-    }
-
-    err_code = app_mailbox_create(&tx_evt_queue);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INTERNAL;
-    }
-
-    err_code = app_mailbox_create(&rx_evt_queue);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INTERNAL;
-    }
-
-    err_code = ser_phy_hci_slip_open(hci_slip_event_handler);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    if (err_code == NRF_SUCCESS)
-    {
-        m_packet_ack_number = INITIAL_ACK_NUMBER_EXPECTED;
-        m_packet_seq_number = INITIAL_SEQ_NUMBER;
-        m_ser_phy_callback  = events_handler;
-
-#ifndef HCI_LINK_CONTROL
-        m_hci_tx_fsm_state  = HCI_TX_STATE_SEND;
-        m_hci_rx_fsm_state  = HCI_RX_STATE_RECEIVE;
-#else
-        hci_timeout_setup(HCI_LINK_CONTROL_TIMEOUT);// Trigger sending SYNC messages
-        m_hci_mode              = HCI_MODE_UNINITIALIZED;
-        m_hci_other_side_active = false;
-#endif /*HCI_LINK_CONTROL*/
-    }
-    return err_code;
-}
-
-static uint32_t hci_timer_close(void)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-#ifdef HCI_APP_TIMER
-    err_code = app_timer_stop(m_app_timer_id);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INTERNAL;
-    }
-#endif
-
-    return err_code;
-}
-
-/* ser_phy API function */
-void ser_phy_close(void)
-{
-    m_ser_phy_callback = NULL;
-    ser_phy_hci_slip_close();
-    m_hci_tx_fsm_state = HCI_TX_STATE_DISABLE;
-    m_hci_rx_fsm_state = HCI_RX_STATE_DISABLE;
-
-#ifdef HCI_LINK_CONTROL
-    m_hci_mode         = HCI_MODE_DISABLE;
-#endif /* HCI_LINK_CONTROL */
-
-    uint32_t err_code = hci_timer_close();
-    ser_phy_hci_assert(err_code == NRF_SUCCESS);
-}
-
-

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/serialization/common/transport/ser_phy/ser_phy_hci.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci.h
deleted file mode 100644
index 7e2321c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci.h
+++ /dev/null
@@ -1,155 +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 ser_phy_hci HCI Serialization PHY
- * @{
- * @ingroup ble_sdk_lib_serialization
- *
- * @brief   HCI PHY layer for serialization.
- *
- * @details This file contains declarations of functions and definitions of data structures and
- *          identifiers (typedef enum) used as API of the serialization HCI PHY layer.
- *
- *
- */
-
-#ifndef SER_PHY_HCI_H__
-#define SER_PHY_HCI_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Serialization PHY HCI module events types. */
-typedef enum
-{
-    SER_PHY_HCI_SLIP_EVT_PKT_SENT = 0,      /**< An event indicating that packet has been transmitted. */
-    SER_PHY_HCI_SLIP_EVT_ACK_SENT,      	/**< An event indicating that ack packet has been transmitted. */
-    SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED,      /**< An event indicating that packet has been received.  */
-    SER_PHY_HCI_SLIP_EVT_HW_ERROR,          /**< An event indicating a hardware error in PHY HCI module.  */
-    SER_PHY_HCI_SLIP_EVT_TYPE_MAX           /**< Enumeration upper bound. */
-} ser_phy_hci_slip_evt_type_t;
-
-/**@brief A struct representing a PHY HCI packet. */
-typedef struct
-{
-    uint8_t * p_buffer;     /**< Pointer to a buffer containing a packet. */
-    uint16_t  num_of_bytes; /**< Length of a packet in octets. */
-} ser_phy_hci_pkt_params_t;
-
-
-/**@brief A struct containing parameters of the event of type @ref SER_PHY_HCI_SLIP_EVT_HW_ERROR. */
-typedef struct
-{
-    uint32_t error_code; /**< Hardware error code - specific for any microcontroller. */
-} ser_phy_hci_evt_hw_error_params_t;
-
-
-/**@brief A struct containing events from a Serialization PHY module.
- *
- * @note  Some events do not have parameters, then whole information is contained in the evt_type.
- */
-typedef struct 
-{
-    ser_phy_hci_slip_evt_type_t            evt_type; /**< Type of an event. */
-    union  /**< Union alternative identified by evt_type in enclosing struct. */
-    {
-        /** Parameters of the event of type @ref SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED. */
-        ser_phy_hci_pkt_params_t             received_pkt;
-        /** Parameters of the event of type @ref SER_PHY_HCI_SLIP_EVT_HW_ERROR. */
-        ser_phy_hci_evt_hw_error_params_t    hw_error;
-    } evt_params;
-} ser_phy_hci_slip_evt_t;
-
-
-/**@brief A type of generic callback function handler to be used by all PHY HCI events.
- *
- * @param[in] event    Serialization PHY HCI module event.
- */
-typedef void (*ser_phy_hci_slip_event_handler_t)(ser_phy_hci_slip_evt_t *p_event);
-
-/**@brief A function for opening and initializing a HCI SLIP PHY module.
- *
- * @note  The function initializes hardware and internal module states, and registers callback
- *        function to be used by all PHY HCI module events.
- *
- * @warning If the function has been already called, the function @ref ser_phy_hci_slip_close has to be
- *          called before ser_phy_hci_slip_open can be called again.
- *
- * @param[in] events_handler    Generic callback function handler to be used by all PHY HCI module
- *                              events.
- *
- * @retval NRF_SUCCESS                Operation success.
- * @retval NRF_ERROR_INVALID_STATE    Operation failure. The function has been already called.
- *                                    To call it again the function @ref ser_phy_hci_slip_close has to
- *                                    be called previously.
- * @retval NRF_ERROR_NULL             Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_PARAM    Operation failure. Hardware initialization parameters are not
- *                                    supported.
- */
-uint32_t ser_phy_hci_slip_open(ser_phy_hci_slip_event_handler_t events_handler);
-
-
-/**@brief A function for transmitting a HCI SLIP packet.
- *
- * @note  The function adds a packet pointed by p_buffer parameter to a transmission queue and
- *        schedules generating an event of type @ref SER_PHY_HCI_SLIP_EVT_PKT_SENT upon transmission
- *        completion.
- *
- * @param[in] p_header  Pointer to ser_phy_hci_pkt_params_t structure representing packet header.
- * @param[in] p_payload Pointer to ser_phy_hci_pkt_params_t structure representing packet payload.
- * @param[in] p_crc     Pointer to ser_phy_hci_pkt_params_t structure representing packet crc.
- *
- * @retval NRF_SUCCESS                Operation success. Packet was added to the transmission queue
- *                                    and event will be send upon transmission completion.
- * @retval NRF_ERROR_NULL             Operation failure. NULL pointer supplied in p_header parameter.
- *                                    NULL pointer is allowed for p_payload and p_crc parameters.
- * @retval NRF_ERROR_INVALID_PARAM    Operation failure. Number of bytes to be send equal to 0.
- * @retval NRF_ERROR_BUSY             Operation failure. Transmitting of a packet in progress.
- */
-uint32_t ser_phy_hci_slip_tx_pkt_send(const ser_phy_hci_pkt_params_t * p_header,
-                                      const ser_phy_hci_pkt_params_t * p_payload,
-                                      const ser_phy_hci_pkt_params_t * p_crc);
-
-
-/**@brief A function for freeing an RX buffer.
- *
- * @note The function has to be called as a response for event @ref SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED
- *       when RX packet has been processed. The function frees the RX buffer and therefore enables
- *       reception of next incoming data.
-
- * @param[in] p_buffer    Pointer to an RX buffer which must be freed.
- *
- * @retval NRF_SUCCESS                Operation success.
- * @retval NRF_ERROR_NULL             Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_STATE    Operation failure. A buffer was already free.
- */
-uint32_t ser_phy_hci_slip_rx_buf_free(uint8_t * p_buffer);
-
-
-/**@brief A function for closing a PHY HCI module.
- *
- * @note  The function disables hardware, resets internal module states and unregisters events
- *        callback function.
- */
-void ser_phy_hci_slip_close(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_PHY_HCI_H__ */
-/** @} */


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/ble_evt_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_app.h
deleted file mode 100644
index cc42fba..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_app.h
+++ /dev/null
@@ -1,119 +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.
- *
- */
-#ifndef BLE_EVT_APP_H__
-#define BLE_EVT_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_evt_app Application event decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    Application event decoders.
- */
-#include "ble.h"
-
-/**
- * @brief Decodes ble_evt_tx_complete event.
- *
- * @sa @ref nrf51_evt_tx_complete_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
-uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_evt_t * const     p_event,
-                                 uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_evt_user_mem_request event.
- *
- * @sa @ref nrf51_evt_user_mem_request_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
- uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf,
-                                       uint32_t              packet_len,
-                                       ble_evt_t * const     p_event,
-                                       uint32_t * const      p_event_len);
-
-/**
- * @brief Decodes ble_evt_user_mem_release event.
- *
- * @sa @ref nrf51_evt_user_mem_release_encoding for packet format.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to the beginning of an event packet.
- * @param[in] packet_len       Length (in bytes) of the event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- */
- uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf,
-                                       uint32_t              packet_len,
-                                       ble_evt_t * const     p_event,
-                                       uint32_t * const      p_event_len);
-
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c
deleted file mode 100644
index 88216e7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_tx_complete.c
+++ /dev/null
@@ -1,49 +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 "ble_evt_app.h"
-#include "ble_serialization.h"
-
-
-uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_evt_t * const     p_event,
-                                 uint32_t * const      p_event_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len);
-
-    uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_evt_tx_complete_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE);
-
-    p_event->header.evt_id  = BLE_EVT_TX_COMPLETE;
-    p_event->header.evt_len = event_len;
-
-    uint16_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.conn_handle);
-    uint8_dec(p_buf, packet_len, &index, &p_event->evt.common_evt.params.tx_complete.count);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c
deleted file mode 100644
index 04c7728..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_release.c
+++ /dev/null
@@ -1,78 +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 "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-#include "ble_evt_app.h"
-#include "app_ble_user_mem.h"
-
-extern ser_ble_user_mem_t m_app_user_mem_table[];
-
-uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t index        = 0;
-    uint32_t err_code     = NRF_SUCCESS;
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_release)) +
-                         sizeof (ble_evt_user_mem_release_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    p_event->header.evt_id  = BLE_EVT_USER_MEM_RELEASE;
-    p_event->header.evt_len = event_len;
-    ble_evt_user_mem_release_t * p_user_mem_rel = &(p_event->evt.common_evt.params.user_mem_release);
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->type));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    // Decoding order of mem block is different than structure elements order - length is decoded first
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_user_mem_rel->mem_block.len));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    if (p_buf[index++] == SER_FIELD_PRESENT)
-    {
-        // Using connection handle find which mem block to release in Application Processor
-        uint32_t user_mem_table_index;
-        err_code = app_ble_user_mem_context_find(p_event->evt.common_evt.conn_handle, &user_mem_table_index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-        p_user_mem_rel->mem_block.p_mem = m_app_user_mem_table[user_mem_table_index].mem_block.p_mem;
-    }
-    else
-    {
-        p_user_mem_rel->mem_block.p_mem = NULL;
-    }
-
-    // Now user memory context can be released
-    err_code = app_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c
deleted file mode 100644
index 65ffd9f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_evt_user_mem_request.c
+++ /dev/null
@@ -1,52 +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 "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "app_util.h"
-#include "ble_evt_app.h"
-
-uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      ble_evt_t * const     p_event,
-                                      uint32_t * const      p_event_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-
-    uint32_t index        = 0;
-    uint32_t err_code     = NRF_SUCCESS;
-
-    uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.common_evt.params.user_mem_request)) +
-                         sizeof (ble_evt_user_mem_request_t) -
-                         sizeof (ble_evt_hdr_t);
-
-    if (p_event == NULL)
-    {
-        *p_event_len = event_len;
-        return NRF_SUCCESS;
-    }
-
-    p_event->header.evt_id  = BLE_EVT_USER_MEM_REQUEST;
-    p_event->header.evt_len = event_len;
-
-    err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.conn_handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.common_evt.params.user_mem_request.type));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    *p_event_len = event_len;
-
-    return err_code;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_address_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_address_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_address_get.c
deleted file mode 100644
index 0cca923..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_address_get.c
+++ /dev/null
@@ -1,75 +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 "ble_gap_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address,
-                                     uint8_t * const              p_buf,
-                                     uint32_t * const             p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_ADDRESS_GET;
-    p_buf[index++] = (p_address == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const  p_buf,
-                                     uint32_t               packet_len,
-                                     ble_gap_addr_t * const p_address,
-                                     uint32_t * const       p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
-                                                             &index,
-                                                             packet_len,
-                                                             SD_BLE_GAP_ADDRESS_GET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, packet_len);
-    SER_ASSERT_NOT_NULL(p_address);
-
-    p_address->addr_type = p_buf[index++];
-    memcpy(p_address->addr, &p_buf[index], BLE_GAP_ADDR_LEN);
-    index += BLE_GAP_ADDR_LEN;
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_address_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_address_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_address_set.c
deleted file mode 100644
index 7ccb2f2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_address_set.c
+++ /dev/null
@@ -1,60 +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 "ble_gap_app.h"
-#include <stdlib.h>
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_address_set_req_enc(uint8_t                      addr_cycle_mode,
-                                     ble_gap_addr_t const * const p_addr,
-                                     uint8_t * const              p_buf,
-                                     uint32_t * const             p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1, *p_buf_len);
-    
-    p_buf[index++] = SD_BLE_GAP_ADDRESS_SET;
-    
-    err_code = uint8_t_enc(&addr_cycle_mode, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    p_buf[index++] = (p_addr == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    if (p_addr != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 1 + BLE_GAP_ADDR_LEN, *p_buf_len);
-        p_buf[index++] = p_addr->addr_type;
-        memcpy(&p_buf[index], p_addr->addr, BLE_GAP_ADDR_LEN);
-        index += BLE_GAP_ADDR_LEN;
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADDRESS_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c
deleted file mode 100644
index 2180101..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_data_set.c
+++ /dev/null
@@ -1,52 +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 "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "nrf_error.h"
-
-
-uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data,
-                                      uint8_t               dlen,
-                                      uint8_t const * const p_sr_data,
-                                      uint8_t               srdlen,
-                                      uint8_t * const       p_buf,
-                                      uint32_t * const      p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index  = 0;
-    uint8_t  opcode = SD_BLE_GAP_ADV_DATA_SET;
-    uint32_t err_code;
-    err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = len8data_enc(p_data, dlen, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = len8data_enc(p_sr_data, srdlen, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_DATA_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c
deleted file mode 100644
index dadb3a5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_start.c
+++ /dev/null
@@ -1,72 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params,
-                                   uint8_t * const                    p_buf,
-                                   uint32_t * const                   p_buf_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t total_len = *p_buf_len;
-
-    SER_ASSERT_LENGTH_LEQ(index + 2, total_len);
-    p_buf[index++] = SD_BLE_GAP_ADV_START;
-    p_buf[index++] = (p_adv_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    if (p_adv_params != NULL)
-    {
-        err_code = uint8_t_enc(&(p_adv_params->type), p_buf, total_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        err_code = cond_field_enc(p_adv_params->p_peer_addr, p_buf, total_len, &index, ble_gap_addr_enc);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        err_code = uint8_t_enc(&(p_adv_params->fp), p_buf, total_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        err_code = cond_field_enc(p_adv_params->p_whitelist, p_buf, total_len, &index, ble_gap_whitelist_t_enc);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        err_code = uint16_t_enc(&(p_adv_params->interval), p_buf, total_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-        
-        err_code = uint16_t_enc(&(p_adv_params->timeout), p_buf, total_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        err_code = ble_gap_adv_ch_mask_t_enc(&(p_adv_params->channel_mask), p_buf, total_len, &index);
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    }
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_START, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c
deleted file mode 100644
index 61cd081..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_adv_stop.c
+++ /dev/null
@@ -1,40 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-
-uint32_t ble_gap_adv_stop_req_enc(uint8_t * const  p_buf,
-                                  uint32_t * const p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint8_t  op_code  = SD_BLE_GAP_ADV_STOP;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t buf_len  = *p_buf_len;
-    uint32_t index    = 0;
-
-    err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_ADV_STOP, p_result_code);
-}


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

Posted by cc...@apache.org.
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/dfu_init_template.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_init_template.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_init_template.c
deleted file mode 100644
index 0d582e1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_init_template.c
+++ /dev/null
@@ -1,155 +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_dfu_init_template Template file with an DFU init packet handling example.
- * @{
- *
- * @ingroup nrf_dfu
- *
- * @brief This file contains a template on how to implement DFU init packet handling.
- *
- * @details The template shows how device type and revision can be used for a safety check of the 
- *          received image. It shows how validation can be performed in two stages:
- *          - Stage 1: Pre-check of firmware image before transfer to ensure the firmware matches:
- *                     - Device Type.
- *                     - Device Revision.
- *                     Installed SoftDevice.
- *                     This template can be extended with additional checks according to needs.
- *                     For example, such a check could be the origin of the image (trusted source) 
- *                     based on a signature scheme.
- *          - Stage 2: Post-check of the image after image transfer but before installing firmware.
- *                     For example, such a check could be an integrity check in form of hashing or 
- *                     verification of a signature.
- *                     In this template, a simple CRC check is carried out.
- *                     The CRC check can be replaced with other mechanisms, like signing.
- *
- * @note This module does not support security features such as image signing, but the 
- *       implementation allows for such extension.
- *       If the init packet is signed by a trusted source, it must be decrypted before it can be
- *       processed.
- */
-
-#include "dfu_init.h"
-#include <stdint.h>
-#include <string.h>
-#include <dfu_types.h>
-#include "nrf_error.h"
-#include "crc16.h"
-
-#define DFU_INIT_PACKET_EXT_LENGTH_MIN      2                       //< Minimum length of the extended init packet. The extended init packet may contain a CRC, a HASH, or other data. This value must be changed according to the requirements of the system. The template uses a minimum value of two in order to hold a CRC. */
-#define DFU_INIT_PACKET_EXT_LENGTH_MAX      10                      //< Maximum length of the extended init packet. The extended init packet may contain a CRC, a HASH, or other data. This value must be changed according to the requirements of the system. The template uses a maximum value of 10 in order to hold a CRC and any padded data on transport layer without overflow. */
-
-static uint8_t m_extended_packet[DFU_INIT_PACKET_EXT_LENGTH_MAX];   //< Data array for storage of the extended data received. The extended data follows the normal init data of type \ref dfu_init_packet_t. Extended data can be used for a CRC, hash, signature, or other data. */
-static uint8_t m_extended_packet_length;                            //< Length of the extended data received with init packet. */
-
-
-uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len)
-{
-    uint32_t i = 0;
-    
-    // In order to support signing or encryption then any init packet decryption function / library
-    // should be called from here or implemented at this location.
-
-    // Length check to ensure valid data are parsed.
-    if (init_data_len < sizeof(dfu_init_packet_t))
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    // Current template uses clear text data so they can be casted for pre-check.
-    dfu_init_packet_t * p_init_packet = (dfu_init_packet_t *)p_init_data;
-
-    m_extended_packet_length = ((uint32_t)p_init_data + init_data_len) -
-                               (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len];
-    if (m_extended_packet_length < DFU_INIT_PACKET_EXT_LENGTH_MIN)
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    if (((uint32_t)p_init_data + init_data_len) < 
-        (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len])
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    memcpy(m_extended_packet,
-           &p_init_packet->softdevice[p_init_packet->softdevice_len],
-           m_extended_packet_length);
-
-/** [DFU init application version] */
-    // To support application versioning, this check should be updated.
-    // This template allows for any application to be installed. However, 
-    // customers can place a revision number at the bottom of the application 
-    // to be verified by the bootloader. This can be done at a location 
-    // relative to the application, for example the application start 
-    // address + 0x0100.
-/** [DFU init application version] */
-    
-    // First check to verify the image to be transfered matches the device type.
-    // If no Device type is present in DFU_DEVICE_INFO then any image will be accepted.
-    if ((DFU_DEVICE_INFO->device_type != DFU_DEVICE_TYPE_EMPTY) &&
-        (p_init_packet->device_type != DFU_DEVICE_INFO->device_type))
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-    
-    // Second check to verify the image to be transfered matches the device revision.
-    // If no Device revision is present in DFU_DEVICE_INFO then any image will be accepted.
-    if ((DFU_DEVICE_INFO->device_rev != DFU_DEVICE_REVISION_EMPTY) &&
-        (p_init_packet->device_rev != DFU_DEVICE_INFO->device_rev))
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-
-    // Third check: Check the array of supported SoftDevices by this application.
-    //              If the installed SoftDevice does not match any SoftDevice in the list then an
-    //              error is returned.
-    while (i < p_init_packet->softdevice_len)
-    {
-        if (p_init_packet->softdevice[i]   == DFU_SOFTDEVICE_ANY ||
-            p_init_packet->softdevice[i++] == SD_FWID_GET(MBR_SIZE))
-        {
-            return NRF_SUCCESS;
-        }
-    }
-    
-    // No matching SoftDevice found - Return NRF_ERROR_INVALID_DATA.
-    return NRF_ERROR_INVALID_DATA;
-}
-
-
-uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len)
-{
-    uint16_t image_crc;
-    uint16_t received_crc;
-    
-    // In order to support hashing (and signing) then the (decrypted) hash should be fetched and
-    // the corresponding hash should be calculated over the image at this location.
-    // If hashing (or signing) is added to the system then the CRC validation should be removed.
-
-    // calculate CRC from active block.
-    image_crc = crc16_compute(p_image, image_len, NULL);
-
-    // Decode the received CRC from extended data.    
-    received_crc = uint16_decode((uint8_t *)&m_extended_packet[0]);
-
-    // Compare the received and calculated CRC.
-    if (image_crc != received_crc)
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-
-    return NRF_SUCCESS;
-}
-

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/dfu_single_bank.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_single_bank.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_single_bank.c
deleted file mode 100644
index 8fef052..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_single_bank.c
+++ /dev/null
@@ -1,783 +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 <stddef.h>
-#include "dfu.h"
-#include <dfu_types.h>
-#include "dfu_bank_internal.h"
-#include "nrf.h"
-#include "nrf_sdm.h"
-#include "app_error.h"
-#include "app_timer.h"
-#include "bootloader.h"
-#include "bootloader_types.h"
-#include "pstorage.h"
-#include "nrf_mbr.h"
-#include "dfu_init.h"
-#include "sdk_common.h"
-
-static dfu_state_t                  m_dfu_state;                /**< Current DFU state. */
-static uint32_t                     m_image_size;               /**< Size of the image that will be transmitted. */
-
-static dfu_start_packet_t           m_start_packet;             /**< Start packet received for this update procedure. Contains update mode and image sizes information to be used for image transfer. */
-static uint8_t                      m_init_packet[64];          /**< Init packet, can hold CRC, Hash, Signed Hash and similar, for image validation, integrety check and authorization checking. */ 
-static uint8_t                      m_init_packet_length;       /**< Length of init packet received. */
-static uint16_t                     m_image_crc;                /**< Calculated CRC of the image received. */
-
-APP_TIMER_DEF(m_dfu_timer_id);                                  /**< Application timer id. */
-static bool                         m_dfu_timed_out = false;    /**< Boolean flag value for tracking DFU timer timeout state. */
-
-static pstorage_handle_t            m_storage_handle_app;       /**< Pstorage handle for the application area (bank 0). Bank used when updating a SoftDevice w/wo bootloader. Handle also used when swapping received application from bank 1 to bank 0. */
-static pstorage_handle_t          * mp_storage_handle_active;   /**< Pointer to the pstorage handle for the active bank for receiving of data packets. */
-
-static dfu_callback_t               m_data_pkt_cb;              /**< Callback from DFU Bank module for notification of asynchronous operation such as flash prepare. */
-static dfu_bank_func_t              m_functions;                /**< Structure holding operations for the selected update process. */
-
-
-/**@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)
-{
-    switch (op_code)
-    {
-        case PSTORAGE_STORE_OP_CODE:
-            if ((m_dfu_state == DFU_STATE_RX_DATA_PKT) && (m_data_pkt_cb != NULL))
-            {
-                m_data_pkt_cb(DATA_PACKET, result, p_data);
-            }
-            break;
-
-        case PSTORAGE_CLEAR_OP_CODE:
-            if (m_dfu_state == DFU_STATE_PREPARING)
-            {
-                m_functions.cleared();
-                m_dfu_state = DFU_STATE_RDY;
-                if (m_data_pkt_cb != NULL)
-                {
-                    m_data_pkt_cb(START_PACKET, result, p_data);
-                }
-            }
-            break;
-
-        default:
-            break;
-    }
-    APP_ERROR_CHECK(result);
-}
-
-
-/**@brief Function for handling the DFU timeout.
- *
- * @param[in] p_context The timeout context.
- */
-static void dfu_timeout_handler(void * p_context)
-{
-    UNUSED_PARAMETER(p_context);
-    dfu_update_status_t update_status;
-
-    m_dfu_timed_out           = true;
-    update_status.status_code = DFU_TIMEOUT;
-
-    bootloader_dfu_update_process(update_status);
-}
-
-
-/**@brief   Function for restarting the DFU Timer.
- *
- * @details This function will stop and restart the DFU timer. This function will be called by the
- *          functions handling any DFU packet received from the peer that is transferring a firmware
- *          image.
- */
-static uint32_t dfu_timer_restart(void)
-{
-    if (m_dfu_timed_out)
-    {
-        // The DFU timer had already timed out.
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    uint32_t err_code = app_timer_stop(m_dfu_timer_id);
-    APP_ERROR_CHECK(err_code);
-
-    err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL);
-    APP_ERROR_CHECK(err_code);
-
-    return err_code;
-}
-
-
-/**@brief   Function for preparing of flash before receiving SoftDevice image.
- *
- * @details This function will erase current application area to ensure sufficient amount of
- *          storage for the SoftDevice image. Upon erase complete a callback will be done.
- *          See \ref dfu_bank_prepare_t for further details.
- */
-static void dfu_prepare_func_app_erase(uint32_t image_size)
-{
-    uint32_t err_code;
-
-    mp_storage_handle_active = &m_storage_handle_app;
-
-    // Doing a SoftDevice update thus current application must be cleared to ensure enough space
-    // for new SoftDevice.
-    m_dfu_state = DFU_STATE_PREPARING;
-    err_code    = pstorage_clear(&m_storage_handle_app, m_image_size);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief   Function for handling behaviour when clear operation has completed.
- */
-static void dfu_cleared_func_app(void)
-{
-    dfu_update_status_t update_status = {DFU_BANK_0_ERASED, };
-    bootloader_dfu_update_process(update_status);
-}
-
-
-/**@brief   Function for calculating storage offset for receiving SoftDevice image.
- *
- * @details When a new SoftDevice is received it will be temporary stored in flash before moved to
- *          address 0x0. In order to succesfully validate transfer and relocation it is important
- *          that temporary image and final installed image does not ovwerlap hence an offset must
- *          be calculated in case new image is larger than currently installed SoftDevice.
- */
-uint32_t offset_calculate(uint32_t sd_image_size)
-{
-    uint32_t offset = 0;
-    
-    if (m_start_packet.sd_image_size > DFU_BANK_0_REGION_START)
-    {
-        uint32_t page_mask = (CODE_PAGE_SIZE - 1);
-        uint32_t diff = m_start_packet.sd_image_size - DFU_BANK_0_REGION_START;
-        
-        offset = diff & ~page_mask;
-        
-        // Align offset to next page if image size is not page sized.
-        if ((diff & page_mask) > 0)
-        {
-            offset += CODE_PAGE_SIZE;
-        }
-    }
-
-    return offset;
-}
-
-
-/**@brief Function for activating received SoftDevice image.
- *
- *  @note This function will not move the SoftDevice image.
- *        The bootloader settings will be marked as SoftDevice update complete and the swapping of
- *        current SoftDevice will occur after system reset.
- *
- * @return NRF_SUCCESS on success.
- */
-static uint32_t dfu_activate_sd(void)
-{
-    dfu_update_status_t update_status;
-
-    update_status.status_code    = DFU_UPDATE_SD_COMPLETE;
-    update_status.app_crc        = m_image_crc;
-    update_status.sd_image_start = DFU_BANK_0_REGION_START;
-    update_status.sd_size        = m_start_packet.sd_image_size;
-    update_status.bl_size        = m_start_packet.bl_image_size;
-    update_status.app_size       = m_start_packet.app_image_size;
-
-    bootloader_dfu_update_process(update_status);
-
-    return NRF_SUCCESS;
-}
-
-
-/**@brief Function for activating received Application image.
- *
- *  @details This function will move the received application image fram swap (bank 1) to
- *           application area (bank 0).
- *
- * @return NRF_SUCCESS on success. Error code otherwise.
- */
-static uint32_t dfu_activate_app(void)
-{
-    uint32_t            err_code = NRF_SUCCESS;
-    dfu_update_status_t update_status;
-
-    memset(&update_status, 0, sizeof(dfu_update_status_t ));
-    update_status.status_code = DFU_UPDATE_APP_COMPLETE;
-    update_status.app_crc     = m_image_crc;
-    update_status.app_size    = m_start_packet.app_image_size;
-
-    bootloader_dfu_update_process(update_status);
-
-    return err_code;
-}
-
-
-/**@brief Function for activating received Bootloader image.
- *
- *  @note This function will not move the bootloader image.
- *        The bootloader settings will be marked as Bootloader update complete and the swapping of
- *        current bootloader will occur after system reset.
- *
- * @return NRF_SUCCESS on success.
- */
-static uint32_t dfu_activate_bl(void)
-{
-    dfu_update_status_t update_status;
-
-    update_status.status_code = DFU_UPDATE_BOOT_COMPLETE;
-    update_status.app_crc     = m_image_crc;
-    update_status.sd_size     = m_start_packet.sd_image_size;
-    update_status.bl_size     = m_start_packet.bl_image_size;
-    update_status.app_size    = m_start_packet.app_image_size;
-
-    bootloader_dfu_update_process(update_status);
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_init(void)
-{
-    uint32_t                err_code;
-    pstorage_module_param_t storage_module_param = {.cb = pstorage_callback_handler};
-
-    m_init_packet_length = 0;
-    m_image_crc          = 0;
-
-    err_code = pstorage_register(&storage_module_param, &m_storage_handle_app);
-    if (err_code != NRF_SUCCESS)
-    {
-        m_dfu_state = DFU_STATE_INIT_ERROR;
-        return err_code;
-    }
-
-    m_storage_handle_app.block_id  = DFU_BANK_0_REGION_START;
-
-    // Create the timer to monitor the activity by the peer doing the firmware update.
-    err_code = app_timer_create(&m_dfu_timer_id,
-                                APP_TIMER_MODE_SINGLE_SHOT,
-                                dfu_timeout_handler);
-    APP_ERROR_CHECK(err_code);
-
-    // Start the DFU timer.
-    err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL);
-    APP_ERROR_CHECK(err_code);
-
-    m_data_received = 0;
-    m_dfu_state     = DFU_STATE_IDLE;
-
-    return NRF_SUCCESS;
-}
-
-
-void dfu_register_callback(dfu_callback_t callback_handler)
-{
-    m_data_pkt_cb = callback_handler;
-}
-
-
-uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet)
-{
-    uint32_t err_code;
-
-    m_start_packet = *(p_packet->params.start_packet);
-
-    // Check that the requested update procedure is supported.
-    // Currently the following combinations are allowed:
-    // - Application
-    // - SoftDevice
-    // - Bootloader
-    // - SoftDevice with Bootloader
-    if (IS_UPDATING_APP(m_start_packet) && 
-        (IS_UPDATING_SD(m_start_packet) || IS_UPDATING_BL(m_start_packet)))
-    {
-        // App update is only supported independently.
-        return NRF_ERROR_NOT_SUPPORTED;
-    }
-
-    if (!(IS_WORD_SIZED(m_start_packet.sd_image_size) &&
-          IS_WORD_SIZED(m_start_packet.bl_image_size) &&
-          IS_WORD_SIZED(m_start_packet.app_image_size)))
-    {
-        // Image_sizes are not a multiple of 4 (word size).
-        return NRF_ERROR_NOT_SUPPORTED;
-    }
-
-    m_image_size = m_start_packet.sd_image_size + m_start_packet.bl_image_size +
-                   m_start_packet.app_image_size;
-    
-    if (m_start_packet.bl_image_size > DFU_BL_IMAGE_MAX_SIZE)
-    {
-        return NRF_ERROR_DATA_SIZE;
-    }
-
-    if (m_image_size > (DFU_IMAGE_MAX_SIZE_FULL))
-    {
-        return NRF_ERROR_DATA_SIZE;
-    }
-    m_functions.prepare  = dfu_prepare_func_app_erase;
-    m_functions.cleared  = dfu_cleared_func_app;
-    
-    if (IS_UPDATING_SD(m_start_packet))
-    {
-        m_functions.activate = dfu_activate_sd;
-    }
-    else if (IS_UPDATING_BL(m_start_packet))
-    {
-        m_functions.activate = dfu_activate_bl;
-    }
-    else
-    {
-        m_functions.activate = dfu_activate_app;
-    }
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_IDLE:
-            // Valid peer activity detected. Hence restart the DFU timer.
-            err_code = dfu_timer_restart();
-            VERIFY_SUCCESS(err_code);
-            m_functions.prepare(m_image_size);
-
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet)
-{
-    uint32_t   data_length;
-    uint32_t   err_code;
-    uint32_t * p_data;
-
-    VERIFY_PARAM_NOT_NULL(p_packet);
-
-    // Check pointer alignment.
-    if (!is_word_aligned(p_packet->params.data_packet.p_data_packet))
-    {
-        // The p_data_packet is not word aligned address.
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_RDY:
-        case DFU_STATE_RX_INIT_PKT:
-            return NRF_ERROR_INVALID_STATE;
-
-        case DFU_STATE_RX_DATA_PKT:
-            data_length = p_packet->params.data_packet.packet_length * sizeof(uint32_t);
-
-            if ((m_data_received + data_length) > m_image_size)
-            {
-                // The caller is trying to write more bytes into the flash than the size provided to
-                // the dfu_image_size_set function. This is treated as a serious error condition and
-                // an unrecoverable one. Hence point the variable mp_app_write_address to the top of
-                // the flash area. This will ensure that all future application data packet writes
-                // will be blocked because of the above check.
-                m_data_received = 0xFFFFFFFF;
-
-                return NRF_ERROR_DATA_SIZE;
-            }
-
-            // Valid peer activity detected. Hence restart the DFU timer.
-            err_code = dfu_timer_restart();
-            VERIFY_SUCCESS(err_code);
-
-            p_data = (uint32_t *)p_packet->params.data_packet.p_data_packet;
-
-            err_code = pstorage_store(mp_storage_handle_active,
-                                          (uint8_t *)p_data,
-                                          data_length,
-                                          m_data_received);
-            VERIFY_SUCCESS(err_code);
-
-            m_data_received += data_length;
-
-            if (m_data_received != m_image_size)
-            {
-                // The entire image is not received yet. More data is expected.
-                err_code = NRF_ERROR_INVALID_LENGTH;
-            }
-            else
-            {
-                // The entire image has been received. Return NRF_SUCCESS.
-                err_code = NRF_SUCCESS;
-            }
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_init_pkt_complete(void)
-{
-    uint32_t err_code = NRF_ERROR_INVALID_STATE;
-    
-    // DFU initialization has been done and a start packet has been received.
-    if (IMAGE_WRITE_IN_PROGRESS())
-    {
-        // Image write is already in progress. Cannot handle an init packet now.
-        return NRF_ERROR_INVALID_STATE;
-    }
-    
-    if (m_dfu_state == DFU_STATE_RX_INIT_PKT)
-    {
-        err_code = dfu_init_prevalidate(m_init_packet, m_init_packet_length);
-        if (err_code == NRF_SUCCESS)
-        {
-            m_dfu_state = DFU_STATE_RX_DATA_PKT;
-        }
-        else
-        {
-            m_init_packet_length = 0;
-        }
-    }
-    return err_code;
-}
-
-
-uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet)
-{
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t length;
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_RDY:
-            m_dfu_state = DFU_STATE_RX_INIT_PKT;
-            // When receiving init packet in state ready just update and fall through this case.         
-
-        case DFU_STATE_RX_INIT_PKT:
-            // DFU initialization has been done and a start packet has been received.
-            if (IMAGE_WRITE_IN_PROGRESS())
-            {
-                // Image write is already in progress. Cannot handle an init packet now.
-                return NRF_ERROR_INVALID_STATE;
-            }
-
-            // Valid peer activity detected. Hence restart the DFU timer.
-            err_code = dfu_timer_restart();
-            VERIFY_SUCCESS(err_code);
-
-            length = p_packet->params.data_packet.packet_length * sizeof(uint32_t);
-            if ((m_init_packet_length + length) > sizeof(m_init_packet))
-            {
-                return NRF_ERROR_INVALID_LENGTH;
-            }
-
-            memcpy(&m_init_packet[m_init_packet_length],
-                   &p_packet->params.data_packet.p_data_packet[0],
-                   length);
-            m_init_packet_length += length;
-            break;
-
-        default:
-            // Either the start packet was not received or dfu_init function was not called before.
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_image_validate()
-{
-    uint32_t err_code;
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_RX_DATA_PKT:
-            // Check if the application image write has finished.
-            if (m_data_received != m_image_size)
-            {
-                // Image not yet fully transfered by the peer or the peer has attempted to write
-                // too much data. Hence the validation should fail.
-                err_code = NRF_ERROR_INVALID_STATE;
-            }
-            else
-            {
-                m_dfu_state = DFU_STATE_VALIDATE;
-
-                // Valid peer activity detected. Hence restart the DFU timer.
-                err_code = dfu_timer_restart();
-                if (err_code == NRF_SUCCESS)
-                {
-                    err_code = dfu_init_postvalidate((uint8_t *)mp_storage_handle_active->block_id,
-                                                     m_image_size);
-                    VERIFY_SUCCESS(err_code);
-
-                    m_dfu_state = DFU_STATE_WAIT_4_ACTIVATE;
-                }
-            }
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-uint32_t dfu_image_activate()
-{
-    uint32_t err_code;
-
-    switch (m_dfu_state)
-    {
-        case DFU_STATE_WAIT_4_ACTIVATE:
-
-            // Stop the DFU Timer because the peer activity need not be monitored any longer.
-            err_code = app_timer_stop(m_dfu_timer_id);
-            APP_ERROR_CHECK(err_code);
-
-            err_code = m_functions.activate();
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-
-    return err_code;
-}
-
-
-void dfu_reset(void)
-{
-    dfu_update_status_t update_status;
-
-    update_status.status_code = DFU_RESET;
-
-    bootloader_dfu_update_process(update_status);
-}
-
-
-static uint32_t dfu_compare_block(uint32_t * ptr1, uint32_t * ptr2, uint32_t len)
-{
-    sd_mbr_command_t sd_mbr_cmd;
-
-    sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
-    sd_mbr_cmd.params.compare.ptr1 = ptr1;
-    sd_mbr_cmd.params.compare.ptr2 = ptr2;
-    sd_mbr_cmd.params.compare.len  = len / sizeof(uint32_t);
-
-    return sd_mbr_command(&sd_mbr_cmd);
-}
-
-
-static uint32_t dfu_copy_sd(uint32_t * src, uint32_t * dst, uint32_t len)
-{
-    sd_mbr_command_t sd_mbr_cmd;
-
-    sd_mbr_cmd.command            = SD_MBR_COMMAND_COPY_SD;
-    sd_mbr_cmd.params.copy_sd.src = src;
-    sd_mbr_cmd.params.copy_sd.dst = dst;
-    sd_mbr_cmd.params.copy_sd.len = len / sizeof(uint32_t);
-
-    return sd_mbr_command(&sd_mbr_cmd);
-}
-
-
-static uint32_t dfu_sd_img_block_swap(uint32_t * src, 
-                                      uint32_t * dst, 
-                                      uint32_t len, 
-                                      uint32_t block_size)
-{
-    // It is neccesarry to swap the new SoftDevice in 3 rounds to ensure correct copy of data
-    // and verifucation of data in case power reset occurs during write to flash. 
-    // To ensure the robustness of swapping the images are compared backwards till start of
-    // image swap. If the back is identical everything is swapped.
-    uint32_t err_code = dfu_compare_block(src, dst, len);
-    if (err_code == NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    if ((uint32_t)dst > SOFTDEVICE_REGION_START)
-    {
-        err_code = dfu_sd_img_block_swap((uint32_t *)((uint32_t)src - block_size), 
-                                         (uint32_t *)((uint32_t)dst - block_size), 
-                                         block_size, 
-                                         block_size);
-        VERIFY_SUCCESS(err_code);
-    }
-
-    err_code = dfu_copy_sd(src, dst, len);
-    VERIFY_SUCCESS(err_code);
-
-    return dfu_compare_block(src, dst, len);
-}
-
-
-uint32_t dfu_sd_image_swap(void)
-{
-    bootloader_settings_t boot_settings;
-
-    bootloader_settings_get(&boot_settings);
-
-    if (boot_settings.sd_image_size == 0)
-    {
-        return NRF_SUCCESS;
-    }
-    
-    if ((SOFTDEVICE_REGION_START + boot_settings.sd_image_size) > boot_settings.sd_image_start)
-    {
-        uint32_t err_code;
-        uint32_t sd_start        = SOFTDEVICE_REGION_START;
-        uint32_t block_size      = (boot_settings.sd_image_start - sd_start) / 2;
-        uint32_t image_end       = boot_settings.sd_image_start + boot_settings.sd_image_size;
-
-        uint32_t img_block_start = boot_settings.sd_image_start + 2 * block_size;
-        uint32_t sd_block_start  = sd_start + 2 * block_size;
-        
-        if (SD_SIZE_GET(MBR_SIZE) < boot_settings.sd_image_size)
-        {
-            // This will clear a page thus ensuring the old image is invalidated before swapping.
-            err_code = dfu_copy_sd((uint32_t *)(sd_start + block_size), 
-                                   (uint32_t *)(sd_start + block_size), 
-                                   sizeof(uint32_t));
-            VERIFY_SUCCESS(err_code);
-
-            err_code = dfu_copy_sd((uint32_t *)sd_start, (uint32_t *)sd_start, sizeof(uint32_t));
-            VERIFY_SUCCESS(err_code);
-        }
-        
-        return dfu_sd_img_block_swap((uint32_t *)img_block_start, 
-                                     (uint32_t *)sd_block_start, 
-                                     image_end - img_block_start, 
-                                     block_size);
-    }
-    else
-    {
-        if (boot_settings.sd_image_size != 0)
-        {
-            return dfu_copy_sd((uint32_t *)boot_settings.sd_image_start,
-                               (uint32_t *)SOFTDEVICE_REGION_START, 
-                               boot_settings.sd_image_size);
-        }
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_bl_image_swap(void)
-{
-    bootloader_settings_t bootloader_settings;
-    sd_mbr_command_t      sd_mbr_cmd;
-
-    bootloader_settings_get(&bootloader_settings);
-
-    if (bootloader_settings.bl_image_size != 0)
-    {
-        uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ?
-                                  DFU_BANK_0_REGION_START :
-                                  bootloader_settings.sd_image_start + 
-                                  bootloader_settings.sd_image_size;
-
-        sd_mbr_cmd.command               = SD_MBR_COMMAND_COPY_BL;
-        sd_mbr_cmd.params.copy_bl.bl_src = (uint32_t *)(bl_image_start);
-        sd_mbr_cmd.params.copy_bl.bl_len = bootloader_settings.bl_image_size / sizeof(uint32_t);
-
-        return sd_mbr_command(&sd_mbr_cmd);
-    }
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_bl_image_validate(void)
-{
-    bootloader_settings_t bootloader_settings;
-    sd_mbr_command_t      sd_mbr_cmd;
-
-    bootloader_settings_get(&bootloader_settings);
-
-    if (bootloader_settings.bl_image_size != 0)
-    {
-        uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ?
-                                  DFU_BANK_0_REGION_START :
-                                  bootloader_settings.sd_image_start +
-                                  bootloader_settings.sd_image_size;
-
-        sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
-        sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)BOOTLOADER_REGION_START;
-        sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)(bl_image_start);
-        sd_mbr_cmd.params.compare.len  = bootloader_settings.bl_image_size / sizeof(uint32_t);
-
-        return sd_mbr_command(&sd_mbr_cmd);
-    }
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_sd_image_validate(void)
-{
-    bootloader_settings_t bootloader_settings;
-    sd_mbr_command_t      sd_mbr_cmd;
-
-    bootloader_settings_get(&bootloader_settings);
-
-    if (bootloader_settings.sd_image_size == 0)
-    {
-        return NRF_SUCCESS;
-    }
-    
-    if ((SOFTDEVICE_REGION_START + bootloader_settings.sd_image_size) > bootloader_settings.sd_image_start)
-    {
-        uint32_t sd_start        = SOFTDEVICE_REGION_START;
-        uint32_t block_size      = (bootloader_settings.sd_image_start - sd_start) / 2;
-        uint32_t image_end       = bootloader_settings.sd_image_start + 
-                                   bootloader_settings.sd_image_size;
-
-        uint32_t img_block_start = bootloader_settings.sd_image_start + 2 * block_size;
-        uint32_t sd_block_start  = sd_start + 2 * block_size;
-
-        if (SD_SIZE_GET(MBR_SIZE) < bootloader_settings.sd_image_size)
-        {
-            return NRF_ERROR_NULL;
-        }
-
-        return dfu_sd_img_block_swap((uint32_t *)img_block_start, 
-                                     (uint32_t *)sd_block_start, 
-                                     image_end - img_block_start, 
-                                     block_size);
-    }
-    
-    sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
-    sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)SOFTDEVICE_REGION_START;
-    sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)bootloader_settings.sd_image_start;
-    sd_mbr_cmd.params.compare.len  = bootloader_settings.sd_image_size / sizeof(uint32_t);
-
-    return sd_mbr_command(&sd_mbr_cmd);
-}

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/dfu_transport.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport.h
deleted file mode 100644
index 6eb7ab6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport.h
+++ /dev/null
@@ -1,48 +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_dfu_transport DFU transport API.
- * @{     
- *  
- * @brief DFU transport module interface.
- */
- 
-#ifndef DFU_TRANSPORT_H__
-#define DFU_TRANSPORT_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for starting the update of Device Firmware.
- *
- * @retval NRF_SUCCESS Operation success.   
- */
-uint32_t dfu_transport_update_start(void);
-
-/**@brief Function for closing the transport layer.
- *
- * @retval NRF_SUCCESS Operation success.    
- */
-uint32_t dfu_transport_close(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_TRANSPORT_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/dfu_transport_ble.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport_ble.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport_ble.c
deleted file mode 100644
index 25cf217..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport_ble.c
+++ /dev/null
@@ -1,1100 +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 "dfu_transport.h"
-#include "dfu.h"
-#include <dfu_types.h>
-#include <stddef.h>
-#include "boards.h"
-#include "nrf.h"
-#include "nrf_sdm.h"
-#include "nrf_gpio.h"
-#include "app_util.h"
-#include "app_error.h"
-#include "softdevice_handler.h"
-#include "ble_stack_handler_types.h"
-#include "ble_advdata.h"
-#include "ble_l2cap.h"
-#include "ble_gap.h"
-#include "ble_gatt.h"
-#include "ble_hci.h"
-#include "ble_dfu.h"
-#include "app_timer.h"
-#include "ble_conn_params.h"
-#include "hci_mem_pool.h"
-#include "bootloader.h"
-#include "dfu_ble_svc_internal.h"
-#include "nrf_delay.h"
-#include "sdk_common.h"
-
-#define DFU_REV_MAJOR                        0x00                                                    /** DFU Major revision number to be exposed. */
-#define DFU_REV_MINOR                        0x08                                                    /** DFU Minor revision number to be exposed. */
-#define DFU_REVISION                         ((DFU_REV_MAJOR << 8) | DFU_REV_MINOR)                  /** DFU Revision number to be exposed. Combined of major and minor versions. */
-#define ADVERTISING_LED_PIN_NO               BSP_LED_0                                               /**< Is on when device is advertising. */
-#define CONNECTED_LED_PIN_NO                 BSP_LED_1                                               /**< Is on when device has connected. */
-#define DFU_SERVICE_HANDLE                   0x000C                                                  /**< Handle of DFU service when DFU service is first service initialized. */
-#define BLE_HANDLE_MAX                       0xFFFF                                                  /**< Max handle value is BLE. */
-
-#define DEVICE_NAME                          "DfuTarg"                                               /**< Name of device. Will be included in the advertising data. */
-#define MANUFACTURER_NAME                    "NordicSemiconductor"                                   /**< Manufacturer. Will be passed to Device Information Service. */
-
-#define MIN_CONN_INTERVAL                    (uint16_t)(MSEC_TO_UNITS(15, UNIT_1_25_MS))             /**< Minimum acceptable connection interval (11.25 milliseconds). */
-#define MAX_CONN_INTERVAL                    (uint16_t)(MSEC_TO_UNITS(30, UNIT_1_25_MS))             /**< Maximum acceptable connection interval (15 milliseconds). */
-#define SLAVE_LATENCY                        0                                                       /**< Slave latency. */
-#define CONN_SUP_TIMEOUT                     (4 * 100)                                               /**< Connection supervisory timeout (4 seconds). */
-
-#define APP_TIMER_PRESCALER                  0                                                       /**< Value of the RTC1 PRESCALER register. */
-
-#define FIRST_CONN_PARAMS_UPDATE_DELAY       APP_TIMER_TICKS(100, APP_TIMER_PRESCALER)               /**< Time from the Connected event to first time sd_ble_gap_conn_param_update is called (100 milliseconds). */
-#define NEXT_CONN_PARAMS_UPDATE_DELAY        APP_TIMER_TICKS(500, APP_TIMER_PRESCALER)               /**< Time between each call to sd_ble_gap_conn_param_update after the first call (500 milliseconds). */
-#define MAX_CONN_PARAMS_UPDATE_COUNT         3                                                       /**< Number of attempts before giving up the connection parameter negotiation. */
-
-#define APP_ADV_INTERVAL                     MSEC_TO_UNITS(25, UNIT_0_625_MS)                        /**< The advertising interval (25 ms.). */
-#define APP_ADV_TIMEOUT_IN_SECONDS           BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED                   /**< The advertising timeout in units of seconds. This is set to @ref BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED so that the advertisement is done as long as there there is a call to @ref dfu_transport_close function.*/
-#define APP_DIRECTED_ADV_TIMEOUT             50                                                       /**< number of direct advertisement (each lasting 1.28seconds). */
-#define PEER_ADDRESS_TYPE_INVALID            0xFF                                                    /**< Value indicating that no valid peer address exists. This will be the case when a private resolvable address is used in which case there is no address available but instead an IRK is present. */   
-#define PEER_ADDRESS_TYPE_INVALID            0xFF                                                    /**< Value indicating that no valid peer address exists. This will be the case when a private resolvable address is used in which case there is no address available but instead an IRK is present. */   
-
-#define SEC_PARAM_TIMEOUT                    30                                                      /**< Timeout for Pairing Request or Security Request (in seconds). */
-#define SEC_PARAM_BOND                       0                                                       /**< Perform bonding. */
-#define SEC_PARAM_MITM                       0                                                       /**< Man In The Middle protection not required. */
-#define SEC_PARAM_LESC                       0                                                       /**< LE Secure Connections not enabled. */
-#define SEC_PARAM_KEYPRESS                   0                                                       /**< Keypress notifications not enabled. */
-#define SEC_PARAM_IO_CAPABILITIES            BLE_GAP_IO_CAPS_NONE                                    /**< No I/O capabilities. */
-#define SEC_PARAM_OOB                        0                                                       /**< Out Of Band data not available. */
-#define SEC_PARAM_MIN_KEY_SIZE               7                                                       /**< Minimum encryption key size. */
-#define SEC_PARAM_MAX_KEY_SIZE               16                                                      /**< Maximum encryption key size. */
-
-#define MAX_SIZE_OF_BLE_STACK_EVT            (sizeof(ble_evt_t) + BLE_L2CAP_MTU_DEF)                 /**< Maximum size (in bytes) of the event received from S110 SoftDevice.*/
-#define NUM_WORDS_RESERVED_FOR_BLE_EVENTS    CEIL_DIV(MAX_SIZE_OF_BLE_STACK_EVT, sizeof(uint32_t))   /**< Size of the memory (in words) reserved for receiving S110 SoftDevice events. */
-
-#define IS_CONNECTED()                       (m_conn_handle != BLE_CONN_HANDLE_INVALID)              /**< Macro to determine if the device is in connected state. */
-
-#define APP_FEATURE_NOT_SUPPORTED            BLE_GATT_STATUS_ATTERR_APP_BEGIN + 2                    /**< Reply when unsupported features are requested. */
-#define SD_IMAGE_SIZE_OFFSET                 0                                                       /**< Offset in start packet for the size information for SoftDevice. */
-#define BL_IMAGE_SIZE_OFFSET                 4                                                       /**< Offset in start packet for the size information for bootloader. */
-#define APP_IMAGE_SIZE_OFFSET                8                                                       /**< Offset in start packet for the size information for application. */
-
-
-/**@brief Packet type enumeration.
- */
-typedef enum
-{
-    PKT_TYPE_INVALID,                                                                                /**< Invalid packet type. Used for initialization purpose.*/
-    PKT_TYPE_START,                                                                                  /**< Start packet.*/
-    PKT_TYPE_INIT,                                                                                   /**< Init packet.*/
-    PKT_TYPE_FIRMWARE_DATA                                                                           /**< Firmware data packet.*/
-} pkt_type_t;
-
-static ble_gap_sec_params_t m_sec_params;                                                            /**< Security requirements for this application. */
-static ble_gap_adv_params_t m_adv_params;                                                            /**< Parameters to be passed to the stack when starting advertising. */
-static ble_dfu_t            m_dfu;                                                                   /**< Structure used to identify the Device Firmware Update service. */
-static pkt_type_t           m_pkt_type;                                                              /**< Type of packet to be expected from the DFU Controller. */
-static uint8_t              m_update_mode;                                                           /**< Type of update mode specified by the DFU Controller. */
-static uint32_t             m_num_of_firmware_bytes_rcvd;                                            /**< Cumulative number of bytes of firmware data received. */
-static uint16_t             m_pkt_notif_target;                                                      /**< Number of packets of firmware data to be received before transmitting the next Packet Receipt Notification to the DFU Controller. */
-static uint16_t             m_pkt_notif_target_cnt;                                                  /**< Number of packets of firmware data received after sending last Packet Receipt Notification or since the receipt of a @ref BLE_DFU_PKT_RCPT_NOTIF_ENABLED event from the DFU service, which ever occurs later.*/
-static uint8_t            * mp_rx_buffer;                                                            /**< Pointer to a RX buffer.*/
-static bool                 m_tear_down_in_progress  = false;                                        /**< Variable to indicate whether a tear down is in progress. A tear down could be because the application has initiated it or the peer has disconnected. */
-static bool                 m_pkt_rcpt_notif_enabled = false;                                        /**< Variable to denote whether packet receipt notification has been enabled by the DFU controller.*/
-static uint16_t             m_conn_handle            = BLE_CONN_HANDLE_INVALID;                      /**< Handle of the current connection. */
-static bool                 m_is_advertising         = false;                                        /**< Variable to indicate if advertising is ongoing.*/
-static dfu_ble_peer_data_t  m_ble_peer_data;                                                         /**< BLE Peer data exchanged from application on buttonless update mode. */
-static bool                 m_ble_peer_data_valid    = false;                                        /**< True if BLE Peer data has been exchanged from application. */
-static uint32_t             m_direct_adv_cnt         = APP_DIRECTED_ADV_TIMEOUT;                     /**< Counter of direct advertisements. */
-static uint8_t            * mp_final_packet;                                                         /**< Pointer to final data packet received. When callback for succesful packet handling is received from dfu bank handling a transfer complete response can be sent to peer. */
-
-
-/**@brief     Function updating Service Changed CCCD and indicate a service change to peer.
- *
- * @details   This function will verify the CCCD setting provided with \ref m_ble_peer_data and
- *            update the system attributes accordingly. If Service Change CCCD is set to indicate
- *            then a service change indication will be send to the peer.
- *
- * @retval    NRF_INVALID_STATE if no connection has been established to a central.
- * @return    Any error code returned by SoftDevice function calls.
- */
-static uint32_t service_change_indicate()
-{
-    uint32_t err_code;
-
-    if (m_conn_handle == BLE_CONN_HANDLE_INVALID)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (m_ble_peer_data_valid)
-    {
-        err_code = sd_ble_gatts_sys_attr_set(m_conn_handle,
-                                             m_ble_peer_data.sys_serv_attr,
-                                             sizeof(m_ble_peer_data.sys_serv_attr),
-                                             BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
-        VERIFY_SUCCESS(err_code);
-
-        err_code = sd_ble_gatts_sys_attr_set(m_conn_handle,
-                                             NULL,
-                                             0,
-                                             BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS);
-        VERIFY_SUCCESS(err_code);
-
-        err_code = sd_ble_gatts_service_changed(m_conn_handle, DFU_SERVICE_HANDLE, BLE_HANDLE_MAX);
-        if ((err_code == BLE_ERROR_INVALID_CONN_HANDLE) ||
-            (err_code == NRF_ERROR_INVALID_STATE) ||
-            (err_code == BLE_ERROR_NO_TX_PACKETS))
-        {
-            // Those errors can be expected when sending trying to send Service Changed Indication
-            // if the CCCD is not set to indicate. Thus set the returning error code to success.
-            err_code = NRF_SUCCESS;
-        }
-    }
-    else
-    {
-        err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
-    }
-
-    return err_code;
-}
-
-
-/**@brief     Function to convert an nRF51 error code to a DFU Response Value.
- *
- * @details   This function will convert a given nRF51 error code to a DFU Response Value. The
- *            result of this function depends on the current DFU procedure in progress, given as
- *            input in current_dfu_proc parameter.
- *
- * @param[in] err_code         The nRF51 error code to be converted.
- * @param[in] current_dfu_proc Current DFU procedure in progress.
- *
- * @return    Converted Response Value.
- */
-static ble_dfu_resp_val_t nrf_err_code_translate(uint32_t                  err_code,
-                                                 const ble_dfu_procedure_t current_dfu_proc)
-{
-    switch (err_code)
-    {
-        case NRF_SUCCESS:
-            return BLE_DFU_RESP_VAL_SUCCESS;
-
-        case NRF_ERROR_INVALID_STATE:
-            return BLE_DFU_RESP_VAL_INVALID_STATE;
-
-        case NRF_ERROR_NOT_SUPPORTED:
-            return BLE_DFU_RESP_VAL_NOT_SUPPORTED;
-
-        case NRF_ERROR_DATA_SIZE:
-            return BLE_DFU_RESP_VAL_DATA_SIZE;
-
-        case NRF_ERROR_INVALID_DATA:
-            if (current_dfu_proc == BLE_DFU_VALIDATE_PROCEDURE)
-            {
-                // When this error is received in Validation phase, then it maps to a CRC Error.
-                // Refer dfu_image_validate function for more information.
-                return BLE_DFU_RESP_VAL_CRC_ERROR;
-            }
-            return BLE_DFU_RESP_VAL_OPER_FAILED;
-
-        default:
-            return BLE_DFU_RESP_VAL_OPER_FAILED;
-    }
-}
-
-
-/**@brief     Function for handling the callback events from the dfu module.
- *            Callbacks are expected when \ref dfu_data_pkt_handle has been executed.
- *
- * @param[in] packet    Packet type for which this callback is related.
- * @param[in] result    Operation result code. NRF_SUCCESS when a queued operation was successful.
- * @param[in] p_data    Pointer to the data to which the operation is related.
- */
-static void dfu_cb_handler(uint32_t packet, uint32_t result, uint8_t * p_data)
-{
-    switch (packet)
-    {
-        ble_dfu_resp_val_t resp_val;
-        uint32_t           err_code;
-
-        case DATA_PACKET:
-            if (result != NRF_SUCCESS)
-            {
-                // Disconnect from peer.
-                if (IS_CONNECTED())
-                {
-                    err_code = sd_ble_gap_disconnect(m_conn_handle,
-                                                     BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
-                    APP_ERROR_CHECK(err_code);
-                }
-            }
-            else
-            {
-                err_code = hci_mem_pool_rx_consume(p_data);
-                APP_ERROR_CHECK(err_code);
-
-                // If the callback matches final data packet received then the peer is notified.
-                if (mp_final_packet == p_data)
-                {
-                    // Notify the DFU Controller about the success of the procedure.
-                    err_code = ble_dfu_response_send(&m_dfu,
-                                                     BLE_DFU_RECEIVE_APP_PROCEDURE,
-                                                     BLE_DFU_RESP_VAL_SUCCESS);
-                    APP_ERROR_CHECK(err_code);
-                }
-            }
-            break;
-
-        case START_PACKET:
-            // Translate the err_code returned by the above function to DFU Response Value.
-            resp_val = nrf_err_code_translate(result, BLE_DFU_START_PROCEDURE);
-
-            err_code = ble_dfu_response_send(&m_dfu,
-                                             BLE_DFU_START_PROCEDURE,
-                                             resp_val);
-            APP_ERROR_CHECK(err_code);
-            break;
-
-        default:
-            // ignore.
-            break;
-    }
-}
-
-
-/**@brief     Function for notifying a DFU Controller about error conditions in the DFU module.
- *            This function also ensures that an error is translated from nrf_errors to DFU Response
- *            Value.
- *
- * @param[in] p_dfu     DFU Service Structure.
- * @param[in] err_code  Nrf error code that should be translated and send to the DFU Controller.
- */
-static void dfu_error_notify(ble_dfu_t * p_dfu, uint32_t err_code)
-{
-    // An error has occurred. Notify the DFU Controller about this error condition.
-    // Translate the err_code returned to DFU Response Value.
-    ble_dfu_resp_val_t resp_val;
-
-    resp_val = nrf_err_code_translate(err_code, BLE_DFU_RECEIVE_APP_PROCEDURE);
-
-    err_code = ble_dfu_response_send(p_dfu, BLE_DFU_RECEIVE_APP_PROCEDURE, resp_val);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief     Function for processing start data written by the peer to the DFU Packet
- *            Characteristic.
- *
- * @param[in] p_dfu     DFU Service Structure.
- * @param[in] p_evt     Pointer to the event received from the S110 SoftDevice.
- */
-static void start_data_process(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
-{
-    uint32_t err_code;
-
-    dfu_start_packet_t  start_packet  = {.dfu_update_mode = m_update_mode};
-    dfu_update_packet_t update_packet =
-    {
-        .packet_type         = START_PACKET,
-        .params.start_packet = &start_packet
-    };
-
-    uint32_t length = p_evt->evt.ble_dfu_pkt_write.len;
-
-    // Verify that the data is exactly three * four bytes (three words) long.
-    if (length != (3 * sizeof(uint32_t)))
-    {
-        err_code = ble_dfu_response_send(p_dfu,
-                                         BLE_DFU_START_PROCEDURE,
-                                         BLE_DFU_RESP_VAL_NOT_SUPPORTED);
-        APP_ERROR_CHECK(err_code);
-    }
-    else
-    {
-        // Extract the size of from the DFU Packet Characteristic.
-        uint8_t * p_length_data = p_evt->evt.ble_dfu_pkt_write.p_data;
-
-        start_packet.sd_image_size  = uint32_decode(p_length_data + SD_IMAGE_SIZE_OFFSET);
-        start_packet.bl_image_size  = uint32_decode(p_length_data + BL_IMAGE_SIZE_OFFSET);
-        start_packet.app_image_size = uint32_decode(p_length_data + APP_IMAGE_SIZE_OFFSET);
-
-        err_code = dfu_start_pkt_handle(&update_packet);
-        if (err_code != NRF_SUCCESS)
-        {
-            // Translate the err_code returned by the above function to DFU Response Value.
-            ble_dfu_resp_val_t resp_val;
-
-            resp_val = nrf_err_code_translate(err_code, BLE_DFU_START_PROCEDURE);
-            err_code = ble_dfu_response_send(p_dfu, BLE_DFU_START_PROCEDURE, resp_val);
-        }
-
-        APP_ERROR_CHECK(err_code);
-    }
-}
-
-
-/**@brief     Function for processing initialization data written by the peer to the DFU Packet
- *            Characteristic.
- *
- * @param[in] p_dfu     DFU Service Structure.
- * @param[in] p_evt     Pointer to the event received from the S110 SoftDevice.
- */
-static void init_data_process(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
-{
-    uint32_t            err_code;
-    dfu_update_packet_t dfu_pkt;
-
-    // The DFU module accepts the dfu_pkt.packet_length to be in 'number of words'. And so if the
-    // received data does not have a size which is a multiple of four, it should be padded with
-    // zeros and the packet_length should be incremented accordingly before calling
-    // dfu_init_pkt_handle.
-    if ((p_evt->evt.ble_dfu_pkt_write.len & (sizeof(uint32_t) - 1)) != 0)
-    {
-        uint32_t padding;
-        uint32_t i;
-        uint8_t  pkt_length = p_evt->evt.ble_dfu_pkt_write.len;
-
-        // Find out the number of bytes to be padded.
-        padding = sizeof(uint32_t) - (pkt_length & (sizeof(uint32_t) - 1));
-
-        for (i = 0; i < padding; i++)
-        {
-            p_evt->evt.ble_dfu_pkt_write.p_data[pkt_length++] = 0;
-        }
-        
-        p_evt->evt.ble_dfu_pkt_write.len = pkt_length;
-    }
-
-    dfu_pkt.packet_type = INIT_PACKET;
-
-    dfu_pkt.params.data_packet.p_data_packet = (uint32_t *)p_evt->evt.ble_dfu_pkt_write.p_data;
-    dfu_pkt.params.data_packet.packet_length = p_evt->evt.ble_dfu_pkt_write.len / sizeof(uint32_t);
-
-    err_code = dfu_init_pkt_handle(&dfu_pkt);
-
-    // Translate the err_code returned by the above function to DFU Response Value.
-    if (err_code != NRF_SUCCESS)
-    {
-        ble_dfu_resp_val_t resp_val = nrf_err_code_translate(err_code, BLE_DFU_INIT_PROCEDURE);
-
-        err_code = ble_dfu_response_send(p_dfu, BLE_DFU_INIT_PROCEDURE, resp_val);
-        APP_ERROR_CHECK(err_code);
-    }
-}
-
-
-/**@brief     Function for processing application data written by the peer to the DFU Packet
- *            Characteristic.
- *
- * @param[in] p_dfu     DFU Service Structure.
- * @param[in] p_evt     Pointer to the event received from the S110 SoftDevice.
- */
-static void app_data_process(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
-{
-    uint32_t err_code;
-
-    if ((p_evt->evt.ble_dfu_pkt_write.len & (sizeof(uint32_t) - 1)) != 0)
-    {
-        // Data length is not a multiple of 4 (word size).
-        err_code = ble_dfu_response_send(p_dfu,
-                                         BLE_DFU_RECEIVE_APP_PROCEDURE,
-                                         BLE_DFU_RESP_VAL_NOT_SUPPORTED);
-        APP_ERROR_CHECK(err_code);
-        return;
-    }
-
-    uint32_t length = p_evt->evt.ble_dfu_pkt_write.len;
-
-    err_code = hci_mem_pool_rx_produce(length, (void **) &mp_rx_buffer);
-    if (err_code != NRF_SUCCESS)
-    {
-        dfu_error_notify(p_dfu, err_code);
-        return;
-    }
-
-    uint8_t * p_data_packet = p_evt->evt.ble_dfu_pkt_write.p_data;
-    
-    memcpy(mp_rx_buffer, p_data_packet, length);
-
-    err_code = hci_mem_pool_rx_data_size_set(length);
-    if (err_code != NRF_SUCCESS)
-    {
-        dfu_error_notify(p_dfu, err_code);
-        return;
-    }
-
-    err_code = hci_mem_pool_rx_extract(&mp_rx_buffer, &length);
-    if (err_code != NRF_SUCCESS)
-    {
-        dfu_error_notify(p_dfu, err_code);
-        return;
-    }
-
-    dfu_update_packet_t dfu_pkt;
-
-    dfu_pkt.packet_type                      = DATA_PACKET;
-    dfu_pkt.params.data_packet.packet_length = length / sizeof(uint32_t);
-    dfu_pkt.params.data_packet.p_data_packet = (uint32_t *)mp_rx_buffer;
-
-    err_code = dfu_data_pkt_handle(&dfu_pkt);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        m_num_of_firmware_bytes_rcvd += p_evt->evt.ble_dfu_pkt_write.len;
-
-        // All the expected firmware data has been received and processed successfully.
-        // Response will be sent when flash operation for final packet is completed.
-        mp_final_packet = mp_rx_buffer;
-    }
-    else if (err_code == NRF_ERROR_INVALID_LENGTH)
-    {
-        // Firmware data packet was handled successfully. And more firmware data is expected.
-        m_num_of_firmware_bytes_rcvd += p_evt->evt.ble_dfu_pkt_write.len;
-
-        // Check if a packet receipt notification is needed to be sent.
-        if (m_pkt_rcpt_notif_enabled)
-        {
-            // Decrement the counter for the number firmware packets needed for sending the
-            // next packet receipt notification.
-            m_pkt_notif_target_cnt--;
-
-            if (m_pkt_notif_target_cnt == 0)
-            {
-                err_code = ble_dfu_pkts_rcpt_notify(p_dfu, m_num_of_firmware_bytes_rcvd);
-                APP_ERROR_CHECK(err_code);
-
-                // Reset the counter for the number of firmware packets.
-                m_pkt_notif_target_cnt = m_pkt_notif_target;
-            }
-        }
-    }
-    else
-    {
-        uint32_t hci_error = hci_mem_pool_rx_consume(mp_rx_buffer);
-        if (hci_error != NRF_SUCCESS)
-        {
-            dfu_error_notify(p_dfu, hci_error);
-        }
-
-        dfu_error_notify(p_dfu, err_code);
-    }
-}
-
-
-/**@brief     Function for processing data written by the peer to the DFU Packet Characteristic.
- *
- * @param[in] p_dfu     DFU Service Structure.
- * @param[in] p_evt     Pointer to the event received from the S110 SoftDevice.
- */
-static void on_dfu_pkt_write(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
-{
-    // The peer has written to the DFU Packet characteristic. Depending on the value of
-    // the current value of the DFU Control Point, the appropriate action is taken.
-    switch (m_pkt_type)
-    {
-        case PKT_TYPE_START:
-            // The peer has written a start packet to the DFU Packet characteristic.
-            start_data_process(p_dfu, p_evt);
-            break;
-
-        case PKT_TYPE_INIT:
-            // The peer has written an init packet to the DFU Packet characteristic.
-            init_data_process(p_dfu, p_evt);
-            break;
-
-        case PKT_TYPE_FIRMWARE_DATA:
-            app_data_process(p_dfu, p_evt);
-            break;
-
-        default:
-            // It is not possible to find out what packet it is. Ignore. There is no
-            // mechanism to notify the DFU Controller about this error condition.
-            break;
-    }
-}
-
-
-/**@brief     Function for handling a Connection Parameters error.
- *
- * @param[in] nrf_error Error code.
- */
-static void conn_params_error_handler(uint32_t nrf_error)
-{
-    APP_ERROR_HANDLER(nrf_error);
-}
-
-
-/**@brief Function for initializing the Connection Parameters module.
- */
-static void conn_params_init(void)
-{
-    uint32_t               err_code;
-    ble_conn_params_init_t cp_init;
-
-    memset(&cp_init, 0, sizeof(cp_init));
-
-    cp_init.p_conn_params                  = NULL;
-    cp_init.first_conn_params_update_delay = FIRST_CONN_PARAMS_UPDATE_DELAY;
-    cp_init.next_conn_params_update_delay  = NEXT_CONN_PARAMS_UPDATE_DELAY;
-    cp_init.max_conn_params_update_count   = MAX_CONN_PARAMS_UPDATE_COUNT;
-    cp_init.start_on_notify_cccd_handle    = BLE_GATT_HANDLE_INVALID;
-    cp_init.disconnect_on_fail             = false;
-    cp_init.evt_handler                    = NULL;
-    cp_init.error_handler                  = conn_params_error_handler;
-
-    err_code = ble_conn_params_init(&cp_init);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief     Function for the Device Firmware Update Service event handler.
- *
- * @details   This function will be called for all Device Firmware Update Service events which
- *            are passed to the application.
- *
- * @param[in] p_dfu     Device Firmware Update Service structure.
- * @param[in] p_evt     Event received from the Device Firmware Update Service.
- */
-static void on_dfu_evt(ble_dfu_t * p_dfu, ble_dfu_evt_t * p_evt)
-{
-    uint32_t           err_code;
-    ble_dfu_resp_val_t resp_val;
-
-    switch (p_evt->ble_dfu_evt_type)
-    {
-        case BLE_DFU_VALIDATE:
-            err_code = dfu_image_validate();
-
-            // Translate the err_code returned by the above function to DFU Response Value.
-            resp_val = nrf_err_code_translate(err_code, BLE_DFU_VALIDATE_PROCEDURE);
-
-            err_code = ble_dfu_response_send(p_dfu, BLE_DFU_VALIDATE_PROCEDURE, resp_val);
-            APP_ERROR_CHECK(err_code);
-            break;
-
-        case BLE_DFU_ACTIVATE_N_RESET:
-            err_code = dfu_transport_close();
-            APP_ERROR_CHECK(err_code);
-
-            // With the S110 Flash API it is safe to initiate the activate before connection is
-            // fully closed.
-            err_code = dfu_image_activate();
-            if (err_code != NRF_SUCCESS)
-            {
-                dfu_reset();
-            }
-            break;
-
-        case BLE_DFU_SYS_RESET:
-            err_code = dfu_transport_close();
-            APP_ERROR_CHECK(err_code);
-
-            dfu_reset();
-            break;
-
-        case BLE_DFU_START:
-            m_pkt_type    = PKT_TYPE_START;
-            m_update_mode = (uint8_t)p_evt->evt.ble_dfu_pkt_write.p_data[0];
-            break;
-
-        case BLE_DFU_RECEIVE_INIT_DATA:
-            m_pkt_type = PKT_TYPE_INIT;
-            if ((uint8_t)p_evt->evt.ble_dfu_pkt_write.p_data[0] == DFU_INIT_COMPLETE)
-            {
-                err_code = dfu_init_pkt_complete();
-
-                // Translate the err_code returned by the above function to DFU Response Value.
-                resp_val = nrf_err_code_translate(err_code, BLE_DFU_INIT_PROCEDURE);
-
-                err_code = ble_dfu_response_send(p_dfu, BLE_DFU_INIT_PROCEDURE, resp_val);
-                APP_ERROR_CHECK(err_code);
-            }
-            break;
-
-        case BLE_DFU_RECEIVE_APP_DATA:
-            m_pkt_type = PKT_TYPE_FIRMWARE_DATA;
-            break;
-
-        case BLE_DFU_PACKET_WRITE:
-            on_dfu_pkt_write(p_dfu, p_evt);
-            break;
-
-        case BLE_DFU_PKT_RCPT_NOTIF_ENABLED:
-            m_pkt_rcpt_notif_enabled = true;
-            m_pkt_notif_target       = p_evt->evt.pkt_rcpt_notif_req.num_of_pkts;
-            m_pkt_notif_target_cnt   = p_evt->evt.pkt_rcpt_notif_req.num_of_pkts;
-            break;
-
-        case BLE_DFU_PKT_RCPT_NOTIF_DISABLED:
-            m_pkt_rcpt_notif_enabled = false;
-            m_pkt_notif_target       = 0;
-            break;
-
-       case BLE_DFU_BYTES_RECEIVED_SEND:
-            err_code = ble_dfu_bytes_rcvd_report(p_dfu, m_num_of_firmware_bytes_rcvd);
-            APP_ERROR_CHECK(err_code);
-            break;
-
-        default:
-            // Unsupported event received from DFU Service. Ignore.
-            break;
-    }
-}
-
-
-/**@brief     Function for the Advertising functionality initialization.
- *
- * @details   Encodes the required advertising data and passes it to the stack.
- *            Also builds a structure to be passed to the stack when starting advertising.
- */
-static void advertising_init(uint8_t adv_flags)
-{
-    uint32_t      err_code;
-    ble_advdata_t advdata;
-    ble_uuid_t    service_uuid;
-
-    service_uuid.type = m_dfu.uuid_type;
-    service_uuid.uuid = BLE_DFU_SERVICE_UUID;
-
-    // Build and set advertising data.
-    memset(&advdata, 0, sizeof(advdata));
-
-    advdata.name_type                     = BLE_ADVDATA_FULL_NAME;
-    advdata.include_appearance            = false;
-    advdata.flags                         = adv_flags;
-    advdata.uuids_more_available.uuid_cnt = 1;
-    advdata.uuids_more_available.p_uuids  = &service_uuid;
-
-    err_code = ble_advdata_set(&advdata, NULL);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief Function for starting advertising.
- */
-static void advertising_start(void)
-{
-    if (!m_is_advertising)
-    {
-        uint32_t err_code;
-
-        // Initialize advertising parameters (used when starting advertising).
-        memset(&m_adv_params, 0, sizeof(m_adv_params));
-
-        if (m_ble_peer_data_valid)
-        {
-            ble_gap_irk_t empty_irk = {{0}};
-
-            if (memcmp(m_ble_peer_data.irk.irk, empty_irk.irk, sizeof(empty_irk.irk)) == 0)
-            {
-                advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
-                m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND;
-                m_adv_params.p_peer_addr = &m_ble_peer_data.addr;
-                m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
-                m_adv_params.interval    = 0;
-                m_adv_params.timeout     = 0;
-            }
-            else
-            {
-                ble_gap_irk_t  * p_irk[1];
-                ble_gap_addr_t * p_addr[1];
-
-                p_irk[0]  = &m_ble_peer_data.irk;
-                p_addr[0] = &m_ble_peer_data.addr;
-
-                ble_gap_whitelist_t whitelist;
-                whitelist.addr_count = 1;
-                whitelist.pp_addrs   = p_addr;
-                whitelist.irk_count  = 1;
-                whitelist.pp_irks    = p_irk;
-
-                advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
-                m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
-                m_adv_params.fp          = BLE_GAP_ADV_FP_FILTER_CONNREQ;
-                m_adv_params.p_whitelist = &whitelist;
-                m_adv_params.interval    = APP_ADV_INTERVAL;
-                m_adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
-            }
-        }
-        else
-        {
-            advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
-            m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
-            m_adv_params.p_peer_addr = NULL;
-            m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
-            m_adv_params.interval    = APP_ADV_INTERVAL;
-            m_adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
-        }
-
-        err_code = sd_ble_gap_adv_start(&m_adv_params);
-        APP_ERROR_CHECK(err_code);
-
-        nrf_gpio_pin_clear(ADVERTISING_LED_PIN_NO);
-
-        m_is_advertising = true;
-    }
-}
-
-
-/**@brief Function for stopping advertising.
- */
-static void advertising_stop(void)
-{
-    if (m_is_advertising)
-    {
-        uint32_t err_code;
-
-        err_code = sd_ble_gap_adv_stop();
-        APP_ERROR_CHECK(err_code);
-
-        nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
-
-        m_is_advertising = false;
-    }
-}
-
-
-/**@brief Function for the Application's S110 SoftDevice event handler.
- *
- * @param[in] p_ble_evt S110 SoftDevice event.
- */
-static void on_ble_evt(ble_evt_t * p_ble_evt)
-{
-    uint32_t                              err_code;
-    ble_gatts_rw_authorize_reply_params_t auth_reply;
-
-    switch (p_ble_evt->header.evt_id)
-    {
-        case BLE_GAP_EVT_CONNECTED:
-            nrf_gpio_pin_clear(CONNECTED_LED_PIN_NO);
-            nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
-
-            m_conn_handle    = p_ble_evt->evt.gap_evt.conn_handle;
-            m_is_advertising = false;
-            break;
-
-        case BLE_GAP_EVT_DISCONNECTED:
-            {
-                uint8_t  sys_attr[128];
-                uint16_t sys_attr_len = 128;
-            
-                m_direct_adv_cnt = APP_DIRECTED_ADV_TIMEOUT;
-                nrf_gpio_pin_set(CONNECTED_LED_PIN_NO);
-        
-                err_code = sd_ble_gatts_sys_attr_get(m_conn_handle, 
-                                                     sys_attr, 
-                                                     &sys_attr_len, 
-                                                     BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
-                APP_ERROR_CHECK(err_code);
-
-            }
-            if (!m_tear_down_in_progress)
-            {
-                // The Disconnected event is because of an external event. (Link loss or
-                // disconnect triggered by the DFU Controller before the firmware update was
-                // complete).
-                // Restart advertising so that the DFU Controller can reconnect if possible.
-                advertising_start();
-            }
-
-            m_conn_handle = BLE_CONN_HANDLE_INVALID;
-
-            break;
-
-        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
-            {
-                ble_gap_sec_keyset_t keys;
-                ble_gap_enc_key_t    enc_key;
-                ble_gap_id_key_t     id_key;
-
-                id_key.id_addr_info = m_ble_peer_data.addr;
-                id_key.id_info      = m_ble_peer_data.irk;
-                enc_key             = m_ble_peer_data.enc_key;
-
-                keys.keys_peer.p_id_key  = &id_key;
-                keys.keys_peer.p_enc_key = &enc_key;
-
-                err_code = sd_ble_gap_sec_params_reply(m_conn_handle,
-                                                       BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP,
-                                                       &m_sec_params,
-                                                       &keys);
-                APP_ERROR_CHECK(err_code);
-            }
-            break;
-
-        case BLE_GATTS_EVT_TIMEOUT:
-            if (p_ble_evt->evt.gatts_evt.params.timeout.src == BLE_GATT_TIMEOUT_SRC_PROTOCOL)
-            {
-                err_code = sd_ble_gap_disconnect(m_conn_handle,
-                                                 BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
-                APP_ERROR_CHECK(err_code);
-            }
-            break;
-
-        case BLE_GAP_EVT_TIMEOUT:
-            if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISING)
-            {
-                m_is_advertising = false;
-                m_direct_adv_cnt--;
-                if (m_direct_adv_cnt == 0)
-                {
-                    dfu_update_status_t update_status = {.status_code = DFU_TIMEOUT};
-                    bootloader_dfu_update_process(update_status);
-                }
-                else
-                {
-                    advertising_start();
-                }
-            }
-            break;
-
-        case BLE_EVT_USER_MEM_REQUEST:
-            err_code = sd_ble_user_mem_reply(m_conn_handle, NULL);
-            APP_ERROR_CHECK(err_code);
-            break;
-
-        case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
-            if (p_ble_evt->evt.gatts_evt.params.authorize_request.type
-                != BLE_GATTS_AUTHORIZE_TYPE_INVALID)
-            {
-                if ((p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op
-                     == BLE_GATTS_OP_PREP_WRITE_REQ)
-                    || (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op
-                        == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)
-                    || (p_ble_evt->evt.gatts_evt.params.authorize_request.request.write.op
-                        == BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL))
-                {
-                    if (p_ble_evt->evt.gatts_evt.params.authorize_request.type
-                        == BLE_GATTS_AUTHORIZE_TYPE_WRITE)
-                    {
-                        auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_WRITE;
-                    }
-                    else
-                    {
-                        auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
-                    }
-                    auth_reply.params.write.gatt_status = APP_FEATURE_NOT_SUPPORTED;
-
-                    err_code = sd_ble_gatts_rw_authorize_reply(m_conn_handle,&auth_reply);
-                    APP_ERROR_CHECK(err_code);
-                }
-            }
-            break;
-
-        case BLE_GAP_EVT_SEC_INFO_REQUEST:
-            {
-                ble_gap_enc_info_t * p_enc_info = NULL;
-
-                // If there is a match in diversifier then set the correct keys.
-                if (p_ble_evt->evt.gap_evt.params.sec_info_request.master_id.ediv == 
-                    m_ble_peer_data.enc_key.master_id.ediv)
-                {
-                    p_enc_info = &m_ble_peer_data.enc_key.enc_info;
-                }
-
-                err_code = sd_ble_gap_sec_info_reply(p_ble_evt->evt.gap_evt.conn_handle,
-                                                     p_enc_info,
-                                                     &m_ble_peer_data.irk,
-                                                     NULL);
-                APP_ERROR_CHECK(err_code);
-            }
-            break;
-
-        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
-        case BLE_GAP_EVT_CONN_SEC_UPDATE:
-            err_code = service_change_indicate();
-            APP_ERROR_CHECK(err_code);
-            break;
-
-        case BLE_GAP_EVT_AUTH_STATUS:
-            // No implementation needed.
-            break;
-
-        default:
-            // No implementation needed.
-            break;
-    }
-}
-
-
-/**@brief     Function for dispatching a S110 SoftDevice event to all modules with a S110
- *            SoftDevice event handler.
- *
- * @details   This function is called from the S110 SoftDevice event interrupt handler after a
- *            S110 SoftDevice event has been received.
- *
- * @param[in] p_ble_evt S110 SoftDevice event.
- */
-static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
-{
-    ble_conn_params_on_ble_evt(p_ble_evt);
-    ble_dfu_on_ble_evt(&m_dfu, p_ble_evt);
-    on_ble_evt(p_ble_evt);
-}
-
-
-/**@brief       Function for the LEDs initialization.
- *
- * @details     Initializes all LEDs used by this application.
- */
-static void leds_init(void)
-{
-    nrf_gpio_cfg_output(ADVERTISING_LED_PIN_NO);
-    nrf_gpio_cfg_output(CONNECTED_LED_PIN_NO);
-    nrf_gpio_pin_set(ADVERTISING_LED_PIN_NO);
-    nrf_gpio_pin_set(CONNECTED_LED_PIN_NO);
-}
-
-
-/**@brief     Function for the GAP initialization.
- *
- * @details   This function will setup all the necessary GAP (Generic Access Profile) parameters of
- *            the device. It also sets the permissions and appearance.
- */
-static void gap_params_init(void)
-{
-    uint32_t                err_code;
-    ble_gap_conn_params_t   gap_conn_params;
-    ble_gap_conn_sec_mode_t sec_mode;
-
-    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
-
-    err_code = sd_ble_gap_device_name_set(&sec_mode,
-                                          (const uint8_t *)DEVICE_NAME,
-                                          strlen(DEVICE_NAME));
-    APP_ERROR_CHECK(err_code);
-
-    memset(&gap_conn_params, 0, sizeof(gap_conn_params));
-
-    gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
-    gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
-    gap_conn_params.slave_latency     = SLAVE_LATENCY;
-    gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;
-
-    err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief     Function for handling Service errors.
- *
- * @details   A pointer to this function will be passed to the DFU service which may need to inform
- *            the application about an error.
- *
- * @param[in] nrf_error Error code containing information about what went wrong.
- */
-static void service_error_handler(uint32_t nrf_error)
-{
-    APP_ERROR_HANDLER(nrf_error);
-}
-
-
-/**@brief     Function for initializing services that will be used by the application.
- */
-static void services_init(void)
-{
-    uint32_t       err_code;
-    ble_dfu_init_t dfu_init_obj;
-
-    // Initialize the Device Firmware Update Service.
-    memset(&dfu_init_obj, 0, sizeof(dfu_init_obj));
-
-    dfu_init_obj.revision      = DFU_REVISION;
-    dfu_init_obj.evt_handler   = on_dfu_evt;
-    dfu_init_obj.error_handler = service_error_handler;
-
-    err_code = ble_dfu_init(&m_dfu, &dfu_init_obj);
-
-    APP_ERROR_CHECK(err_code);
-}
-
-
-/**@brief Function for initializing security parameters.
- */
-static void sec_params_init(void)
-{
-    m_sec_params.bond         = SEC_PARAM_BOND;
-    m_sec_params.mitm         = SEC_PARAM_MITM;
-    m_sec_params.lesc         = SEC_PARAM_LESC;
-    m_sec_params.keypress     = SEC_PARAM_KEYPRESS;
-    m_sec_params.io_caps      = SEC_PARAM_IO_CAPABILITIES;
-    m_sec_params.oob          = SEC_PARAM_OOB;
-    m_sec_params.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
-    m_sec_params.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
-}
-
-
-uint32_t dfu_transport_update_start(void)
-{
-    uint32_t err_code;
-
-    m_tear_down_in_progress = false;
-    m_pkt_type              = PKT_TYPE_INVALID;
-
-    leds_init();
-
-    err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
-    VERIFY_SUCCESS(err_code);
-
-    dfu_register_callback(dfu_cb_handler);
-
-    err_code = hci_mem_pool_open();
-    VERIFY_SUCCESS(err_code);
-
-    err_code = dfu_ble_peer_data_get(&m_ble_peer_data);
-    if (err_code == NRF_SUCCESS)
-    {
-        m_ble_peer_data_valid = true;
-    }
-    else
-    {
-        ble_gap_addr_t addr;
-
-        err_code = sd_ble_gap_address_get(&addr);
-        APP_ERROR_CHECK(err_code);
-
-        // Increase the BLE address by one when advertising openly.
-        addr.addr[0] += 1;
-
-        err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr);
-        APP_ERROR_CHECK(err_code);
-    }
-
-    gap_params_init();
-    services_init();
-    conn_params_init();
-    sec_params_init();
-    advertising_start();
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_transport_close()
-{
-    uint32_t err_code;
-
-    m_tear_down_in_progress = true;
-
-    if (IS_CONNECTED())
-    {
-        // Disconnect from peer.
-        err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
-        APP_ERROR_CHECK(err_code);
-    }
-    else
-    {
-        // If not connected, then the device will be advertising. Hence stop the advertising.
-        advertising_stop();
-    }
-
-    err_code = ble_conn_params_stop();
-    APP_ERROR_CHECK(err_code);
-
-    return NRF_SUCCESS;
-}


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

Posted by cc...@apache.org.
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/spi_master/spi_5W_master.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/spi_5W_master.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/spi_5W_master.c
deleted file mode 100644
index 8811d55..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/spi_5W_master.c
+++ /dev/null
@@ -1,602 +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 ser_phy_spi_5W_hw_driver_master spi_5W_master.c
- * @{
- * @ingroup ser_phy_spi_5W_hw_driver_master
- *
- * @brief SPI_5W_RAW hardware driver.
- */
-
-#include "app_error.h"
-#include "app_util_platform.h"
-#include "nrf_gpio.h"
-#include "nrf.h"
-#include "spi_5W_master.h"
-#include "ser_config_5W_app.h"
-#include "ser_phy_debug_app.h"
-#include "sdk_common.h"
-
-
-#define _static
-
-#define DOUBLE_BUFFERED /**< A flag for enabling double buffering. */
-
-#define SPI_PIN_DISCONNECTED 0xFFFFFFFF /**< A value used to the PIN deinitialization. */
-#define SPI_DEFAULT_TX_BYTE  0x00       /**< Default byte (used to clock transmission
-                                             from slave to the master) */
-
-typedef struct
-{
-    NRF_SPI_Type * p_nrf_spi; /**< A pointer to the NRF SPI master */
-    IRQn_Type      irq_type;  /**< A type of NVIC IRQn */
-
-    uint8_t * p_tx_buffer; /**< A pointer to TX buffer. */
-    uint16_t  tx_length;   /**< A length of TX buffer. */
-    uint16_t  tx_index;    /**< A index of the current element in the TX buffer. */
-
-    uint8_t * p_rx_buffer; /**< A pointer to RX buffer. */
-    uint16_t  rx_length;   /**< A length RX buffer. */
-    uint16_t  rx_index;    /**< A index of the current element in the RX buffer. */
-
-    uint16_t max_length; /**< Max length (Max of the TX and RX length). */
-    uint16_t bytes_count;
-    uint8_t  pin_slave_select; /**< A pin for Slave Select. */
-
-    spi_master_event_handler_t callback_event_handler; /**< A handler for event callback function. */
-    spi_master_state_t         state;                  /**< A state of an instance of SPI master. */
-    bool                       start_flag;
-    bool                       abort_flag;
-
-} spi_master_instance_t;
-
-#ifdef _SPI_5W_
-typedef enum
-{
-    HOOK_STATE_DISABLED,
-    HOOK_STATE_IDLE,
-    HOOK_STATE_GUARDED,
-    HOOK_STATE_ABORTED,
-    HOOK_STATE_RESTARTED,
-    HOOK_STATE_PASSING
-} spi_hook_state_t;
-
-
-_static spi_master_event_handler_t m_ser_phy_event_handler;
-_static spi_master_hw_instance_t   m_spi_master_hw_instance;
-_static spi_hook_state_t           m_hook_state = HOOK_STATE_DISABLED;
-#endif
-
-#ifdef SER_PHY_DEBUG_APP_ENABLE
-_static spi_master_raw_callback_t m_debug_callback;
-#endif
-
-_static spi_master_instance_t m_spi_master_instances[SPI_MASTER_HW_ENABLED_COUNT];
-
-static __INLINE spi_master_instance_t * spi_master_get_instance(
-    const spi_master_hw_instance_t spi_master_hw_instance);
-static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance);
-static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance,
-                                           spi_master_evt_type_t         event_type,
-                                           const uint16_t                data);
-
-#ifdef SPI_MASTER_0_ENABLE
-/**
- * @brief SPI0 interrupt handler.
- */
-void SPI0_TWI0_IRQHandler(void)
-{
-    if (NRF_SPI0->EVENTS_READY != 0)
-    {
-        NRF_SPI0->EVENTS_READY = 0;
-
-        spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_0);
-
-        spi_master_send_recv_irq(p_spi_instance);
-    }
-}
-#endif //SPI_MASTER_0_ENABLE
-
-#ifdef SPI_MASTER_1_ENABLE
-/**
- * @brief SPI0 interrupt handler.
- */
-void SPI1_TWI1_IRQHandler(void)
-{
-    if (NRF_SPI1->EVENTS_READY != 0)
-    {
-        NRF_SPI1->EVENTS_READY = 0;
-
-        spi_master_instance_t * p_spi_instance = spi_master_get_instance(SPI_MASTER_1);
-
-        spi_master_send_recv_irq(p_spi_instance);
-    }
-}
-#endif //SPI_MASTER_1_ENABLE
-
-#if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-
-/**@brief Function for getting an instance of SPI master. */
-static __INLINE spi_master_instance_t * spi_master_get_instance(
-    const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    return &(m_spi_master_instances[(uint8_t)spi_master_hw_instance]);
-}
-
-/** @brief Function for initializing instance of SPI master by default values. */
-static __INLINE void spi_master_init_hw_instance(NRF_SPI_Type *          p_nrf_spi,
-                                                 IRQn_Type               irq_type,
-                                                 spi_master_instance_t * p_spi_instance)
-{
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-
-    p_spi_instance->p_nrf_spi = p_nrf_spi;
-    p_spi_instance->irq_type  = irq_type;
-
-    p_spi_instance->p_tx_buffer = NULL;
-    p_spi_instance->tx_length   = 0;
-    p_spi_instance->tx_index    = 0;
-
-    p_spi_instance->p_rx_buffer = NULL;
-    p_spi_instance->rx_length   = 0;
-    p_spi_instance->rx_index    = 0;
-
-    p_spi_instance->bytes_count      = 0;
-    p_spi_instance->max_length       = 0;
-    p_spi_instance->pin_slave_select = 0;
-
-    p_spi_instance->callback_event_handler = NULL;
-
-    p_spi_instance->state      = SPI_MASTER_STATE_DISABLED;
-    p_spi_instance->abort_flag = false;
-    p_spi_instance->start_flag = false;
-}
-
-/**@brief Function for initializing TX or RX buffer. */
-static __INLINE void spi_master_buffer_init(uint8_t * const  p_buf,
-                                            const uint16_t   buf_len,
-                                            uint8_t * *      pp_buf,
-                                            uint16_t * const p_buf_len,
-                                            uint16_t * const p_index)
-{
-    APP_ERROR_CHECK_BOOL(pp_buf != NULL);
-    APP_ERROR_CHECK_BOOL(p_buf_len != NULL);
-    APP_ERROR_CHECK_BOOL(p_index != NULL);
-
-    *pp_buf    = p_buf;
-    *p_buf_len = (p_buf != NULL) ? buf_len : 0;
-    *p_index   = 0;
-}
-
-/**@brief Function for releasing TX or RX buffer. */
-static __INLINE void spi_master_buffer_release(uint8_t * * const pp_buf, uint16_t * const p_buf_len)
-{
-    APP_ERROR_CHECK_BOOL(pp_buf != NULL);
-    APP_ERROR_CHECK_BOOL(p_buf_len != NULL);
-
-    *pp_buf    = NULL;
-    *p_buf_len = 0;
-}
-
-/**@brief Function for sending events by callback. */
-static __INLINE void spi_master_signal_evt(spi_master_instance_t * const p_spi_instance,
-                                           spi_master_evt_type_t         event_type,
-                                           const uint16_t                data)
-{
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-
-    if (p_spi_instance->callback_event_handler != NULL)
-    {
-        spi_master_evt_t event = {SPI_MASTER_EVT_TYPE_MAX, 0};
-        event.type = event_type;
-        event.data = data;
-        p_spi_instance->callback_event_handler(event);
-    }
-}
-
-/**@brief Function insert to a TX buffer another byte or two bytes (depends on flag @ref DOUBLE_BUFFERED). */
-static __INLINE void spi_master_send_initial_bytes(spi_master_instance_t * const p_spi_instance)
-{
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-
-    p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) &&
-                                      (p_spi_instance->tx_index < p_spi_instance->tx_length)) ?
-                                     p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] :
-                                     SPI_DEFAULT_TX_BYTE;
-    (p_spi_instance->tx_index)++;
-
-    #ifdef DOUBLE_BUFFERED
-
-    if (p_spi_instance->tx_index < p_spi_instance->max_length)
-    {
-        p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) &&
-                                          (p_spi_instance->tx_index < p_spi_instance->tx_length)) ?
-                                         p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] :
-                                         SPI_DEFAULT_TX_BYTE;
-        (p_spi_instance->tx_index)++;
-    }
-    #endif
-}
-
-/**@brief Function for receiving and sending data from IRQ. (The same for both IRQs). */
-static __INLINE void spi_master_send_recv_irq(spi_master_instance_t * const p_spi_instance)
-{
-
-    uint8_t rx_byte;
-
-    APP_ERROR_CHECK_BOOL(p_spi_instance != NULL);
-    APP_ERROR_CHECK_BOOL(p_spi_instance->state == SPI_MASTER_STATE_BUSY);
-
-    p_spi_instance->bytes_count++;
-    rx_byte = p_spi_instance->p_nrf_spi->RXD;
-
-    if (p_spi_instance->start_flag)
-    {
-        p_spi_instance->start_flag = false;
-        spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_FIRST_BYTE_RECEIVED, (uint16_t)rx_byte);
-    }
-    else if (p_spi_instance->abort_flag  ) //this is tricky, but callback for SPI_MASTER_EVT_FIRST_BYTE_RECEIVED will set this flag for a first byte, which is bad because there is still byte in a buffer
-    {                                      //and for a single byte transaction you will get XFERDONE event to restart
-        p_spi_instance->abort_flag = false;
-        p_spi_instance->state      = SPI_MASTER_STATE_ABORTED;
-        nrf_gpio_pin_set(p_spi_instance->pin_slave_select);
-        spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_ABORTED, 0);
-        return;
-    }
-
-    if ((p_spi_instance->p_rx_buffer != NULL) &&
-        (p_spi_instance->rx_index < p_spi_instance->rx_length))
-    {
-        p_spi_instance->p_rx_buffer[p_spi_instance->rx_index++] = rx_byte;
-    }
-
-    if ((p_spi_instance->tx_index < p_spi_instance->max_length) && (!(p_spi_instance->abort_flag))) //do not TX if you know that there is an abort to be done - this should work for a DOUBLE BUFFERING ???
-    {
-        p_spi_instance->p_nrf_spi->TXD = ((p_spi_instance->p_tx_buffer != NULL) &&
-                                          (p_spi_instance->tx_index < p_spi_instance->tx_length)) ?
-                                         p_spi_instance->p_tx_buffer[p_spi_instance->tx_index] :
-                                         SPI_DEFAULT_TX_BYTE;
-        (p_spi_instance->tx_index)++;
-    }
-
-    if (p_spi_instance->bytes_count >= p_spi_instance->max_length)
-    {
-        APP_ERROR_CHECK_BOOL(p_spi_instance->bytes_count == p_spi_instance->max_length);
-        nrf_gpio_pin_set(p_spi_instance->pin_slave_select);
-        p_spi_instance->state = SPI_MASTER_STATE_IDLE;
-        spi_master_signal_evt(p_spi_instance,
-                              SPI_MASTER_EVT_TRANSFER_COMPLETED,
-                              p_spi_instance->tx_index);
-    }
-    return;
-}
-#endif //defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-
-
-/**
- * @brief Function for opening and initializing a SPI master driver. */
-uint32_t spi_master_open(const spi_master_hw_instance_t    spi_master_hw_instance,
-                         spi_master_config_t const * const p_spi_master_config)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-
-
-    VERIFY_PARAM_NOT_NULL(p_spi_master_config);
-
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    switch (spi_master_hw_instance)
-    {
-    #ifdef SPI_MASTER_0_ENABLE
-        case SPI_MASTER_0:
-            spi_master_init_hw_instance(NRF_SPI0, SPI0_TWI0_IRQn, p_spi_instance);
-            break;
-    #endif //SPI_MASTER_0_ENABLE
-
-    #ifdef SPI_MASTER_1_ENABLE
-        case SPI_MASTER_1:
-            spi_master_init_hw_instance(NRF_SPI1, SPI1_TWI1_IRQn, p_spi_instance);
-            break;
-    #endif //SPI_MASTER_1_ENABLE
-
-        default:
-            break;
-    }
-
-    //A Slave select must be set as high before setting it as output,
-    //because during connect it to the pin it causes glitches.
-    nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS);
-    nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SS);
-    nrf_gpio_pin_set(p_spi_master_config->SPI_Pin_SS);
-
-    //Configure GPIO
-    nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_SCK);
-    nrf_gpio_cfg_output(p_spi_master_config->SPI_Pin_MOSI);
-    nrf_gpio_cfg_input(p_spi_master_config->SPI_Pin_MISO, NRF_GPIO_PIN_NOPULL);
-    p_spi_instance->pin_slave_select = p_spi_master_config->SPI_Pin_SS;
-
-    /* Configure SPI hardware */
-    p_spi_instance->p_nrf_spi->PSELSCK  = p_spi_master_config->SPI_Pin_SCK;
-    p_spi_instance->p_nrf_spi->PSELMOSI = p_spi_master_config->SPI_Pin_MOSI;
-    p_spi_instance->p_nrf_spi->PSELMISO = p_spi_master_config->SPI_Pin_MISO;
-
-    p_spi_instance->p_nrf_spi->FREQUENCY = p_spi_master_config->SPI_Freq;
-
-    p_spi_instance->p_nrf_spi->CONFIG =
-        (uint32_t)(p_spi_master_config->SPI_CPHA << SPI_CONFIG_CPHA_Pos) |
-        (p_spi_master_config->SPI_CPOL << SPI_CONFIG_CPOL_Pos) |
-        (p_spi_master_config->SPI_ORDER << SPI_CONFIG_ORDER_Pos);
-
-
-    /* Clear waiting interrupts and events */
-    p_spi_instance->p_nrf_spi->EVENTS_READY = 0;
-
-    NVIC_ClearPendingIRQ(p_spi_instance->irq_type);
-    NVIC_SetPriority(p_spi_instance->irq_type, APP_IRQ_PRIORITY_MID);
-
-    /* Clear event handler */
-    p_spi_instance->callback_event_handler = NULL;
-
-    /* Enable interrupt */
-    p_spi_instance->p_nrf_spi->INTENSET = (SPI_INTENSET_READY_Set << SPI_INTENCLR_READY_Pos);
-    NVIC_EnableIRQ(p_spi_instance->irq_type);
-
-    /* Enable SPI hardware */
-    p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Enabled << SPI_ENABLE_ENABLE_Pos);
-
-    /* Change state to IDLE */
-    p_spi_instance->state = SPI_MASTER_STATE_IDLE;
-
-    return NRF_SUCCESS;
-    #else
-    return NRF_ERROR_NOT_SUPPORTED;
-    #endif
-}
-
-/**
- * @brief Function for closing a SPI master driver.
- */
-void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    /* Disable interrupt */
-    NVIC_ClearPendingIRQ(p_spi_instance->irq_type);
-    NVIC_DisableIRQ(p_spi_instance->irq_type);
-
-    p_spi_instance->p_nrf_spi->ENABLE = (SPI_ENABLE_ENABLE_Disabled << SPI_ENABLE_ENABLE_Pos);
-
-    /* Set Slave Select pin as input with pull-up. */
-    nrf_gpio_pin_set(p_spi_instance->pin_slave_select);
-    nrf_gpio_cfg_input(p_spi_instance->pin_slave_select, NRF_GPIO_PIN_PULLUP);
-    p_spi_instance->pin_slave_select = (uint8_t)0xFF;
-
-    /* Disconnect pins from SPI hardware */
-    p_spi_instance->p_nrf_spi->PSELSCK  = (uint32_t)SPI_PIN_DISCONNECTED;
-    p_spi_instance->p_nrf_spi->PSELMOSI = (uint32_t)SPI_PIN_DISCONNECTED;
-    p_spi_instance->p_nrf_spi->PSELMISO = (uint32_t)SPI_PIN_DISCONNECTED;
-
-    /* Reset to default values */
-    spi_master_init_hw_instance(NULL, (IRQn_Type)0, p_spi_instance);
-    #else
-    return;
-    #endif
-}
-
-/**
- * @brief Function for getting current state of the SPI master driver.
- */
-__INLINE spi_master_state_t spi_master_get_state(
-    const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance);
-    return spi_instance->state;
-    #else
-    return SPI_MASTER_STATE_DISABLED;
-    #endif
-}
-
-/**
- * @brief Function for event handler registration.
- */
-__INLINE void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                         spi_master_event_handler_t     event_handler)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * spi_instance = spi_master_get_instance(spi_master_hw_instance);
-    spi_instance->callback_event_handler = event_handler;
-    #else
-    return;
-    #endif
-}
-
-/**
- * @brief Function for transmitting data between SPI master and SPI slave.
- */
-uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance,
-                              uint8_t * const p_tx_buf, const uint16_t tx_buf_len,
-                              uint8_t * const p_rx_buf, const uint16_t rx_buf_len)
-{
-    #if defined(SPI_MASTER_0_ENABLE) || defined(SPI_MASTER_1_ENABLE)
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    uint32_t err_code   = NRF_SUCCESS;
-    uint16_t max_length = 0;
-
-    if (p_spi_instance->state == SPI_MASTER_STATE_IDLE)
-    {
-        NVIC_DisableIRQ(p_spi_instance->irq_type);
-
-        max_length = (rx_buf_len > tx_buf_len) ? rx_buf_len : tx_buf_len;
-
-        if (max_length > 0)
-        {
-            p_spi_instance->state       = SPI_MASTER_STATE_BUSY;
-            p_spi_instance->start_flag  = true; //abort_flag should set by abort and cleared only by restart
-            p_spi_instance->bytes_count = 0;
-            p_spi_instance->max_length  = max_length;
-            spi_master_buffer_release(&(p_spi_instance->p_tx_buffer), &(p_spi_instance->tx_length));
-            spi_master_buffer_release(&(p_spi_instance->p_rx_buffer), &(p_spi_instance->rx_length));
-            /* Initialize buffers */
-            spi_master_buffer_init(p_tx_buf, tx_buf_len, &(p_spi_instance->p_tx_buffer),
-                                   &(p_spi_instance->tx_length), &(p_spi_instance->tx_index));
-            spi_master_buffer_init(p_rx_buf, rx_buf_len, &(p_spi_instance->p_rx_buffer),
-                                   &(p_spi_instance->rx_length), &(p_spi_instance->rx_index));
-            nrf_gpio_pin_clear(p_spi_instance->pin_slave_select);
-            spi_master_send_initial_bytes(p_spi_instance);
-            spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_STARTED, max_length);
-        }
-        else
-        {
-            err_code = NRF_ERROR_INVALID_PARAM;
-        }
-
-        NVIC_EnableIRQ(p_spi_instance->irq_type);
-    }
-    else
-    {
-        err_code = NRF_ERROR_BUSY;
-    }
-
-    return err_code;
-    #else
-    return NRF_ERROR_NOT_SUPPORTED;
-    #endif
-}
-
-#ifdef _SPI_5W_
-
-/**
- * @brief Function for aborting transfer
- */
-uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    NVIC_DisableIRQ(p_spi_instance->irq_type);
-
-    if (p_spi_instance->state == SPI_MASTER_STATE_BUSY)
-    {
-        //set_flag - but only when there are events pending
-        //ignore when in IDLE - must be able to restart a completed transfer
-        p_spi_instance->abort_flag = true;
-    }
-    NVIC_EnableIRQ(p_spi_instance->irq_type);
-    return NRF_SUCCESS;
-}
-
-/**
- * @brief Function for restarting transfer
- */
-uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance)
-{
-    spi_master_instance_t * p_spi_instance = spi_master_get_instance(spi_master_hw_instance);
-
-    NVIC_DisableIRQ(p_spi_instance->irq_type);
-    spi_master_signal_evt(p_spi_instance, SPI_MASTER_EVT_TRANSFER_RESTARTED, 0);
-    p_spi_instance->state       = SPI_MASTER_STATE_BUSY;
-    p_spi_instance->bytes_count = 0;
-    p_spi_instance->tx_index    = 0;
-    p_spi_instance->rx_index    = 0;
-    p_spi_instance->start_flag  = true;
-    p_spi_instance->abort_flag  = false; //you should force clearing abort flag - no other way for 1 byte transfer
-    nrf_gpio_pin_clear(p_spi_instance->pin_slave_select);
-    spi_master_send_initial_bytes(p_spi_instance);
-    NVIC_EnableIRQ(p_spi_instance->irq_type);
-
-    return NRF_SUCCESS;
-}
-
-static void spi_5W_master_event_handler(spi_master_evt_t evt)
-{
-
-    switch (m_hook_state)
-    {
-        case HOOK_STATE_IDLE:
-
-            if (evt.type == SPI_MASTER_EVT_TRANSFER_STARTED)
-            {
-                DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0);
-                m_hook_state = HOOK_STATE_GUARDED;
-                m_ser_phy_event_handler(evt);
-            }
-            break;
-
-        case HOOK_STATE_GUARDED:
-
-            if (evt.type == SPI_MASTER_EVT_FIRST_BYTE_RECEIVED)
-            {
-                if (evt.data == 0)
-                {
-                    DEBUG_EVT_SPI_MASTER_RAW_XFER_PASSED(0);
-                    m_hook_state = HOOK_STATE_PASSING;
-                }
-                else
-                {
-                    DEBUG_EVT_SPI_MASTER_RAW_XFER_ABORTED(0);
-                    m_hook_state = HOOK_STATE_ABORTED;
-                    (void)spi_master_abort(m_spi_master_hw_instance);
-                }
-            }
-            break;
-
-        case HOOK_STATE_ABORTED:
-
-            if ((evt.type == SPI_MASTER_EVT_TRANSFER_ABORTED) ||
-                (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED))
-            {
-                DEBUG_EVT_SPI_MASTER_RAW_XFER_RESTARTED(0);
-                m_hook_state = HOOK_STATE_RESTARTED;
-                (void)spi_master_restart(m_spi_master_hw_instance);
-            }
-            break;
-
-        case HOOK_STATE_RESTARTED:
-
-            if (evt.type == SPI_MASTER_EVT_TRANSFER_RESTARTED)
-            {
-                DEBUG_EVT_SPI_MASTER_RAW_XFER_GUARDED(0);
-                m_hook_state = HOOK_STATE_GUARDED;
-            }
-            break;
-
-        case HOOK_STATE_PASSING:
-
-            if (evt.type == SPI_MASTER_EVT_TRANSFER_COMPLETED)
-            {
-                m_hook_state = HOOK_STATE_IDLE;
-                m_ser_phy_event_handler(evt); //this is the only way to get a signal from complete transaction
-            }
-            break;
-
-        default:
-            break;
-    }
-}
-
-void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                   spi_master_event_handler_t     event_handler)
-{
-    m_ser_phy_event_handler  = event_handler;
-    m_spi_master_hw_instance = spi_master_hw_instance;
-    m_hook_state             = HOOK_STATE_IDLE;
-    spi_master_evt_handler_reg(spi_master_hw_instance, spi_5W_master_event_handler);
-    return;
-}
-
-#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/drivers_nrf/spi_master/spi_5W_master.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/spi_5W_master.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/spi_5W_master.h
deleted file mode 100644
index 501eeff..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/spi_5W_master.h
+++ /dev/null
@@ -1,178 +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.
- *
- */
- 
-#ifndef APP_SPI_MASTER_H
-#define APP_SPI_MASTER_H
-
-#include <stdint.h>
-#include <stdlib.h>
-#include "boards.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define _SPI_5W_
-
-/**@brief Struct containing configuration parameters of the SPI master. */
-typedef struct
-{
-    uint32_t SPI_Freq;      /**< SPI frequency. */
-    uint32_t SPI_Pin_SCK;   /**< SCK pin number. */
-    uint32_t SPI_Pin_MISO;  /**< MISO pin number. */
-    uint32_t SPI_Pin_MOSI;  /**< MOSI pin number .*/
-    uint32_t SPI_Pin_SS;    /**< Slave select pin number. */
-    uint8_t SPI_ORDER;      /**< Bytes order MSBFIRST or LSBFIRST. */
-    uint8_t SPI_CPOL;       /**< Serial clock polarity ACTIVEHIGH or ACTIVELOW. */
-    uint8_t SPI_CPHA;       /**< Serial clock phase LEADING or TRAILING. */
- } spi_master_config_t;
-
-/**@brief SPI master driver events types. */
-typedef enum
-{
-    SPI_MASTER_EVT_TRANSFER_STARTED = 0, /**< An event indicating that transfer has been started */
-    SPI_MASTER_EVT_TRANSFER_COMPLETED,   /**< An event indicating that transfer has been completed */
-    SPI_MASTER_EVT_TRANSFER_ABORTED,   /**< An event indicating that transfer has been aborted */
-    SPI_MASTER_EVT_TRANSFER_RESTARTED,   /**< An event indicating that transfer has been resumed */
-    SPI_MASTER_EVT_FIRST_BYTE_RECEIVED,   /**< An event indicating end of one byte transfer  */
-    SPI_MASTER_EVT_TYPE_MAX              /**< Enumeration upper bound. */
-} spi_master_evt_type_t;
- 
-/**@brief Struct containing parameters of the SPI MASTER event */
- typedef struct
- {
-   spi_master_evt_type_t type; /**< Type of an event */
-   uint16_t data;                   /**< event data - context dependent */
- } spi_master_evt_t;
-
- /**@brief SPI MASTER internal states types. */
- typedef enum
- {
-   SPI_MASTER_STATE_DISABLED, /**< A state indicating that SPI master is disabled. */
-   SPI_MASTER_STATE_BUSY,     /**< A state indicating that SPI master is sending now. */
-   SPI_MASTER_STATE_ABORTED,
-   SPI_MASTER_STATE_IDLE      /**< A state indicating that SPI master is idle now. */
- } spi_master_state_t;
-
- /**@brief Instances of SPI master module. */
- typedef enum
- {
-     #ifdef SPI_MASTER_0_ENABLE
-        SPI_MASTER_0,   /**< A instance of SPI master 0. */
-     #endif
-     
-     #ifdef SPI_MASTER_1_ENABLE
-        SPI_MASTER_1,   /**< A instance of SPI master 1. */
-     #endif 
-     
-     SPI_MASTER_HW_ENABLED_COUNT    /**< A number of enabled instances of SPI master. */
- } spi_master_hw_instance_t;
- 
-/**@brief Type of generic callback function handler to be used by all SPI MASTER driver events.
- *
- * @param[in] spi_master_evt    SPI MASTER driver event.
- */
-typedef void (*spi_master_event_handler_t) (spi_master_evt_t spi_master_evt);
-
-
-/**@brief Function for opening and initializing a SPI master driver.
- *
- * @note  Function initializes SPI master hardware and internal module states, unregister events callback.
- *
- * @warning If the function has been already called, the function @ref spi_master_close has to be
- *          called before spi_master_open can be called again.
- *
- * @param[in] spi_master_hw_instance    Instance of SPI master module.
- * @param[in] p_spi_master_config       Pointer to configuration structure which will be used 
- *                                      to initialize SPI MASTER hardware.
- *
- * @retval NRF_SUCCESS                Operation success.
- * @retval NRF_ERROR_INVALID_STATE    Operation failure. The function has been already called.
- *                                    To call it again the function @ref spi_master_close 
- *                                    has to be called previously.
- * @retval NRF_ERROR_NULL             Operation failure. NULL pointer supplied.
- */
-uint32_t spi_master_open(const spi_master_hw_instance_t spi_master_hw_instance,
-                         spi_master_config_t const * const p_spi_master_config);
-
- 
-/**@brief Function for closing a SPI MASTER driver.
- *
- * @note  Function disable hardware, reset internal module states and unregister events callback
- *        function.
- *
- * @param[in] spi_master_hw_instance    A instance of SPI master.
- */
-void spi_master_close(const spi_master_hw_instance_t spi_master_hw_instance);
-
- 
-/**@brief Function for transferring data between SPI master and SPI slave
- *
- * @note  Function registers buffers pointed by p_tx_buf and p_rx_buf parameters, after that starts transmission.
- *        Function generates an event of type @ref SPI_MASTER_EVT_TRANSFER_STARTED when transfer has been started
- *        and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED when transfer has been completed.
- *
- * @param[in]  spi_master_hw_instance    Instance of SPI master module.
- * @param[in]  p_tx_buf                  Pointer to a transmit buffer.
- * @param[in]  tx_buf_len                Number of octets to the transfer.
- * @param[out] p_rx_buf                  Pointer to a receive buffer.
- * @param[in]  rx_buf_len                Number of octets to be received.
- *
- * @retval NRF_SUCCESS                Operation success. Packet was registered to the transmission
- *                                    and event will be send upon transmission completion.
- * @retval NRF_ERROR_BUSY             Operation failure. Transmitting of a data is in progress.
- */
- uint32_t spi_master_send_recv(const spi_master_hw_instance_t spi_master_hw_instance,
-                               uint8_t * const p_tx_buf, const uint16_t tx_buf_len,
-                               uint8_t * const p_rx_buf, const uint16_t rx_buf_len);
-
-
-/**@brief Function for registration event handler.
-*
-* @note  Function registers a event handler to be used by SPI MASTER driver for sending events.
-*        @ref SPI_MASTER_EVT_TRANSFER_STARTED and @ref SPI_MASTER_EVT_TRANSFER_COMPLETED.
-*
-* @param[in] spi_master_hw_instance    Instance of SPI master module.
-* @param[in] event_handler             Generic callback function handler to be used 
-*                                      by all SPI master driver events.
-*/
-void spi_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                spi_master_event_handler_t event_handler);
-
-
-/**@brief Function for getting current state of the SPI master driver.
- *
- * @note  Function gets current state of the SPI master driver.
- * 
- * @param[in] spi_master_hw_instance   Instance of SPI master module.
- *
- * @retval SPI_MASTER_STATE_DISABLED   SPI MASTER is disabled.
- * @retval SPI_MASTER_STATE_BUSY       SPI_MASTER is sending now. 
- * @retval SPI_MASTER_STATE_IDLE       SPI_MASTER is idle now. 
- */
-spi_master_state_t spi_master_get_state(const spi_master_hw_instance_t spi_master_hw_instance);
-
-#ifdef _SPI_5W_
-
-uint32_t spi_master_abort(const spi_master_hw_instance_t spi_master_hw_instance);
-
-uint32_t spi_master_restart(const spi_master_hw_instance_t spi_master_hw_instance);
-
-void spi_5W_master_evt_handler_reg(const spi_master_hw_instance_t spi_master_hw_instance,
-                                         spi_master_event_handler_t event_handler);
-#endif
-
-#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/drivers_nrf/spi_slave/nrf_drv_spis.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_slave/nrf_drv_spis.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_slave/nrf_drv_spis.c
deleted file mode 100644
index c62496d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_slave/nrf_drv_spis.c
+++ /dev/null
@@ -1,396 +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 "nrf_drv_spis.h"
-#include <stdbool.h>
-#include <stdio.h>
-#include "nrf.h"
-#include "nrf_gpio.h"
-#include "app_error.h"
-#include "app_util_platform.h"
-#include "nrf_drv_config.h"
-#include "nrf_drv_common.h"
-#include "nordic_common.h"
-#include "sdk_common.h"
-#include "nrf_assert.h"
-
-#if !SPIS_COUNT
-    #warning No SPIS instances enabled.
-#else
-
-/**@brief States of the SPI transaction state machine. */
-typedef enum
-{
-    SPIS_STATE_INIT,                                 /**< Initialization state. In this state the module waits for a call to @ref spi_slave_buffers_set. */                                                                                             
-    SPIS_BUFFER_RESOURCE_REQUESTED,                  /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has started. */
-    SPIS_BUFFER_RESOURCE_CONFIGURED,                 /**< State where the configuration of the memory buffers, which are to be used in SPI transaction, has completed. */
-    SPIS_XFER_COMPLETED                              /**< State where SPI transaction has been completed. */
-} nrf_drv_spis_state_t;
-
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n
-    #define IRQ_HANDLER(n)      static void IRQ_HANDLER_NAME(n)(void)
-
-    #if SPIS0_ENABLED
-        IRQ_HANDLER(0);
-    #endif
-    #if SPIS1_ENABLED
-        IRQ_HANDLER(1);
-    #endif
-    #if SPIS2_ENABLED
-        IRQ_HANDLER(2);
-    #endif
-    static nrf_drv_irq_handler_t const m_irq_handlers[SPIS_COUNT] = {
-    #if SPIS0_ENABLED
-        IRQ_HANDLER_NAME(0),
-    #endif
-    #if SPIS1_ENABLED
-        IRQ_HANDLER_NAME(1),
-    #endif
-    #if SPIS2_ENABLED
-        IRQ_HANDLER_NAME(2),
-    #endif
-    };
-#else
-    #define IRQ_HANDLER(n) void SPIS##n##_IRQ_HANDLER(void)
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-#define SPIS_IRQHANDLER_TEMPLATE(NUM) \
-    IRQ_HANDLER(NUM)                                                        \
-    {                                                                       \
-        spis_irq_handler(NRF_SPIS##NUM, &m_cb[SPIS##NUM##_INSTANCE_INDEX]); \
-    }
-
-
-/**@brief SPIS control block - driver instance local data. */
-typedef struct
-{
-    volatile uint32_t             tx_buffer_size;  //!< SPI slave TX buffer size in bytes.
-    volatile uint32_t             rx_buffer_size;  //!< SPI slave RX buffer size in bytes.
-    nrf_drv_spis_event_handler_t  handler;         //!< SPI event handler.
-    volatile const uint8_t *      tx_buffer;       //!< SPI slave TX buffer.
-    volatile uint8_t *            rx_buffer;       //!< SPI slave RX buffer.
-    nrf_drv_state_t               state;           //!< driver initialization state.
-    volatile nrf_drv_spis_state_t spi_state;       //!< SPI slave state.
-} spis_cb_t;
-
-static spis_cb_t m_cb[SPIS_COUNT];
-
-static nrf_drv_spis_config_t const m_default_config[SPIS_COUNT] = {
-#if SPIS0_ENABLED
-    NRF_DRV_SPIS_DEFAULT_CONFIG(0),
-#endif
-#if SPIS1_ENABLED
-    NRF_DRV_SPIS_DEFAULT_CONFIG(1),
-#endif
-#if SPIS2_ENABLED
-    NRF_DRV_SPIS_DEFAULT_CONFIG(2),
-#endif
-};
-
-
-ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const  p_instance,
-                             nrf_drv_spis_config_t const * p_config,
-                             nrf_drv_spis_event_handler_t  event_handler)
-{
-    spis_cb_t * p_cb = &m_cb[p_instance->instance_id];
-    
-    NRF_SPIS_Type * p_spis = p_instance->p_reg;
-
-    if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config[p_instance->instance_id];
-    }
-    if ((uint32_t)p_config->mode > (uint32_t)NRF_DRV_SPIS_MODE_3)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-    if (!event_handler)
-    {
-        return NRF_ERROR_NULL;
-    }
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    if (nrf_drv_common_per_res_acquire(p_spis,
-            m_irq_handlers[p_instance->instance_id]) != NRF_SUCCESS)
-    {
-        return NRF_ERROR_BUSY;
-    }
-#endif
-
-    // Configure the SPI pins for input.
-    uint32_t mosi_pin;
-    uint32_t miso_pin;
-    
-    if (p_config->miso_pin != NRF_DRV_SPIS_PIN_NOT_USED)
-    {
-        nrf_gpio_cfg(p_config->miso_pin,
-                    NRF_GPIO_PIN_DIR_INPUT,
-                    NRF_GPIO_PIN_INPUT_CONNECT,
-                    NRF_GPIO_PIN_NOPULL,
-                    p_config->miso_drive,
-                    NRF_GPIO_PIN_NOSENSE);
-        miso_pin = p_config->miso_pin;
-    }
-    else
-    {
-        miso_pin = NRF_SPIS_PIN_NOT_CONNECTED;
-    }
-    
-    if (p_config->mosi_pin != NRF_DRV_SPIS_PIN_NOT_USED)
-    {
-        nrf_gpio_cfg(p_config->mosi_pin,
-                     NRF_GPIO_PIN_DIR_INPUT,
-                     NRF_GPIO_PIN_INPUT_CONNECT,
-                     NRF_GPIO_PIN_NOPULL,
-                     NRF_GPIO_PIN_S0S1,
-                     NRF_GPIO_PIN_NOSENSE);
-        mosi_pin = p_config->mosi_pin;
-    }
-    else
-    {
-        mosi_pin = NRF_SPIS_PIN_NOT_CONNECTED;
-    }
-    
-    nrf_gpio_cfg(p_config->csn_pin,
-                 NRF_GPIO_PIN_DIR_INPUT,
-                 NRF_GPIO_PIN_INPUT_CONNECT,
-                 p_config->csn_pullup,
-                 NRF_GPIO_PIN_S0S1,
-                 NRF_GPIO_PIN_NOSENSE);
-    
-    nrf_gpio_cfg(p_config->sck_pin,
-                 NRF_GPIO_PIN_DIR_INPUT,
-                 NRF_GPIO_PIN_INPUT_CONNECT,
-                 NRF_GPIO_PIN_NOPULL,
-                 NRF_GPIO_PIN_S0S1,
-                 NRF_GPIO_PIN_NOSENSE);
-
-    nrf_spis_pins_set(p_spis, p_config->sck_pin, mosi_pin, miso_pin, p_config->csn_pin);
-    
-    nrf_spis_rx_buffer_set(p_spis, NULL, 0);
-    nrf_spis_tx_buffer_set(p_spis, NULL, 0);
-    
-    // Configure SPI mode.
-    nrf_spis_configure(p_spis, (nrf_spis_mode_t) p_config->mode,
-                               (nrf_spis_bit_order_t) p_config->bit_order);
-    
-    // Configure DEF and ORC characters.
-    nrf_spis_def_set(p_spis, p_config->def);
-    nrf_spis_orc_set(p_spis, p_config->orc);
-    
-    // Clear possible pending events.
-    nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END);
-    nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED);
-    
-    // Enable END_ACQUIRE shortcut.        
-    nrf_spis_shorts_enable(p_spis, NRF_SPIS_SHORT_END_ACQUIRE);
-    
-    m_cb[p_instance->instance_id].spi_state = SPIS_STATE_INIT;
-    m_cb[p_instance->instance_id].handler = event_handler;
-
-    
-    // Enable IRQ.
-    nrf_spis_int_enable(p_spis, NRF_SPIS_INT_ACQUIRED_MASK | NRF_SPIS_INT_END_MASK);
-    nrf_drv_common_irq_enable(p_instance->irq, p_config->irq_priority);
-    
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-    
-    // Enable SPI slave device.        
-    nrf_spis_enable(p_spis);
-    
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_spis_uninit(nrf_drv_spis_t const * const  p_instance)
-{
-    spis_cb_t * p_cb = &m_cb[p_instance->instance_id];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-    
-    NRF_SPIS_Type * p_spis = p_instance->p_reg;
-
-    #define DISABLE_ALL 0xFFFFFFFF
-    nrf_spis_disable(p_spis);
-    nrf_drv_common_irq_disable(p_instance->irq);
-    nrf_spis_int_disable(p_spis, DISABLE_ALL);
-    #undef  DISABLE_ALL
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    nrf_drv_common_per_res_release(p_spis);
-#endif
-
-    p_cb->state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-
-/**@brief Function for executing the state entry action. */
-static void spis_state_entry_action_execute(NRF_SPIS_Type * p_spis,
-                                                     spis_cb_t * p_cb)
-{
-    nrf_drv_spis_event_t event;
-    
-    switch (p_cb->spi_state)
-    {                             
-        case SPIS_BUFFER_RESOURCE_REQUESTED:
-            nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_ACQUIRE);
-            break;            
-     
-        case SPIS_BUFFER_RESOURCE_CONFIGURED:
-            event.evt_type  = NRF_DRV_SPIS_BUFFERS_SET_DONE;
-            event.rx_amount = 0;
-            event.tx_amount = 0;     
-            
-            APP_ERROR_CHECK_BOOL(p_cb->handler != NULL);
-            p_cb->handler(event);
-            break;
-            
-        case SPIS_XFER_COMPLETED:        
-            event.evt_type  = NRF_DRV_SPIS_XFER_DONE;
-            event.rx_amount = nrf_spis_rx_amount_get(p_spis);
-            event.tx_amount = nrf_spis_tx_amount_get(p_spis);
-            APP_ERROR_CHECK_BOOL(p_cb->handler != NULL);
-            p_cb->handler(event);
-            break;
-            
-        default:
-            // No implementation required.            
-            break;
-    }
-}
-
-/**@brief Function for changing the state of the SPI state machine.
- *
- * @param[in] p_spis    SPIS instance register.
- * @param[in] p_cb      SPIS instance control block.
- * @param[in] new_state State where the state machine transits to.
- */
-static void spis_state_change(NRF_SPIS_Type * p_spis,
-                              spis_cb_t * p_cb,
-                              nrf_drv_spis_state_t new_state)
-{
-    p_cb->spi_state = new_state;
-    spis_state_entry_action_execute(p_spis, p_cb);
-}
-
-
-ret_code_t nrf_drv_spis_buffers_set(nrf_drv_spis_t const * const  p_instance,
-                                    const uint8_t * p_tx_buffer,
-                                    uint8_t   tx_buffer_length,
-                                    uint8_t * p_rx_buffer,
-                                    uint8_t   rx_buffer_length)
-{
-    spis_cb_t * p_cb = &m_cb[p_instance->instance_id];
-    uint32_t err_code;
-
-    VERIFY_PARAM_NOT_NULL(p_rx_buffer);
-    VERIFY_PARAM_NOT_NULL(p_tx_buffer);
-
-    // EasyDMA requires that transfer buffers are placed in Data RAM region;
-    // signal error if they are not.
-    if ((p_tx_buffer != NULL && !nrf_drv_is_in_RAM(p_tx_buffer)) ||
-        (p_rx_buffer != NULL && !nrf_drv_is_in_RAM(p_rx_buffer)))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-    
-    switch (p_cb->spi_state)
-    {
-        case SPIS_STATE_INIT:
-        case SPIS_XFER_COMPLETED:
-        case SPIS_BUFFER_RESOURCE_CONFIGURED:        
-            p_cb->tx_buffer      = p_tx_buffer;
-            p_cb->rx_buffer      = p_rx_buffer;
-            p_cb->tx_buffer_size = tx_buffer_length;
-            p_cb->rx_buffer_size = rx_buffer_length;        
-            err_code             = NRF_SUCCESS;            
-                        
-            spis_state_change(p_instance->p_reg, p_cb, SPIS_BUFFER_RESOURCE_REQUESTED);             
-            break;
-
-        case SPIS_BUFFER_RESOURCE_REQUESTED:
-            err_code = NRF_ERROR_INVALID_STATE; 
-            break;
-        
-        default:
-            // @note: execution of this code path would imply internal error in the design.
-            err_code = NRF_ERROR_INTERNAL;             
-            break;
-    }
-    
-    return err_code;
-}
-
-static void spis_irq_handler(NRF_SPIS_Type * p_spis, spis_cb_t * p_cb)
-{
-    // @note: as multiple events can be pending for processing, the correct event processing order 
-    // is as follows:
-    // - SPI semaphore acquired event.
-    // - SPI transaction complete event.
-    
-    // Check for SPI semaphore acquired event.
-    if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_ACQUIRED))
-    {
-        nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_ACQUIRED);
-        
-        switch (p_cb->spi_state)
-        {                
-            case SPIS_BUFFER_RESOURCE_REQUESTED:     
-                nrf_spis_tx_buffer_set(p_spis, (uint8_t *)p_cb->tx_buffer, p_cb->tx_buffer_size);
-                nrf_spis_rx_buffer_set(p_spis, (uint8_t *)p_cb->rx_buffer, p_cb->rx_buffer_size);
-                
-                nrf_spis_task_trigger(p_spis, NRF_SPIS_TASK_RELEASE);
-                
-                spis_state_change(p_spis, p_cb, SPIS_BUFFER_RESOURCE_CONFIGURED);                                                                       
-                break;
-                
-            default:
-                // No implementation required.
-                break;
-        }
-    }
-
-    // Check for SPI transaction complete event.
-    if (nrf_spis_event_check(p_spis, NRF_SPIS_EVENT_END))
-    {
-        nrf_spis_event_clear(p_spis, NRF_SPIS_EVENT_END);
-        
-        switch (p_cb->spi_state)
-        {
-            case SPIS_BUFFER_RESOURCE_CONFIGURED:    
-                spis_state_change(p_spis, p_cb, SPIS_XFER_COMPLETED);
-                break;
-
-            default:
-                // No implementation required.                    
-                break;                
-        }    
-    }
-}
-
-#if SPIS0_ENABLED
-    SPIS_IRQHANDLER_TEMPLATE(0)
-#endif
-
-#if SPIS1_ENABLED
-    SPIS_IRQHANDLER_TEMPLATE(1)
-#endif
-
-#if SPIS2_ENABLED
-    SPIS_IRQHANDLER_TEMPLATE(2)
-#endif
-
-#endif // SPI_COUNT > 0

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/spi_slave/nrf_drv_spis.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_slave/nrf_drv_spis.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_slave/nrf_drv_spis.h
deleted file mode 100644
index 9734466..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_slave/nrf_drv_spis.h
+++ /dev/null
@@ -1,231 +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
- * @defgroup nrf_spis SPI slave HAL and driver
- * @ingroup nrf_spi
- * @brief SPI slave API.
- * @details The SPIS HAL provides basic APIs for accessing the registers 
- * of the SPIS. The SPIS driver provides APIs on a higher level.
- **/
-
-#ifndef SPI_SLAVE_H__
-#define SPI_SLAVE_H__
-
-#include <stdint.h>
-#include "nrf.h"
-#include "nrf_error.h"
-#include "nrf_drv_config.h"
-#include "nrf_spis.h"
-#include "nrf_gpio.h"
-#include "sdk_common.h"
-#include "app_util_platform.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(NRF52)
-    #define SPIS2_IRQ            SPIM2_SPIS2_SPI2_IRQn
-    #define SPIS2_IRQ_HANDLER    SPIM2_SPIS2_SPI2_IRQHandler
-    #define SPIS0_IRQ            SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn
-    #define SPIS0_IRQ_HANDLER    SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler
-    #define SPIS1_IRQ            SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn
-    #define SPIS1_IRQ_HANDLER    SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler
-#else
-    #define SPIS0_IRQ            SPI0_TWI0_IRQn
-    #define SPIS0_IRQ_HANDLER    SPI0_TWI0_IRQHandler
-    #define SPIS1_IRQ            SPI1_TWI1_IRQn
-    #define SPIS1_IRQ_HANDLER    SPI1_TWI1_IRQHandler
-#endif
-
-/**
- * @defgroup nrf_drv_spi_slave SPI slave driver
- * @{
- * @ingroup  nrf_spis
- *
- * @brief    Multi-instance SPI slave driver.
- */
- 
-#define NRF_DRV_SPIS_DEFAULT_CSN_PULLUP NRF_GPIO_PIN_NOPULL /**< Default pull-up configuration of the SPI CS. */
-#define NRF_DRV_SPIS_DEFAULT_MISO_DRIVE NRF_GPIO_PIN_S0S1   /**< Default drive configuration of the SPI MISO. */
-#define NRF_DRV_SPIS_DEFAULT_DEF        0xFF                /**< Default DEF character. */
-#define NRF_DRV_SPIS_DEFAULT_ORC        0xFF                /**< Default ORC character. */
- 
-/**
-* @brief This value can be provided instead of a pin number for the signals MOSI
-*        and MISO to specify that the given signal is not used and therefore
-*        does not need to be connected to a pin.
-*/
-#define NRF_DRV_SPIS_PIN_NOT_USED       0xFF
-
-/** @brief SPIS transaction bit order definitions. */
-typedef enum
-{
-    NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST = NRF_SPIS_BIT_ORDER_LSB_FIRST, /**< Least significant bit shifted out first. */
-    NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST = NRF_SPIS_BIT_ORDER_MSB_FIRST  /**< Most significant bit shifted out first. */
-} nrf_drv_spis_endian_t;
-
-/** @brief SPIS mode definitions for clock polarity and phase. */
-typedef enum
-{
-    NRF_DRV_SPIS_MODE_0 = NRF_SPIS_MODE_0,       /**< (CPOL = 0, CPHA = 0). */
-    NRF_DRV_SPIS_MODE_1 = NRF_SPIS_MODE_1,       /**< (CPOL = 0, CPHA = 1). */
-    NRF_DRV_SPIS_MODE_2 = NRF_SPIS_MODE_2,       /**< (CPOL = 1, CPHA = 0). */
-    NRF_DRV_SPIS_MODE_3 = NRF_SPIS_MODE_3        /**< (CPOL = 1, CPHA = 1). */
-} nrf_drv_spis_mode_t;
-
-/** @brief Event callback function event definitions. */
-typedef enum
-{
-    NRF_DRV_SPIS_BUFFERS_SET_DONE,          /**< Memory buffer set event. Memory buffers have been set successfully to the SPI slave device, and SPI transactions can be done. */
-    NRF_DRV_SPIS_XFER_DONE,                 /**< SPI transaction event. SPI transaction has been completed. */  
-    NRF_DRV_SPIS_EVT_TYPE_MAX                    /**< Enumeration upper bound. */      
-} nrf_drv_spis_event_type_t;
-
-/** @brief Structure containing the event context from the SPI slave driver. */
-typedef struct
-{
-    nrf_drv_spis_event_type_t evt_type;     //!< Type of event.
-    uint32_t                  rx_amount;    //!< Number of bytes received in last transaction. This parameter is only valid for @ref NRF_DRV_SPIS_XFER_DONE events.
-    uint32_t                  tx_amount;    //!< Number of bytes transmitted in last transaction. This parameter is only valid for @ref NRF_DRV_SPIS_XFER_DONE events.
-} nrf_drv_spis_event_t;
-
-/** @brief SPI slave driver instance data structure. */
-typedef struct
-{
-    NRF_SPIS_Type * p_reg;          //!< SPIS instance register.
-    uint8_t         instance_id;    //!< SPIS instance ID.
-    IRQn_Type       irq;            //!< IRQ of the specific instance.
-} nrf_drv_spis_t;
-
-/** @brief Macro for creating an SPI slave driver instance. */
-#define NRF_DRV_SPIS_INSTANCE(id)                        \
-{                                                        \
-    .p_reg        = CONCAT_2(NRF_SPIS, id),              \
-    .irq          = CONCAT_3(SPIS, id, _IRQ),            \
-    .instance_id  = CONCAT_3(SPIS, id, _INSTANCE_INDEX), \
-}
-
-/** @brief SPI slave instance default configuration. */
-#define NRF_DRV_SPIS_DEFAULT_CONFIG(id)                       \
-{                                                             \
-    .sck_pin      = CONCAT_3(SPIS, id, _CONFIG_SCK_PIN),      \
-    .mosi_pin     = CONCAT_3(SPIS, id, _CONFIG_MOSI_PIN),     \
-    .miso_pin     = CONCAT_3(SPIS, id, _CONFIG_MISO_PIN),     \
-    .csn_pin      = NRF_DRV_SPIS_PIN_NOT_USED,                \
-    .miso_drive   = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE,          \
-    .csn_pullup   = NRF_DRV_SPIS_DEFAULT_CSN_PULLUP,          \
-    .orc          = NRF_DRV_SPIS_DEFAULT_ORC,                 \
-    .def          = NRF_DRV_SPIS_DEFAULT_DEF,                 \
-    .mode         = NRF_DRV_SPIS_MODE_0,                      \
-    .bit_order    = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST,         \
-    .irq_priority = CONCAT_3(SPIS, id, _CONFIG_IRQ_PRIORITY), \
-}
-
-/** @brief SPI peripheral device configuration data. */
-typedef struct 
-{
-    uint32_t              miso_pin;            //!< SPI MISO pin (optional).
-                                               /**< Set @ref NRF_DRV_SPIS_PIN_NOT_USED
-                                                *   if this signal is not needed. */
-    uint32_t              mosi_pin;            //!< SPI MOSI pin (optional).
-                                               /**< Set @ref NRF_DRV_SPIS_PIN_NOT_USED
-                                                *   if this signal is not needed. */
-    uint32_t              sck_pin;             //!< SPI SCK pin.
-    uint32_t              csn_pin;             //!< SPI CSN pin.
-    nrf_drv_spis_mode_t   mode;                //!< SPI mode.
-    nrf_drv_spis_endian_t bit_order;           //!< SPI transaction bit order.
-    nrf_gpio_pin_pull_t   csn_pullup;          //!< CSN pin pull-up configuration.
-    nrf_gpio_pin_drive_t  miso_drive;          //!< MISO pin drive configuration.
-    uint8_t               def;                 //!< Character clocked out in case of an ignored transaction.
-    uint8_t               orc;                 //!< Character clocked out after an over-read of the transmit buffer.
-    uint8_t               irq_priority;        //!< Interrupt priority.
-} nrf_drv_spis_config_t;
-
-
-/** @brief SPI slave event callback function type.
- *
- * @param[in] event                 SPI slave driver event.  
- */
-typedef void (*nrf_drv_spis_event_handler_t)(nrf_drv_spis_event_t event);
-
-/** @brief Function for initializing the SPI slave driver instance.
- *
- * @param[in] p_instance    Pointer to the instance structure.
- * @param[in] p_config      Pointer to the structure with the initial configuration.
- *                          If NULL, the default configuration will be used.
- * @param[in] event_handler Function to be called by the SPI slave driver upon event.
- *
- * @retval NRF_SUCCESS             If the initialization was successful.
- * @retval NRF_ERROR_INVALID_PARAM If an invalid parameter is supplied.
- * @retval NRF_ERROR_BUSY          If some other peripheral with the same
- *                                 instance ID is already in use. This is 
- *                                 possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED 
- *                                 is set to a value other than zero.
- */
-ret_code_t nrf_drv_spis_init(nrf_drv_spis_t const * const  p_instance,
-                             nrf_drv_spis_config_t const * p_config,
-                             nrf_drv_spis_event_handler_t  event_handler);
-
-/**
- * @brief Function for uninitializing the SPI slave driver instance.
- *
- * @param[in] p_instance Pointer to the instance structure.
- */
-void nrf_drv_spis_uninit(nrf_drv_spis_t const * const p_instance);
-
-/** @brief Function for preparing the SPI slave instance for a single SPI transaction.
- * 
- * This function prepares the SPI slave device to be ready for a single SPI transaction. It configures 
- * the SPI slave device to use the memory supplied with the function call in SPI transactions. 
- * 
- * When either the memory buffer configuration or the SPI transaction has been 
- * completed, the event callback function will be called with the appropriate event 
- * @ref nrf_drv_spis_event_type_t. Note that the callback function can be called before returning from 
- * this function, because it is called from the SPI slave interrupt context.
- *
- * @note This function can be called from the callback function context.
- *
- * @note Client applications must call this function after every @ref NRF_DRV_SPIS_XFER_DONE event if 
- * the SPI slave driver should be prepared for a possible new SPI transaction. 
- *
- * @note Peripherals that are using EasyDMA (for example, SPIS) require the transfer buffers
- * to be placed in the Data RAM region. Otherwise, this function will fail
- * with the error code NRF_ERROR_INVALID_ADDR.
- *
- * @param[in] p_instance            SPIS instance.
- * @param[in] p_tx_buffer           Pointer to the TX buffer.
- * @param[in] p_rx_buffer           Pointer to the RX buffer.
- * @param[in] tx_buffer_length      Length of the TX buffer in bytes.
- * @param[in] rx_buffer_length      Length of the RX buffer in bytes. 
- *
- * @retval NRF_SUCCESS              If the operation was successful.
- * @retval NRF_ERROR_NULL           If the operation failed because a NULL pointer was supplied.   
- * @retval NRF_ERROR_INVALID_STATE  If the operation failed because the SPI slave device is in an incorrect state.
- * @retval NRF_ERROR_INVALID_ADDR   If the provided buffers are not placed in the Data
- *                                  RAM region.
- * @retval NRF_ERROR_INTERNAL       If the operation failed because of an internal error.
- */
-ret_code_t nrf_drv_spis_buffers_set(nrf_drv_spis_t const * const  p_instance,
-                                    const uint8_t * p_tx_buffer, 
-                                    uint8_t   tx_buffer_length, 
-                                    uint8_t * p_rx_buffer, 
-                                    uint8_t   rx_buffer_length);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SPI_SLAVE_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/swi/nrf_drv_swi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/swi/nrf_drv_swi.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/swi/nrf_drv_swi.c
deleted file mode 100644
index e8c2bb2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/swi/nrf_drv_swi.c
+++ /dev/null
@@ -1,326 +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_common.h"
-#include "nrf_error.h"
-#include "nrf_assert.h"
-#include <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include "nrf_drv_swi.h"
-#include "app_util_platform.h"
-
-STATIC_ASSERT(SWI_COUNT > 0);
-STATIC_ASSERT(SWI_COUNT <= SWI_MAX);
-STATIC_ASSERT(SWI_MAX_FLAGS <= sizeof(nrf_swi_flags_t) * 8);
-
-#ifdef SWI_DISABLE0
- #undef SWI_DISABLE0
- #define SWI_DISABLE0  1uL
-#else
- #if SWI_COUNT > 0
-  #define SWI_DISABLE0 0uL
- #else
-  #define SWI_DISABLE0 1uL
- #endif
-#endif
-
-#ifdef SWI_DISABLE1
- #undef SWI_DISABLE1
- #define SWI_DISABLE1  1uL
-#else
- #if SWI_COUNT > 1
-  #define SWI_DISABLE1 0uL
- #else
-  #define SWI_DISABLE1 1uL
- #endif
-#endif
-
-#ifdef SWI_DISABLE2
- #undef SWI_DISABLE2
- #define SWI_DISABLE2  1uL
-#else
- #if SWI_COUNT > 2
-  #define SWI_DISABLE2 0uL
- #else
-  #define SWI_DISABLE2 1uL
- #endif
-#endif
-
-#ifdef SWI_DISABLE3
- #undef SWI_DISABLE3
- #define SWI_DISABLE3  1uL
-#else
- #if SWI_COUNT > 3
-  #define SWI_DISABLE3 0uL
- #else
-  #define SWI_DISABLE3 1uL
- #endif
-#endif
-
-#ifdef SWI_DISABLE4
- #undef SWI_DISABLE4
- #define SWI_DISABLE4  1uL
-#else
- #if SWI_COUNT > 4
-  #define SWI_DISABLE4 0uL
- #else
-  #define SWI_DISABLE4 1uL
- #endif
-#endif
-
-#ifdef SWI_DISABLE5
- #undef SWI_DISABLE5
- #define SWI_DISABLE5  1uL
-#else
- #if SWI_COUNT > 5
-  #define SWI_DISABLE5 0uL
- #else
-  #define SWI_DISABLE5 1uL
- #endif
-#endif
-
-#define SWI_START_NUMBER ( (SWI_DISABLE0)                                                             \
-                         + (SWI_DISABLE0 * SWI_DISABLE1)                                              \
-                         + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2)                               \
-                         + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3)                \
-                         + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3 * SWI_DISABLE4) \
-                         + (SWI_DISABLE0 * SWI_DISABLE1 * SWI_DISABLE2 * SWI_DISABLE3 * SWI_DISABLE4  \
-                            * SWI_DISABLE5) )
-
-#define SWI_ARRAY_SIZE   (SWI_COUNT - SWI_START_NUMBER)
-
-#if (SWI_COUNT <= SWI_START_NUMBER)
-  #undef SWI_ARRAY_SIZE
-  #define SWI_ARRAY_SIZE 1
-#endif
-
-static nrf_drv_state_t   m_drv_state = NRF_DRV_STATE_UNINITIALIZED;
-static nrf_swi_handler_t m_swi_handlers[SWI_ARRAY_SIZE];
-
-#if !EGU_ENABLED
-static nrf_swi_flags_t   m_swi_flags[SWI_ARRAY_SIZE];
-#endif
-
-
-#if EGU_ENABLED > 0
-
-/**@brief Get the specific EGU instance. */
-__STATIC_INLINE NRF_EGU_Type * egu_instance_get(nrf_swi_t swi)
-{
-    return (NRF_EGU_Type*) (NRF_EGU0_BASE + (((uint32_t) swi) * (NRF_EGU1_BASE - NRF_EGU0_BASE)));
-}
-
-/**@brief Software interrupt handler (using EGU). */
-static void nrf_drv_swi_process(nrf_swi_t swi)
-{
-    ASSERT(m_swi_handlers[swi - SWI_START_NUMBER]);
-    nrf_swi_flags_t flags   = 0;
-    NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi);
-    
-    for (uint8_t i = 0; i < NRF_EGU_CHANNEL_COUNT; ++i)
-    {
-        nrf_egu_event_t egu_event = nrf_egu_event_triggered_get(i);
-        if (nrf_egu_event_check(NRF_EGUx, egu_event))
-        {
-            flags |= (1u << i);
-            nrf_egu_event_clear(NRF_EGUx, egu_event);
-        }
-    }
-    
-    m_swi_handlers[swi - SWI_START_NUMBER](swi, flags);
-}
-
-#define SWI_HANDLER_TEMPLATE(NUM)  void SWI##NUM##_EGU##NUM##_IRQHandler(void) \
-                        {                                                      \
-                            nrf_drv_swi_process(NUM);                          \
-                        }
-
-#else
-
-/**@brief Software interrupt handler (without EGU). */
-static void nrf_drv_swi_process(nrf_swi_t swi, nrf_swi_flags_t flags)
-{
-    ASSERT(m_swi_handlers[swi - SWI_START_NUMBER]);
-    m_swi_flags[swi - SWI_START_NUMBER] &= ~flags;
-    m_swi_handlers[swi - SWI_START_NUMBER](swi, flags);
-}
-
-
-#define SWI_HANDLER_TEMPLATE(NUM)  void SWI##NUM##_IRQHandler(void)                            \
-                        {                                                                      \
-                            nrf_drv_swi_process((NUM), m_swi_flags[(NUM) - SWI_START_NUMBER]); \
-                        }
-
-#endif
-
-#if SWI_DISABLE0 == 0
-SWI_HANDLER_TEMPLATE(0)
-#endif
-
-#if SWI_DISABLE1 == 0
-SWI_HANDLER_TEMPLATE(1)
-#endif
-
-#if SWI_DISABLE2 == 0
-SWI_HANDLER_TEMPLATE(2)
-#endif
-
-#if SWI_DISABLE3 == 0
-SWI_HANDLER_TEMPLATE(3)
-#endif
-
-#if SWI_DISABLE4 == 0
-SWI_HANDLER_TEMPLATE(4)
-#endif
-
-#if SWI_DISABLE5 == 0
-SWI_HANDLER_TEMPLATE(5)
-#endif
-
-#define AVAILABLE_SWI (0x3FuL & ~(                                                       \
-                         (SWI_DISABLE0 << 0) | (SWI_DISABLE1 << 1) | (SWI_DISABLE2 << 2) \
-                       | (SWI_DISABLE3 << 3) | (SWI_DISABLE4 << 4) | (SWI_DISABLE5 << 5) \
-                                 ))
-
-#if (AVAILABLE_SWI == 0)
- #warning No available SWIs.
-#endif
-
-/**@brief Function for converting SWI number to system interrupt number.
- *
- * @param[in]  swi                 SWI number.
- *
- * @retval     IRQ number.
- */
-__STATIC_INLINE IRQn_Type nrf_drv_swi_irq_of(nrf_swi_t swi)
-{
-    return (IRQn_Type)((uint32_t)SWI0_IRQn + (uint32_t)swi);
-}
-
-
-/**@brief Function for checking if given SWI is allocated.
- *
- * @param[in]  swi                 SWI number.
- */
-__STATIC_INLINE bool swi_is_allocated(nrf_swi_t swi)
-{
-    ASSERT(swi < SWI_COUNT);
-#if SWI_START_NUMBER > 0
-    if (swi < SWI_START_NUMBER)
-    {
-        return false;
-    }
-#endif
-    /*lint -e(661) out of range case handled by assert above*/
-    return m_swi_handlers[swi - SWI_START_NUMBER];
-}
-
-
-ret_code_t nrf_drv_swi_init(void)
-{
-    if (m_drv_state == NRF_DRV_STATE_UNINITIALIZED)
-    {
-        m_drv_state = NRF_DRV_STATE_INITIALIZED;
-        return NRF_SUCCESS;
-    }
-    return MODULE_ALREADY_INITIALIZED;
-}
-
-
-void nrf_drv_swi_uninit(void)
-{
-    ASSERT(m_drv_state != NRF_DRV_STATE_UNINITIALIZED)
-
-    for (uint32_t i = SWI_START_NUMBER; i < SWI_COUNT; ++i)
-    {
-        m_swi_handlers[i - SWI_START_NUMBER] = NULL;
-        nrf_drv_common_irq_disable(nrf_drv_swi_irq_of((nrf_swi_t) i));
-#if EGU_ENABLED > 0
-        NRF_EGU_Type * NRF_EGUx = egu_instance_get(i);
-        nrf_egu_int_disable(NRF_EGUx, NRF_EGU_INT_ALL);
-#endif
-    }
-    m_drv_state = NRF_DRV_STATE_UNINITIALIZED;
-    return;
-}
-
-
-void nrf_drv_swi_free(nrf_swi_t * p_swi)
-{
-    ASSERT(swi_is_allocated(*p_swi));
-    nrf_drv_common_irq_disable(nrf_drv_swi_irq_of(*p_swi));
-    m_swi_handlers[(*p_swi) - SWI_START_NUMBER] = NULL;
-    *p_swi = NRF_SWI_UNALLOCATED;
-}
-
-
-ret_code_t nrf_drv_swi_alloc(nrf_swi_t * p_swi, nrf_swi_handler_t event_handler, uint32_t priority)
-{
-    ASSERT(event_handler);
-    uint32_t err_code = NRF_ERROR_NO_MEM;
-
-    for (uint32_t i = SWI_START_NUMBER; i < SWI_COUNT; i++)
-    {
-        CRITICAL_REGION_ENTER();
-        if ((!swi_is_allocated(i)) && (AVAILABLE_SWI & (1 << i)))
-        {
-            m_swi_handlers[i - SWI_START_NUMBER] = event_handler;
-            *p_swi = (nrf_swi_t) i;
-            nrf_drv_common_irq_enable(nrf_drv_swi_irq_of(*p_swi), priority);
-#if EGU_ENABLED > 0
-            NRF_EGU_Type * NRF_EGUx = egu_instance_get(i);
-            nrf_egu_int_enable(NRF_EGUx, NRF_EGU_INT_ALL);
-#endif
-            err_code = NRF_SUCCESS;
-        }
-        CRITICAL_REGION_EXIT();
-        if (err_code == NRF_SUCCESS)
-        {
-            break;
-        }
-    }
-    return err_code;
-}
-
-
-void nrf_drv_swi_trigger(nrf_swi_t swi, uint8_t flag_number)
-{
-    ASSERT(swi_is_allocated((uint32_t) swi));
-#if EGU_ENABLED > 0
-    ASSERT(flag_number < NRF_EGU_CHANNEL_COUNT);
-    NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi);
-    nrf_egu_task_trigger(NRF_EGUx, nrf_egu_task_trigger_get(flag_number));
-#else
-    ASSERT(flag_number < SWI_MAX_FLAGS);
-    m_swi_flags[swi - SWI_START_NUMBER] |= (1 << flag_number);
-    NVIC_SetPendingIRQ(nrf_drv_swi_irq_of(swi));
-#endif
-}
-
-
-#if EGU_ENABLED > 0
-
-uint32_t nrf_drv_swi_task_trigger_address_get(nrf_swi_t swi, uint8_t channel)
-{
-    NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi);
-    return (uint32_t) nrf_egu_task_trigger_addres_get(NRF_EGUx, channel);
-}
-
-uint32_t nrf_drv_swi_event_triggered_address_get(nrf_swi_t swi, uint8_t channel)
-{
-    NRF_EGU_Type * NRF_EGUx = egu_instance_get(swi);
-    return (uint32_t) nrf_egu_event_triggered_addres_get(NRF_EGUx, channel);
-}
-
-#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/drivers_nrf/swi/nrf_drv_swi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/swi/nrf_drv_swi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/swi/nrf_drv_swi.h
deleted file mode 100644
index 9ce71a0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/swi/nrf_drv_swi.h
+++ /dev/null
@@ -1,175 +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
- *
- * @defgroup lib_driver_swi SWI driver
- * @{
- * @ingroup  nrf_drivers
- *
- * @brief    Driver for software interrupts (SWI).
- * @details  The SWI driver allows the user to allocate SWIs and pass extra flags to interrupt handler functions.
- */
-
-#ifndef NRF_DRV_SWI_H__
-#define NRF_DRV_SWI_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "app_util.h"
-#include "app_util_platform.h"
-#include "nrf_drv_config.h"
-#include "sdk_errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef EGU_ENABLED
-    #define EGU_ENABLED 0
-#endif
-
-#if EGU_ENABLED > 0
-#include "nrf_egu.h"
-#endif
-
-typedef uint8_t nrf_swi_t;         ///< @brief SWI channel (unsigned integer).
-
-/** @brief   SWI user flags (unsigned integer).
- *
- *  User flags are set during the SWI trigger and passed to the callback function as an argument.
- */
-typedef uint16_t nrf_swi_flags_t;
-
-/** @brief Unallocated channel value. */
-#define NRF_SWI_UNALLOCATED ((nrf_swi_t) 0xFFFFFFFFuL)
-
-/** @brief   SWI handler function.
- *
- *  Takes two arguments: SWI number (nrf_swi_t) and flags (nrf_swi_flags_t).
- */
-typedef void (* nrf_swi_handler_t)(nrf_swi_t, nrf_swi_flags_t);
-
-/**@brief Maximum numbers of SWIs. This number is fixed for a specific chip. */
-#if EGU_ENABLED > 0
-#define SWI_MAX              NRF_EGU_COUNT
-#else
-#define SWI_MAX              6
-#endif
-
-/**@brief Number of flags per SWI (fixed number). */
-#if EGU_ENABLED > 0
-#define SWI_MAX_FLAGS        NRF_EGU_CHANNEL_COUNT
-#else
-#define SWI_MAX_FLAGS        16
-#endif
-
-#ifndef SWI_COUNT
-/** @brief Number of software interrupts available.
- *
- *  This number can be set in the range from 1 to SWI_MAX.
- */
-#define SWI_COUNT 4
-#endif
-
-#ifdef SOFTDEVICE_PRESENT
-    #if SWI_COUNT > 2
-        #undef SWI_COUNT
-        #define SWI_COUNT 2
-    #endif
-#else
-    #ifdef SVCALL_AS_NORMAL_FUNCTION
-    // Serialization is enabled.
-        #if SWI_COUNT > 2
-            #undef SWI_COUNT
-            #define SWI_COUNT 2
-        #endif
-    #endif
-#endif
-
-/**@brief Default SWI priority. */
-#define SWI_DEFAULT_PRIORITY APP_IRQ_PRIORITY_LOW
-
-
-/**@brief Function for initializing the SWI module.
- *
- * @retval     NRF_SUCCESS                If the module was successfully initialized.
- * @retval     MODULE_ALREADY_INITIALIZED If the module has already been initialized.
- */
-ret_code_t nrf_drv_swi_init(void);
-
-
-/**@brief Function for uninitializing the SWI module.
- *
- * This function also disables all SWIs.
- */
-void nrf_drv_swi_uninit(void);
-
-
-/**@brief Function for allocating a first unused SWI instance and setting a handler.
- * @details The event handler function returns void and takes one uint32_t argument (SWI number).
- *
- * @param[out] p_swi                   Pointer to the SWI that has been allocated.
- * @param[in]  event_handler           Event handler function (must not be NULL).
- * @param[in]  priority                Interrupt priority.
- *
- * @retval     NRF_SUCCESS             If the SWI was successfully allocated.
- * @retval     NRF_ERROR_NO_MEM        If there is no available SWI to be used.
- */
-ret_code_t nrf_drv_swi_alloc(nrf_swi_t * p_swi, nrf_swi_handler_t event_handler, uint32_t priority);
-
-
-/**@brief Function for freeing a previously allocated SWI.
- *
- * @param[in,out]  p_swi     SWI to free. The value is changed to NRF_SWI_UNALLOCATED on success.
- */
-void nrf_drv_swi_free(nrf_swi_t * p_swi);
-
-
-/**@brief Function for triggering the SWI.
- *
- * @param[in]  swi           SWI to trigger.
- * @param[in]  flag_number   Number of user flag to trigger.
- */
-void nrf_drv_swi_trigger(nrf_swi_t swi, uint8_t flag_number);
-
-
-#if EGU_ENABLED > 0
-
-/**@brief Function for returning the EGU trigger task address.
- *
- * @param[in]  swi           SWI instance.
- * @param[in]  channel       Number of the EGU channel.
- *
- * @returns EGU trigger task address.
- */
-uint32_t nrf_drv_swi_task_trigger_address_get(nrf_swi_t swi, uint8_t channel);
-
-/**@brief Function for returning the EGU triggered event address.
- *
- * @param[in]  swi           SWI instance.
- * @param[in]  channel       Number of the EGU channel.
- *
- * @returns EGU triggered event address.
- */
-uint32_t nrf_drv_swi_event_triggered_address_get(nrf_swi_t swi, uint8_t channel);
-
-#endif // EGU_ENABLED > 0
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_SWI_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/timer/nrf_drv_timer.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/timer/nrf_drv_timer.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/timer/nrf_drv_timer.c
deleted file mode 100644
index 1cbb846..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/timer/nrf_drv_timer.c
+++ /dev/null
@@ -1,280 +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_timer.h"
-#include "nrf_drv_common.h"
-#include "app_util_platform.h"
-
-#if (TIMER_COUNT == 0)
-    #error "No TIMER instances enabled in the driver configuration file."
-#endif
-
-
-/**@brief Timer control block. */
-typedef struct
-{
-    nrf_timer_event_handler_t handler;
-    void *                    context;
-    nrf_drv_state_t           state;
-} timer_control_block_t;
-
-static timer_control_block_t m_cb[TIMER_COUNT];
-
-static const nrf_drv_timer_config_t m_default_config[TIMER_COUNT] = {
-#if TIMER0_ENABLED
-    NRF_DRV_TIMER_DEFAULT_CONFIG(0),
-#endif
-#if TIMER1_ENABLED
-    NRF_DRV_TIMER_DEFAULT_CONFIG(1),
-#endif
-#if TIMER2_ENABLED
-    NRF_DRV_TIMER_DEFAULT_CONFIG(2),
-#endif
-#if TIMER3_ENABLED
-    NRF_DRV_TIMER_DEFAULT_CONFIG(3),
-#endif
-#if TIMER4_ENABLED
-    NRF_DRV_TIMER_DEFAULT_CONFIG(4),
-#endif
-};
-
-
-ret_code_t nrf_drv_timer_init(nrf_drv_timer_t const * const p_instance,
-                              nrf_drv_timer_config_t const * p_config,
-                              nrf_timer_event_handler_t timer_event_handler)
-{
-    timer_control_block_t * p_cb = &m_cb[p_instance->instance_id];
-
-#ifdef SOFTDEVICE_PRESENT
-    ASSERT(p_instance->p_reg != NRF_TIMER0);
-#endif
-    ASSERT(NRF_TIMER_IS_BIT_WIDTH_VALID(p_instance->p_reg, p_config->bit_width));
-
-    if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (timer_event_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config[p_instance->instance_id];
-    }
-
-    p_cb->handler = timer_event_handler;
-    p_cb->context = p_config->p_context;
-
-    uint8_t i;
-    for (i = 0; i < p_instance->cc_channel_count; ++i)
-    {
-        nrf_timer_event_clear(p_instance->p_reg,
-            nrf_timer_compare_event_get(i));
-    }
-
-    nrf_drv_common_irq_enable(nrf_drv_get_IRQn(p_instance->p_reg),
-        p_config->interrupt_priority);
-
-    nrf_timer_mode_set(p_instance->p_reg, p_config->mode);
-    nrf_timer_bit_width_set(p_instance->p_reg, p_config->bit_width);
-    nrf_timer_frequency_set(p_instance->p_reg, p_config->frequency);
-
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_timer_uninit(nrf_drv_timer_t const * const p_instance)
-{
-    nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_instance->p_reg));
-
-    #define DISABLE_ALL UINT32_MAX
-    nrf_timer_shorts_disable(p_instance->p_reg, DISABLE_ALL);
-    nrf_timer_int_disable(p_instance->p_reg, DISABLE_ALL);
-    #undef DISABLE_ALL
-
-    nrf_drv_timer_disable(p_instance);
-
-    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-void nrf_drv_timer_enable(nrf_drv_timer_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_INITIALIZED);
-    nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START);
-    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_POWERED_ON;
-}
-
-void nrf_drv_timer_disable(nrf_drv_timer_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON);
-    nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_SHUTDOWN);
-    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED;
-}
-
-void nrf_drv_timer_resume(nrf_drv_timer_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON);
-    nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_START);
-}
-
-void nrf_drv_timer_pause(nrf_drv_timer_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON);
-    nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_STOP);
-}
-
-void nrf_drv_timer_clear(nrf_drv_timer_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED);
-    nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_CLEAR);
-}
-
-void nrf_drv_timer_increment(nrf_drv_timer_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON);
-    ASSERT(nrf_timer_mode_get(p_instance->p_reg) != NRF_TIMER_MODE_TIMER);
-
-    nrf_timer_task_trigger(p_instance->p_reg, NRF_TIMER_TASK_COUNT);
-}
-
-uint32_t nrf_drv_timer_capture(nrf_drv_timer_t const * const p_instance,
-                               nrf_timer_cc_channel_t cc_channel)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON);
-    ASSERT(cc_channel < p_instance->cc_channel_count);
-
-    nrf_timer_task_trigger(p_instance->p_reg,
-        nrf_timer_capture_task_get(cc_channel));
-    return nrf_timer_cc_read(p_instance->p_reg, cc_channel);
-}
-
-void nrf_drv_timer_compare(nrf_drv_timer_t const * const p_instance,
-                           nrf_timer_cc_channel_t cc_channel,
-                           uint32_t               cc_value,
-                           bool                   enable_int)
-{
-    nrf_timer_int_mask_t timer_int = nrf_timer_compare_int_get(cc_channel);
-
-    if (enable_int)
-    {
-        nrf_timer_int_enable(p_instance->p_reg, timer_int);
-    }
-    else
-    {
-        nrf_timer_int_disable(p_instance->p_reg, timer_int);
-    }
-
-    nrf_timer_cc_write(p_instance->p_reg, cc_channel, cc_value);
-}
-
-void nrf_drv_timer_extended_compare(nrf_drv_timer_t const * const p_instance,
-                                    nrf_timer_cc_channel_t cc_channel,
-                                    uint32_t               cc_value,
-                                    nrf_timer_short_mask_t timer_short_mask,
-                                    bool                   enable_int)
-{
-    nrf_timer_shorts_disable(p_instance->p_reg,
-        (TIMER_SHORTS_COMPARE0_STOP_Msk  << cc_channel) |
-        (TIMER_SHORTS_COMPARE0_CLEAR_Msk << cc_channel));
-
-    nrf_timer_shorts_enable(p_instance->p_reg, timer_short_mask);
-
-    (void)nrf_drv_timer_compare(p_instance,
-                                cc_channel,
-                                cc_value,
-                                enable_int);
-}
-
-void nrf_drv_timer_compare_int_enable(nrf_drv_timer_t const * const p_instance,
-                                      uint32_t channel)
-{
-    ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(channel < p_instance->cc_channel_count);
-
-    nrf_timer_event_clear(p_instance->p_reg,
-        nrf_timer_compare_event_get(channel));
-    nrf_timer_int_enable(p_instance->p_reg,
-        nrf_timer_compare_int_get(channel));
-}
-
-void nrf_drv_timer_compare_int_disable(nrf_drv_timer_t const * const p_instance,
-                                       uint32_t channel)
-{
-    ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(channel < p_instance->cc_channel_count);
-
-    nrf_timer_int_disable(p_instance->p_reg,
-        nrf_timer_compare_int_get(channel));
-}
-
-static void irq_handler(NRF_TIMER_Type * p_reg,
-                        timer_control_block_t * p_cb,
-                        uint8_t channel_count)
-{
-    uint8_t i;
-    for (i = 0; i < channel_count; ++i)
-    {
-        nrf_timer_event_t event = nrf_timer_compare_event_get(i);
-        nrf_timer_int_mask_t int_mask = nrf_timer_compare_int_get(i);
-
-        if (nrf_timer_event_check(p_reg, event) &&
-            nrf_timer_int_enable_check(p_reg, int_mask))
-        {
-            nrf_timer_event_clear(p_reg, event);
-            p_cb->handler(event, p_cb->context);
-        }
-    }
-}
-
-#if TIMER0_ENABLED
-void TIMER0_IRQHandler(void)
-{
-    irq_handler(NRF_TIMER0, &m_cb[TIMER0_INSTANCE_INDEX],
-        NRF_TIMER_CC_CHANNEL_COUNT(0));
-}
-#endif
-
-#if TIMER1_ENABLED
-void TIMER1_IRQHandler(void)
-{
-    irq_handler(NRF_TIMER1, &m_cb[TIMER1_INSTANCE_INDEX],
-        NRF_TIMER_CC_CHANNEL_COUNT(1));
-}
-#endif
-
-#if TIMER2_ENABLED
-void TIMER2_IRQHandler(void)
-{
-    irq_handler(NRF_TIMER2, &m_cb[TIMER2_INSTANCE_INDEX],
-        NRF_TIMER_CC_CHANNEL_COUNT(2));
-}
-#endif
-
-#if TIMER3_ENABLED
-void TIMER3_IRQHandler(void)
-{
-    irq_handler(NRF_TIMER3, &m_cb[TIMER3_INSTANCE_INDEX],
-        NRF_TIMER_CC_CHANNEL_COUNT(3));
-}
-#endif
-
-#if TIMER4_ENABLED
-void TIMER4_IRQHandler(void)
-{
-    irq_handler(NRF_TIMER4, &m_cb[TIMER4_INSTANCE_INDEX],
-        NRF_TIMER_CC_CHANNEL_COUNT(4));
-}
-#endif


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

Posted by cc...@apache.org.
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/hci/hci_slip.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_slip.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_slip.c
deleted file mode 100644
index 4c40808..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_slip.c
+++ /dev/null
@@ -1,428 +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 "hci_slip.h"
-#include <stdlib.h>
-#include "hci_transport_config.h"
-#include "app_uart.h"
-#include "nrf_error.h"
-
-#define APP_SLIP_END        0xC0                            /**< SLIP code for identifying the beginning and end of a packet frame.. */
-#define APP_SLIP_ESC        0xDB                            /**< SLIP escape code. This code is used to specify that the following character is specially encoded. */
-#define APP_SLIP_ESC_END    0xDC                            /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xC0.. */
-#define APP_SLIP_ESC_ESC    0xDD                            /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xDB. */
-
-/** @brief States for the SLIP state machine. */
-typedef enum
-{
-    SLIP_OFF,                                               /**< SLIP state OFF. */
-    SLIP_READY,                                             /**< SLIP state ON. */
-    SLIP_TRANSMITTING,                                      /**< SLIP state is transmitting indicating write() has been called but data transmission has not completed. */
-} slip_states_t;
-
-static slip_states_t            m_current_state = SLIP_OFF; /** Current state for the SLIP TX state machine. */
-
-static hci_slip_event_handler_t m_slip_event_handler;       /** Event callback function for handling of SLIP events, @ref hci_slip_evt_type_t . */
-
-static const uint8_t *          mp_tx_buffer;               /** Pointer to the current TX buffer that is in transmission. */
-static uint32_t                 m_tx_buffer_length;         /** Length of the current TX buffer that is in transmission. */
-static volatile uint32_t        m_tx_buffer_index;          /** Current index for next byte to transmit in the mp_tx_buffer. */
-
-static uint8_t *                mp_rx_buffer;               /** Pointer to the current RX buffer where the next SLIP decoded packet will be stored. */
-static uint32_t                 m_rx_buffer_length;         /** Length of the current RX buffer. */
-static uint32_t                 m_rx_received_count;        /** Number of SLIP decoded bytes received and stored in mp_rx_buffer. */
-
-
-/**@brief Function for parsing bytes received on the UART until a SLIP escape byte is received.
- *
- * @param[in]  byte  Byte received in UART module.
- */
-static void handle_rx_byte_default(uint8_t byte);
-
-/**@brief Function for parsing bytes received on the UART until SLIP end byte is received.
- *
- * @param[in]  byte  Byte received in UART module.
- */
-static void handle_rx_byte_wait_start(uint8_t byte);
-
-/**@brief Function for decoding a received SLIP escape byte.
- *        It will ensure correct decoding of the byte following the SLIP escape byte.
- *
- * @param[in]  byte  Byte received in UART module.
- */
-static void handle_rx_byte_esc(uint8_t byte);
-
-/**@brief Function pointer for parsing and decoding SLIP bytes from the UART module.
- *
- * @param[in]  byte  Byte received in UART module.
- */
-static void (*handle_rx_byte) (uint8_t byte) = handle_rx_byte_wait_start;
-
-/**@brief Function pointer for sending a byte through the UART module.
- */
-static uint32_t send_tx_byte_default(void);
-
-/**@brief Function for transferring a SLIP escape byte (0xDB) when special bytes are transferred,
- *        that is 0xC0 and 0xDB.
- */
-static uint32_t send_tx_byte_esc(void);
-
-/**@brief Function for transferring a byte when it collides with SLIP commands and follows the SLIP
- *        escape byte, that is 0xC0 => 0xDC and 0xDB => 0xDD.
- */
-static uint32_t send_tx_byte_encoded(void);
-
-/**@brief Function for transferring the SLIP end frame byte, 0xC0.
- */
-static uint32_t send_tx_byte_end(void);
-
-/**@brief Function pointer for sending a byte through the UART module.
- */
-uint32_t (*send_tx_byte) (void) = send_tx_byte_default;
-
-
-static uint32_t send_tx_byte_end(void)
-{
-    uint32_t err_code = app_uart_put(APP_SLIP_END);
-
-    if ((err_code == NRF_SUCCESS) && (m_tx_buffer_index == 0))
-    {
-        // Packet transmission started.
-        send_tx_byte = send_tx_byte_default;
-    }
-
-    return err_code;
-}
-
-
-static uint32_t send_tx_byte_default(void)
-{
-    uint32_t err_code = app_uart_put(mp_tx_buffer[m_tx_buffer_index]);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        m_tx_buffer_index++;
-    }
-
-    return err_code;
-}
-
-
-static uint32_t send_tx_byte_encoded(void)
-{
-    uint32_t err_code;
-
-    switch(mp_tx_buffer[m_tx_buffer_index])
-    {
-        case APP_SLIP_END:
-            err_code = app_uart_put(APP_SLIP_ESC_END);
-            break;
-
-        case APP_SLIP_ESC:
-            err_code = app_uart_put(APP_SLIP_ESC_ESC);
-            break;
-
-        default:
-            err_code = NRF_ERROR_NO_MEM;
-            break;
-    }
-
-    if (err_code == NRF_SUCCESS)
-    {
-        m_tx_buffer_index++;
-        send_tx_byte = send_tx_byte_default;
-    }
-
-    return err_code;
-}
-
-
-static uint32_t send_tx_byte_esc(void)
-{
-    uint32_t err_code = app_uart_put(APP_SLIP_ESC);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        send_tx_byte = send_tx_byte_encoded;
-    }
-
-    return err_code;
-}
-
-
-/** @brief Function for transferring the content of the mp_tx_buffer to the UART.
- *         It continues to transfer bytes until the UART buffer is full or the complete buffer is
- *         transferred.
- */
-static void transmit_buffer(void)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    while (m_tx_buffer_index < m_tx_buffer_length)
-    {
-        if ((mp_tx_buffer[m_tx_buffer_index] == APP_SLIP_END  ||
-             mp_tx_buffer[m_tx_buffer_index] == APP_SLIP_ESC) &&
-             send_tx_byte == send_tx_byte_default)
-        {
-            send_tx_byte = send_tx_byte_esc;
-        }
-
-        err_code = send_tx_byte();
-
-        if (err_code == NRF_ERROR_NO_MEM || err_code == NRF_ERROR_BUSY)
-        {
-            // No memory left in UART TX buffer. Abort and wait for APP_UART_TX_EMPTY to continue.
-            return;
-        }
-    }
-
-    send_tx_byte = send_tx_byte_end;
-
-    err_code = send_tx_byte();
-
-    if (err_code == NRF_SUCCESS)
-    {
-        // Packet transmission ended. Notify higher level.
-        m_current_state = SLIP_READY;
-
-        if (m_slip_event_handler != NULL)
-        {
-            hci_slip_evt_t event = {HCI_SLIP_TX_DONE, mp_tx_buffer, m_tx_buffer_index};
-
-            m_slip_event_handler(event);
-        }
-    }
-}
-
-
-/** @brief Function for handling the reception of a SLIP end byte.
- *         If the number of bytes received is greater than zero it will call m_slip_event_handler
- *         with number of bytes received and invalidate the mp_rx_buffer to protect against data
- *         corruption.
- *         No new bytes can be received until a new RX buffer is supplied.
- */
-static void handle_slip_end(void)
-{
-    if (m_rx_received_count > 0)
-    {
-        // Full packet received, push it up.
-        if (m_slip_event_handler != NULL)
-        {
-            hci_slip_evt_t event = {HCI_SLIP_RX_RDY, mp_rx_buffer, m_rx_received_count};
-
-            m_rx_received_count  = 0;
-            mp_rx_buffer         = NULL;
-
-            m_slip_event_handler(event);
-        }
-    }
-}
-
-
-static void handle_rx_byte_esc(uint8_t byte)
-{
-    switch (byte)
-    {
-        case APP_SLIP_END:
-            handle_slip_end();
-            break;
-
-        case APP_SLIP_ESC_END:
-            mp_rx_buffer[m_rx_received_count++] = APP_SLIP_END;
-            break;
-
-        case APP_SLIP_ESC_ESC:
-            mp_rx_buffer[m_rx_received_count++] = APP_SLIP_ESC;
-            break;
-
-        default:
-            mp_rx_buffer[m_rx_received_count++] = byte;
-            break;
-    }
-
-    handle_rx_byte = handle_rx_byte_default;
-}
-
-
-static void handle_rx_byte_default(uint8_t byte)
-{
-    switch (byte)
-    {
-        case APP_SLIP_END:
-            handle_slip_end();
-            break;
-
-        case APP_SLIP_ESC:
-            handle_rx_byte = handle_rx_byte_esc;
-            break;
-
-        default:
-            mp_rx_buffer[m_rx_received_count++] = byte;
-            break;
-    }
-}
-
-
-static void handle_rx_byte_wait_start(uint8_t byte)
-{
-    if (byte == APP_SLIP_END)
-    {
-        handle_rx_byte = handle_rx_byte_default;
-    }
-}
-
-
-/** @brief Function for checking the current index and length of the RX buffer to determine if the
- *         buffer is full. If an event handler has been registered, the callback function will
- *         be executed..
- *
- * @retval true     If RX buffer has overflowed.
- * @retval false    otherwise.
- *
- */
-static bool rx_buffer_overflowed(void)
-{
-    if (mp_rx_buffer == NULL || m_rx_received_count >= m_rx_buffer_length)
-    {
-        if (m_slip_event_handler != NULL)
-        {
-            hci_slip_evt_t event = {HCI_SLIP_RX_OVERFLOW, mp_rx_buffer, m_rx_received_count};
-            m_slip_event_handler(event);
-        }
-
-        return true;
-    }
-
-    return false;
-}
-
-
-/** @brief Function for handling the UART module event. It parses events from the UART when
- *         bytes are received/transmitted.
- *
- *  @param[in] uart_event   Event received from app_uart module.
- */
-static void slip_uart_eventhandler(app_uart_evt_t * uart_event)
-{
-    if (uart_event->evt_type == APP_UART_TX_EMPTY && m_current_state == SLIP_TRANSMITTING)
-    {
-        transmit_buffer();
-    }
-
-    if ((uart_event->evt_type == APP_UART_DATA) && (!rx_buffer_overflowed()))
-    {
-        handle_rx_byte(uart_event->data.value);
-    }
-}
-
-
-/** @brief Function for enabling the UART module when the SLIP layer is opened.
- */
-static uint32_t slip_uart_open(void)
-{
-    uint32_t err_code;
-
-    app_uart_comm_params_t comm_params =
-    {
-        HCI_SLIP_UART_RX_PIN_NUMBER,
-        HCI_SLIP_UART_TX_PIN_NUMBER,
-        HCI_SLIP_UART_RTS_PIN_NUMBER,
-        HCI_SLIP_UART_CTS_PIN_NUMBER,
-        HCI_SLIP_UART_MODE,
-        false,
-        HCI_SLIP_UART_BAUDRATE
-    };
-
-    err_code = app_uart_init(&comm_params,
-                             NULL,
-                             slip_uart_eventhandler,
-                             APP_IRQ_PRIORITY_LOW);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        m_current_state = SLIP_READY;
-    }
-
-    return err_code;
-}
-
-
-uint32_t hci_slip_evt_handler_register(hci_slip_event_handler_t event_handler)
-{
-    m_slip_event_handler = event_handler;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t hci_slip_open()
-{
-    switch (m_current_state)
-    {
-        case SLIP_OFF:
-            return slip_uart_open();
-
-        default:
-            // Do nothing.
-            break;
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t hci_slip_close()
-{
-    m_current_state   = SLIP_OFF;
-    uint32_t err_code = app_uart_close();
-
-    return err_code;
-}
-
-
-uint32_t hci_slip_write(const uint8_t * p_buffer, uint32_t length)
-{
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    switch (m_current_state)
-    {
-        case SLIP_READY:
-            m_tx_buffer_index  = 0;
-            m_tx_buffer_length = length;
-            mp_tx_buffer       = p_buffer;
-            m_current_state    = SLIP_TRANSMITTING;
-            send_tx_byte       = send_tx_byte_end;
-
-            transmit_buffer();
-            return NRF_SUCCESS;
-
-        case SLIP_TRANSMITTING:
-            return NRF_ERROR_NO_MEM;
-
-        case SLIP_OFF:
-        default:
-            return NRF_ERROR_INVALID_STATE;
-    }
-}
-
-
-uint32_t hci_slip_rx_buffer_register(uint8_t * p_buffer, uint32_t length)
-{
-    mp_rx_buffer        = p_buffer;
-    m_rx_buffer_length  = length;
-    m_rx_received_count = 0;
-    handle_rx_byte      = handle_rx_byte_wait_start;
-    return NRF_SUCCESS;
-}

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/hci/hci_slip.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_slip.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_slip.h
deleted file mode 100644
index 43c72ea..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_slip.h
+++ /dev/null
@@ -1,137 +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 hci_slip SLIP module
- * @{
- * @ingroup app_common
- *
- * @brief SLIP layer for supporting packet framing in HCI transport.
- *
- * @details This module implements SLIP packet framing as described in the Bluetooth Core
- *          Specification 4.0, Volume 4, Part D, Chapter 3 SLIP Layer.
- *
- *          SLIP framing ensures that all packets sent on the UART are framed as:
- *          <0xC0> SLIP packet 1 <0xC0> <0xC0> SLIP packet 2 <0xC0>.
- *
- *          The SLIP layer uses events to notify the upper layer when data transmission is complete
- *          and when a SLIP packet is received.
- */
-
-#ifndef HCI_SLIP_H__
-#define HCI_SLIP_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Event types from the SLIP Layer. */
-typedef enum
-{
-    HCI_SLIP_RX_RDY,                        /**< An event indicating that an RX packet is ready to be read. */
-    HCI_SLIP_TX_DONE,                       /**< An event indicating write completion of the TX packet provided in the function call \ref hci_slip_write . */
-    HCI_SLIP_RX_OVERFLOW,                   /**< An event indicating that RX data has been discarded due to lack of free RX memory. */
-    HCI_SLIP_ERROR,                         /**< An event indicating that an unrecoverable error has occurred. */
-    HCI_SLIP_EVT_TYPE_MAX                   /**< Enumeration upper bound. */
-} hci_slip_evt_type_t;
-
-/**@brief Structure containing an event from the SLIP layer.
- */
-typedef struct
-{
-    hci_slip_evt_type_t evt_type;           /**< Type of event. */
-    const uint8_t *     packet;             /**< This field contains a pointer to the packet for which the event relates, i.e. SLIP_TX_DONE: the packet transmitted, SLIP_RX_RDY: the packet received, SLIP_RX_OVERFLOW: The packet which overflow/or NULL if no receive buffer is available. */
-    uint32_t            packet_length;      /**< Packet length, i.e. SLIP_TX_DONE: Bytes transmitted, SLIP_RX_RDY: Bytes received, SLIP_RX_OVERFLOW: index at which the packet overflowed. */
-} hci_slip_evt_t;
-
-/**@brief Function for the SLIP layer event callback.
- */
-typedef void (*hci_slip_event_handler_t)(hci_slip_evt_t event);
-
-/**@brief Function for registering the event handler provided as parameter and this event handler
- *        will be used by SLIP layer to send events described in \ref hci_slip_evt_type_t.
- *
- * @note Multiple registration requests will overwrite any existing registration. 
- *
- * @param[in] event_handler         This function is called by the SLIP layer upon an event.
- *
- * @retval NRF_SUCCESS              Operation success.
- */
-uint32_t hci_slip_evt_handler_register(hci_slip_event_handler_t event_handler);
-
-/**@brief Function for opening the SLIP layer. This function must be called before
- *        \ref hci_slip_write and before any data can be received.
- *
- * @note Can be called multiple times. 
- * 
- * @retval NRF_SUCCESS              Operation success.
- *
- * The SLIP layer module will propagate errors from underlying sub-modules.
- * This implementation is using UART module as a physical transmission layer, and hci_slip_open
- * executes \ref app_uart_init . For an extended error list, please refer to \ref app_uart_init .
- */
-uint32_t hci_slip_open(void);
-
-/**@brief Function for closing the SLIP layer. After this function is called no data can be
- *        transmitted or received in this layer.
- *
- * @note This function can be called multiple times and also for an unopened channel.
- * 
- * @retval NRF_SUCCESS              Operation success.  
- */
-uint32_t hci_slip_close(void);
-
-/**@brief Function for writing a packet with SLIP encoding. Packet transmission is confirmed when
- *        the HCI_SLIP_TX_DONE event is received by the function caller.
- *
- * @param[in] p_buffer              Pointer to the packet to transmit.
- * @param[in] length                Packet length, in bytes.
- *
- * @retval NRF_SUCCESS              Operation success. Packet was encoded and added to the 
- *                                  transmission queue and an event will be sent upon transmission 
- *                                  completion.
- * @retval NRF_ERROR_NO_MEM         Operation failure. Transmission queue is full and packet was not
- *                                  added to the transmission queue. Application shall wait for
- *                                  the \ref HCI_SLIP_TX_DONE event. After HCI_SLIP_TX_DONE this
- *                                  function can be executed for transmission of next packet.
- * @retval NRF_ERROR_INVALID_ADDR   If a NULL pointer is provided.
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. Module is not open.
- */
-uint32_t hci_slip_write(const uint8_t * p_buffer, uint32_t length);
-
-/**@brief Function for registering a receive buffer. The receive buffer will be used for storage of
- *        received and SLIP decoded data.
- *        No data can be received by the SLIP layer until a receive buffer has been registered.
- *
- * @note  The lifetime of the buffer must be valid during complete reception of data. A static
- *        buffer is recommended.
- *
- * @warning Multiple registration requests will overwrite any existing registration.
- *
- * @param[in]  p_buffer             Pointer to receive buffer. The received and SLIP decoded packet
- *                                  will be placed in this buffer.
- * @param[in]  length               Buffer length, in bytes.
- *
- * @retval NRF_SUCCESS              Operation success. 
- */
-uint32_t hci_slip_rx_buffer_register(uint8_t * p_buffer, uint32_t length);
- 
-#ifdef __cplusplus
-}
-#endif
-
-#endif // HCI_SLIP_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/hci/hci_transport.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_transport.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_transport.c
deleted file mode 100644
index fe45f24..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_transport.c
+++ /dev/null
@@ -1,779 +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 "hci_transport_config.h"
-#include "hci_transport.h"
-#include "hci_slip.h"
-#include "crc16.h"
-#include "hci_mem_pool.h"
-#include "hci_mem_pool_internal.h"
-#include "app_timer.h"
-#include "app_error.h"
-#include <stdio.h>
-#include "sdk_common.h"
-
-#define PKT_HDR_SIZE                    4u                                                                 /**< Packet header size in number of bytes. */
-#define PKT_CRC_SIZE                    2u                                                                 /**< Packet CRC size in number of bytes. */
-#define PKT_TYPE_VENDOR_SPECIFIC        14u                                                                /**< Packet type vendor specific. */
-#define PKT_TYPE_ACK                    0                                                                  /**< Packet type acknowledgement. */
-#define DATA_INTEGRITY_MASK             (1u << 6u)                                                         /**< Mask for data integrity bit in the packet header. */
-#define RELIABLE_PKT_MASK               (1u << 7u)                                                         /**< Mask for reliable packet bit in the packet header. */
-#define INITIAL_ACK_NUMBER_EXPECTED     1u                                                                 /**< Initial acknowledge number expected. */
-#define INITIAL_ACK_NUMBER_TX           INITIAL_ACK_NUMBER_EXPECTED                                        /**< Initial acknowledge number transmitted. */
-#define INVALID_PKT_TYPE                0xFFFFFFFFu                                                        /**< Internal invalid packet type value. */
-#define MAX_TRANSMISSION_TIME           (ROUNDED_DIV((MAX_PACKET_SIZE_IN_BITS * 1000u), USED_BAUD_RATE))   /**< Max transmission time of a single application packet over UART in units of mseconds. */      
-#define RETRANSMISSION_TIMEOUT_IN_MS    (3u * MAX_TRANSMISSION_TIME)                                       /**< Retransmission timeout for application packet in units of mseconds. */      
-#define APP_TIMER_PRESCALER             0                                                                  /**< Value of the RTC1 PRESCALER register. */
-#define RETRANSMISSION_TIMEOUT_IN_TICKS APP_TIMER_TICKS(RETRANSMISSION_TIMEOUT_IN_MS, APP_TIMER_PRESCALER) /**< Retransmission timeout for application packet in units of timer ticks. */             
-#define MAX_RETRY_COUNT                 5u                                                                 /**< Max retransmission retry count for application packets. */
-#define ACK_BUF_SIZE                    5u                                                                 /**< Length of module internal RX buffer which is big enough to hold an acknowledgement packet. */
-
-/**@brief States of the TX state machine. */
-typedef enum
-{
-    TX_STATE_IDLE,                                                   /**< State for: no application transmission packet processing in progress. */                                                                                             
-    TX_STATE_PENDING,                                                /**< State for: TX in progress in slip layer and TX-done event is waited for to signal the end of transmission. */
-    TX_STATE_ACTIVE                                                  /**< State for: application packet has been delivered to slip for transmission and peer transport entity acknowledgement packet is waited for. */
-} tx_state_t;
-
-/**@brief TX state machine events. */
-typedef enum
-{
-    TX_EVENT_STATE_ENTRY,                                            /**< Event for: state entry use case. */                                                                                             
-    TX_EVENT_SLIP_TX_DONE,                                           /**< Event for: HCI_SLIP_TX_DONE event use case. */
-    TX_EVENT_TIMEOUT,                                                /**< Event for: retransmission timeout use case. */
-    TX_EVENT_VALID_RX_ACK                                            /**< Event for: valid acknowledgement received for TX packet use case. */
-} tx_event_t;
-
-static void tx_sm_state_change(tx_state_t new_state);
-
-static tx_state_t                      m_tx_state;                   /**< Current TX state. */
-static hci_transport_tx_done_handler_t m_transport_tx_done_handle;   /**< TX done event callback function. */
-static hci_transport_event_handler_t   m_transport_event_handle;     /**< Event handler callback function. */
-static uint8_t *                       mp_slip_used_rx_buffer;       /**< Reference to RX buffer used by the slip layer. */
-static uint32_t                        m_packet_expected_seq_number; /**< Sequence number counter of the packet expected to be received . */ 
-static uint32_t                        m_packet_transmit_seq_number; /**< Sequence number counter of the transmitted packet for which acknowledgement packet is waited for. */ 
-static uint8_t *                       mp_tx_buffer;                 /**< Pointer to TX application buffer to be transmitted. */
-static uint32_t                        m_tx_buffer_length;           /**< Length of application TX packet data to be transmitted in bytes. */
-static bool                            m_is_slip_decode_ready;       /**< Boolean to determine has slip decode been completed or not. */
-APP_TIMER_DEF(m_app_timer_id);                                       /**< Application timer id. */
-static uint32_t                        m_tx_retry_counter;           /**< Application packet retransmission counter. */
-static hci_transport_tx_done_result_t  m_tx_done_result_code;        /**< TX done event callback function result code. */
-static uint8_t                         m_rx_ack_buffer[ACK_BUF_SIZE];/**< RX buffer big enough to hold an acknowledgement packet and which is taken in use upon receiving  HCI_SLIP_RX_OVERFLOW event. */
-
-
-/**@brief Function for validating a received packet.
- *
- * @param[in] p_buffer Pointer to the packet data.
- * @param[in] length   Length of packet data in bytes.  
- *
- * @return true if received packet is valid, false in other case.
- */
-static bool is_rx_pkt_valid(const uint8_t * p_buffer, uint32_t length)
-{  
-    // Executed packet filtering algorithm order:
-    // - verify packet overall length
-    // - verify data integrity bit set
-    // - verify reliable packet bit set
-    // - verify supported packet type
-    // - verify header checksum
-    // - verify payload length field
-    // - verify CRC
-    if (length <= PKT_HDR_SIZE)
-    {
-        return false;        
-    }
-    
-    if (!(p_buffer[0] & DATA_INTEGRITY_MASK))
-    {
-        return false;
-    }    
-    
-    if (!(p_buffer[0] & RELIABLE_PKT_MASK))
-    {
-        return false;
-    }        
-    
-    if ((p_buffer[1] & 0x0Fu) != PKT_TYPE_VENDOR_SPECIFIC)
-    {    
-        return false;    
-    }
-    
-    const uint32_t expected_checksum = 
-        ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu;
-    if (expected_checksum != 0)
-    {    
-        return false;
-    }
-    
-    const uint16_t crc_calculated = crc16_compute(p_buffer, (length - PKT_CRC_SIZE), NULL);
-    const uint16_t crc_received   = uint16_decode(&p_buffer[length - PKT_CRC_SIZE]);
-    if (crc_calculated != crc_received)
-    {
-        return false;
-    }
-    
-    return true;
-}
-
-
-/**@brief Function for getting the sequence number of the next reliable packet expected.
- *
- * @return sequence number of the next reliable packet expected.
- */
-static __INLINE uint8_t packet_number_expected_get(void)
-{    
-    return (uint8_t) m_packet_expected_seq_number;
-}
-
-
-/**@brief Function for calculating a packet header checksum.
- *
- * @param[in] p_hdr Pointer to the packet header.
- *
- * @return          Calculated checksum.
- */
-static uint8_t header_checksum_calculate(const uint8_t * p_hdr)
-{
-    // @note: no pointer validation check needed as already checked by calling function.
-    uint32_t checksum;
-    
-    checksum  = p_hdr[0];   
-    checksum += p_hdr[1];          
-    checksum += p_hdr[2];                  
-    checksum &= 0xFFu;
-    checksum  = (~checksum + 1u);
-    
-    return (uint8_t)checksum;
-}
-
-
-/**@brief Function for writing an acknowledgment packet for transmission.
- */
-static void ack_transmit(void)
-{
-    static uint8_t ack_packet[PKT_HDR_SIZE];
-    
-    // TX ACK packet format:
-    // - Unreliable Packet type
-    // - Payload Length set to 0
-    // - Sequence Number set to 0
-    // - Header checksum calculated
-    // - Acknowledge Number set correctly            
-    ack_packet[0] = (packet_number_expected_get() << 3u);
-    ack_packet[1] = 0;    
-    ack_packet[2] = 0;        
-    ack_packet[3] = header_checksum_calculate(ack_packet); 
-
-    // @note: no return value check needed for hci_slip_write(...) call as acknowledgement packets 
-    // are considered to be from system design point of view unreliable packets.Use case where 
-    // underlying slip layer does not accept a packet for transmission is managed either by:
-    // - acknowledged by possible future application packet as acknowledgement number header field 
-    // is included 
-    // - protocol peer entity will retransmit the packet        
-    UNUSED_VARIABLE(hci_slip_write(ack_packet, sizeof(ack_packet)));   
-}
-
-
-/**@brief Function for validating a received packet.
- *
- * @param[in] p_buffer Pointer to the packet data. 
- *
- * @return sequence number field of the packet header with unrelated data masked out.
- */
-static __INLINE uint8_t packet_seq_nmbr_extract(const uint8_t * p_buffer)
-{
-    return (p_buffer[0] & 0x07u);
-}
-
-
-/**@brief Function for incrementing the sequence number counter for next reliable packet expected.
- */
-static __INLINE void packet_number_expected_inc(void)
-{
-    ++m_packet_expected_seq_number;
-    m_packet_expected_seq_number &= 0x07u;    
-}
-
-
-/**@brief Function for decoding a packet type field.
- *
- * @param[in] p_buffer Pointer to the packet data. 
- * @param[in] length   Length of packet data in bytes.  
- *
- * @return Packet type field or INVALID_PKT_TYPE in case of decode error.
- */
-static __INLINE uint32_t packet_type_decode(const uint8_t * p_buffer, uint32_t length)
-{
-    // @note: no pointer validation check needed as allready checked by calling function.
-    uint32_t return_value;
-                
-    if (length >= PKT_HDR_SIZE)
-    {
-        return_value = (p_buffer[1] & 0x0Fu);
-    }    
-    else
-    {
-        return_value = INVALID_PKT_TYPE;
-    }    
-    
-    return return_value;
-}
-
-
-/**@brief Function for processing a received vendor specific packet.
- *
- * @param[in] p_buffer Pointer to the packet data. 
- * @param[in] length   Length of packet data in bytes.  
- */
-static void rx_vendor_specific_pkt_type_handle(const uint8_t * p_buffer, uint32_t length)
-{
-    // @note: no pointer validation check needed as allready checked by calling function.
-    uint32_t err_code;
-    
-    if (is_rx_pkt_valid(p_buffer, length))
-    {
-        // RX packet is valid: validate sequence number.
-        const uint8_t rx_seq_number = packet_seq_nmbr_extract(p_buffer);
-        if (packet_number_expected_get() == rx_seq_number)
-        {
-            // Sequence number is valid: transmit acknowledgement.
-            packet_number_expected_inc();                    
-            ack_transmit();                    
-
-            m_is_slip_decode_ready = true;            
-            
-            err_code = hci_mem_pool_rx_data_size_set(length);
-            APP_ERROR_CHECK(err_code);
-
-            err_code = hci_mem_pool_rx_produce(RX_BUF_SIZE, (void **)&mp_slip_used_rx_buffer); 
-            APP_ERROR_CHECK_BOOL((err_code == NRF_SUCCESS) || (err_code == NRF_ERROR_NO_MEM));
-
-            // If memory pool RX buffer produce succeeded we register that buffer to slip layer 
-            // otherwise we register the internal acknowledgement buffer. 
-            err_code = hci_slip_rx_buffer_register(
-                (err_code == NRF_SUCCESS) ? mp_slip_used_rx_buffer : m_rx_ack_buffer, 
-                (err_code == NRF_SUCCESS) ? RX_BUF_SIZE : ACK_BUF_SIZE);            
-
-            APP_ERROR_CHECK(err_code);                
-                    
-            if (m_transport_event_handle != NULL)
-            {
-                // Send application event of RX packet reception.
-                const hci_transport_evt_t evt = {HCI_TRANSPORT_RX_RDY};
-                m_transport_event_handle(evt);
-            }                     
-        }
-        else
-        {
-            // RX packet discarded: sequence number not valid, set the same buffer to slip layer in 
-            // order to avoid buffer overrun. 
-            err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE);                            
-            APP_ERROR_CHECK(err_code);                            
-                
-            // As packet did not have expected sequence number: send acknowledgement with the 
-            // current expected sequence number.
-            ack_transmit();
-        }
-    }
-    else
-    {
-        // RX packet discarded: reset the same buffer to slip layer in order to avoid buffer
-        // overrun. 
-        err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE);                            
-        APP_ERROR_CHECK(err_code);                                    
-    }            
-}
-
-
-/**@brief Function for getting the sequence number of a reliable TX packet for which peer protocol 
- * entity acknowledgment is pending.
- *
- * @return sequence number of a reliable TX packet for which peer protocol entity acknowledgement
- * is pending.
- */
-static __INLINE uint8_t packet_number_to_transmit_get(void)
-{
-    return m_packet_transmit_seq_number;
-}
-
-
-/**@brief Function for getting the expected acknowledgement number.
- *
- * @return expected acknowledgement number.
- */
-static __INLINE uint8_t expected_ack_number_get(void)
-{
-    uint8_t seq_nmbr = packet_number_to_transmit_get(); 
-    ++seq_nmbr;
-    seq_nmbr &= 0x07u;
-    
-    return seq_nmbr;
-}
-
-
-/**@brief Function for processing a received acknowledgement packet.
- *
- * Verifies does the received acknowledgement packet has the expected acknowledgement number and 
- * that the header checksum is correct. 
- *
- * @param[in] p_buffer Pointer to the packet data. 
- *
- * @return true if valid acknowledgement packet received.
- */
-static __INLINE bool rx_ack_pkt_type_handle(const uint8_t * p_buffer)
-{
-    // @note: no pointer validation check needed as allready checked by calling function.
-    
-    // Verify header checksum.
-    const uint32_t expected_checksum = 
-        ((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu;
-    if (expected_checksum != 0)
-    {    
-        return false;
-    }
-    
-    const uint8_t ack_number = (p_buffer[0] >> 3u) & 0x07u;
-    
-    // Verify expected acknowledgment number.
-    return (ack_number == expected_ack_number_get());
-}
-
-
-/**@brief Function for incrementing the sequence number counter of the TX packet. 
- */
-static __INLINE void packet_number_tx_inc(void)
-{
-    ++m_packet_transmit_seq_number;
-    m_packet_transmit_seq_number &= 0x07u;
-}
-
-
-/**@brief Function for TX state machine event processing in a state centric manner.
- *
- * @param[in] event Type of event occurred.
- */
-static void tx_sm_event_handle(tx_event_t event)
-{
-    uint32_t err_code;
-    
-    switch (m_tx_state)
-    {
-        case TX_STATE_IDLE:
-            if (event == TX_EVENT_STATE_ENTRY)
-            {                 
-                err_code = app_timer_stop(m_app_timer_id);
-                APP_ERROR_CHECK(err_code);
-                
-                // Send TX-done event if registered handler exists.
-                if (m_transport_tx_done_handle != NULL)                
-                {
-                    m_transport_tx_done_handle(m_tx_done_result_code);
-                }                
-            }
-            break;
-            
-        case TX_STATE_PENDING:
-            if (event == TX_EVENT_SLIP_TX_DONE)
-            {     
-                // @note: this call should always succeed as called from HCI_SLIP_TX_DONE context 
-                // and error cases are managed by dedicated error event from the slip layer.
-                err_code = hci_slip_write(mp_tx_buffer, 
-                                         (m_tx_buffer_length + PKT_HDR_SIZE + PKT_CRC_SIZE));  
-                APP_ERROR_CHECK(err_code);                                                  
-                tx_sm_state_change(TX_STATE_ACTIVE);                                              
-            }        
-            break;
-            
-        case TX_STATE_ACTIVE:
-            switch (event)
-            {
-                case TX_EVENT_VALID_RX_ACK:                    
-                    // Tx sequence number counter incremented as packet transmission 
-                    // acknowledged by peer transport entity.
-                    packet_number_tx_inc();                                  
-                    tx_sm_state_change(TX_STATE_IDLE);
-                    break;
-                    
-                case TX_EVENT_STATE_ENTRY:
-                    m_tx_retry_counter = 0;
-                    err_code = app_timer_start(m_app_timer_id, 
-                                               RETRANSMISSION_TIMEOUT_IN_TICKS, 
-                                               NULL);
-                    APP_ERROR_CHECK(err_code);
-                    break;
-                    
-                case TX_EVENT_TIMEOUT:
-                    if (m_tx_retry_counter != MAX_RETRY_COUNT)
-                    {
-                        ++m_tx_retry_counter;
-                        // @note: no return value check done for hci_slip_write(...) call as current 
-                        // system design allows use case where retransmission is not accepted by the 
-                        // slip layer due to existing acknowledgement packet transmission in the 
-                        // slip layer. 
-                        UNUSED_VARIABLE(hci_slip_write(mp_tx_buffer, 
-                                                      (m_tx_buffer_length + 
-                                                      PKT_HDR_SIZE        + 
-                                                      PKT_CRC_SIZE)));                
-                    }    
-                    else
-                    {
-                        // Application packet retransmission count reached: 
-                        // - set correct TX done event callback function result code
-                        // - execute state change    
-                        // @note: m_tx_retry_counter is reset in TX_STATE_ACTIVE state entry.
-                        m_tx_done_result_code = HCI_TRANSPORT_TX_DONE_FAILURE;         
-                        tx_sm_state_change(TX_STATE_IDLE);
-                    }                
-                    break;
-                    
-                default:
-                    // No implementation needed.
-                    break;
-            }
-            break;
-            
-        default:        
-            // No implementation needed.
-            break;
-    }
-}
-
-
-/**@brief Function for changing the state of the TX state machine.
- *
- * @param[in] new_state State TX state machine transits to.
- */
-static void tx_sm_state_change(tx_state_t new_state)
-{
-    m_tx_state = new_state;
-    tx_sm_event_handle(TX_EVENT_STATE_ENTRY);
-}
-
-
-/**@brief Function for handling slip events.
- *
- * @param[in] event The event structure.
- */
-void slip_event_handle(hci_slip_evt_t event)
-{    
-    uint32_t return_code;
-    uint32_t err_code;    
-    
-    switch (event.evt_type)
-    {
-        case HCI_SLIP_TX_DONE:   
-            tx_sm_event_handle(TX_EVENT_SLIP_TX_DONE);
-            break;
-            
-        case HCI_SLIP_RX_RDY:
-            return_code = packet_type_decode(event.packet, event.packet_length);
-            
-            switch (return_code)
-            {
-                case PKT_TYPE_VENDOR_SPECIFIC:
-                    rx_vendor_specific_pkt_type_handle(event.packet, event.packet_length);
-                    break;
-                    
-                case PKT_TYPE_ACK:
-                    if (rx_ack_pkt_type_handle(event.packet))
-                    {
-                        // Valid expected acknowledgement packet received: set correct TX done event 
-                        // callback function result code and execute state change.
-                        m_tx_done_result_code = HCI_TRANSPORT_TX_DONE_SUCCESS; 
-                        tx_sm_event_handle(TX_EVENT_VALID_RX_ACK);
-                    }
-                
-                /* fall-through */                
-                default:
-                    // RX packet dropped: reset memory buffer to slip in order to avoid RX buffer 
-                    // overflow. 
-                    // If existing mem pool produced RX buffer exists reuse that one. If existing 
-                    // mem pool produced RX buffer does not exist try to produce new one. If 
-                    // producing fails use the internal acknowledgement buffer.                    
-                    if (mp_slip_used_rx_buffer != NULL)
-                    {
-                        err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE);                                                            
-                        APP_ERROR_CHECK(err_code);                                                                
-                    }
-                    else
-                    {
-                        err_code = hci_mem_pool_rx_produce(RX_BUF_SIZE, 
-                                                           (void **)&mp_slip_used_rx_buffer); 
-                        APP_ERROR_CHECK_BOOL((err_code == NRF_SUCCESS) || 
-                                            (err_code == NRF_ERROR_NO_MEM));
-
-                        err_code = hci_slip_rx_buffer_register(
-                            (err_code == NRF_SUCCESS) ? mp_slip_used_rx_buffer : m_rx_ack_buffer, 
-                            (err_code == NRF_SUCCESS) ? RX_BUF_SIZE : ACK_BUF_SIZE);            
-                        APP_ERROR_CHECK(err_code);                                                                
-                    }
-                    break;
-            }
-            break;
-
-        case HCI_SLIP_RX_OVERFLOW:
-            err_code = hci_slip_rx_buffer_register(m_rx_ack_buffer, ACK_BUF_SIZE);                                                            
-            APP_ERROR_CHECK(err_code);                                                                
-            break;
-        
-        case HCI_SLIP_ERROR:
-            APP_ERROR_HANDLER(event.evt_type);
-            break;
-            
-        default:
-            APP_ERROR_HANDLER(event.evt_type); 
-            break;
-    }
-}
-
-
-uint32_t hci_transport_evt_handler_reg(hci_transport_event_handler_t event_handler)
-{
-    uint32_t err_code;    
-    
-    m_transport_event_handle = event_handler;
-    err_code                 = hci_slip_evt_handler_register(slip_event_handle); 
-    APP_ERROR_CHECK(err_code);                                                                        
-    
-    return (event_handler != NULL) ? NRF_SUCCESS : NRF_ERROR_NULL;        
-}
-
-
-uint32_t hci_transport_tx_done_register(hci_transport_tx_done_handler_t event_handler)
-{
-    uint32_t err_code;    
-    
-    m_transport_tx_done_handle = event_handler;
-    err_code                   = hci_slip_evt_handler_register(slip_event_handle);    
-    APP_ERROR_CHECK(err_code);                                                                    
-    
-    return (event_handler != NULL) ? NRF_SUCCESS : NRF_ERROR_NULL;        
-}
-
-
-/**@brief Function for handling the application packet retransmission timeout.
- *        
- * This function is registered in the @ref app_timer module when a timer is created on 
- * @ref hci_transport_open. 
- *
- * @note This function must be executed in APP-LO context otherwise retransmission behaviour is 
- *       undefined, see @ref nrf51_system_integration_serialization.
- * 
- * @param[in] p_context The timeout context.
- */
-void hci_transport_timeout_handle(void * p_context)
-{
-    tx_sm_event_handle(TX_EVENT_TIMEOUT);
-}
-
-
-uint32_t hci_transport_open(void)
-{
-    mp_tx_buffer                 = NULL;
-    m_tx_buffer_length           = 0;
-    m_tx_retry_counter           = 0;
-    m_is_slip_decode_ready       = false;
-    m_tx_state                   = TX_STATE_IDLE;
-    m_packet_expected_seq_number = INITIAL_ACK_NUMBER_EXPECTED;
-    m_packet_transmit_seq_number = INITIAL_ACK_NUMBER_TX;
-    m_tx_done_result_code        = HCI_TRANSPORT_TX_DONE_FAILURE;
-    
-    uint32_t err_code = app_timer_create(&m_app_timer_id, 
-                                         APP_TIMER_MODE_REPEATED, 
-                                         hci_transport_timeout_handle);
-    if (err_code != NRF_SUCCESS)
-    {    
-        // @note: conduct required interface adjustment.
-        return NRF_ERROR_INTERNAL;
-    }
-    
-    err_code = hci_mem_pool_open();
-    VERIFY_SUCCESS(err_code);
-    
-    err_code = hci_slip_open();
-    VERIFY_SUCCESS(err_code);
-    
-    err_code = hci_mem_pool_rx_produce(RX_BUF_SIZE, (void **)&mp_slip_used_rx_buffer);
-    if (err_code != NRF_SUCCESS)
-    {
-        // @note: conduct required interface adjustment.
-        return NRF_ERROR_INTERNAL;
-    }   
-    
-    err_code = hci_slip_rx_buffer_register(mp_slip_used_rx_buffer, RX_BUF_SIZE);
-    
-    return err_code;    
-}
-
-
-uint32_t hci_transport_close(void)
-{
-    uint32_t err_code;
-
-    m_transport_tx_done_handle = NULL;
-    m_transport_event_handle   = NULL;
-        
-    err_code = hci_mem_pool_close();
-    APP_ERROR_CHECK(err_code);    
-    err_code = hci_slip_close();
-    APP_ERROR_CHECK(err_code);    
-    
-    // @note: NRF_ERROR_NO_MEM is the only return value which should never be returned.
-    err_code = app_timer_stop(m_app_timer_id);
-    APP_ERROR_CHECK_BOOL(err_code != NRF_ERROR_NO_MEM);
-    
-    return NRF_SUCCESS;
-}    
-
-
-uint32_t hci_transport_tx_alloc(uint8_t ** pp_memory)
-{
-    const uint32_t err_code = hci_mem_pool_tx_alloc((void **)pp_memory);    
-    if (err_code == NRF_SUCCESS)
-    {
-        // @note: no need to validate pp_memory against null as validation has already been done 
-        // by hci_mem_pool_tx_alloc(...) and visible to us from the method return code.
-        //lint -e(413) "Likely use of null pointer"        
-        *pp_memory += PKT_HDR_SIZE; 
-    }
-    
-    return err_code;
-}
-
-
-uint32_t hci_transport_tx_free(void)
-{
-    return hci_mem_pool_tx_free();
-}
-
-
-/**@brief Function for constructing 1st byte of the packet header of the packet to be transmitted.
- *
- * @return 1st byte of the packet header of the packet to be transmitted
- */
-static __INLINE uint8_t tx_packet_byte_zero_construct(void)
-{
-    const uint32_t value = DATA_INTEGRITY_MASK                  | 
-                           RELIABLE_PKT_MASK                    | 
-                           (packet_number_expected_get() << 3u) | 
-                           packet_number_to_transmit_get();   
-    
-    return (uint8_t) value;
-}
-
-
-/**@brief Function for handling the application packet write request in tx-idle state.
- */
-static uint32_t pkt_write_handle(void)
-{   
-    uint32_t err_code;     
-    
-    // Set packet header fields.
-
-    mp_tx_buffer   -= PKT_HDR_SIZE;
-    mp_tx_buffer[0] = tx_packet_byte_zero_construct();
-                
-    const uint16_t type_and_length_fields = ((m_tx_buffer_length << 4u) | PKT_TYPE_VENDOR_SPECIFIC);            
-    // @note: no use case for uint16_encode(...) return value.
-    UNUSED_VARIABLE(uint16_encode(type_and_length_fields, &(mp_tx_buffer[1])));
-    mp_tx_buffer[3] = header_checksum_calculate(mp_tx_buffer);
-    
-    // Calculate, append CRC to the packet and write it.
-        
-    const uint16_t crc = crc16_compute(mp_tx_buffer, (PKT_HDR_SIZE + m_tx_buffer_length), NULL);
-    // @note: no use case for uint16_encode(...) return value.
-    UNUSED_VARIABLE(uint16_encode(crc, &(mp_tx_buffer[PKT_HDR_SIZE + m_tx_buffer_length])));        
-    err_code = hci_slip_write(mp_tx_buffer, (m_tx_buffer_length + PKT_HDR_SIZE + PKT_CRC_SIZE));        
-    switch (err_code)
-    {
-        case NRF_SUCCESS:
-            tx_sm_state_change(TX_STATE_ACTIVE);
-            break;
-                
-        case NRF_ERROR_NO_MEM:
-            tx_sm_state_change(TX_STATE_PENDING);            
-            err_code = NRF_SUCCESS;
-            break;
-                
-        default:
-            // No implementation needed.
-            break;
-    }
-    
-    return err_code;
-}
-
-
-uint32_t hci_transport_pkt_write(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t err_code;
-    
-    if (p_buffer)
-    {          
-        switch (m_tx_state)
-        {
-            case TX_STATE_IDLE:
-                mp_tx_buffer       = (uint8_t *)p_buffer;
-                m_tx_buffer_length = length;            
-                err_code = pkt_write_handle();
-                break;
-                
-            default:
-                err_code = NRF_ERROR_NO_MEM;
-                break;
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_NULL;
-    }
-    
-    return err_code;    
-}
-
-
-uint32_t hci_transport_rx_pkt_extract(uint8_t ** pp_buffer, uint16_t * p_length)
-{
-    uint32_t err_code;
-    
-    if (pp_buffer != NULL && p_length != NULL)
-    {
-        uint32_t length = 0; 
-        
-        if (m_is_slip_decode_ready)
-        {
-            m_is_slip_decode_ready = false;
-            err_code               = hci_mem_pool_rx_extract(pp_buffer, &length);
-            length                -= (PKT_HDR_SIZE + PKT_CRC_SIZE);
-            
-            *p_length              = (uint16_t)length; 
-            *pp_buffer            += PKT_HDR_SIZE;
-        }
-        else
-        {
-            err_code = NRF_ERROR_NO_MEM;
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_NULL;
-    }
-    
-    return err_code;
-}
-
-
-uint32_t hci_transport_rx_pkt_consume(uint8_t * p_buffer)
-{
-    return (hci_mem_pool_rx_consume(p_buffer - PKT_HDR_SIZE));     
-}

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/hci/hci_transport.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_transport.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_transport.h
deleted file mode 100644
index c09203a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/hci/hci_transport.h
+++ /dev/null
@@ -1,228 +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 hci_transport HCI Transport
- * @{
- * @ingroup  app_common
- *
- * @brief    HCI transport module implementation.
- *
- * This module implements certain specific features from the three-wire UART transport layer, 
- * defined by the Bluetooth specification version 4.0 [Vol 4] part D.
- *
- * \par Features supported
- * - Transmission and reception of Vendor Specific HCI packet type application packets.
- * - Transmission and reception of reliable packets: defined by chapter 6 of the specification.
- *
- * \par Features not supported
- * - Link establishment procedure: defined by chapter 8 of the specification.
- * - Low power: defined by chapter 9 of the specification. 
- *
- * \par Implementation specific behaviour
- * - As Link establishment procedure is not supported following static link configuration parameters
- * are used:
- * + TX window size is 1.
- * + 16 bit CCITT-CRC must be used.
- * + Out of frame software flow control not supported.
- * + Parameters specific for resending reliable packets are compile time configurable (clarifed 
- * later in this document).
- * + Acknowledgement packet transmissions are not timeout driven , meaning they are delivered for 
- * transmission within same context which the corresponding application packet was received. 
- *
- * \par Implementation specific limitations
- * Current implementation has the following limitations which will have impact to system wide 
- * behaviour:
- * - Delayed acknowledgement scheduling not implemented: 
- * There exists a possibility that acknowledgement TX packet and application TX packet will collide 
- * in the TX pipeline having the end result that acknowledgement packet will be excluded from the TX 
- * pipeline which will trigger the retransmission algorithm within the peer protocol entity.
- * - Delayed retransmission scheduling not implemented:  
- * There exists a possibility that retransmitted application TX packet and acknowledgement TX packet
- * will collide in the TX pipeline having the end result that retransmitted application TX packet 
- * will be excluded from the TX pipeline.
- * - Processing of the acknowledgement number from RX application packets:
- * Acknowledgement number is not processed from the RX application packets having the end result 
- * that unnecessary application packet retransmissions can occur.
- *
- * The application TX packet processing flow is illustrated by the statemachine below. 
- *
- * @image html hci_transport_tx_sm.png "TX - application packet statemachine"
- *
- * \par Component specific configuration options
- *
- * The following compile time configuration options are available, and used to configure the 
- * application TX packet retransmission interval, in order to suite various application specific 
- * implementations:
- * - MAC_PACKET_SIZE_IN_BITS Maximum size of a single application packet in bits. 
- * - USED_BAUD_RATE Used uart baudrate. 
- *
- * The following compile time configuration option is available to configure module specific 
- * behaviour:
- * - MAX_RETRY_COUNT Max retransmission retry count for applicaton packets.
- */
- 
-#ifndef HCI_TRANSPORT_H__
-#define HCI_TRANSPORT_H__
-
-#include <stdint.h>
-#include "nrf_error.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Generic event callback function events. */
-typedef enum
-{
-    HCI_TRANSPORT_RX_RDY,               /**< An event indicating that RX packet is ready for read. */
-    HCI_TRANSPORT_EVT_TYPE_MAX          /**< Enumeration upper bound. */  
-} hci_transport_evt_type_t;
-
-/**@brief Struct containing events from the Transport layer.
- */
-typedef struct
-{
-    hci_transport_evt_type_t evt_type;  /**< Type of event. */
-} hci_transport_evt_t;
-
-/**@brief Transport layer generic event callback function type.
- *
- * @param[in] event                Transport layer event.  
- */
-typedef void (*hci_transport_event_handler_t)(hci_transport_evt_t event);
-
-/**@brief TX done event callback function result codes. */
-typedef enum
-{
-    HCI_TRANSPORT_TX_DONE_SUCCESS,      /**< Transmission success, peer transport entity has acknowledged the transmission. */
-    HCI_TRANSPORT_TX_DONE_FAILURE       /**< Transmission failure. */    
-} hci_transport_tx_done_result_t;
-
-/**@brief Transport layer TX done event callback function type.
- *
- * @param[in] result                TX done event result code. 
- */
-typedef void (*hci_transport_tx_done_handler_t)(hci_transport_tx_done_result_t result);
-
-/**@brief Function for registering a generic event handler.
- *
- * @note Multiple registration requests will overwrite any possible existing registration. 
- *
- * @param[in] event_handler         The function to be called by the transport layer upon an event.
- *
- * @retval NRF_SUCCESS              Operation success.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.    
- */
-uint32_t hci_transport_evt_handler_reg(hci_transport_event_handler_t event_handler);
-
-/**@brief Function for registering a handler for TX done event.
- *
- * @note Multiple registration requests will overwrite any possible existing registration. 
- *
- * @param[in] event_handler         The function to be called by the transport layer upon TX done
- *                                  event.
- *
- * @retval NRF_SUCCESS              Operation success.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.    
- */
-uint32_t hci_transport_tx_done_register(hci_transport_tx_done_handler_t event_handler);
-                                        
-/**@brief Function for opening the transport channel and initializing the transport layer.
- *
- * @warning Must not be called for a channel which has been allready opened. 
- * 
- * @retval NRF_SUCCESS              Operation success.
- * @retval NRF_ERROR_INTERNAL       Operation failure. Internal error ocurred. 
- */
-uint32_t hci_transport_open(void);
-
-/**@brief Function for closing the transport channel.
- *
- * @note Can be called multiple times and also for not opened channel.
- * 
- * @retval NRF_SUCCESS              Operation success.  
- */
-uint32_t hci_transport_close(void);
-
-/**@brief Function for allocating tx packet memory.
- * 
- * @param[out] pp_memory            Pointer to the packet data.
- * 
- * @retval NRF_SUCCESS              Operation success. Memory was allocated.
- * @retval NRF_ERROR_NO_MEM         Operation failure. No memory available.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.   
- */
-uint32_t hci_transport_tx_alloc(uint8_t ** pp_memory);
-
-/**@brief Function for freeing tx packet memory.
- *
- * @note Memory management works in FIFO principle meaning that free order must match the alloc 
- *       order.
- * 
- * @retval NRF_SUCCESS              Operation success. Memory was freed.   
- */
-uint32_t hci_transport_tx_free(void);
-
-/**@brief Function for writing a packet.
- *
- * @note Completion of this method does not guarantee that actual peripheral transmission would 
- *       have completed.
- *
- * @note In case of 0 byte packet length write request, message will consist of only transport 
- *       module specific headers.  
- *
- * @retval NRF_SUCCESS              Operation success. Packet was added to the transmission queue 
- *                                  and an event will be send upon transmission completion. 
- * @retval NRF_ERROR_NO_MEM         Operation failure. Transmission queue is full and packet was not
- *                                  added to the transmission queue. User should wait for 
- *                                  a appropriate event prior issuing this operation again.
- * @retval NRF_ERROR_DATA_SIZE      Operation failure. Packet size exceeds limit.   
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.  
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. Channel is not open.
- */
-uint32_t hci_transport_pkt_write(const uint8_t * p_buffer, uint16_t length);
-
-/**@brief Function for extracting received packet.
- *
- * @note Extracted memory can't be reused by the underlying transport layer untill freed by call to 
- *       hci_transport_rx_pkt_consume().
- *
- * @param[out] pp_buffer            Pointer to the packet data.
- * @param[out] p_length             Length of packet data in bytes.  
- *
- * @retval NRF_SUCCESS              Operation success. Packet was extracted. 
- * @retval NRF_ERROR_NO_MEM         Operation failure. No packet available to extract.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.   
- */
-uint32_t hci_transport_rx_pkt_extract(uint8_t ** pp_buffer, uint16_t * p_length);
-
-/**@brief Function for consuming extracted packet described by p_buffer.
- *
- * RX memory pointed to by p_buffer is freed and can be reused by the underlying transport layer.
- *
- * @param[in] p_buffer              Pointer to the buffer that has been consumed.
- *
- * @retval NRF_SUCCESS              Operation success. 
- * @retval NRF_ERROR_NO_MEM         Operation failure. No packet available to consume. 
- * @retval NRF_ERROR_INVALID_ADDR   Operation failure. Not a valid pointer. 
- */
-uint32_t hci_transport_rx_pkt_consume(uint8_t * p_buffer);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // HCI_TRANSPORT_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/ic_info/nrf_ic_info.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/ic_info/nrf_ic_info.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/ic_info/nrf_ic_info.c
deleted file mode 100644
index 1572053..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/ic_info/nrf_ic_info.c
+++ /dev/null
@@ -1,67 +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_ic_info.h"
-#include "nrf.h"
-
-#define PART_NO_NRF51 0x01
-#define PART_NO_NRF52 0x06
-
-void nrf_ic_info_get(nrf_ic_info_t * p_ic_info)
-{
-    uint32_t ic_data    = ((*((uint32_t volatile *)0xF0000FE8)) & 0x000000F0) >> 4;
-    uint32_t ic_part_no = ((*((uint32_t volatile *)0xF0000FE0)) & 0x000000FF);
-
-    switch (ic_part_no)
-    {
-#if defined(NRF51)
-        case PART_NO_NRF51:
-        {
-            p_ic_info->ram_size   = (uint16_t) NRF_FICR->NUMRAMBLOCK;
-            p_ic_info->ram_size   *= (uint16_t) (NRF_FICR->SIZERAMBLOCKS / 1024);
-            p_ic_info->flash_size = (uint16_t) NRF_FICR->CODESIZE;
-
-            switch (ic_data)
-            {
-                /** IC revision 1 */
-                case 1:
-                    p_ic_info->ic_revision = IC_REVISION_NRF51_REV1;
-                    break;
-
-                /** IC revision 2 */
-                case 4:
-                    p_ic_info->ic_revision = IC_REVISION_NRF51_REV2;
-                    break;
-
-                /** IC revision 3 */
-                case 7:
-                    /* fall through */
-                case 8:
-                    /* fall through */
-                case 9:
-                    p_ic_info->ic_revision = IC_REVISION_NRF51_REV3;
-                    break;
-
-                default:
-                    p_ic_info->ic_revision = IC_REVISION_NRF51_UNKNOWN;
-                    break;
-            }
-            break;
-        }
-#endif
-        default:
-            p_ic_info->ic_revision = IC_PART_UNKNOWN;
-            p_ic_info->flash_size  = 0;
-            p_ic_info->ram_size    = 0;
-            break;
-    }
-}

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/ic_info/nrf_ic_info.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/ic_info/nrf_ic_info.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/ic_info/nrf_ic_info.h
deleted file mode 100644
index db40097..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/ic_info/nrf_ic_info.h
+++ /dev/null
@@ -1,65 +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
- *
- * @defgroup nrf_ic_info IC information
- * @{
- * @ingroup app_common
- *
- * @brief Library for checking IC information (IC revision, RAM size, FLASH size).
- *
- */
-
-#ifndef NRF51_IC_INFO_H__
-#define NRF51_IC_INFO_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Enum identifying the IC revision as described in the Compatibility Matrix. */
-typedef enum
-{
-    IC_PART_UNKNOWN = 0,        /**< IC Revision unknown. */
-    IC_REVISION_NRF51_REV1,     /**< IC Revision 1. */
-    IC_REVISION_NRF51_REV2,     /**< IC Revision 2. */
-    IC_REVISION_NRF51_REV3,     /**< IC Revision 3. */
-    IC_REVISION_NRF51_UNKNOWN   /**< IC Revision unknown. */
-} nrf_ic_revision_t;
-
- /**@brief IC information struct containing the IC revision, RAM size, and FLASH size. */
-typedef struct
-{
-    nrf_ic_revision_t ic_revision;    /**< IC revision. */
-    uint16_t          ram_size;       /**< RAM size in kB (16 = 16 kB RAM). */
-    uint16_t          flash_size;     /**< FLASH size in kB (256 = 256 kB FLASH). */
-} nrf_ic_info_t;
-
-
-/**@brief  Function for returning information about the IC revision, the RAM size, and the FLASH size.
- *
- * @param[out]  p_ic_info  Struct containing IC revision, RAM size, and FLASH size.
- *
- */
-void nrf_ic_info_get(nrf_ic_info_t*  p_ic_info);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF51_IC_INFO_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/led_softblink/led_softblink.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/led_softblink/led_softblink.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/led_softblink/led_softblink.c
deleted file mode 100644
index 71b2359..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/led_softblink/led_softblink.c
+++ /dev/null
@@ -1,201 +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 <string.h>
-#include "led_softblink.h"
-#include "nrf_gpio.h"
-#include "app_timer.h"
-#include "nrf_assert.h"
-#include "low_power_pwm.h"
-
-/* Period for LED softblink PWM. */
-#define PWM_PERIOD UINT8_MAX
-
-/**@bref Structure to handle timer time-outs
- *
- */
-typedef struct
-{
-    bool                    leds_is_on;     /**< Flag for indicating if LEDs are on. */
-    bool                    is_counting_up; /**< Flag for indicating if counter is incrementing or decrementing. */
-    nrf_drv_state_t         led_sb_state;   /**< Indicates current state of instance. */
-    uint16_t                duty_cycle;     /**< Current pulse width. */
-    uint32_t                bit_mask;       /**< Mask of used pins. */
-    led_sb_init_params_t    params;         /**< Structure holding initialization parameters. */
-    low_power_pwm_config_t  pwm_config;     /**< Structure holding parameters for initializing low level layer. */
-    low_power_pwm_t         pwm_instance;   /**< Structure holding low-power PWM instance parameters. */
-}led_sb_context_t;
-
-static led_sb_context_t m_led_sb = {0};
-
-/**@brief Timer event handler for softblink.
- *
- * @param[in] p_context            General purpose pointer. Will be passed to the time-out handler
- *                                when the timer expires.
- *
- */
-static void led_softblink_on_timeout(void * p_context)
-{
-    static int32_t pause_ticks;
-    ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED);
-    ret_code_t err_code;
-    
-    if(pause_ticks <= 0)
-    {
-        if (m_led_sb.is_counting_up)
-        {
-            if (m_led_sb.duty_cycle >= (m_led_sb.params.duty_cycle_max - m_led_sb.params.duty_cycle_step))
-            {
-                // Max PWM duty cycle is reached, start decrementing.
-                m_led_sb.is_counting_up = false;
-                m_led_sb.duty_cycle     = m_led_sb.params.duty_cycle_max;
-                pause_ticks = m_led_sb.params.on_time_ticks ? m_led_sb.params.on_time_ticks + APP_TIMER_MIN_TIMEOUT_TICKS : 0;
-            }
-            else
-            {
-                m_led_sb.duty_cycle += m_led_sb.params.duty_cycle_step;
-            }
-        }
-        else
-        {
-            if (m_led_sb.duty_cycle <= (m_led_sb.params.duty_cycle_min + m_led_sb.params.duty_cycle_step))
-            {
-                // Min PWM duty cycle is reached, start incrementing.
-                m_led_sb.is_counting_up = true;
-                m_led_sb.duty_cycle     = m_led_sb.params.duty_cycle_min;
-                pause_ticks = m_led_sb.params.off_time_ticks ? m_led_sb.params.off_time_ticks + APP_TIMER_MIN_TIMEOUT_TICKS : 0;
-            }
-            else
-            {
-                m_led_sb.duty_cycle -= m_led_sb.params.duty_cycle_step;
-            }
-        } 
-    }
-    else
-    {
-        pause_ticks -= PWM_PERIOD;
-    }
-    
-    err_code = low_power_pwm_duty_set(&m_led_sb.pwm_instance, m_led_sb.duty_cycle);
-    
-    APP_ERROR_CHECK(err_code);
-}
-
-
-ret_code_t led_softblink_init(led_sb_init_params_t * p_init_params)
-{
-    ret_code_t err_code;
-    
-    ASSERT(m_led_sb.led_sb_state == NRF_DRV_STATE_UNINITIALIZED);
-
-    ASSERT(p_init_params);
-    
-    if ( (p_init_params->duty_cycle_max == 0)                               ||
-         (p_init_params->duty_cycle_max <= p_init_params->duty_cycle_min)   ||
-         (p_init_params->duty_cycle_step == 0)                              ||
-         (p_init_params->leds_pin_bm == 0))
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
- 
-    
-    
-    memset(&m_led_sb, 0, sizeof(led_sb_context_t));
-    memcpy(&m_led_sb.params, p_init_params, sizeof(led_sb_init_params_t));
-    
-    m_led_sb.is_counting_up = true;
-    m_led_sb.duty_cycle     = p_init_params->duty_cycle_min + p_init_params->duty_cycle_step;
-    m_led_sb.leds_is_on     = false;
-    m_led_sb.bit_mask       = p_init_params->leds_pin_bm;
-    
-    APP_TIMER_DEF(led_softblink_timer);
-    
-    m_led_sb.pwm_config.active_high         = m_led_sb.params.active_high;
-    m_led_sb.pwm_config.bit_mask            = p_init_params->leds_pin_bm;
-    m_led_sb.pwm_config.period              = PWM_PERIOD;
-    m_led_sb.pwm_config.p_timer_id          = &led_softblink_timer;
-    
-    err_code = low_power_pwm_init( &m_led_sb.pwm_instance, &m_led_sb.pwm_config, led_softblink_on_timeout);
-    
-    if (err_code == NRF_SUCCESS)
-    {
-        m_led_sb.led_sb_state = NRF_DRV_STATE_INITIALIZED;
-    }
-    else
-    {
-        return err_code;
-    }
-    
-    err_code = low_power_pwm_duty_set( &m_led_sb.pwm_instance, p_init_params->duty_cycle_min + p_init_params->duty_cycle_step);
-
-    return err_code;
-}
-
-
-ret_code_t led_softblink_start(uint32_t leds_pin_bit_mask)
-{
-    ret_code_t err_code;
-    
-    ASSERT(m_led_sb.led_sb_state == NRF_DRV_STATE_INITIALIZED);
-    
-    err_code = low_power_pwm_start(&m_led_sb.pwm_instance, leds_pin_bit_mask);
-    
-    return err_code;
-}
-
-
-ret_code_t led_softblink_stop(void)
-{
-    ret_code_t err_code;
-    
-    err_code = low_power_pwm_stop(&m_led_sb.pwm_instance);
-    
-    return err_code;
-}
-
-
-void led_softblink_off_time_set(uint32_t off_time_ticks)
-{
-    ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED);
-
-    m_led_sb.params.off_time_ticks = off_time_ticks;
-}
-
-
-void led_softblink_on_time_set(uint32_t on_time_ticks)
-{
-    ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED);
-
-    m_led_sb.params.on_time_ticks = on_time_ticks;
-}
-
-
-ret_code_t led_softblink_uninit(void)
-{
-    ASSERT(m_led_sb.led_sb_state != NRF_DRV_STATE_UNINITIALIZED);
-
-    ret_code_t err_code;
-    
-    err_code = led_softblink_stop();
-   
-    if (err_code == NRF_SUCCESS)
-    {
-        m_led_sb.led_sb_state = NRF_DRV_STATE_UNINITIALIZED;
-    }
-    else
-    {
-        return err_code;
-    }
-    
-    memset(&m_led_sb, 0, sizeof(m_led_sb));
-
-    return NRF_SUCCESS;
-}

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/led_softblink/led_softblink.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/led_softblink/led_softblink.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/led_softblink/led_softblink.h
deleted file mode 100644
index 4aa976b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/led_softblink/led_softblink.h
+++ /dev/null
@@ -1,139 +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
- *
- * @defgroup led_softblink LED softblink
- * @{
- * @ingroup app_common
- *
- * @brief Module for generating a changing pulse-width modulated output signal that is used to smoothly blink LEDs.
- *
- * @details This module provides an LED softblink implementation using timers and GPIO.
- *
- * LED softblink needs one timer. It can use any number of output channels that are available. 
- *
- * Only one instance of LED softblink can run at a time.
- */
-
-#ifndef LED_SOFTBLINK_H__
-#define LED_SOFTBLINK_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "sdk_errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Structure holding the initialization parameters.
- */
-typedef struct
-{
-    bool     active_high;      /**< Activate negative polarity. */
-    uint8_t  duty_cycle_max;   /**< Maximum impulse width. */
-    uint8_t  duty_cycle_min;   /**< Minimum impulse width. */
-    uint8_t  duty_cycle_step;  /**< Cycle step. */ 
-    uint32_t off_time_ticks;   /**< Ticks to stay in low impulse state. */
-    uint32_t on_time_ticks;    /**< Ticks to stay in high impulse state. */ 
-    uint32_t leds_pin_bm;      /**< Mask of used LEDs. */
-}led_sb_init_params_t;
-
-/**
- * @name Default settings
- * @brief Default settings for LED softblink.
- * @{
- */
-#define LED_SB_INIT_PARAMS_ACTIVE_HIGH            false
-#define LED_SB_INIT_PARAMS_DUTY_CYCLE_MAX         220
-#define LED_SB_INIT_PARAMS_DUTY_CYCLE_MIN         0
-#define LED_SB_INIT_PARAMS_DUTY_CYCLE_STEP        5
-#define LED_SB_INIT_PARAMS_OFF_TIME_TICKS         65536
-#define LED_SB_INIT_PARAMS_ON_TIME_TICKS          0
-#define LED_SB_INIT_PARAMS_LEDS_PIN_BM(mask)      (mask)
-/** @} */
-
-/**
- * @brief LED softblink default configuration.
- */
-#define LED_SB_INIT_DEFAULT_PARAMS(mask)                            \
-{                                                                   \
-    .active_high        = LED_SB_INIT_PARAMS_ACTIVE_HIGH,           \
-    .duty_cycle_max     = LED_SB_INIT_PARAMS_DUTY_CYCLE_MAX,        \
-    .duty_cycle_min     = LED_SB_INIT_PARAMS_DUTY_CYCLE_MIN,        \
-    .duty_cycle_step    = LED_SB_INIT_PARAMS_DUTY_CYCLE_STEP,       \
-    .off_time_ticks     = LED_SB_INIT_PARAMS_OFF_TIME_TICKS,        \
-    .on_time_ticks      = LED_SB_INIT_PARAMS_ON_TIME_TICKS,         \
-    .leds_pin_bm        = LED_SB_INIT_PARAMS_LEDS_PIN_BM(mask)      \
-}
-
-/**
- * @brief Function for initializing LED softblink.
- *
- * @param[in] p_init_params          Pointer to the initialization structure.
- *
- * @return Values returned by @ref app_timer_create.
- */
-ret_code_t led_softblink_init(led_sb_init_params_t * p_init_params);
-
-/**
- * @brief Function for starting to blink LEDs.
- *
- * @param[in] leds_pin_bit_mask        Bit mask containing the pins for the LEDs to be blinked.
- *   
- * @return Values returned by @ref app_timer_start.
- */
-ret_code_t led_softblink_start(uint32_t leds_pin_bit_mask);
-
-/**
- * @brief Function for stopping to blink LEDs.
- *
- * @return Values returned by @ref app_timer_stop.
- */
-ret_code_t led_softblink_stop(void);
-
-/**
- * @brief Function for setting the off time.
- *
- * This function configures the time that the LEDs will be off between each blink.
- *
- * @param[in] off_time_ticks              Off time in ticks.
- *
- */
-void led_softblink_off_time_set(uint32_t off_time_ticks);
-
-/**
- * @brief Function for setting the on time.
- *
- * This function configures the time that the LEDs will be on between each blink.
- *
- * @param[in] on_time_ticks               On time in ticks.
- *
- */
-void led_softblink_on_time_set(uint32_t on_time_ticks);
-
-/**
- * @brief Function for uninitializing LED softblink.
- *
- * @retval NRF_SUCCESS          If LED softblink was uninitialized successfully.
- */
-ret_code_t led_softblink_uninit(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // LED_SOFTBLINK_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/low_power_pwm/low_power_pwm.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/low_power_pwm.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/low_power_pwm.c
deleted file mode 100644
index 4408547..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/low_power_pwm/low_power_pwm.c
+++ /dev/null
@@ -1,216 +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 <string.h>
-#include "low_power_pwm.h"
-#include "nrf_gpio.h"
-#include "app_timer.h"
-#include "nrf_assert.h"
-
-/**
- * @brief Function for turning on LEDs.
- *
- * Sets the pin high state according to active_high parameter.
- * 
- * @param[in] p_pwm_instance        Pointer to instance of low-power PWM.
- */
-__STATIC_INLINE void led_on(low_power_pwm_t * p_pwm_instance)
-{
-    if (p_pwm_instance->active_high)
-    {
-        nrf_gpio_pins_set(p_pwm_instance->bit_mask_toggle);
-    }
-    else
-    {
-        nrf_gpio_pins_clear(p_pwm_instance->bit_mask_toggle);
-    }
-    p_pwm_instance->led_is_on = true;
-}
-
-
-/**
- * @brief Function for turning off LEDs.
- *
- * Sets the pin low state according to active_high parameter.
- *
- * @param[in] p_pwm_instance        Pointer to instance of low-power PWM.
- */
-__STATIC_INLINE void led_off(low_power_pwm_t * p_pwm_instance)
-{
-    if (p_pwm_instance->active_high)
-    {
-        nrf_gpio_pins_clear(p_pwm_instance->bit_mask_toggle);
-    }
-    else
-    {
-        nrf_gpio_pins_set(p_pwm_instance->bit_mask_toggle);
-    }
-    p_pwm_instance->led_is_on = false;
-}
-
-
-/**
- * @brief Timer event handler for PWM.
- *
- * @param[in] p_context             General purpose pointer. Will be passed to the time-out handler
- *                                  when the timer expires.
- *
- */
-static void pwm_timeout_handler(void * p_context)
-{
-    ret_code_t err_code;
-    uint8_t duty_cycle;
-    
-    low_power_pwm_t * p_pwm_instance = (low_power_pwm_t *)p_context;
-    
-    p_pwm_instance->pwm_state = NRF_DRV_STATE_INITIALIZED;
-    
-    if(p_pwm_instance->evt_type == LOW_POWER_PWM_EVENT_PERIOD)
-    {        
-        if (p_pwm_instance->handler)
-        {
-            p_pwm_instance->handler(p_pwm_instance);
-        }
-        
-        duty_cycle = p_pwm_instance->duty_cycle;
-        
-        if(duty_cycle == p_pwm_instance->period)    // Process duty cycle 100%
-        {
-            led_on(p_pwm_instance);
-            p_pwm_instance->timeout_ticks = p_pwm_instance->period + APP_TIMER_MIN_TIMEOUT_TICKS;
-        }
-        else if (duty_cycle == 0)   // Process duty cycle 0%
-        {
-            led_off(p_pwm_instance);
-            p_pwm_instance->timeout_ticks = p_pwm_instance->period + APP_TIMER_MIN_TIMEOUT_TICKS;
-        }
-        else // Process any other duty cycle than 0 or 100%
-        {
-            led_on(p_pwm_instance);
-            p_pwm_instance->timeout_ticks = ((duty_cycle*p_pwm_instance->period)>>8) +
-                                APP_TIMER_MIN_TIMEOUT_TICKS;
-            // setting next state
-            p_pwm_instance->evt_type = LOW_POWER_PWM_EVENT_DUTY_CYCLE;
-        }
-    }
-    else
-    {
-        led_off(p_pwm_instance);
-        p_pwm_instance->evt_type = LOW_POWER_PWM_EVENT_PERIOD;
-        p_pwm_instance->timeout_ticks = (((p_pwm_instance->period - p_pwm_instance->duty_cycle)*p_pwm_instance->period)>>8) +
-                                  APP_TIMER_MIN_TIMEOUT_TICKS;
-    }
-    
-    if (p_pwm_instance->pwm_state == NRF_DRV_STATE_INITIALIZED)
-    {
-        err_code = app_timer_start(*p_pwm_instance->p_timer_id, p_pwm_instance->timeout_ticks, p_pwm_instance);
-        APP_ERROR_CHECK(err_code);
-    }
-}
-
-
-ret_code_t low_power_pwm_init(low_power_pwm_t * p_pwm_instance, low_power_pwm_config_t const * p_pwm_config, app_timer_timeout_handler_t handler)
-{ 
-    ASSERT(p_pwm_instance->pwm_state == NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(p_pwm_config->bit_mask != 0);
-    ASSERT(p_pwm_config->period != 0);
- 
-    ret_code_t err_code;
-    uint32_t bit_mask;
-    uint32_t pin_number = 0;
-    
-    p_pwm_instance->handler = handler;
-    
-    bit_mask = p_pwm_config->bit_mask;
-    
-    p_pwm_instance->active_high = p_pwm_config->active_high;
-    p_pwm_instance->bit_mask = p_pwm_config->bit_mask;
-    p_pwm_instance->bit_mask_toggle = p_pwm_config->bit_mask;
-    p_pwm_instance->period = p_pwm_config->period;
-    p_pwm_instance->p_timer_id = p_pwm_config->p_timer_id;
-    
-    err_code = app_timer_create(p_pwm_instance->p_timer_id, APP_TIMER_MODE_SINGLE_SHOT, pwm_timeout_handler);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    while (bit_mask)
-    {
-        if (bit_mask & 0x1UL)
-        {
-            nrf_gpio_cfg_output(pin_number);
-        }
-
-        pin_number++;
-        bit_mask >>= 1UL;
-    }
-    
-    led_off(p_pwm_instance);
-    p_pwm_instance->pwm_state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-
-ret_code_t low_power_pwm_start(low_power_pwm_t * p_pwm_instance,
-                             uint32_t          leds_pin_bit_mask)
-{
-    ASSERT(p_pwm_instance->pwm_state == NRF_DRV_STATE_INITIALIZED);
-    ASSERT(((~p_pwm_instance->bit_mask) & leds_pin_bit_mask) == false);
-
-    p_pwm_instance->pwm_state = NRF_DRV_STATE_POWERED_ON;
-    p_pwm_instance->bit_mask_toggle = leds_pin_bit_mask;
-    
-    led_off(p_pwm_instance);
-    
-    p_pwm_instance->bit_mask = leds_pin_bit_mask;
-    p_pwm_instance->evt_type = LOW_POWER_PWM_EVENT_PERIOD;
-    pwm_timeout_handler(p_pwm_instance);
-    
-    return NRF_SUCCESS;
-}
-
-
-ret_code_t low_power_pwm_stop(low_power_pwm_t * p_pwm_instance)
-{
-    ASSERT(p_pwm_instance->pwm_state == NRF_DRV_STATE_POWERED_ON);
-
-    ret_code_t err_code;    
-    
-    err_code = app_timer_stop(*p_pwm_instance->p_timer_id);
-    
-    led_off(p_pwm_instance);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    p_pwm_instance->pwm_state = NRF_DRV_STATE_INITIALIZED;
-
-
-    return NRF_SUCCESS;
-}
-
-
-ret_code_t low_power_pwm_duty_set(low_power_pwm_t * p_pwm_instance, uint8_t duty_cycle)
-{
-    if ( p_pwm_instance->period < duty_cycle)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    p_pwm_instance->duty_cycle = duty_cycle;
-
-    return NRF_SUCCESS;
-}


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

Posted by cc...@apache.org.
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/dfu_transport_serial.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport_serial.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport_serial.c
deleted file mode 100644
index b2ab3cc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_transport_serial.c
+++ /dev/null
@@ -1,306 +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 "dfu_transport.h"
-#include <stddef.h>
-#include "dfu.h"
-#include <dfu_types.h>
-#include "app_error.h"
-#include "app_util.h"
-#include "hci_transport.h"
-#include "app_timer.h"
-#include "app_scheduler.h"
-
-#define MAX_BUFFERS          4u                                                      /**< Maximum number of buffers that can be received queued without being consumed. */
-
-/**
- * defgroup Data Packet Queue Access Operation Macros
- * @{
- */
-
-/** Provides status showing if the queue is full or not. */
-#define DATA_QUEUE_FULL()                                                                         \
-        (((MAX_BUFFERS -1) == m_data_queue.count) ? true : false)
-
-/** Provides status showing if the queue is empty or not */
-#define DATA_QUEUE_EMPTY()                                                                        \
-        ((0 == m_data_queue.count) ? true : false)
-
-/** Initializes an element of the data queue. */
-#define DATA_QUEUE_ELEMENT_INIT(i)                                                                \
-        m_data_queue.data_packet[(i)].packet_type = INVALID_PACKET
-
-/** Sets the packet type of an element of the data queue. */
-#define DATA_QUEUE_ELEMENT_SET_PTYPE(i, t)                                                         \
-        m_data_queue.data_packet[(i)].packet_type = (t)
-
-/** Copies a data packet pointer of an element of the data queue. */
-#define DATA_QUEUE_ELEMENT_COPY_PDATA(i, dp)                                                       \
-        m_data_queue.data_packet[(i)].params.data_packet.p_data_packet = (uint32_t *)(dp)
-
-/** Sets the packet length of an element in the data queue. */
-#define DATA_QUEUE_ELEMENT_SET_PLEN(i, l)                                                          \
-        m_data_queue.data_packet[(i)].params.data_packet.packet_length = (l)
-
-/** Gets a data packet pointer of an element in the data queue. */
-#define DATA_QUEUE_ELEMENT_GET_PDATA(i)                                                           \
-        (m_data_queue.data_packet[(i)].params.data_packet.p_data_packet)
-
-/** Gets the packet type of an element in the data queue. */
-#define DATA_QUEUE_ELEMENT_GET_PTYPE(i)                                                           \
-        m_data_queue.data_packet[(i)].packet_type
-
-/* @} */
-
-/** Abstracts data packet queue */
-typedef struct
-{
-    dfu_update_packet_t   data_packet[MAX_BUFFERS];                                  /**< Bootloader data packets used when processing data from the UART. */
-    volatile uint8_t      count;                                                     /**< Counter to maintain number of elements in the queue. */
-} dfu_data_queue_t;
-
-static dfu_data_queue_t      m_data_queue;                                           /**< Received-data packet queue. */
-
-/**@brief Initializes an element of the data buffer queue.
- *
- * @param[in] element_index index of the element.
- */
-static void data_queue_element_init (uint8_t element_index)
-{
-    DATA_QUEUE_ELEMENT_INIT(element_index);
-    DATA_QUEUE_ELEMENT_SET_PTYPE(element_index, INVALID_PACKET);
-    DATA_QUEUE_ELEMENT_COPY_PDATA(element_index, NULL);
-    DATA_QUEUE_ELEMENT_SET_PLEN(element_index, 0);
-}
-
-/** Initializes data buffer queue */
-static void data_queue_init(void)
-{
-    uint32_t index;
-
-    m_data_queue.count = 0;
-
-    for (index = 0; index < MAX_BUFFERS; index++)
-    {
-        data_queue_element_init(index);
-    }
-}
-
-/**@brief Function for freeing an element.
- *
- * @param[in] element_index index of the element.
- */
-static uint32_t data_queue_element_free(uint8_t element_index)
-{
-    uint8_t * p_data;
-    uint32_t  retval;
-
-    retval = NRF_ERROR_INVALID_PARAM;
-    
-    if (MAX_BUFFERS > element_index)
-    {
-        p_data = (uint8_t *)DATA_QUEUE_ELEMENT_GET_PDATA(element_index);
-        if (INVALID_PACKET != DATA_QUEUE_ELEMENT_GET_PTYPE(element_index))
-        {
-            m_data_queue.count--;
-            data_queue_element_init (element_index);
-            retval = hci_transport_rx_pkt_consume((p_data - 4));
-            APP_ERROR_CHECK(retval);
-        }
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    return NRF_SUCCESS;
-}
-
-/**@brief Function for Allocating element.
- *
- * @param[in]   packet_type      packet type.
- * @param[out]  p_element_index  index of the element.
- */
-static uint32_t data_queue_element_alloc(uint8_t * p_element_index, uint8_t packet_type)
-{
-    uint32_t retval;
-    uint32_t index;
-
-    retval = NRF_ERROR_NO_MEM;
-    
-    if (INVALID_PACKET == packet_type)
-    {
-        retval = NRF_ERROR_INVALID_PARAM;
-    }
-    else if (true == DATA_QUEUE_FULL())
-    {
-        retval = NRF_ERROR_NO_MEM;
-    }
-    else
-    {
-        for (index = 0; index < MAX_BUFFERS; index++)
-        {
-            if (INVALID_PACKET == DATA_QUEUE_ELEMENT_GET_PTYPE(index))
-            {
-                // Found a free element: allocate, and end search.
-                *p_element_index = index;
-                DATA_QUEUE_ELEMENT_SET_PTYPE(index, packet_type);
-                retval = NRF_SUCCESS;
-                m_data_queue.count++;
-                break;
-            }
-        }
-    }
-
-    return retval;
-}
-
-// Flush everything on disconnect or stop.
-static void data_queue_flush(void)
-{
-    uint32_t index;
-
-    for (index = 0; index < MAX_BUFFERS; index++)
-    {
-         // In this case it does not matter if free succeeded or not as data packets are being flushed because DFU Trnsport was closed
-        (void)data_queue_element_free(index);
-    }
-}
-
-
-/**@brief       Function for handling the callback events from the dfu module.
- *              Callbacks are expected when \ref dfu_data_pkt_handle has been executed.
- *
- * @param[in]   packet  Packet type for which this callback is related. START_PACKET, DATA_PACKET.
- * @param[in]   result  Operation result code. NRF_SUCCESS when a queued operation was successful.
- * @param[in]   p_data  Pointer to the data to which the operation is related.
- */
-static void dfu_cb_handler(uint32_t packet, uint32_t result, uint8_t * p_data)
-{
-    APP_ERROR_CHECK(result);
-}
-
-
-static void process_dfu_packet(void * p_event_data, uint16_t event_size)
-{
-    uint32_t              retval;
-    uint32_t              index;
-    dfu_update_packet_t * packet;
-
-        while (false == DATA_QUEUE_EMPTY())
-        {
-            // Fetch the element to be processed.
-            for (index = 0; index < MAX_BUFFERS ; index++)
-            {
-                packet = &m_data_queue.data_packet[index];
-                if (INVALID_PACKET != packet->packet_type)
-                {
-
-                    switch (DATA_QUEUE_ELEMENT_GET_PTYPE(index))
-                    {
-                        case DATA_PACKET:
-                            (void)dfu_data_pkt_handle(packet);
-                            break;
-
-                        case START_PACKET:
-                            packet->params.start_packet = 
-                                (dfu_start_packet_t*)packet->params.data_packet.p_data_packet;
-                            retval = dfu_start_pkt_handle(packet);
-                            APP_ERROR_CHECK(retval);
-                            break;
-
-                        case INIT_PACKET:
-                            (void)dfu_init_pkt_handle(packet);
-                            retval = dfu_init_pkt_complete();
-                            APP_ERROR_CHECK(retval);
-                            break;
-
-                        case STOP_DATA_PACKET:
-                            (void)dfu_image_validate();
-                            (void)dfu_image_activate();
-
-                            // Break the loop by returning.
-                            return;
-
-                        default:
-                            // No implementation needed.
-                            break;
-                    }
-
-                    // Free the processed element.
-                    retval = data_queue_element_free(index);
-                    APP_ERROR_CHECK(retval);
-                }
-            }
-        }
-}
-
-
-void rpc_transport_event_handler(hci_transport_evt_t event)
-{
-    uint32_t  retval;
-    uint16_t  rpc_cmd_length_read = 0;
-    uint8_t * p_rpc_cmd_buffer = NULL;
-    uint8_t   element_index;
-
-    retval = hci_transport_rx_pkt_extract(&p_rpc_cmd_buffer, &rpc_cmd_length_read);
-    if (NRF_SUCCESS == retval)
-    {
-        // Verify if the data queue can buffer the packet.
-        retval = data_queue_element_alloc(&element_index, p_rpc_cmd_buffer[0]);
-        if (NRF_SUCCESS == retval)
-        {
-            //subtract 1 since we are interested in payload length and not the type field.
-            DATA_QUEUE_ELEMENT_SET_PLEN(element_index,(rpc_cmd_length_read / sizeof(uint32_t)) - 1);
-            DATA_QUEUE_ELEMENT_COPY_PDATA(element_index, &p_rpc_cmd_buffer[4]);
-            retval = app_sched_event_put(NULL, 0, process_dfu_packet);
-        }
-    }
-    
-    if (p_rpc_cmd_buffer != NULL && NRF_SUCCESS != retval)
-    {
-        // Free the packet that could not be processed.
-        retval = hci_transport_rx_pkt_consume(p_rpc_cmd_buffer);
-        APP_ERROR_CHECK(retval);
-    }
-}
-
-
-uint32_t dfu_transport_update_start(void)
-{
-    uint32_t err_code;
-
-    // Initialize data buffer queue.
-    data_queue_init();
-
-    dfu_register_callback(dfu_cb_handler);
-
-    // Open transport layer.
-    err_code = hci_transport_open();
-    APP_ERROR_CHECK(err_code);
-
-    // Register callback to be run when commands have been received by the transport layer.
-    err_code = hci_transport_evt_handler_reg(rpc_transport_event_handler);
-    APP_ERROR_CHECK(err_code);
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t dfu_transport_close(void)
-{
-    // Remove all buffered packets.
-    data_queue_flush();
-    
-    return hci_transport_close();
-}
-

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/dfu_types.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_types.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_types.h
deleted file mode 100644
index 1415ee1..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/dfu_types.h
+++ /dev/null
@@ -1,176 +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_dfu_types Types and definitions.
- * @{
- *
- * @ingroup nrf_dfu
- *
- * @brief Device Firmware Update module type and definitions.
- */
-
-#ifndef DFU_TYPES_H__
-#define DFU_TYPES_H__
-
-#include <stdint.h>
-#include "nrf_sdm.h"
-#include "nrf_mbr.h"
-#include "nrf.h"
-#include "app_util.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define NRF_UICR_BOOT_START_ADDRESS         (NRF_UICR_BASE + 0x14)      /**< Register where the bootloader start address is stored in the UICR register. */
-
-#if defined(NRF52)                                                  
-#define NRF_UICR_MBR_PARAMS_PAGE_ADDRESS    (NRF_UICR_BASE + 0x18)      /**< Register where the mbr params page is stored in the UICR register. (Only in use in nRF52 MBR).*/
-#endif                                                              
-
-#define CODE_REGION_1_START                 SD_SIZE_GET(MBR_SIZE)       /**< This field should correspond to the size of Code Region 0, (which is identical to Start of Code Region 1), found in UICR.CLEN0 register. This value is used for compile safety, as the linker will fail if application expands into bootloader. Runtime, the bootloader will use the value found in UICR.CLEN0. */
-#define SOFTDEVICE_REGION_START             MBR_SIZE                    /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
-
-#ifdef NRF51        
-
-#define CODE_PAGE_SIZE                      0x0400                      /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */
-
-#ifdef SIGNING      
-
-#define BOOTLOADER_REGION_START             0x00039C00                  /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
-#define BOOTLOADER_SETTINGS_ADDRESS         0x0003D800                  /**< The field specifies the page location of the bootloader settings address. */
-
-#else       
-
-#define BOOTLOADER_REGION_START             0x0003C000                  /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
-#define BOOTLOADER_SETTINGS_ADDRESS         0x0003FC00                  /**< The field specifies the page location of the bootloader settings address. */
-
-#endif      
-
-
-        
-#elif NRF52     
-        
-#define BOOTLOADER_REGION_START             0x0007A000                  /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
-#define BOOTLOADER_SETTINGS_ADDRESS         0x0007F000                  /**< The field specifies the page location of the bootloader settings address. */
-#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS  0x0007E000                  /**< The field specifies the page location of the mbr params page address. */
-        
-#define CODE_PAGE_SIZE                      0x1000                      /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */
-
-#else
-
-#error No target defined
-
-#endif
-
-#define DFU_REGION_TOTAL_SIZE           (BOOTLOADER_REGION_START - CODE_REGION_1_START)                 /**< Total size of the region between SD and Bootloader. */
-
-#ifndef DFU_APP_DATA_RESERVED
-#define DFU_APP_DATA_RESERVED           CODE_PAGE_SIZE * 0                                              /**< Size of Application Data that must be preserved between application updates. This value must be a multiple of page size. Page size is 0x400 (1024d) bytes, thus this value must be 0x0000, 0x0400, 0x0800, 0x0C00, 0x1000, etc. */
-#endif
-
-#define DFU_IMAGE_MAX_SIZE_FULL         (DFU_REGION_TOTAL_SIZE - DFU_APP_DATA_RESERVED)                 /**< Maximum size of an application, excluding save data from the application. */
-                                          
-#define DFU_IMAGE_MAX_SIZE_BANKED       (((DFU_IMAGE_MAX_SIZE_FULL) - \
-                                        (DFU_IMAGE_MAX_SIZE_FULL % (2 * CODE_PAGE_SIZE)))/2)            /**< Maximum size of an application, excluding save data from the application. */
-
-#define DFU_BL_IMAGE_MAX_SIZE           (BOOTLOADER_SETTINGS_ADDRESS - BOOTLOADER_REGION_START)         /**< Maximum size of a bootloader, excluding save data from the current bootloader. */
-
-#define DFU_BANK_0_REGION_START         CODE_REGION_1_START                                             /**< Bank 0 region start. */
-#define DFU_BANK_1_REGION_START         (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED)           /**< Bank 1 region start. */
-
-#define EMPTY_FLASH_MASK                0xFFFFFFFF                                                      /**< Bit mask that defines an empty address in flash. */
-
-#define INVALID_PACKET                  0x00                                                            /**< Invalid packet identifies. */
-#define INIT_PACKET                     0x01                                                            /**< Packet identifies for initialization packet. */
-#define STOP_INIT_PACKET                0x02                                                            /**< Packet identifies for stop initialization packet. Used when complete init packet has been received so that the init packet can be used for pre validaiton. */
-#define START_PACKET                    0x03                                                            /**< Packet identifies for the Data Start Packet. */
-#define DATA_PACKET                     0x04                                                            /**< Packet identifies for a Data Packet. */
-#define STOP_DATA_PACKET                0x05                                                            /**< Packet identifies for the Data Stop Packet. */
-
-#define DFU_UPDATE_SD                   0x01                                                            /**< Bit field indicating update of SoftDevice is ongoing. */
-#define DFU_UPDATE_BL                   0x02                                                            /**< Bit field indicating update of bootloader is ongoing. */
-#define DFU_UPDATE_APP                  0x04                                                            /**< Bit field indicating update of application is ongoing. */
-
-#define DFU_INIT_RX                     0x00                                                            /**< Op Code identifies for receiving init packet. */
-#define DFU_INIT_COMPLETE               0x01                                                            /**< Op Code identifies for transmission complete of init packet. */
-
-// Safe guard to ensure during compile time that the DFU_APP_DATA_RESERVED is a multiple of page size.
-STATIC_ASSERT((((DFU_APP_DATA_RESERVED) & (CODE_PAGE_SIZE - 1)) == 0x00));
-
-/**@brief Structure holding a start packet containing update mode and image sizes.
- */
-typedef struct
-{
-    uint8_t  dfu_update_mode;                                                                           /**< Packet type, used to identify the content of the received packet referenced by data packet. */
-    uint32_t sd_image_size;                                                                             /**< Size of the SoftDevice image to be transferred. Zero if no SoftDevice image will be transfered. */
-    uint32_t bl_image_size;                                                                             /**< Size of the Bootloader image to be transferred. Zero if no Bootloader image will be transfered. */
-    uint32_t app_image_size;                                                                            /**< Size of the application image to be transmitted. Zero if no Bootloader image will be transfered. */
-} dfu_start_packet_t;
-
-/**@brief Structure holding a bootloader init/data packet received.
- */
-typedef struct
-{
-    uint32_t   packet_length;                                                                           /**< Packet length of the data packet. Each data is word size, meaning length of 4 is 4 words, not bytes. */
-    uint32_t * p_data_packet;                                                                           /**< Data Packet received. Each data is a word size entry. */
-} dfu_data_packet_t;
-
-/**@brief Structure for holding dfu update packet. Packet type indicate the type of packet.
- */
-typedef struct
-{
-    uint32_t   packet_type;                                                                             /**< Packet type, used to identify the content of the received packet referenced by data packet. */
-    union
-    {
-        dfu_data_packet_t    data_packet;                                                               /**< Used when packet type is INIT_PACKET or DATA_PACKET. Packet contains data received for init or data. */
-        dfu_start_packet_t * start_packet;                                                              /**< Used when packet type is START_DATA_PACKET. Will contain information on software to be updtaed, i.e. SoftDevice, Bootloader and/or Application along with image sizes. */
-    } params;
-} dfu_update_packet_t;
-
-/**@brief DFU status error codes.
-*/
-typedef enum
-{
-    DFU_UPDATE_APP_COMPLETE,                                                                            /**< Status update of application complete.*/
-    DFU_UPDATE_SD_COMPLETE,                                                                             /**< Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1. */
-    DFU_UPDATE_SD_SWAPPED,                                                                              /**< Status update of SoftDevice update complete. Note that this solely indicates that a new SoftDevice has been received and stored in bank 0 and 1. */
-    DFU_UPDATE_BOOT_COMPLETE,                                                                           /**< Status update complete.*/
-    DFU_BANK_0_ERASED,                                                                                  /**< Status bank 0 erased.*/
-    DFU_TIMEOUT,                                                                                        /**< Status timeout.*/
-    DFU_RESET                                                                                           /**< Status Reset to indicate current update procedure has been aborted and system should reset. */
-} dfu_update_status_code_t;
-
-/**@brief Structure holding DFU complete event.
-*/
-typedef struct
-{
-    dfu_update_status_code_t status_code;                                                               /**< Device Firmware Update status. */
-    uint16_t                 app_crc;                                                                   /**< CRC of the recieved application. */
-    uint32_t                 sd_size;                                                                   /**< Size of the recieved SoftDevice. */
-    uint32_t                 bl_size;                                                                   /**< Size of the recieved BootLoader. */
-    uint32_t                 app_size;                                                                  /**< Size of the recieved Application. */
-    uint32_t                 sd_image_start;                                                            /**< Location in flash where the received SoftDevice image is stored. */
-} dfu_update_status_t;
-
-/**@brief Update complete handler type. */
-typedef void (*dfu_complete_handler_t)(dfu_update_status_t dfu_update_status);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DFU_TYPES_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/experimental/dfu_init_template_signing.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/experimental/dfu_init_template_signing.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/experimental/dfu_init_template_signing.c
deleted file mode 100644
index abb52db..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/experimental/dfu_init_template_signing.c
+++ /dev/null
@@ -1,210 +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_dfu_init_template Template file with an DFU init packet handling example.
- * @{
- *
- * @ingroup nrf_dfu
- *
- * @brief This file contains a template on how to implement DFU init packet handling.
- *
- * @details The template shows how device type and revision can be used for a safety check of the 
- *          received image. It shows how validation can be performed in two stages:
- *          - Stage 1: Pre-check of firmware image before transfer to ensure the firmware matches:
- *                     - Device Type.
- *                     - Device Revision.
- *                     Installed SoftDevice.
- *                     This template can be extended with additional checks according to needs.
- *                     For example, such a check could be the origin of the image (trusted source) 
- *                     based on a signature scheme.
- *          - Stage 2: Post-check of the image after image transfer but before installing firmware.
- *                     For example, such a check could be an integrity check in form of hashing or 
- *                     verification of a signature.
- *                     In this template, a simple CRC check is carried out.
- *                     The CRC check can be replaced with other mechanisms, like signing.
- *
- * @note This module does not support security features such as image signing, but the 
- *       implementation allows for such extension.
- *       If the init packet is signed by a trusted source, it must be decrypted before it can be
- *       processed.
- */
-
-#include "dfu_init.h"
-#include <stdint.h>
-#include <string.h>
-#include <dfu_types.h>
-#include "nrf_sec.h"
-#include "nrf_error.h"
-#include "crc16.h"
-
-// The following is the layout of the extended init packet if using image length and sha256 to validate image
-// and NIST P-256 + SHA256 to sign the init_package including the extended part
-#define DFU_INIT_PACKET_POS_EXT_IDENTIFIER                  0       //< Position of the identifier for the ext package
-#define DFU_INIT_PACKET_POS_EXT_IMAGE_LENGTH                4       //< Position of the image length    
-#define DFU_INIT_PACKET_POS_EXT_IMAGE_HASH256               8       //< Position of the 256
-#define DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_R            40      //< Position of the Signature R
-#define DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_S            72      //< Position of the Signature S
-#define DFU_INIT_PACKET_EXT_LENGTH_SIGNED                   40      //< Length of the extended init packet that is part of the signed data
-#define DFU_INIT_PACKET_EXT_BEGIN
-
-#define DFU_INIT_PACKET_EXT_LENGTH_MIN          6                   //< Minimum length of the extended init packet. Init packet and CRC16
-#define DFU_INIT_PACKET_EXT_LENGTH_MAX          104                 //< Identifier (4 bytes) + Image length (4 bytes) + SHA-256 digest (32 bytes) + NIST P-256 using SHA-256 (64 bytes)
-
-#define DFU_SHA256_DIGEST_LENGTH                32                  //< Length of SHA-256 digest
-#define DFU_SIGNATURE_R_LENGTH                  32                  //< Length of the signature part r
-#define DFU_SIGNATURE_S_LENGTH                  32                  //< Length of the signature part s
-
-static uint8_t m_extended_packet[DFU_INIT_PACKET_EXT_LENGTH_MAX];   //< Data array for storage of the extended data received. The extended data follows the normal init data of type \ref dfu_init_packet_t. Extended data can be used for a CRC, hash, signature, or other data. */
-static uint8_t m_extended_packet_length;                            //< Length of the extended data received with init packet. */
- 
- #define DFU_INIT_PACKET_USES_CRC16 (0)
- #define DFU_INIT_PACKET_USES_HASH  (1)
- #define DFU_INIT_PACKET_USES_ECDS  (2)
- 
-
-/** @snippet [DFU BLE Signing public key curve points] */
-static uint8_t Qx[] = { 0x39, 0xb0, 0x58, 0x3d, 0x27, 0x07, 0x91, 0x38, 0x6a, 0xa3, 0x36, 0x0f, 0xa2, 0xb5, 0x86, 0x7e, 0xae, 0xba, 0xf7, 0xa3, 0xf4, 0x81, 0x5f, 0x78, 0x02, 0xf2, 0xa1, 0x21, 0xd5, 0x21, 0x84, 0x12 };
-static uint8_t Qy[] = { 0x4a, 0x0d, 0xfe, 0xa4, 0x77, 0x50, 0xb1, 0xb5, 0x26, 0xc0, 0x9d, 0xdd, 0xf0, 0x24, 0x90, 0x57, 0x6c, 0x64, 0x3b, 0xd3, 0xdf, 0x92, 0x3b, 0xb3, 0x47, 0x97, 0x83, 0xd4, 0xfc, 0x76, 0xf5, 0x9d };
-/** @snippet [DFU BLE Signing public key curve points] */
-
-static nrf_sec_ecc_point_t Q = {.p_x   = Qx, 
-                                .x_len = sizeof(Qx),
-                                .p_y   = Qy, 
-                                .y_len = sizeof(Qy)};
-
-uint32_t dfu_init_prevalidate(uint8_t * p_init_data, uint32_t init_data_len)
-{
-    uint32_t                i = 0;
-    static uint32_t         err_code;
-    nrf_sec_data_t          init_data;
-    nrf_sec_ecc_signature_t signature;
-        
-    // In order to support encryption then any init packet decryption function / library
-    // should be called from here or implemented at this location.
-
-    // Length check to ensure valid data are parsed.
-    if (init_data_len < sizeof(dfu_init_packet_t))
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    // Current template uses clear text data so they can be casted for pre-check.
-    dfu_init_packet_t * p_init_packet = (dfu_init_packet_t *)p_init_data;
-    
-    
-    m_extended_packet_length = ((uint32_t)p_init_data + init_data_len) -
-                                (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len];
-    
-    if (m_extended_packet_length < DFU_INIT_PACKET_EXT_LENGTH_MIN)
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    if (((uint32_t)p_init_data + init_data_len) < 
-         (uint32_t)&p_init_packet->softdevice[p_init_packet->softdevice_len])
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-    
-    memcpy(&m_extended_packet,
-           &p_init_packet->softdevice[p_init_packet->softdevice_len],
-           m_extended_packet_length);
-
-/** [DFU init application version] */
-    // To support application versioning, this check should be updated.
-    // This template allows for any application to be installed. However, 
-    // customers can place a revision number at the bottom of the application 
-    // to be verified by the bootloader. This can be done at a location 
-    // relative to the application, for example the application start 
-    // address + 0x0100.
-/** [DFU init application version] */
-    
-    // First check to verify the image to be transfered matches the device type.
-    // If no Device type is present in DFU_DEVICE_INFO then any image will be accepted.
-    if ((DFU_DEVICE_INFO->device_type != DFU_DEVICE_TYPE_EMPTY) &&
-        (p_init_packet->device_type != DFU_DEVICE_INFO->device_type))
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-    
-    // Second check to verify the image to be transfered matches the device revision.
-    // If no Device revision is present in DFU_DEVICE_INFO then any image will be accepted.
-    if ((DFU_DEVICE_INFO->device_rev != DFU_DEVICE_REVISION_EMPTY) &&
-        (p_init_packet->device_rev != DFU_DEVICE_INFO->device_rev))
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-
-    // Third check: Check the array of supported SoftDevices by this application.
-    //              If the installed SoftDevice does not match any SoftDevice in the list then an
-    //              error is returned.
-    while (i < p_init_packet->softdevice_len)
-    {
-        if (p_init_packet->softdevice[i]   == DFU_SOFTDEVICE_ANY ||
-            p_init_packet->softdevice[i++] == SD_FWID_GET(MBR_SIZE))
-        {
-            // Found a match. Break the loop.
-            break;
-        }
-        // No matching SoftDevice found - Return NRF_ERROR_INVALID_DATA.
-        return NRF_ERROR_INVALID_DATA;
-    }
-    
-    // Check that we have the correct identifier indicating that ECDS is used
-    if(*(uint32_t*)&m_extended_packet[DFU_INIT_PACKET_POS_EXT_IDENTIFIER] != DFU_INIT_PACKET_USES_ECDS)
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-    
-    // init_data consists of the regular init-packet and all the extended packet data excluding the signing key
-    init_data.length = (init_data_len - m_extended_packet_length) + DFU_INIT_PACKET_EXT_LENGTH_SIGNED;
-    init_data.p_data = p_init_data;
-
-    signature.p_r   = &m_extended_packet[DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_R];
-    signature.r_len = DFU_SIGNATURE_R_LENGTH;
-    signature.p_s   = &m_extended_packet[DFU_INIT_PACKET_POS_EXT_INIT_SIGNATURE_S];
-    signature.s_len = DFU_SIGNATURE_S_LENGTH;
-
-    err_code = nrf_sec_svc_verify(&init_data, &Q ,&signature, NRF_SEC_NIST256_SHA256);
-    return err_code;
-}
-
-uint32_t dfu_init_postvalidate(uint8_t * p_image, uint32_t image_len)
-{
-    uint8_t   image_digest[DFU_SHA256_DIGEST_LENGTH];
-    uint8_t * received_digest;
-    
-    nrf_sec_data_t data = {.p_data = p_image,
-                           .length = image_len};
-    
-    
-    // Compare image size received with signed init_packet data
-    if(image_len != *(uint32_t*)&m_extended_packet[DFU_INIT_PACKET_POS_EXT_IMAGE_LENGTH])
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-                          
-    // Calculate digest from active block.
-    nrf_sec_svc_hash(&data, image_digest, NRF_SEC_SHA256);
-
-    received_digest = &m_extended_packet[DFU_INIT_PACKET_POS_EXT_IMAGE_HASH256];
-
-    // Compare the received and calculated digests.
-    if (memcmp(&image_digest[0], received_digest, DFU_SHA256_DIGEST_LENGTH) != 0)
-    {
-        return NRF_ERROR_INVALID_DATA;
-    }
-
-    return NRF_SUCCESS;
-}

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/experimental/nrf_sec.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/experimental/nrf_sec.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/experimental/nrf_sec.h
deleted file mode 100644
index fce0ce9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/experimental/nrf_sec.h
+++ /dev/null
@@ -1,116 +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.
- *
- */
-
-#ifndef NRF_SEC_H__
-#define NRF_SEC_H__
-
-#include "nrf_svc.h"
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define NRF_SEC_SVC_BASE 0x8 /**< The lowest SVC number reserved for the nRF Security library. */
-
-/**@brief The SVC numbers used by the SVC functions in the security library. */
-enum NRF_SEC_SVCS
-{
-    NRF_SEC_SVC_HASH = NRF_SEC_SVC_BASE,  /**< SVC number for generating a digest using a hash function over a dataset. */
-    NRF_SEC_SVC_VERIFY,                   /**< SVC number for veryfying a signature for a given dataset using provided keys and signature. */
-    NRF_SEC_SVC_LAST
-};
-
-/**@brief Enumeration containing list of supported ECC curve and hash functions in the nRF Security library.
- */
-typedef enum
-{
-    NRF_SEC_NIST256_SHA256 = 0x00, /**< Selection of NIST P-256 curve with SHA-256 digest for verification of signature. */
-    NRF_SEC_ALGO_LAST              /**< Last element in enumeration closing valid algorithm list. */
-}nrf_sec_algo_t;
-
-/**@brief Enumeration containing list of supported hash functions in the nRF Security library.
- */
-typedef enum
-{
-    NRF_SEC_SHA256 = 0x00, /**< Selection of SHA-256 hash function. */
-    NRF_SEC_HASH_FUNC_LAST /**< Last element in enumeration closing valid hash function list. */
-}nrf_sec_hash_func_t;
-
-/**@brief Structure with length of data and pointer to data for signing or verification.
- */
-typedef struct
-{
-    uint32_t   length;  /**< Length of data pointed to by @ref p_data. */
-    uint8_t  * p_data;  /**< Pointer to data to be used. */
-} nrf_sec_data_t;
-
-/**@brief Structure with pointers to X and Y coordinates of a point on the curve.
- */
-typedef struct
-{
-    uint8_t  * p_x;     /**< Pointer to X coordinate of point. */
-    uint32_t   x_len;   /**< Length of data pointed to by p_x. */
-    uint8_t  * p_y;     /**< Pointer to X coordinate of point. */
-    uint32_t   y_len;   /**< Length of data pointed to by p_x. */
-} nrf_sec_ecc_point_t;
-
-/**@brief Structure with pointers to r and s parts of the ecc signature.
- */
-typedef struct
-{
-    uint8_t  * p_r;     /**< Pointer to R part of signature    */
-    uint32_t   r_len;   /**< Length of data pointed to by p_r  */
-    uint8_t  * p_s;     /**< Pointer to S part of signature    */
-    uint32_t   s_len;   /**< Length to data pointed to by p_s  */
-} nrf_sec_ecc_signature_t;
-
-/**@brief   SVC Function for verifying a signature over a given dataset.
- *
- * @param[in] p_data       Pointer to the data which must be verified.
- * @param[in] p_Q          Pointer to the public key, Q.
- * @param[in] p_signature  Pointer to the signature (r and s).
- * @param[in] algorithm    Curve and hash algorithm to be used for verifying the signature, for
-                           example NIST P-256 with SHA-256.
- *
- * @retval NRF_ERROR_INVALID_DATA  If the signature does not match the dataset provided.
- * @retval NRF_ERROR_NOT_SUPPORTED If the selected algorithm is not supported in this version of 
-                                   the library.
- * @retval NRF_SUCCESS             If the signature matches the dataset provided.
- */
-SVCALL(NRF_SEC_SVC_VERIFY, uint32_t, nrf_sec_svc_verify (nrf_sec_data_t          * p_data,
-                                                         nrf_sec_ecc_point_t     * p_Q,
-                                                         nrf_sec_ecc_signature_t * p_signature,
-                                                         nrf_sec_algo_t            algorithm));
-
-/**@brief   SVC Function for generating a signature over a given dataset.
- *
- * @param[in]  p_data    Pointer to the data which must be verified.
- * @param[out] p_digest  Pointer to memory where generated digest shall be stored. Ensure 
- *                       sufficient memory is available, that is for a SHA-256 there must 
- *                       be at least 256 bits (8 words) available.
- * @param[in]  hash_func Type of fash function to use when generating the digest
- *
- * @retval NRF_ERROR_NULL          If a null pointer is provided as data or hash.
- * @retval NRF_ERROR_NOT_SUPPORTED If the selected hash functions is not supported in this version
- *                                 of the library.
- * @retval NRF_SUCCESS             If generation of a digest was successful.
- */
-SVCALL(NRF_SEC_SVC_HASH, uint32_t, nrf_sec_svc_hash(nrf_sec_data_t      * p_data, 
-                                                    uint8_t             * p_digest, 
-                                                    nrf_sec_hash_func_t   hash_func));
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_SEC_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/hci_transport/hci_mem_pool_internal.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h
deleted file mode 100644
index 596f1b9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/hci_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       32u    /**< TX buffer size in bytes. */
-#define RX_BUF_SIZE       600u   /**< RX buffer size in bytes. */
-
-#define RX_BUF_QUEUE_SIZE 2u     /**< 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/hci_transport/hci_transport_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h
deleted file mode 100644
index 5befce3..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h
+++ /dev/null
@@ -1,53 +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 ble_sdk_bootloader_hci_congfig HCI Transport Layer Configuration
- * @{
- * @ingroup dfu_bootloader_api
- * @brief Definition of HCI Transport Layer configurable parameters
- */
-
-#ifndef HCI_TRANSPORT_CONFIG_H__
-#define HCI_TRANSPORT_CONFIG_H__
-
-#include "boards.h"                                                     /**< Default include for boards.h which means that default pin numbers will be used for RX, TX, CTS, and RTS on the UART. Other pin number can be used if desired. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** This section covers configurable parameters for the HCI Transport SLIP layer. */
-#define HCI_SLIP_UART_RX_PIN_NUMBER  RX_PIN_NUMBER                      /**< Defines the UART RX pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_TX_PIN_NUMBER  TX_PIN_NUMBER                      /**< Defines the UART TX pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_RTS_PIN_NUMBER RTS_PIN_NUMBER                     /**< Defines the UART RTS pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_CTS_PIN_NUMBER CTS_PIN_NUMBER                     /**< Defines the UART CTS pin number. The default pin for the board is chosen, but can be overwritten. */
-
-#define HCI_SLIP_UART_MODE           APP_UART_FLOW_CONTROL_DISABLED     /**< Defines the UART mode to be used. Use UART Low Power with Flow Control - Valid values are defined in \ref app_uart_flow_control_t. For further information on the UART Low Power mode, please refer to: \ref app_uart . */
-
-#define HCI_SLIP_UART_BAUDRATE       UART_BAUDRATE_BAUDRATE_Baud38400   /**< Defines the UART Baud rate. Default is 38400 baud. */
-
-/** This section covers configurable parameters for the HCI Transport layer that are used for calculating correct value for the retransmission timer timeout. */
-#define MAX_PACKET_SIZE_IN_BITS      8000u                              /**< Maximum size of a single application packet in bits. */      
-#define USED_BAUD_RATE               38400u                             /**< The used uart baudrate. */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // HCI_TRANSPORT_CONFIG_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/button/app_button.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/button/app_button.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/button/app_button.c
deleted file mode 100644
index f135eb6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/button/app_button.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Copyright (c) 2012 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 "app_button.h"
-#include "app_timer.h"
-#include "app_error.h"
-#include "nrf_drv_gpiote.h"
-#include "nrf_assert.h"
-#include "sdk_common.h"
-
-static app_button_cfg_t *             mp_buttons = NULL;           /**< Button configuration. */
-static uint8_t                        m_button_count;              /**< Number of configured buttons. */
-static uint32_t                       m_detection_delay;           /**< Delay before a button is reported as pushed. */
-APP_TIMER_DEF(m_detection_delay_timer_id);  /**< Polling timer id. */
-
-
-static uint32_t m_pin_state;
-static uint32_t m_pin_transition;
-
-/**@brief Function for handling the timeout that delays reporting buttons as pushed.
- *
- * @details    The detection_delay_timeout_handler(...) is a call-back issued from the app_timer
- *             module. It is called with the p_context parameter. The p_context parameter is
- *             provided to the app_timer module when a timer is started, using the call
- *             @ref app_timer_start. On @ref app_timer_start the p_context will be holding the
- *             currently pressed buttons.
- *
- * @param[in]  p_context   Pointer used for passing information app_start_timer() was called.
- *                         In the app_button module the p_context holds information on pressed
- *                         buttons.
- */
-static void detection_delay_timeout_handler(void * p_context)
-{
-    uint8_t i;
-    
-    // Pushed button(s) detected, execute button handler(s).
-    for (i = 0; i < m_button_count; i++)
-    {
-        app_button_cfg_t * p_btn = &mp_buttons[i];
-        uint32_t btn_mask = 1 << p_btn->pin_no;
-        if (btn_mask & m_pin_transition)
-        {
-            m_pin_transition &= ~btn_mask;
-            bool pin_is_set = nrf_drv_gpiote_in_is_set(p_btn->pin_no);
-            if ((m_pin_state & (1 << p_btn->pin_no)) == (pin_is_set << p_btn->pin_no))
-            {
-                uint32_t transition = !(pin_is_set ^ (p_btn->active_state == APP_BUTTON_ACTIVE_HIGH));
-
-                if (p_btn->button_handler)
-                {
-                    p_btn->button_handler(p_btn->pin_no, transition);
-                }
-            }
-        }
-    }
-}
-
-static void gpiote_event_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
-{
-    uint32_t err_code;
-    uint32_t pin_mask = 1 << pin;
-
-    // Start detection timer. If timer is already running, the detection period is restarted.
-    // NOTE: Using the p_context parameter of app_timer_start() to transfer the pin states to the
-    //       timeout handler (by casting event_pins_mask into the equally sized void * p_context
-    //       parameter).
-    err_code = app_timer_stop(m_detection_delay_timer_id);
-    if (err_code != NRF_SUCCESS)
-    {
-        // The impact in app_button of the app_timer queue running full is losing a button press.
-        // The current implementation ensures that the system will continue working as normal.
-        return;
-    }
-
-    if (!(m_pin_transition & pin_mask))
-    {
-        if (nrf_drv_gpiote_in_is_set(pin))
-        {
-            m_pin_state |= pin_mask;
-        }
-        else
-        {
-            m_pin_state &= ~(pin_mask);
-        }
-        m_pin_transition |= (pin_mask);
-
-        err_code = app_timer_start(m_detection_delay_timer_id, m_detection_delay, NULL);
-        if (err_code != NRF_SUCCESS)
-        {
-            // The impact in app_button of the app_timer queue running full is losing a button press.
-            // The current implementation ensures that the system will continue working as normal.
-        }
-    }
-    else
-    {
-        m_pin_transition &= ~pin_mask;
-    }
-}
-
-uint32_t app_button_init(app_button_cfg_t *             p_buttons,
-                         uint8_t                        button_count,
-                         uint32_t                       detection_delay)
-{
-    uint32_t err_code;
-    
-    if (detection_delay < APP_TIMER_MIN_TIMEOUT_TICKS)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (!nrf_drv_gpiote_is_init())
-    {
-        err_code = nrf_drv_gpiote_init();
-        VERIFY_SUCCESS(err_code);
-    }
-
-    // Save configuration.
-    mp_buttons          = p_buttons;
-    m_button_count      = button_count;
-    m_detection_delay   = detection_delay;
-
-    m_pin_state      = 0;
-    m_pin_transition = 0;
-    
-    while (button_count--)
-    {
-        app_button_cfg_t * p_btn = &p_buttons[button_count];
-
-        nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false);
-        config.pull = p_btn->pull_cfg;
-        
-        err_code = nrf_drv_gpiote_in_init(p_btn->pin_no, &config, gpiote_event_handler);
-        VERIFY_SUCCESS(err_code);
-    }
-
-    // Create polling timer.
-    return app_timer_create(&m_detection_delay_timer_id,
-                            APP_TIMER_MODE_SINGLE_SHOT,
-                            detection_delay_timeout_handler);
-}
-
-uint32_t app_button_enable(void)
-{
-    ASSERT(mp_buttons);
-
-    uint32_t i;
-    for (i = 0; i < m_button_count; i++)
-    {
-        nrf_drv_gpiote_in_event_enable(mp_buttons[i].pin_no, true);
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t app_button_disable(void)
-{
-    ASSERT(mp_buttons);
-
-    uint32_t i;
-    for (i = 0; i < m_button_count; i++)
-    {
-       nrf_drv_gpiote_in_event_disable(mp_buttons[i].pin_no);
-    }
-
-    // Make sure polling timer is not running.
-    return app_timer_stop(m_detection_delay_timer_id);
-}
-
-
-uint32_t app_button_is_pushed(uint8_t button_id, bool * p_is_pushed)
-{
-    ASSERT(button_id <= m_button_count);
-    ASSERT(mp_buttons != NULL);
-
-    app_button_cfg_t * p_btn = &mp_buttons[button_id];
-    bool is_set = nrf_drv_gpiote_in_is_set(p_btn->pin_no);
-
-    *p_is_pushed = !(is_set^(p_btn->active_state == APP_BUTTON_ACTIVE_HIGH));
-    
-    return NRF_SUCCESS;
-}

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/button/app_button.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/button/app_button.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/button/app_button.h
deleted file mode 100644
index a7b9697..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/button/app_button.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Copyright (c) 2012 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 app_button Button Handler
- * @{
- * @ingroup app_common
- *
- * @brief Buttons handling module.
- *
- * @details The button handler uses the @ref app_gpiote to detect that a button has been
- *          pushed. To handle debouncing, it will start a timer in the GPIOTE event handler.
- *          The button will only be reported as pushed if the corresponding pin is still active when
- *          the timer expires. If there is a new GPIOTE event while the timer is running, the timer
- *          is restarted.
- *
- * @note    The app_button module uses the app_timer module. The user must ensure that the queue in
- *          app_timer is large enough to hold the app_timer_stop() / app_timer_start() operations
- *          which will be executed on each event from GPIOTE module (2 operations), as well as other
- *          app_timer operations queued simultaneously in the application.
- *
- * @note    Even if the scheduler is not used, app_button.h will include app_scheduler.h, so when
- *          compiling, app_scheduler.h must be available in one of the compiler include paths.
- */
-
-#ifndef APP_BUTTON_H__
-#define APP_BUTTON_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "nrf.h"
-#include "app_error.h"
-#include "nrf_gpio.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define APP_BUTTON_PUSH        1                               /**< Indicates that a button is pushed. */
-#define APP_BUTTON_RELEASE     0                               /**< Indicates that a button is released. */
-#define APP_BUTTON_ACTIVE_HIGH 1                               /**< Indicates that a button is active high. */
-#define APP_BUTTON_ACTIVE_LOW  0                               /**< Indicates that a button is active low. */
-
-/**@brief Button event handler type. */
-typedef void (*app_button_handler_t)(uint8_t pin_no, uint8_t button_action);
-
-/**@brief Button configuration structure. */
-typedef struct
-{
-    uint8_t              pin_no;           /**< Pin to be used as a button. */
-    uint8_t              active_state;     /**< APP_BUTTON_ACTIVE_HIGH or APP_BUTTON_ACTIVE_LOW. */
-    nrf_gpio_pin_pull_t  pull_cfg;         /**< Pull-up or -down configuration. */
-    app_button_handler_t button_handler;   /**< Handler to be called when button is pushed. */
-} app_button_cfg_t;
-
-/**@brief  Pin transition direction struct. */
-typedef struct
-{
-    uint32_t high_to_low;   /**Pin went from high to low */
-    uint32_t low_to_high;   /**Pin went from low to high */
-} pin_transition_t;
-    
-/**@brief Function for initializing the Buttons.
- *
- * @details This function will initialize the specified pins as buttons, and configure the Button
- *          Handler module as a GPIOTE user (but it will not enable button detection).
- *
- * @note Normally initialization should be done using the APP_BUTTON_INIT() macro
- *
- * @note app_button_enable() function must be called in order to enable the button detection.    
- *
- * @param[in]  p_buttons           Array of buttons to be used (NOTE: Must be static!).
- * @param[in]  button_count        Number of buttons.
- * @param[in]  detection_delay     Delay from a GPIOTE event until a button is reported as pushed.
- *
- * @return   NRF_SUCCESS on success, otherwise an error code.
- */
-uint32_t app_button_init(app_button_cfg_t *             p_buttons,
-                         uint8_t                        button_count,
-                         uint32_t                       detection_delay);
-
-/**@brief Function for enabling button detection.
- *
- * @retval NRF_SUCCESS Module successfully enabled.
- */
-uint32_t app_button_enable(void);
-
-/**@brief Function for disabling button detection.
- *
- * @retval  NRF_SUCCESS               Button detection successfully disabled. Error code otherwise.
- */
-uint32_t app_button_disable(void);
-
-/**@brief Function for checking if a button is currently being pushed.
- *
- * @param[in]  button_id     Button index (in the app_button_cfg_t array given to app_button_init) to be checked.
- * @param[out] p_is_pushed   Button state.
- *
- * @retval     NRF_SUCCESS               State successfully read.
- * @retval     NRF_ERROR_INVALID_PARAM   Invalid button index.
- */
-uint32_t app_button_is_pushed(uint8_t button_id, bool * p_is_pushed);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // APP_BUTTON_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/crc16/crc16.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc16/crc16.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc16/crc16.c
deleted file mode 100644
index aa289af..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc16/crc16.c
+++ /dev/null
@@ -1,31 +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 "crc16.h"
-
-#include <stdlib.h>
-
-uint16_t crc16_compute(uint8_t const * p_data, uint32_t size, uint16_t const * p_crc)
-{
-    uint16_t crc = (p_crc == NULL) ? 0xFFFF : *p_crc;
-
-    for (uint32_t i = 0; i < size; i++)
-    {
-        crc  = (uint8_t)(crc >> 8) | (crc << 8);
-        crc ^= p_data[i];
-        crc ^= (uint8_t)(crc & 0xFF) >> 4;
-        crc ^= (crc << 8) << 4;
-        crc ^= ((crc & 0xFF) << 4) << 1;
-    }
-
-    return crc;
-}

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/crc16/crc16.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc16/crc16.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc16/crc16.h
deleted file mode 100644
index e5bbe26..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc16/crc16.h
+++ /dev/null
@@ -1,52 +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 crc_compute CRC compute
- * @{
- * @ingroup hci_transport
- *
- * @brief    This module implements CRC-16-CCITT (polynomial 0x1021) with 0xFFFF initial value.
- *           The data can be passed in multiple blocks.
- */
- 
-#ifndef CRC16_H__
-#define CRC16_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for calculating CRC-16 in blocks.
- *
- * Feed each consecutive data block into this function, along with the current value of p_crc as
- * returned by the previous call of this function. The first call of this function should pass NULL
- * as the initial value of the crc in p_crc.
- *
- * @param[in] p_data The input data block for computation.
- * @param[in] size   The size of the input data block in bytes.
- * @param[in] p_crc  The previous calculated CRC-16 value or NULL if first call.
- *
- * @return The updated CRC-16 value, based on the input supplied.
- */
-uint16_t crc16_compute(uint8_t const * p_data, uint32_t size, uint16_t const * p_crc);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // CRC16_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/crc32/crc32.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc32/crc32.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc32/crc32.c
deleted file mode 100644
index ab8ee38..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc32/crc32.c
+++ /dev/null
@@ -1,31 +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 "crc32.h"
-
-#include <stdlib.h>
-
-uint32_t crc32_compute(uint8_t const * p_data, uint32_t size, uint32_t const * p_crc)
-{
-    uint32_t crc;
-
-    crc = (p_crc == NULL) ? 0xFFFFFFFF : ~(*p_crc);
-    for (uint32_t i = 0; i < size; i++)
-    {
-        crc = crc ^ p_data[i];
-        for (uint32_t j = 8; j > 0; j--)
-        {
-            crc = (crc >> 1) ^ (0xEDB88320 & -(crc & 1));
-        }
-    }
-    return ~crc;
-}

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/crc32/crc32.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc32/crc32.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc32/crc32.h
deleted file mode 100644
index 4ec4e88..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/crc32/crc32.h
+++ /dev/null
@@ -1,51 +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
- *
- * @defgroup crc_compute CRC compute
- * @{
- * @ingroup hci_transport
- *
- * @brief    This module implements the CRC-32 calculation in the blocks.
- */
- 
-#ifndef CRC32_H__
-#define CRC32_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Function for calculating CRC-32 in blocks.
- *
- * Feed each consecutive data block into this function, along with the current value of p_crc as
- * returned by the previous call of this function. The first call of this function should pass NULL
- * as the initial value of the crc in p_crc.
- *
- * @param[in] p_data The input data block for computation.
- * @param[in] size   The size of the input data block in bytes.
- * @param[in] p_crc  The previous calculated CRC-32 value or NULL if first call.
- *
- * @return The updated CRC-32 value, based on the input supplied.
- */
-uint32_t crc32_compute(uint8_t const * p_data, uint32_t size, uint32_t const * p_crc);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // CRC32_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/experimental_section_vars/section_vars.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/experimental_section_vars/section_vars.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/experimental_section_vars/section_vars.h
deleted file mode 100644
index ac96a67..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/experimental_section_vars/section_vars.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/* Copyright (c) 2016 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.
- *
- */
-
-#ifndef SECTION_VARS_H__
-#define SECTION_VARS_H__
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup section_vars Section variables
- * @ingroup app_common
- * @{
- *
- * @brief Section variables.
- */
-
-#if defined(__ICCARM__)
-// Enable IAR language extensions
-#pragma language=extended
-#endif
-
-
-// Macro to delay macro expansion.
-#define NRF_PRAGMA(x)       _Pragma(#x)
-
-
-/**@brief   Macro to register a named section.
- *
- * @param[in]   section_name    Name of the section to register.
- */
-#if defined(__CC_ARM)
-
-// Not required by this compiler.
-#define NRF_SECTION_VARS_REGISTER_SECTION(section_name)
-
-#elif defined(__GNUC__)
-
-// Not required by this compiler.
-#define NRF_SECTION_VARS_REGISTER_SECTION(section_name)
-
-#elif defined(__ICCARM__)
-
-#define NRF_SECTION_VARS_REGISTER_SECTION(section_name)     NRF_PRAGMA(section = #section_name)
-
-#endif
-
-
-/*lint -save -e27 */
-
-/**@brief   Macro to obtain the linker symbol for the beginning of a given section.
- *
- * @details The symbol that this macro resolves to is used to obtain a section start address.
- *
- * @param[in]   section_name    Name of the section.
- */
-#if defined(__CC_ARM)
-
-#define NRF_SECTION_VARS_START_SYMBOL(section_name)         section_name ## $$Base
-
-#elif defined(__GNUC__)
-
-#define NRF_SECTION_VARS_START_SYMBOL(section_name)         __start_ ## section_name
-
-#elif defined(__ICCARM__)
-
-#define NRF_SECTION_VARS_START_SYMBOL(section_name)         __section_begin(#section_name)
-
-#endif
-
-
-/**@brief   Macro to obtain the linker symbol for the end of a given section.
- *
- * @details The symbol that this macro resolves to is used to obtain a section end address.
- *
- * @param[in]   section_name    Name of the section.
- */
-#if defined(__CC_ARM)
-
-#define NRF_SECTION_VARS_END_SYMBOL(section_name)           section_name ## $$Limit
-
-#elif defined(__GNUC__)
-
-#define NRF_SECTION_VARS_END_SYMBOL(section_name)           __stop_ ## section_name
-
-#elif defined(__ICCARM__)
-
-#define NRF_SECTION_VARS_END_SYMBOL(section_name)           __section_end(#section_name)
-
-#endif
-
-/*lint -restore */
-
-
-/**@brief   Macro for retrieving the length of a given section, in bytes.
- *
- * @param[in]   section_name    Name of the section.
- */
-#if defined(__CC_ARM)
-
-#define NRF_SECTION_VARS_LENGTH(section_name) \
-    ((uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name) - (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name))
-
-#elif defined(__GNUC__)
-
- #define NRF_SECTION_VARS_LENGTH(section_name) \
-    ((uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name) - (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name))
-
-#elif defined(__ICCARM__)
-
- #define NRF_SECTION_VARS_LENGTH(section_name) \
-    ((uint32_t)NRF_SECTION_VARS_END_SYMBOL(section_name) - (uint32_t)NRF_SECTION_VARS_START_SYMBOL(section_name))
-
-#endif
-      
-
-/**@brief   Macro to obtain the start address of a named section.
- *
- * param[in]    section_name    Name of the section.
- */
-#if defined(__CC_ARM)
-
-#define NRF_SECTION_VARS_START_ADDR(section_name)       (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name)
-
-#elif defined(__GNUC__)
-
-#define NRF_SECTION_VARS_START_ADDR(section_name)       (uint32_t)&NRF_SECTION_VARS_START_SYMBOL(section_name)
-
-#elif defined(__ICCARM__)
-
-#define NRF_SECTION_VARS_START_ADDR(section_name)       (uint32_t)iar_ ## section_name ## _start
-
-#endif
-
-      
-/*@brief    Macro to obtain the end address of a named section.
- *
- * @param[in]   section_name    Name of the section.
- */
-#if defined(__CC_ARM)
-
-#define NRF_SECTION_VARS_END_ADDR(section_name)         (uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name)
-
-#elif defined(__GNUC__)
-
-#define NRF_SECTION_VARS_END_ADDR(section_name)         (uint32_t)&NRF_SECTION_VARS_END_SYMBOL(section_name)
-
-#elif defined(__ICCARM__)
-
-#define NRF_SECTION_VARS_END_ADDR(section_name)         (uint32_t)iar_ ## section_name ## _end
-
-#endif
-
-
-/**@brief   Macro to extern a named section start and stop symbols.
- *
- * @note    These declarations are required for GCC and Keil linkers (but not for IAR's).
- *
- * @param[in]   type_name       Name of the type stored in the section.
- * @param[in]   section_name    Name of the section.
- */
-#if defined(__CC_ARM)
-
-#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name)  \
-    extern type_name * NRF_SECTION_VARS_START_SYMBOL(section_name); \
-    extern void      * NRF_SECTION_VARS_END_SYMBOL(section_name)
-
-#elif defined(__GNUC__)
-
-#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name)  \
-    extern type_name * NRF_SECTION_VARS_START_SYMBOL(section_name); \
-    extern void      * NRF_SECTION_VARS_END_SYMBOL(section_name)
-
-#elif defined(__ICCARM__)
-
-// No symbol registration required for IAR.
-#define NRF_SECTION_VARS_REGISTER_SYMBOLS(type_name, section_name)                  \
-    extern void * iar_ ## section_name ## _start = __section_begin(#section_name);  \
-    extern void * iar_ ## section_name ## _end   = __section_end(#section_name)
-
-#endif
-
-
-/**@brief   Macro to declare a variable to be placed in a named section.
- *
- * @details Declares a variable to be placed in a named section. This macro ensures that its symbol
- *          is not stripped by the linker because of optimizations.
- *
- * @warning The order with which variables are placed in a section is implementation dependant.
- *          Generally, variables are placed in a section depending on the order with which they
- *          are found by the linker.
- *
- * @warning The symbols added in the named section must be word aligned to prevent padding.
- *
- * @param[in]   section_name    Name of the section.
- * @param[in]   type_def        Datatype of the variable to place in the given section.
- */
-#if defined(__CC_ARM)
-    
-#define NRF_SECTION_VARS_ADD(section_name, type_def) \
-    static type_def __attribute__ ((section(#section_name))) __attribute__((used))
-
-#elif defined(__GNUC__)
-
-#define NRF_SECTION_VARS_ADD(section_name, type_def) \
-    static type_def __attribute__ ((section("."#section_name))) __attribute__((used))
-
-#elif defined(__ICCARM__)
-
-#define NRF_SECTION_VARS_ADD(section_name, type_def) \
-    __root type_def @ #section_name
-
-#endif
-
-
-/**@brief   Macro to get symbol from named section.
- *
- * @warning     The stored symbol can only be resolved using this macro if the 
- *              type of the data is word aligned. The operation of acquiring 
- *              the stored symbol relies on sizeof of the stored type, no 
- *              padding can exist in the named section in between individual 
- *              stored items or this macro will fail.
- *
- * @param[in]   i               Index of item in section.
- * @param[in]   type_name       Type name of item in section.
- * @param[in]   section_name    Name of the section.
- */
-#if defined(__CC_ARM)
-
-#define NRF_SECTION_VARS_GET(i, type_name, section_name) \
-    (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name))
-      
-#elif defined(__GNUC__)
-
-#define NRF_SECTION_VARS_GET(i, type_name, section_name) \
-    (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name))
-      
-#elif defined(__ICCARM__)
-
-#define NRF_SECTION_VARS_GET(i, type_name, section_name) \
-    (type_name*)(NRF_SECTION_VARS_START_ADDR(section_name) + i * sizeof(type_name))
-
-#endif
-
-
-/**@brief   Macro to get number of items in named section.
- *
- * @param[in]   type_name       Type name of item in section.
- * @param[in]   section_name    Name of the section.
- */
-#define NRF_SECTION_VARS_COUNT(type_name, section_name) \
-    NRF_SECTION_VARS_LENGTH(section_name) / sizeof(type_name)
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SECTION_VARS_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/fds/config/fds_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/config/fds_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/config/fds_config.h
deleted file mode 100644
index b158f36..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/libraries/fds/config/fds_config.h
+++ /dev/null
@@ -1,71 +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.
- *
- */
-
-#ifndef FDS_CONFIG_H__
-#define FDS_CONFIG_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /**
- * @file fds_config.h
- *
- * @defgroup flash_data_storage_config Configuration options
- * @ingroup flash_data_storage
- * @{
- * @brief   Configuration options for FDS.
- */
-
-/**@brief   Configures the size of the internal queue. */
-#define FDS_OP_QUEUE_SIZE           (4)
-
-/**@brief   Determines how many @ref fds_record_chunk_t structures can be buffered at any time. */
-#define FDS_CHUNK_QUEUE_SIZE        (8)
-
-/**@brief   Configures the maximum number of callbacks that can be registered. */
-#define FDS_MAX_USERS               (3)
-
-/**@brief   Configures the number of virtual flash pages to use.
- *
- * The total amount of flash memory that is used by FDS amounts to
- * @ref FDS_VIRTUAL_PAGES * @ref FDS_VIRTUAL_PAGE_SIZE * 4 bytes.
- * On nRF51 ICs, this defaults to 3 * 256 * 4 bytes = 3072 bytes.
- * On nRF52 ICs, it defaults to 3 * 1024 * 4 bytes = 12288 bytes.
- *
- * One of the virtual pages is reserved by the system for garbage collection. Therefore, the
- * minimum is two virtual pages: one page to store data and one page to be used by the system for
- * garbage collection.
- */
-#define FDS_VIRTUAL_PAGES           (3)
-
-/**@brief   Configures the size of a virtual page of flash memory, expressed in number of
- *          4-byte words.
- *
- * By default, a virtual page is the same size as a physical page. Therefore, the default size
- * is 1024 bytes for nRF51 ICs and 4096 bytes for nRF52 ICs.
- *
- * The size of a virtual page must be a multiple of the size of a physical page.
- */
-#if   defined(NRF51)
-    #define FDS_VIRTUAL_PAGE_SIZE   (256)
-#elif defined(NRF52)
-    #define FDS_VIRTUAL_PAGE_SIZE   (1024)
-#endif
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // FDS_CONFIG_H__


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

Posted by cc...@apache.org.
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/serialization/common/struct_ser/s130/ble_struct_serialization.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.c
deleted file mode 100644
index e73c49f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.c
+++ /dev/null
@@ -1,571 +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.
- *
- */
-
-#include "ble_struct_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "ble_gatts_struct_serialization.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-#include "ble_types.h"
-#include "ble_l2cap.h"
-#include "ble.h"
-#include "cond_field_serialization.h"
-#include <string.h>
-
-
-uint32_t ble_uuid_t_enc(void const * const p_void_uuid,
-                        uint8_t * const    p_buf,
-                        uint32_t           buf_len,
-                        uint32_t * const   p_index)
-{
-    ble_uuid_t * p_uuid   = (ble_uuid_t *)p_void_uuid;
-    uint32_t     err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&p_uuid->uuid, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_uuid->type, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_uuid_t_dec(uint8_t const * const p_buf,
-                        uint32_t              buf_len,
-                        uint32_t * const      p_index,
-                        void * const          p_void_uuid)
-{
-    ble_uuid_t * p_uuid = (ble_uuid_t *)p_void_uuid;
-
-    SER_ASSERT_LENGTH_LEQ(3, buf_len - *p_index);
-    uint16_dec(p_buf, buf_len, p_index, &p_uuid->uuid);
-    uint8_dec(p_buf, buf_len, p_index, &p_uuid->type);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_uuid128_t_enc(void const * const p_void_uuid,
-                           uint8_t * const    p_buf,
-                           uint32_t           buf_len,
-                           uint32_t * const   p_index)
-{
-    ble_uuid128_t * p_uuid   = (ble_uuid128_t *)p_void_uuid;
-    uint32_t        err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index);
-
-    memcpy(&p_buf[*p_index], p_uuid->uuid128, sizeof (p_uuid->uuid128));
-
-    *p_index += sizeof (p_uuid->uuid128);
-
-    return err_code;
-}
-
-uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf,
-                           uint32_t              buf_len,
-                           uint32_t * const      p_index,
-                           void * const          p_void_uuid)
-{
-    ble_uuid128_t * p_uuid   = (ble_uuid128_t *)p_void_uuid;
-    uint32_t        err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(16, buf_len - *p_index);
-
-    memcpy(p_uuid->uuid128, &p_buf[*p_index], sizeof (p_uuid->uuid128));
-
-    *p_index += sizeof (p_uuid->uuid128);
-
-    return err_code;
-}
-
-uint32_t ble_l2cap_header_t_enc(void const * const p_void_header,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_header);
-
-    ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header;
-    uint32_t             err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&(p_header->len), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_header->cid), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                void * const          p_void_header)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_header);
-
-    ble_l2cap_header_t * p_header = (ble_l2cap_header_t *)p_void_header;
-    uint32_t             err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->len));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_header->cid));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_evt_rx);
-
-    ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx;
-    uint32_t             err_code = NRF_SUCCESS;
-
-    err_code = ble_l2cap_header_t_enc(&(p_evt_rx->header), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_evt_rx->data, p_evt_rx->header.len);
-    *p_index += p_evt_rx->header.len;
-
-    return err_code;
-}
-
-uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                uint32_t * const      p_struct_len,
-                                void * const          p_void_evt_rx)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_struct_len);
-
-    ble_l2cap_evt_rx_t * p_evt_rx = (ble_l2cap_evt_rx_t *)p_void_evt_rx;
-    uint32_t             err_code = NRF_SUCCESS;
-
-    uint32_t total_struct_len = *p_struct_len;
-
-    /* Get data length */
-    uint32_t tmp_index = *p_index;
-    uint16_t len       = 0;
-
-    err_code = uint16_t_dec(p_buf, buf_len, &tmp_index, &len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    /* Update struct length */
-    *p_struct_len = offsetof(ble_l2cap_evt_rx_t, data[0]);
-    *p_struct_len += (uint8_t*)&p_evt_rx->data[len] - (uint8_t*)&p_evt_rx->data[0];
-
-    /* Decode header and copy data */
-    if (p_void_evt_rx != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(*p_struct_len, total_struct_len);
-
-        err_code = ble_l2cap_header_t_dec(p_buf, buf_len, p_index, &(p_evt_rx->header));
-        SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-        SER_ASSERT_LENGTH_LEQ(p_evt_rx->header.len, buf_len - *p_index);
-        memcpy(p_evt_rx->data, &p_buf[*p_index], p_evt_rx->header.len);
-        *p_index += p_evt_rx->header.len;
-    }
-
-    return err_code;
-}
-
-uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_enable_params);
-
-    ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = ble_common_enable_params_t_enc(&p_enable_params->common_enable_params, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = ble_gap_enable_params_t_enc(&p_enable_params->gap_enable_params, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gatts_enable_params_t_enc(&p_enable_params->gatts_enable_params, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_enable_params)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_enable_params);
-
-    ble_enable_params_t * p_enable_params = (ble_enable_params_t *)p_void_enable_params;
-    uint32_t              err_code = NRF_SUCCESS;
-
-    err_code = ble_common_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->common_enable_params));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gap_enable_params));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gatts_enable_params_t_dec(p_buf, buf_len, p_index, &(p_enable_params->gatts_enable_params));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_conn_bw_t_enc(void const * const p_void_conn_bw,
-                           uint8_t * const    p_buf,
-                           uint32_t           buf_len,
-                           uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_conn_bw);
-
-    ble_conn_bw_t * p_conn_bw = (ble_conn_bw_t *)p_void_conn_bw;
-    uint32_t        err_code  = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&p_conn_bw->conn_bw_rx, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_conn_bw->conn_bw_tx, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_conn_bw_t_dec(uint8_t const * const p_buf,
-                           uint32_t              buf_len,
-                           uint32_t * const      p_index,
-                           void * const          p_void_conn_bw)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_conn_bw);
-
-    ble_conn_bw_t * p_conn_bw = (ble_conn_bw_t *)p_void_conn_bw;
-    uint32_t        err_code  = NRF_SUCCESS;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw->conn_bw_rx);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw->conn_bw_tx);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_common_opt_conn_bw_t_enc(void const * const p_void_opt_conn_bw,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_opt_conn_bw);
-
-    ble_common_opt_conn_bw_t * p_conn_bw = (ble_common_opt_conn_bw_t *)p_void_opt_conn_bw;
-    uint32_t            err_code  = NRF_SUCCESS;
-    uint8_t             byte;
-
-    byte = p_conn_bw->role;
-    err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_conn_bw_t_enc(&p_conn_bw->conn_bw, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_common_opt_conn_bw_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_opt_conn_bw)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_opt_conn_bw);
-
-    ble_common_opt_conn_bw_t * p_conn_bw = (ble_common_opt_conn_bw_t *)p_void_opt_conn_bw;
-    uint32_t            err_code  = NRF_SUCCESS;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw->role);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_conn_bw_t_dec(p_buf, buf_len, p_index, &p_conn_bw->conn_bw);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_conn_bw_count_t_enc(void const * const p_void_conn_bw_count,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_conn_bw_count);
-
-    ble_conn_bw_count_t * p_conn_bw_count = (ble_conn_bw_count_t *)p_void_conn_bw_count;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&p_conn_bw_count->high_count, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_conn_bw_count->mid_count, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_conn_bw_count->low_count, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_conn_bw_count_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_conn_bw_count)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_conn_bw_count);
-
-    ble_conn_bw_count_t * p_conn_bw_count = (ble_conn_bw_count_t *)p_void_conn_bw_count;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw_count->high_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw_count->mid_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_conn_bw_count->low_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_conn_bw_counts_t_enc(void const * const p_void_conn_bw_counts,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_conn_bw_counts);
-
-    ble_conn_bw_counts_t * p_conn_bw_counts = (ble_conn_bw_counts_t *)p_void_conn_bw_counts;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = ble_conn_bw_count_t_enc(&p_conn_bw_counts->tx_counts, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_conn_bw_count_t_enc(&p_conn_bw_counts->rx_counts, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_conn_bw_counts_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_void_conn_bw_counts)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_conn_bw_counts);
-
-    ble_conn_bw_counts_t * p_conn_bw_counts = (ble_conn_bw_counts_t *)p_void_conn_bw_counts;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = ble_conn_bw_count_t_dec(p_buf, buf_len, p_index, &p_conn_bw_counts->tx_counts);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_conn_bw_count_t_dec(p_buf, buf_len, p_index, &p_conn_bw_counts->rx_counts);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_common_enable_params_t_enc(void const * const p_void_common_enable_params,
-                                        uint8_t * const    p_buf,
-                                        uint32_t           buf_len,
-                                        uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_common_enable_params);
-
-    ble_common_enable_params_t * p_common_enable_params = (ble_common_enable_params_t *)p_void_common_enable_params;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&p_common_enable_params->vs_uuid_count, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_common_enable_params->p_conn_bw_counts, p_buf, buf_len, p_index, ble_conn_bw_counts_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_common_enable_params_t_dec(uint8_t const * const p_buf,
-                                        uint32_t              buf_len,
-                                        uint32_t * const      p_index,
-                                        void * const          p_void_common_enable_params)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_common_enable_params);
-
-    ble_common_enable_params_t * p_common_enable_params = (ble_common_enable_params_t *)p_void_common_enable_params;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &p_common_enable_params->vs_uuid_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_common_enable_params->p_conn_bw_counts),
-            ble_conn_bw_counts_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_common_opt_pa_lna_t_enc(void const * const p_void_opt,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_opt);
-
-    ble_common_opt_pa_lna_t * p_opt = (ble_common_opt_pa_lna_t *)p_void_opt;
-    uint32_t              err_code        = NRF_SUCCESS;
-
-    err_code = ble_pa_lna_cfg_t_enc(&p_opt->pa_cfg, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_pa_lna_cfg_t_enc(&p_opt->lna_cfg, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_opt->ppi_ch_id_set, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_opt->ppi_ch_id_clr, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_opt->gpiote_ch_id, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_common_opt_pa_lna_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_opt)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_opt);
-
-    ble_common_opt_pa_lna_t * p_opt = (ble_common_opt_pa_lna_t *)p_void_opt;
-    uint32_t            err_code  = NRF_SUCCESS;
-
-    err_code = ble_pa_lna_cfg_t_dec(p_buf, buf_len, p_index, &p_opt->pa_cfg);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_pa_lna_cfg_t_dec(p_buf, buf_len, p_index, &p_opt->lna_cfg);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_opt->ppi_ch_id_set);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_opt->ppi_ch_id_clr);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_opt->gpiote_ch_id);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-
-uint32_t ble_pa_lna_cfg_t_enc(void const * const p_void_cfg,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_cfg);
-
-    ble_pa_lna_cfg_t * p_cfg = (ble_pa_lna_cfg_t *)p_void_cfg;
-    uint32_t           err_code        = NRF_SUCCESS;
-
-    uint8_t data = (p_cfg->enable & 0x01)             |
-                   ((p_cfg->active_high & 0x01) << 1) |
-                   (p_cfg->gpio_pin << 2);
-
-    err_code = uint8_t_enc(&data, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_pa_lna_cfg_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_cfg)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    SER_ASSERT_NOT_NULL(p_void_cfg);
-
-    ble_pa_lna_cfg_t * p_cfg = (ble_pa_lna_cfg_t *)p_void_cfg;
-    uint32_t           err_code  = NRF_SUCCESS;
-
-    uint8_t data;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &data);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p_cfg->enable = data & 0x01;
-    p_cfg->active_high = (data >> 1) & 0x01;
-    p_cfg->gpio_pin = (data >> 2);
-
-
-    return err_code;
-}
-
-

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/serialization/common/struct_ser/s130/ble_struct_serialization.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.h
deleted file mode 100644
index c967335..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_struct_serialization.h
+++ /dev/null
@@ -1,135 +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.
- *
- */
-
-#include "ble_types.h"
-
-
-uint32_t ble_uuid_t_enc(void const * const p_void_uuid,
-                        uint8_t * const    p_buf,
-                        uint32_t           buf_len,
-                        uint32_t * const   p_index);
-
-uint32_t ble_uuid_t_dec(uint8_t const * const p_buf,
-                        uint32_t              buf_len,
-                        uint32_t * const      p_index,
-                        void * const          p_void_uuid);
-
-uint32_t ble_uuid128_t_enc(const void * const p_void_uuid,
-                           uint8_t * const    p_buf,
-                           uint32_t           buf_len,
-                           uint32_t * const   p_index);
-
-uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf,
-                           uint32_t              buf_len,
-                           uint32_t * const      p_index,
-                           void * const          p_void_uuid);
-
-uint32_t ble_l2cap_header_t_enc(void const * const p_void_header,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index);
-
-uint32_t ble_l2cap_header_t_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                void * const          p_void_header);
-
-uint32_t ble_l2cap_evt_rx_t_enc(void const * const p_void_evt_rx,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index);
-
-uint32_t ble_l2cap_evt_rx_t_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                uint32_t * const      p_event_len,
-                                void * const          p_void_evt_rx);
-                                
-uint32_t ble_enable_params_t_enc(void const * const p_void_enable_params,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-                                 
-uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_enable_params);
-
-uint32_t ble_conn_bw_t_enc(void const * const p_void_conn_bw,
-                           uint8_t * const    p_buf,
-                           uint32_t           buf_len,
-                           uint32_t * const   p_index);
-
-uint32_t ble_conn_bw_t_dec(uint8_t const * const p_buf,
-                           uint32_t              buf_len,
-                           uint32_t * const      p_index,
-                           void * const          p_void_conn_bw);
-
-uint32_t ble_common_opt_conn_bw_t_enc(void const * const p_void_opt_conn_bw,
-                                      uint8_t * const    p_buf,
-                                      uint32_t           buf_len,
-                                      uint32_t * const   p_index);
-
-uint32_t ble_common_opt_conn_bw_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_opt_conn_bw);
-
-uint32_t ble_conn_bw_count_t_enc(void const * const p_void_conn_bw_count,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_conn_bw_count_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_void_conn_bw_count);
-
-uint32_t ble_conn_bw_counts_t_enc(void const * const p_void_conn_bw_count,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index);
-
-uint32_t ble_conn_bw_counts_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_void_conn_bw_count);
-
-uint32_t ble_common_enable_params_t_enc(void const * const p_void_common_enable_params,
-                                        uint8_t * const    p_buf,
-                                        uint32_t           buf_len,
-                                        uint32_t * const   p_index);
-
-uint32_t ble_common_enable_params_t_dec(uint8_t const * const p_buf,
-                                        uint32_t              buf_len,
-                                        uint32_t * const      p_index,
-                                        void * const          p_void_common_enable_params);
-
-uint32_t ble_common_opt_pa_lna_t_enc(void const * const p_void_opt,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_common_opt_pa_lna_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_opt);
-
-uint32_t ble_pa_lna_cfg_t_enc(void const * const p_void_cfg,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_pa_lna_cfg_t_dec(uint8_t const * const p_buf,
-                                      uint32_t              buf_len,
-                                      uint32_t * const      p_index,
-                                      void * const          p_void_cfg);

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/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c
deleted file mode 100644
index 2de56c4..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.c
+++ /dev/null
@@ -1,82 +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.
- *
- */
-
-#include "nrf_soc_struct_serialization.h"
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-#include "string.h"
-
-uint32_t nrf_ecb_hal_data_t_in_enc(void const * const p_data,
-                         uint8_t * const    p_buf,
-                         uint32_t           buf_len,
-                         uint32_t * const   p_index)
-{
-    nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data;
-    uint32_t             err_code;
-
-    err_code = buf_enc(p_ecb_data->key,SOC_ECB_KEY_LENGTH, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = buf_enc(p_ecb_data->cleartext,SOC_ECB_CLEARTEXT_LENGTH, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t nrf_ecb_hal_data_t_in_dec(uint8_t const * const p_buf,
-                         uint32_t              buf_len,
-                         uint32_t * const      p_index,
-                         void * const          p_data)
-{
-    nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data;
-    uint32_t             err_code;
-
-    uint8_t * p_tmp = p_ecb_data->key;
-    err_code = buf_dec(p_buf, buf_len, p_index, &p_tmp,SOC_ECB_KEY_LENGTH,SOC_ECB_KEY_LENGTH);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p_tmp = p_ecb_data->cleartext;
-    err_code = buf_dec(p_buf, buf_len, p_index, &p_tmp,SOC_ECB_CLEARTEXT_LENGTH, SOC_ECB_CLEARTEXT_LENGTH);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t nrf_ecb_hal_data_t_out_enc(void const * const p_data,
-                         uint8_t * const    p_buf,
-                         uint32_t           buf_len,
-                         uint32_t * const   p_index)
-{
-    nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data;
-    uint32_t             err_code;
-
-    err_code = buf_enc(p_ecb_data->ciphertext,SOC_ECB_CIPHERTEXT_LENGTH, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t nrf_ecb_hal_data_t_out_dec(uint8_t const * const p_buf,
-                         uint32_t              buf_len,
-                         uint32_t * const      p_index,
-                         void * const          p_data)
-{
-    nrf_ecb_hal_data_t * p_ecb_data = (nrf_ecb_hal_data_t *)p_data;
-    uint32_t             err_code;
-
-    uint8_t * p_tmp = p_ecb_data->ciphertext;
-    err_code = buf_dec(p_buf, buf_len, p_index, &p_tmp,SOC_ECB_CIPHERTEXT_LENGTH, SOC_ECB_CIPHERTEXT_LENGTH);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return NRF_SUCCESS;
-}

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/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h
deleted file mode 100644
index 2a4b065..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/nrf_soc_struct_serialization.h
+++ /dev/null
@@ -1,33 +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.
- *
- */
-
-#include "nrf_soc.h"
-
-uint32_t nrf_ecb_hal_data_t_in_enc(void const * const p_data,
-                         uint8_t * const    p_buf,
-                         uint32_t           buf_len,
-                         uint32_t * const   p_index);
-
-uint32_t nrf_ecb_hal_data_t_in_dec(uint8_t const * const p_buf,
-                         uint32_t              buf_len,
-                         uint32_t * const      p_index,
-                         void * const          p_data);
-
-uint32_t nrf_ecb_hal_data_t_out_enc(void const * const p_data,
-                         uint8_t * const    p_buf,
-                         uint32_t           buf_len,
-                         uint32_t * const   p_index);
-
-uint32_t nrf_ecb_hal_data_t_out_dec(uint8_t const * const p_buf,
-                         uint32_t              buf_len,
-                         uint32_t * const      p_index,
-                         void * const          p_data);

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/serialization/common/transport/debug/debug_hci_config_nrf6310.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h
deleted file mode 100644
index 88dfa01..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_config_nrf6310.h
+++ /dev/null
@@ -1,52 +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.
- *
- */
-
-#ifndef DEBUG_HCI_CONFIG_NRF6310_H__
-#define DEBUG_HCI_CONFIG_NRF6310_H__
-
-#include "boards.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// define CONN_DGB to prevent CONN chip from being reseted while connected via DBG
-#define nCONN_DGB
-
-#define PIN_EVT_DBG
-
-#define LED_MEM_CALLBACK          LED_3
-#define LED_RX_CALLBACK           LED_4
-#define LED_TX_CALLBACK           LED_5
-#define LED_DP_CALLBACK           LED_6
-#define LED_TX_ERR_CALLBACK       LED_7
-
-#define PIO_SLIP_EVT_PKT_TX       24
-#define PIO_SLIP_EVT_ACK_TX       25
-#define PIO_SLIP_EVT_PKT_TXED     28
-#define PIO_SLIP_EVT_ACK_TXED     29
-#define PIO_SLIP_EVT_PKT_RXED     0
-#define PIO_SLIP_EVT_ACK_RXED     1
-#define PIO_TIMER_EVT_TIMEOUT     2
-#define PIO_HCI_RETX              3
-#define PIO_MAIN_BUSY             4
-#define PIO_TX_REQ                5
-
-#define PIO_SLIP_EVT_ERR_RXED     LED_2   // only pulses not change of state
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //DEBUG_CONFIG_NRF6310_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/serialization/common/transport/debug/debug_hci_nrf6310.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_nrf6310.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_nrf6310.c
deleted file mode 100644
index 8058da9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/debug/debug_hci_nrf6310.c
+++ /dev/null
@@ -1,228 +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.
- *
- */
-
-#include <stddef.h>
-#include <stdint.h>
-#include "nrf_delay.h"
-#include "nrf_gpio.h"
-
-#ifdef SER_PHY_HCI_DEBUG_ENABLE
-
-#include "ser_phy_debug_comm.h"
-#include "debug_hci_config_nRF6310.h"
-#include "app_error.h"
-
-#define LED_BLINK_us                  1               /* 1 us */
-
-static hci_dbg_event_handler_t m_hci_dbg_event_handler = NULL;
-
-static void pio_blink(uint8_t led)
-{
-    nrf_gpio_pin_set(led);
-    nrf_delay_us(LED_BLINK_us);
-    nrf_gpio_pin_clear(led);
-}
-
-
-static void Debug_PulseOnMemCallback()
-{
-    pio_blink(LED_MEM_CALLBACK);
-}
-
-
-static void Debug_PulseOnRxCallback()
-{
-    pio_blink(LED_RX_CALLBACK);
-}
-
-
-static void Debug_PulseOnTxCallback()
-{
-    pio_blink(LED_TX_CALLBACK);
-}
-
-
-static void Debug_PulseOnPacketDroppedCallback()
-{
-    pio_blink(LED_DP_CALLBACK);
-}
-
-static void Debug_PulseOnTxError()
-{
-    pio_blink(LED_TX_ERR_CALLBACK);
-}
-
-static void Debug_PulseOnPacketTX()
-{
-    pio_blink(PIO_SLIP_EVT_PKT_TX);
-}
-
-static void Debug_PulseOnAckTX()
-{
-    pio_blink(PIO_SLIP_EVT_ACK_TX);
-}
-
-static void Debug_PulseOnPacketTXED()
-{
-    pio_blink(PIO_SLIP_EVT_PKT_TXED);
-}
-
-static void Debug_PulseOnAckTXED()
-{
-    pio_blink(PIO_SLIP_EVT_ACK_TXED);
-}
-
-static void Debug_PulseOnPacketRXED()
-{
-    pio_blink(PIO_SLIP_EVT_PKT_RXED);
-}
-
-static void Debug_PulseOnAckRXED()
-{
-    pio_blink(PIO_SLIP_EVT_ACK_RXED);
-}
-
-static void Debug_PulseOnErrRXED()
-{
-    pio_blink(PIO_SLIP_EVT_ERR_RXED);
-    /* throw assert when in debug mode*/
-    APP_ERROR_CHECK_BOOL(false);
-}
-
-static void Debug_PulseOnTimer()
-{
-    pio_blink(PIO_TIMER_EVT_TIMEOUT);
-}
-
-static void Debug_PulseOnRETX()
-{
-    pio_blink(PIO_HCI_RETX);
-}
-
-static void Debug_LevelOnBusy(uint32_t data)
-{
-    if (data)
-    {
-      nrf_gpio_pin_set(PIO_MAIN_BUSY);
-    }
-    else
-    {
-      nrf_gpio_pin_clear(PIO_MAIN_BUSY);
-    }
-}
-
-static void Debug_PulseOnTXReq()
-{
-    pio_blink(PIO_TX_REQ);
-}
-
-static void default_hci_event_handler(hci_dbg_evt_t event)
-{
-    switch (event.evt)
-    {
-    case HCI_PHY_EVT_TX_PKT_SENT:
-      Debug_PulseOnTxCallback();
-    break;
-    case HCI_PHY_EVT_BUF_REQUEST:
-      Debug_PulseOnMemCallback();
-    break;
-    case HCI_PHY_EVT_RX_PKT_RECEIVED:
-      Debug_PulseOnRxCallback();
-    break;
-    case HCI_PHY_EVT_RX_PKT_DROPPED:
-      Debug_PulseOnPacketDroppedCallback();
-    break;
-    case HCI_PHY_EVT_TX_ERROR:
-      Debug_PulseOnTxError();
-    break;
-    case HCI_SLIP_EVT_PACKET_TX:
-      Debug_PulseOnPacketTX();
-    break;
-    case HCI_SLIP_EVT_ACK_TX:
-      Debug_PulseOnAckTX();
-    break;
-    case HCI_SLIP_EVT_PACKET_TXED:
-      Debug_PulseOnPacketTXED();
-    break;
-    case HCI_SLIP_EVT_ACK_TXED:
-      Debug_PulseOnAckTXED();
-    break;
-    case HCI_SLIP_EVT_PACKET_RXED:
-      Debug_PulseOnPacketRXED();
-    break;
-    case HCI_SLIP_EVT_ACK_RXED:
-      Debug_PulseOnAckRXED();
-    break;
-    case HCI_SLIP_EVT_ERR_RXED:
-      Debug_PulseOnErrRXED();
-    break;
-    case HCI_TIMER_EVT_TIMEOUT:
-      Debug_PulseOnTimer();
-    break;
-    case HCI_RETX:
-      Debug_PulseOnRETX();
-    break;
-    case HCI_MAIN_BUSY:
-      Debug_LevelOnBusy(event.data);
-    break;
-    case HCI_TX_REQ:
-      Debug_PulseOnTXReq();
-    break;
-
-    default:
-    break;
-    }
-    return;
-}
-
-
-void debug_init(hci_dbg_event_handler_t evt_callback)
-{
-    //Configure all LED as outputs.
-    nrf_gpio_range_cfg_output(LED_START, LED_STOP);
-
-    nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_TX);
-    nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_TX);
-    nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_TXED);
-    nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_TXED);
-    nrf_gpio_cfg_output(PIO_SLIP_EVT_PKT_RXED);
-    nrf_gpio_cfg_output(PIO_SLIP_EVT_ACK_RXED);
-    nrf_gpio_cfg_output(PIO_TIMER_EVT_TIMEOUT);
-    nrf_gpio_cfg_output(PIO_HCI_RETX);
-    nrf_gpio_cfg_output(PIO_MAIN_BUSY);
-    nrf_gpio_cfg_output(PIO_TX_REQ);
-    m_hci_dbg_event_handler = evt_callback;
-    if (evt_callback)
-    {
-      m_hci_dbg_event_handler = evt_callback;
-    }
-    else
-    {
-      m_hci_dbg_event_handler = default_hci_event_handler;
-    }
-
-}
-
-
-void debug_evt(hci_dbg_evt_type_t evt, uint32_t data)
-{
-    hci_dbg_evt_t event;
-    event.evt = evt;
-    event.data = data;
-    
-    if (m_hci_dbg_event_handler)
-    {
-      m_hci_dbg_event_handler(event);
-    }
-}
-
-#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/serialization/common/transport/dtm_uart_params.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/dtm_uart_params.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/dtm_uart_params.h
deleted file mode 100644
index c7e5346..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/dtm_uart_params.h
+++ /dev/null
@@ -1,65 +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.
- *
- */
-
-#ifndef DTM_UART_PARAMS_H__
-#define DTM_UART_PARAMS_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @ingroup ble_dtm_app
- */
-
-
-/**@brief Enumeration of supported baud rates. */ 
-typedef enum
-{
-    UART_BAUD_RATE_1200,     /**< Baud rate 1200. */
-    UART_BAUD_RATE_2400,     /**< Baud rate 2400. */
-    UART_BAUD_RATE_4800,     /**< Baud rate 4800. */
-    UART_BAUD_RATE_9600,     /**< Baud rate 9600. */
-    UART_BAUD_RATE_14400,    /**< Baud rate 14400. */
-    UART_BAUD_RATE_19200,    /**< Baud rate 19200. */
-    UART_BAUD_RATE_28800,    /**< Baud rate 28800. */
-    UART_BAUD_RATE_38400,    /**< Baud rate 38400. */
-    UART_BAUD_RATE_57600,    /**< Baud rate 57600. */
-    UART_BAUD_RATE_76800,    /**< Baud rate 76800. */
-    UART_BAUD_RATE_115200,   /**< Baud rate 115200. */
-    UART_BAUD_RATE_230400,   /**< Baud rate 230400. */
-    UART_BAUD_RATE_250000,   /**< Baud rate 250000. */
-    UART_BAUD_RATE_460800,   /**< Baud rate 460800. */
-    UART_BAUD_RATE_921600,   /**< Baud rate 921600. */
-    UART_BAUD_RATE_1000000,  /**< Baud rate 1000000. */
-    UART_BAUD_RATE_MAX       /**< Enumeration upper bound. */
-} app_uart_stream_baud_rate_t;
-
-/**@brief UART communication structure holding configuration settings for the peripheral.
- */
-typedef struct
-{
-    uint8_t                     rx_pin_no;      /**< RX pin number. */
-    uint8_t                     tx_pin_no;      /**< TX pin number. */
-    uint8_t                     rts_pin_no;     /**< RTS pin number, only used if flow control is enabled. */
-    uint8_t                     cts_pin_no;     /**< CTS pin number, only used if flow control is enabled. */
-    bool                        use_parity;     /**< Even parity if TRUE, no parity if FALSE. */
-    app_uart_stream_baud_rate_t baud_rate;      /**< Baud rate configuration. */
-} app_uart_stream_comm_params_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DTM_UART_PARAMS_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/serialization/common/transport/ser_hal_transport.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.c
deleted file mode 100644
index 30a9fc9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.c
+++ /dev/null
@@ -1,460 +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.
- *
- */
-
-#include <stdbool.h>
-#include <string.h>
-#include "app_error.h"
-#include "ser_config.h"
-#include "ser_phy.h"
-#include "ser_hal_transport.h"
-
-/**
- * @brief States of the RX state machine.
- */
-typedef enum
-{
-    HAL_TRANSP_RX_STATE_CLOSED = 0,
-    HAL_TRANSP_RX_STATE_IDLE,
-    HAL_TRANSP_RX_STATE_RECEIVING,
-    HAL_TRANSP_RX_STATE_DROPPING,
-    HAL_TRANSP_RX_STATE_RECEIVED,
-    HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ,
-    HAL_TRANSP_RX_STATE_RECEIVED_DROPPING,
-    HAL_TRANSP_RX_STATE_MAX
-}ser_hal_transp_rx_states_t;
-
-/**
- * @brief States of the TX state machine.
- */
-typedef enum
-{
-    HAL_TRANSP_TX_STATE_CLOSED = 0,
-    HAL_TRANSP_TX_STATE_IDLE,
-    HAL_TRANSP_TX_STATE_TX_ALLOCATED,
-    HAL_TRANSP_TX_STATE_TRANSMITTING,
-    HAL_TRANSP_TX_STATE_TRANSMITTED,
-    HAL_TRANSP_TX_STATE_MAX
-}ser_hal_transp_tx_states_t;
-
-/**
- * @brief RX state.
- */
-static ser_hal_transp_rx_states_t m_rx_state = HAL_TRANSP_RX_STATE_CLOSED;
-/**
- * @brief TX state.
- */
-static ser_hal_transp_tx_states_t m_tx_state = HAL_TRANSP_TX_STATE_CLOSED;
-
-/**
- * @brief Transmission buffer.
- */
-static uint8_t m_tx_buffer[SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE];
-/**
- * @brief Reception buffer.
- */
-static uint8_t m_rx_buffer[SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE];
-
-/**
- * @brief Callback function handler for Serialization HAL Transport layer events.
- */
-static ser_hal_transport_events_handler_t m_events_handler = NULL;
-
-
-/**
- * @brief A callback function to be used to handle a PHY module events. This function is called in
- *        an interrupt context.
- */
-static void phy_events_handler(ser_phy_evt_t phy_event)
-{
-    uint32_t                err_code = 0;
-    ser_hal_transport_evt_t hal_transp_event;
-
-    memset(&hal_transp_event, 0, sizeof (ser_hal_transport_evt_t));
-    hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TYPE_MAX;
-
-    switch (phy_event.evt_type)
-    {
-        case SER_PHY_EVT_TX_PKT_SENT:
-        {
-            if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state)
-            {
-                m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED;
-                err_code   = ser_hal_transport_tx_pkt_free(m_tx_buffer);
-                APP_ERROR_CHECK(err_code);
-                /* An event to an upper layer that a packet has been transmitted. */
-                hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TX_PKT_SENT;
-                m_events_handler(hal_transp_event);
-            }
-            else
-            {
-                /* Lower layer should not generate this event in current state. */
-                APP_ERROR_CHECK_BOOL(false);
-            }
-            break;
-        }
-
-        case SER_PHY_EVT_RX_BUF_REQUEST:
-        {
-            /* An event to an upper layer that a packet is being scheduled to receive or to drop. */
-            hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING;
-
-            /* Receive or drop a packet. */
-            if (phy_event.evt_params.rx_buf_request.num_of_bytes <= sizeof (m_rx_buffer))
-            {
-                if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state)
-                {
-                    m_events_handler(hal_transp_event);
-                    err_code = ser_phy_rx_buf_set(m_rx_buffer);
-                    APP_ERROR_CHECK(err_code);
-                    m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING;
-                }
-                else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state)
-                {
-                    /* It is OK to get know higher layer at this point that we are going to receive
-                     * a new packet even though we will start receiving when rx buffer is freed. */
-                    m_events_handler(hal_transp_event);
-                    m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ;
-                }
-                else
-                {
-                    /* Lower layer should not generate this event in current state. */
-                    APP_ERROR_CHECK_BOOL(false);
-                }
-            }
-            else
-            {
-                /* There is not enough memory but packet has to be received to dummy location. */
-                if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state)
-                {
-                    m_events_handler(hal_transp_event);
-                    err_code = ser_phy_rx_buf_set(NULL);
-                    APP_ERROR_CHECK(err_code);
-                    m_rx_state = HAL_TRANSP_RX_STATE_DROPPING;
-                }
-                else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state)
-                {
-                    m_events_handler(hal_transp_event);
-                    err_code = ser_phy_rx_buf_set(NULL);
-                    APP_ERROR_CHECK(err_code);
-                    m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_DROPPING;
-                }
-                else
-                {
-                    /* Lower layer should not generate this event in current state. */
-                    APP_ERROR_CHECK_BOOL(false);
-                }
-            }
-            break;
-        }
-
-        case SER_PHY_EVT_RX_PKT_RECEIVED:
-        {
-            if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state)
-            {
-                m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED;
-                /* Generate the event to an upper layer. */
-                hal_transp_event.evt_type =
-                    SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED;
-                hal_transp_event.evt_params.rx_pkt_received.p_buffer =
-                    phy_event.evt_params.rx_pkt_received.p_buffer;
-                hal_transp_event.evt_params.rx_pkt_received.num_of_bytes =
-                    phy_event.evt_params.rx_pkt_received.num_of_bytes;
-                m_events_handler(hal_transp_event);
-            }
-            else
-            {
-                /* Lower layer should not generate this event in current state. */
-                APP_ERROR_CHECK_BOOL(false);
-            }
-            break;
-        }
-
-        case SER_PHY_EVT_RX_PKT_DROPPED:
-        {
-            if (HAL_TRANSP_RX_STATE_DROPPING == m_rx_state)
-            {
-                /* Generate the event to an upper layer. */
-                hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED;
-                m_events_handler(hal_transp_event);
-                m_rx_state = HAL_TRANSP_RX_STATE_IDLE;
-            }
-            else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state)
-            {
-                /* Generate the event to an upper layer. */
-                hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED;
-                m_events_handler(hal_transp_event);
-                m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED;
-            }
-            else
-            {
-                /* Lower layer should not generate this event in current state. */
-                APP_ERROR_CHECK_BOOL(false);
-            }
-            break;
-        }
-
-        case SER_PHY_EVT_RX_OVERFLOW_ERROR:
-        {
-            /* Generate the event to an upper layer. */
-            hal_transp_event.evt_type                        = SER_HAL_TRANSP_EVT_PHY_ERROR;
-            hal_transp_event.evt_params.phy_error.error_type =
-                SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW;
-            m_events_handler(hal_transp_event);
-            break;
-        }
-
-        case SER_PHY_EVT_TX_OVERREAD_ERROR:
-        {
-            /* Generate the event to an upper layer. */
-            hal_transp_event.evt_type                        = SER_HAL_TRANSP_EVT_PHY_ERROR;
-            hal_transp_event.evt_params.phy_error.error_type =
-                SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD;
-            m_events_handler(hal_transp_event);
-            break;
-        }
-
-        case SER_PHY_EVT_HW_ERROR:
-        {
-            /* Generate the event to an upper layer. */
-            hal_transp_event.evt_type                        = SER_HAL_TRANSP_EVT_PHY_ERROR;
-            hal_transp_event.evt_params.phy_error.error_type =
-                SER_HAL_TRANSP_PHY_ERROR_HW_ERROR;
-            hal_transp_event.evt_params.phy_error.hw_error_code =
-                phy_event.evt_params.hw_error.error_code;
-            if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state)
-            {
-                m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED;
-                err_code   = ser_hal_transport_tx_pkt_free(phy_event.evt_params.hw_error.p_buffer);
-                APP_ERROR_CHECK(err_code);
-                /* An event to an upper layer that a packet has been transmitted. */
-            }
-            else if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state)
-            {
-                m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED;
-                err_code   = ser_hal_transport_rx_pkt_free(phy_event.evt_params.hw_error.p_buffer);
-                APP_ERROR_CHECK(err_code);
-            }
-            m_events_handler(hal_transp_event);
-
-            break;
-        }
-
-        default:
-        {
-            APP_ERROR_CHECK_BOOL(false);
-            break;
-        }
-    }
-}
-
-uint32_t ser_hal_transport_open(ser_hal_transport_events_handler_t events_handler)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    if ((HAL_TRANSP_RX_STATE_CLOSED != m_rx_state) || (HAL_TRANSP_TX_STATE_CLOSED != m_tx_state))
-    {
-        err_code = NRF_ERROR_INVALID_STATE;
-    }
-    else if (NULL == events_handler)
-    {
-        err_code = NRF_ERROR_NULL;
-    }
-    else
-    {
-        /* We have to change states before calling lower layer because ser_phy_open() function is
-         * going to enable interrupts. On success an event from PHY layer can be emitted immediately
-         * after return from ser_phy_open(). */
-        m_rx_state = HAL_TRANSP_RX_STATE_IDLE;
-        m_tx_state = HAL_TRANSP_TX_STATE_IDLE;
-
-        m_events_handler = events_handler;
-
-        /* Initialize a PHY module. */
-        err_code = ser_phy_open(phy_events_handler);
-
-        if (NRF_SUCCESS != err_code)
-        {
-            m_rx_state       = HAL_TRANSP_RX_STATE_CLOSED;
-            m_tx_state       = HAL_TRANSP_TX_STATE_CLOSED;
-            m_events_handler = NULL;
-
-            if (NRF_ERROR_INVALID_PARAM != err_code)
-            {
-                err_code = NRF_ERROR_INTERNAL;
-            }
-        }
-    }
-
-    return err_code;
-}
-
-
-void ser_hal_transport_close(void)
-{
-    /* Reset generic handler for all events, reset internal states and close PHY module. */
-    ser_phy_interrupts_disable();
-    m_rx_state = HAL_TRANSP_RX_STATE_CLOSED;
-    m_tx_state = HAL_TRANSP_TX_STATE_CLOSED;
-
-    m_events_handler = NULL;
-
-    ser_phy_close();
-}
-
-
-uint32_t ser_hal_transport_rx_pkt_free(uint8_t * p_buffer)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    ser_phy_interrupts_disable();
-
-    if (NULL == p_buffer)
-    {
-        err_code = NRF_ERROR_NULL;
-    }
-    else if (p_buffer != m_rx_buffer)
-    {
-        err_code = NRF_ERROR_INVALID_ADDR;
-    }
-    else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state)
-    {
-        m_rx_state = HAL_TRANSP_RX_STATE_IDLE;
-    }
-    else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state)
-    {
-        m_rx_state = HAL_TRANSP_RX_STATE_DROPPING;
-    }
-    else if (HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ == m_rx_state)
-    {
-        err_code = ser_phy_rx_buf_set(m_rx_buffer);
-
-        if (NRF_SUCCESS == err_code)
-        {
-            m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING;
-        }
-        else
-        {
-            err_code = NRF_ERROR_INTERNAL;
-        }
-    }
-    else
-    {
-        /* Upper layer should not call this function in current state. */
-        err_code = NRF_ERROR_INVALID_STATE;
-    }
-    ser_phy_interrupts_enable();
-
-    return err_code;
-}
-
-
-uint32_t ser_hal_transport_tx_pkt_alloc(uint8_t * * pp_memory, uint16_t * p_num_of_bytes)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    if ((NULL == pp_memory) || (NULL == p_num_of_bytes))
-    {
-        err_code = NRF_ERROR_NULL;
-    }
-    else if (HAL_TRANSP_TX_STATE_CLOSED == m_tx_state)
-    {
-        err_code = NRF_ERROR_INVALID_STATE;
-    }
-    else if (HAL_TRANSP_TX_STATE_IDLE == m_tx_state)
-    {
-        m_tx_state      = HAL_TRANSP_TX_STATE_TX_ALLOCATED;
-        *pp_memory      = &m_tx_buffer[0];
-        *p_num_of_bytes = (uint16_t)sizeof (m_tx_buffer);
-    }
-    else
-    {
-        err_code = NRF_ERROR_NO_MEM;
-    }
-
-    return err_code;
-}
-
-
-uint32_t ser_hal_transport_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    /* The buffer provided to this function must be allocated through ser_hal_transport_tx_alloc()
-     * function - this assures correct state and that correct memory buffer is used. */
-    if (NULL == p_buffer)
-    {
-        err_code = NRF_ERROR_NULL;
-    }
-    else if (0 == num_of_bytes)
-    {
-        err_code = NRF_ERROR_INVALID_PARAM;
-    }
-    else if (p_buffer != m_tx_buffer)
-    {
-        err_code = NRF_ERROR_INVALID_ADDR;
-    }
-    else if (num_of_bytes > sizeof (m_tx_buffer))
-    {
-        err_code = NRF_ERROR_DATA_SIZE;
-    }
-    else if (HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state)
-    {
-        ser_phy_interrupts_disable();
-        err_code = ser_phy_tx_pkt_send(p_buffer, num_of_bytes);
-
-        if (NRF_SUCCESS == err_code)
-        {
-            m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTING;
-        }
-        else
-        {
-            if (NRF_ERROR_BUSY != err_code)
-            {
-                err_code = NRF_ERROR_INTERNAL;
-            }
-        }
-        ser_phy_interrupts_enable();
-    }
-    else
-    {
-        err_code = NRF_ERROR_INVALID_STATE;
-    }
-
-    return err_code;
-}
-
-
-uint32_t ser_hal_transport_tx_pkt_free(uint8_t * p_buffer)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    if (NULL == p_buffer)
-    {
-        err_code = NRF_ERROR_NULL;
-    }
-    else if (p_buffer != m_tx_buffer)
-    {
-        err_code = NRF_ERROR_INVALID_ADDR;
-    }
-    else if ((HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state) ||
-             (HAL_TRANSP_TX_STATE_TRANSMITTED == m_tx_state))
-    {
-        /* Release TX buffer for use. */
-        m_tx_state = HAL_TRANSP_TX_STATE_IDLE;
-    }
-    else
-    {
-        err_code = NRF_ERROR_INVALID_STATE;
-    }
-
-    return err_code;
-}

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/serialization/common/transport/ser_hal_transport.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.h
deleted file mode 100644
index e8e90f2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_hal_transport.h
+++ /dev/null
@@ -1,239 +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 ser_hal_transport Serialization HAL Transport
- * @{
- * @ingroup ble_sdk_lib_serialization
- *
- * @brief   HAL Transport layer for serialization.
- *
- * @details This file contains declarations of functions and typedefs used as API of the HAL
- *          Transport layer for serialization. This layer is fully hardware independent.
- *          Currently the HAL Transport layer is responsible for controlling the PHY layer and
- *          memory management. In the future it is possible to add more feature to it as: crc,
- *          retransmission etc.
- *
- * \n \n
- * \image html ser_hal_transport_rx_state_machine.png "RX state machine"
- * \n \n
- * \image html ser_hal_transport_tx_state_machine.png "TX state machine"
- * \n
- */
-
-#ifndef SER_HAL_TRANSPORT_H__
-#define SER_HAL_TRANSPORT_H__
-
-#include <stdint.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief Serialization HAL Transport layer event types. */
-typedef enum
-{
-    SER_HAL_TRANSP_EVT_TX_PKT_SENT = 0,     /**< An event indicating that TX packet has been
-                                                 transmitted. */
-    SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING,    /**< An event indicating that RX packet is being
-                                                 scheduled to receive or to drop. */
-    SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED,     /**< An event indicating that RX packet is ready for
-                                                 read. */
-    SER_HAL_TRANSP_EVT_RX_PKT_DROPPED,      /**< An event indicating that RX packet was dropped
-                                                 because it was longer than available buffer. */
-    SER_HAL_TRANSP_EVT_PHY_ERROR,           /**< An event indicating error on PHY layer. */
-    SER_HAL_TRANSP_EVT_TYPE_MAX             /**< Enumeration upper bound. */
-} ser_hal_transport_evt_type_t;
-
-
-/**@brief Serialization PHY layer error types. */
-typedef enum
-{
-    SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW = 0, /**< An error indicating that more information has
-                                                   been transmitted than phy module could handle. */
-    SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD,     /**< An error indicating that phy module was forced to
-                                                   transmit more information than possessed. */
-    SER_HAL_TRANSP_PHY_ERROR_HW_ERROR,        /**< An error indicating a hardware error in a phy
-                                                   module. */
-    SER_HAL_TRANSP_PHY_ERROR_TYPE_MAX         /**< Enumeration upper bound. */
-} ser_hal_transport_phy_error_type_t;
-
-
-/**@brief A struct containing parameters of the event of type
- *        @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED.
- */
-typedef struct
-{
-    uint8_t * p_buffer;     /**< Pointer to a buffer containing a packet to read. */
-    uint16_t  num_of_bytes; /**< Length of a received packet in octets. */
-} ser_hal_transport_evt_rx_pkt_received_params_t;
-
-
-/**@brief A struct containing parameters of the event of type @ref SER_HAL_TRANSP_EVT_PHY_ERROR. */
-typedef struct
-{
-    ser_hal_transport_phy_error_type_t error_type; /**< Type of PHY error. */
-    uint32_t hw_error_code; /**< Hardware error code - specific for any microcontroller. Parameter
-                                 is valid only for the phy error of type
-                                 @ref SER_HAL_TRANSP_PHY_ERROR_HW_ERROR. */
-} ser_hal_transport_evt_phy_error_params_t;
-
-
-/**@brief A struct containing events from the Serialization HAL Transport layer.
- *
- * @note  Some events do not have parameters, then whole information is contained in the evt_type.
- */
-typedef struct
-{
-    ser_hal_transport_evt_type_t evt_type;  /**< Type of event. */
-    union  /**< Union alternative identified by evt_type in enclosing struct. */
-    {
-        ser_hal_transport_evt_rx_pkt_received_params_t  rx_pkt_received; /**< Parameters of the event of type @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED. */
-        ser_hal_transport_evt_phy_error_params_t        phy_error;       /**< Parameters of the event of type @ref SER_HAL_TRANSP_EVT_PHY_ERROR. */
-    } evt_params;
-} ser_hal_transport_evt_t;
-
-
-/**@brief A generic callback function type to be used by all Serialization HAL Transport layer
- *        events.
- *
- * @param[in] event    Serialization HAL Transport layer event.
- */
-typedef void (*ser_hal_transport_events_handler_t)(ser_hal_transport_evt_t event);
-
-                                        
-/**@brief A function for opening and initializing the Serialization HAL Transport layer.
- *
- * @note The function opens the transport channel, initializes a PHY layer and registers callback
- *       function to be used by all Serialization HAL Transport layer events.
- *
- * @warning If the function has been already called, the function @ref ser_hal_transport_close has
- *          to be called before ser_hal_transport_open can be called again.
- *
- * @param[in] events_handler    Generic callback function to be used by all Serialization HAL
- *                              Transport layer events.
- * 
- * @retval NRF_SUCCESS              Operation success.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_PARAM  Operation failure. Hardware initialization parameters taken from
- *                                  the configuration file are wrong.
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. The function has been already called. To call
- *                                  it again the function @ref ser_hal_transport_close has to be
- *                                  called previously.
- * @retval NRF_ERROR_INTERNAL       Operation failure. Internal error ocurred. 
- */
-uint32_t ser_hal_transport_open(ser_hal_transport_events_handler_t events_handler);
-
-
-/**@brief A function for closing a transport channel.
- *
- * @note The function disables hardware, resets internal module states and unregisters events
- *       callback function. Can be called multiple times, also for not opened channel.
- */
-void ser_hal_transport_close(void);
-
-
-/**@brief A function for freeing a memory allocated for RX packet.
- *
- * @note The function should be called as a response to an event of type
- *       @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED when received data has beed processed. The function
- *       frees an RX memory pointed by p_buffer. The memory, immediately or at a later time, is
- *       reused by the underlying transport layer.
- *
- * @param[in] p_buffer    A pointer to the beginning of a buffer that has been processed (has to be
- *                        the same address as provided in an event of type
- *                        @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED).
- *
- * @retval NRF_SUCCESS              Operation success.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_ADDR   Operation failure. Not a valid pointer (provided address is not
- *                                  the starting address of a buffer managed by HAL Transport layer).
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. The function should be called as a response
- *                                  to an event of type @ref SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED.
- * @retval NRF_ERROR_INTERNAL       Operation failure. Internal error ocurred.
- */
-uint32_t ser_hal_transport_rx_pkt_free(uint8_t * p_buffer);
-
-
-/**@brief A function for allocating a memory for TX packet.
- * 
- * @param[out] pp_memory       A pointer to pointer to which an address of the beginning of the
- *                             allocated buffer is written.
- * @param[out] p_num_of_bytes  A pointer to a variable to which size in octets of the allocated
- *                             buffer is written.
- * 
- * @retval NRF_SUCCESS              Operation success. Memory was allocated.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_NO_MEM         Operation failure. No memory available.
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. The function was called before calling
- *                                  @ref ser_hal_transport_open function.
- */
-uint32_t ser_hal_transport_tx_pkt_alloc(uint8_t ** pp_memory, uint16_t * p_num_of_bytes);
-
-/**@brief A function for transmitting a packet.
- *
- * @note The function adds a packet pointed by p_buffer parameter to a transmission queue. A buffer
- *       provided to this function must be allocated by @ref ser_hal_transport_tx_pkt_alloc function.
- *
- * @warning Completion of this method does not guarantee that actual peripheral transmission would
- *          have completed.
- *
- * @param[in] p_buffer        A pointer to a buffer to transmit.
- * @param[in] num_of_bytes    Number of octets to transmit. Must be more than 0.
- *
- * @retval NRF_SUCCESS              Operation success. Packet was added to the transmission queue.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_PARAM  Operation failure. num_of_bytes is equal to 0.
- * @retval NRF_ERROR_INVALID_ADDR   Operation failure. Not a valid pointer (provided address is not
- *                                  the starting address of a buffer managed by HAL Transport layer).
- * @retval NRF_ERROR_DATA_SIZE      Operation failure. Packet size exceeds limit.
- * @retval NRF_ERROR_BUSY           Operation failure. Transmission queue is full so packet was not
- *                                  added to the transmission queue.
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. Transmittion channel was not opened by
- *                                  @ref ser_hal_transport_open function or provided buffer was not
- *                                  allocated by @ref ser_hal_transport_tx_pkt_alloc function.
- * @retval NRF_ERROR_INTERNAL       Operation failure. Internal error ocurred.
- */
-uint32_t ser_hal_transport_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes);
-
-
-/**@brief A function for freeing a memory allocated for TX packet.
- *
- * @note The function frees a TX memory pointed by p_buffer. Freeing a TX buffer is possible only if
- *       the buffer was allocated by @ref ser_hal_transport_tx_pkt_alloc function and transmittion
- *       is not in progress. When transmittion has finished this function is automatically called by
- *       the Serialization HAL Transport layer, so the only case when this function should be used
- *       from outside is when a TX buffer was allocated but a transmittion has not been started
- *       (@ref ser_hal_transport_tx_pkt_send function has not been called).
- *
- * @param[in] p_buffer    A pointer to the beginning of a buffer that has been allocated by
- *                        @ref ser_hal_transport_tx_pkt_alloc function.
- *
- * @retval NRF_SUCCESS              Operation success. Memory was freed.
- * @retval NRF_ERROR_NULL           Operation failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_ADDR   Operation failure. Not a valid pointer (provided address is not
- *                                  the starting address of a buffer managed by HAL Transport layer).
- * @retval NRF_ERROR_INVALID_STATE  Operation failure. Freeing a TX buffer is possible only if the
- *                                  buffer was allocated by @ref ser_hal_transport_tx_pkt_alloc
- *                                  function and transmittion is not in progress.
- */
-uint32_t ser_hal_transport_tx_pkt_free(uint8_t * p_buffer);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_HAL_TRANSPORT_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/serialization/common/transport/ser_phy/config/ser_config_5W_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h
deleted file mode 100644
index 9a4af06..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_config_5W_app.h
+++ /dev/null
@@ -1,24 +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.
- *
- */
-
-#ifndef SER_CONFIG_5W_APP_H__
-#define SER_CONFIG_5W_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_CONFIG_APP_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/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h
deleted file mode 100644
index eaa6639..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_app_nrf51.h
+++ /dev/null
@@ -1,78 +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.
- *
- */
-
-#ifndef SER_CONFIG_APP_HAL_NRF51_H__
-#define SER_CONFIG_APP_HAL_NRF51_H__
-
-#include "boards.h"
-#include "ser_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(SPI_MASTER_0_ENABLE)
-#define SER_PHY_SPI_MASTER SPI_MASTER_0
-#endif
-#if defined(SPI_MASTER_1_ENABLE)
-#define SER_PHY_SPI_MASTER SPI_MASTER_1
-#endif
-#if defined(SPI_MASTER_2_ENABLE)
-#define SER_PHY_SPI_MASTER SPI_MASTER_2
-#endif
-
-#if (defined(SPI0_ENABLED) && (SPI0_ENABLED == 1)) || defined(SPI_MASTER_0_ENABLE)
-
-#define SER_PHY_SPI_MASTER_INSTANCE             NRF_DRV_SPI_INSTANCE(0)
-#define SER_PHY_SPI_MASTER_PIN_SCK              SER_APP_SPIM0_SCK_PIN
-#define SER_PHY_SPI_MASTER_PIN_MISO             SER_APP_SPIM0_MISO_PIN
-#define SER_PHY_SPI_MASTER_PIN_MOSI             SER_APP_SPIM0_MOSI_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT     SER_APP_SPIM0_SS_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST    SER_APP_SPIM0_REQ_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY      SER_APP_SPIM0_RDY_PIN
-
-#elif (defined(SPI1_ENABLED) && (SPI1_ENABLED == 1)) || defined(SPI_MASTER_1_ENABLE)
-
-#define SER_PHY_SPI_MASTER_INSTANCE             NRF_DRV_SPI_INSTANCE(1)
-#define SER_PHY_SPI_MASTER_PIN_SCK              SER_APP_SPIM1_SCK_PIN
-#define SER_PHY_SPI_MASTER_PIN_MISO             SER_APP_SPIM1_MISO_PIN
-#define SER_PHY_SPI_MASTER_PIN_MOSI             SER_APP_SPIM1_MOSI_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT     SER_APP_SPIM1_SS_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST    SER_APP_SPIM1_REQ_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY      SER_APP_SPIM1_RDY_PIN
-
-#elif (defined(SPI2_ENABLED) && (SPI2_ENABLED == 1)) || defined(SPI_MASTER_2_ENABLE)
-
-#define SER_PHY_SPI_MASTER_INSTANCE             NRF_DRV_SPI_INSTANCE(2)
-#define SER_PHY_SPI_MASTER_PIN_SCK              SER_APP_SPIM2_SCK_PIN
-#define SER_PHY_SPI_MASTER_PIN_MISO             SER_APP_SPIM2_MISO_PIN
-#define SER_PHY_SPI_MASTER_PIN_MOSI             SER_APP_SPIM2_MOSI_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT     SER_APP_SPIM2_SS_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST    SER_APP_SPIM2_REQ_PIN
-#define SER_PHY_SPI_MASTER_PIN_SLAVE_READY      SER_APP_SPIM2_RDY_PIN
-
-#endif
-
-#define CONN_CHIP_RESET_PIN_NO                  SER_CONN_CHIP_RESET_PIN /**< Pin used for reseting the nRF51822. */
-
-/* UART configuration */
-#define UART_IRQ_PRIORITY                       APP_IRQ_PRIORITY_MID
-#define SER_PHY_UART_RX                         SER_APP_RX_PIN
-#define SER_PHY_UART_TX                         SER_APP_TX_PIN
-#define SER_PHY_UART_CTS                        SER_APP_CTS_PIN
-#define SER_PHY_UART_RTS                        SER_APP_RTS_PIN
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //SER_CONFIG_APP_HAL_NRF51_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/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h
deleted file mode 100644
index a929845..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/config/ser_phy_config_conn_nrf51.h
+++ /dev/null
@@ -1,50 +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.
- *
- */
-
-#ifndef SER_PHY_CONFIG_CONN_NRF51_H__
-#define SER_PHY_CONFIG_CONN_NRF51_H__
-
-#include "boards.h"
-#include "ser_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/***********************************************************************************************//**
- * SER_PHY layer configuration.
- **************************************************************************************************/
-#define SER_PHY_SPI_PPI_RDY_CH                  0
-#define SER_PHY_SPI_GPIOTE_RDY_CH               0
-
-#define SER_PHY_SPI_SLAVE_INSTANCE              1
-
-#define SER_PHY_SPI_SLAVE_REQ_PIN               SER_CON_SPIS_REQ_PIN
-#define SER_PHY_SPI_SLAVE_RDY_PIN               SER_CON_SPIS_RDY_PIN
-#define SER_PHY_SPI_SLAVE_SCK_PIN               SER_CON_SPIS_SCK_PIN
-#define SER_PHY_SPI_SLAVE_MISO_PIN              SER_CON_SPIS_MISO_PIN
-#define SER_PHY_SPI_SLAVE_MOSI_PIN              SER_CON_SPIS_MOSI_PIN
-#define SER_PHY_SPI_SLAVE_SS_PIN                SER_CON_SPIS_CSN_PIN
-
-/* UART configuration */
-#define UART_IRQ_PRIORITY                       APP_IRQ_PRIORITY_LOW
-
-#define SER_PHY_UART_RX                         SER_CON_RX_PIN
-#define SER_PHY_UART_TX                         SER_CON_TX_PIN
-#define SER_PHY_UART_CTS                        SER_CON_CTS_PIN
-#define SER_PHY_UART_RTS                        SER_CON_RTS_PIN
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //SER_PHY_CONFIG_CONN_NRF51_H__


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c
deleted file mode 100644
index f9ede04..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_gatts.c
+++ /dev/null
@@ -1,665 +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 "ble_gatts.h"
-#include <stdint.h>
-#include "ble_serialization.h"
-#include "ser_sd_transport.h"
-#include "ble_gatts_app.h"
-#include "app_error.h"
-
-
-//Pointer for sd calls output params
-static void * mp_out_params[3];
-
-static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
-{
-    uint32_t err_code;
-
-    do
-    {
-        err_code = ser_sd_transport_tx_alloc(p_data, p_len);
-    }
-    while (err_code != NRF_SUCCESS);
-    *p_data[0] = SER_PKT_TYPE_CMD;
-    *p_len    -= 1;
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_set BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_sys_attr_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_sys_attr_set_rsp_dec(p_buffer, length, &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_sys_attr_set(uint16_t              conn_handle,
-                                   uint8_t const * const p_sys_attr_data,
-                                   uint16_t              len,
-                                   uint32_t              flags)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gatts_sys_attr_set_req_enc(conn_handle,
-                                                             p_sys_attr_data,
-                                                             len,
-                                                             flags,
-                                                             &(p_buffer[1]),
-                                                             &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_sys_attr_set_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gatts_hvx BLE command.
- *
- * Callback for decoding the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_hvx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_hvx_rsp_dec(p_buffer, length, &result_code,
-                                                    (uint16_t * *)&mp_out_params[0]);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const * const p_hvx_params)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = (p_hvx_params) ? p_hvx_params->p_len : NULL;
-
-    const uint32_t err_code = ble_gatts_hvx_req_enc(conn_handle,
-                                                    p_hvx_params,
-                                                    &(p_buffer[1]),
-                                                    &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_hvx_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_service_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code =
-        ble_gatts_service_add_rsp_dec(p_buffer,
-                                      length,
-                                      (uint16_t *)mp_out_params[0],
-                                      &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_service_add(uint8_t                  type,
-                                  ble_uuid_t const * const p_uuid,
-                                  uint16_t * const         p_handle)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_handle;
-
-    const uint32_t err_code = ble_gatts_service_add_req_enc(type,
-                                                            p_uuid,
-                                                            p_handle,
-                                                            &(p_buffer[1]),
-                                                            &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_service_add_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_service_changed_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = NRF_SUCCESS;
-
-    const uint32_t err_code = ble_gatts_service_changed_rsp_dec(p_buffer,
-                                                                length,
-                                                                &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gatts_service_changed(uint16_t conn_handle,
-                                      uint16_t start_handle,
-                                      uint16_t end_handle)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_gatts_service_changed_req_enc(conn_handle,
-                                                                start_handle,
-                                                                end_handle,
-                                                                &(p_buffer[1]),
-                                                                &buffer_length);
-
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_service_changed_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_include_add BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_include_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = NRF_SUCCESS;
-
-    const uint32_t err_code =
-        ble_gatts_include_add_rsp_dec(p_buffer,
-                                      length,
-                                      (uint16_t *) mp_out_params[0],
-                                      &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gatts_include_add(uint16_t         service_handle,
-                                  uint16_t         inc_serv_handle,
-                                  uint16_t * const p_include_handle)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_include_handle;
-
-    const uint32_t err_code = ble_gatts_include_add_req_enc(service_handle,
-                                                            inc_serv_handle,
-                                                            p_include_handle,
-                                                            &(p_buffer[1]),
-                                                            &buffer_length);
-
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_include_add_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_characteristic_add BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_characteristic_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_characteristic_add_rsp_dec(
-        p_buffer,
-        length,
-        (uint16_t * *)&mp_out_params[0],
-        &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_characteristic_add(uint16_t                          service_handle,
-                                         ble_gatts_char_md_t const * const p_char_md,
-                                         ble_gatts_attr_t const * const    p_attr_char_value,
-                                         ble_gatts_char_handles_t * const  p_handles)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_handles;
-
-    const uint32_t err_code = ble_gatts_characteristic_add_req_enc(service_handle,
-                                                                   p_char_md,
-                                                                   p_attr_char_value,
-                                                                   p_handles,
-                                                                   &(p_buffer[1]),
-                                                                   &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_characteristic_add_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_descriptor_add BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_descriptor_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = NRF_SUCCESS;
-
-    const uint32_t err_code =
-        ble_gatts_descriptor_add_rsp_dec(p_buffer,
-                                         length,
-                                         (uint16_t *) mp_out_params[0],
-                                         &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gatts_descriptor_add(uint16_t                       char_handle,
-                                     ble_gatts_attr_t const * const p_attr,
-                                     uint16_t * const               p_handle)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_handle;
-
-    const uint32_t err_code = ble_gatts_descriptor_add_req_enc(char_handle,
-                                                               p_attr,
-                                                               p_handle,
-                                                               &(p_buffer[1]),
-                                                               &buffer_length);
-
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_descriptor_add_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_rw_authorize_reply BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_rw_authorize_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code = NRF_SUCCESS;
-
-    const uint32_t err_code = ble_gatts_rw_authorize_reply_rsp_dec(p_buffer,
-                                                                   length,
-                                                                   &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gatts_rw_authorize_reply(
-    uint16_t conn_handle,
-    ble_gatts_rw_authorize_reply_params_t const * const
-    p_rw_authorize_reply_params)
-{
-
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-
-    const uint32_t err_code = ble_gatts_rw_authorize_reply_req_enc(conn_handle,
-                                                                   p_rw_authorize_reply_params,
-                                                                   &(p_buffer[1]),
-                                                                   &buffer_length);
-
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_rw_authorize_reply_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_value_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_value_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_value_get_rsp_dec(p_buffer,
-                                                          length,
-                                                          (ble_gatts_value_t *)mp_out_params[0],
-                                                          &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-uint32_t sd_ble_gatts_value_get(uint16_t            conn_handle,
-                                uint16_t            handle,
-                                ble_gatts_value_t * p_value)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_value;
-
-    const uint32_t err_code = ble_gatts_value_get_req_enc(conn_handle,
-                                                          handle,
-                                                          p_value,
-                                                          &(p_buffer[1]),
-                                                          &buffer_length);
-
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_value_get_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_value_set BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_value_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_value_set_rsp_dec(
-        p_buffer,
-        length,
-        (ble_gatts_value_t *)mp_out_params[0],
-        &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_value_set(uint16_t            conn_handle,
-                                uint16_t            handle,
-                                ble_gatts_value_t * p_value)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_value;
-    
-    const uint32_t err_code = ble_gatts_value_set_req_enc(conn_handle,
-                                                          handle,
-                                                          p_value,
-                                                          &(p_buffer[1]),
-                                                          &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_value_set_rsp_dec);
-}
-
-
-/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_sys_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_sys_attr_get_rsp_dec(
-        p_buffer,
-        length,
-        (uint8_t *)  mp_out_params[0],
-        (uint16_t *) mp_out_params[1],
-        &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_sys_attr_get(uint16_t         conn_handle,
-                                   uint8_t * const  p_sys_attr_data,
-                                   uint16_t * const p_len,
-                                   uint32_t         flags)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_sys_attr_data;
-    mp_out_params[1] = p_len;
-
-    const uint32_t err_code = ble_gatts_sys_attr_get_req_enc(conn_handle,
-                                                             p_sys_attr_data,
-                                                             p_len,
-                                                             flags,
-                                                             &(p_buffer[1]),
-                                                             &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_sys_attr_get_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_attr_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_attr_get_rsp_dec(
-        p_buffer,
-        length,
-        (ble_gatts_attr_md_t **)&mp_out_params[0],
-        &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_attr_get(uint16_t              handle,
-                               ble_uuid_t          * p_uuid,
-                               ble_gatts_attr_md_t * p_md)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_md;
-
-    const uint32_t err_code = ble_gatts_attr_get_req_enc(handle,
-                                                         p_uuid,
-                                                         p_md,
-                                                        &(p_buffer[1]),
-                                                        &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_attr_get_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ble_gatts_initial_user_handle_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t gatts_initial_user_handle_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ble_gatts_initial_user_handle_get_rsp_dec(
-        p_buffer,
-        length,
-        (uint16_t **)&mp_out_params[0],
-        &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_gatts_initial_user_handle_get(uint16_t * p_handle)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_params[0] = p_handle;
-
-    const uint32_t err_code = ble_gatts_initial_user_handle_get_req_enc(p_handle,
-                                                             &(p_buffer[1]),
-                                                             &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      gatts_initial_user_handle_get_rsp_dec);
-}

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/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c
deleted file mode 100644
index d4cf91c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_ble_l2cap.c
+++ /dev/null
@@ -1,165 +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.
- *
- */
-
-#include "ble_gap.h"
-#include <stdint.h>
-#include "ble_serialization.h"
-#include "ser_sd_transport.h"
-#include "ble_l2cap_app.h"
-#include "app_error.h"
-
-static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
-{
-    uint32_t err_code;
-
-    do
-    {
-        err_code = ser_sd_transport_tx_alloc(p_data, p_len);
-    }
-    while (err_code != NRF_SUCCESS);
-    *p_data[0] = SER_PKT_TYPE_CMD;
-    *p_len    -= 1;
-}
-/**@brief Command response callback function for @ref ble_l2cap_cid_register_req_enc BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t l2cap_cid_register_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code =
-        ble_l2cap_cid_register_rsp_dec(p_buffer,
-                                       length,
-                                       &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_l2cap_cid_register(uint16_t cid)
-{
-
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_l2cap_cid_register_req_enc(cid,
-                                                             &(p_buffer[1]),
-                                                             &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      l2cap_cid_register_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref ble_l2cap_cid_unregister_req_enc BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t l2cap_cid_unregister_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code =
-        ble_l2cap_cid_unregister_rsp_dec(p_buffer,
-                                         length,
-                                         &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_l2cap_cid_unregister(uint16_t cid)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_l2cap_cid_unregister_req_enc(cid,
-                                                               &(p_buffer[1]),
-                                                               &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      l2cap_cid_unregister_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref ble_l2cap_tx_req_enc BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-static uint32_t l2cap_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code =
-        ble_l2cap_tx_rsp_dec(p_buffer,
-                             length,
-                             &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-
-
-    return result_code;
-}
-
-
-uint32_t sd_ble_l2cap_tx(uint16_t                         conn_handle,
-                         ble_l2cap_header_t const * const p_header,
-                         uint8_t const * const            p_data)
-{
-
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = ble_l2cap_tx_req_enc(conn_handle, p_header, p_data,
-                                                   &(p_buffer[1]),
-                                                   &buffer_length);
-    //@note: Should never fail.
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      l2cap_tx_rsp_dec);
-}
-

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/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c
deleted file mode 100644
index 9fc2231..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/middleware/app_mw_nrf_soc.c
+++ /dev/null
@@ -1,144 +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.
- *
- */
-
-#include "nrf_soc.h"
-#include <stdint.h>
-#include <string.h>
-#include "ser_sd_transport.h"
-#include "nrf_soc_app.h"
-#include "nrf_error_soc.h"
-#include "app_error.h"
-#include "ble_serialization.h"
-
-#include "ser_app_power_system_off.h"
-
-static void * mp_out_param;
-
-static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
-{
-    uint32_t err_code;
-
-    do
-    {
-        err_code = ser_sd_transport_tx_alloc(p_data, p_len);
-    }
-    while (err_code != NRF_SUCCESS);
-    *p_data[0] = SER_PKT_TYPE_CMD;
-    *p_len    -= 1;
-}
-
-
-uint32_t sd_power_system_off(void)
-{
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    const uint32_t err_code = power_system_off_req_enc(&(p_buffer[1]), &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    ser_app_power_system_off_set();
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      NULL);
-}
-
-
-/**@brief Command response callback function for @ref sd_temp_get BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-
-static uint32_t mw_temp_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = temp_get_rsp_dec(p_buffer,
-                                               length,
-                                               &result_code,
-                                               (int32_t *)mp_out_param);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_temp_get(int32_t * p_temp)
-{
-
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_param = p_temp;
-
-    const uint32_t err_code = temp_get_req_enc(p_temp,
-                                               &(p_buffer[1]),
-                                               &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      mw_temp_get_rsp_dec);
-}
-
-/**@brief Command response callback function for @ref sd_ecb_block_encrypt BLE command.
- *
- * Callback for decoding the output parameters and the command response return code.
- *
- * @param[in] p_buffer  Pointer to begin of command response buffer.
- * @param[in] length    Length of data in bytes.
- *
- * @return Decoded command response return code.
- */
-
-static uint32_t mw_ecb_block_encrypt_rsp_dec(const uint8_t * p_buffer, uint16_t length)
-{
-    uint32_t result_code;
-
-    const uint32_t err_code = ecb_block_encrypt_rsp_dec(p_buffer,
-                                               length,
-                                               (nrf_ecb_hal_data_t *)mp_out_param,
-                                               &result_code);
-
-    APP_ERROR_CHECK(err_code);
-
-    return result_code;
-}
-
-uint32_t sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data)
-{
-
-    uint8_t * p_buffer;
-    uint32_t  buffer_length = 0;
-
-    tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
-    mp_out_param = p_ecb_data;
-
-    const uint32_t err_code = ecb_block_encrypt_req_enc(p_ecb_data,
-                                                       &(p_buffer[1]),
-                                                       &buffer_length);
-    APP_ERROR_CHECK(err_code);
-
-    //@note: Increment buffer length as internally managed packet type field must be included.
-    return ser_sd_transport_cmd_write(p_buffer,
-                                      (++buffer_length),
-                                      mw_ecb_block_encrypt_rsp_dec);
-}

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/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c
deleted file mode 100644
index 8b0c7ae..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.c
+++ /dev/null
@@ -1,73 +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.
- *
- */
-
-#include "app_ble_gap_sec_keys.h"
-#include "nrf_error.h"
-#include <stddef.h>
-
-ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS];
-
-uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index)
-{
-  uint32_t err_code = NRF_ERROR_NO_MEM;
-  uint32_t i;
-
-  for (i=0; i<SER_MAX_CONNECTIONS; i++ )
-  {
-    if ( ! m_app_keys_table[i].conn_active )
-    {
-        m_app_keys_table[i].conn_active = 1;
-        m_app_keys_table[i].conn_handle = conn_handle;
-        *p_index = i;
-        err_code = NRF_SUCCESS;
-        break;
-    }
-  }
-
-  return err_code;
-}
-
-uint32_t app_ble_gap_sec_context_destroy(uint16_t conn_handle)
-{
-  uint32_t err_code = NRF_ERROR_NOT_FOUND;
-  uint32_t i;
-
-  for (i=0; i<SER_MAX_CONNECTIONS; i++ )
-  {
-    if (  m_app_keys_table[i].conn_handle == conn_handle )
-    {
-        m_app_keys_table[i].conn_active = 0;
-        err_code = NRF_SUCCESS;
-        break;
-    }
-  }
-
-  return err_code;
-}
-
-uint32_t app_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index)
-{
-  uint32_t err_code = NRF_ERROR_NOT_FOUND;
-  uint32_t i;
-
-  for (i=0; i<SER_MAX_CONNECTIONS; i++ )
-  {
-    if ( (m_app_keys_table[i].conn_handle == conn_handle) && (m_app_keys_table[i].conn_active == 1) )
-    {
-        *p_index = i;
-        err_code = NRF_SUCCESS;
-        break;
-    }
-  }
-
-  return err_code;
-}

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/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.h
deleted file mode 100644
index 525e939..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_gap_sec_keys.h
+++ /dev/null
@@ -1,89 +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.
- *
- */
-#ifndef _APP_BLE_GAP_SEC_KEYS_H
-#define _APP_BLE_GAP_SEC_KEYS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
- /**@file
- *
- * @defgroup app_ble_gap_sec_keys GAP Functions for managing memory for security keys in application device.
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    GAP Application auxiliary functions for synchronizing GAP security keys with the ones stored in the connectivity device. 
- */
-
-#include "ble_gap.h"
-#include <stdint.h>
-
-#define SER_MAX_CONNECTIONS 2
-
-/**@brief GAP connection - keyset mapping structure.
- *
- * @note  This structure is used to map keysets to connection instances, and will be stored in a static table.
- */
-typedef struct
-{
-  uint16_t               conn_handle;    /**< Connection handle.*/
-  uint8_t                conn_active;    /**< Indication that keys for this connection are used by soft device. 0: keys used; 1: keys not used*/
-  ble_gap_sec_keyset_t   keyset;         /**< Keyset structure, see @ref ble_gap_sec_keyset_t.*/
-} ser_ble_gap_app_keyset_t;
-
-/**@brief allocates instance in m_app_keys_table[] for storage of encryption keys.
- *
- * @param[in]     conn_handle         conn_handle
- * @param[out]    p_index             pointer to the index of allocated instance
- *
- * @retval NRF_SUCCESS                Context allocated.
- * @retval NRF_ERROR_NO_MEM           No free instance available.
- */
-uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index);
-
-/**@brief release instance identified by a connection handle.
- *
- * @param[in]     conn_handle         conn_handle
- *
- * @retval NRF_SUCCESS                Context released.
- * @retval NRF_ERROR_NOT_FOUND        instance with conn_handle not found
- */
-uint32_t app_ble_gap_sec_context_destroy(uint16_t conn_handle);
-
-/**@brief finds index of instance identified by a connection handle in m_app_keys_table[].
- *
- * @param[in]     conn_handle         conn_handle
- *
- * @param[out]    p_index             Pointer to the index of the entry in the context table corresponding to the given conn_handle
- *
- * @retval NRF_SUCCESS                Context found
- * @retval NRF_ERROR_NOT_FOUND        instance with conn_handle not found
- */
-uint32_t app_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_APP_BLE_GAP_SEC_KEYS_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/serialization/application/codecs/s130/serializers/app_ble_user_mem.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.c
deleted file mode 100644
index 14a268c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.c
+++ /dev/null
@@ -1,74 +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.
- *
- */
-
-#include "app_ble_user_mem.h"
-#include "ser_config.h"
-#include "nrf_error.h"
-#include <stddef.h>
-
-ser_ble_user_mem_t m_app_user_mem_table[SER_MAX_CONNECTIONS];
-
-uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index)
-{
-  uint32_t err_code = NRF_ERROR_NO_MEM;
-  uint32_t i;
-
-  for (i=0; i<SER_MAX_CONNECTIONS; i++ )
-  {
-    if ( ! m_app_user_mem_table[i].conn_active )
-    {
-        m_app_user_mem_table[i].conn_active = 1;
-        m_app_user_mem_table[i].conn_handle = conn_handle;
-        *p_index = i;
-        err_code = NRF_SUCCESS;
-        break;
-    }
-  }
-
-  return err_code;
-}
-
-uint32_t app_ble_user_mem_context_destroy(uint16_t conn_handle)
-{
-  uint32_t err_code = NRF_ERROR_NOT_FOUND;
-  uint32_t i;
-
-  for (i=0; i<SER_MAX_CONNECTIONS; i++ )
-  {
-    if (  m_app_user_mem_table[i].conn_handle == conn_handle )
-    {
-        m_app_user_mem_table[i].conn_active = 0;
-        err_code = NRF_SUCCESS;
-        break;
-    }
-  }
-
-  return err_code;
-}
-
-uint32_t app_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index)
-{
-  uint32_t err_code = NRF_ERROR_NOT_FOUND;
-  uint32_t i;
-
-  for (i=0; i<SER_MAX_CONNECTIONS; i++ )
-  {
-    if ( (m_app_user_mem_table[i].conn_handle == conn_handle) && (m_app_user_mem_table[i].conn_active == 1) )
-    {
-        *p_index = i;
-        err_code = NRF_SUCCESS;
-        break;
-    }
-  }
-
-  return err_code;
-}

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/serialization/application/codecs/s130/serializers/app_ble_user_mem.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.h
deleted file mode 100644
index c7ab7ca..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/app_ble_user_mem.h
+++ /dev/null
@@ -1,89 +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.
- *
- */
-#ifndef _APP_BLE_USER_MEM_H
-#define _APP_BLE_USER_MEM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
- /**@file
- *
- * @defgroup app_ble_user_mem Functions for managing memory for user memory request in application device.
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    Application auxiliary functions for synchronizing user memory with the one stored in the connectivity device. 
- */
-
-#include "ble.h"
-#include "ser_config.h"
-#include <stdint.h>
-
-/**@brief Connection - user memory mapping structure.
- *
- * @note  This structure is used to map user memory to connection instances, and will be stored in a static table.
- */
-//lint -esym(452,ser_ble_user_mem_t) 
-typedef struct
-{
-  uint16_t               conn_handle;    /**< Connection handle.*/
-  uint8_t                conn_active;    /**< Indication that user memory for this connection is used by soft device. 0: memory used; 1: memory not used*/
-  ble_user_mem_block_t   mem_block;      /**< User memory block structure, see @ref ble_user_mem_block_t.*/
-} ser_ble_user_mem_t;
-
-/**@brief allocates instance in m_user_mem_table[] for storage.
- *
- * @param[in]     conn_handle         conn_handle
- * @param[out]    p_index             pointer to the index of allocated instance
- *
- * @retval NRF_SUCCESS                Context allocated.
- * @retval NRF_ERROR_NO_MEM           No free instance available.
- */
-uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index);
-
-/**@brief release instance identified by a connection handle.
- *
- * @param[in]     conn_handle         conn_handle
- *
- * @retval NRF_SUCCESS                Context released.
- * @retval NRF_ERROR_NOT_FOUND        instance with conn_handle not found
- */
-uint32_t app_ble_user_mem_context_destroy(uint16_t conn_handle);
-
-/**@brief finds index of instance identified by a connection handle in m_user_mem_table[].
- *
- * @param[in]     conn_handle         conn_handle
- *
- * @param[out]    p_index             Pointer to the index of the entry in the context table corresponding to the given conn_handle
- *
- * @retval NRF_SUCCESS                Context found
- * @retval NRF_ERROR_NOT_FOUND        instance with conn_handle not found
- */
-uint32_t app_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index);
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_APP_BLE_USER_MEM_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/serialization/application/codecs/s130/serializers/ble_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_app.h
deleted file mode 100644
index a0f5c29..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_app.h
+++ /dev/null
@@ -1,455 +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.
- *
- */
-#ifndef BLE_APP_H__
-#define BLE_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_app Application command request encoders and command response decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    Application command request encoders and command response decoders.
- */
-#include "ble.h"
-/**
- * @brief Encodes @ref sd_ble_tx_packet_count_get command request.
- *
- * @sa @ref nrf51_tx_packet_count_get_encoding for packet format,
- *     @ref ble_tx_packet_count_get_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle    Connection handle.
- * @param[in] p_count        Pointer to count value to be filled.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_count  will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_tx_packet_count_get_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_tx_packet_count_get_req_enc(uint16_t              conn_handle,
-                                         uint8_t const * const p_count,
-                                         uint8_t * const       p_buf,
-                                         uint32_t * const      p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_tx_packet_count_get command.
- *
- * @sa @ref nrf51_tx_packet_count_get_encoding for packet format,
- *     @ref ble_tx_packet_count_get_req_enc for command request encoder.
- *
- * @param[in] p_buf           Pointer to beginning of command response packet.
- * @param[in] packet_len      Length (in bytes) of response packet.
- * @param[out] pp_count       Pointer to pointer to count value.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_tx_packet_count_get_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         uint8_t * * const     pp_count,
-                                         uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_uuid_encode command request.
- *
- * @sa @ref nrf51_uuid_encode_encoding for packet format,
- *     @ref ble_uuid_encode_rsp_dec for command response decoder.
- *
- * @param[in] p_uuid         Pointer to a @ref ble_uuid_t structure that will be encoded into bytes.
- * @param[in] p_uuid_le_len  Size of \p p_uuid_le if \p p_uuid_le is not NULL
- * @param[in] p_uuid_le      Pointer to a buffer where the little endian raw UUID bytes(2 or 16)
- *                           will be stored. Can be NULL to calculate required size.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_uuid_le_len and \p p_uuid_le will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_uuid_encode_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid,
-                                 uint8_t const * const    p_uuid_le_len,
-                                 uint8_t const * const    p_uuid_le,
-                                 uint8_t * const          p_buf,
-                                 uint32_t * const         p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_uuid_encode command.
- *
- * @sa @ref nrf51_uuid_encode_encoding for packet format,
- *     @ref ble_uuid_encode_req_enc for command request encoder.
- *
- * @param[in] p_buf              Pointer to beginning of command response packet.
- * @param[in] packet_len         Length (in bytes) of response packet.
- * @param[in,out] p_uuid_le_len  \c in: Size (in bytes) of \p p_uuid_le buffer.
- *                               \c out: Length of decoded contents of \p p_uuid_le.
- * @param[out] p_uuid_le         Pointer to a buffer where the encoded UUID will be stored.
- * @param[out] p_result_code     Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Length of \p p_uuid_le is too small to hold decoded
- *                                   value from response.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match expected
- *                                   operation code.
- */
-uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 uint8_t * const       p_uuid_le_len,
-                                 uint8_t * const       p_uuid_le,
-                                 uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_uuid_decode command request.
- *
- * @sa @ref nrf51_uuid_decode_encoding for packet format,
- *     @ref ble_uuid_decode_rsp_dec for command response decoder.
- *
- * @param[in] uuid_le_len  Size of \p p_uuid_le if \p p_uuid_le is not NULL
- * @param[in] p_uuid_le      Pointer to a buffer where the little endian raw UUID bytes(2 or 16)
- *                           is stored.
- * @param[out] p_uuid        Pointer to a @ref ble_uuid_t structure were raw UUID will be decoded.
- * @param[in]  p_buf         Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_uuid will not be updated by the command request encoder.
- *           Updated values are set by @ref ble_uuid_decode_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_uuid_decode_req_enc(uint8_t               uuid_le_len,
-                                 uint8_t const * const p_uuid_le,
-                                 ble_uuid_t * const    p_uuid,
-                                 uint8_t * const       p_buf,
-                                 uint32_t * const      p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_uuid_decode command.
- *
- * @sa @ref nrf51_uuid_decode_encoding for packet format,
- *     @ref ble_uuid_decode_req_enc for command request encoder.
- *
- * @param[in] p_buf              Pointer to beginning of command response packet.
- * @param[in] packet_len         Length (in bytes) of response packet.
- * @param[out] p_uuid         Pointer to a buffer where the decoded UUID will be stored.
- * @param[out] p_result_code     Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match expected
- *                                   operation code.
- */
-uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_uuid_t * * const  p_uuid,
-                                 uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_uuid_vs_add command request.
- *
- * @sa @ref nrf51_uuid_vs_add_encoding for packet format,
- *     @ref ble_uuid_vs_add_rsp_dec for command response decoder.
- *
- * @param[in] p_vs_uuid     Pointer to a @ref ble_uuid128_t structure.
- * @param[in] p_uuid_type   Pointer to uint8_t where UUID type will be returned.
- * @param[in] p_buf         Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
- *                          \c out: Length of encoded command packet.
- *
- * @note  \p p_uuid_type will not be updated by the command request encoder.
- *           Updated values are set by @ref ble_uuid_vs_add_rsp_dec.
- *
- * @retval NRF_SUCCESS              Encoding success.
- * @retval NRF_ERROR_NULL           Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid,
-                                 uint8_t * const             p_uuid_type,
-                                 uint8_t * const             p_buf,
-                                 uint32_t * const            p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_uuid_vs_add command.
- *
- * @sa @ref nrf51_uuid_vs_add_encoding for packet format,
- *     @ref ble_uuid_vs_add_req_enc for command request encoder.
- *
- * @param[in] p_buf          Pointer to beginning of command response packet.
- * @param[in] buf_len     Length (in bytes) of response packet.
- * @param[out] pp_uuid_type  Pointer to a pointer to uint8_t where the decoded UUID type will be stored.
- * @param[out] p_result_code Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match expected
- *                                   operation code.
- */
-uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint8_t * * const     pp_uuid_type,
-                                 uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_version_get command request.
- *
- * @sa @ref nrf51_version_get_encoding for packet format,
- *     @ref ble_version_get_rsp_dec for command response decoder.
- *
- * @param[in] p_version      Pointer to a @ref ble_version_t structure to be filled by the response.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_version_get_req_enc(ble_version_t const * const p_version,
-                                 uint8_t * const             p_buf,
-                                 uint32_t * const            p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_version_get command.
- *
- * @sa @ref nrf51_version_get_encoding for packet format,
- *     @ref ble_version_get_req_enc for command request encoder.
- *
- * @param[in] p_buf        Pointer to beginning of command response packet.
- * @param[in] packet_len   Length (in bytes) of response packet.
- * @param[out] p_version    Pointer to a @ref ble_version_t where decoded version will be stored.
- * @param[out] p_result_code     Command result code.
- *
- * @return NRF_SUCCESS              Version information stored successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Length of \p p_event is too small to
- *                                  hold decoded event.
- */
-uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 ble_version_t *       p_version,
-                                 uint32_t * const      p_result_code);
-
-
-/**@brief Encodes @ref sd_ble_opt_set command request.
- *
- * @sa @ref nrf51_opt_set_encoding for packet format,
- *     @ref ble_opt_set_rsp_dec for command response decoder.
- *
- * @param[in] opt_id         Identifies type of parameter in ble_opt_t union.
- * @param[in] p_opt          Pointer to ble_opt_t union.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Invalid opt id.
- */
-uint32_t ble_opt_set_req_enc(uint32_t const          opt_id,
-                             ble_opt_t const * const p_opt,
-                             uint8_t * const         p_buf,
-                             uint32_t * const        p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_opt_set command.
- *
- * @sa @ref nrf51_opt_set_encoding for packet format,
- *     @ref ble_opt_set_req_enc for command request encoder.
- *
- * @param[in] p_buf              Pointer to beginning of command response packet.
- * @param[in] packet_len         Length (in bytes) of response packet.
- * @param[out] p_result_code     Command result code.
- *
- * @return NRF_SUCCESS              Version information stored successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf,
-                             uint32_t              packet_len,
-                             uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_enable command request.
- *
- * @sa @ref nrf51_enable_encoding for packet format,
- *     @ref ble_enable_rsp_dec for command response decoder.
- *
- * @param[in] p_ble_enable_params       Pointer to a @ref ble_enable_params_t structure.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params,
-                            uint8_t * const       p_buf,
-                            uint32_t * const      p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_enable command.
- *
- * @sa @ref nrf51_enable_encoding for packet format,
- *     @ref ble_enable_req_enc for command request encoder.
- *
- * @param[in] p_buf          Pointer to beginning of command response packet.
- * @param[in] packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code Command result code.
- *
- * @return NRF_SUCCESS              Success.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Length of \p p_event is too small to
- *                                  hold decoded event.
- */
-uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf,
-                            uint32_t              packet_len,
-                            uint32_t * const      p_result_code);
-                             
-/**@brief Encodes @ref sd_ble_opt_get command request.
- *
- * @sa @ref nrf51_opt_get_encoding for packet format,
- *     @ref ble_opt_get_rsp_dec for command response decoder.
- *
- * @param[in] opt_id         Identifies type of parameter in ble_opt_t union.
- * @param[in] p_opt          Pointer to a @ref ble_opt_t union to be filled by the response.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Invalid opt id.
- */
-uint32_t ble_opt_get_req_enc(uint32_t                opt_id,
-                             ble_opt_t const * const p_opt,
-                             uint8_t * const         p_buf,
-                             uint32_t * const        p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_opt_get command.
- *
- * @sa @ref nrf51_opt_get_encoding for packet format,
- *     @ref ble_opt_get_req_enc for command request encoder.
- *
- * @param[in] p_buf        Pointer to beginning of command response packet.
- * @param[in] packet_len   Length (in bytes) of response packet.
- * @param[out] p_opt_id    Pointer to a decoded opt_id
- * @param[out] p_opt       Pointer to a decoded @ref ble_opt_t union
- * @param[out] p_result_code     Command result code.
- *
- * @return NRF_SUCCESS              Opt stored successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Length of \p p_event is too small to
- *                                  hold decoded event.
- * @retval NRF_ERROR_INVALID_PARAM  Invalid opt id.
- */
-
-uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf,
-                             uint32_t              packet_len,
-                             uint32_t      * const p_opt_id,
-                             ble_opt_t     * const p_opt,
-                             uint32_t      * const p_result_code);
-
-/**@brief Encodes @ref sd_ble_user_mem_reply command request.
- *
- * @sa @ref nrf51_user_mem_reply_encoding for packet format,
- *     @ref ble_user_mem_reply_rsp_dec for command response decoder.
- *
- * @param[in] conn_handle    Connection Handle.
- * @param[in] p_block        Pointer to a @ref ble_user_mem_block_t structure.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Invalid opt id.
- */
-uint32_t ble_user_mem_reply_req_enc(uint16_t                     conn_handle,
-                                    ble_user_mem_block_t const * p_block,
-                                    uint8_t * const              p_buf,
-                                    uint32_t * const             p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_user_mem_reply command.
- *
- * @sa @ref nrf51_user_mem_reply_encoding for packet format,
- *     @ref ble_user_mem_reply_req_enc for command request encoder.
- *
- * @param[in] p_buf        Pointer to beginning of command response packet.
- * @param[in] packet_len   Length (in bytes) of response packet.
- * @param[out] p_result_code     Command result code.
- *
- * @return NRF_SUCCESS              Opt stored successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Length of \p p_event is too small to
- *                                  hold decoded event.
- * @retval NRF_ERROR_INVALID_PARAM  Invalid opt id.
- */
-uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t      * const p_result_code);
-
-/**@brief Event decoding dispatcher.
- *
- * The event decoding dispatcher will route the event packet to the correct decoder which in turn
- * decodes the contents of the event and updates the \p p_event struct.
- *
- * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
- *
- * @param[in] p_buf            Pointer to beginning of event packet.
- * @param[in] packet_len       Length (in bytes) of event packet.
- * @param[in,out] p_event      Pointer to a \ref ble_evt_t buffer where the decoded event will be
- *                             stored. If NULL, required length will be returned in \p p_event_len.
- * @param[in,out] p_event_len  \c in: Size (in bytes) of \p p_event buffer.
- *                             \c out: Length of decoded contents of \p p_event.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE       Decoding failure. Length of \p p_event is too small to
- *                                   hold decoded event.
- * @retval NRF_ERROR_NOT_FOUND       Decoding failure. No event decoder is available.
- */
-uint32_t ble_event_dec(uint8_t const * const p_buf,
-                       uint32_t              packet_len,
-                       ble_evt_t * const     p_event,
-                       uint32_t * const      p_event_len);
-
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_enable.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_enable.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_enable.c
deleted file mode 100644
index 0c3aa29..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_enable.c
+++ /dev/null
@@ -1,50 +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.
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "ble_app.h"
-#include "ble_serialization.h"
-#include "ble_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params,
-                            uint8_t * const       p_buf,
-                            uint32_t * const      p_buf_len)
-{
-    uint32_t index    = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_ENABLE;
-    
-    err_code = cond_field_enc(p_ble_enable_params, p_buf, *p_buf_len, &index, ble_enable_params_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf,
-                            uint32_t              packet_len,
-                            uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_ENABLE, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_event.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_event.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_event.c
deleted file mode 100644
index 197e42f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_event.c
+++ /dev/null
@@ -1,262 +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.
- *
- */
-
-#include "ble_app.h"
-#include "ble_evt_app.h"
-#include "ble_gap_evt_app.h"
-#include "ble_gattc_evt_app.h"
-#include "ble_gatts_evt_app.h"
-#include "ble_l2cap_evt_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-uint32_t ble_event_dec(uint8_t const * const p_buf,
-                       uint32_t              packet_len,
-                       ble_evt_t * const     p_event,
-                       uint32_t * const      p_event_len)
-{
-    uint32_t err_code;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_event_len);
-    SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE, packet_len);
-
-
-    const uint16_t  event_id       = uint16_decode(&p_buf[SER_EVT_ID_POS]);
-    const uint8_t * p_sub_buffer   = &p_buf[SER_EVT_HEADER_SIZE];
-    const uint32_t  sub_packet_len = packet_len - SER_EVT_HEADER_SIZE;
-
-    if (p_event)
-    {
-        SER_ASSERT_LENGTH_LEQ(sizeof (ble_evt_hdr_t), *p_event_len);
-        *p_event_len -= sizeof (ble_evt_hdr_t);
-    }
-
-    switch (event_id)
-    {
-        case BLE_EVT_TX_COMPLETE:
-            err_code = ble_evt_tx_complete_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_EVT_USER_MEM_REQUEST:
-            err_code = ble_evt_user_mem_request_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_EVT_USER_MEM_RELEASE:
-            err_code = ble_evt_user_mem_release_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GAP_EVT_PASSKEY_DISPLAY:
-            err_code = ble_gap_evt_passkey_display_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                       p_event_len);
-            break;
-
-        case BLE_GAP_EVT_AUTH_KEY_REQUEST:
-            err_code = ble_gap_evt_auth_key_request_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                        p_event_len);
-            break;
-
-        case BLE_GAP_EVT_CONN_PARAM_UPDATE:
-            err_code = ble_gap_evt_conn_param_update_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                         p_event_len);
-            break;
-
-        case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
-            err_code = ble_gap_evt_conn_param_update_request_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                                 p_event_len);
-            break;
-
-        case BLE_GAP_EVT_CONN_SEC_UPDATE:
-            err_code = ble_gap_evt_conn_sec_update_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                       p_event_len);
-            break;
-
-        case BLE_GAP_EVT_CONNECTED:
-            err_code = ble_gap_evt_connected_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GAP_EVT_DISCONNECTED:
-            err_code = ble_gap_evt_disconnected_dec(p_sub_buffer,
-                                                    sub_packet_len,
-                                                    p_event,
-                                                    p_event_len);
-            break;
-
-        case BLE_GAP_EVT_TIMEOUT:
-            err_code = ble_gap_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GAP_EVT_RSSI_CHANGED:
-            err_code = ble_gap_evt_rssi_changed_dec(p_sub_buffer,
-                                                    sub_packet_len,
-                                                    p_event,
-                                                    p_event_len);
-            break;
-
-        case BLE_GAP_EVT_SEC_INFO_REQUEST:
-            err_code = ble_gap_evt_sec_info_request_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                        p_event_len);
-            break;
-
-        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
-            err_code = ble_gap_evt_sec_params_request_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                          p_event_len);
-            break;
-
-        case BLE_GAP_EVT_AUTH_STATUS:
-            err_code = ble_gap_evt_auth_status_dec(p_sub_buffer,
-                                                   sub_packet_len,
-                                                   p_event,
-                                                   p_event_len);
-            break;
-
-        case BLE_GAP_EVT_SEC_REQUEST:
-            err_code = ble_gap_evt_sec_request_dec(p_sub_buffer,
-                                                   sub_packet_len,
-                                                   p_event,
-                                                   p_event_len);
-            break;
-
-        case BLE_GAP_EVT_KEY_PRESSED:
-            err_code = ble_gap_evt_key_pressed_dec(p_sub_buffer,
-                                                   sub_packet_len,
-                                                   p_event,
-                                                   p_event_len);
-            break;
-
-        case BLE_GAP_EVT_LESC_DHKEY_REQUEST:
-            err_code = ble_gap_evt_lesc_dhkey_request_dec(p_sub_buffer,
-                                                   sub_packet_len,
-                                                   p_event,
-                                                   p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_CHAR_DISC_RSP:
-            err_code = ble_gattc_evt_char_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                       p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP:
-            err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_dec(p_sub_buffer,
-                                                                   sub_packet_len,
-                                                                   p_event,
-                                                                   p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_DESC_DISC_RSP:
-            err_code = ble_gattc_evt_desc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                       p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP:
-            err_code = ble_gattc_evt_prim_srvc_disc_rsp_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                            p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_READ_RSP:
-            err_code = ble_gattc_evt_read_rsp_dec(p_sub_buffer,
-                                                  sub_packet_len,
-                                                  p_event,
-                                                  p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_HVX:
-            err_code = ble_gattc_evt_hvx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_TIMEOUT:
-            err_code = ble_gattc_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_WRITE_RSP:
-            err_code = ble_gattc_evt_write_rsp_dec(p_sub_buffer,
-                                                   sub_packet_len,
-                                                   p_event,
-                                                   p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_CHAR_VALS_READ_RSP:
-            err_code = ble_gattc_evt_char_vals_read_rsp_dec(p_sub_buffer,
-                                                            sub_packet_len,
-                                                            p_event,
-                                                            p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_REL_DISC_RSP:
-            err_code = ble_gattc_evt_rel_disc_rsp_dec(p_sub_buffer,
-                                                      sub_packet_len,
-                                                      p_event,
-                                                      p_event_len);
-            break;
-
-        case BLE_GATTC_EVT_ATTR_INFO_DISC_RSP:
-                    err_code = ble_gattc_evt_attr_info_disc_rsp_dec(p_sub_buffer,
-                                                                    sub_packet_len,
-                                                                    p_event,
-                                                                    p_event_len);
-                    break;
-
-        case BLE_GATTS_EVT_WRITE:
-            err_code = ble_gatts_evt_write_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GATTS_EVT_TIMEOUT:
-            err_code = ble_gatts_evt_timeout_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GATTS_EVT_SC_CONFIRM:
-            err_code = ble_gatts_evt_sc_confirm_dec(p_sub_buffer,
-                                                    sub_packet_len,
-                                                    p_event,
-                                                    p_event_len);
-            break;
-
-        case BLE_GATTS_EVT_HVC:
-            err_code = ble_gatts_evt_hvc_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
-            err_code = ble_gatts_evt_sys_attr_missing_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                          p_event_len);
-            break;
-
-        case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
-            err_code = ble_gatts_evt_rw_authorize_request_dec(p_sub_buffer, sub_packet_len, p_event,
-                                                              p_event_len);
-            break;
-
-        case BLE_L2CAP_EVT_RX:
-            err_code = ble_l2cap_evt_rx_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GAP_EVT_ADV_REPORT:
-            err_code = ble_gap_evt_adv_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-
-        case BLE_GAP_EVT_SCAN_REQ_REPORT:
-            err_code = ble_gap_evt_scan_req_report_dec(p_sub_buffer, sub_packet_len, p_event, p_event_len);
-            break;
-        default:
-            err_code = NRF_ERROR_NOT_FOUND;
-            break;
-    }
-
-    if (p_event != NULL)
-    {
-        p_event->header.evt_id  = (err_code == NRF_SUCCESS) ? event_id : 0;
-        p_event->header.evt_len = (err_code == NRF_SUCCESS) ?
-                                  (uint16_t)*p_event_len : 0;
-    }
-
-    *p_event_len += sizeof(ble_evt_hdr_t);
-    return err_code;
-}


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

Posted by cc...@apache.org.
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/adc/nrf_drv_adc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/adc/nrf_drv_adc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/adc/nrf_drv_adc.h
deleted file mode 100644
index 3639046..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/adc/nrf_drv_adc.h
+++ /dev/null
@@ -1,298 +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_adc.h"
-#include "nrf_drv_config.h"
-#include "sdk_errors.h"
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**
- * @addtogroup nrf_adc ADC HAL and driver
- * @ingroup nrf_drivers
- * @brief Analog-to-digital converter (ADC) APIs.
- * @details The ADC HAL provides basic APIs for accessing the registers of the analog-to-digital converter.
- * The ADC driver provides APIs on a higher level.
- *
- * @defgroup nrf_adc_drv ADC driver
- * @{
- * @ingroup nrf_adc
- * @brief Analog-to-digital converter (ADC) driver.
- */
-
-
-/**
- * @brief Driver event types.
- */
-typedef enum
-{
-    NRF_DRV_ADC_EVT_DONE,    ///< Event generated when the buffer is filled with samples.
-    NRF_DRV_ADC_EVT_SAMPLE,  ///< Event generated when the requested channel is sampled.
-} nrf_drv_adc_evt_type_t;
-
-typedef int16_t nrf_adc_value_t;
-
-/**
- * @brief Analog-to-digital converter driver DONE event.
- */
-typedef struct
-{
-    nrf_adc_value_t *        p_buffer; ///< Pointer to buffer with converted samples.
-    uint16_t                 size;     ///< Number of samples in the buffer.
-} nrf_drv_adc_done_evt_t;
-
-/**
- * @brief Analog-to-digital converter driver SAMPLE event.
- */
-typedef struct
-{
-    nrf_adc_value_t   sample; ///< Converted sample.
-} nrf_drv_adc_sample_evt_t;
-
-/**
- * @brief Analog-to-digital converter driver event.
- */
-typedef struct
-{
-    nrf_drv_adc_evt_type_t type;  ///< Event type.
-    union
-    {
-        nrf_drv_adc_done_evt_t   done;   ///< Data for DONE event.
-        nrf_drv_adc_sample_evt_t sample; ///< Data for SAMPLE event.
-    } data;
-} nrf_drv_adc_evt_t;
-
-/**@brief Macro for initializing the ADC channel with the default configuration. */
-#define NRF_DRV_ADC_DEFAULT_CHANNEL(analog_input)          \
- {{{                                                       \
-    .resolution = NRF_ADC_CONFIG_RES_10BIT,                \
-    .input      = NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE, \
-    .reference  = NRF_ADC_CONFIG_REF_VBG,                  \
-    .ain        = (analog_input)                           \
- }}, NULL}
-
-/**
- * @brief ADC channel configuration.
- *
- * @note The bit fields reflect bit fields in the ADC CONFIG register.
- */
-typedef struct
-{
-    uint32_t resolution        :2; ///< 8-10 bit resolution.
-    uint32_t input             :3; ///< Input selection and scaling.
-    uint32_t reference         :2; ///< Reference source.
-    uint32_t reserved          :1; ///< Unused bit fields.
-    uint32_t ain               :8; ///< Analog input.
-    uint32_t external_reference:2; ///< Eternal reference source.
-}nrf_drv_adc_channel_config_t;
-
-// Forward declaration of the nrf_drv_adc_channel_t type.
-typedef struct nrf_drv_adc_channel_s nrf_drv_adc_channel_t;
-
-/**
- * @brief ADC channel.
- *
- * This structure is defined by the user and used by the driver. Therefore, it should
- * not be defined on the stack as a local variable.
- */
-struct nrf_drv_adc_channel_s
-{
-    union
-    {
-        nrf_drv_adc_channel_config_t config; ///< Channel configuration.
-        uint32_t data;                       ///< Raw value.
-    } config;
-    nrf_drv_adc_channel_t      * p_next;     ///< Pointer to the next enabled channel (for internal use).
-};
-
-/**
- * @brief ADC configuration.
- */
-typedef struct
-{
-    uint8_t interrupt_priority;              ///< Priority of ADC interrupt.
-} nrf_drv_adc_config_t;
-
-/** @brief ADC default configuration. */
-#define NRF_DRV_ADC_DEFAULT_CONFIG                \
-{                                                 \
-    .interrupt_priority = ADC_CONFIG_IRQ_PRIORITY \
-}
-
-/**
- * @brief User event handler prototype.
- *
- * This function is called when the requested number of samples has been processed.
- *
- * @param p_event Event.
- */
-typedef void (*nrf_drv_adc_event_handler_t)(nrf_drv_adc_evt_t const * p_event);
-
-/**
- * @brief Function for initializing the ADC.
- *
- * If a valid event handler is provided, the driver is initialized in non-blocking mode.
- * If event_handler is NULL, the driver works in blocking mode.
- *
- * @param[in] p_config Driver configuration.
- * @param[in] event_handler Event handler provided by the user.
- *
- * @retval    NRF_SUCCESS If initialization was successful.
- * @retval    NRF_ERROR_INVALID_STATE If the driver is already initialized.
- */
-ret_code_t nrf_drv_adc_init(nrf_drv_adc_config_t const * p_config,
-                            nrf_drv_adc_event_handler_t  event_handler);
-
-/**
- * @brief Function for uninitializing the ADC.
- *
- * This function stops all ongoing conversions and disables all channels.
- */
-void nrf_drv_adc_uninit(void);
-
-/**
- * @brief Function for enabling an ADC channel.
- *
- * This function configures and enables the channel. When @ref nrf_drv_adc_buffer_convert is
- * called, all channels that have been enabled with this function are sampled.
- *
- * @note The channel instance variable @p p_channel is used by the driver as an item
- *       in a list. Therefore, it cannot be an automatic variable, and an assertion fails if it is
- *       an automatic variable (if asserts are enabled).
- */
-void nrf_drv_adc_channel_enable(nrf_drv_adc_channel_t * const p_channel);
-
-/**
- * @brief Function for disabling an ADC channel.
- */
-void nrf_drv_adc_channel_disable(nrf_drv_adc_channel_t * const p_channel);
-
-/**
- * @brief Function for starting ADC sampling.
- *
- * This function triggers single ADC sampling. If more than one channel is enabled, the driver
- * emulates scanning and all channels are sampled in the order they were enabled.
- */
-void nrf_drv_adc_sample(void);
-
-/**
- * @brief Function for executing a single ADC conversion.
- *
- * This function selects the desired input and starts a single conversion. If a valid pointer
- * is provided for the result, the function blocks until the conversion is completed. Otherwise, the
- * function returns when the conversion is started, and the result is provided in an event (driver
- * must be initialized in non-blocking mode otherwise an assertion will fail). The function will fail if
- * ADC is busy. The channel does not need to be enabled to perform a single conversion.
- *
- * @param[in]  p_channel Channel.
- * @param[out] p_value   Pointer to the location where the result should be placed. Unless NULL is
- *                       provided, the function is blocking.
- *
- * @retval NRF_SUCCESS    If conversion was successful.
- * @retval NRF_ERROR_BUSY If the ADC driver is busy.
- */
-ret_code_t nrf_drv_adc_sample_convert(nrf_drv_adc_channel_t const * const p_channel,
-                                      nrf_adc_value_t * p_value);
-
-/**
- * @brief Function for converting data to the buffer.
- *
- * If the driver is initialized in non-blocking mode, this function returns when the first conversion
- * is set up. When the buffer is filled, the application is notified by the event handler. If the
- * driver is initialized in blocking mode, the function returns when the buffer is filled.
- *
- * Conversion is done on all enabled channels, but it is not triggered by this
- * function. This function will prepare the ADC for sampling and then
- * wait for the SAMPLE task. Sampling can be triggered manually by the @ref
- * nrf_drv_adc_sample function or by PPI using the @ref NRF_ADC_TASK_START task.
- *
- * @note If more than one channel is enabled, the function emulates scanning, and
- * a single START task will trigger conversion on all enabled channels. For example:
- * If 3 channels are enabled and the user requests 6 samples, the completion event
- * handler will be called after 2 START tasks.
- * @note The application must adjust the sampling frequency. The maximum frequency
- * depends on the sampling timer and the maximum latency of the ADC interrupt. If
- * an interrupt is not handled before the next sampling is triggered, the sample
- * will be lost.
- *
- * @param[in] buffer Result buffer.
- * @param[in] size   Buffer size in samples.
- *
- * @retval NRF_SUCCESS    If conversion was successful.
- * @retval NRF_ERROR_BUSY If the driver is busy.
- */
-ret_code_t nrf_drv_adc_buffer_convert(nrf_adc_value_t * buffer, uint16_t size);
-
-/**
- * @brief Function for retrieving the ADC state.
- *
- * @retval true  If the ADC is busy.
- * @retval false If the ADC is ready.
- */
-bool nrf_drv_adc_is_busy(void);
-
-/**
- * @brief Function for getting the address of the ADC START task.
- *
- * This function is used to get the address of the START task, which can be used to trigger ADC
- * conversion.
- *
- * @return Start task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_adc_start_task_get(void);
-
-/**
- * @brief Function for converting a GPIO pin number to an analog input pin mask to be used in
- *        the ADC channel configuration.
- *
- * @param[in]  pin GPIO pin.
- *
- * @return     Analog input pin mask. The function returns @ref NRF_ADC_CONFIG_INPUT_DISABLED
- *             if the specified pin is not an analog input.
- */
-__STATIC_INLINE nrf_adc_config_input_t nrf_drv_adc_gpio_to_ain(uint32_t pin);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE uint32_t nrf_drv_adc_start_task_get(void)
-{
-    return nrf_adc_task_address_get(NRF_ADC_TASK_START);
-}
-
-__STATIC_INLINE nrf_adc_config_input_t nrf_drv_adc_gpio_to_ain(uint32_t pin)
-{
-    // AIN2 - AIN7
-    if (pin >= 1 && pin <= 6)
-    {
-        return (nrf_adc_config_input_t)(1 << (pin+1));
-    }
-    // AIN0 - AIN1
-    else if (pin >= 26 && pin <= 27)
-    {
-        return (nrf_adc_config_input_t)(1 <<(pin - 26));
-    }
-    else
-    {
-        return NRF_ADC_CONFIG_INPUT_DISABLED;
-    }
-}
-#endif
-
-#ifdef __cplusplus
-}
-#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/drivers_nrf/ble_flash/ble_flash.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ble_flash/ble_flash.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ble_flash/ble_flash.c
deleted file mode 100644
index 12438cc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ble_flash/ble_flash.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/* Copyright (c) 2012 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 "ble_flash.h"
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include "nrf_soc.h"
-#include "nordic_common.h"
-#include "nrf_error.h"
-#include "nrf.h"
-#include "app_util.h"
-
-
-static volatile bool m_radio_active = false;  /**< TRUE if radio is active (or about to become active), FALSE otherwise. */
-
-
-uint16_t ble_flash_crc16_compute(uint8_t * p_data, uint16_t size, uint16_t * p_crc)
-{
-    uint16_t i;
-    uint16_t crc = (p_crc == NULL) ? 0xffff : *p_crc;
-
-    for (i = 0; i < size; i++)
-    {
-        crc  = (unsigned char)(crc >> 8) | (crc << 8);
-        crc ^= p_data[i];
-        crc ^= (unsigned char)(crc & 0xff) >> 4;
-        crc ^= (crc << 8) << 4;
-        crc ^= ((crc & 0xff) << 4) << 1;
-    }
-    return crc;
-}
-
-
-/**@brief Function for erasing a page in flash.
- * 
- * @param[in]  p_page  Pointer to first word in page to be erased.
- */
-static void flash_page_erase(uint32_t * p_page)
-{
-    // Turn on flash erase enable and wait until the NVMC is ready.
-    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos);
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing.
-    }
-
-    // Erase page.
-    NRF_NVMC->ERASEPAGE = (uint32_t)p_page;
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing.
-    }
-
-    // Turn off flash erase enable and wait until the NVMC is ready.
-    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing
-    }
-}
-
-
-/**@brief Function for writing one word to flash. Unprotected write, which can interfere with radio communication.
- *
- * @details This function DOES NOT use the m_radio_active variable, but will force the write even
- *          when the radio is active. To be used only from @ref ble_flash_page_write.
- *
- * @note Flash location to be written must have been erased previously.
- *
- * @param[in]  p_address   Pointer to flash location to be written.
- * @param[in]  value       Value to write to flash.
- */
-static void flash_word_unprotected_write(uint32_t * p_address, uint32_t value)
-{
-    // Turn on flash write enable and wait until the NVMC is ready.
-    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing.
-    }
-    *p_address = value;
-    
-    // Wait flash write to finish
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing.
-    }
-
-    // Turn off flash write enable and wait until the NVMC is ready.
-    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing.
-    }
-}
-
-
-/**@brief Function for writing one word to flash.
- *
- * @note Flash location to be written must have been erased previously.
- *
- * @param[in]  p_address   Pointer to flash location to be written.
- * @param[in]  value       Value to write to flash.
- */
-static void flash_word_write(uint32_t * p_address, uint32_t value)
-{
-    // If radio is active, wait for it to become inactive.
-    while (m_radio_active)
-    {
-        // Do nothing (just wait for radio to become inactive).
-        (void) sd_app_evt_wait();
-    }
-
-    // Turn on flash write enable and wait until the NVMC is ready.
-    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing.
-    }
-
-    *p_address = value;
-    // Wait flash write to finish
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing.
-    }
-    // Turn off flash write enable and wait until the NVMC is ready.
-    NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-        // Do nothing
-    }
-}
-
-
-uint32_t ble_flash_word_write(uint32_t * p_address, uint32_t value)
-{
-    flash_word_write(p_address, value);
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_flash_block_write(uint32_t * p_address, uint32_t * p_in_array, uint16_t word_count)
-{
-    uint16_t i;
-
-    for (i = 0; i < word_count; i++)
-    {
-        flash_word_write(p_address, p_in_array[i]);
-        p_address++;
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_flash_page_erase(uint8_t page_num)
-{
-    uint32_t * p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num);
-    flash_page_erase(p_page);
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_flash_page_write(uint8_t page_num, uint32_t * p_in_array, uint8_t word_count)
-{
-    int        i;
-    uint32_t * p_page;
-    uint32_t * p_curr_addr;
-    uint16_t   in_data_crc;
-    uint16_t   flash_crc;
-    uint32_t   flash_header;
-
-    p_page      = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num);
-    p_curr_addr = p_page;
-
-    // Calculate CRC of the data to write.
-    in_data_crc = ble_flash_crc16_compute((uint8_t *)p_in_array,
-                                          word_count * sizeof(uint32_t),
-                                          NULL);
-
-    // Compare the calculated to the one in flash.
-    flash_header = *p_curr_addr;
-    flash_crc    = (uint16_t)flash_header;
-
-    if (flash_crc == in_data_crc)
-    {
-        // Data is the same as the data already stored in flash, return without modifying flash.
-        return NRF_SUCCESS;
-    }
-
-    // Erase flash page
-    flash_page_erase(p_page);
-
-    // Reserve space for magic number (for detecting if flash content is valid).
-    p_curr_addr++;
-
-    // Reserve space for saving word_count.
-    p_curr_addr++;
-
-    // Write data
-    for (i = 0; i < word_count; i++)
-    {
-        flash_word_unprotected_write(p_curr_addr, p_in_array[i]);
-        p_curr_addr++;
-    }
-
-    // Write number of elements.
-    flash_word_write(p_page + 1, (uint32_t)(word_count));
-
-    // Write magic number and CRC to indicate that flash content is valid.
-    flash_header = BLE_FLASH_MAGIC_NUMBER | (uint32_t)in_data_crc;
-    flash_word_write(p_page, flash_header);
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_flash_page_read(uint8_t page_num, uint32_t * p_out_array, uint8_t * p_word_count)
-{
-    int        byte_count;
-    uint32_t * p_page;
-    uint32_t * p_curr_addr;
-    uint32_t   flash_header;
-    uint32_t   calc_header;
-    uint16_t   calc_crc;
-    uint32_t   tmp;
-
-    p_page      = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num);    
-    p_curr_addr = p_page;
-
-    // Check if block is valid
-    flash_header = *p_curr_addr;
-    tmp = flash_header & 0xFFFF0000;
-    if (tmp != BLE_FLASH_MAGIC_NUMBER)
-    {
-        *p_word_count = 0;
-        return NRF_ERROR_NOT_FOUND;
-    }
-    p_curr_addr++;
-
-    // Read number of elements
-    *p_word_count = (uint8_t)(*(p_curr_addr));
-    p_curr_addr++;
-
-    // Read data
-    byte_count = (*p_word_count) * sizeof(uint32_t);
-    memcpy(p_out_array, p_curr_addr, byte_count);
-
-    // Check CRC
-    calc_crc = ble_flash_crc16_compute((uint8_t *)p_out_array,
-                                       (*p_word_count) * sizeof(uint32_t),
-                                       NULL);
-    calc_header = BLE_FLASH_MAGIC_NUMBER | (uint32_t)calc_crc;
-
-    if (calc_header != flash_header)
-    {
-        return NRF_ERROR_NOT_FOUND;
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_flash_page_addr(uint8_t page_num, uint32_t ** pp_page_addr)
-{
-    *pp_page_addr = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_num);
-    return NRF_SUCCESS;
-}
-
-
-void ble_flash_on_radio_active_evt(bool radio_active)
-{
-    m_radio_active = radio_active;
-}

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/ble_flash/ble_flash.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ble_flash/ble_flash.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ble_flash/ble_flash.h
deleted file mode 100644
index 080ea5a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/ble_flash/ble_flash.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Copyright (c) 2012 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 ble_flash_module Flash Manager
- * @{
- * @ingroup ble_sdk_lib
- * @brief Module for accessing flash memory.
- *
- * @details It contains functions for reading, writing and erasing one page in flash.
- *
- *          The module uses the first 32 bits of the flash page to write a magic number in order to
- *          determine if the page has been written or not.
- *
- * @note Be careful not to use a page number in the SoftDevice area (which currently occupies the
- *       range 0 to 127), or in your application space! In both cases, this would end up
- *       with a hard fault.
- */
-
-#ifndef BLE_FLASH_H__
-#define BLE_FLASH_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BLE_FLASH_PAGE_SIZE     ((uint16_t)NRF_FICR->CODEPAGESIZE)  /**< Size of one flash page. */
-#define BLE_FLASH_MAGIC_NUMBER  0x45DE0000                          /**< Magic value to identify if flash contains valid data. */
-#define BLE_FLASH_EMPTY_MASK    0xFFFFFFFF                          /**< Bit mask that defines an empty address in flash. */
-
-
-/**@brief Macro for getting the end of the flash available for application.
- * 
- * @details    The result flash page number indicates the end boundary of the flash available 
- *             to the application. If a bootloader is used, the end will be the start of the 
- *             bootloader region. Otherwise, the end will be the size of the flash. 
- */
-#define BLE_FLASH_PAGE_END \
-    ((NRF_UICR->NRFFW[0] != BLE_FLASH_EMPTY_MASK) \
-        ? (NRF_UICR->NRFFW[0] / BLE_FLASH_PAGE_SIZE) \
-        : NRF_FICR->CODESIZE)
-
-/**@brief Function for erasing the specified flash page, and then writes the given data to this page.
- *
- * @warning This operation blocks the CPU. DO NOT use while in a connection!
- *
- * @param[in]  page_num     Page number to update.
- * @param[in]  p_in_array   Pointer to a RAM area containing the elements to write in flash.
- *                          This area has to be 32 bits aligned.
- * @param[in]  word_count   Number of 32 bits words to write in flash.
- *
- * @return     NRF_SUCCESS on successful flash write, otherwise an error code.
- */
-uint32_t ble_flash_page_write(uint8_t page_num, uint32_t * p_in_array, uint8_t word_count);
-
-/**@brief Function for reading data from flash to RAM.
- *
- * @param[in]  page_num       Page number to read.
- * @param[out] p_out_array    Pointer to a RAM area where the found data will be written. 
- *                            This area has to be 32 bits aligned.
- * @param[out] p_word_count   Number of 32 bits words read.
- *
- * @return     NRF_SUCCESS on successful upload, NRF_ERROR_NOT_FOUND if no valid data has been found
- *             in flash (first 32 bits not equal to the MAGIC_NUMBER+CRC).
- */
-uint32_t ble_flash_page_read(uint8_t page_num, uint32_t * p_out_array, uint8_t * p_word_count);
-
-/**@brief Function for erasing a flash page.
- *
- * @note This operation blocks the CPU, so it should not be done while the radio is running!
- *
- * @param[in]  page_num   Page number to erase.
- *
- * @return     NRF_SUCCESS on success, an error_code otherwise.
- */
-uint32_t ble_flash_page_erase(uint8_t page_num);
-
-/**@brief Function for writing one word to flash.
- *
- * @note Flash location to be written must have been erased previously.
- *
- * @param[in]  p_address   Pointer to flash location to be written.
- * @param[in]  value       Value to write to flash.
- *
- * @return     NRF_SUCCESS.
- */
-uint32_t ble_flash_word_write(uint32_t * p_address, uint32_t value);
-
-/**@brief Function for writing a data block to flash.
- *
- * @note Flash locations to be written must have been erased previously.
- *
- * @param[in]  p_address    Pointer to start of flash location to be written.
- * @param[in]  p_in_array   Pointer to start of flash block to be written.
- * @param[in]  word_count   Number of words to be written.
- *
- * @return     NRF_SUCCESS.
- */
-uint32_t ble_flash_block_write(uint32_t * p_address, uint32_t * p_in_array, uint16_t word_count);
-
-/**@brief Function for computing pointer to start of specified flash page.
- *
- * @param[in]  page_num       Page number.
- * @param[out] pp_page_addr   Pointer to start of flash page.
- *
- * @return     NRF_SUCCESS.
- */
-uint32_t ble_flash_page_addr(uint8_t page_num, uint32_t ** pp_page_addr);
-
-/**@brief Function for calculating a 16 bit CRC using the CRC-16-CCITT scheme.
- * 
- * @param[in]  p_data   Pointer to data on which the CRC is to be calulated.
- * @param[in]  size     Number of bytes on which the CRC is to be calulated.
- * @param[in]  p_crc    Initial CRC value (if NULL, a preset value is used as the initial value).
- *
- * @return     Calculated CRC.
- */
-uint16_t ble_flash_crc16_compute(uint8_t * p_data, uint16_t size, uint16_t * p_crc);
-
-/**@brief Function for handling flashing module Radio Notification event.
- *
- * @note For flash writing to work safely while in a connection or while advertising, this function
- *       MUST be called from the Radio Notification module's event handler (see
- *       @ref ble_radio_notification for details).
- *
- * @param[in]  radio_active   TRUE if radio is active (or about to become active), FALSE otherwise.
- */
-void ble_flash_on_radio_active_evt(bool radio_active);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BLE_FLASH_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/clock/nrf_drv_clock.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/clock/nrf_drv_clock.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/clock/nrf_drv_clock.c
deleted file mode 100644
index 8545117..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/clock/nrf_drv_clock.c
+++ /dev/null
@@ -1,479 +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_clock.h"
-#include "nrf_error.h"
-#include "nordic_common.h"
-
-#ifdef SOFTDEVICE_PRESENT
-#include "nrf_sdm.h"
-#include "nrf_soc.h"
-#include "app_util_platform.h"
-#else
-#include "app_util_platform.h"
-#endif // SOFTDEVICE_PRESENT
-
-/*lint -save -e652 */
-#define NRF_CLOCK_LFCLK_RC    CLOCK_LFCLKSRC_SRC_RC
-#define NRF_CLOCK_LFCLK_Xtal  CLOCK_LFCLKSRC_SRC_Xtal
-#define NRF_CLOCK_LFCLK_Synth CLOCK_LFCLKSRC_SRC_Synth
-/*lint -restore */
-
-#define INT_MAX 0xFFFFFFFF
-
-#if (CLOCK_CONFIG_LF_SRC == NRF_CLOCK_LFCLK_RC) && !defined(SOFTDEVICE_PRESENT)
-#define CALIBRATION_SUPPORT 1
-#else
-#define CALIBRATION_SUPPORT 0
-#endif
-typedef enum
-{
-    CAL_STATE_IDLE,
-    CAL_STATE_CT,
-    CAL_STATE_HFCLK_REQ,
-    CAL_STATE_CAL,
-    CAL_STATE_ABORT,
-} nrf_drv_clock_cal_state_t;
-
-/**@brief CLOCK control block. */
-typedef struct
-{
-    volatile uint32_t                       hfclk_requests;     /*< High-frequency clock request counter. */
-    volatile nrf_drv_clock_handler_item_t * p_hf_head;
-    bool                                    module_initialized; /*< Indicate the state of module */
-    volatile bool                           hfclk_on;           /*< High-frequency clock state. */
-#ifndef SOFTDEVICE_PRESENT
-    volatile bool                           lfclk_on;           /*< Low-frequency clock state. */
-    uint32_t                                lfclk_requests;     /*< Low-frequency clock request counter. */
-    volatile nrf_drv_clock_handler_item_t * p_lf_head;
-#if CALIBRATION_SUPPORT
-    nrf_drv_clock_handler_item_t            cal_hfclk_started_handler_item;
-    nrf_drv_clock_event_handler_t           cal_done_handler;
-    volatile nrf_drv_clock_cal_state_t      cal_state;
-#endif //CALIBRATION_SUPPORT
-#endif //SOFTDEVICE_PRESENT
-}nrf_drv_clock_cb_t;
-
-static nrf_drv_clock_cb_t m_clock_cb;
-
-#ifndef SOFTDEVICE_PRESENT
-/**@brief Function for starting LFCLK. This function will return immediately without waiting for start.
- */
-static void lfclk_start(void)
-{
-    nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED);
-    nrf_clock_int_enable(NRF_CLOCK_INT_LF_STARTED_MASK);
-    nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART);
-}
-
-/**@brief Function for stopping LFCLK and calibration (if it was set up).
- */
-static void lfclk_stop(void)
-{
-#if CALIBRATION_SUPPORT
-    (void)nrf_drv_clock_calibration_abort();
-#endif //CALIBRATION_SUPPORT
-
-    nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTOP);
-    while (nrf_clock_lf_is_running())
-    {}
-}
-#endif
-static void hfclk_start(void)
-{
-#ifndef SOFTDEVICE_PRESENT
-    nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED);
-    nrf_clock_int_enable(NRF_CLOCK_INT_HF_STARTED_MASK);
-    nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTART);
-#else
-    UNUSED_VARIABLE(sd_clock_hfclk_request());
-#endif
-}
-
-static void hfclk_stop(void)
-{
-#ifndef SOFTDEVICE_PRESENT
-    nrf_clock_task_trigger(NRF_CLOCK_TASK_HFCLKSTOP);
-    while (nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY))
-    {}
-#else
-    UNUSED_VARIABLE(sd_clock_hfclk_release());
-#endif
-}
-
-ret_code_t nrf_drv_clock_init(void)
-{
-    uint32_t result = NRF_SUCCESS;
-
-    if (m_clock_cb.module_initialized)
-    {
-        return MODULE_ALREADY_INITIALIZED;
-    }
-
-    m_clock_cb.p_hf_head      = NULL;
-    m_clock_cb.hfclk_requests = 0;
-#ifndef SOFTDEVICE_PRESENT
-    m_clock_cb.p_lf_head      = NULL;
-    m_clock_cb.lfclk_requests = 0;
-    nrf_clock_xtalfreq_set(CLOCK_CONFIG_XTAL_FREQ);
-    nrf_clock_lf_src_set((nrf_clock_lfclk_t)CLOCK_CONFIG_LF_SRC);
-    nrf_drv_common_irq_enable(POWER_CLOCK_IRQn, CLOCK_CONFIG_IRQ_PRIORITY);
-#if CALIBRATION_SUPPORT
-    m_clock_cb.cal_state = CAL_STATE_IDLE;
-#endif // CALIBRATION_SUPPORT
-#else // SOFTDEVICE_PRESENT
-        uint8_t is_enabled;
-        result = sd_softdevice_is_enabled(&is_enabled);
-        if((result == NRF_SUCCESS) && !is_enabled)
-        {
-            result = NRF_ERROR_SOFTDEVICE_NOT_ENABLED;
-        }
-#endif // SOFTDEVICE_PRESENT
-    m_clock_cb.module_initialized = true;
-    return result;
-}
-
-void nrf_drv_clock_uninit(void)
-{
-    ASSERT(m_clock_cb.module_initialized);
-#ifndef SOFTDEVICE_PRESENT
-    nrf_drv_common_irq_disable(POWER_CLOCK_IRQn);
-    nrf_clock_int_disable(0xFFFFFFFF);
-	lfclk_stop();
-#endif
-    hfclk_stop();
-    m_clock_cb.module_initialized = false;
-}
-
-static void item_enqueue(nrf_drv_clock_handler_item_t ** p_head,
-                         nrf_drv_clock_handler_item_t * p_item)
-{
-    if (*p_head)
-    {
-        p_item->p_next = *p_head;
-        *p_head = p_item;
-    }
-    else
-    {
-        p_item->p_next = NULL;
-        *p_head = p_item;
-    }
-}
-
-static nrf_drv_clock_handler_item_t * item_dequeue(nrf_drv_clock_handler_item_t ** p_head)
-{
-    nrf_drv_clock_handler_item_t * p_item = *p_head;
-    if (p_item)
-    {
-        *p_head = p_item->p_next;
-    }
-
-    return p_item;
-}
-
-void nrf_drv_clock_lfclk_request(nrf_drv_clock_handler_item_t * p_handler_item)
-{
-    ASSERT(m_clock_cb.module_initialized);
-#ifndef SOFTDEVICE_PRESENT
-    ASSERT(m_clock_cb.lfclk_requests != INT_MAX);
-    CRITICAL_REGION_ENTER();
-    if (m_clock_cb.lfclk_on)
-    {
-        if (p_handler_item)
-        {
-            p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED);
-        }
-    }
-    else
-    {
-
-        if (p_handler_item)
-        {
-            item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, p_handler_item);
-        }
-        if (m_clock_cb.lfclk_requests == 0)
-        {
-            lfclk_start();
-        }
-    }
-    m_clock_cb.lfclk_requests++;
-    CRITICAL_REGION_EXIT();
-#else
-    if (p_handler_item)
-    {
-        p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED);
-    }
-#endif // SOFTDEVICE_PRESENT
-}
-
-
-void nrf_drv_clock_lfclk_release(void)
-{
-    ASSERT(m_clock_cb.module_initialized);
-#ifndef SOFTDEVICE_PRESENT
-    ASSERT(m_clock_cb.lfclk_requests > 0);
-
-    CRITICAL_REGION_ENTER();
-    m_clock_cb.lfclk_requests--;
-    if (m_clock_cb.lfclk_requests == 0)
-    {
-        lfclk_stop();
-        m_clock_cb.lfclk_on = false;
-        m_clock_cb.p_lf_head   = NULL;
-    }
-    CRITICAL_REGION_EXIT();
-#endif // SOFTDEVICE_PRESENT
-}
-
-
-bool nrf_drv_clock_lfclk_is_running(void)
-{
-    ASSERT(m_clock_cb.module_initialized);
-    bool result;
-#ifndef SOFTDEVICE_PRESENT
-    result = nrf_clock_lf_is_running();
-#else
-    result = true;
-#endif
-    return result;
-}
-
-void nrf_drv_clock_hfclk_request(nrf_drv_clock_handler_item_t * p_handler_item)
-{
-    ASSERT(m_clock_cb.module_initialized);
-    ASSERT(m_clock_cb.hfclk_requests != INT_MAX);
-
-    CRITICAL_REGION_ENTER();
-    if (m_clock_cb.hfclk_on)
-    {
-        if (p_handler_item)
-        {
-            p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_HFCLK_STARTED);
-        }
-    }
-    else
-    {
-        if (p_handler_item)
-        {
-            item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, p_handler_item);
-        }
-        if (m_clock_cb.hfclk_requests == 0)
-        {
-            hfclk_start();
-        }
-    }
-    m_clock_cb.hfclk_requests++;
-    CRITICAL_REGION_EXIT();
-}
-
-void nrf_drv_clock_hfclk_release(void)
-{
-    ASSERT(m_clock_cb.module_initialized);
-    ASSERT(m_clock_cb.hfclk_requests > 0);
-
-    //disable interrupts CLOCK or SoftDevice events
-    CRITICAL_REGION_ENTER();
-    m_clock_cb.hfclk_requests--;
-    if (m_clock_cb.hfclk_requests == 0)
-    {
-        hfclk_stop();
-        m_clock_cb.hfclk_on = false;
-        m_clock_cb.p_hf_head   = NULL;
-    }
-    CRITICAL_REGION_EXIT();
-    //enable interrupts CLOCK or SoftDevice events
-}
-
-bool nrf_drv_clock_hfclk_is_running(void)
-{
-    bool result;
-    ASSERT(m_clock_cb.module_initialized);
-#ifndef SOFTDEVICE_PRESENT
-    result = nrf_clock_hf_is_running(NRF_CLOCK_HFCLK_HIGH_ACCURACY);
-#else
-    uint32_t is_running;
-    UNUSED_VARIABLE(sd_clock_hfclk_is_running(&is_running));
-    result = is_running ? true : false;
-#endif
-    return result;
-}
-
-#if CALIBRATION_SUPPORT
-static void clock_calibration_hf_started(nrf_drv_clock_evt_type_t event)
-{
-    if (m_clock_cb.cal_state == CAL_STATE_ABORT)
-    {
-        nrf_drv_clock_hfclk_release();
-        m_clock_cb.cal_state = CAL_STATE_IDLE;
-        if (m_clock_cb.cal_done_handler)
-        {
-            m_clock_cb.cal_done_handler(NRF_DRV_CLOCK_EVT_CAL_ABORTED);
-        }
-    }
-    else
-    {
-        nrf_clock_int_enable(NRF_CLOCK_INT_DONE_MASK);
-        m_clock_cb.cal_state = CAL_STATE_CAL;
-        nrf_clock_task_trigger(NRF_CLOCK_TASK_CAL);
-    }
-}
-#endif
-
-ret_code_t nrf_drv_clock_calibration_start(uint8_t interval, nrf_drv_clock_event_handler_t handler)
-{
-#if CALIBRATION_SUPPORT
-    ASSERT(m_clock_cb.cal_state == CAL_STATE_IDLE);
-    ret_code_t ret = NRF_SUCCESS;
-    if (m_clock_cb.lfclk_on == false)
-    {
-        ret = NRF_ERROR_INVALID_STATE;
-    }
-    else if (m_clock_cb.cal_state == CAL_STATE_IDLE)
-    {
-        m_clock_cb.cal_done_handler = handler;
-        m_clock_cb.cal_hfclk_started_handler_item.event_handler = clock_calibration_hf_started;
-        if (interval == 0)
-        {
-            m_clock_cb.cal_state = CAL_STATE_HFCLK_REQ;
-            nrf_drv_clock_hfclk_request(&m_clock_cb.cal_hfclk_started_handler_item);
-        }
-        else
-        {
-            m_clock_cb.cal_state = CAL_STATE_CT;
-            nrf_clock_cal_timer_timeout_set(interval);
-            nrf_clock_int_enable(NRF_CLOCK_INT_CTTO_MASK);
-            nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTART);
-        }
-    }
-    else
-    {
-        ret = NRF_ERROR_BUSY;
-    }
-    return ret;
-#else //CALIBRATION_SUPPORT
-    return NRF_ERROR_FORBIDDEN;
-#endif
-}
-
-
-ret_code_t nrf_drv_clock_calibration_abort(void)
-{
-#if CALIBRATION_SUPPORT
-    CRITICAL_REGION_ENTER();
-    switch(m_clock_cb.cal_state)
-    {
-    case CAL_STATE_CT:
-        nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK);
-        nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTOP);
-        m_clock_cb.cal_state = CAL_STATE_IDLE;
-        if (m_clock_cb.cal_done_handler)
-        {
-            m_clock_cb.cal_done_handler(NRF_DRV_CLOCK_EVT_CAL_ABORTED);
-        }
-        break;
-    case CAL_STATE_HFCLK_REQ:
-        /* fall through. */
-    case CAL_STATE_CAL:
-        m_clock_cb.cal_state = CAL_STATE_ABORT;
-        break;
-    default:
-        break;
-    }
-    CRITICAL_REGION_EXIT();
-    return NRF_SUCCESS;
-#else //CALIBRATION_SUPPORT
-    return NRF_ERROR_FORBIDDEN;
-#endif
-}
-
-ret_code_t nrf_drv_clock_is_calibrating(bool * p_is_calibrating)
-{
-#if CALIBRATION_SUPPORT
-    ASSERT(m_clock_cb.module_initialized);
-    *p_is_calibrating = (m_clock_cb.cal_state != CAL_STATE_IDLE);
-    return NRF_SUCCESS;
-#else //CALIBRATION_SUPPORT
-    return NRF_ERROR_FORBIDDEN;
-#endif
-}
-
-static __INLINE void clock_clk_started_notify(nrf_drv_clock_handler_item_t **p_head,
-                                                nrf_drv_clock_evt_type_t evt_type)
-{
-    while(1)
-    {
-        nrf_drv_clock_handler_item_t * p_item = item_dequeue(p_head);
-        if (p_item)
-        {
-            p_item->event_handler(evt_type);
-        }
-        else
-        {
-            break;
-        }
-    }
-}
-
-#ifndef SOFTDEVICE_PRESENT
-void POWER_CLOCK_IRQHandler(void)
-{
-    if (nrf_clock_event_check(NRF_CLOCK_EVENT_HFCLKSTARTED))
-    {
-        nrf_clock_event_clear(NRF_CLOCK_EVENT_HFCLKSTARTED);
-        nrf_clock_int_disable(NRF_CLOCK_INT_HF_STARTED_MASK);
-        m_clock_cb.hfclk_on = true;
-        clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, NRF_DRV_CLOCK_EVT_HFCLK_STARTED);
-    }
-    if (nrf_clock_event_check(NRF_CLOCK_EVENT_LFCLKSTARTED))
-    {
-        nrf_clock_event_clear(NRF_CLOCK_EVENT_LFCLKSTARTED);
-        nrf_clock_int_disable(NRF_CLOCK_INT_LF_STARTED_MASK);
-        m_clock_cb.lfclk_on = true;
-        clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, NRF_DRV_CLOCK_EVT_LFCLK_STARTED);
-    }
-#if CALIBRATION_SUPPORT
-    if (nrf_clock_event_check(NRF_CLOCK_EVENT_CTTO))
-    {
-        nrf_clock_event_clear(NRF_CLOCK_EVENT_CTTO);
-        nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK);
-        nrf_drv_clock_hfclk_request(&m_clock_cb.cal_hfclk_started_handler_item);
-    }
-
-    if (nrf_clock_event_check(NRF_CLOCK_EVENT_DONE))
-    {
-        nrf_clock_event_clear(NRF_CLOCK_EVENT_DONE);
-        nrf_clock_int_disable(NRF_CLOCK_INT_DONE_MASK);
-
-        nrf_drv_clock_hfclk_release();
-        nrf_drv_clock_evt_type_t evt_type = (m_clock_cb.cal_state == CAL_STATE_ABORT) ?
-                                       NRF_DRV_CLOCK_EVT_CAL_ABORTED : NRF_DRV_CLOCK_EVT_CAL_DONE;
-        m_clock_cb.cal_state = CAL_STATE_IDLE;
-        if (m_clock_cb.cal_done_handler)
-        {
-            m_clock_cb.cal_done_handler(evt_type);
-        }
-    }
-#endif //CALIBRATION_SUPPORT
-}
-#else
-void nrf_drv_clock_on_soc_event(uint32_t evt_id)
-{
-    if (evt_id == NRF_EVT_HFCLKSTARTED)
-    {
-        clock_clk_started_notify((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head, NRF_DRV_CLOCK_EVT_HFCLK_STARTED);
-    }
-}
-#endif // SOFTDEVICE_PRESENT
-
-#undef NRF_CLOCK_LFCLK_RC
-#undef NRF_CLOCK_LFCLK_Xtal
-#undef NRF_CLOCK_LFCLK_Synth

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/clock/nrf_drv_clock.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/clock/nrf_drv_clock.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/clock/nrf_drv_clock.h
deleted file mode 100644
index 78e13d9..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/clock/nrf_drv_clock.h
+++ /dev/null
@@ -1,254 +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.
- *
- */
-
-#ifndef NRF_DRV_CLOCK_H__
-#define NRF_DRV_CLOCK_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "sdk_errors.h"
-#include "nrf_assert.h"
-#include "nrf_clock.h"
-#include "nrf_drv_config.h"
-#include "nrf_drv_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- *
- * @addtogroup nrf_clock Clock HAL and driver
- * @ingroup nrf_drivers
- * @brief Clock APIs.
- * @details The clock HAL provides basic APIs for accessing the registers of the clock. 
- * The clock driver provides APIs on a higher level.
- *
- * @defgroup nrf_clock_drv Clock driver
- * @{
- * @ingroup nrf_clock
- * @brief Driver for managing the low-frequency clock (LFCLK) and the high-frequency clock (HFCLK).
- */
-
-/**
- * @brief Clock events.
- */
-typedef enum
-{
-    NRF_DRV_CLOCK_EVT_HFCLK_STARTED, ///< HFCLK has been started.
-    NRF_DRV_CLOCK_EVT_LFCLK_STARTED, ///< LFCLK has been started.
-    NRF_DRV_CLOCK_EVT_CAL_DONE,      ///< Calibration is done.
-    NRF_DRV_CLOCK_EVT_CAL_ABORTED,   ///< Calibration has been aborted.
-} nrf_drv_clock_evt_type_t;
-
-/**
- * @brief Clock event handler.
- *
- * @param[in] event  Event.
- */
-typedef void (*nrf_drv_clock_event_handler_t)(nrf_drv_clock_evt_type_t event);
-
-// Forward declaration of the nrf_drv_clock_handler_item_t type.
-typedef struct nrf_drv_clock_handler_item_s nrf_drv_clock_handler_item_t;
-
-struct nrf_drv_clock_handler_item_s
-{
-    nrf_drv_clock_handler_item_t * p_next;        ///< A pointer to the next handler that should be called when the clock is started.
-    nrf_drv_clock_event_handler_t  event_handler; ///< Function to be called when the clock is started.
-};
-
-/**
- * @brief Function for initializing the nrf_drv_clock module.
- *
- * After initialization, the module is in power off state (clocks are not requested).
- *
- * @retval     NRF_SUCCESS                        If the procedure was successful.
- * @retval     MODULE_ALREADY_INITIALIZED         If the driver was already initialized.
- * @retval     NRF_ERROR_SOFTDEVICE_NOT_ENABLED   If the SoftDevice was not enabled.
- */
-ret_code_t nrf_drv_clock_init(void);
-
-/**
- * @brief Function for uninitializing the clock module.
- *
- */
-void nrf_drv_clock_uninit(void);
-
-/**
- * @brief Function for requesting the LFCLK. 
- * 
- * The low-frequency clock can be requested by different modules
- * or contexts. The driver ensures that the clock will be started only when it is requested
- * the first time. If the clock is not ready but it was already started, the handler item that is
- * provided as an input parameter is added to the list of handlers that will be notified
- * when the clock is started. If the clock is already enabled, user callback is called from the
- * current context.
- *
- * The first request will start the selected LFCLK source. If an event handler is
- * provided, it will be called once the LFCLK is started. If the LFCLK was already started at this 
- * time, the event handler will be called from the context of this function. Additionally,
- * the @ref nrf_drv_clock_lfclk_is_running function can be polled to check if the clock has started.
- *
- * @note When a SoftDevice is enabled, the LFCLK is always running and the driver cannot control it.
- *
- * @note The handler item provided by the user cannot be an automatic variable.
- *
- * @param[in] p_handler_item A pointer to the event handler structure.
- */
-void nrf_drv_clock_lfclk_request(nrf_drv_clock_handler_item_t * p_handler_item);
-
-/**
- * @brief Function for releasing the LFCLK. 
- *
- * If there are no more requests, the LFCLK source will be stopped.
- *
- * @note When a SoftDevice is enabled, the LFCLK is always running.
- */
-void nrf_drv_clock_lfclk_release(void);
-
-/**
- * @brief Function for checking the LFCLK state.
- *
- * @retval true If the LFCLK is running.
- * @retval false If the LFCLK is not running.
- */
-bool nrf_drv_clock_lfclk_is_running(void);
-
-/**
- * @brief Function for requesting the high-accuracy source HFCLK. 
- *
- * The high-accuracy source 
- * can be requested by different modules or contexts. The driver ensures that the high-accuracy
- * clock will be started only when it is requested the first time. If the clock is not ready
- * but it was already started, the handler item that is provided as an input parameter is added
- * to the list of handlers that will be notified when the clock is started.
- *
- * If an event handler is provided, it will be called once the clock is started. If the clock was already
- * started at this time, the event handler will be called from the context of this function. Additionally,
- * the @ref nrf_drv_clock_hfclk_is_running function can be polled to check if the clock has started.
- *
- * @note If a SoftDevice is running, the clock is managed by the SoftDevice and all requests are handled by
- *       the SoftDevice. This function cannot be called from all interrupt priority levels in that case.
- * @note The handler item provided by the user cannot be an automatic variable.
- *
- * @param[in] p_handler_item A pointer to the event handler structure.
- */
-void nrf_drv_clock_hfclk_request(nrf_drv_clock_handler_item_t * p_handler_item);
-
-/**
- * @brief Function for releasing the high-accuracy source HFCLK. 
- *
- * If there are no more requests, the high-accuracy source will be released.
- */
-void nrf_drv_clock_hfclk_release(void);
-
-/**
- * @brief Function for checking the HFCLK state.
- *
- * @retval true If the HFCLK is running (for \nRFXX XTAL source).
- * @retval false If the HFCLK is not running.
- */
-bool nrf_drv_clock_hfclk_is_running(void);
-
-/**
- * @brief Function for starting a single calibration process.
- *
- * This function can also delay the start of calibration by a user-specified value. The delay will use
- * a low-power timer that is part of the CLOCK module. @ref nrf_drv_clock_is_calibrating can be called to
- * check if calibration is still in progress. If a handler is provided, the user can be notified when
- * calibration is completed. The ext calibration can be started from the handler context.
- *
- * The calibration process consists of three phases:
- * - Delay (optional)
- * - Requesting the high-accuracy HFCLK
- * - Hardware-supported calibration
- *
- * @param[in]  delay   Time after which the calibration will be started (in 0.25 s units).
- * @param[in]  handler NULL or user function to be called when calibration is completed or aborted.
- *
- * @retval     NRF_SUCCESS                        If the procedure was successful.
- * @retval     NRF_ERROR_FORBIDDEN                If a SoftDevice is present or the selected LFCLK source is not an RC oscillator.
- * @retval     NRF_ERROR_INVALID_STATE            If the low-frequency clock is off.
- * @retval     NRF_ERROR_BUSY                     If calibration is in progress.
- */
-ret_code_t nrf_drv_clock_calibration_start(uint8_t delay, nrf_drv_clock_event_handler_t handler);
-
-/**
- * @brief Function for aborting calibration.
- *
- * This function aborts on-going calibration. If calibration was started, it cannot be stopped. If a handler
- * was provided by @ref nrf_drv_clock_calibration_start, this handler will be called once
- * aborted calibration is completed. @ref nrf_drv_clock_is_calibrating can also be used to check
- * if the system is calibrating.
- *
- * @retval     NRF_SUCCESS                        If the procedure was successful.
- * @retval     NRF_ERROR_FORBIDDEN                If a SoftDevice is present or the selected LFCLK source is not an RC oscillator.
- */
-ret_code_t nrf_drv_clock_calibration_abort(void);
-
-/**
- * @brief Function for checking if calibration is in progress. 
- *
- * This function indicates that the system is
- * in calibration if it is in any of the calibration process phases (see @ref nrf_drv_clock_calibration_start).
- *
- * @param[out] p_is_calibrating                   True if calibration is in progress, false if not.
- *
- * @retval     NRF_SUCCESS                        If the procedure was successful.
- * @retval     NRF_ERROR_FORBIDDEN                If a SoftDevice is present or the selected LFCLK source is not an RC oscillator.
- */
-ret_code_t nrf_drv_clock_is_calibrating(bool * p_is_calibrating);
-
-/**@brief Function for returning a requested task address for the clock driver module.
- *
- * @param[in]  task                               One of the peripheral tasks.
- *
- * @return     Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_clock_ppi_task_addr(nrf_clock_task_t task);
-
-/**@brief Function for returning a requested event address for the clock driver module.
- *
- * @param[in]  event                              One of the peripheral events.
- *
- * @return     Event address.
- */
-__STATIC_INLINE uint32_t nrf_drv_clock_ppi_event_addr(nrf_clock_event_t event);
-
-/**
- * @brief Function called by the SoftDevice handler if an @ref nrf_soc event is received from the SoftDevice.
- */
-#ifdef SOFTDEVICE_PRESENT
-void nrf_drv_clock_on_soc_event(uint32_t evt_id);
-#endif
-/**
- *@}
- **/
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-__STATIC_INLINE uint32_t nrf_drv_clock_ppi_task_addr(nrf_clock_task_t task)
-{
-    return nrf_clock_task_address_get(task);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_clock_ppi_event_addr(nrf_clock_event_t event)
-{
-    return nrf_clock_event_address_get(event);
-}
-#endif //SUPPRESS_INLINE_IMPLEMENTATION
-
-/*lint --flb "Leave library region" */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_CLOCK_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/common/nrf_drv_common.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/common/nrf_drv_common.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/common/nrf_drv_common.c
deleted file mode 100644
index eff432d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/common/nrf_drv_common.c
+++ /dev/null
@@ -1,208 +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 <stddef.h>
-#include "nrf_drv_common.h"
-#include "nrf_assert.h"
-#include "app_util_platform.h"
-
-#ifdef SOFTDEVICE_PRESENT
-#include "nrf_soc.h"
-#endif
-
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-typedef struct {
-    nrf_drv_irq_handler_t handler;
-    bool                  acquired;
-} shared_resource_t;
-
-// SPIM0, SPIS0, SPI0, TWIM0, TWIS0, TWI0
-#if (SPI0_ENABLED || SPIS0_ENABLED || TWI0_ENABLED || TWIS0_ENABLED)
-    #define SERIAL_BOX_0_IN_USE
-    // [this checking may need a different form in unit tests, hence macro]
-    #ifndef IS_SERIAL_BOX_0
-        #define IS_SERIAL_BOX_0(p_per_base)  (p_per_base == NRF_SPI0)
-    #endif
-
-    static shared_resource_t m_serial_box_0 = { .acquired = false };
-    void SPI0_TWI0_IRQHandler(void)
-    {
-        ASSERT(m_serial_box_0.handler);
-        m_serial_box_0.handler();
-    }
-#endif // (SPI0_ENABLED || SPIS0_ENABLED || TWI0_ENABLED || TWIS0_ENABLED)
-
-// SPIM1, SPIS1, SPI1, TWIM1, TWIS1, TWI1
-#if (SPI1_ENABLED || SPIS1_ENABLED || TWI1_ENABLED || TWIS1_ENABLED)
-    #define SERIAL_BOX_1_IN_USE
-    // [this checking may need a different form in unit tests, hence macro]
-    #ifndef IS_SERIAL_BOX_1
-        #define IS_SERIAL_BOX_1(p_per_base)  (p_per_base == NRF_SPI1)
-    #endif
-
-    static shared_resource_t m_serial_box_1 = { .acquired = false };
-    void SPI1_TWI1_IRQHandler(void)
-    {
-        ASSERT(m_serial_box_1.handler);
-        m_serial_box_1.handler();
-    }
-#endif // (SPI1_ENABLED || SPIS1_ENABLED || TWI1_ENABLED || TWIS1_ENABLED)
-
-// SPIM2, SPIS2, SPI2
-#if (SPI2_ENABLED || SPIS2_ENABLED)
-    #define SERIAL_BOX_2_IN_USE
-    // [this checking may need a different form in unit tests, hence macro]
-    #ifndef IS_SERIAL_BOX_2
-        #define IS_SERIAL_BOX_2(p_per_base)  (p_per_base == NRF_SPI2)
-    #endif
-
-    static shared_resource_t m_serial_box_2 = { .acquired = false };
-    void SPIM2_SPIS2_SPI2_IRQHandler(void)
-    {
-        ASSERT(m_serial_box_2.handler);
-        m_serial_box_2.handler();
-    }
-#endif // (SPI2_ENABLED || SPIS2_ENABLED)
-
-// COMP, LPCOMP
-#if (COMP_ENABLED || LPCOMP_ENABLED)
-	#define COMP_LPCOMP_IN_USE
-
-	#ifndef IS_COMP_LPCOMP
-		#define IS_COMP_LPCOMP(p_per_base)  ((p_per_base) == NRF_LPCOMP)
-	#endif
-
-    static shared_resource_t m_comp_lpcomp = { .acquired = false };
-    void LPCOMP_IRQHandler(void)
-    {
-    	ASSERT(m_comp_lpcomp.handler);
-    	m_comp_lpcomp.handler();
-    }
-#endif	// (COMP_ENABLED || LPCOMP_ENABLED)
-
-#if defined(SERIAL_BOX_0_IN_USE) || \
-    defined(SERIAL_BOX_1_IN_USE) || \
-    defined(SERIAL_BOX_2_IN_USE) || \
-	defined(COMP_LPCOMP_IN_USE)
-static ret_code_t acquire_shared_resource(shared_resource_t * p_resource,
-                                          nrf_drv_irq_handler_t handler)
-{
-    bool busy = false;
-
-    CRITICAL_REGION_ENTER();
-    if (p_resource->acquired)
-    {
-        busy = true;
-    }
-    else
-    {
-        p_resource->acquired = true;
-    }
-    CRITICAL_REGION_EXIT();
-
-    if (busy)
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    p_resource->handler = handler;
-    return NRF_SUCCESS;
-}
-#endif
-
-ret_code_t nrf_drv_common_per_res_acquire(void const * p_per_base,
-                                          nrf_drv_irq_handler_t handler)
-{
-#ifdef SERIAL_BOX_0_IN_USE
-    if (IS_SERIAL_BOX_0(p_per_base))
-    {
-        return acquire_shared_resource(&m_serial_box_0, handler);
-    }
-#endif
-
-#ifdef SERIAL_BOX_1_IN_USE
-    if (IS_SERIAL_BOX_1(p_per_base))
-    {
-        return acquire_shared_resource(&m_serial_box_1, handler);
-    }
-#endif
-
-#ifdef SERIAL_BOX_2_IN_USE
-    if (IS_SERIAL_BOX_2(p_per_base))
-    {
-        return acquire_shared_resource(&m_serial_box_2, handler);
-    }
-#endif
-
-#ifdef COMP_LPCOMP_IN_USE
-    if (IS_COMP_LPCOMP(p_per_base))
-    {
-    	return acquire_shared_resource(&m_comp_lpcomp, handler);
-    }
-#endif
-
-    return NRF_ERROR_INVALID_PARAM;
-}
-
-void nrf_drv_common_per_res_release(void const * p_per_base)
-{
-#ifdef SERIAL_BOX_0_IN_USE
-    if (IS_SERIAL_BOX_0(p_per_base))
-    {
-        m_serial_box_0.acquired = false;
-    }
-    else
-#endif
-
-#ifdef SERIAL_BOX_1_IN_USE
-    if (IS_SERIAL_BOX_1(p_per_base))
-    {
-        m_serial_box_1.acquired = false;
-    }
-    else
-#endif
-
-#ifdef SERIAL_BOX_2_IN_USE
-    if (IS_SERIAL_BOX_2(p_per_base))
-    {
-        m_serial_box_2.acquired = false;
-    }
-    else
-#endif
-
-#ifdef COMP_LPCOMP_IN_USE
-	if (IS_COMP_LPCOMP(p_per_base))
-    {
-        m_comp_lpcomp.acquired = false;
-    }
-	else
-#endif
-
-    {}
-}
-
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-
-void nrf_drv_common_irq_enable(IRQn_Type IRQn, uint8_t priority)
-{
-
-#ifdef SOFTDEVICE_PRESENT
-    ASSERT((priority == APP_IRQ_PRIORITY_LOW) || (priority == APP_IRQ_PRIORITY_HIGH));
-#endif
-
-    NVIC_SetPriority(IRQn, priority);
-    NVIC_ClearPendingIRQ(IRQn);
-    NVIC_EnableIRQ(IRQn);
-}

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/common/nrf_drv_common.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/common/nrf_drv_common.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/common/nrf_drv_common.h
deleted file mode 100644
index 356ff72..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/common/nrf_drv_common.h
+++ /dev/null
@@ -1,202 +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.
- *
- */
-
-#ifndef NRF_DRV_COMMON_H__
-#define NRF_DRV_COMMON_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "nrf.h"
-#include "sdk_errors.h"
-#include "nrf_drv_config.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Offset of event registers in every peripheral instance
- *
- * This is the offset where event registers start in the every peripheral.
- */
-#define NRF_DRV_COMMON_EVREGS_OFFSET 0x100U
-
-/**
- * @brief Driver state.
- */
-typedef enum 
-{ 
-	NRF_DRV_STATE_UNINITIALIZED, /**< Uninitialized. */
-	NRF_DRV_STATE_INITIALIZED, /**< Initialized but powered off. */
-	NRF_DRV_STATE_POWERED_ON
-} nrf_drv_state_t;
-
-/**
- * @brief Driver power state selection.
- */
-typedef enum
-{
-    NRF_DRV_PWR_CTRL_ON,   /**< Power on request. */
-    NRF_DRV_PWR_CTRL_OFF   /**< Power off request. */
-} nrf_drv_pwr_ctrl_t;
-
-/**
- * @brief IRQ handler type.
- */
-typedef void (*nrf_drv_irq_handler_t)(void);
-
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-/**
- * @brief Function for acquiring shared peripheral resources associated with
- *        the specified peripheral.
- *
- * Certain resources and registers are shared among peripherals that have
- * the same ID (for example: SPI0, SPIM0, SPIS0, TWI0, TWIM0, and TWIS0).
- * Only one of them can be utilized at a given time. This function reserves
- * proper resources to be used by the specified peripheral.
- * If PERIPHERAL_RESOURCE_SHARING_ENABLED is set to a non-zero value, IRQ
- * handlers for peripherals that are sharing resources with others are
- * implemented by the nrf_drv_common module instead of individual drivers.
- * The drivers must then specify their interrupt handling routines and
- * register them by using this function.
- *
- * @param[in] p_per_base Requested peripheral base pointer.
- * @param[in] handler    Interrupt handler to register. May be NULL
- *                       if interrupts are not used for the peripheral.
- *
- * @retval NRF_SUCCESS             If resources were acquired successfully.
- * @retval NRF_ERROR_BUSY          If resources were already acquired.
- * @retval NRF_ERROR_INVALID_PARAM If the specified peripheral is not enabled 
- *                                 or the peripheral does not share resources 
- *                                 with other peripherals.
- */
-ret_code_t nrf_drv_common_per_res_acquire(void const * p_per_base,
-                                          nrf_drv_irq_handler_t handler);
-
-/**
- * @brief Function for releasing shared resources reserved previously by
- *        @ref nrf_drv_common_per_res_acquire() for the specified peripheral.
- *
- * @param[in] p_per_base Requested peripheral base pointer.
- */
-void nrf_drv_common_per_res_release(void const * p_per_base);
-
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-
-/**
- * @brief Function sets priority and enables NVIC interrupt
- *
- * @note Function checks if correct priority is used when softdevice is present
- *
- * @param[in] IRQn     Interrupt id
- * @param[in] priority Interrupt priority
- */
-void nrf_drv_common_irq_enable(IRQn_Type IRQn, uint8_t priority);
-
-/**
- * @brief Function disables NVIC interrupt
- *
- * @param[in] IRQn     Interrupt id
- */
-__STATIC_INLINE void nrf_drv_common_irq_disable(IRQn_Type IRQn);
-
-/**
- * @brief Convert bit position to event code
- *
- * Function for converting the bit position in INTEN register to event code
- * that is equivalent to the offset of the event register from the beginning
- * of peripheral instance.
- *
- * For example the result of this function can be casted directly to
- * the types like @ref nrf_twis_event_t or @ref nrf_rng_events_t...
- *
- * @param bit Bit position in INTEN register
- * @return Event code to be casted to the right enum type or to be used in functions like
- * @ref nrf_rng_event_get
- *
- * @sa nrf_drv_event_to_bitpos
- */
-__STATIC_INLINE uint32_t nrf_drv_bitpos_to_event(uint32_t bit);
-
-/**
- * @brief Convert event code to bit position
- *
- * This function can be used to get bit position in INTEN register from event code.
- *
- * @param event Event code that may be casted from enum values from types like
- * @ref nrf_twis_event_t or @ref nrf_rng_events_t
- * @return Bit position in INTEN register that corresponds to the given code.
- *
- * @sa nrf_drv_bitpos_to_event
- */
-__STATIC_INLINE uint32_t nrf_drv_event_to_bitpos(uint32_t event);
-
-/**
- * @brief Get interrupt number connected with given instance
- *
- * Function returns interrupt number for a given instance of any peripheral.
- * @param[in] pinst Pointer to peripheral registry
- * @return Interrupt number
- */
-__STATIC_INLINE IRQn_Type nrf_drv_get_IRQn(void const * const pinst);
-
-/**
- * @brief Check if given object is in RAM
- *
- * Function for analyzing if given location is placed in RAM.
- * This function is used to determine if we have address that can be supported by EasyDMA.
- * @param[in] ptr Pointer to the object
- * @retval true  Object is located in RAM
- * @retval false Object is not located in RAM
- */
-__STATIC_INLINE bool nrf_drv_is_in_RAM(void const * const ptr);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_drv_common_irq_disable(IRQn_Type IRQn)
-{
-    NVIC_DisableIRQ(IRQn);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_bitpos_to_event(uint32_t bit)
-{
-    return NRF_DRV_COMMON_EVREGS_OFFSET + bit * sizeof(uint32_t);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_event_to_bitpos(uint32_t event)
-{
-    return (event - NRF_DRV_COMMON_EVREGS_OFFSET) / sizeof(uint32_t);
-}
-
-__STATIC_INLINE IRQn_Type nrf_drv_get_IRQn(void const * const pinst)
-{
-    uint8_t ret = (uint8_t)((uint32_t)pinst>>12U);
-    return (IRQn_Type) ret;
-}
-
-__STATIC_INLINE bool nrf_drv_is_in_RAM(void const * const ptr)
-{
-    return ((((uintptr_t)ptr) & 0xE0000000u) == 0x20000000u);
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_COMMON_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/comp/nrf_drv_comp.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/comp/nrf_drv_comp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/comp/nrf_drv_comp.c
deleted file mode 100644
index 26b21d5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/comp/nrf_drv_comp.c
+++ /dev/null
@@ -1,174 +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_comp.h"
-
-#include "nrf_assert.h"
-#include "nrf_error.h"
-#include "nrf_soc.h"
-#include "nrf_drv_common.h"
-#include "app_util_platform.h"
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#define COMP_IRQ			COMP_LPCOMP_IRQn
-#define COMP_IRQ_HANDLER 	COMP_LPCOMP_IRQHandler
-
-static comp_events_handler_t 	m_comp_events_handler = NULL;
-static nrf_drv_state_t        	m_state = NRF_DRV_STATE_UNINITIALIZED;
-
-static const nrf_drv_comp_config_t m_default_config = NRF_DRV_COMP_CONF_DEFAULT_CONFIG(NRF_COMP_INPUT_0);
-
-static void comp_execute_handler(nrf_comp_event_t event, uint32_t event_mask)
-{
-    if ( nrf_comp_event_check(event) && nrf_comp_int_enable_check(event_mask) )
-    {
-        nrf_comp_event_clear(event);
-        
-        m_comp_events_handler(event);
-    }
-}
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    #define IRQ_HANDLER_NAME    irq_handler_for_comp
-    #define IRQ_HANDLER      	static void IRQ_HANDLER_NAME(void)
-
-	IRQ_HANDLER;
-#else
-    #define IRQ_HANDLER void COMP_IRQ_HANDLER(void)
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-IRQ_HANDLER
-{
-    comp_execute_handler(NRF_COMP_EVENT_READY, COMP_INTENSET_READY_Msk);
-    comp_execute_handler(NRF_COMP_EVENT_DOWN, COMP_INTENSET_DOWN_Msk);
-    comp_execute_handler(NRF_COMP_EVENT_UP, COMP_INTENSET_UP_Msk);
-    comp_execute_handler(NRF_COMP_EVENT_CROSS, COMP_INTENSET_CROSS_Msk);
-}
-
-
-ret_code_t nrf_drv_comp_init(const nrf_drv_comp_config_t * p_config,
-                               comp_events_handler_t   event_handler)
-{
-    if (m_state != NRF_DRV_STATE_UNINITIALIZED)
-    { // COMP driver is already initialized
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config;
-    }
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    if (nrf_drv_common_per_res_acquire(NRF_COMP, IRQ_HANDLER_NAME) != NRF_SUCCESS)
-    {
-        return NRF_ERROR_BUSY;
-    }
-#endif
-
-    nrf_comp_task_trigger(NRF_COMP_TASK_STOP);
-    nrf_comp_enable();
-    
-    // Clear events to be sure there are no leftovers.
-    nrf_comp_event_clear(NRF_COMP_EVENT_READY);
-    nrf_comp_event_clear(NRF_COMP_EVENT_DOWN);
-    nrf_comp_event_clear(NRF_COMP_EVENT_UP);
-    nrf_comp_event_clear(NRF_COMP_EVENT_CROSS);
-    
-    nrf_comp_ref_set(p_config->reference);
-    
-    //If external source is chosen, write to appropriate register.
-    if (p_config->reference == COMP_REFSEL_REFSEL_ARef)
-    {
-        nrf_comp_ext_ref_set(p_config->ext_ref);
-    }
-    
-    nrf_comp_th_set(p_config->threshold);
-    nrf_comp_main_mode_set(p_config->main_mode);
-    nrf_comp_speed_mode_set(p_config->speed_mode);
-    nrf_comp_hysteresis_set(p_config->hyst);
-    nrf_comp_isource_set(p_config->isource);
-    nrf_comp_shorts_disable(NRF_DRV_COMP_SHORT_STOP_AFTER_CROSS_EVT | NRF_DRV_COMP_SHORT_STOP_AFTER_UP_EVT |
-    						NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT);
-    nrf_comp_int_disable(COMP_INTENCLR_CROSS_Msk | COMP_INTENCLR_UP_Msk |
-                           COMP_INTENCLR_DOWN_Msk | COMP_INTENCLR_READY_Msk);
-
-    if (event_handler)
-    {
-        m_comp_events_handler = event_handler;
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    nrf_comp_input_select(p_config->input);
-
-    nrf_drv_common_irq_enable(COMP_LPCOMP_IRQn, p_config->interrupt_priority);
-
-    m_state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_comp_uninit(void)
-{
-    ASSERT(m_state != NRF_DRV_STATE_UNINITIALIZED);
-    nrf_drv_common_irq_disable(COMP_LPCOMP_IRQn);
-    nrf_comp_disable();
-    m_state = NRF_DRV_STATE_UNINITIALIZED;
-    m_comp_events_handler = NULL;
-}
-
-void nrf_drv_comp_pin_select(nrf_comp_input_t psel)
-{
-    bool comp_enable_state = nrf_comp_enable_check();
-    nrf_comp_task_trigger(NRF_COMP_TASK_STOP);
-    if(m_state == NRF_DRV_STATE_POWERED_ON)
-    {
-    	m_state = NRF_DRV_STATE_INITIALIZED;
-    }
-    nrf_comp_disable();
-    nrf_comp_input_select(psel);
-    if(comp_enable_state == true)
-    {
-    	nrf_comp_enable();
-    }
-}
-
-void nrf_drv_comp_start(uint32_t comp_int_mask, uint32_t comp_shorts_mask)
-{
-    ASSERT(m_state == NRF_DRV_STATE_INITIALIZED);
-    nrf_comp_int_enable(comp_int_mask);
-    nrf_comp_shorts_enable(comp_shorts_mask);
-    nrf_comp_task_trigger(NRF_COMP_TASK_START);
-    m_state = NRF_DRV_STATE_POWERED_ON;
-}
-
-void nrf_drv_comp_stop(void)
-{
-    ASSERT(m_state == NRF_DRV_STATE_POWERED_ON);
-    nrf_comp_shorts_disable(UINT32_MAX);
-    nrf_comp_int_disable(UINT32_MAX);
-    nrf_comp_task_trigger(NRF_COMP_TASK_STOP);
-    m_state = NRF_DRV_STATE_INITIALIZED;
-}
-
-uint32_t nrf_drv_comp_sample()
-{
-    ASSERT(m_state == NRF_DRV_STATE_POWERED_ON);
-    nrf_comp_task_trigger(NRF_COMP_TASK_SAMPLE);
-    return nrf_comp_result_get();
-}

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/comp/nrf_drv_comp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/comp/nrf_drv_comp.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/comp/nrf_drv_comp.h
deleted file mode 100644
index b1d8d49..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/comp/nrf_drv_comp.h
+++ /dev/null
@@ -1,276 +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.
- *
- */
-
-#ifndef NRF_DRV_COMP_H__
-#define NRF_DRV_COMP_H__
-
-#include "nrf_comp.h"
-#include "sdk_errors.h"
-#include "nrf_drv_common.h"
-#include "nrf_drv_config.h"
-#include "app_util_platform.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup nrf_comp COMP HAL and driver
- * @ingroup nrf_drivers
- * @brief @tagAPI52 Comparator (COMP) APIs.
- * @details The COMP HAL provides basic APIs for accessing the registers of Comparator. 
- * The COMP driver provides APIs on a higher level.
- *
- * @defgroup nrf_drivers_comp COMP driver
- * @{
- * @ingroup nrf_comp
- * @brief @tagAPI52 Comparator (COMP) driver. 
- */
-
-/**
- * @brief Macro to convert the threshold voltage to an integer value (needed by the COMP_TH register).
- *
- * @param[in] vol 			Voltage to be changed to COMP_TH register value. This value must not be smaller than
- * 							reference voltage divided by 64.
- * @param[in] ref 			Reference voltage.
- */
-#define VOLTAGE_THRESHOLD_TO_INT(vol, ref) (uint8_t)(((vol) > ((ref)/64)) ? (ROUNDED_DIV((vol)*64,(ref))-1) : 0)
-
-/**@brief COMP event handler function type.
- * @param[in] event  COMP event.
- */
-typedef void (* comp_events_handler_t)(nrf_comp_event_t event);
-
-/**
- * @enum nrf_drv_comp_short_mask_t
- * @brief COMP shortcut masks.
- */
-typedef enum
-{
-	NRF_DRV_COMP_SHORT_STOP_AFTER_CROSS_EVT = COMP_SHORTS_CROSS_STOP_Msk, 		/*!< Shortcut between the CROSS event and the STOP task. */
-	NRF_DRV_COMP_SHORT_STOP_AFTER_UP_EVT = COMP_SHORTS_UP_STOP_Msk, 			/*!< Shortcut between the UP event and the STOP task. */
-	NRF_DRV_COMP_SHORT_STOP_AFTER_DOWN_EVT = COMP_SHORTS_DOWN_STOP_Msk   		/*!< Shortcut between the DOWN event and the STOP task. */
-}nrf_drv_comp_short_mask_t;
-
-/**
- * @enum nrf_drv_comp_evt_en_mask_t
- * @brief COMP events masks.
- */
-typedef enum
-{
-	NRF_DRV_COMP_EVT_EN_CROSS_MASK = COMP_INTENSET_CROSS_Msk,				/*!< CROSS event (generated after VIN+ == VIN-). */
-	NRF_DRV_COMP_EVT_EN_UP_MASK = COMP_INTENSET_UP_Msk,						/*!< UP event (generated when VIN+ crosses VIN- while increasing). */
-	NRF_DRV_COMP_EVT_EN_DOWN_MASK = COMP_INTENSET_DOWN_Msk,					/*!< DOWN event (generated when VIN+ crosses VIN- while decreasing). */
-	NRF_DRV_COMP_EVT_EN_READY_MASK = COMP_INTENSET_READY_Msk				/*!< READY event (generated when the module is ready). */
-}nrf_drv_comp_evt_en_mask_t;
-
-/**@brief COMP configuration.
- */
-typedef struct
-{
-	nrf_comp_ref_t		    reference;	        /**< Reference selection. */
-	nrf_comp_ext_ref_t      ext_ref;            /**< External analog reference selection. */
-	nrf_comp_main_mode_t	main_mode;			/**< Main operation mode. */
-	nrf_comp_th_t			threshold;			/**< Structure holding THDOWN and THUP values needed by the COMP_TH register. */
-	nrf_comp_sp_mode_t		speed_mode;			/**< Speed and power mode. */
-	nrf_comp_hyst_t			hyst;				/**< Comparator hysteresis.*/
-	nrf_isource_t			isource;			/**< Current source selected on analog input. */
-    nrf_comp_input_t     	input;              /**< Input to be monitored. */
-    uint8_t              	interrupt_priority; /**< Interrupt priority. */
-} nrf_drv_comp_config_t;
-
-/** @brief COMP threshold default configuration. */
-#define COMP_CONFIG_TH	                            \
-{							                        \
-	.th_down = VOLTAGE_THRESHOLD_TO_INT(0.5, 1.8), 	    \
-	.th_up = VOLTAGE_THRESHOLD_TO_INT(1.5, 1.8) 		\
-}
-
-/** @brief COMP driver default configuration including the COMP HAL configuration. */
-#define NRF_DRV_COMP_CONF_DEFAULT_CONFIG(INPUT)       							\
-    {                                                                              	\
-        .reference          = COMP_CONFIG_REF,                                      \
-        .main_mode          = COMP_CONFIG_MAIN_MODE,                                \
-        .threshold          = COMP_CONFIG_TH,                                       \
-        .speed_mode         = COMP_CONFIG_SPEED_MODE,                               \
-        .hyst               = COMP_CONFIG_HYST,                                     \
-        .isource            = COMP_CONFIG_ISOURCE,                                  \
-        .input              = INPUT,                            	    			\
-        .interrupt_priority = COMP_CONFIG_IRQ_PRIORITY                           	\
-    }
-
-/**
- * @brief Function for initializing the COMP driver.
- * 
- * This function initializes the COMP driver, but does not enable the peripheral or any interrupts. 
- * To start the driver, call the function @ref nrf_drv_comp_start() after initialization.
- *
- * If no configuration structure is provided, the driver is initialized with the default settings.
- *
- * @param[in] p_config              Initial configuration. If NULL, the default configuration is used.
- * @param[in] event_handler         Handler function.
- *
- * @retval NRF_ERROR_INVALID_PARAM 	If the configuration is invalid.
- * @retval NRF_ERROR_INVALID_STATE 	If the driver has already been initialized.
- * @retval NRF_ERROR_BUSY 			If the LPCOMP driver is initialized.
- */
-ret_code_t nrf_drv_comp_init(const nrf_drv_comp_config_t * p_config,
-                               comp_events_handler_t   event_handler);
-
-
-/**
- *  @brief Function for uninitializing the COMP driver.
- *
- *  This function uninitializes the COMP driver. The COMP peripheral and 
- *  its interrupts are disabled, and local variables are cleaned. After this call, you must
- *  initialize the driver again by calling nrf_drv_comp_init() if you want to use it.
- *
- *  @sa nrf_drv_comp_stop()
- */
-void     nrf_drv_comp_uninit(void);
-
-/**
- * @brief Function for setting the analog input.
- *
- * @param[in] psel              COMP analog pin selection.
- */
-void nrf_drv_comp_pin_select(nrf_comp_input_t psel);
-    
-/**
- * @brief Function for starting the COMP peripheral and interrupts.
- *
- * Before calling this function, the driver must be initialized. This function
- * enables the COMP peripheral and its interrupts.
- *
- * @param[in] comp_evt_en_mask			Mask of events to be enabled. This parameter should be built as
- * 										'or' of elements from @ref nrf_drv_comp_evt_en_mask_t.
- * @param[in] comp_shorts_mask			Mask of shorts to be enabled. This parameter should be built as
- * 										'or' of elements from @ref nrf_drv_comp_short_mask_t.
- *
- * @sa nrf_drv_comp_init()
- *
- */
-void nrf_drv_comp_start(uint32_t comp_evt_en_mask, uint32_t comp_shorts_mask);
-
-/**@brief Function for stopping the COMP peripheral.
- *
- * Before calling this function, the driver must be enabled. This function disables the COMP
- * peripheral and its interrupts.
- *
- * @sa nrf_drv_comp_uninit()
- *
- */
-void nrf_drv_comp_stop(void);
-
-/**
- * @brief Function for copying the current state of the comparator result to the RESULT register.
- *
- * @retval 0 If the input voltage is below the threshold (VIN+ < VIN-). 
- * @retval 1 If the input voltage is above the threshold (VIN+ > VIN-).
- */
-uint32_t nrf_drv_comp_sample(void);
-
-/**
- * @brief Function for getting the task address.
- *
- * Before calling this function, the driver must be enabled.
- *
- * @param[in] comp_task					COMP task.
- *
- * @return Address of the given COMP task.
- */
-__STATIC_INLINE uint32_t nrf_drv_comp_task_address_get(nrf_comp_task_t comp_task)
-{
-    return (uint32_t)nrf_comp_task_address_get(comp_task);
-}
-
-/**
- * @brief Function for getting the event address.
- *
- * @param[in] comp_event				COMP event.
- *
- * @return Address of the given COMP event.
- */
-__STATIC_INLINE uint32_t nrf_drv_comp_event_address_get(nrf_comp_event_t comp_event)
-{
-    return (uint32_t)nrf_comp_event_address_get(comp_event);
-}
-
-/**
- * @brief Function for converting a GPIO pin number to an analog COMP channel.
- *
- * @param[in]  pin						GPIO pin number.
- *
- * @return     COMP channel. The function returns UINT8_MAX
- *             if the specified pin is not an analog input.
- */
-__STATIC_INLINE nrf_comp_input_t nrf_drv_comp_gpio_to_ain(uint8_t pin);
-
-/**
- * @brief Function for converting a COMP channel to a GPIO pin number.
- *
- * @param[in]  ain						COMP channel.
- *
- * @return     GPIO pin number. The function returns UINT8_MAX
- *             if the specified channel is not a GPIO pin.
- */
-__STATIC_INLINE uint8_t nrf_drv_comp_ain_to_gpio(nrf_comp_input_t ain);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE nrf_comp_input_t nrf_drv_comp_gpio_to_ain(uint8_t pin)
-{
-    // AIN0 - AIN3
-    if ((pin >= 2) && (pin <= 5))
-    {
-        return (nrf_comp_input_t)(pin-2);
-    }
-    // AIN4 - AIN7
-    else if ((pin >= 28) && (pin <= 31))
-    {
-        return (nrf_comp_input_t)(pin - 24);
-    }
-    else
-    {
-        return (nrf_comp_input_t)UINT8_MAX;
-    }
-}
-
-__STATIC_INLINE uint8_t nrf_drv_comp_ain_to_gpio(nrf_comp_input_t ain)
-{
-    // AIN0 - AIN3
-    if (ain <= 3)
-    {
-        return (uint8_t)(ain + 2);
-    }
-    // AIN4 - AIN7
-    else if ((ain >= 4) && (ain <= 7))
-    {
-        return (uint8_t)(ain + 24);
-    }
-    else
-    {
-        return UINT8_MAX;
-    }
-}
-
-#endif //SUPPRESS_INLINE_IMPLEMENTATION
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
- #endif /* NRF_DRV_COMP_H__ */


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

Posted by cc...@apache.org.
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/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c
deleted file mode 100644
index 5fb78f6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.c
+++ /dev/null
@@ -1,1495 +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.
- *
- */
-
-#include "ble_gap_struct_serialization.h"
-#include "ble_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-#include "string.h"
-
-uint32_t ble_gap_irk_enc(void const * const p_data,
-                         uint8_t * const    p_buf,
-                         uint32_t           buf_len,
-                         uint32_t * const   p_index)
-{
-    ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data;
-
-    SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index);
-
-    memcpy(&p_buf[*p_index], p_gap_irk->irk, BLE_GAP_SEC_KEY_LEN);
-
-    *p_index += BLE_GAP_SEC_KEY_LEN;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_irk_dec(uint8_t const * const p_buf,
-                         uint32_t              buf_len,
-                         uint32_t * const      p_index,
-                         void * const          p_data)
-{
-    ble_gap_irk_t * p_gap_irk = (ble_gap_irk_t *)p_data;
-
-    SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index);
-
-    memcpy(p_gap_irk->irk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN);
-
-    *p_index += BLE_GAP_SEC_KEY_LEN;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_addr_enc(void const * const p_data,
-                          uint8_t * const    p_buf,
-                          uint32_t           buf_len,
-                          uint32_t * const   p_index)
-{
-    ble_gap_addr_t * p_addr = (ble_gap_addr_t *)p_data;
-
-    SER_ASSERT_LENGTH_LEQ(1 + BLE_GAP_ADDR_LEN, buf_len - *p_index);
-
-    p_buf[*p_index] = p_addr->addr_type;
-    (*p_index)++;
-    memcpy(&p_buf[*p_index], p_addr->addr, BLE_GAP_ADDR_LEN);
-    *p_index += BLE_GAP_ADDR_LEN;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_addr_dec(uint8_t const * const p_buf,
-                          uint32_t              buf_len,
-                          uint32_t * const      p_index,
-                          void * const          p_addr)
-{
-    ble_gap_addr_t * p_address = (ble_gap_addr_t *) p_addr;
-
-    SER_ASSERT_LENGTH_LEQ(1 + BLE_GAP_ADDR_LEN, (int32_t)buf_len - *p_index);
-
-    p_address->addr_type = p_buf[*p_index];
-    (*p_index)++;
-    memcpy(p_address->addr, &p_buf[*p_index], BLE_GAP_ADDR_LEN);
-    *p_index += BLE_GAP_ADDR_LEN;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_sec_levels_enc(void const * const p_data,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index)
-{
-    ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-
-    p_buf[*p_index] = (p_sec_levels->lv1 << 0) | (p_sec_levels->lv2 << 1) |
-                      (p_sec_levels->lv3 << 2) | (p_sec_levels->lv4 << 3);
-    (*p_index)++;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                void * const          p_data)
-{
-    ble_gap_sec_levels_t * p_sec_levels = (ble_gap_sec_levels_t *)p_data;
-    uint32_t err_code;
-    uint32_t uint8_temp;
-
-    SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sec_levels_t), buf_len - *p_index);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(uint8_temp));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p_sec_levels->lv1 = uint8_temp & 0x01;
-    p_sec_levels->lv2 = (uint8_temp >> 1) & 0x01;
-    p_sec_levels->lv3 = (uint8_temp >> 2) & 0x01;
-    p_sec_levels->lv4 = (uint8_temp >> 3) & 0x01;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_sec_keys_enc(void const * const p_data,
-                              uint8_t * const    p_buf,
-                              uint32_t           buf_len,
-                              uint32_t * const   p_index)
-{
-    ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = cond_field_enc(p_sec_keys->p_enc_key, p_buf, buf_len, p_index, ble_gap_enc_key_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_sec_keys->p_id_key, p_buf, buf_len, p_index, ble_gap_id_key_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_sec_keys->p_sign_key, p_buf, buf_len, p_index, ble_gap_sign_info_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_sec_keys->p_pk, p_buf, buf_len, p_index, ble_gap_lesc_p256_pk_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf,
-                              uint32_t              buf_len,
-                              uint32_t * const      p_index,
-                              void * const          p_data)
-{
-    ble_gap_sec_keys_t * p_sec_keys = (ble_gap_sec_keys_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_enc_key), ble_gap_enc_key_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_id_key), ble_gap_id_key_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_sign_key), ble_gap_sign_info_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void * *)&(p_sec_keys->p_pk), ble_gap_lesc_p256_pk_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_enc_info_enc(void const * const p_data,
-                              uint8_t * const    p_buf,
-                              uint32_t           buf_len,
-                              uint32_t * const   p_index)
-{
-    uint32_t             err_code = NRF_SUCCESS;
-    ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_data;
-
-    SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN + 1, buf_len - *p_index);
-
-    memcpy(&p_buf[*p_index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN);
-    *p_index += BLE_GAP_SEC_KEY_LEN;
-
-    uint8_t data = (p_enc_info->lesc & 0x01)       |
-                   ((p_enc_info->auth & 0x01) << 1)|
-                   ((p_enc_info->ltk_len & 0x3F) << 2);
-    p_buf[*p_index]  = data;
-    (*p_index)++;
-
-    return err_code;
-}
-
-uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf,
-                              uint32_t              buf_len,
-                              uint32_t * const      p_index,
-                               void * const          p_enc_infox)
-{
-    ble_gap_enc_info_t * p_enc_info = (ble_gap_enc_info_t *)p_enc_infox;
-
-    SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_KEY_LEN, buf_len - *p_index);
-    memcpy(p_enc_info->ltk, &p_buf[*p_index], BLE_GAP_SEC_KEY_LEN);
-    *p_index += BLE_GAP_SEC_KEY_LEN;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    p_enc_info->lesc    = p_buf[*p_index] & 0x01;
-    p_enc_info->auth    = (p_buf[*p_index]>>1) & 0x01;
-    p_enc_info->ltk_len = (p_buf[*p_index] >> 2) & 0x3F;
-    *p_index            += 1;
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_sign_info_enc(void const * const p_sign_info,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_sign_info, sizeof (ble_gap_sign_info_t));
-    *p_index += sizeof (ble_gap_sign_info_t);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_sign_info)
-{
-    SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_sign_info_t), buf_len - *p_index);
-    memcpy(p_sign_info, &p_buf[*p_index], sizeof (ble_gap_sign_info_t));
-    *p_index += sizeof (ble_gap_sign_info_t);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index)
-{
-    uint32_t err_code = NRF_SUCCESS;
-    uint8_t  byte;
-
-    ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data;
-
-    SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index);
-
-    err_code = uint8_t_enc(&(p_auth_status->auth_status), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    byte = (p_auth_status->error_src) | ((p_auth_status->bonded) << 2);
-
-    err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm1_levels), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_levels_enc(&(p_auth_status->sm2_levels), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_own), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_enc(&(p_auth_status->kdist_peer), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_data)
-{
-
-    ble_gap_evt_auth_status_t * p_auth_status = (ble_gap_evt_auth_status_t *)p_data;
-    uint32_t                    err_code;
-    uint8_t                     byte;
-
-    SER_ASSERT_LENGTH_LEQ(6, buf_len - *p_index);
-    SER_ASSERT_NOT_NULL(p_auth_status);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_auth_status->auth_status));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_auth_status->error_src = byte & 0x03;
-    p_auth_status->bonded =  (byte >> 2) & 0x01 ;
-
-    err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm1_levels));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_levels_dec(p_buf, buf_len, p_index, &(p_auth_status->sm2_levels));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_own));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, &(p_auth_status->kdist_peer));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode;
-    uint32_t                  err_code   = NRF_SUCCESS;
-    uint8_t                   sm = p_sec_mode->sm & 0x0F;
-    uint8_t                   temp8      = sm | ((p_sec_mode->lv & 0x0F) << 4);
-
-    err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_sec_mode)
-{
-    ble_gap_conn_sec_mode_t * p_sec_mode = (ble_gap_conn_sec_mode_t *)p_void_sec_mode;
-    uint32_t                  err_code   = NRF_SUCCESS;
-    uint8_t                   temp8;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    uint8_dec(p_buf, buf_len, p_index, &temp8);
-
-    p_sec_mode->sm = temp8;
-    p_sec_mode->lv = temp8 >> 4;
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update,
-                                           uint8_t * const    p_buf,
-                                           uint32_t           buf_len,
-                                           uint32_t * const   p_index)
-{
-    return ble_gap_conn_sec_t_enc(p_void_conn_sec_update, p_buf, buf_len, p_index);
-}
-
-uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf,
-                                           uint32_t              buf_len,
-                                           uint32_t * const      p_index,
-                                           void * const          p_void_conn_sec_update)
-{
-    return ble_gap_conn_sec_t_dec(p_buf, buf_len, p_index, p_void_conn_sec_update);
-}
-
-uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index)
-{
-    ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec;
-    uint32_t             err_code   = NRF_SUCCESS;
-
-    err_code = ble_gap_conn_sec_mode_enc(&p_conn_sec->sec_mode, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_conn_sec->encr_key_size, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                void * const          p_void_sec)
-{
-    ble_gap_conn_sec_t * p_conn_sec = (ble_gap_conn_sec_t *)p_void_sec;
-    uint32_t             err_code   = NRF_SUCCESS;
-
-    err_code = ble_gap_conn_sec_mode_dec(p_buf, buf_len, p_index, &p_conn_sec->sec_mode);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    uint8_dec(p_buf, buf_len, p_index, &p_conn_sec->encr_key_size);
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request,
-                                            uint8_t * const    p_buf,
-                                            uint32_t           buf_len,
-                                            uint32_t * const   p_index)
-{
-    ble_gap_evt_sec_info_request_t * p_conn_sec =
-    (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request;
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ble_gap_addr_enc(&p_conn_sec->peer_addr, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_master_id_t_enc(&p_conn_sec->master_id, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint8_t temp8 = p_conn_sec->enc_info |
-                    (p_conn_sec->id_info << 1) |
-                    (p_conn_sec->sign_info << 2);
-
-    err_code = uint8_t_enc(&temp8, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf,
-                                            uint32_t              buf_len,
-                                            uint32_t * const      p_index,
-                                            void * const          p_void_sec_info_request)
-{   
-    ble_gap_evt_sec_info_request_t * p_conn_sec = (ble_gap_evt_sec_info_request_t *)p_void_sec_info_request;
-    uint32_t err_code = NRF_SUCCESS;
-    uint8_t temp8;
-
-    err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_conn_sec->peer_addr));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_conn_sec->master_id));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p_conn_sec->enc_info  = temp8 & 0x01;
-    p_conn_sec->id_info   = (temp8 >> 1) & 0x01;
-    p_conn_sec->sign_info = (temp8 >> 2) & 0x01;
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct,
-                                     uint8_t * const    p_buf,
-                                     uint32_t           buf_len,
-                                     uint32_t * const   p_index)
-{
-    ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_struct;
-    uint32_t                  err_code   = NRF_SUCCESS;
-    uint8_t                   byte       = 0;
-
-    err_code = ble_gap_addr_enc((void *)&p_evt_conn->peer_addr, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    err_code = ble_gap_addr_enc((void *)&p_evt_conn->own_addr, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&(p_evt_conn->role), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    byte = p_evt_conn->irk_match | (p_evt_conn->irk_match_idx << 1);
-    err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_conn_params_t_enc((void *)&p_evt_conn->conn_params, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf,
-                                     uint32_t              buf_len,
-                                     uint32_t * const      p_index,
-                                     void * const          p_void_connected)
-{
-    ble_gap_evt_connected_t * p_evt_conn = (ble_gap_evt_connected_t *)p_void_connected;
-    uint32_t                err_code     = NRF_SUCCESS;
-    uint8_t                 byte         = 0;
-
-    err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->peer_addr));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_evt_conn->own_addr));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_evt_conn->role));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_evt_conn->irk_match     = byte & 0x01;
-    p_evt_conn->irk_match_idx = (byte & 0xFE) >> 1;
-
-    err_code = ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, &(p_evt_conn->conn_params));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index)
-{
-    ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct;
-    uint32_t               err_code     = NRF_SUCCESS;
-    uint8_t                temp8;
-
-    temp8 = (p_sec_params->bond      & 0x01)       |
-            ((p_sec_params->mitm     & 0x01) << 1) |
-            ((p_sec_params->lesc     & 0x01) << 2) |
-            ((p_sec_params->keypress & 0x01) << 3) |
-            ((p_sec_params->io_caps  & 0x07) << 4) |
-            ((p_sec_params->oob      & 0x01) << 7);
-
-    err_code = uint8_t_enc((void *) &temp8, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc((void *) &(p_sec_params->min_key_size), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc((void *) &(p_sec_params->max_key_size), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_own), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_enc((void *) &(p_sec_params->kdist_peer), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_void_struct)
-{
-    ble_gap_sec_params_t * p_sec_params = (ble_gap_sec_params_t *)p_void_struct;
-    uint32_t               err_code     = NRF_SUCCESS;
-    uint8_t                temp8;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &temp8);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_sec_params->bond     = temp8 & 0x01;
-    p_sec_params->mitm     = (temp8 >> 1) & 0x01;
-    p_sec_params->lesc     = (temp8 >> 2) & 0x01;
-    p_sec_params->keypress = (temp8 >> 3) & 0x01;
-    p_sec_params->io_caps  = (temp8 >> 4) & 0x07;
-    p_sec_params->oob      = (temp8 >> 7) & 0x01;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->min_key_size));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->max_key_size));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_own));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_kdist_t_dec(p_buf, buf_len, p_index, (void *) &(p_sec_params->kdist_peer));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct,
-                                              uint8_t * const    p_buf,
-                                              uint32_t           buf_len,
-                                              uint32_t * const   p_index)
-{
-    return ble_gap_sec_params_t_enc(p_void_struct, p_buf, buf_len, p_index);
-}
-
- uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf,
-                                               uint32_t              buf_len,
-                                               uint32_t * const      p_index,
-                                               void * const          p_void_struct)
- {
-    return ble_gap_sec_params_t_dec(p_buf, buf_len, p_index, p_void_struct);
- }
-
-uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update,
-                                             uint8_t * const    p_buf,
-                                             uint32_t           buf_len,
-                                             uint32_t * const   p_index)
-{
-    return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update, p_buf, buf_len, p_index);
-}
-
-uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf,
-                                             uint32_t              buf_len,
-                                             uint32_t * const      p_index,
-                                             void * const          p_void_evt_conn_param_update)
-{
-    return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update);
-}
-
-uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request,
-                                                     uint8_t * const    p_buf,
-                                                     uint32_t           buf_len,
-                                                     uint32_t * const   p_index)
-{
-    return ble_gap_conn_params_t_enc(p_void_evt_conn_param_update_request, p_buf, buf_len, p_index);
-}
-
-uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf,
-                                             uint32_t              buf_len,
-                                             uint32_t * const      p_index,
-                                             void * const          p_void_evt_conn_param_update_request)
-{
-    return ble_gap_conn_params_t_dec(p_buf, buf_len, p_index, p_void_evt_conn_param_update_request);
-}
-
-uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params;
-    uint32_t                err_code      = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&p_conn_params->min_conn_interval, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_conn_params->max_conn_interval, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_conn_params->slave_latency, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&p_conn_params->conn_sup_timeout, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_conn_params)
-{
-    ble_gap_conn_params_t * p_conn_params = (ble_gap_conn_params_t *)p_void_conn_params;
-
-    SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len);
-    uint16_dec(p_buf, buf_len, p_index, &p_conn_params->min_conn_interval);
-
-    SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len);
-    uint16_dec(p_buf, buf_len, p_index, &p_conn_params->max_conn_interval);
-
-    SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len);
-    uint16_dec(p_buf, buf_len, p_index, &p_conn_params->slave_latency);
-
-    SER_ASSERT_LENGTH_LEQ(*p_index + 2, buf_len);
-    uint16_dec(p_buf, buf_len, p_index, &p_conn_params->conn_sup_timeout);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected,
-                                        uint8_t * const    p_buf,
-                                        uint32_t           buf_len,
-                                        uint32_t * const   p_index)
-{
-    ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected;
-    uint32_t                     err_code       = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&p_disconnected->reason, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf,
-                                        uint32_t              buf_len,
-                                        uint32_t * const      p_index,
-                                        void * const          p_void_disconnected)
-{
-    ble_gap_evt_disconnected_t * p_disconnected = (ble_gap_evt_disconnected_t *)p_void_disconnected;
-    uint32_t                     err_code       = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    uint8_dec(p_buf, buf_len, p_index, &p_disconnected->reason);
-
-    return err_code;
-}
-
-uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    ble_gap_master_id_t * p_master_id = (ble_gap_master_id_t *) p_master_idx;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&(p_master_id->ediv), p_buf, buf_len, p_index);
-
-    SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN);
-    *p_index += BLE_GAP_SEC_RAND_LEN;
-
-    return err_code;
-}
-
-uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t      * const p_index,
-                               void          * const p_master_idx)
-{
-    ble_gap_master_id_t *p_master_id = (ble_gap_master_id_t *)p_master_idx;
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_master_id->ediv));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(BLE_GAP_SEC_RAND_LEN, buf_len - *p_index);
-    memcpy(p_master_id->rand, &p_buf[*p_index], BLE_GAP_SEC_RAND_LEN);
-    *p_index += BLE_GAP_SEC_RAND_LEN;
-
-    return err_code;
-}
-
-uint32_t ble_gap_whitelist_t_enc(void const * const p_data,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    
-    ble_gap_whitelist_t *p_whitelist = (ble_gap_whitelist_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t i = 0;
-
-    SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT,
-                            NRF_ERROR_INVALID_PARAM);
-    SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT,
-                            NRF_ERROR_INVALID_PARAM);
-
-    err_code = uint8_t_enc(&(p_whitelist->addr_count), p_buf, buf_len, p_index);
-
-    err_code = cond_field_enc(p_whitelist->pp_addrs, p_buf, buf_len, p_index, NULL);
-
-    for (i = 0; i < p_whitelist->addr_count; i++)
-    {
-        err_code = cond_field_enc(p_whitelist->pp_addrs[i], p_buf, buf_len, p_index, ble_gap_addr_enc);
-    }
-
-    err_code = uint8_t_enc(&(p_whitelist->irk_count), p_buf, buf_len, p_index);
-
-    err_code = cond_field_enc(p_whitelist->pp_irks, p_buf, buf_len, p_index, NULL);
-
-    for (i = 0; i < p_whitelist->irk_count; i++)
-    {
-        err_code = cond_field_enc(p_whitelist->pp_irks[i], p_buf, buf_len, p_index, ble_gap_irk_enc);
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gap_whitelist_t_dec(uint8_t const * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index,
-                                 void *             p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_whitelist_t * p_whitelist = (ble_gap_whitelist_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-    uint32_t i = 0;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->addr_count));
-    SER_ERROR_CHECK(p_whitelist->addr_count <= BLE_GAP_WHITELIST_ADDR_MAX_COUNT,
-                        NRF_ERROR_INVALID_LENGTH);
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs), NULL);
-
-    for (i = 0; i < p_whitelist->addr_count; i++)
-    {
-        err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_addrs[i]), ble_gap_addr_dec);
-    }
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &(p_whitelist->irk_count));
-    SER_ERROR_CHECK(p_whitelist->irk_count <= BLE_GAP_WHITELIST_IRK_MAX_COUNT,
-                        NRF_ERROR_INVALID_LENGTH);
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks), NULL);
-
-    for (i = 0; i < p_whitelist->irk_count; i++)
-    {
-        err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_whitelist->pp_irks[i]), ble_gap_irk_dec);
-    }
-
-    return err_code;
-}
-
-uint32_t ble_gap_scan_params_t_enc(void const * const p_data,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    p_buf[*p_index]  = p_scan_params->active & 0x01;
-    p_buf[*p_index] |= (p_scan_params->selective & 0x7F) << 1;
-    (*p_index)++;
-
-    err_code = cond_field_enc(p_scan_params->p_whitelist, p_buf, buf_len, p_index, ble_gap_whitelist_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_scan_params->interval), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_scan_params->window), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_scan_params->timeout), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_scan_params_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_scan_params_t * p_scan_params = (ble_gap_scan_params_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    p_scan_params->active    = p_buf[*p_index] & 0x01;
-    p_scan_params->selective = (p_buf[*p_index] >> 1) & 0x7F;
-    (*p_index)++;
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_scan_params->p_whitelist), ble_gap_whitelist_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->interval));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->window));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_scan_params->timeout));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_enc_key_t_enc(void const * const p_data,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ble_gap_enc_info_enc(&(p_enc_key->enc_info), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_master_id_t_enc(&(p_enc_key->master_id), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_enc_key_t * p_enc_key = (ble_gap_enc_key_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ble_gap_enc_info_dec(p_buf, buf_len, p_index, &(p_enc_key->enc_info));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_master_id_t_dec(p_buf, buf_len, p_index, &(p_enc_key->master_id));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-uint32_t ble_gap_id_key_t_enc(void const * const p_data,
-                              uint8_t * const    p_buf,
-                              uint32_t           buf_len,
-                              uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ble_gap_irk_enc(&(p_id_key->id_info), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_addr_enc(&(p_id_key->id_addr_info), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf,
-                              uint32_t              buf_len,
-                              uint32_t * const      p_index,
-                              void * const          p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_id_key_t * p_id_key = (ble_gap_id_key_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ble_gap_irk_dec(p_buf, buf_len, p_index, &(p_id_key->id_info));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &(p_id_key->id_addr_info));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *) p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_own), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_keys_enc(&(p_sec_keyset->keys_peer), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_sec_keyset_t * p_sec_keyset = (ble_gap_sec_keyset_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_own));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = ble_gap_sec_keys_dec(p_buf, buf_len, p_index, &(p_sec_keyset->keys_peer));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_evt_sec_request_t * p_evt_sec_request = (ble_gap_evt_sec_request_t *)p_void_struct;
-    uint32_t                  err_code   = NRF_SUCCESS;
-    
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-
-    uint8_t data = (p_evt_sec_request->bond & 0x01)        |
-                   ((p_evt_sec_request->mitm & 0x01) << 1) |
-                   ((p_evt_sec_request->lesc & 0x01) << 2) |
-                   ((p_evt_sec_request->keypress & 0x01) << 3);
-    p_buf[*p_index]  = data;
-    (*p_index)++;
-
-    return err_code;
-}
-
-uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_evt_sec_request_t * p_sec_request = (ble_gap_evt_sec_request_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    p_sec_request->bond = p_buf[*p_index] & 0x01;
-    p_sec_request->mitm = (p_buf[*p_index] >> 1) & 0x01;
-    p_sec_request->lesc = (p_buf[*p_index] >> 2) & 0x01;
-    p_sec_request->keypress = (p_buf[*p_index] >> 3) & 0x01;
-    *p_index            += 1;
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *) p_data;
-    uint32_t                  err_code    = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-
-    p_buf[*p_index]  = p_sec_kdist->enc & 0x01;
-    p_buf[*p_index] |= (p_sec_kdist->id & 0x01) << 1;
-    p_buf[*p_index] |= (p_sec_kdist->sign & 0x01) << 2;
-    p_buf[*p_index] |= (p_sec_kdist->link & 0x01) << 3;
-    (*p_index)++;
-
-    return err_code;
-}
-
-uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_sec_kdist_t * p_sec_kdist = (ble_gap_sec_kdist_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    p_sec_kdist->enc   = p_buf[*p_index] & 0x01;
-    p_sec_kdist->id    = (p_buf[*p_index] >> 1) & 0x01;
-    p_sec_kdist->sign  = (p_buf[*p_index] >> 2) & 0x01;
-    p_sec_kdist->link  = (p_buf[*p_index] >> 3) & 0x01;
-    (*p_index)++;
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    
-    ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-    
-    err_code = uint16_t_enc(&p_gap_opt_ch_map->conn_handle, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_gap_opt_ch_map->ch_map, 5);
-
-    *p_index += 5;
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-    
-    ble_gap_opt_ch_map_t * p_gap_opt_ch_map = (ble_gap_opt_ch_map_t *)p_data;
-    uint32_t err_code = NRF_SUCCESS;
-    
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &p_gap_opt_ch_map->conn_handle);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    
-    SER_ASSERT_LENGTH_LEQ(5, buf_len - *p_index);
-    memcpy(p_gap_opt_ch_map->ch_map, &p_buf[*p_index], 5);
-
-    *p_index += 5;
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency,
-                                              uint8_t * const    p_buf,
-                                              uint32_t           buf_len,
-                                              uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_local_conn_latency_t * p_latency =
-        (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_enc(&(p_latency->conn_handle), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_latency->requested_latency), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_latency->p_actual_latency, p_buf, buf_len, p_index, uint16_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf,
-                                              uint32_t              buf_len,
-                                              uint32_t * const      p_index,
-                                              void * const          p_void_local_conn_latency)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_local_conn_latency_t * p_latency =
-        (ble_gap_opt_local_conn_latency_t *)p_void_local_conn_latency;
-    uint32_t err_code = NRF_SUCCESS;
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->conn_handle));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_latency->requested_latency));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_latency->p_actual_latency),
-                              uint16_t_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_passkey_t * p_opt_passkey  = (ble_gap_opt_passkey_t *)p_void_passkey;
-    uint32_t   err_code                    = NRF_SUCCESS;
-    uint16_t passkey_len                   = BLE_GAP_PASSKEY_LEN;
-
-    err_code = buf_enc(p_opt_passkey->p_passkey, passkey_len, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_passkey)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_passkey_t * p_opt_passkey  = (ble_gap_opt_passkey_t *)p_void_passkey;
-    uint32_t   err_code                    = NRF_SUCCESS;
-    uint16_t passkey_len                   = BLE_GAP_PASSKEY_LEN;
-
-    err_code = buf_dec(p_buf, buf_len, p_index, &p_opt_passkey->p_passkey, passkey_len,
-                       passkey_len);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy;
-    uint32_t                 err_code = NRF_SUCCESS;
-
-    err_code = cond_field_enc(p_privacy->p_irk, p_buf, buf_len, p_index, ble_gap_irk_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&(p_privacy->interval_s), p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_privacy)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_privacy_t * p_privacy = (ble_gap_opt_privacy_t *)p_void_privacy;
-    uint32_t                 err_code = NRF_SUCCESS;
-
-    err_code = cond_field_dec(p_buf, buf_len, p_index, (void **) &(p_privacy->p_irk), ble_gap_irk_dec);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_dec(p_buf, buf_len, p_index, &(p_privacy->interval_s));
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report,
-                                           uint8_t * const    p_buf,
-                                           uint32_t           buf_len,
-                                           uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report;
-    uint32_t                                 err_code = NRF_SUCCESS;
-    uint8_t                                  byte;
-
-    byte = p_scan_req_report->enable;
-    err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf,
-                                           uint32_t           buf_len,
-                                           uint32_t * const   p_index,
-                                           void * const       p_void_scan_req_report)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_scan_req_report_t * p_scan_req_report = (ble_gap_opt_scan_req_report_t *)p_void_scan_req_report;
-    uint32_t                        err_code          = NRF_SUCCESS;
-    uint8_t                         byte;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_scan_req_report->enable = byte & 0x01;
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode;
-    uint32_t                    err_code      = NRF_SUCCESS;
-    uint8_t                     byte          = 0;
-
-    byte = p_compat_mode->mode_1_enable;
-    err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_void_compat_mode)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_opt_compat_mode_t * p_compat_mode = (ble_gap_opt_compat_mode_t *)p_void_compat_mode;
-    uint32_t                    err_code      = NRF_SUCCESS;
-    uint8_t                     byte          = 0;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_compat_mode->mode_1_enable = byte & 0x01;
-
-    return err_code;
-}
-
-uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask;
-    uint32_t                err_code  = NRF_SUCCESS;
-    uint8_t                 byte;
-
-    byte = p_ch_mask->ch_37_off        |
-           (p_ch_mask->ch_38_off << 1) |
-           (p_ch_mask->ch_39_off << 2);
-    err_code = uint8_t_enc(&byte, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_ch_mask)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_adv_ch_mask_t * p_ch_mask = (ble_gap_adv_ch_mask_t *)p_void_ch_mask;
-    uint32_t                err_code  = NRF_SUCCESS;
-    uint8_t                 byte;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &byte);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-    p_ch_mask->ch_37_off = byte & 0x01;
-    p_ch_mask->ch_38_off = (byte >> 1) & 0x01;
-    p_ch_mask->ch_39_off = (byte >> 2) & 0x01;
-
-    return err_code;
-}
-
-uint32_t ble_gap_enable_params_t_enc(void const * const p_void_enable_params,
-                                     uint8_t * const    p_buf,
-                                     uint32_t           buf_len,
-                                     uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_enable_params_t * p_enable_params = (ble_gap_enable_params_t *)p_void_enable_params;
-    uint32_t                err_code  = NRF_SUCCESS;
-
-    err_code = uint8_t_enc(&p_enable_params->periph_conn_count, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_enable_params->central_conn_count, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&p_enable_params->central_sec_count, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_enable_params_t_dec(uint8_t const * const p_buf,
-                                     uint32_t              buf_len,
-                                     uint32_t * const      p_index,
-                                     void * const          p_void_enable_params)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_enable_params_t * p_enable_params = (ble_gap_enable_params_t *)p_void_enable_params;
-    uint32_t                err_code  = NRF_SUCCESS;
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_enable_params->periph_conn_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_enable_params->central_conn_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_dec(p_buf, buf_len, p_index, &p_enable_params->central_sec_count);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return err_code;
-}
-
-uint32_t ble_gap_lesc_p256_pk_t_enc(void const * const p_pk,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_lesc_p256_pk_t), buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_pk, sizeof (ble_gap_lesc_p256_pk_t));
-    *p_index += sizeof (ble_gap_lesc_p256_pk_t);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_lesc_p256_pk_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_pk)
-{
-    SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_lesc_p256_pk_t), buf_len - *p_index);
-    memcpy(p_pk, &p_buf[*p_index], sizeof (ble_gap_lesc_p256_pk_t));
-    *p_index += sizeof (ble_gap_lesc_p256_pk_t);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_lesc_dhkey_t_enc(void const * const p_key,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_lesc_dhkey_t), buf_len - *p_index);
-    memcpy(&p_buf[*p_index], p_key, sizeof (ble_gap_lesc_dhkey_t));
-    *p_index += sizeof (ble_gap_lesc_dhkey_t);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_lesc_dhkey_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_key)
-{
-    SER_ASSERT_LENGTH_LEQ(sizeof (ble_gap_lesc_dhkey_t), buf_len - *p_index);
-    memcpy(p_key, &p_buf[*p_index], sizeof (ble_gap_lesc_dhkey_t));
-    *p_index += sizeof (ble_gap_lesc_dhkey_t);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_lesc_oob_data_t_enc(void const * const p_void_oob_data,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_lesc_oob_data_t * p_oob_data = (ble_gap_lesc_oob_data_t *)p_void_oob_data;
-    uint32_t                err_code  = NRF_SUCCESS;
-
-    err_code = ble_gap_addr_enc(&p_oob_data->addr, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = buf_enc(p_oob_data->r, BLE_GAP_SEC_KEY_LEN, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = buf_enc(p_oob_data->c, BLE_GAP_SEC_KEY_LEN, p_buf, buf_len, p_index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ble_gap_lesc_oob_data_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_oob_data)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_index);
-
-    ble_gap_lesc_oob_data_t * p_oob_data = (ble_gap_lesc_oob_data_t *)p_void_oob_data;
-    uint32_t                err_code  = NRF_SUCCESS;
-
-    err_code = ble_gap_addr_dec(p_buf, buf_len, p_index, &p_oob_data->addr);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    uint8_t * p = p_oob_data->r;
-    err_code = buf_dec(p_buf, buf_len, p_index, (uint8_t **)&p, BLE_GAP_SEC_KEY_LEN, BLE_GAP_SEC_KEY_LEN);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    p = p_oob_data->c;
-    err_code = buf_dec(p_buf, buf_len, p_index, (uint8_t **)&p, BLE_GAP_SEC_KEY_LEN,  BLE_GAP_SEC_KEY_LEN);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    return NRF_SUCCESS;
-}

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/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h
deleted file mode 100644
index afdefef..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/struct_ser/s130/ble_gap_struct_serialization.h
+++ /dev/null
@@ -1,383 +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.
- *
- */
-
-#include "ble_gap.h"
-
-uint32_t ble_gap_irk_enc(void const * const p_data,
-                         uint8_t * const    p_buf,
-                         uint32_t           buf_len,
-                         uint32_t * const   p_index);
-
-uint32_t ble_gap_irk_dec(uint8_t const * const p_buf,
-                         uint32_t              buf_len,
-                         uint32_t * const      p_index,
-                         void * const          p_data);
-
-uint32_t ble_gap_addr_enc(void const * const p_data,
-                          uint8_t * const    p_buf,
-                          uint32_t           buf_len,
-                          uint32_t * const   p_index);
-
-uint32_t ble_gap_addr_dec(uint8_t const * const p_buf,
-                          uint32_t              buf_len,
-                          uint32_t * const      p_index,
-                          void * const          p_addr);
-
-uint32_t ble_gap_sec_levels_enc(void const * const p_data,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index);
-
-uint32_t ble_gap_sec_levels_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                void * const          p_data);
-
-uint32_t ble_gap_sec_keys_enc(void const * const p_data,
-                              uint8_t * const    p_buf,
-                              uint32_t           buf_len,
-                              uint32_t * const   p_index);
-
-uint32_t ble_gap_sec_keys_dec(uint8_t const * const p_buf,
-                              uint32_t              buf_len,
-                              uint32_t * const      p_index,
-                              void * const          p_data);
-
-uint32_t ble_gap_enc_info_enc(void const * const p_data,
-                              uint8_t * const    p_buf,
-                              uint32_t           buf_len,
-                              uint32_t * const   p_index);
-
-uint32_t ble_gap_enc_info_dec(uint8_t const * const p_buf,
-                              uint32_t              buf_len,
-                              uint32_t * const      p_index,
-                              void * const          p_enc_info);
-
-uint32_t ble_gap_sign_info_enc(void const * const p_sign_info,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-
-uint32_t ble_gap_sign_info_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_sign_info);
-
-uint32_t ble_gap_evt_auth_status_t_enc(void const * const p_data,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_auth_status_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_data);
-
-uint32_t ble_gap_conn_sec_mode_enc(void const * const p_void_sec_mode,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ble_gap_conn_sec_mode_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_sec_mode);
-
-uint32_t ble_gap_conn_sec_t_enc(void const * const p_void_sec,
-                                uint8_t * const    p_buf,
-                                uint32_t           buf_len,
-                                uint32_t * const   p_index);
-
-uint32_t ble_gap_conn_sec_t_dec(uint8_t const * const p_buf,
-                                uint32_t              buf_len,
-                                uint32_t * const      p_index,
-                                void * const          p_void_sec);
-
-uint32_t ble_gap_evt_conn_sec_update_t_enc(void const * const p_void_conn_sec_update,
-                                           uint8_t * const    p_buf,
-                                           uint32_t           buf_len,
-                                           uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_conn_sec_update_t_dec(uint8_t const * const p_buf,
-                                           uint32_t              buf_len,
-                                           uint32_t * const      p_index,
-                                           void * const          p_void_conn_sec_update);
-
-uint32_t ble_gap_evt_sec_info_request_t_enc(void const * const p_void_sec_info_request,
-                                            uint8_t * const    p_buf,
-                                            uint32_t           buf_len,
-                                            uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_sec_info_request_t_dec(uint8_t const * const p_buf,
-                                            uint32_t              buf_len,
-                                            uint32_t * const      p_index,
-                                            void * const          p_void_sec_info_request);
-
-uint32_t ble_gap_evt_connected_t_enc(void const * const p_void_struct,
-                                     uint8_t * const    p_buf,
-                                     uint32_t           buf_len,
-                                     uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_connected_t_dec(uint8_t const * const p_buf,
-                                     uint32_t              buf_len,
-                                     uint32_t * const      p_index,
-                                     void * const          p_void_connected);
-
-uint32_t ble_gap_sec_params_t_enc(void const * const p_void_struct,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index);
-
-uint32_t ble_gap_sec_params_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_void_struct);
-
-uint32_t ble_gap_evt_sec_params_request_t_enc(void const * const p_void_struct,
-                                              uint8_t * const    p_buf,
-                                              uint32_t           buf_len,
-                                              uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_sec_params_request_t_dec(uint8_t const * const p_buf,
-                                              uint32_t              buf_len,
-                                              uint32_t * const      p_index,
-                                              void * const          p_void_struct);
-
-uint32_t ble_gap_conn_params_t_enc(void const * const p_void_conn_params,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ble_gap_conn_params_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_conn_params);
-
-uint32_t ble_gap_evt_conn_param_update_t_enc(void const * const p_void_evt_conn_param_update,
-                                             uint8_t * const    p_buf,
-                                             uint32_t           buf_len,
-                                             uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_conn_param_update_t_dec(uint8_t const * const p_buf,
-                                             uint32_t              buf_len,
-                                             uint32_t * const      p_index,
-                                             void * const          p_void_evt_conn_param_update);
-
-uint32_t ble_gap_evt_conn_param_update_request_t_enc(void const * const p_void_evt_conn_param_update_request,
-                                                     uint8_t * const    p_buf,
-                                                     uint32_t           buf_len,
-                                                     uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_conn_param_update_request_t_dec(uint8_t const * const p_buf,
-                                                     uint32_t              buf_len,
-                                                     uint32_t * const      p_index,
-                                                     void * const          p_void_evt_conn_param_update_request);
-
-uint32_t ble_gap_evt_disconnected_t_enc(void const * const p_void_disconnected,
-                                        uint8_t * const    p_buf,
-                                        uint32_t           buf_len,
-                                        uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_disconnected_t_dec(uint8_t const * const p_buf,
-                                        uint32_t              buf_len,
-                                        uint32_t * const      p_index,
-                                        void * const          p_void_disconnected);
-
-uint32_t ble_gap_whitelist_t_enc(void const * const p_data,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_gap_whitelist_t_dec(uint8_t const * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index,
-                                 void *             p_data);
-
-uint32_t ble_gap_scan_params_t_enc(void const * const p_data,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ble_gap_scan_params_t_dec(uint8_t const * const  p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index,
-                                 void * const p_data);
-
-uint32_t ble_gap_master_id_t_enc(void const * const p_master_idx,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_gap_master_id_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t      * const p_index,
-                                 void          * const p_master_idx);
-
-uint32_t ble_gap_enc_key_t_enc(void const * const p_data,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-
-uint32_t ble_gap_enc_key_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_data);
-
-uint32_t ble_gap_id_key_t_enc(void const * const p_data,
-                              uint8_t * const    p_buf,
-                              uint32_t           buf_len,
-                              uint32_t * const   p_index);
-
-uint32_t ble_gap_id_key_t_dec(uint8_t const * const p_buf,
-                              uint32_t              buf_len,
-                              uint32_t * const      p_index,
-                              void * const          p_data);
-
-uint32_t ble_gap_sec_keyset_t_enc(void const * const p_data,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index);
-
-uint32_t ble_gap_sec_keyset_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_data);
-
-uint32_t ble_gap_evt_sec_request_t_enc(void const * const p_void_struct,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index);
-
-uint32_t ble_gap_evt_sec_request_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_data);
-
-uint32_t ble_gap_sec_kdist_t_enc(void const * const p_data,
-                                 uint8_t * const    p_buf,
-                                 uint32_t           buf_len,
-                                 uint32_t * const   p_index);
-
-uint32_t ble_gap_sec_kdist_t_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 void * const          p_data);
-
-uint32_t ble_gap_opt_ch_map_t_enc(void const * const p_data,
-                                  uint8_t * const    p_buf,
-                                  uint32_t           buf_len,
-                                  uint32_t * const   p_index);
-
-uint32_t ble_gap_opt_ch_map_t_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  void * const          p_data);
-
-uint32_t ble_gap_opt_local_conn_latency_t_enc(void const * const p_void_local_conn_latency,
-                                              uint8_t * const    p_buf,
-                                              uint32_t           buf_len,
-                                              uint32_t * const   p_index);
-
-uint32_t ble_gap_opt_local_conn_latency_t_dec(uint8_t const * const p_buf,
-                                              uint32_t              buf_len,
-                                              uint32_t * const      p_index,
-                                              void * const          p_void_local_conn_latency);
-
-uint32_t ble_gap_opt_passkey_t_enc(void const * const p_void_passkey,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ble_gap_opt_passkey_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_passkey);
-
-uint32_t ble_gap_opt_privacy_t_enc(void const * const p_void_privacy,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ble_gap_opt_privacy_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_privacy);
-
-uint32_t ble_gap_opt_scan_req_report_t_enc(void const * const p_void_scan_req_report,
-                                           uint8_t * const    p_buf,
-                                           uint32_t           buf_len,
-                                           uint32_t * const   p_index);
-
-uint32_t ble_gap_opt_scan_req_report_t_dec(uint8_t const * const p_buf,
-                                           uint32_t           buf_len,
-                                           uint32_t * const   p_index,
-                                           void * const       p_void_scan_req_report);
-
-uint32_t ble_gap_opt_compat_mode_t_enc(void const * const p_void_compat_mode,
-                                       uint8_t * const    p_buf,
-                                       uint32_t           buf_len,
-                                       uint32_t * const   p_index);
-
-uint32_t ble_gap_opt_compat_mode_t_dec(uint8_t const * const p_buf,
-                                       uint32_t              buf_len,
-                                       uint32_t * const      p_index,
-                                       void * const          p_void_compat_mode);
-
-uint32_t ble_gap_adv_ch_mask_t_enc(void const * const p_void_ch_mask,
-                                   uint8_t * const    p_buf,
-                                   uint32_t           buf_len,
-                                   uint32_t * const   p_index);
-
-uint32_t ble_gap_adv_ch_mask_t_dec(uint8_t const * const p_buf,
-                                   uint32_t              buf_len,
-                                   uint32_t * const      p_index,
-                                   void * const          p_void_ch_mask);
-
-uint32_t ble_gap_enable_params_t_enc(void const * const p_void_enable_params,
-                                     uint8_t * const    p_buf,
-                                     uint32_t           buf_len,
-                                     uint32_t * const   p_index);
-
-uint32_t ble_gap_enable_params_t_dec(uint8_t const * const p_buf,
-                                     uint32_t              buf_len,
-                                     uint32_t * const      p_index,
-                                     void * const          p_void_enable_params);
-
-uint32_t ble_gap_lesc_p256_pk_t_enc(void const * const p_pk,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-
-uint32_t ble_gap_lesc_p256_pk_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_pk);
-
-uint32_t ble_gap_lesc_dhkey_t_enc(void const * const p_key,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-
-uint32_t ble_gap_lesc_dhkey_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_key);
-
-uint32_t ble_gap_lesc_oob_data_t_enc(void const * const p_void_oob_data,
-                               uint8_t * const    p_buf,
-                               uint32_t           buf_len,
-                               uint32_t * const   p_index);
-
-uint32_t ble_gap_lesc_oob_data_t_dec(uint8_t const * const p_buf,
-                               uint32_t              buf_len,
-                               uint32_t * const      p_index,
-                               void * const          p_void_oob_data);


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

Posted by cc...@apache.org.
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/serialization/common/transport/ser_phy/ser_phy_hci_slip.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci_slip.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci_slip.c
deleted file mode 100644
index 89f5f90..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_hci_slip.c
+++ /dev/null
@@ -1,634 +0,0 @@
-
-/* Copyright (c) Nordic Semiconductor ASA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. This software must only be used in a processor manufactured by Nordic
- * Semiconductor ASA, or in a processor manufactured by a third party that
- * is used in combination with a processor manufactured by Nordic Semiconductor.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <stdbool.h>
-
-#include "nrf_error.h"
-#include "nrf_gpio.h"
-#include "app_uart.h"
-#include "ser_phy_hci.h"
-#include "app_error.h"
-#include "app_util_platform.h"
-#include "nrf_soc.h"
-
-#ifdef SER_CONNECTIVITY
-#include "ser_phy_config_conn_nrf51.h"
-#else
-#include "ser_phy_config_app_nrf51.h"
-#endif /* SER_CONNECTIVITY */
-
-#include "ser_config.h"
-#define APP_SLIP_END     0xC0 /**< SLIP code for identifying the beginning and end of a packet frame.. */
-#define APP_SLIP_ESC     0xDB /**< SLIP escape code. This code is used to specify that the following character is specially encoded. */
-#define APP_SLIP_ESC_END 0xDC /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xC0.. */
-#define APP_SLIP_ESC_ESC 0xDD /**< SLIP special code. When this code follows 0xDB, this character is interpreted as payload data 0xDB. */
-
-#define HDR_SIZE 4
-#define CRC_SIZE 2
-#define PKT_SIZE (SER_HAL_TRANSPORT_MAX_PKT_SIZE + HDR_SIZE + CRC_SIZE)
-
-static const app_uart_comm_params_t comm_params =
-{
-    .rx_pin_no  = SER_PHY_UART_RX,
-    .tx_pin_no  = SER_PHY_UART_TX,
-    .rts_pin_no = SER_PHY_UART_RTS,
-    .cts_pin_no = SER_PHY_UART_CTS,
-    // Below values are defined in ser_config.h common for application and connectivity
-    .flow_control = SER_PHY_UART_FLOW_CTRL,
-    .use_parity   = SER_PHY_UART_PARITY,
-    .baud_rate    = SER_PHY_UART_BAUDRATE
-};
-
-static uint8_t m_small_buffer[HDR_SIZE];
-static uint8_t m_big_buffer[PKT_SIZE];
-
-static uint8_t * mp_small_buffer = NULL;
-static uint8_t * mp_big_buffer   = NULL;
-static uint8_t * mp_buffer       = NULL;
-
-static ser_phy_hci_pkt_params_t m_header;
-static ser_phy_hci_pkt_params_t m_payload;
-static ser_phy_hci_pkt_params_t m_crc;
-static ser_phy_hci_pkt_params_t m_header_pending;
-static ser_phy_hci_pkt_params_t m_payload_pending;
-static ser_phy_hci_pkt_params_t m_crc_pending;
-
-static ser_phy_hci_slip_evt_t           m_ser_phy_hci_slip_event;
-static ser_phy_hci_slip_event_handler_t m_ser_phy_hci_slip_event_handler; /**< Event handler for upper layer */
-
-static bool    m_other_side_active = false; /**< Flag indicating that the other side is running */
-static uint8_t m_rx_byte;                   /**< Rx byte passed from low-level driver */
-
-static bool m_rx_escape = false;
-static bool m_tx_escape = false;
-
-static bool m_tx_busy = false; /**< Flag indicating that currently some transmission is ongoing */
-
-static uint32_t                   m_tx_index;
-static uint32_t                   m_rx_index;
-static ser_phy_hci_pkt_params_t * mp_data = NULL;
-
-/* Function declarations */
-static uint32_t ser_phy_hci_tx_byte(void);
-static bool     slip_decode(uint8_t * p_received_byte);
-static void     ser_phi_hci_rx_byte(uint8_t rx_byte);
-// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-__STATIC_INLINE void callback_hw_error(uint32_t error_src)
-{
-    m_ser_phy_hci_slip_event.evt_type = SER_PHY_HCI_SLIP_EVT_HW_ERROR;
-
-    // Pass error source to upper layer
-    m_ser_phy_hci_slip_event.evt_params.hw_error.error_code = error_src;
-    m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event);
-}
-
-
-__STATIC_INLINE void slip_encode(void)
-{
-    switch (mp_data->p_buffer[m_tx_index])
-    {
-        case APP_SLIP_END:
-            m_tx_escape = true;
-            (void)app_uart_put(APP_SLIP_ESC);
-            break;
-
-        case APP_SLIP_ESC:
-            m_tx_escape = true;
-            (void)app_uart_put(APP_SLIP_ESC);
-            break;
-
-        default:
-            (void)app_uart_put(mp_data->p_buffer[m_tx_index]);
-            m_tx_index++;
-            break;
-    }
-}
-
-
-__STATIC_INLINE bool check_pending_tx()
-{
-    bool tx_continue = false;
-
-    if (m_header_pending.p_buffer != NULL)
-    {
-        m_header  = m_header_pending;
-        m_payload = m_payload_pending;
-        m_crc     = m_crc_pending;
-
-        m_header_pending.p_buffer      = NULL;
-        m_header_pending.num_of_bytes  = 0;
-        m_payload_pending.p_buffer     = NULL;
-        m_payload_pending.num_of_bytes = 0;
-        m_crc_pending.p_buffer         = NULL;
-        m_crc_pending.num_of_bytes     = 0;
-
-        m_tx_index  = 0; // may be also done in ser_phy_hci_tx_byte???
-        tx_continue = true;
-
-        /* Start sending pending packet */
-        (void)ser_phy_hci_tx_byte();
-    }
-
-    return tx_continue;
-}
-
-
-static uint32_t ser_phy_hci_tx_byte()
-{
-    /* Flags informing about actually transmited part of packet*/
-    static bool header  = false;
-    static bool payload = false;
-    static bool crc     = false;
-
-    static bool ack_end    = false;
-    static bool packet_end = false;
-
-    if (ack_end == true)
-    {
-        ack_end   = false;
-        m_tx_busy = check_pending_tx();
-        /* Report end of ACK transmission*/
-        m_ser_phy_hci_slip_event.evt_type = SER_PHY_HCI_SLIP_EVT_ACK_SENT;
-        m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event);
-
-    }
-    else if (packet_end == true)
-    {
-        packet_end = false;
-        m_tx_busy  = check_pending_tx();
-        /* Report end of packet transmission*/
-        m_ser_phy_hci_slip_event.evt_type = SER_PHY_HCI_SLIP_EVT_PKT_SENT;
-        m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event);
-
-    }
-    else if ((m_tx_index == 0) && !header && !payload && !crc)
-    {
-        /* Beginning of packet - sent 0xC0*/
-        header  = true;
-        mp_data = &m_header;
-        (void)app_uart_put(APP_SLIP_END);
-    }
-    else if ((m_tx_index == mp_data->num_of_bytes) && crc == true)
-    {
-        /* End of packet - sent 0xC0*/
-        (void)app_uart_put(APP_SLIP_END);
-
-        m_crc.p_buffer = NULL;
-        crc            = false;
-        m_tx_index     = 0;
-        packet_end     = true;
-    }
-    else if ((m_tx_index == mp_data->num_of_bytes) && header == true)
-    {
-        /* End of header transmission*/
-        m_tx_index = 0;
-
-        if (m_payload.p_buffer != NULL)
-        {
-            header  = false;
-            payload = true;
-            mp_data = &m_payload;
-
-            /* Handle every character in buffer accordingly to SLIP protocol*/
-            slip_encode();
-        }
-        else
-        {
-            /* End of ACK - sent 0xC0*/
-            (void)app_uart_put(APP_SLIP_END);
-
-            header  = false;
-            ack_end = true;
-        }
-    }
-    else if ((m_tx_index == mp_data->num_of_bytes) && payload == true)
-    {
-        /* End of payload transmission*/
-        m_tx_index = 0;
-
-        if (m_crc.p_buffer != NULL)
-        {
-            m_payload.p_buffer = NULL;
-            payload            = false;
-            crc                = true;
-            mp_data            = &m_crc;
-
-            /* Handle every character in buffer accordingly to SLIP protocol*/
-            slip_encode();
-        }
-        /* CRC is not used for this packet -> finish packet transmission */
-        else
-        {
-            /* End of packet - send 0xC0*/
-            (void)app_uart_put(APP_SLIP_END);
-
-            m_payload.p_buffer = NULL;
-            payload            = false;
-            packet_end         = true;
-        }
-    }
-    else if (m_tx_escape == false)
-    {
-        /* Handle every character in buffer accordingly to SLIP protocol*/
-        slip_encode();
-    }
-    else if (m_tx_escape == true)
-    {
-        /* Send SLIP special code*/
-        m_tx_escape = false;
-
-        if (mp_data->p_buffer[m_tx_index] == APP_SLIP_END)
-        {
-            (void)app_uart_put(APP_SLIP_ESC_END);
-            m_tx_index++;
-        }
-        else
-        {
-            (void)app_uart_put(APP_SLIP_ESC_ESC);
-            m_tx_index++;
-        }
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ser_phy_hci_slip_tx_pkt_send(const ser_phy_hci_pkt_params_t * p_header,
-                                      const ser_phy_hci_pkt_params_t * p_payload,
-                                      const ser_phy_hci_pkt_params_t * p_crc)
-{
-    /* Block TXRDY interrupts at this point*/
-    // NRF_UART0->INTENCLR = (UART_INTENCLR_TXDRDY_Clear << UART_INTENCLR_TXDRDY_Pos);
-    CRITICAL_REGION_ENTER();
-
-    if (p_header == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    /* Check if no tx is ongoing */
-    if (!m_tx_busy)
-    {
-        m_header = *p_header;
-
-        if (p_payload != NULL)
-        {
-            m_payload = *p_payload;
-        }
-
-        if (p_crc != NULL)
-        {
-            m_crc = *p_crc;
-        }
-    }
-    /* Tx is ongoing, schedule transmission as pending */
-    else
-    {
-        if (p_crc != NULL)
-        {
-            m_crc_pending = *p_crc;
-        }
-
-        if (p_payload != NULL)
-        {
-            m_payload_pending = *p_payload;
-        }
-
-        m_header_pending = *p_header;
-    }
-
-    /* Start packet transmission only if no other tx is ongoing */
-    if (!m_tx_busy)
-    {
-        m_tx_busy = true;
-        (void)ser_phy_hci_tx_byte();
-    }
-
-    /* Enable TXRDY interrupts at this point*/
-    // NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos);
-    CRITICAL_REGION_EXIT();
-    return NRF_SUCCESS;
-}
-
-
-/* Function returns false when last byte in packet is detected.*/
-static bool slip_decode(uint8_t * p_received_byte)
-{
-    switch (*p_received_byte)
-    {
-        case APP_SLIP_END:
-            return false;
-
-        case APP_SLIP_ESC:
-            m_rx_escape = true;
-            break;
-
-        case APP_SLIP_ESC_END:
-
-            if (m_rx_escape == true)
-            {
-                m_rx_escape      = false;
-                *p_received_byte = APP_SLIP_END;
-            }
-            break;
-
-        case APP_SLIP_ESC_ESC:
-
-            if (m_rx_escape == true)
-            {
-                m_rx_escape      = false;
-                *p_received_byte = APP_SLIP_ESC;
-            }
-            break;
-
-        /* Normal character - decoding not needed*/
-        default:
-            break;
-    }
-
-    return true;
-}
-
-
-static void ser_phi_hci_rx_byte(uint8_t rx_byte)
-{
-    static bool rx_sync         = false;
-    uint8_t     received_byte   = rx_byte;
-    static bool big_buff_in_use = false;
-
-    /* Test received byte for SLIP packet start: 0xC0*/
-    if (!rx_sync)
-    {
-        if (received_byte == APP_SLIP_END)
-        {
-            m_rx_index = 0;
-            rx_sync    = true;
-        }
-        return;
-    }
-
-    /* Additional check needed in case rx_sync flag was set by end of previous packet*/
-    if ((m_rx_index) == 0 && (received_byte == APP_SLIP_END))
-    {
-        return;
-    }
-
-    /* Check if small (ACK) buffer is available*/
-    if ((mp_small_buffer != NULL) && (big_buff_in_use == false))
-    {
-        if (m_rx_index == 0)
-        {
-            mp_buffer = mp_small_buffer;
-        }
-
-        /* Check if switch between small and big buffer is needed*/
-        if (m_rx_index == sizeof (m_small_buffer) /*NEW!!!*/ && received_byte != APP_SLIP_END)
-        {
-            /* Check if big (PKT) buffer is available*/
-            if (mp_big_buffer != NULL)
-            {
-                /* Switch to big buffer*/
-                memcpy(m_big_buffer, m_small_buffer, sizeof (m_small_buffer));
-                mp_buffer = m_big_buffer;
-            }
-            else
-            {
-                /* Small buffer is too small and big buffer not available - cannot continue reception*/
-                rx_sync = false;
-                return;
-            }
-        }
-
-        /* Check if big buffer is full */
-        if ((m_rx_index >= PKT_SIZE) && (received_byte != APP_SLIP_END))
-        {
-            /* Do not notify upper layer - the packet is too big and cannot be handled by slip */
-            rx_sync = false;
-            return;
-        }
-
-        /* Decode byte. Will return false when it is 0xC0 - end of packet*/
-        if (slip_decode(&received_byte))
-        {
-            /* Write Rx byte only if it is not escape char */
-            if (!m_rx_escape)
-            {
-                mp_buffer[m_rx_index++] = received_byte;
-            }
-        }
-        else
-        {
-            /* Reset pointers to signalise buffers are locked waiting for upper layer */
-            if (mp_buffer == mp_small_buffer)
-            {
-                mp_small_buffer = NULL;
-            }
-            else
-            {
-                mp_big_buffer = NULL;
-            }
-            /* Report packet reception end*/
-            m_ser_phy_hci_slip_event.evt_type =
-                SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED;
-            m_ser_phy_hci_slip_event.evt_params.received_pkt.p_buffer     = mp_buffer;
-            m_ser_phy_hci_slip_event.evt_params.received_pkt.num_of_bytes = m_rx_index;
-            m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event);
-
-            rx_sync = false;
-        }
-    }
-    else if (mp_big_buffer != NULL)
-    {
-        big_buff_in_use = true;
-        mp_buffer       = mp_big_buffer;
-
-        /* Check if big buffer is full */
-        if ((m_rx_index >= PKT_SIZE) && (received_byte != APP_SLIP_END))
-        {
-            /* Do not notify upper layer - the packet is too big and cannot be handled by slip */
-            rx_sync = false;
-            return;
-        }
-
-        /* Decode byte*/
-        if (slip_decode(&received_byte))
-        {
-            /* Write Rx byte only if it is not escape char */
-            if (!m_rx_escape)
-            {
-                mp_buffer[m_rx_index++] = received_byte;
-            }
-        }
-        else
-        {
-            /* Report packet reception end*/
-            m_ser_phy_hci_slip_event.evt_type =
-                SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED;
-            m_ser_phy_hci_slip_event.evt_params.received_pkt.p_buffer     = mp_buffer;
-            m_ser_phy_hci_slip_event.evt_params.received_pkt.num_of_bytes = m_rx_index;
-            m_ser_phy_hci_slip_event_handler(&m_ser_phy_hci_slip_event);
-
-            rx_sync         = false;
-            mp_big_buffer   = NULL;
-            big_buff_in_use = false;
-        }
-    }
-    else
-    {
-        /* Both buffers are not available - cannot continue reception*/
-        rx_sync = false;
-        return;
-    }
-}
-
-
-uint32_t ser_phy_hci_slip_rx_buf_free(uint8_t * p_buffer)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-    else if (p_buffer == m_small_buffer)
-    {
-        /* Free small buffer*/
-        if (mp_small_buffer == NULL)
-        {
-            mp_small_buffer = m_small_buffer;
-        }
-        else
-        {
-            err_code = NRF_ERROR_INVALID_STATE;
-        }
-    }
-    else if (p_buffer == m_big_buffer)
-    {
-        /* Free big buffer*/
-        if (mp_big_buffer == NULL)
-        {
-            mp_big_buffer = m_big_buffer;
-        }
-        else
-        {
-            err_code = NRF_ERROR_INVALID_STATE;
-        }
-    }
-
-    return err_code;
-}
-
-
-static void ser_phy_uart_evt_callback(app_uart_evt_t * uart_evt)
-{
-    if (uart_evt == NULL)
-    {
-        return;
-    }
-
-    switch (uart_evt->evt_type)
-    {
-        case APP_UART_COMMUNICATION_ERROR:
-
-            // Process error only if this is parity or overrun error.
-            // Break and framing error is always present when app side is not active
-            if (uart_evt->data.error_communication &
-                (UART_ERRORSRC_PARITY_Msk | UART_ERRORSRC_OVERRUN_Msk))
-            {
-                callback_hw_error(uart_evt->data.error_communication);
-            }
-            break;
-
-        case APP_UART_TX_EMPTY:
-            (void)ser_phy_hci_tx_byte();
-            break;
-
-        case APP_UART_DATA:
-
-            // After first reception disable pulldown - it was only needed before start
-            // of the other side
-            if (!m_other_side_active)
-            {
-                m_other_side_active = true;
-            }
-
-            m_rx_byte = uart_evt->data.value;
-            ser_phi_hci_rx_byte(m_rx_byte);
-            break;
-
-        default:
-            APP_ERROR_CHECK(NRF_ERROR_INTERNAL);
-            break;
-    }
-}
-
-
-uint32_t ser_phy_hci_slip_open(ser_phy_hci_slip_event_handler_t events_handler)
-{
-    uint32_t err_code;
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    // Check if function was not called before
-    if (m_ser_phy_hci_slip_event_handler != NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    // Configure UART and register handler
-    // uart_evt_handler is used to handle events produced by low-level uart driver
-    APP_UART_INIT(&comm_params, ser_phy_uart_evt_callback, UART_IRQ_PRIORITY, err_code);
-
-    mp_small_buffer = m_small_buffer;
-    mp_big_buffer   = m_big_buffer;
-
-    m_ser_phy_hci_slip_event_handler = events_handler;
-
-    return err_code;
-}
-
-
-void ser_phy_hci_slip_close(void)
-{
-    m_ser_phy_hci_slip_event_handler = NULL;
-    (void)app_uart_close();
-}
-

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/serialization/common/transport/ser_phy/ser_phy_nohci.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nohci.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nohci.c
deleted file mode 100644
index 7c9a9e5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nohci.c
+++ /dev/null
@@ -1,356 +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 ser_phy_spi_phy_driver_slave ser_phy_nrf51_spi_slave.c
- * @{
- * @ingroup ser_phy_spi_phy_driver_slave
- *
- * @brief SPI_RAW PHY slave driver.
- */
-
-#include <stddef.h>
-#include <string.h>
-
-#include "app_error.h"
-#include "app_util.h"
-#include "app_util_platform.h"
-#include "app_timer.h"
-#include "app_mailbox.h"
-#include "ser_phy.h"
-#include "ser_phy_hci.h"
-#include "crc16.h"
-#include "nrf_soc.h"
-
-#include "ser_phy_debug_comm.h"
-
-static bool m_flag_nohci_init = false;
-static bool m_flag_expect_ack;
-static bool m_flag_buffer_reqested = false;
-
-static uint16_t  m_rx_packet_length;
-static uint8_t * m_p_rx_packet;
-
-static uint16_t  m_rx_pending_packet_length;
-static uint8_t * m_p_rx_pending_packet;
-
-static uint16_t  m_rx_allocated_packet_length;
-static uint8_t * m_p_rx_allocated_packet;
-
-static uint8_t * m_p_tx_packet = NULL;
-static uint16_t  m_tx_packet_length;
-
-static ser_phy_events_handler_t m_ser_phy_callback = NULL;
-
-#define PKT_HDR_SIZE 4 /**< Packet header size in number of bytes. */
-#define PKT_CRC_SIZE 2 /**< Packet CRC size in number of bytes. */
-
-static void ser_phy_nohci_assert(bool cond)
-{
-    APP_ERROR_CHECK_BOOL(cond);
-}
-
-
-static void ser_phy_event_callback(ser_phy_evt_t event)
-{
-    if (m_ser_phy_callback)
-    {
-        m_ser_phy_callback(event);
-    }
-}
-
-
-static void memory_request_callback(uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_BUF_REQUEST(0);
-
-    event.evt_type                               = SER_PHY_EVT_RX_BUF_REQUEST;
-    event.evt_params.rx_buf_request.num_of_bytes = size;
-    ser_phy_event_callback(event);
-}
-
-
-static void packet_received_callback(uint8_t * pBuffer, uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_RX_PKT_RECEIVED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-    event.evt_params.rx_pkt_received.num_of_bytes = size;
-    event.evt_params.rx_pkt_received.p_buffer     = pBuffer;
-    ser_phy_event_callback(event);
-}
-
-
-static void packet_dropped_callback(void)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_RX_PKT_DROPPED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-    ser_phy_event_callback(event);
-}
-
-
-static void packet_transmitted_callback(void)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_HCI_PHY_EVT_TX_PKT_SENT(0);
-
-    event.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    ser_phy_event_callback(event);
-}
-
-
-static void hci_slip_event_handler(ser_phy_hci_slip_evt_t * p_event)
-{
-    if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_SENT )
-    {
-        DEBUG_EVT_SLIP_PACKET_TXED(0);
-
-        if (!m_flag_expect_ack)
-        {
-            m_p_tx_packet = NULL;
-            packet_transmitted_callback();
-        }
-        else
-        {
-            ser_phy_nohci_assert(false); // packet was send as a ACK packet, callback should be with ACK_SENT
-        }
-
-    }
-    else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_ACK_SENT )
-    {
-        DEBUG_EVT_SLIP_ACK_TXED(0);
-
-        if (m_flag_expect_ack)
-        {
-            m_p_tx_packet = NULL;
-            packet_transmitted_callback();
-        }
-        else
-        {
-            ser_phy_nohci_assert(false); // packet was send as a normal packet, callback should be with PKT_SENT
-        }
-
-    }
-    else if ( p_event->evt_type == SER_PHY_HCI_SLIP_EVT_PKT_RECEIVED )
-    {
-        CRITICAL_REGION_ENTER();
-
-        if (m_p_rx_packet == NULL)
-        {
-            m_p_rx_packet                = p_event->evt_params.received_pkt.p_buffer;
-            m_rx_packet_length           = p_event->evt_params.received_pkt.num_of_bytes;
-            m_p_rx_allocated_packet      = m_p_rx_packet;
-            m_rx_allocated_packet_length = m_rx_packet_length;
-            m_flag_buffer_reqested       = true;
-            memory_request_callback(m_rx_allocated_packet_length);
-        }
-        else if (m_p_rx_pending_packet == NULL)
-        {
-            m_p_rx_pending_packet      = p_event->evt_params.received_pkt.p_buffer;
-            m_rx_pending_packet_length = p_event->evt_params.received_pkt.num_of_bytes;
-        }
-        else
-        {
-            // both buffers are not released; this is fault
-            ser_phy_nohci_assert(false);
-        }
-        CRITICAL_REGION_EXIT();
-    }
-    else
-    {
-        // no other callbacks are expected
-        ser_phy_nohci_assert(false);
-    }
-}
-
-
-/* ser_phy API function */
-void ser_phy_interrupts_enable(void)
-{
-
-    NVIC_EnableIRQ(UART0_IRQn);
-    return;
-}
-
-
-/* ser_phy API function */
-void ser_phy_interrupts_disable(void)
-{
-    NVIC_DisableIRQ(UART0_IRQn);
-    return;
-}
-
-
-/* ser_phy API function */
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    uint32_t status = NRF_SUCCESS;
-
-    if (m_flag_buffer_reqested)
-    {
-        m_flag_buffer_reqested = false;
-
-        if (p_buffer)
-        {
-            memcpy(p_buffer, m_p_rx_allocated_packet, m_rx_allocated_packet_length);
-            packet_received_callback(p_buffer, m_rx_allocated_packet_length);
-        }
-        else
-        {
-            packet_dropped_callback();
-        }
-
-        CRITICAL_REGION_ENTER();
-
-        if (m_p_rx_allocated_packet == m_p_rx_packet && (m_p_rx_pending_packet == NULL))
-        {
-            // packet is copied and there is no pending packet
-            (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet);
-            m_p_rx_packet           = NULL;
-            m_p_rx_allocated_packet = NULL;
-        }
-        else if (m_p_rx_allocated_packet == m_p_rx_packet && (m_p_rx_pending_packet != NULL))
-        {
-            // there is a pending packet - request memory for it
-            m_p_rx_allocated_packet      = m_p_rx_pending_packet;
-            m_rx_allocated_packet_length = m_rx_pending_packet_length;
-            m_flag_buffer_reqested       = true;
-        }
-        else if (m_p_rx_allocated_packet == m_p_rx_pending_packet )
-        {
-            // the pending packet was serviced - release both
-            m_p_rx_allocated_packet = NULL;
-            (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_packet);
-            m_p_rx_packet = NULL;
-            (void) ser_phy_hci_slip_rx_buf_free(m_p_rx_pending_packet);
-            m_p_rx_pending_packet = NULL;
-        }
-        else
-        {
-            // no other calls are expected
-            ser_phy_nohci_assert(false);
-        }
-        CRITICAL_REGION_EXIT();
-
-        // request memory for a pending
-        if (m_p_rx_allocated_packet)
-        {
-            memory_request_callback(m_rx_allocated_packet_length);
-        }
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-    return status;
-}
-
-
-/* ser_phy API function */
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    uint32_t status = NRF_SUCCESS;
-    uint32_t err_code;
-
-    if ( p_buffer == NULL || num_of_bytes == 0)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    if ( m_p_tx_packet == NULL)
-    {
-        m_tx_packet_length = num_of_bytes;
-        m_p_tx_packet      = (uint8_t *)p_buffer;
-
-        if (m_tx_packet_length <= PKT_HDR_SIZE + PKT_CRC_SIZE)
-        {
-            ser_phy_hci_pkt_params_t pkt; // all packets smaller than 6 goes as ACK
-
-            m_flag_expect_ack = true;
-            pkt.p_buffer      = (uint8_t *)m_p_tx_packet;
-            pkt.num_of_bytes  = m_tx_packet_length;
-            DEBUG_EVT_SLIP_ACK_TX(0);
-            err_code = ser_phy_hci_slip_tx_pkt_send(&pkt, NULL, NULL); // this will look like ACK for slip
-            ser_phy_nohci_assert(err_code == NRF_SUCCESS);
-        }
-        else
-        {
-            ser_phy_hci_pkt_params_t header;  // this is fake header - just first 4 bytes
-            ser_phy_hci_pkt_params_t crc;     // this is fake header - just last 2 bytes
-            ser_phy_hci_pkt_params_t payload; // this is fake payload - all except for header and crc
-
-            m_flag_expect_ack    = false;
-            header.p_buffer      = (uint8_t *)m_p_tx_packet;
-            header.num_of_bytes  = PKT_HDR_SIZE;
-            crc.p_buffer         = (uint8_t *)m_p_tx_packet + m_tx_packet_length - PKT_CRC_SIZE;
-            crc.num_of_bytes     = PKT_CRC_SIZE;
-            payload.p_buffer     = (uint8_t *)m_p_tx_packet + PKT_HDR_SIZE;
-            payload.num_of_bytes = m_tx_packet_length - PKT_HDR_SIZE - PKT_CRC_SIZE;
-            DEBUG_EVT_SLIP_PACKET_TX(0);
-            err_code = ser_phy_hci_slip_tx_pkt_send(&header, &payload, &crc); // this will look like normal packet for slip
-            ser_phy_nohci_assert(err_code == NRF_SUCCESS);
-        }
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-
-    return status;
-}
-
-
-/* ser_phy API function */
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    uint32_t err_code;
-
-    if (m_flag_nohci_init)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-    err_code = ser_phy_hci_slip_open(hci_slip_event_handler);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    m_ser_phy_callback = events_handler;
-    m_flag_nohci_init  = true;
-    return NRF_SUCCESS;
-}
-
-
-/* ser_phy API function */
-void ser_phy_close(void)
-{
-    m_ser_phy_callback = NULL;
-    ser_phy_hci_slip_close();
-    m_flag_nohci_init = false;
-}
-
-

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/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c
deleted file mode 100644
index 6bae1a8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_nrf_drv_spi.c
+++ /dev/null
@@ -1,784 +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 ser_phy_spi_phy_driver_master ser_phy_nrf51_spi_master.c
- * @{
- * @ingroup ser_phy_spi_phy_driver_master
- *
- * @brief SPI_RAW PHY master driver.
- */
-
-#include <stdio.h>
-#include "nrf_drv_gpiote.h"
-#include "nrf_drv_spi.h"
-#include "ser_phy.h"
-#include "ser_config.h"
-#include "app_util.h"
-#include "app_util_platform.h"
-#include "app_error.h"
-#include "nrf_error.h"
-#include "nrf_gpio.h"
-#include "nrf_gpiote.h"
-#include "boards.h"
-#include "app_error.h"
-#include "ser_phy_config_app_nrf51.h"
-#include "ser_phy_debug_app.h"
-
-#define notUSE_PendSV
-
-#ifdef USE_PendSV
-
-#define SW_IRQn              PendSV_IRQn
-#define SW_IRQ_Handler()     PendSV_Handler()
-#define SET_Pend_SW_IRQ()    SCB->ICSR = SCB->ICSR | SCB_ICSR_PENDSVSET_Msk //NVIC_SetPendingIRQ(PendSV_IRQn) -  PendSV_IRQn is a negative - does not work with CMSIS
-
-#else
-
-#ifdef NRF51
-#define SW_IRQn              SWI3_IRQn
-#define SW_IRQ_Handler()     SWI3_IRQHandler()
-#define SET_Pend_SW_IRQ()    NVIC_SetPendingIRQ(SWI3_IRQn)
-#elif defined NRF52
-#define SW_IRQn              SWI3_EGU3_IRQn
-#define SW_IRQ_Handler()     SWI3_EGU3_IRQHandler()
-#define SET_Pend_SW_IRQ()    NVIC_SetPendingIRQ(SWI3_EGU3_IRQn)
-#endif /* NRF51 */
-
-#endif /* USE_PendSV */
-
-typedef enum
-{
-    SER_PHY_STATE_IDLE = 0,
-    SER_PHY_STATE_TX_HEADER,
-    SER_PHY_STATE_TX_WAIT_FOR_RDY,
-    SER_PHY_STATE_TX_PAYLOAD,
-    SER_PHY_STATE_RX_WAIT_FOR_RDY,
-    SER_PHY_STATE_TX_ZERO_HEADER,
-    SER_PHY_STATE_RX_HEADER,
-    SER_PHY_STATE_MEMORY_REQUEST,
-    SER_PHY_STATE_RX_PAYLOAD,
-    SER_PHY_STATE_DISABLED
-} ser_phy_spi_master_state_t;
-
-typedef enum
-{
-    SER_PHY_EVT_GPIO_RDY = 0,
-    SER_PHY_EVT_GPIO_REQ,
-    SER_PHY_EVT_SPI_TRANSFER_DONE,
-    SER_PHY_EVT_TX_API_CALL,
-    SER_PHY_EVT_RX_API_CALL
-} ser_phy_event_source_t;
-
-#define _static static
-
-_static uint8_t * mp_tx_buffer = NULL;
-_static uint16_t  m_tx_buf_len = 0;
-
-_static uint8_t * mp_rx_buffer = NULL;
-_static uint16_t  m_rx_buf_len = 0;
-_static uint8_t   m_frame_buffer[SER_PHY_SPI_MTU_SIZE];
-_static uint8_t   m_header_buffer[SER_PHY_HEADER_SIZE] = { 0 };
-
-_static uint16_t m_tx_packet_length             = 0;
-_static uint16_t m_accumulated_tx_packet_length = 0;
-_static uint16_t m_current_tx_packet_length     = 0;
-
-_static uint16_t m_rx_packet_length             = 0;
-_static uint16_t m_accumulated_rx_packet_length = 0;
-_static uint16_t m_current_rx_packet_length     = 0;
-
-_static volatile bool m_pend_req_flag    = 0;
-_static volatile bool m_pend_rdy_flag    = 0;
-_static volatile bool m_pend_xfer_flag   = 0;
-_static volatile bool m_pend_rx_api_flag = 0;
-_static volatile bool m_pend_tx_api_flag = 0;
-
-_static volatile bool m_slave_ready_flag   = false;
-_static volatile bool m_slave_request_flag = false;
-
-_static ser_phy_events_handler_t   m_callback_events_handler = NULL;
-_static ser_phy_spi_master_state_t m_spi_master_state        = SER_PHY_STATE_DISABLED;
-
-_static const nrf_drv_spi_t m_spi_master = SER_PHY_SPI_MASTER_INSTANCE;
-
-static void ser_phy_switch_state(ser_phy_event_source_t evt_src);
-
-static void spi_master_raw_assert(bool cond)
-{
-    APP_ERROR_CHECK_BOOL(cond);
-}
-
-void SW_IRQ_Handler()
-{
-    if (m_pend_req_flag)
-    {
-        m_pend_req_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_REQUEST(0);
-        ser_phy_switch_state(SER_PHY_EVT_GPIO_REQ);
-    }
-
-    if (m_pend_rdy_flag)
-    {
-        m_pend_rdy_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_READY(0);
-        ser_phy_switch_state(SER_PHY_EVT_GPIO_RDY);
-    }
-
-    if (m_pend_xfer_flag)
-    {
-        m_pend_xfer_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(0);
-        ser_phy_switch_state(SER_PHY_EVT_SPI_TRANSFER_DONE);
-    }
-
-    if (m_pend_rx_api_flag)
-    {
-        m_pend_rx_api_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0);
-        ser_phy_switch_state(SER_PHY_EVT_RX_API_CALL);
-    }
-
-    if (m_pend_tx_api_flag)
-    {
-        m_pend_tx_api_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0);
-        ser_phy_switch_state(SER_PHY_EVT_TX_API_CALL);
-    }
-}
-
-void ser_phy_spi_master_ready(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
-{
-    if (nrf_gpio_pin_read(pin) == 0)
-    {
-        m_slave_ready_flag = true;
-        m_pend_rdy_flag    = true;
-    }
-    else
-    {
-        m_slave_ready_flag = false;
-    }
-
-    DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE((uint32_t) !m_slave_ready_flag);
-    SET_Pend_SW_IRQ();
-}
-
-void ser_phy_spi_master_request(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
-{
-    if (nrf_gpio_pin_read(pin) == 0)
-    {
-        m_slave_request_flag = true;
-        m_pend_req_flag      = true;
-    }
-    else
-    {
-        m_slave_request_flag = false;
-    }
-
-    DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE((uint32_t) !m_slave_request_flag);
-    SET_Pend_SW_IRQ();
-}
-
-/* Send event SER_PHY_EVT_TX_PKT_SENT */
-static __INLINE void callback_packet_sent()
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_MASTER_PHY_TX_PKT_SENT(0);
-
-    event.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    m_callback_events_handler(event);
-}
-
-/* Send event SER_PHY_EVT_RX_PKT_DROPPED */
-static __INLINE void callback_packet_dropped()
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_DROPPED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-    m_callback_events_handler(event);
-}
-
-/* Send event SER_PHY_EVT_RX_PKT_RECEIVED */
-static __INLINE void callback_packet_received()
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_MASTER_PHY_RX_PKT_RECEIVED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-    event.evt_params.rx_pkt_received.p_buffer     = mp_rx_buffer;
-    event.evt_params.rx_pkt_received.num_of_bytes = m_rx_buf_len;
-    m_callback_events_handler(event);
-}
-
-/* Send event SER_PHY_EVT_RX_BUF_REQUEST */
-static __INLINE void callback_mem_request()
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_MASTER_PHY_BUF_REQUEST(0);
-
-    event.evt_type                               = SER_PHY_EVT_RX_BUF_REQUEST;
-    event.evt_params.rx_buf_request.num_of_bytes = m_rx_buf_len;
-    m_callback_events_handler(event);
-}
-
-/* Release buffer */
-static __INLINE void buffer_release(uint8_t * * const pp_buffer,
-                                    uint16_t * const  p_buf_len)
-{
-    *pp_buffer = NULL;
-    *p_buf_len = 0;
-}
-
-/* Function computes current packet length */
-static uint16_t compute_current_packet_length(const uint16_t packet_length,
-                                              const uint16_t accumulated_packet_length)
-{
-    uint16_t current_packet_length = packet_length - accumulated_packet_length;
-
-    if (current_packet_length > SER_PHY_SPI_MTU_SIZE)
-    {
-        current_packet_length = SER_PHY_SPI_MTU_SIZE;
-    }
-
-    return current_packet_length;
-}
-
-static __INLINE uint32_t header_send(const uint16_t length)
-{
-    uint8_t buf_len_size = uint16_encode(length, m_header_buffer);
-
-    return nrf_drv_spi_transfer(&m_spi_master, m_header_buffer, buf_len_size, NULL, 0);
-}
-
-
-static __INLINE uint32_t frame_send()
-{
-    uint32_t err_code;
-
-    m_current_tx_packet_length = compute_current_packet_length(m_tx_packet_length,
-                                                               m_accumulated_tx_packet_length);
-    err_code                   =
-        nrf_drv_spi_transfer(&m_spi_master,
-                             &mp_tx_buffer[m_accumulated_tx_packet_length],
-                             m_current_tx_packet_length,
-                             NULL,
-                             0);
-    m_accumulated_tx_packet_length += m_current_tx_packet_length;
-    return err_code;
-}
-
-static __INLINE uint32_t header_get()
-{
-    return nrf_drv_spi_transfer(&m_spi_master, NULL, 0, m_header_buffer, SER_PHY_HEADER_SIZE);
-}
-
-static __INLINE uint32_t frame_get()
-{
-    uint32_t err_code;
-
-    m_current_rx_packet_length = compute_current_packet_length(m_rx_packet_length,
-                                                               m_accumulated_rx_packet_length);
-
-    if (mp_rx_buffer)
-    {
-        err_code = nrf_drv_spi_transfer(&m_spi_master,
-                                        NULL,
-                                        0,
-                                        &(mp_rx_buffer[m_accumulated_rx_packet_length]),
-                                        m_current_rx_packet_length);
-    }
-    else
-    {
-        err_code = nrf_drv_spi_transfer(&m_spi_master,
-                                        NULL,
-                                        0,
-                                        m_frame_buffer,
-                                        m_current_rx_packet_length);
-    }
-    return err_code;
-}
-
-
-/**
- * \brief Master driver main state machine
- * Executed only in the context of PendSV_Handler()
- * For UML graph, please refer to SDK documentation
-*/
-static void ser_phy_switch_state(ser_phy_event_source_t evt_src)
-{
-    uint32_t    err_code           = NRF_SUCCESS;
-    static bool m_wait_for_ready_flag = false; //local scheduling flag to defer RDY events
-
-    switch (m_spi_master_state)
-    {
-
-        case SER_PHY_STATE_IDLE:
-
-            if (evt_src == SER_PHY_EVT_GPIO_REQ)
-            {
-                m_wait_for_ready_flag = false;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                    err_code           = header_send(0);
-                }
-                else
-                {
-                    m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY;
-                }
-            }
-            else if (evt_src == SER_PHY_EVT_TX_API_CALL)
-            {
-                spi_master_raw_assert(mp_tx_buffer != NULL); //api event with tx_buffer == NULL has no sense
-                m_wait_for_ready_flag = false;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_HEADER;
-                    err_code           = header_send(m_tx_buf_len);
-                }
-                else
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY;
-                }
-            }
-            break;
-
-        case SER_PHY_STATE_TX_WAIT_FOR_RDY:
-
-            if (evt_src == SER_PHY_EVT_GPIO_RDY)
-            {
-                m_spi_master_state = SER_PHY_STATE_TX_HEADER;
-                err_code           = header_send(m_tx_buf_len);
-            }
-            break;
-
-        case SER_PHY_STATE_RX_WAIT_FOR_RDY:
-
-            if (evt_src == SER_PHY_EVT_GPIO_RDY)
-            {
-                m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                err_code           = header_send(0);
-
-            }
-            break;
-
-        case SER_PHY_STATE_TX_HEADER:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                m_tx_packet_length             = m_tx_buf_len;
-                m_accumulated_tx_packet_length = 0;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD;
-                    err_code           = frame_send();
-
-                }
-                else
-                {
-                    m_wait_for_ready_flag = true;
-                }
-            }
-            else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag)
-            {
-                m_wait_for_ready_flag = false;
-                m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD;
-                err_code           = frame_send();
-            }
-
-            break;
-
-        case SER_PHY_STATE_TX_PAYLOAD:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                if (m_accumulated_tx_packet_length < m_tx_packet_length)
-                {
-                    if (m_slave_ready_flag)
-                    {
-                        err_code = frame_send();
-                    }
-                    else
-                    {
-                        m_wait_for_ready_flag = true;
-                    }
-                }
-                else
-                {
-                    spi_master_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length);
-                    buffer_release(&mp_tx_buffer, &m_tx_buf_len);
-                    callback_packet_sent();
-                    if ( m_slave_request_flag)
-                    {
-                        if (m_slave_ready_flag)
-                        {
-                            m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                            err_code           = header_send(0);
-                        }
-                        else
-                        {
-                            m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY;
-                        }
-                    }
-                    else
-                    {
-                        m_spi_master_state = SER_PHY_STATE_IDLE; //m_Tx_buffer is NULL - have to wait for API event
-                    }
-                }
-            }
-            else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag )
-            {
-                m_wait_for_ready_flag = false;
-                err_code           = frame_send();
-            }
-
-            break;
-
-        case SER_PHY_STATE_TX_ZERO_HEADER:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_RX_HEADER;
-                    err_code           = header_get();
-                }
-                else
-                {
-                    m_wait_for_ready_flag = true;
-                }
-            }
-            else if ( (evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag)
-            {
-                m_wait_for_ready_flag = false;
-                m_spi_master_state = SER_PHY_STATE_RX_HEADER;
-                err_code           = header_get();
-            }
-            break;
-
-        case SER_PHY_STATE_RX_HEADER:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                m_spi_master_state = SER_PHY_STATE_MEMORY_REQUEST;
-                m_rx_buf_len       = uint16_decode(m_header_buffer);
-                m_rx_packet_length = m_rx_buf_len;
-                callback_mem_request();
-
-            }
-            break;
-
-        case SER_PHY_STATE_MEMORY_REQUEST:
-
-            if (evt_src == SER_PHY_EVT_RX_API_CALL)
-            {
-                m_accumulated_rx_packet_length = 0;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD;
-                    err_code           = frame_get();
-                }
-                else
-                {
-                    m_wait_for_ready_flag = true;
-                }
-            }
-            else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_wait_for_ready_flag)
-            {
-                m_wait_for_ready_flag = false;
-                m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD;
-                err_code           = frame_get();
-            }
-            break;
-
-        case SER_PHY_STATE_RX_PAYLOAD:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                m_accumulated_rx_packet_length += m_current_rx_packet_length;
-
-                if (m_accumulated_rx_packet_length < m_rx_packet_length)
-                {
-                    if (m_slave_ready_flag)
-                    {
-                        err_code = frame_get();
-                    }
-                    else
-                    {
-                        m_wait_for_ready_flag = true;
-                    }
-                }
-                else
-                {
-                    spi_master_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length);
-
-                    if (mp_rx_buffer == NULL)
-                    {
-                        callback_packet_dropped();
-                    }
-                    else
-                    {
-                        callback_packet_received();
-                    }
-                    buffer_release(&mp_rx_buffer, &m_rx_buf_len);
-                    if (mp_tx_buffer != NULL) //mp_tx_buffer !=NULL, this means that API_EVT was scheduled
-                    {
-                        if (m_slave_ready_flag )
-                        {
-                            err_code           = header_send(m_tx_buf_len);
-                            m_spi_master_state = SER_PHY_STATE_TX_HEADER;
-                        }
-                        else
-                        {
-                            m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY;
-                        }
-                    }
-                    else if (m_slave_request_flag)
-                    {
-                        if (m_slave_ready_flag)
-                        {
-                            m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                            err_code           = header_send(0);
-                        }
-                        else
-                        {
-                            m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY;
-                        }
-                    }
-                    else
-                    {
-                        m_spi_master_state = SER_PHY_STATE_IDLE;
-
-                    }
-                }
-
-            }
-            else if ( evt_src == SER_PHY_EVT_GPIO_RDY && m_wait_for_ready_flag)
-            {
-                m_wait_for_ready_flag = false;
-                err_code           = frame_get();
-            }
-            break;
-
-        default:
-            break;
-    }
-
-    if (err_code != NRF_SUCCESS)
-    {
-        (void)err_code;
-    }
-}
-
-static void ser_phy_spi_master_event_handler(nrf_drv_spi_evt_t const * p_event)
-{
-    switch (p_event->type)
-    {
-        case NRF_DRV_SPI_EVENT_DONE:
-
-            /* Switch state */
-            m_pend_xfer_flag = true;
-            SET_Pend_SW_IRQ();
-
-            break;
-
-        default:
-            break;
-    }
-}
-
-static __INLINE void ser_phy_init_PendSV()
-{
-    NVIC_SetPriority(SW_IRQn, APP_IRQ_PRIORITY_MID);
-    NVIC_EnableIRQ(SW_IRQn);
-}
-
-static __INLINE void ser_phy_init_gpio()
-{
-    nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, NRF_GPIO_PIN_PULLUP);
-    nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, NRF_GPIO_PIN_PULLUP);
-}
-
-static __INLINE ret_code_t ser_phy_init_gpiote()
-{
-    if (!nrf_drv_gpiote_is_init())
-    {
-        (void)nrf_drv_gpiote_init();
-    }
-    m_slave_request_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST));
-    m_slave_ready_flag   = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_READY));
-
-    nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
-    /* Enable pullup to ensure high state while connectivity device is reset */
-    config.pull = NRF_GPIO_PIN_PULLUP;
-    ret_code_t err_code = nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, &config, ser_phy_spi_master_request);
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-    nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST,true);
-
-    err_code = nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, &config, ser_phy_spi_master_ready);
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-    nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_READY,true);
-
-    NVIC_ClearPendingIRQ(SW_IRQn);
-
-    return NRF_SUCCESS;
-}
-
-static __INLINE void ser_phy_deinit_gpiote()
-{
-    nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST);
-    nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_READY);
-
-//    (void)app_gpiote_end_irq_event_handler_unregister();
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    if (num_of_bytes == 0)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (mp_tx_buffer != NULL)
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    //ser_phy_interrupts_disable();
-    CRITICAL_REGION_ENTER();
-    mp_tx_buffer       = (uint8_t *)p_buffer;
-    m_tx_buf_len       = num_of_bytes;
-    m_pend_tx_api_flag = true;
-    SET_Pend_SW_IRQ();
-    //ser_phy_interrupts_enable();
-    CRITICAL_REGION_EXIT();
-
-    return NRF_SUCCESS;
-}
-/* ser_phy API function */
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    if (m_spi_master_state != SER_PHY_STATE_MEMORY_REQUEST)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    //ser_phy_interrupts_disable();
-    CRITICAL_REGION_ENTER();
-    mp_rx_buffer       = p_buffer;
-    m_pend_rx_api_flag = true;
-    SET_Pend_SW_IRQ();
-    //ser_phy_interrupts_enable();
-    CRITICAL_REGION_EXIT();
-
-    return NRF_SUCCESS;
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    if (m_spi_master_state != SER_PHY_STATE_DISABLED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    uint32_t err_code = NRF_SUCCESS;
-
-    m_spi_master_state        = SER_PHY_STATE_IDLE;
-    m_callback_events_handler = events_handler;
-    nrf_drv_spi_config_t spi_master_config = {
-        .sck_pin      = SER_PHY_SPI_MASTER_PIN_SCK,
-        .mosi_pin     = SER_PHY_SPI_MASTER_PIN_MOSI,
-        .miso_pin     = SER_PHY_SPI_MASTER_PIN_MISO,
-        .ss_pin       = SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT,
-        .irq_priority = APP_IRQ_PRIORITY_MID,
-        .orc          = 0,
-        .frequency    = SER_PHY_SPI_FREQUENCY,
-        .mode         = NRF_DRV_SPI_MODE_0,
-        .bit_order    = NRF_DRV_SPI_BIT_ORDER_LSB_FIRST,
-    };
-    err_code = nrf_drv_spi_init(&m_spi_master, &spi_master_config,
-        ser_phy_spi_master_event_handler);
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-
-    ser_phy_init_gpio();
-    err_code = ser_phy_init_gpiote();
-    ser_phy_init_PendSV();
-    return err_code;
-}
-
-/* ser_phy API function */
-void ser_phy_close(void)
-{
-    m_spi_master_state = SER_PHY_STATE_DISABLED;
-
-    m_callback_events_handler = NULL;
-
-    buffer_release(&mp_tx_buffer, &m_tx_buf_len);
-    buffer_release(&mp_rx_buffer, &m_rx_buf_len);
-
-    m_tx_packet_length             = 0;
-    m_accumulated_tx_packet_length = 0;
-    m_current_tx_packet_length     = 0;
-
-    m_rx_packet_length             = 0;
-    m_accumulated_rx_packet_length = 0;
-    m_current_rx_packet_length     = 0;
-
-    ser_phy_deinit_gpiote();
-    nrf_drv_spi_uninit(&m_spi_master);
-}
-
-/* ser_phy API function */
-/* only PendSV may interact with ser_phy layer, other interrupts are internal */
-void ser_phy_interrupts_enable(void)
-{
-    NVIC_EnableIRQ(SW_IRQn);
-}
-
-/* ser_phy API function */
-void ser_phy_interrupts_disable(void)
-{
-    NVIC_DisableIRQ(SW_IRQn);
-}
-
-/** @} */

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/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c
deleted file mode 100644
index 2b103c5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_master.c
+++ /dev/null
@@ -1,803 +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 ser_phy_spi_5W_phy_driver_master ser_phy_nrf51_spi_5W_master.c
- * @{
- * @ingroup ser_phy_spi_5W_phy_driver_master
- *
- * @brief SPI_5W_RAW PHY master driver.
- */
-
-#include <stdio.h>
-#include "app_util.h"
-#include "app_util_platform.h"
-#include "boards.h"
-#include "nrf_error.h"
-#include "nrf_gpio.h"
-#include "nrf_drv_gpiote.h"
-#include "ser_config.h"
-#include "ser_config_5W_app.h"
-#include "ser_phy.h"
-#include "ser_phy_config_app_nrf51.h"
-#include "spi_5W_master.h"
-#include "ser_phy_debug_app.h"
-#include "app_error.h"
-#define notUSE_PendSV
-
-#ifdef USE_PendSV
-#define SW_IRQn              PendSV_IRQn
-#define SW_IRQ_Handler()     PendSV_Handler()
-#define SET_Pend_SW_IRQ()    SCB->ICSR = SCB->ICSR | SCB_ICSR_PENDSVSET_Msk //NVIC_SetPendingIRQ(PendSV_IRQn) -  PendSV_IRQn is a negative - does not work with CMSIS
-#else
-#define SW_IRQn              SWI3_IRQn
-#define SW_IRQ_Handler()     SWI3_IRQHandler()
-#define SET_Pend_SW_IRQ()    NVIC_SetPendingIRQ(SWI3_IRQn)
-#endif
-
-#define SER_PHY_SPI_5W_MTU_SIZE SER_PHY_SPI_MTU_SIZE
-
-typedef enum
-{
-    SER_PHY_STATE_IDLE = 0,
-    SER_PHY_STATE_TX_HEADER,
-    SER_PHY_STATE_TX_WAIT_FOR_RDY,
-    SER_PHY_STATE_TX_PAYLOAD,
-    SER_PHY_STATE_RX_WAIT_FOR_RDY,
-    SER_PHY_STATE_TX_ZERO_HEADER,
-    SER_PHY_STATE_RX_HEADER,
-    SER_PHY_STATE_MEMORY_REQUEST,
-    SER_PHY_STATE_RX_PAYLOAD,
-    SER_PHY_STATE_DISABLED
-} ser_phy_spi_master_state_t;
-
-typedef enum
-{
-    SER_PHY_EVT_GPIO_RDY = 0,
-    SER_PHY_EVT_GPIO_REQ,
-    SER_PHY_EVT_SPI_TRANSFER_DONE,
-    SER_PHY_EVT_TX_API_CALL,
-    SER_PHY_EVT_RX_API_CALL
-} ser_phy_event_source_t;
-
-#define _static static
-
-_static uint8_t * mp_tx_buffer = NULL;
-_static uint16_t  m_tx_buf_len = 0;
-
-_static uint8_t * mp_rx_buffer = NULL;
-_static uint16_t  m_rx_buf_len = 0;
-_static uint8_t   m_recv_buffer[SER_PHY_SPI_5W_MTU_SIZE];
-_static uint8_t   m_len_buffer[SER_PHY_HEADER_SIZE + 1] = { 0 }; //len is asymmetric for 5W, there is a 1 byte guard when receiving
-
-_static uint16_t m_tx_packet_length             = 0;
-_static uint16_t m_accumulated_tx_packet_length = 0;
-_static uint16_t m_current_tx_packet_length     = 0;
-
-_static uint16_t m_rx_packet_length             = 0;
-_static uint16_t m_accumulated_rx_packet_length = 0;
-_static uint16_t m_current_rx_packet_length     = 0;
-
-_static volatile bool m_pend_req_flag    = 0;
-_static volatile bool m_pend_rdy_flag    = 0;
-_static volatile bool m_pend_xfer_flag   = 0;
-_static volatile bool m_pend_rx_api_flag = 0;
-_static volatile bool m_pend_tx_api_flag = 0;
-
-_static volatile bool m_slave_ready_flag   = false;
-_static volatile bool m_slave_request_flag = false;
-
-
-_static ser_phy_events_handler_t   m_callback_events_handler = NULL;
-_static ser_phy_spi_master_state_t m_spi_master_state        = SER_PHY_STATE_DISABLED;
-
-static void ser_phy_switch_state(ser_phy_event_source_t evt_src);
-
-static void spi_master_raw_assert(bool cond)
-{
-    APP_ERROR_CHECK_BOOL(cond);
-}
-
-void SW_IRQ_Handler()
-{
-    if (m_pend_req_flag)
-    {
-        m_pend_req_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_REQUEST(0);
-        ser_phy_switch_state(SER_PHY_EVT_GPIO_REQ);
-    }
-
-    if (m_pend_rdy_flag)
-    {
-        m_pend_rdy_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_READY(0);
-        ser_phy_switch_state(SER_PHY_EVT_GPIO_RDY);
-    }
-
-    if (m_pend_xfer_flag)
-    {
-        m_pend_xfer_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_XFER_DONE(0);
-        ser_phy_switch_state(SER_PHY_EVT_SPI_TRANSFER_DONE);
-    }
-
-    if (m_pend_rx_api_flag)
-    {
-        m_pend_rx_api_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0);
-        ser_phy_switch_state(SER_PHY_EVT_RX_API_CALL);
-    }
-
-    if (m_pend_tx_api_flag)
-    {
-        m_pend_tx_api_flag = false;
-        DEBUG_EVT_SPI_MASTER_RAW_API_CALL(0);
-        ser_phy_switch_state(SER_PHY_EVT_TX_API_CALL);
-    }
-
-}
-
-void ser_phy_spi_master_ready(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
-{
-
-#ifdef _SPI_5W_
-      //For 5W slave is considered to be always READY
-      m_slave_ready_flag = true;
-      m_pend_rdy_flag  = false;
- #else
-      if (nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_READY) == 0)
-      {
-          m_slave_ready_flag = true;
-          m_pend_rdy_flag    = true;
-      }
-      else
-      {
-          m_slave_ready_flag = false;
-      }
-
-      DEBUG_EVT_SPI_MASTER_RAW_READY_EDGE((uint32_t) !m_slave_ready_flag);
-#endif
-
-}
-
-void ser_phy_spi_master_request(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
-{
-    if (nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST) == 0)
-    {
-        m_slave_request_flag = true;
-        m_pend_req_flag      = true;
-    }
-    else
-    {
-        m_slave_request_flag = false;
-    }
-
-    DEBUG_EVT_SPI_MASTER_RAW_REQUEST_EDGE((uint32_t) !m_slave_request_flag);
-    SET_Pend_SW_IRQ();
-}
-
-/* Send event SER_PHY_EVT_TX_PKT_SENT */
-static __INLINE void callback_packet_sent()
-{
-    ser_phy_evt_t event;
-
-    event.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    m_callback_events_handler(event);
-}
-
-/* Send event SER_PHY_EVT_RX_PKT_DROPPED */
-static __INLINE void callback_packet_dropped()
-{
-    ser_phy_evt_t event;
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-    m_callback_events_handler(event);
-}
-
-/* Send event SER_PHY_EVT_RX_PKT_RECEIVED */
-static __INLINE void callback_packet_received()
-{
-    ser_phy_evt_t event;
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-    event.evt_params.rx_pkt_received.p_buffer     = mp_rx_buffer;
-    event.evt_params.rx_pkt_received.num_of_bytes = m_rx_buf_len;
-    m_callback_events_handler(event);
-}
-
-/* Send event SER_PHY_EVT_RX_BUF_REQUEST */
-static __INLINE void callback_mem_request()
-{
-    ser_phy_evt_t event;
-
-    event.evt_type                               = SER_PHY_EVT_RX_BUF_REQUEST;
-    event.evt_params.rx_buf_request.num_of_bytes = m_rx_buf_len;
-    m_callback_events_handler(event);
-}
-
-static __INLINE void copy_buff(uint8_t * const p_dest, uint8_t const * const p_src, uint16_t len)
-{
-    uint16_t index;
-
-    for (index = 0; index < len; index++)
-    {
-        p_dest[index] = p_src[index];
-    }
-    return;
-}
-
-static __INLINE void buffer_release(uint8_t * * const pp_buffer, uint16_t * const p_buf_len)
-{
-    *pp_buffer = NULL;
-    *p_buf_len = 0;
-}
-
-static uint16_t compute_current_packet_length(const uint16_t packet_length,
-                                              const uint16_t accumulated_packet_length)
-{
-    uint16_t current_packet_length = packet_length - accumulated_packet_length;
-
-    if (current_packet_length > SER_PHY_SPI_5W_MTU_SIZE)
-    {
-        current_packet_length = SER_PHY_SPI_5W_MTU_SIZE;
-    }
-
-    return current_packet_length;
-}
-
-static __INLINE uint32_t header_send(const uint16_t length)
-{
-    uint16_t buf_len_size = uint16_encode(length, m_len_buffer);
-
-    return spi_master_send_recv(SER_PHY_SPI_MASTER, m_len_buffer, buf_len_size, NULL, 0);
-}
-
-static __INLINE uint32_t frame_send()
-{
-    uint32_t err_code;
-
-    m_current_tx_packet_length = compute_current_packet_length(m_tx_packet_length,
-                                                               m_accumulated_tx_packet_length);
-    err_code                   =
-        spi_master_send_recv(SER_PHY_SPI_MASTER,
-                             &mp_tx_buffer[m_accumulated_tx_packet_length],
-                             m_current_tx_packet_length,
-                             NULL,
-                             0);
-    m_accumulated_tx_packet_length += m_current_tx_packet_length;
-    return err_code;
-}
-
-static __INLINE uint32_t header_get()
-{
-    return spi_master_send_recv(SER_PHY_SPI_MASTER, NULL, 0, m_len_buffer, SER_PHY_HEADER_SIZE + 1); //add 0 byte guard when receiving
-}
-
-static __INLINE uint32_t frame_get()
-{
-    uint32_t err_code;
-
-    m_current_rx_packet_length = compute_current_packet_length(m_rx_packet_length,
-                                                               m_accumulated_rx_packet_length);
-
-    if (m_current_rx_packet_length < SER_PHY_SPI_5W_MTU_SIZE)
-    {
-        m_current_rx_packet_length++; //take into account guard byte when receiving
-    }
-    err_code = spi_master_send_recv(SER_PHY_SPI_MASTER,
-                                    NULL,
-                                    0,
-                                    m_recv_buffer,
-                                    m_current_rx_packet_length);
-    return err_code;
-}
-
-/**
- * \brief Master driver main state machine
- * Executed only in the context of PendSV_Handler()
- * For UML graph, please refer to SDK documentation
-*/
-
-static void ser_phy_switch_state(ser_phy_event_source_t evt_src)
-{
-    uint32_t    err_code           = NRF_SUCCESS;
-    static bool m_waitForReadyFlag = false; //local scheduling flag to defer RDY events
-
-    switch (m_spi_master_state)
-    {
-
-        case SER_PHY_STATE_IDLE:
-
-            if (evt_src == SER_PHY_EVT_GPIO_REQ)
-            {
-                m_waitForReadyFlag = false;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                    err_code           = header_send(0);
-                }
-                else
-                {
-                    m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY;
-                }
-            }
-            else if (evt_src == SER_PHY_EVT_TX_API_CALL)
-            {
-                spi_master_raw_assert(mp_tx_buffer != NULL); //api event with tx_buffer == NULL has no sense
-                m_waitForReadyFlag = false;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_HEADER;
-                    err_code           = header_send(m_tx_buf_len);
-                }
-                else
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY;
-                }
-            }
-            break;
-
-        case SER_PHY_STATE_TX_WAIT_FOR_RDY:
-
-            if (evt_src == SER_PHY_EVT_GPIO_RDY)
-            {
-                m_spi_master_state = SER_PHY_STATE_TX_HEADER;
-                err_code           = header_send(m_tx_buf_len);
-            }
-            break;
-
-        case SER_PHY_STATE_RX_WAIT_FOR_RDY:
-
-            if (evt_src == SER_PHY_EVT_GPIO_RDY)
-            {
-                m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                err_code           = header_send(0);
-
-            }
-            break;
-
-        case SER_PHY_STATE_TX_HEADER:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                m_tx_packet_length             = m_tx_buf_len;
-                m_accumulated_tx_packet_length = 0;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD;
-                    err_code           = frame_send();
-
-                }
-                else
-                {
-                    m_waitForReadyFlag = true;
-                }
-            }
-            else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag)
-            {
-                m_waitForReadyFlag = false;
-                m_spi_master_state = SER_PHY_STATE_TX_PAYLOAD;
-                err_code           = frame_send();
-            }
-
-            break;
-
-        case SER_PHY_STATE_TX_PAYLOAD:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                if (m_accumulated_tx_packet_length < m_tx_packet_length)
-                {
-                    if (m_slave_ready_flag)
-                    {
-                        err_code = frame_send();
-                    }
-                    else
-                    {
-                        m_waitForReadyFlag = true;
-                    }
-                }
-                else
-                {
-                    spi_master_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length);
-                    //Release TX buffer
-                    buffer_release(&mp_tx_buffer, &m_tx_buf_len);
-                    callback_packet_sent();
-
-                    if ( m_slave_request_flag)
-                    {
-                        if (m_slave_ready_flag)
-                        {
-                            m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                            err_code           = header_send(0);
-                        }
-                        else
-                        {
-                            m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY;
-                        }
-                    }
-                    else
-                    {
-                        m_spi_master_state = SER_PHY_STATE_IDLE; //m_Tx_buffer is NULL - have to wait for API event
-                    }
-                }
-            }
-            else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag )
-            {
-                m_waitForReadyFlag = false;
-                err_code           = frame_send();
-            }
-
-            break;
-
-        case SER_PHY_STATE_TX_ZERO_HEADER:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_RX_HEADER;
-                    err_code           = header_get();
-                }
-                else
-                {
-                    m_waitForReadyFlag = true;
-                }
-            }
-            else if ( (evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag)
-            {
-                m_waitForReadyFlag = false;
-                m_spi_master_state = SER_PHY_STATE_RX_HEADER;
-                err_code           = header_get();
-            }
-            break;
-
-        case SER_PHY_STATE_RX_HEADER:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                m_spi_master_state = SER_PHY_STATE_MEMORY_REQUEST;
-                m_rx_buf_len       = uint16_decode(&(m_len_buffer[1])); //skip guard when receiving
-                m_rx_packet_length = m_rx_buf_len;
-                callback_mem_request();
-            }
-            break;
-
-        case SER_PHY_STATE_MEMORY_REQUEST:
-
-            if (evt_src == SER_PHY_EVT_RX_API_CALL)
-            {
-                m_accumulated_rx_packet_length = 0;
-
-                if (m_slave_ready_flag)
-                {
-                    m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD;
-                    err_code           = frame_get();
-                }
-                else
-                {
-                    m_waitForReadyFlag = true;
-                }
-            }
-            else if ((evt_src == SER_PHY_EVT_GPIO_RDY) && m_waitForReadyFlag)
-            {
-                m_waitForReadyFlag = false;
-                m_spi_master_state = SER_PHY_STATE_RX_PAYLOAD;
-                err_code           = frame_get();
-            }
-            break;
-
-        case SER_PHY_STATE_RX_PAYLOAD:
-
-            if (evt_src == SER_PHY_EVT_SPI_TRANSFER_DONE)
-            {
-                if (mp_rx_buffer)
-                {
-                    copy_buff(&(mp_rx_buffer[m_accumulated_rx_packet_length]),
-                              &(m_recv_buffer[1]),
-                              m_current_rx_packet_length - 1); //skip guard byte when receiving
-                }
-                m_accumulated_rx_packet_length += (m_current_rx_packet_length - 1);
-
-                if (m_accumulated_rx_packet_length < m_rx_packet_length)
-                {
-                    if (m_slave_ready_flag)
-                    {
-                        err_code = frame_get();
-                    }
-                    else
-                    {
-                        m_waitForReadyFlag = true;
-                    }
-                }
-                else
-                {
-                    spi_master_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length);
-
-                    if (mp_rx_buffer == NULL)
-                    {
-                        callback_packet_dropped();
-                    }
-                    else
-                    {
-                        callback_packet_received();
-                    }
-                    //Release RX buffer
-                    buffer_release(&mp_rx_buffer, &m_rx_buf_len);
-
-                    if ((mp_tx_buffer != NULL)) //mp_tx_buffer !=NULL, this means that API_EVT was scheduled
-                    {
-                        if (m_slave_ready_flag )
-                        {
-                            err_code           = header_send(m_tx_buf_len);
-                            m_spi_master_state = SER_PHY_STATE_TX_HEADER;
-                        }
-                        else
-                        {
-                            m_spi_master_state = SER_PHY_STATE_TX_WAIT_FOR_RDY;
-                        }
-                    }
-                    else if (m_slave_request_flag)
-                    {
-                        if (m_slave_ready_flag)
-                        {
-                            m_spi_master_state = SER_PHY_STATE_TX_ZERO_HEADER;
-                            err_code           = header_send(0);
-                        }
-                        else
-                        {
-                            m_spi_master_state = SER_PHY_STATE_RX_WAIT_FOR_RDY;
-                        }
-                    }
-                    else
-                    {
-                        m_spi_master_state = SER_PHY_STATE_IDLE;
-                    }
-                }
-            }
-            else if ( evt_src == SER_PHY_EVT_GPIO_RDY && m_waitForReadyFlag)
-            {
-                m_waitForReadyFlag = false;
-                err_code           = frame_get();
-            }
-
-
-            break;
-
-        default:
-            break;
-    }
-
-
-    if (err_code != NRF_SUCCESS)
-    {
-        (void)err_code;
-    }
-}
-
-/* SPI master event handler */
-static void ser_phy_spi_master_event_handler(spi_master_evt_t spi_master_evt)
-{
-    switch (spi_master_evt.type)
-    {
-        case SPI_MASTER_EVT_TRANSFER_COMPLETED:
-
-            /* Switch state */
-            m_pend_xfer_flag = true;
-            SET_Pend_SW_IRQ();
-
-            break;
-
-        default:
-            break;
-    }
-}
-
-/* Initialize GPIO */
-static __INLINE void ser_phy_init_gpio()
-{
-    nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, NRF_GPIO_PIN_PULLUP);
-    nrf_gpio_cfg_input(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, NRF_GPIO_PIN_PULLUP);
-}
-
-/* Initialize GPIO */
-static __INLINE void ser_phy_init_pendSV()
-{
-    NVIC_SetPriority(SW_IRQn, APP_IRQ_PRIORITY_MID);
-    NVIC_EnableIRQ(SW_IRQn);
-}
-
-/* Initialize GPIOTE */
-static __INLINE void ser_phy_init_gpiote()
-{
-    if (!nrf_drv_gpiote_is_init())
-    {
-        (void)nrf_drv_gpiote_init();
-    }
-    m_slave_request_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST));
-
-    nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
-    (void)nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST, &config, ser_phy_spi_master_request);
-    nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST,true);
-    m_slave_request_flag = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST));
-
-
-#ifdef _SPI_5W_
-    m_slave_ready_flag     = true;
-
-#else
-    m_slave_ready_flag   = !(nrf_gpio_pin_read(SER_PHY_SPI_MASTER_PIN_SLAVE_READY));
-    (void)nrf_drv_gpiote_in_init(SER_PHY_SPI_MASTER_PIN_SLAVE_READY, &config, ser_phy_spi_master_ready);
-
-    nrf_drv_gpiote_in_event_enable(SER_PHY_SPI_MASTER_PIN_SLAVE_READY,true);
-#endif
-
-    NVIC_ClearPendingIRQ(SW_IRQn);
-}
-
-static __INLINE void ser_phy_deinit_gpiote()
-{
-    nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_REQUEST);
-#ifndef _SPI_5W_
-    nrf_drv_gpiote_in_uninit(SER_PHY_SPI_MASTER_PIN_SLAVE_READY);
-#endif
-
-
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    if (num_of_bytes == 0)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (mp_tx_buffer != NULL)
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    ser_phy_interrupts_disable();
-    mp_tx_buffer       = (uint8_t *)p_buffer;
-    m_tx_buf_len       = num_of_bytes;
-    m_pend_tx_api_flag = true;
-    SET_Pend_SW_IRQ();
-    ser_phy_interrupts_enable();
-    return NRF_SUCCESS;
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    if (m_spi_master_state != SER_PHY_STATE_MEMORY_REQUEST)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    ser_phy_interrupts_disable();
-    mp_rx_buffer       = p_buffer;
-    m_pend_rx_api_flag = true;
-    SET_Pend_SW_IRQ();
-    ser_phy_interrupts_enable();
-    return NRF_SUCCESS;
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-
-    if (m_spi_master_state != SER_PHY_STATE_DISABLED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    uint32_t err_code = NRF_SUCCESS;
-    ser_phy_init_gpio();
-    m_spi_master_state        = SER_PHY_STATE_IDLE;
-    m_callback_events_handler = events_handler;
-    ser_phy_init_gpiote();
-
-    /* Configure SPI Master driver */
-    spi_master_config_t spi_master_config;
-    spi_master_config.SPI_Freq     = SPI_FREQUENCY_FREQUENCY_M1;
-    spi_master_config.SPI_Pin_SCK  = SER_PHY_SPI_MASTER_PIN_SCK;
-    spi_master_config.SPI_Pin_MISO = SER_PHY_SPI_MASTER_PIN_MISO;
-    spi_master_config.SPI_Pin_MOSI = SER_PHY_SPI_MASTER_PIN_MOSI;
-    spi_master_config.SPI_Pin_SS   = SER_PHY_SPI_MASTER_PIN_SLAVE_SELECT;
-    spi_master_config.SPI_ORDER    = SPI_CONFIG_ORDER_LsbFirst;
-    spi_master_config.SPI_CPOL     = SPI_CONFIG_CPOL_ActiveHigh;
-    spi_master_config.SPI_CPHA     = SPI_CONFIG_CPHA_Leading;
-
-    err_code = spi_master_open(SER_PHY_SPI_MASTER, &spi_master_config);
-
-    if (err_code != NRF_SUCCESS)
-    {
-        return err_code;
-    }
-#ifdef _SPI_5W_
-    spi_5W_master_evt_handler_reg(SER_PHY_SPI_MASTER, ser_phy_spi_master_event_handler);
-#else
-    spi_master_evt_handler_reg(SER_PHY_SPI_MASTER, ser_phy_spi_master_event_handler);
-#endif
-    ser_phy_init_pendSV();
-
-    return err_code;
-}
-
-/* ser_phy API function */
-void ser_phy_close(void)
-{
-    m_spi_master_state = SER_PHY_STATE_DISABLED;
-
-    m_callback_events_handler = NULL;
-
-    buffer_release(&mp_tx_buffer, &m_tx_buf_len);
-    buffer_release(&mp_rx_buffer, &m_rx_buf_len);
-    m_tx_packet_length             = 0;
-    m_accumulated_tx_packet_length = 0;
-    m_current_tx_packet_length     = 0;
-    m_rx_packet_length             = 0;
-    m_accumulated_rx_packet_length = 0;
-    m_current_rx_packet_length     = 0;
-    ser_phy_deinit_gpiote();
-    spi_master_close(SER_PHY_SPI_MASTER);
-}
-
-/* ser_phy API function */
-void ser_phy_interrupts_enable(void)
-{
-    NVIC_EnableIRQ(SW_IRQn);
-}
-
-/* ser_phy API function */
-void ser_phy_interrupts_disable(void)
-{
-    NVIC_DisableIRQ(SW_IRQn);
-}
-
-
-#ifdef SER_PHY_DEBUG_APP_ENABLE
-
-static spi_master_raw_callback_t m_spi_master_raw_evt_callback;
-
-void debug_evt(spi_master_raw_evt_type_t evt, uint32_t data)
-{
-    if (m_spi_master_raw_evt_callback)
-    {
-        spi_master_raw_evt_t e;
-        e.evt  = evt;
-        e.data = data;
-        m_spi_master_raw_evt_callback(e);
-    }
-}
-
-void debug_init(spi_master_raw_callback_t spi_master_raw_evt_callback)
-{
-    m_spi_master_raw_evt_callback = spi_master_raw_evt_callback;
-}
-
-#endif
-/** @} */


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

Posted by cc...@apache.org.
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/pwm/nrf_drv_pwm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pwm/nrf_drv_pwm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pwm/nrf_drv_pwm.h
deleted file mode 100644
index a1ffc86..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/pwm/nrf_drv_pwm.h
+++ /dev/null
@@ -1,434 +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_pwm PWM HAL and driver
- * @ingroup    nrf_drivers
- * @brief      @tagAPI52 Pulse Width Modulation (PWM) module APIs.
- *
- * @defgroup   nrf_drv_pwm PWM driver
- * @{
- * @ingroup    nrf_pwm
- * @brief      @tagAPI52 Pulse Width Modulation (PWM) module driver.
- */
-
-
-#ifndef NRF_DRV_PWM_H__
-#define NRF_DRV_PWM_H__
-
-#include "nordic_common.h"
-#include "nrf_drv_config.h"
-#include "nrf_pwm.h"
-#include "sdk_errors.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief PWM driver instance data structure.
- */
-typedef struct
-{
-    NRF_PWM_Type * p_registers;  ///< Pointer to the structure with PWM peripheral instance registers.
-    uint8_t        drv_inst_idx; ///< Driver instance index.
-} nrf_drv_pwm_t;
-
-/**
- * @brief Macro for creating a PWM driver instance.
- */
-#define NRF_DRV_PWM_INSTANCE(id)                        \
-{                                                       \
-    .p_registers  = CONCAT_2(NRF_PWM, id),              \
-    .drv_inst_idx = CONCAT_3(PWM, id, _INSTANCE_INDEX), \
-}
-
-
-/**
- * @brief This value can be provided instead of a pin number for any channel
- *        to specify that its output is not used and therefore does not need
- *        to be connected to a pin.
- */
-#define NRF_DRV_PWM_PIN_NOT_USED    0xFF
-
-/**
- * @brief This value can be added to a pin number to inverse its polarity 
- *        (set idle state = 1).
- */
-#define NRF_DRV_PWM_PIN_INVERTED    0x80
-
-/**
- * @brief PWM driver configuration structure.
- */
-typedef struct
-{
-    uint8_t output_pins[NRF_PWM_CHANNEL_COUNT]; ///< Pin numbers for individual output channels (optional). 
-                                                /**< Use @ref NRF_DRV_PWM_PIN_NOT_USED
-                                                 *   if a given output channel is not needed. */
-    uint8_t            irq_priority; ///< Interrupt priority.
-    nrf_pwm_clk_t      base_clock;   ///< Base clock frequency.
-    nrf_pwm_mode_t     count_mode;   ///< Operating mode of the pulse generator counter.
-    uint16_t           top_value;    ///< Value up to which the pulse generator counter counts.
-    nrf_pwm_dec_load_t load_mode;    ///< Mode of loading sequence data from RAM.
-    nrf_pwm_dec_step_t step_mode;    ///< Mode of advancing the active sequence.
-} nrf_drv_pwm_config_t;
-
-/**
- * @brief PWM driver default configuration.
- */
-#define NRF_DRV_PWM_DEFAULT_CONFIG(id)                       \
-{                                                            \
-    .output_pins  = { CONCAT_3(PWM, id, _CONFIG_OUT0_PIN),   \
-                      CONCAT_3(PWM, id, _CONFIG_OUT1_PIN),   \
-                      CONCAT_3(PWM, id, _CONFIG_OUT2_PIN),   \
-                      CONCAT_3(PWM, id, _CONFIG_OUT3_PIN) }, \
-    .irq_priority = CONCAT_3(PWM, id, _CONFIG_IRQ_PRIORITY), \
-    .base_clock   = CONCAT_3(PWM, id, _CONFIG_BASE_CLOCK),   \
-    .count_mode   = CONCAT_3(PWM, id, _CONFIG_COUNT_MODE),   \
-    .top_value    = CONCAT_3(PWM, id, _CONFIG_TOP_VALUE),    \
-    .load_mode    = CONCAT_3(PWM, id, _CONFIG_LOAD_MODE),    \
-    .step_mode    = CONCAT_3(PWM, id, _CONFIG_STEP_MODE),    \
-}
-
-
-/**
- * @brief PWM flags providing additional playback options.
- */
-typedef enum
-{
-    NRF_DRV_PWM_FLAG_STOP = 0x01, /**< When the requested playback is finished,
-                                       the peripheral should be stopped.
-                                       @note The STOP task is triggered when
-                                       the last value of the final sequence is
-                                       loaded from RAM, and the peripheral stops
-                                       at the end of the current PWM period.
-                                       For sequences with configured repeating
-                                       of duty cycle values, this might result in
-                                       less than the requested number of repeats
-                                       of the last value. */
-    NRF_DRV_PWM_FLAG_LOOP = 0x02, /**< When the requested playback is finished,
-                                       it should be started from the beginning.
-                                       This flag is ignored if used together
-                                       with @ref NRF_DRV_PWM_FLAG_STOP. */
-    NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ0 = 0x04, /**< The event handler should be
-                                                  called when the last value
-                                                  from sequence 0 is loaded. */
-    NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ1 = 0x08, /**< The event handler should be
-                                                  called when the last value
-                                                  from sequence 1 is loaded. */
-    NRF_DRV_PWM_FLAG_NO_EVT_FINISHED = 0x10, /**< The playback finished event
-                                                  (enabled by default) should be
-                                                  suppressed. */
-} nrf_drv_pwm_flag_t;
-
-
-/**
- * @brief PWM driver event type.
- */
-typedef enum
-{
-    NRF_DRV_PWM_EVT_FINISHED, ///< Sequence playback finished.
-    NRF_DRV_PWM_EVT_END_SEQ0, /**< End of sequence 0 reached. Its data can be
-                                   safely modified now. */
-    NRF_DRV_PWM_EVT_END_SEQ1, /**< End of sequence 1 reached. Its data can be
-                                   safely modified now. */
-    NRF_DRV_PWM_EVT_STOPPED,  ///< The PWM peripheral has been stopped.
-} nrf_drv_pwm_evt_type_t;
-
-/**
- * @brief PWM driver event handler type.
- */
-typedef void (* nrf_drv_pwm_handler_t)(nrf_drv_pwm_evt_type_t event_type);
-
-
-/**
- * @brief Function for initializing the PWM driver.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] p_config   Pointer to the structure with initial configuration.
- *                       If NULL, the default configuration is used.
- * @param[in] handler    Event handler provided by the user. If NULL is passed
- *                       instead, event notifications are not done and PWM
- *                       interrupts are disabled.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized.
- */
-ret_code_t nrf_drv_pwm_init(nrf_drv_pwm_t const * const p_instance,
-                            nrf_drv_pwm_config_t const * p_config,
-                            nrf_drv_pwm_handler_t        handler);
-
-/**
- * @brief Function for uninitializing the PWM driver.
- *
- * If any sequence playback is in progress, it is stopped immediately.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- */
-void nrf_drv_pwm_uninit(nrf_drv_pwm_t const * const p_instance);
-
-/**
- * @brief Function for starting a single sequence playback.
- *
- * To take advantage of the looping mechanism in the PWM peripheral, both
- * sequences must be used (single sequence can be played back only once by
- * the peripheral). Therefore, the provided sequence is internally set and
- * played back as both sequence 0 and sequence 1. Consequently, if end of
- * sequence notifications are required, events for both sequences should be
- * used (that means that both the @ref NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ0 flag
- * and the @ref NRF_DRV_PWM_FLAG_SIGNAL_END_SEQ1 flag should be specified and
- * the @ref NRF_DRV_PWM_EVT_END_SEQ0 event and the @ref NRF_DRV_PWM_EVT_END_SEQ1
- * event should be handled in the same way).
- *
- * @note The array containing the duty cycle values for the specified sequence
- *       must be in RAM and cannot be allocated on stack.
- *       For detailed information, see @ref nrf_pwm_sequence_t.
- *
- * @param[in] p_instance     Pointer to the driver instance structure.
- * @param[in] p_sequence     Sequence to be played back.
- * @param[in] playback_count Number of playbacks to be performed (must not be 0).
- * @param[in] flags          Additional options. Pass any combination of
- *                           @ref nrf_drv_pwm_flag_t "playback flags", or 0
- *                           for default settings.
- */
-void nrf_drv_pwm_simple_playback(nrf_drv_pwm_t const * const p_instance,
-                                 nrf_pwm_sequence_t const * p_sequence,
-                                 uint16_t                   playback_count,
-                                 uint32_t                   flags);
-
-/**
- * @brief Function for starting a two-sequence playback.
- *
- * @note The array containing the duty cycle values for the specified sequence
- *       must be in RAM and cannot be allocated on stack.
- *       For detailed information, see @ref nrf_pwm_sequence_t.
- *
- * @param[in] p_instance     Pointer to the driver instance structure.
- * @param[in] p_sequence_0   First sequence to be played back.
- * @param[in] p_sequence_1   Second sequence to be played back.
- * @param[in] playback_count Number of playbacks to be performed (must not be 0).
- * @param[in] flags          Additional options. Pass any combination of
- *                           @ref nrf_drv_pwm_flag_t "playback flags", or 0
- *                           for default settings.
- */
-void nrf_drv_pwm_complex_playback(nrf_drv_pwm_t const * const p_instance,
-                                  nrf_pwm_sequence_t const * p_sequence_0,
-                                  nrf_pwm_sequence_t const * p_sequence_1,
-                                  uint16_t                   playback_count,
-                                  uint32_t                   flags);
-
-/**
- * @brief Function for advancing the active sequence.
- *
- * This function only applies to @ref NRF_PWM_STEP_TRIGGERED mode.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- */
-__STATIC_INLINE void nrf_drv_pwm_step(nrf_drv_pwm_t const * const p_instance);
-
-/**
- * @brief Function for stopping the sequence playback.
- *
- * The playback is stopped at the end of the current PWM period.
- * This means that if the active sequence is configured to repeat each duty
- * cycle value for a certain number of PWM periods, the last played value
- * might appear on the output less times than requested.
- *
- * @note This function can be instructed to wait until the playback is stopped
- *       (by setting @p wait_until_stopped to true). Note that, depending on
- *       the length of the PMW period, this might take a significant amount of
- *       time. Alternatively, the @ref nrf_drv_pwm_is_stopped function can be
- *       used to poll the status, or the @ref NRF_DRV_PWM_EVT_STOPPED event can
- *       be used to get the notification when the playback is stopped, provided
- *       the event handler is defined.
- *
- * @param[in] p_instance         Pointer to the driver instance structure.
- * @param[in] wait_until_stopped If true, the function will not return until
- *                               the playback is stopped.
- *
- * @retval true  If the PWM peripheral is stopped.
- * @retval false If the PWM peripheral is not stopped.
- */
-bool nrf_drv_pwm_stop(nrf_drv_pwm_t const * const p_instance,
-                      bool wait_until_stopped);
-
-/**
- * @brief Function for checking the status of the PWM peripheral.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- *
- * @retval true  If the PWM peripheral is stopped.
- * @retval false If the PWM peripheral is not stopped.
- */
-bool nrf_drv_pwm_is_stopped(nrf_drv_pwm_t const * const p_instance);
-
-/**
- * @brief Function for updating the sequence data during playback.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] seq_id     Identifier of the sequence (0 or 1).
- * @param[in] p_sequence Pointer to the new sequence definition.
- */
-__STATIC_INLINE void nrf_drv_pwm_sequence_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t                    seq_id,
-                                        nrf_pwm_sequence_t const * p_sequence);
-
-/**
- * @brief Function for updating the pointer to the duty cycle values
- *        in the specified sequence during playback.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] seq_id     Identifier of the sequence (0 or 1).
- * @param[in] values     New pointer to the duty cycle values.
- */
-__STATIC_INLINE void nrf_drv_pwm_sequence_values_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t          seq_id,
-                                        nrf_pwm_values_t values);
-
-/**
- * @brief Function for updating the number of duty cycle values
- *        in the specified sequence during playback.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] seq_id     Identifier of the sequence (0 or 1).
- * @param[in] length     New number of the duty cycle values.
- */
-__STATIC_INLINE void nrf_drv_pwm_sequence_length_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t  seq_id,
-                                        uint16_t length);
-
-/**
- * @brief Function for updating the number of repeats for duty cycle values
- *        in specified sequence during playback.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] seq_id     Identifier of the sequence (0 or 1).
- * @param[in] repeats    New number of repeats.
- */
-__STATIC_INLINE void nrf_drv_pwm_sequence_repeats_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t  seq_id,
-                                        uint32_t repeats);
-
-/**
- * @brief Function for updating the additional delay after the specified
- *        sequence during playback.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] seq_id     Identifier of the sequence (0 or 1).
- * @param[in] end_delay  New end delay value (in PWM periods).
- */
-__STATIC_INLINE void nrf_drv_pwm_sequence_end_delay_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t  seq_id,
-                                        uint32_t end_delay);
-
-/**
- * @brief Function for returning the address of a specified PWM task that can
- *        be used in PPI module.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] task       Requested task.
- *
- * @return Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_pwm_task_address_get(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        nrf_pwm_task_t task);
-
-/**@brief Function for returning the address of a specified PWM event that can
- *        be used in PPI module.
- *
- * @param[in] p_instance Pointer to the driver instance structure.
- * @param[in] event      Requested event.
- *
- * @return Event address.
- */
-__STATIC_INLINE uint32_t nrf_drv_pwm_event_address_get(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        nrf_pwm_event_t event);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_drv_pwm_step(nrf_drv_pwm_t const * const p_instance)
-{
-    nrf_pwm_task_trigger(p_instance->p_registers, NRF_PWM_TASK_NEXTSTEP);
-}
-
-__STATIC_INLINE void nrf_drv_pwm_sequence_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t                    seq_id,
-                                        nrf_pwm_sequence_t const * p_sequence)
-{
-    nrf_pwm_sequence_set(p_instance->p_registers, seq_id, p_sequence);
-}
-
-__STATIC_INLINE void nrf_drv_pwm_sequence_values_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t          seq_id,
-                                        nrf_pwm_values_t values)
-{
-    nrf_pwm_seq_ptr_set(p_instance->p_registers, seq_id, values.p_raw);
-}
-
-__STATIC_INLINE void nrf_drv_pwm_sequence_length_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t  seq_id,
-                                        uint16_t length)
-{
-    nrf_pwm_seq_cnt_set(p_instance->p_registers, seq_id, length);
-}
-
-__STATIC_INLINE void nrf_drv_pwm_sequence_repeats_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t  seq_id,
-                                        uint32_t repeats)
-{
-    nrf_pwm_seq_refresh_set(p_instance->p_registers, seq_id, repeats);
-}
-
-__STATIC_INLINE void nrf_drv_pwm_sequence_end_delay_update(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        uint8_t  seq_id,
-                                        uint32_t end_delay)
-{
-    nrf_pwm_seq_end_delay_set(p_instance->p_registers, seq_id, end_delay);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_pwm_task_address_get(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        nrf_pwm_task_t task)
-{
-    return nrf_pwm_task_address_get(p_instance->p_registers, task);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_pwm_event_address_get(
-                                        nrf_drv_pwm_t const * const p_instance,
-                                        nrf_pwm_event_t event)
-{
-    return nrf_pwm_event_address_get(p_instance->p_registers, event);
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_PWM_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/qdec/nrf_drv_qdec.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/qdec/nrf_drv_qdec.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/qdec/nrf_drv_qdec.c
deleted file mode 100644
index aacc0ab..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/qdec/nrf_drv_qdec.c
+++ /dev/null
@@ -1,168 +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 <stdint.h>
-#include <stddef.h>
-
-#include "nrf.h"
-#include "nrf_gpio.h"
-#include "nrf_error.h"
-#include "nrf_assert.h"
-#include "nrf_drv_common.h"
-#include "nrf_drv_qdec.h"
-#include "app_util_platform.h"
-#include "nrf_assert.h"
-
-static qdec_event_handler_t m_qdec_event_handler = NULL;
-static const nrf_drv_qdec_config_t m_default_config = NRF_DRV_QDEC_DEFAULT_CONFIG;
-static nrf_drv_state_t m_state = NRF_DRV_STATE_UNINITIALIZED;
-
-void QDEC_IRQHandler(void)
-{
-    nrf_drv_qdec_event_t event;
-    if ( nrf_qdec_event_check(NRF_QDEC_EVENT_SAMPLERDY) &&
-         nrf_qdec_int_enable_check(NRF_QDEC_INT_SAMPLERDY_MASK) )
-    {
-        nrf_qdec_event_clear(NRF_QDEC_EVENT_SAMPLERDY);
-
-        event.type = NRF_QDEC_EVENT_SAMPLERDY;
-        event.data.sample.value = (int8_t)nrf_qdec_sample_get();
-        m_qdec_event_handler(event);
-    }
-
-    if ( nrf_qdec_event_check(NRF_QDEC_EVENT_REPORTRDY) &&
-         nrf_qdec_int_enable_check(NRF_QDEC_INT_REPORTRDY_MASK) )
-    {
-        nrf_qdec_event_clear(NRF_QDEC_EVENT_REPORTRDY);
-
-        event.type = NRF_QDEC_EVENT_REPORTRDY;
-
-        event.data.report.acc    = (int16_t)nrf_qdec_accread_get();
-        event.data.report.accdbl = (uint16_t)nrf_qdec_accdblread_get();
-        m_qdec_event_handler(event);
-    }
-
-    if ( nrf_qdec_event_check(NRF_QDEC_EVENT_ACCOF) &&
-         nrf_qdec_int_enable_check(NRF_QDEC_INT_ACCOF_MASK) )
-    {
-        nrf_qdec_event_clear(NRF_QDEC_EVENT_ACCOF);
-
-        event.type = NRF_QDEC_EVENT_ACCOF;
-        m_qdec_event_handler(event);
-    }
-}
-
-
-ret_code_t nrf_drv_qdec_init(const nrf_drv_qdec_config_t * p_config,
-                             qdec_event_handler_t event_handler)
-{
-    if (m_state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE; // qdec_event_handler has been already registered
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config;
-    }
-
-    if (event_handler)
-    {
-        m_qdec_event_handler = event_handler;
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    nrf_qdec_sampleper_set(p_config->sampleper);
-    nrf_gpio_cfg_input(p_config->pselled,NRF_GPIO_PIN_NOPULL);
-    nrf_gpio_cfg_input(p_config->psela, NRF_GPIO_PIN_NOPULL);
-    nrf_gpio_cfg_input(p_config->pselb, NRF_GPIO_PIN_NOPULL);
-    nrf_qdec_pio_assign( p_config->psela, p_config->pselb, p_config->pselled);
-    nrf_qdec_ledpre_set(p_config->ledpre);
-    nrf_qdec_ledpol_set(p_config->ledpol);
-    nrf_qdec_shorts_enable(NRF_QDEC_SHORT_REPORTRDY_READCLRACC_MASK);
-
-    if (p_config->dbfen)
-    {
-        nrf_qdec_dbfen_enable();
-    }
-    else
-    {
-        nrf_qdec_dbfen_disable();
-    }
-
-    uint32_t int_mask = NRF_QDEC_INT_ACCOF_MASK;
-
-    if (p_config->reportper != NRF_QDEC_REPORTPER_DISABLED)
-    {
-        nrf_qdec_reportper_set(p_config->reportper);
-        int_mask |= NRF_QDEC_INT_REPORTRDY_MASK;
-    }
-
-    if (p_config->sample_inten)
-    {
-        int_mask |= NRF_QDEC_INT_SAMPLERDY_MASK;
-    }
-
-    nrf_qdec_int_enable(int_mask);
-    nrf_drv_common_irq_enable(QDEC_IRQn, p_config->interrupt_priority);
-
-    m_state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_qdec_uninit(void)
-{
-    ASSERT(m_state != NRF_DRV_STATE_UNINITIALIZED);
-    nrf_drv_qdec_disable();
-    nrf_drv_common_irq_disable(QDEC_IRQn);
-    m_state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-void nrf_drv_qdec_enable(void)
-{
-    ASSERT(m_state == NRF_DRV_STATE_INITIALIZED);
-    nrf_qdec_enable();
-    nrf_qdec_task_trigger(NRF_QDEC_TASK_START);
-    m_state = NRF_DRV_STATE_POWERED_ON;
-}
-
-void nrf_drv_qdec_disable(void)
-{
-    ASSERT(m_state == NRF_DRV_STATE_POWERED_ON);
-    nrf_qdec_disable();
-    nrf_qdec_task_trigger(NRF_QDEC_TASK_STOP);
-    m_state = NRF_DRV_STATE_INITIALIZED;
-}
-
-void nrf_drv_qdec_accumulators_read(int16_t * p_acc, int16_t * p_accdbl)
-{
-    ASSERT(m_state == NRF_DRV_STATE_POWERED_ON);
-    nrf_qdec_task_trigger(NRF_QDEC_TASK_READCLRACC);
-
-    *p_acc    = (int16_t)nrf_qdec_accread_get();
-    *p_accdbl = (int16_t)nrf_qdec_accdblread_get();
-}
-
-void nrf_drv_qdec_task_address_get(nrf_qdec_task_t task, uint32_t * p_task)
-{
-    *p_task = (uint32_t)nrf_qdec_task_address_get(task);
-}
-
-void nrf_drv_qdec_event_address_get(nrf_qdec_event_t event, uint32_t * p_event)
-{
-    *p_event = (uint32_t)nrf_qdec_event_address_get(event);
-}
-

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/qdec/nrf_drv_qdec.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/qdec/nrf_drv_qdec.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/qdec/nrf_drv_qdec.h
deleted file mode 100644
index df20f38..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/qdec/nrf_drv_qdec.h
+++ /dev/null
@@ -1,157 +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.
- *
- */
-
-#ifndef NRF_DRV_QDEC_H__
-#define NRF_DRV_QDEC_H__
-
-#include "nrf_qdec.h"
-#include "nrf_drv_config.h"
-#include "sdk_errors.h"
-#include <stdbool.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup nrf_qdec QDEC HAL and driver
- * @ingroup nrf_drivers
- * @brief Quadrature decoder (QDEC) APIs.
- * @details The QDEC HAL provides basic APIs for accessing the registers of the QDEC. 
- * The QDEC driver provides APIs on a higher level.
- *
- * @defgroup nrf_drivers_qdec QDEC driver
- * @{
- * @ingroup nrf_qdec
- * @brief Quadrature decoder (QDEC) driver.
- */
-
-/**@brief QDEC configuration structure.*/
-typedef struct
-{
-    nrf_qdec_reportper_t   reportper;          /**< Report period in samples. */
-    nrf_qdec_sampleper_t   sampleper;          /**< Sampling period in microseconds. */
-    uint32_t               psela;              /**< Pin number for A input. */
-    uint32_t               pselb;              /**< Pin number for B input. */
-    uint32_t               pselled;            /**< Pin number for LED output. */
-    uint32_t               ledpre;             /**< Time (in microseconds) how long LED is switched on before sampling. */
-    nrf_qdec_ledpol_t      ledpol;             /**< Active LED polarity. */
-    bool                   dbfen;              /**< State of debouncing filter. */
-    bool                   sample_inten;       /**< Enabling sample ready interrupt. */
-    uint8_t                interrupt_priority; /**< QDEC interrupt priority. */
-} nrf_drv_qdec_config_t;
-
-/**@brief QDEC default configuration. */
-#define NRF_DRV_QDEC_DEFAULT_CONFIG                     \
-    {                                                   \
-        .reportper          = QDEC_CONFIG_REPORTPER,    \
-        .sampleper          = QDEC_CONFIG_SAMPLEPER,    \
-        .psela              = QDEC_CONFIG_PIO_A,        \
-        .pselb              = QDEC_CONFIG_PIO_B,        \
-        .pselled            = QDEC_CONFIG_PIO_LED,      \
-        .ledpre             = QDEC_CONFIG_LEDPRE,       \
-        .ledpol             = QDEC_CONFIG_LEDPOL,       \
-        .interrupt_priority = QDEC_CONFIG_IRQ_PRIORITY, \
-        .dbfen              = QDEC_CONFIG_DBFEN,        \
-        .sample_inten       = QDEC_CONFIG_SAMPLE_INTEN  \
-    }
-
-/**@brief QDEC sample event data.*/
-typedef struct
-{
-    int8_t value; /**< Sample value. */
-} nrf_drv_qdec_sample_data_evt_t;
-
-/**@brief QDEC report event data.*/
-typedef struct
-{
-    int16_t acc;     /**< Accumulated transitions. */
-    uint16_t accdbl;  /**< Accumulated double transitions. */
-} nrf_drv_qdec_report_data_evt_t;
-
-/**@brief QDEC event handler structure. */
-typedef struct
-{
-    nrf_qdec_event_t  type;
-    union
-    {
-        nrf_drv_qdec_sample_data_evt_t sample; /**< Sample event data. */
-        nrf_drv_qdec_report_data_evt_t report; /**< Report event data. */
-    } data;
-} nrf_drv_qdec_event_t;
-
-/**@brief QDEC event handler.
- * @param[in] event  QDEC event structure.
- */
-typedef void (*qdec_event_handler_t)(nrf_drv_qdec_event_t event);
-
-/**@brief Function for initializing QDEC.
- *
- * @param[in] p_config            Pointer to configuration parameters.
- * @param[in] event_handler  Event handler function.
- *
- * @retval NRF_SUCCESS If initialization was successful.
- * @retval NRF_ERROR_INVALID_PARAM If invalid parameters were supplied.
- * @retval NRF_ERROR_INVALID_STATE If QDEC was already initialized.
- */
-ret_code_t nrf_drv_qdec_init(nrf_drv_qdec_config_t const * p_config,
-                             qdec_event_handler_t event_handler);
-
-/**@brief Function for uninitializing QDEC.
- * @note  Function asserts if module is uninitialized.
- */
-void nrf_drv_qdec_uninit(void);
-
-/**@brief Function for enabling QDEC.
- * @note  Function asserts if module is uninitialized or enabled.
- */
-void nrf_drv_qdec_enable(void);
-
-/**@brief Function for disabling QDEC.
- * @note  Function asserts if module is uninitialized or disabled.
- */
-void nrf_drv_qdec_disable(void);
-
-/**@brief Function for reading accumulated transitions QDEC.
- * @note  Function asserts if module is not enabled.
- * @note  Accumulators are cleared after reading.
- *
- * @param[out] p_acc      Pointer to store accumulated transitions.
- * @param[out] p_accdbl   Pointer to store accumulated double transitions.
- */
-void nrf_drv_qdec_accumulators_read(int16_t * p_acc, int16_t * p_accdbl);
-
-/**
- * @brief Function for returning the address of a specific timer task.
- *
- * @param[in]  task       QDEC task.
- * @param[out] p_task     Task address.
- */
-void nrf_drv_qdec_task_address_get(nrf_qdec_task_t task, uint32_t * p_task);
-
-/**
- * @brief Function for returning the address of a specific timer event.
- *
- * @param[in]  event       QDEC event.
- * @param[out] p_event     Event address.
- */
-void nrf_drv_qdec_event_address_get(nrf_qdec_event_t event, uint32_t * p_event);
-
-/**
-   *@}
- **/
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_DRV_QDEC_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/radio_config/radio_config.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/radio_config/radio_config.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/radio_config/radio_config.c
deleted file mode 100644
index 8aa8e64..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/radio_config/radio_config.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright (c) 2009 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_dev_radio_rx_example_main nrf_dev_radio_tx_example_main
-* @{
-*/
- 
-#include "radio_config.h"
-#include "nrf_delay.h"
-
-/* These are set to zero as Shockburst packets don't have corresponding fields. */
-#define PACKET_S1_FIELD_SIZE      (0UL)  /**< Packet S1 field size in bits. */
-#define PACKET_S0_FIELD_SIZE      (0UL)  /**< Packet S0 field size in bits. */
-#define PACKET_LENGTH_FIELD_SIZE  (0UL)  /**< Packet length field size in bits. */
-
-/**
- * @brief Function for swapping/mirroring bits in a byte.
- * 
- *@verbatim
- * output_bit_7 = input_bit_0
- * output_bit_6 = input_bit_1
- *           :
- * output_bit_0 = input_bit_7
- *@endverbatim
- *
- * @param[in] inp is the input byte to be swapped.
- *
- * @return
- * Returns the swapped/mirrored input byte.
- */
-static uint32_t swap_bits(uint32_t inp);
-
-/**
- * @brief Function for swapping bits in a 32 bit word for each byte individually.
- * 
- * The bits are swapped as follows:
- * @verbatim
- * output[31:24] = input[24:31] 
- * output[23:16] = input[16:23]
- * output[15:8]  = input[8:15]
- * output[7:0]   = input[0:7]
- * @endverbatim
- * @param[in] input is the input word to be swapped.
- *
- * @return
- * Returns the swapped input byte.
- */
-static uint32_t bytewise_bitswap(uint32_t inp);
-
-static uint32_t swap_bits(uint32_t inp)
-{
-    uint32_t i;
-    uint32_t retval = 0;
-    
-    inp = (inp & 0x000000FFUL);
-    
-    for (i = 0; i < 8; i++)
-    {
-        retval |= ((inp >> i) & 0x01) << (7 - i);     
-    }
-    
-    return retval;    
-}
-
-
-static uint32_t bytewise_bitswap(uint32_t inp)
-{
-      return (swap_bits(inp >> 24) << 24)
-           | (swap_bits(inp >> 16) << 16)
-           | (swap_bits(inp >> 8) << 8)
-           | (swap_bits(inp));
-}
-
-
-/** 
- * @brief Function for configuring the radio to operate in Shockburst compatible mode.
- * 
- * To configure the application running on nRF24L series devices:
- *
- * @verbatim
- * uint8_t tx_address[5] = { 0xC0, 0x01, 0x23, 0x45, 0x67 };
- * hal_nrf_set_rf_channel(7);
- * hal_nrf_set_address_width(HAL_NRF_AW_5BYTES); 
- * hal_nrf_set_address(HAL_NRF_TX, tx_address);
- * hal_nrf_set_address(HAL_NRF_PIPE0, tx_address); 
- * hal_nrf_open_pipe(0, false);
- * hal_nrf_set_datarate(HAL_NRF_1MBPS);
- * hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);
- * hal_nrf_setup_dynamic_payload(0xFF);
- * hal_nrf_enable_dynamic_payload(false);
- * @endverbatim
- *
- * When transmitting packets with hal_nrf_write_tx_payload(const uint8_t *tx_pload, uint8_t length),
- * match the length with PACKET_STATIC_LENGTH.
- * hal_nrf_write_tx_payload(payload, PACKET_STATIC_LENGTH);
- * 
-*/
-void radio_configure()
-{
-    // Radio config
-    NRF_RADIO->TXPOWER   = (RADIO_TXPOWER_TXPOWER_0dBm << RADIO_TXPOWER_TXPOWER_Pos);
-    NRF_RADIO->FREQUENCY = 7UL;  // Frequency bin 7, 2407MHz
-    NRF_RADIO->MODE      = (RADIO_MODE_MODE_Nrf_1Mbit << RADIO_MODE_MODE_Pos);
-
-    // Radio address config
-    NRF_RADIO->PREFIX0 = 
-        ((uint32_t)swap_bits(0xC3) << 24) // Prefix byte of address 3 converted to nRF24L series format
-      | ((uint32_t)swap_bits(0xC2) << 16) // Prefix byte of address 2 converted to nRF24L series format
-      | ((uint32_t)swap_bits(0xC1) << 8)  // Prefix byte of address 1 converted to nRF24L series format
-      | ((uint32_t)swap_bits(0xC0) << 0); // Prefix byte of address 0 converted to nRF24L series format
-  
-    NRF_RADIO->PREFIX1 = 
-        ((uint32_t)swap_bits(0xC7) << 24) // Prefix byte of address 7 converted to nRF24L series format
-      | ((uint32_t)swap_bits(0xC6) << 16) // Prefix byte of address 6 converted to nRF24L series format
-      | ((uint32_t)swap_bits(0xC4) << 0); // Prefix byte of address 4 converted to nRF24L series format
-
-    NRF_RADIO->BASE0 = bytewise_bitswap(0x01234567UL);  // Base address for prefix 0 converted to nRF24L series format
-    NRF_RADIO->BASE1 = bytewise_bitswap(0x89ABCDEFUL);  // Base address for prefix 1-7 converted to nRF24L series format
-  
-    NRF_RADIO->TXADDRESS   = 0x00UL;  // Set device address 0 to use when transmitting
-    NRF_RADIO->RXADDRESSES = 0x01UL;  // Enable device address 0 to use to select which addresses to receive
-
-    // Packet configuration
-    NRF_RADIO->PCNF0 = (PACKET_S1_FIELD_SIZE     << RADIO_PCNF0_S1LEN_Pos) |
-                       (PACKET_S0_FIELD_SIZE     << RADIO_PCNF0_S0LEN_Pos) |
-                       (PACKET_LENGTH_FIELD_SIZE << RADIO_PCNF0_LFLEN_Pos); //lint !e845 "The right argument to operator '|' is certain to be 0"
-
-    // Packet configuration
-    NRF_RADIO->PCNF1 = (RADIO_PCNF1_WHITEEN_Disabled << RADIO_PCNF1_WHITEEN_Pos) |
-                       (RADIO_PCNF1_ENDIAN_Big       << RADIO_PCNF1_ENDIAN_Pos)  |
-                       (PACKET_BASE_ADDRESS_LENGTH   << RADIO_PCNF1_BALEN_Pos)   |
-                       (PACKET_STATIC_LENGTH         << RADIO_PCNF1_STATLEN_Pos) |
-                       (PACKET_PAYLOAD_MAXSIZE       << RADIO_PCNF1_MAXLEN_Pos); //lint !e845 "The right argument to operator '|' is certain to be 0"
-
-    // CRC Config
-    NRF_RADIO->CRCCNF = (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos); // Number of checksum bits
-    if ((NRF_RADIO->CRCCNF & RADIO_CRCCNF_LEN_Msk) == (RADIO_CRCCNF_LEN_Two << RADIO_CRCCNF_LEN_Pos))
-    {
-        NRF_RADIO->CRCINIT = 0xFFFFUL;   // Initial value      
-        NRF_RADIO->CRCPOLY = 0x11021UL;  // CRC poly: x^16+x^12^x^5+1
-    }
-    else if ((NRF_RADIO->CRCCNF & RADIO_CRCCNF_LEN_Msk) == (RADIO_CRCCNF_LEN_One << RADIO_CRCCNF_LEN_Pos))
-    {
-        NRF_RADIO->CRCINIT = 0xFFUL;   // Initial value
-        NRF_RADIO->CRCPOLY = 0x107UL;  // CRC poly: x^8+x^2^x^1+1
-    }
-}
-
-/** 
- * @}
- */

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/radio_config/radio_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/radio_config/radio_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/radio_config/radio_config.h
deleted file mode 100644
index 9181aaf..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/radio_config/radio_config.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (c) 2009 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.
- *
- */
-#ifndef RADIO_CONFIG_H
-#define RADIO_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define PACKET_BASE_ADDRESS_LENGTH  (4UL)                   //!< Packet base address length field size in bytes
-#define PACKET_STATIC_LENGTH        (1UL)                   //!< Packet static length in bytes
-#define PACKET_PAYLOAD_MAXSIZE      (PACKET_STATIC_LENGTH)  //!< Packet payload maximum size in bytes
-
-void radio_configure(void);
-
-#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/drivers_nrf/rng/nrf_drv_rng.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rng/nrf_drv_rng.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rng/nrf_drv_rng.c
deleted file mode 100644
index 56d207c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rng/nrf_drv_rng.c
+++ /dev/null
@@ -1,250 +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 <stdint.h>
-#include <stddef.h>
-
-#include "nrf_drv_rng.h"
-#include "nrf_assert.h"
-#include "nrf_drv_common.h"
-#include "nordic_common.h"
-#include "nrf_error.h"
-#include "nrf_assert.h"
-#ifdef SOFTDEVICE_PRESENT
-#include "nrf_sdm.h"
-#include "nrf_soc.h"
-#else
-#include "app_fifo.h"
-#include "app_util_platform.h"
-
-static __INLINE uint32_t fifo_length(app_fifo_t * p_fifo)
-{
-    uint32_t tmp = p_fifo->read_pos;
-    return p_fifo->write_pos - tmp;
-}
-
-#define FIFO_LENGTH(fifo) fifo_length(&(fifo))  /**< Macro for calculating the FIFO length. */
-
-#endif // SOFTDEVICE_PRESENT
-typedef struct
-{
-    nrf_drv_state_t state;
-#ifndef SOFTDEVICE_PRESENT
-    app_fifo_t rand_pool;
-    uint8_t    buffer[RNG_CONFIG_POOL_SIZE];
-#endif // SOFTDEVICE_PRESENT
-} nrf_drv_rng_cb_t;
-
-static nrf_drv_rng_cb_t m_rng_cb;
-#ifndef SOFTDEVICE_PRESENT
-static const nrf_drv_rng_config_t m_default_config = NRF_DRV_RNG_DEFAULT_CONFIG;
-static void rng_start(void)
-{
-    if (FIFO_LENGTH(m_rng_cb.rand_pool) <= m_rng_cb.rand_pool.buf_size_mask)
-    {
-        nrf_rng_event_clear(NRF_RNG_EVENT_VALRDY);
-        nrf_rng_int_enable(NRF_RNG_INT_VALRDY_MASK);
-        nrf_rng_task_trigger(NRF_RNG_TASK_START);
-    }
-}
-
-
-static void rng_stop(void)
-{
-    nrf_rng_int_disable(NRF_RNG_INT_VALRDY_MASK);
-    nrf_rng_task_trigger(NRF_RNG_TASK_STOP);
-}
-
-
-#endif // SOFTDEVICE_PRESENT
-
-
-ret_code_t nrf_drv_rng_init(nrf_drv_rng_config_t const * p_config)
-{
-    uint32_t result;
-
-    if (m_rng_cb.state == NRF_DRV_STATE_UNINITIALIZED)
-    {
-#ifndef SOFTDEVICE_PRESENT
-
-        result = app_fifo_init(&m_rng_cb.rand_pool, m_rng_cb.buffer, RNG_CONFIG_POOL_SIZE);
-
-        if (p_config == NULL)
-        {
-            p_config = &m_default_config;
-        }
-
-        if (result == NRF_SUCCESS)
-        {
-            if (p_config->error_correction)
-            {
-                nrf_rng_error_correction_enable();
-            }
-
-            nrf_drv_common_irq_enable(RNG_IRQn, p_config->interrupt_priority);
-
-            nrf_rng_shorts_disable(NRF_RNG_SHORT_VALRDY_STOP_MASK);
-
-            rng_start();
-            m_rng_cb.state = NRF_DRV_STATE_INITIALIZED;
-        }
-#else
-        UNUSED_VARIABLE(p_config);
-        uint8_t softdevice_is_enabled;
-        result = sd_softdevice_is_enabled(&softdevice_is_enabled);
-
-        if (softdevice_is_enabled)
-        {
-            m_rng_cb.state = NRF_DRV_STATE_INITIALIZED;
-        }
-        else
-        {
-            result = NRF_ERROR_SOFTDEVICE_NOT_ENABLED;
-        }
-#endif // SOFTDEVICE_PRESENT
-    }
-    else
-    {
-        result = NRF_ERROR_INVALID_STATE;
-    }
-    return result;
-}
-
-
-void nrf_drv_rng_uninit(void)
-{
-    ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED);
-
-    m_rng_cb.state = NRF_DRV_STATE_UNINITIALIZED;
-#ifndef SOFTDEVICE_PRESENT
-    rng_stop();
-    nrf_drv_common_irq_disable(RNG_IRQn);
-#endif // SOFTDEVICE_PRESENT
-}
-
-ret_code_t nrf_drv_rng_bytes_available(uint8_t * p_bytes_available)
-{
-    ret_code_t result;
-    ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED);
-
-#ifndef SOFTDEVICE_PRESENT
-
-    result             = NRF_SUCCESS;
-    *p_bytes_available = FIFO_LENGTH(m_rng_cb.rand_pool);
-
-#else
-
-    result = sd_rand_application_bytes_available_get(p_bytes_available);
-
-#endif // SOFTDEVICE_PRESENT
-
-    return result;
-}
-
-ret_code_t nrf_drv_rng_pool_capacity(uint8_t * p_pool_capacity)
-{
-    ret_code_t result;
-    ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED);
-
-#ifndef SOFTDEVICE_PRESENT
-
-    result           = NRF_SUCCESS;
-    *p_pool_capacity = RNG_CONFIG_POOL_SIZE;
-
-#else
-
-    result = sd_rand_application_pool_capacity_get(p_pool_capacity);
-
-#endif // SOFTDEVICE_PRESENT
-    return result;
-}
-
-ret_code_t nrf_drv_rng_rand(uint8_t * p_buff, uint8_t length)
-{
-    ret_code_t result;
-
-    ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED);
-
-#ifndef SOFTDEVICE_PRESENT
-    if (FIFO_LENGTH(m_rng_cb.rand_pool) >= length)
-    {
-        result = NRF_SUCCESS;
-
-        for (uint32_t i = 0; (i < length) && (result == NRF_SUCCESS); i++)
-        {
-            result = app_fifo_get(&(m_rng_cb.rand_pool), &p_buff[i]);
-        }
-        rng_start();
-    }
-    else
-    {
-        result = NRF_ERROR_NO_MEM;
-    }
-#else
-
-    result = sd_rand_application_vector_get(p_buff, length);
-
-#endif // SOFTDEVICE_PRESENT
-
-
-    return result;
-}
-
-ret_code_t nrf_drv_rng_block_rand(uint8_t * p_buff, uint32_t length)
-{
-    uint32_t count = 0, poolsz = 0;
-    ret_code_t result;
-    ASSERT(m_rng_cb.state == NRF_DRV_STATE_INITIALIZED);
-
-    result = nrf_drv_rng_pool_capacity((uint8_t *) &poolsz);
-    if(result != NRF_SUCCESS)
-    {
-        return result;
-    }
-
-    while(length)
-    {
-        uint32_t len = length >= poolsz ? poolsz : length;
-        while((result = nrf_drv_rng_rand(&p_buff[count], len)) != NRF_SUCCESS)
-        {
-#ifndef SOFTDEVICE_PRESENT
-            ASSERT(result == NRF_ERROR_NO_MEM);
-#else
-            ASSERT(result == NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES);
-#endif
-        }
-
-        length -= len;
-        count += len;
-    }
-
-    return result;
-}
-
-
-#ifndef SOFTDEVICE_PRESENT
-void RNG_IRQHandler(void)
-{
-    if (nrf_rng_event_get(NRF_RNG_EVENT_VALRDY) &&
-        nrf_rng_int_get(NRF_RNG_INT_VALRDY_MASK))
-    {
-        nrf_rng_event_clear(NRF_RNG_EVENT_VALRDY);
-        uint32_t nrf_error = app_fifo_put(&m_rng_cb.rand_pool, nrf_rng_random_value_get());
-
-        if ((FIFO_LENGTH(m_rng_cb.rand_pool) > m_rng_cb.rand_pool.buf_size_mask) || (nrf_error == NRF_ERROR_NO_MEM))
-        {
-            rng_stop();
-        }
-    }
-}
-
-#endif // SOFTDEVICE_PRESENT

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/rng/nrf_drv_rng.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rng/nrf_drv_rng.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rng/nrf_drv_rng.h
deleted file mode 100644
index 684ad39..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rng/nrf_drv_rng.h
+++ /dev/null
@@ -1,123 +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.
- *
- */
-
-#ifndef NRF_DRV_RNG_H__
-#define NRF_DRV_RNG_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf_rng.h"
-#include "sdk_errors.h"
-#include "nrf_drv_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup nrf_rng RNG HAL and driver
- * @ingroup nrf_drivers
- * @brief Random number generator (RNG) APIs.
- * @details The RNG HAL provides basic APIs for accessing the registers of the random number generator. 
- * The RNG driver provides APIs on a higher level.
- *
- * @defgroup nrf_drv_rng RNG driver
- * @{
- * @ingroup nrf_rng
- * @brief Driver for managing the random number generator (RNG).
- */
-
-/**@brief Struct for RNG configuration. */
-typedef struct
-{
-    bool     error_correction;      /**< Error correction flag. */
-    uint8_t  interrupt_priority;    /**< interrupt priority */
-} nrf_drv_rng_config_t;
-
-/**@brief RNG default configuration. */
-#define NRF_DRV_RNG_DEFAULT_CONFIG                                                    \
-    {                                                                                 \
-        .error_correction   = RNG_CONFIG_ERROR_CORRECTION,                            \
-        .interrupt_priority = RNG_CONFIG_IRQ_PRIORITY,                                \
-    }
-
-/**
- * @brief Function for initializing the nrf_drv_rng module.
- *
- * @param[in]  p_config                   Initial configuration. Default configuration used if NULL.
- *
- * @retval  NRF_SUCCESS                       Driver was successfully initialized.
- * @retval  NRF_ERROR_INVALID_STATE           Driver was already initialized.
- * @retval  NRF_ERROR_INVALID_LENGTH          Pool size have to be a power of 2.
- * @retval  NRF_ERROR_SOFTDEVICE_NOT_ENABLED  SoftDevice is present, but not enabled.
- */
-ret_code_t nrf_drv_rng_init(nrf_drv_rng_config_t const * p_config);
-
-/**
- * @brief Function for uninitializing the nrf_drv_rng module.
- */
-void nrf_drv_rng_uninit(void);
-
-/**
- * @brief Function for getting the number of currently available random bytes.
- *
- * @param[out] p_bytes_available                    The number of bytes currently available in the pool.
- *
- * @retval     NRF_SUCCESS                          If the number of available random bytes was written to p_bytes_available.
- */
-ret_code_t nrf_drv_rng_bytes_available(uint8_t * p_bytes_available);
-
-/**
- * @brief Function for querying the capacity of the application random pool.
- *
- * @param[out] p_pool_capacity                      The capacity of the pool.
- *
- * @retval     NRF_SUCCESS                          If the capacity of the pool was written to p_pool_capacity.
- */
-ret_code_t nrf_drv_rng_pool_capacity(uint8_t * p_pool_capacity);
-
-/**
- * @brief Function for getting the vector of random numbers.
- *
- * @param[out] p_buff                               Pointer to uint8_t buffer for storing the bytes.
- * @param[in]  length                               Number of bytes to take from the pool and place in p_buff.
- *
- * @retval     NRF_SUCCESS                          If the requested bytes were written to p_buff.
- * @retval     NRF_ERROR_NO_MEM                     If no bytes were written to the buffer
- *                                                  because there were not enough bytes available in p_buff.
- * @retval     NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES If no bytes were written to the buffer
- *                                                  because there were not enough bytes available in the pool.
- */
-ret_code_t nrf_drv_rng_rand(uint8_t * p_buff, uint8_t length);
-
-/**
- * @brief Blocking function for getting an arbitrary array of random numbers.
- *
- * @note This function may execute for a substantial amount of time depending on the length of the buffer
- *       required and on the state of the current internal pool of random numbers.
- *
- * @param[out] p_buff                               Pointer to uint8_t buffer for storing the bytes.
- * @param[in]  length                               Number of bytes place in p_buff.
- *
- * @retval     NRF_SUCCESS                          If the requested bytes were written to p_buff.
- */
-ret_code_t nrf_drv_rng_block_rand(uint8_t * p_buff, uint32_t length);
-
-/**
- *@}
- **/
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_RNG_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/rtc/nrf_drv_rtc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rtc/nrf_drv_rtc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rtc/nrf_drv_rtc.c
deleted file mode 100644
index af66bb2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rtc/nrf_drv_rtc.c
+++ /dev/null
@@ -1,290 +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.
- *
- */
-
-#include "nrf_drv_rtc.h"
-#include "nrf_rtc.h"
-#include "nrf_assert.h"
-#include "app_util_platform.h"
-
-/**@brief RTC driver instance control block structure. */
-typedef struct
-{
-    nrf_drv_state_t state;        /**< Instance state. */
-    bool            reliable;     /**< Reliable mode flag. */
-    uint8_t         tick_latency; /**< Maximum length of interrupt handler in ticks (max 7.7 ms). */
-} nrf_drv_rtc_cb_t;
-
-// User callbacks local storage.
-static nrf_drv_rtc_handler_t m_handlers[RTC_COUNT];
-static nrf_drv_rtc_cb_t      m_cb[RTC_COUNT];
-
-static const nrf_drv_rtc_config_t m_default_config[] = {
-#if RTC0_ENABLED
-    NRF_DRV_RTC_DEFAULT_CONFIG(0),
-#endif
-#if RTC1_ENABLED
-    NRF_DRV_RTC_DEFAULT_CONFIG(1),
-#endif
-#if RTC2_ENABLED
-    NRF_DRV_RTC_DEFAULT_CONFIG(2)
-#endif
-};
-
-ret_code_t nrf_drv_rtc_init(nrf_drv_rtc_t const * const p_instance,
-                            nrf_drv_rtc_config_t const * p_config,
-                            nrf_drv_rtc_handler_t handler)
-{
-    if (handler)
-    {
-        m_handlers[p_instance->instance_id] = handler;
-    }
-    else
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config[p_instance->instance_id];
-    }
-
-    if (m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    nrf_drv_common_irq_enable(p_instance->irq, p_config->interrupt_priority);
-    nrf_rtc_prescaler_set(p_instance->p_reg, p_config->prescaler);
-    m_cb[p_instance->instance_id].reliable     = p_config->reliable;
-    m_cb[p_instance->instance_id].tick_latency = p_config->tick_latency;
-    m_cb[p_instance->instance_id].state        = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_rtc_uninit(nrf_drv_rtc_t const * const p_instance)
-{
-    uint32_t mask = NRF_RTC_INT_TICK_MASK     |
-                    NRF_RTC_INT_OVERFLOW_MASK |
-                    NRF_RTC_INT_COMPARE0_MASK |
-                    NRF_RTC_INT_COMPARE1_MASK |
-                    NRF_RTC_INT_COMPARE2_MASK |
-                    NRF_RTC_INT_COMPARE3_MASK;
-    ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED);
-
-    nrf_drv_common_irq_disable(p_instance->irq);
-
-    nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_STOP);
-    nrf_rtc_event_disable(p_instance->p_reg, mask);
-    nrf_rtc_int_disable(p_instance->p_reg, mask);
-
-    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-void nrf_drv_rtc_enable(nrf_drv_rtc_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_INITIALIZED);
-
-    nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_START);
-    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_POWERED_ON;
-}
-
-void nrf_drv_rtc_disable(nrf_drv_rtc_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].state == NRF_DRV_STATE_POWERED_ON);
-
-    nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_STOP);
-    m_cb[p_instance->instance_id].state = NRF_DRV_STATE_INITIALIZED;
-}
-
-ret_code_t nrf_drv_rtc_cc_disable(nrf_drv_rtc_t const * const p_instance, uint32_t channel)
-{
-    ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(channel<p_instance->cc_channel_count);
-
-    uint32_t int_mask = RTC_CHANNEL_INT_MASK(channel);
-    nrf_rtc_event_t event    = RTC_CHANNEL_EVENT_ADDR(channel);
-
-    nrf_rtc_event_disable(p_instance->p_reg,int_mask);
-    if (nrf_rtc_int_is_enabled(p_instance->p_reg,int_mask))
-    {
-        nrf_rtc_int_disable(p_instance->p_reg,int_mask);
-        if (nrf_rtc_event_pending(p_instance->p_reg,event))
-        {
-            nrf_rtc_event_clear(p_instance->p_reg,event);
-            return NRF_ERROR_TIMEOUT;
-        }
-    }
-    return NRF_SUCCESS;
-}
-
-ret_code_t nrf_drv_rtc_cc_set(nrf_drv_rtc_t const * const p_instance,
-                              uint32_t channel,
-                              uint32_t val,
-                              bool enable_irq)
-{
-    ASSERT(m_cb[p_instance->instance_id].state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(channel<p_instance->cc_channel_count);
-
-    uint32_t int_mask = RTC_CHANNEL_INT_MASK(channel);
-    nrf_rtc_event_t event    = RTC_CHANNEL_EVENT_ADDR(channel);
-
-    nrf_rtc_event_disable(p_instance->p_reg, int_mask);
-    nrf_rtc_int_disable(p_instance->p_reg, int_mask);
-
-    val = RTC_WRAP(val);
-    if (m_cb[p_instance->instance_id].reliable)
-    {
-        nrf_rtc_cc_set(p_instance->p_reg,channel,val);
-        uint32_t cnt = nrf_rtc_counter_get(p_instance->p_reg);
-        int32_t diff = cnt - val;
-        if (cnt < val)
-        {
-            diff += RTC_COUNTER_COUNTER_Msk;
-        }
-        if (diff < m_cb[p_instance->instance_id].tick_latency)
-        {
-            return NRF_ERROR_TIMEOUT;
-        }
-    }
-    else
-    {
-        nrf_rtc_cc_set(p_instance->p_reg,channel,val);
-    }
-
-    if (enable_irq)
-    {
-        nrf_rtc_event_clear(p_instance->p_reg,event);
-        nrf_rtc_int_enable(p_instance->p_reg, int_mask);
-    }
-    nrf_rtc_event_enable(p_instance->p_reg,int_mask);
-
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_rtc_tick_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq)
-{
-    nrf_rtc_event_t event = NRF_RTC_EVENT_TICK;
-    uint32_t mask = NRF_RTC_INT_TICK_MASK;
-
-    nrf_rtc_event_clear(p_instance->p_reg, event);
-    nrf_rtc_event_enable(p_instance->p_reg, mask);
-    if (enable_irq)
-    {
-        nrf_rtc_int_enable(p_instance->p_reg, mask);
-    }
-}
-
-void nrf_drv_rtc_tick_disable(nrf_drv_rtc_t const * const p_instance)
-{
-    uint32_t mask = NRF_RTC_INT_TICK_MASK;
-
-    nrf_rtc_event_disable(p_instance->p_reg, mask);
-    nrf_rtc_int_disable(p_instance->p_reg, mask);
-}
-
-void nrf_drv_rtc_overflow_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq)
-{
-    nrf_rtc_event_t event = NRF_RTC_EVENT_OVERFLOW;
-    uint32_t mask = NRF_RTC_INT_OVERFLOW_MASK;
-
-    nrf_rtc_event_clear(p_instance->p_reg, event);
-    nrf_rtc_event_enable(p_instance->p_reg, mask);
-    if (enable_irq)
-    {
-        nrf_rtc_int_enable(p_instance->p_reg, mask);
-    }
-}
-void nrf_drv_rtc_overflow_disable(nrf_drv_rtc_t const * const p_instance)
-{
-    uint32_t mask = NRF_RTC_INT_OVERFLOW_MASK;
-    nrf_rtc_event_disable(p_instance->p_reg, mask);
-    nrf_rtc_int_disable(p_instance->p_reg, mask);
-}
-
-uint32_t nrf_drv_rtc_max_ticks_get(nrf_drv_rtc_t const * const p_instance)
-{
-    ASSERT(m_cb[p_instance->instance_id].reliable);
-    uint32_t ticks;
-    if (m_cb[p_instance->instance_id].reliable)
-    {
-        ticks = RTC_COUNTER_COUNTER_Msk - m_cb[p_instance->instance_id].tick_latency;
-    }
-    else
-    {
-        ticks = RTC_COUNTER_COUNTER_Msk;
-    }
-    return ticks;
-}
-
-/**@brief Generic function for handling RTC interrupt
- *
- * @param[in]  p_reg         Pointer to instance register structure.
- * @param[in]  instance_id   Index of instance.
- */
-__STATIC_INLINE void nrf_drv_rtc_int_handler(NRF_RTC_Type * p_reg,
-                                             uint32_t instance_id,
-                                             uint32_t channel_count)
-{
-    uint32_t i;
-    uint32_t int_mask = (uint32_t)NRF_RTC_INT_COMPARE0_MASK;
-    nrf_rtc_event_t event = NRF_RTC_EVENT_COMPARE_0;
-
-    for (i = 0; i < channel_count; i++)
-    {
-        if (nrf_rtc_int_is_enabled(p_reg,int_mask) && nrf_rtc_event_pending(p_reg,event))
-        {
-            nrf_rtc_event_disable(p_reg,int_mask);
-            nrf_rtc_int_disable(p_reg,int_mask);
-            nrf_rtc_event_clear(p_reg,event);
-            m_handlers[instance_id]((nrf_drv_rtc_int_type_t)i);
-        }
-        int_mask <<= 1;
-        event    = (nrf_rtc_event_t)((uint32_t)event + sizeof(uint32_t));
-    }
-    event = NRF_RTC_EVENT_TICK;
-    if (nrf_rtc_int_is_enabled(p_reg,NRF_RTC_INT_TICK_MASK) &&
-        nrf_rtc_event_pending(p_reg, event))
-    {
-        nrf_rtc_event_clear(p_reg, event);
-        m_handlers[instance_id](NRF_DRV_RTC_INT_TICK);
-    }
-
-    event = NRF_RTC_EVENT_OVERFLOW;
-    if (nrf_rtc_int_is_enabled(p_reg,NRF_RTC_INT_OVERFLOW_MASK) &&
-        nrf_rtc_event_pending(p_reg, event))
-    {
-        nrf_rtc_event_clear(p_reg,event);
-        m_handlers[instance_id](NRF_DRV_RTC_INT_OVERFLOW);
-    }
-}
-
-#if RTC0_ENABLED
-void RTC0_IRQHandler(void)
-{
-    nrf_drv_rtc_int_handler(NRF_RTC0,RTC0_INSTANCE_INDEX, NRF_RTC_CC_CHANNEL_COUNT(0));
-}
-#endif
-
-#if RTC1_ENABLED
-void RTC1_IRQHandler(void)
-{
-    nrf_drv_rtc_int_handler(NRF_RTC1,RTC1_INSTANCE_INDEX, NRF_RTC_CC_CHANNEL_COUNT(1));
-}
-#endif
-
-#if RTC2_ENABLED
-void RTC2_IRQHandler(void)
-{
-    nrf_drv_rtc_int_handler(NRF_RTC2,RTC2_INSTANCE_INDEX, NRF_RTC_CC_CHANNEL_COUNT(2));
-}
-#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/drivers_nrf/rtc/nrf_drv_rtc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rtc/nrf_drv_rtc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rtc/nrf_drv_rtc.h
deleted file mode 100644
index 72e639f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/rtc/nrf_drv_rtc.h
+++ /dev/null
@@ -1,333 +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.
- *
- */
-
-#ifndef NRF_DRV_RTC_H
-#define NRF_DRV_RTC_H
-
-
-#include "nordic_common.h"
-#include "nrf_drv_config.h"
-#include "nrf_drv_common.h"
-#include "nrf_rtc.h"
-#include "sdk_errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup nrf_rtc RTC HAL and driver
- * @ingroup nrf_drivers
- * @brief Real timer counter (RTC) APIs.
- * @details The RTC HAL provides basic APIs for accessing the registers of the real time counter (RTC).
- * The RTC driver provides APIs on a higher level.
- *
- * @defgroup nrf_drv_rtc RTC driver
- * @{
- * @ingroup nrf_rtc
- * @brief Real timer counter (RTC) driver.
- */
-
-/**@brief Macro to convert microseconds into ticks. */
-#define RTC_US_TO_TICKS(us,freq) ((us*freq)/1000000)
-
-/**
- * @enum nrf_drv_rtc_int_type_t
- * @brief RTC driver interrupt types.
- */
-typedef enum
-{
-    NRF_DRV_RTC_INT_COMPARE0 = 0, /**< Interrupt from COMPARE0 event. */
-    NRF_DRV_RTC_INT_COMPARE1 = 1, /**< Interrupt from COMPARE1 event. */
-    NRF_DRV_RTC_INT_COMPARE2 = 2, /**< Interrupt from COMPARE2 event. */
-    NRF_DRV_RTC_INT_COMPARE3 = 3, /**< Interrupt from COMPARE3 event. */
-    NRF_DRV_RTC_INT_TICK     = 4, /**< Interrupt from TICK event. */
-    NRF_DRV_RTC_INT_OVERFLOW = 5  /**< Interrupt from OVERFLOW event. */
-} nrf_drv_rtc_int_type_t;
-
-/**@brief RTC driver instance  structure. */
-typedef struct
-{
-    NRF_RTC_Type  * p_reg;            /**< Pointer to instance register set. */
-    IRQn_Type       irq;              /**< Instance IRQ ID. */
-    uint8_t         instance_id;      /**< Instance index. */
-    uint8_t         cc_channel_count; /**< Number of capture/compare channels. */
-} nrf_drv_rtc_t;
-
-/**@brief Macro for creating RTC driver instance.*/
-#define NRF_DRV_RTC_INSTANCE(id)                           \
-{                                                          \
-    .p_reg            = CONCAT_2(NRF_RTC, id),             \
-    .irq              = CONCAT_3(RTC, id, _IRQn),          \
-    .instance_id      = CONCAT_3(RTC, id, _INSTANCE_INDEX),\
-    .cc_channel_count = NRF_RTC_CC_CHANNEL_COUNT(id),      \
-}
-
-/**@brief RTC driver instance configuration structure. */
-typedef struct
-{
-    uint16_t prescaler;          /**< Prescaler. */
-    uint8_t  interrupt_priority; /**< Interrupt priority. */
-    uint8_t  tick_latency;       /**< Maximum length of interrupt handler in ticks (max 7.7 ms). */
-    bool     reliable;           /**< Reliable mode flag. */
-} nrf_drv_rtc_config_t;
-
-/**@brief RTC instance default configuration. */
-#define NRF_DRV_RTC_DEFAULT_CONFIG(id)                                                                   \
-{                                                                                                        \
-    .prescaler          = (uint16_t)(RTC_INPUT_FREQ / CONCAT_3(RTC, id, _CONFIG_FREQUENCY))-1,           \
-    .interrupt_priority = CONCAT_3(RTC, id, _CONFIG_IRQ_PRIORITY),                                       \
-    .reliable           = CONCAT_3(RTC, id, _CONFIG_RELIABLE),                                           \
-    .tick_latency       = RTC_US_TO_TICKS(NRF_MAXIMUM_LATENCY_US, CONCAT_3(RTC, id, _CONFIG_FREQUENCY)), \
-}
-
-/**@brief RTC driver instance handler type. */
-typedef void (*nrf_drv_rtc_handler_t)(nrf_drv_rtc_int_type_t int_type);
-
-/**@brief Function for initializing the RTC driver instance.
- *
- * After initialization, the instance is in power off state.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  p_config           Initial configuration. Default configuration used if NULL.
- * @param[in]  handler            User's event handler.
- *
- * @retval     NRF_SUCCESS               If successfully initialized.
- * @retval     NRF_ERROR_INVALID_PARAM   If no handler was provided.
- * @retval     NRF_ERROR_INVALID_STATE   If the instance is already initialized.
- */
-ret_code_t nrf_drv_rtc_init(nrf_drv_rtc_t const * const p_instance,
-                            nrf_drv_rtc_config_t const * p_config,
-                            nrf_drv_rtc_handler_t handler);
-
-/**@brief Function for uninitializing the RTC driver instance.
- *
- * After uninitialization, the instance is in idle state. The hardware should return to the state
- *       before initialization. The function asserts if the instance is in idle state.
- *
- * @param[in]  p_instance         Pointer to the instance.
- */
-void nrf_drv_rtc_uninit(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for enabling the RTC driver instance.
- *
- * @note Function asserts if instance is enabled.
- *
- * @param[in]  p_instance         Pointer to the instance.
- */
-void nrf_drv_rtc_enable(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for disabling the RTC driver instance.
- *
- * @note Function asserts if instance is disabled.
- *
- * @param[in]  p_instance         Pointer to instance.
- */
-void nrf_drv_rtc_disable(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for setting a compare channel.
- *
- * The function asserts if the instance is not initialized or if the channel parameter is
- *       wrong. The function powers on the instance if the instance was in power off state.
- *
- * The driver is not entering a critical section when configuring RTC, which means that it can be
- *       preempted for a certain amount of time. When the driver was preempted and the value to be set
- *       is short in time, there is a risk that the driver sets a compare value that is
- *       behind. If RTCn_CONFIG_RELIABLE is 1 for the given instance, the Reliable mode handles that case.
- *       However, to detect if the requested value is behind, this mode makes the following assumptions:
- *       - The maximum preemption time in ticks (8-bit value) is known and is less than 7.7 ms
- *         (for prescaler = 0, RTC frequency 32 kHz).
- *       - The requested absolute compare value is not bigger than (0x00FFFFFF)-tick_latency. It is
- *         the user's responsibility to ensure that.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  channel            One of the instance's channels.
- * @param[in]  val                Absolute value to be set in the compare register.
- * @param[in]  enable_irq         True to enable the interrupt. False to disable the interrupt.
- *
- * @retval     NRF_SUCCESS         If the procedure was successful.
- * @retval     NRF_ERROR_TIMEOUT   If the compare was not set because the request value is behind the current counter
- *                                 value. This error can only be reported if RTCn_CONFIG_RELIABLE = 1.
- */
-ret_code_t nrf_drv_rtc_cc_set(nrf_drv_rtc_t const * const p_instance,
-                              uint32_t channel,
-                              uint32_t val,
-                              bool enable_irq);
-
-/**@brief Function for disabling a channel.
- *
- * This function disables channel events and channel interrupts. The function asserts if the instance is not
- *       initialized or if the channel parameter is wrong.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  channel             One of the instance's channels.
- *
- * @retval     NRF_SUCCESS         If the procedure was successful.
- * @retval     NRF_ERROR_TIMEOUT   If an interrupt was pending on the requested channel.
- */
-ret_code_t nrf_drv_rtc_cc_disable(nrf_drv_rtc_t const * const p_instance, uint32_t channel);
-
-/**@brief Function for enabling tick.
- *
- * This function enables the tick event and optionally the interrupt. The function asserts if the instance is not
- *       powered on.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  enable_irq         True to enable the interrupt. False to disable the interrupt.
- */
-void nrf_drv_rtc_tick_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq);
-
-/**@brief Function for disabling tick.
- *
- * This function disables the tick event and interrupt.
- *
- * @param[in]  p_instance         Pointer to the instance.
- */
-void nrf_drv_rtc_tick_disable(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for enabling overflow.
- *
- * This function enables the overflow event and optionally the interrupt. The function asserts if the instance is
- *       not powered on.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  enable_irq         True to enable the interrupt. False to disable the interrupt.
- */
-void nrf_drv_rtc_overflow_enable(nrf_drv_rtc_t const * const p_instance, bool enable_irq);
-
-/**@brief Function for disabling overflow.
- *
- * This function disables the overflow event and interrupt.
- *
- * @param[in]  p_instance         Pointer to the instance.
- */
-void nrf_drv_rtc_overflow_disable(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for getting the maximum relative ticks value that can be set in the compare channel.
- *
- * When a SoftDevice is used, it occupies the highest level interrupt, so that the application code can be
- *       interrupted at any moment for a certain period of time. If Reliable mode is enabled, the provided
- *       maximum latency is taken into account and the return value is smaller than the RTC counter
- *       resolution. If Reliable mode is disabled, the return value equals the counter resolution.
- *
- * @param[in]  p_instance  Pointer to the instance.
- *
- * @retval     ticks         Maximum ticks value.
- */
-uint32_t nrf_drv_rtc_max_ticks_get(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for disabling all instance interrupts.
-  *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  p_mask              Pointer to the location where the mask is filled.
- */
-__STATIC_INLINE void nrf_drv_rtc_int_disable(nrf_drv_rtc_t const * const p_instance,
-                                             uint32_t * p_mask);
-
-/**@brief Function for enabling instance interrupts.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  mask               Mask of interrupts to enable.
- */
-__STATIC_INLINE void nrf_drv_rtc_int_enable(nrf_drv_rtc_t const * const p_instance, uint32_t mask);
-
-/**@brief Function for retrieving the current counter value.
- *
- * This function asserts if the instance is not powered on or if p_val is NULL.
- *
- * @param[in]  p_instance    Pointer to the instance.
- *
- * @retval     value         Counter value.
- */
-__STATIC_INLINE uint32_t nrf_drv_rtc_counter_get(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for clearing the counter value.
- *
- * This function asserts if the instance is not powered on.
- *
- * @param[in]  p_instance         Pointer to the instance.
- */
-__STATIC_INLINE void nrf_drv_rtc_counter_clear(nrf_drv_rtc_t const * const p_instance);
-
-/**@brief Function for returning a requested task address for the RTC driver instance.
- *
- * This function asserts if the output pointer is NULL. The task address can be used by the PPI module.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  task                One of the peripheral tasks.
- *
- * @retval     Address of task register.
- */
-__STATIC_INLINE uint32_t nrf_drv_rtc_task_address_get(nrf_drv_rtc_t const * const p_instance,
-                                                      nrf_rtc_task_t task);
-
-/**@brief Function for returning a requested event address for the RTC driver instance.
- *
- * This function asserts if the output pointer is NULL. The event address can be used by the PPI module.
- *
- * @param[in]  p_instance         Pointer to the instance.
- * @param[in]  event               One of the peripheral events.
- *
- * @retval     Address of event register.
- */
-__STATIC_INLINE uint32_t nrf_drv_rtc_event_address_get(nrf_drv_rtc_t const * const p_instance,
-                                                       nrf_rtc_event_t event);
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_drv_rtc_int_disable(nrf_drv_rtc_t const * const p_instance,
-                                                 uint32_t * p_mask)
-{
-    *p_mask = nrf_rtc_int_get(p_instance->p_reg);
-    nrf_rtc_int_disable(p_instance->p_reg, NRF_RTC_INT_TICK_MASK |
-                                           NRF_RTC_INT_OVERFLOW_MASK |
-                                           NRF_RTC_INT_COMPARE0_MASK |
-                                           NRF_RTC_INT_COMPARE1_MASK |
-                                           NRF_RTC_INT_COMPARE2_MASK |
-                                           NRF_RTC_INT_COMPARE3_MASK);
-}
-
-__STATIC_INLINE void nrf_drv_rtc_int_enable(nrf_drv_rtc_t const * const p_instance, uint32_t mask)
-{
-    nrf_rtc_int_enable(p_instance->p_reg, mask);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_rtc_counter_get(nrf_drv_rtc_t const * const p_instance)
-{
-    return nrf_rtc_counter_get(p_instance->p_reg);
-}
-
-__STATIC_INLINE void nrf_drv_rtc_counter_clear(nrf_drv_rtc_t const * const p_instance)
-{
-    nrf_rtc_task_trigger(p_instance->p_reg,NRF_RTC_TASK_CLEAR);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_rtc_task_address_get(nrf_drv_rtc_t const * const p_instance,
-                                                      nrf_rtc_task_t task)
-{
-    return nrf_rtc_task_address_get(p_instance->p_reg, task);
-}
-
-__STATIC_INLINE uint32_t nrf_drv_rtc_event_address_get(nrf_drv_rtc_t const * const p_instance,
-                                                       nrf_rtc_event_t event)
-{
-    return nrf_rtc_event_address_get(p_instance->p_reg, event);
-}
-#endif /* SUPPRESS_INLINE_IMPLEMENTATION */
-
-/**
- *@}
- **/
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_DRV_RTC_H */


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

Posted by cc...@apache.org.
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/twi_master/nrf_drv_twi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/nrf_drv_twi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/nrf_drv_twi.h
deleted file mode 100644
index 980822a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twi_master/nrf_drv_twi.h
+++ /dev/null
@@ -1,415 +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.
- *
- */
-
-/**
- *
- * @defgroup nrf_twi Two-wire interface (TWI)
- * @ingroup nrf_drivers
- * @brief Two-wire interface (TWI) APIs.
- *
- * @defgroup nrf_twi_master TWI master HAL and driver
- * @ingroup nrf_twi
- * @brief TWI master APIs.
- * @details The TWI and TWIM HALs provide basic APIs for accessing the registers of the TWI and TWIM peripherals, respectively.
- *
- * The TWI master driver provides APIs on a higher level.
- *
- */
-
-#ifndef NRF_DRV_TWI_H__
-#define NRF_DRV_TWI_H__
-
-#include "nordic_common.h"
-#include "nrf_drv_config.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// This set of macros makes it possible to exclude parts of code when one type
-// of supported peripherals is not used.
-#if ((TWI0_ENABLED == 1 && TWI0_USE_EASY_DMA == 1) || \
-     (TWI1_ENABLED == 1 && TWI1_USE_EASY_DMA == 1))
-    #define TWIM_IN_USE
-#endif
-#if ((TWI0_ENABLED == 1 && TWI0_USE_EASY_DMA != 1) || \
-     (TWI1_ENABLED == 1 && TWI1_USE_EASY_DMA != 1))
-    #define TWI_IN_USE
-#endif
-
-#include "nrf_twi.h"
-#ifdef TWIM_IN_USE
-    #include "nrf_twim.h"
-#endif
-#include "sdk_errors.h"
-
-#if defined(NRF52)
-    #define NRF_DRV_TWI_PERIPHERAL(id)           \
-        (CONCAT_3(TWI, id, _USE_EASY_DMA) == 1 ? \
-            (void *)CONCAT_2(NRF_TWIM, id)       \
-          : (void *)CONCAT_2(NRF_TWI, id))
-#else
-    #define NRF_DRV_TWI_PERIPHERAL(id)  (void *)CONCAT_2(NRF_TWI, id)
-#endif
-
-/**
- * @defgroup nrf_drv_twi TWI master driver
- * @{
- * @ingroup nrf_twi_master
- * @brief   Multi-instance TWI master driver.
- */
-
-/**
- * @brief Structure for the TWI master driver instance.
- */
-typedef struct
-{
-    union
-    {
-#ifdef TWIM_IN_USE
-        NRF_TWIM_Type * p_twim; ///< Pointer to a structure with TWIM registers.
-#endif
-        NRF_TWI_Type  * p_twi;  ///< Pointer to a structure with TWI registers.
-    } reg;
-    uint8_t drv_inst_idx; ///< Driver instance index.
-    bool    use_easy_dma; ///< True if the peripheral with EasyDMA (TWIM) shall be used.
-} nrf_drv_twi_t;
-
-/**
- * @brief Macro for creating a TWI master driver instance.
- */
-#define NRF_DRV_TWI_INSTANCE(id)                        \
-{                                                       \
-    .reg          = {NRF_DRV_TWI_PERIPHERAL(id)},       \
-    .drv_inst_idx = CONCAT_3(TWI, id, _INSTANCE_INDEX), \
-    .use_easy_dma = CONCAT_3(TWI, id, _USE_EASY_DMA)    \
-}
-
-/**
- * @brief Structure for the TWI master driver instance configuration.
- */
-typedef struct
-{
-    uint32_t            scl;                ///< SCL pin number.
-    uint32_t            sda;                ///< SDA pin number.
-    nrf_twi_frequency_t frequency;          ///< TWI frequency.
-    uint8_t             interrupt_priority; ///< Interrupt priority.
-} nrf_drv_twi_config_t;
-
-/**
- * @brief TWI master driver instance default configuration.
- */
-#define NRF_DRV_TWI_DEFAULT_CONFIG(id)                            \
-{                                                                 \
-    .frequency          = CONCAT_3(TWI, id, _CONFIG_FREQUENCY),   \
-    .scl                = CONCAT_3(TWI, id, _CONFIG_SCL),         \
-    .sda                = CONCAT_3(TWI, id, _CONFIG_SDA),         \
-    .interrupt_priority = CONCAT_3(TWI, id, _CONFIG_IRQ_PRIORITY) \
-}
-
-#define NRF_DRV_TWI_FLAG_TX_POSTINC          (1UL << 0) /**< TX buffer address incremented after transfer. */
-#define NRF_DRV_TWI_FLAG_RX_POSTINC          (1UL << 1) /**< RX buffer address incremented after transfer. */
-#define NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER (1UL << 2) /**< Interrupt after each transfer is suppressed, and the event handler is not called. */
-#define NRF_DRV_TWI_FLAG_HOLD_XFER           (1UL << 3) /**< Set up the transfer but do not start it. */
-#define NRF_DRV_TWI_FLAG_REPEATED_XFER       (1UL << 4) /**< Flag indicating that the transfer will be executed multiple times. */
-#define NRF_DRV_TWI_FLAG_TX_NO_STOP          (1UL << 5) /**< Flag indicating that the TX transfer will not end with a stop condition. */
-#define NRF_DRV_TWI_FLAG_RX_NO_STOP          (1UL << 6) /**< Flag indicating that the RX transfer will not end with a stop condition. */
-
-/**
- * @brief TWI master driver event types.
- */
-typedef enum
-{
-    NRF_DRV_TWI_EVT_DONE,         ///< Transfer completed event.
-    NRF_DRV_TWI_EVT_ADDRESS_NACK, ///< Error event: NACK received after sending the address.
-    NRF_DRV_TWI_EVT_DATA_NACK     ///< Error event: NACK received after sending a data byte.
-} nrf_drv_twi_evt_type_t;
-
-/**
- * @brief TWI master driver transfer types.
- */
-typedef enum
-{
-    NRF_DRV_TWI_XFER_TX,          ///< TX transfer.
-    NRF_DRV_TWI_XFER_RX,          ///< RX transfer.
-    NRF_DRV_TWI_XFER_TXRX,        ///< TX transfer followed by RX transfer with repeated start.
-    NRF_DRV_TWI_XFER_TXTX         ///< TX transfer followed by TX transfer with repeated start.
-} nrf_drv_twi_xfer_type_t;
-
-/**
- * @brief Structure for a TWI transfer descriptor.
- */
-typedef struct
-{
-    nrf_drv_twi_xfer_type_t type;             ///< Type of transfer.
-    uint8_t                 address;          ///< Slave address.
-    uint8_t                 primary_length;   ///< Number of bytes transferred.
-    uint8_t                 secondary_length; ///< Number of bytes transferred.
-    uint8_t *               p_primary_buf;    ///< Pointer to transferred data.
-    uint8_t *               p_secondary_buf;  ///< Pointer to transferred data.
-} nrf_drv_twi_xfer_desc_t;
-
-
-/**@brief Macro for setting the TX transfer descriptor. */
-#define NRF_DRV_TWI_XFER_DESC_TX(addr, p_data, length)                 \
-    {                                                                  \
-        .type = NRF_DRV_TWI_XFER_TX,                                   \
-        .address = addr,                                               \
-        .primary_length = length,                                      \
-        .p_primary_buf  = p_data,                                      \
-    }
-
-/**@brief Macro for setting the RX transfer descriptor. */
-#define NRF_DRV_TWI_XFER_DESC_RX(addr, p_data, length)                 \
-    {                                                                  \
-        .type = NRF_DRV_TWI_XFER_RX,                                   \
-        .address = addr,                                               \
-        .primary_length = length,                                      \
-        .p_primary_buf  = p_data,                                      \
-    }
-
-/**@brief Macro for setting the TXRX transfer descriptor. */
-#define NRF_DRV_TWI_XFER_DESC_TXRX(addr, p_tx, tx_len, p_rx, rx_len)   \
-    {                                                                  \
-        .type = NRF_DRV_TWI_XFER_TXRX,                                 \
-        .address = addr,                                               \
-        .primary_length   = tx_len,                                    \
-        .secondary_length = rx_len,                                    \
-        .p_primary_buf    = p_tx,                                      \
-        .p_secondary_buf  = p_rx,                                      \
-    }
-
-/**@brief Macro for setting the TXTX transfer descriptor. */
-#define NRF_DRV_TWI_XFER_DESC_TXTX(addr, p_tx, tx_len, p_tx2, tx_len2) \
-    {                                                                  \
-        .type = NRF_DRV_TWI_XFER_TXTX,                                 \
-        .address = addr,                                               \
-        .primary_length   = tx_len,                                    \
-        .secondary_length = tx_len2,                                   \
-        .p_primary_buf    = p_tx,                                      \
-        .p_secondary_buf  = p_tx2,                                     \
-    }
-
-/**
- * @brief Structure for a TWI event.
- */
-typedef struct
-{
-    nrf_drv_twi_evt_type_t  type;      ///< Event type.
-    nrf_drv_twi_xfer_desc_t xfer_desc; ///< Transfer details.
-} nrf_drv_twi_evt_t;
-
-/**
- * @brief TWI event handler prototype.
- */
-typedef void (* nrf_drv_twi_evt_handler_t)(nrf_drv_twi_evt_t const * p_event,
-                                           void *                    p_context);
-
-/**
- * @brief Function for initializing the TWI instance.
- *
- * @param[in] p_instance      TWI instance.
- * @param[in] p_config        Initial configuration. If NULL, the default configuration is used.
- * @param[in] event_handler   Event handler provided by the user. If NULL, blocking mode is enabled.
- * @param[in] p_context       Context passed to event handler.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the driver is in invalid state.
- * @retval NRF_ERROR_BUSY          If some other peripheral with the same
- *                                 instance ID is already in use. This is
- *                                 possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED
- *                                 is set to a value other than zero.
- */
-ret_code_t nrf_drv_twi_init(nrf_drv_twi_t const *        p_instance,
-                            nrf_drv_twi_config_t const * p_config,
-                            nrf_drv_twi_evt_handler_t    event_handler,
-                            void *                       p_context);
-
-/**
- * @brief Function for uninitializing the TWI instance.
- *
- * @param[in] p_instance  TWI instance.
- */
-void nrf_drv_twi_uninit(nrf_drv_twi_t const * p_instance);
-
-/**
- * @brief Function for enabling the TWI instance.
- *
- * @param[in] p_instance  TWI instance.
- */
-void nrf_drv_twi_enable(nrf_drv_twi_t const * p_instance);
-
-/**
- * @brief Function for disabling the TWI instance.
- *
- * @param[in] p_instance  TWI instance.
- */
-void nrf_drv_twi_disable(nrf_drv_twi_t const * p_instance);
-
-/**
- * @brief Function for sending data to a TWI slave.
- *
- * The transmission will be stopped when an error occurs. If a transfer is ongoing,
- * the function returns the error code @ref NRF_ERROR_BUSY.
- *
- * @param[in] p_instance TWI instance.
- * @param[in] address    Address of a specific slave device (only 7 LSB).
- * @param[in] p_data     Pointer to a transmit buffer.
- * @param[in] length     Number of bytes to send.
- * @param[in] no_stop    If set, the stop condition is not generated on the bus
- *                       after the transfer has completed successfully (allowing
- *                       for a repeated start in the next transfer).
- *
- * @retval NRF_SUCCESS        If the procedure was successful.
- * @retval NRF_ERROR_BUSY     If the driver is not ready for a new transfer.
- * @retval NRF_ERROR_INTERNAL If an error was detected by hardware.
- */
-ret_code_t nrf_drv_twi_tx(nrf_drv_twi_t const * p_instance,
-                          uint8_t               address,
-                          uint8_t const *       p_data,
-                          uint8_t               length,
-                          bool                  no_stop);
-
-/**
- * @brief Function for reading data from a TWI slave.
- *
- * The transmission will be stopped when an error occurs. If a transfer is ongoing,
- * the function returns the error code @ref NRF_ERROR_BUSY.
- *
- * @param[in] p_instance TWI instance.
- * @param[in] address    Address of a specific slave device (only 7 LSB).
- * @param[in] p_data     Pointer to a receive buffer.
- * @param[in] length     Number of bytes to be received.
- *
- * @retval NRF_SUCCESS             If the procedure was successful.
- * @retval NRF_ERROR_BUSY          If the driver is not ready for a new transfer.
- * @retval NRF_ERROR_INTERNAL      If an error was detected by hardware.
- */
-ret_code_t nrf_drv_twi_rx(nrf_drv_twi_t const * p_instance,
-                          uint8_t               address,
-                          uint8_t *             p_data,
-                          uint8_t               length);
-
-/**
- * @brief Function for reading data from a TWI slave.
- *
- * The transmission will be stopped when an error occurs. If a transfer is ongoing,
- * the function returns the error code @ref NRF_ERROR_BUSY.
- *
- * @param[in] p_instance TWI instance.
- * @param[in] address    Address of a specific slave device (only 7 LSB).
- * @param[in] p_data     Pointer to a receive buffer.
- * @param[in] length     Number of bytes to be received.
- * @param[in] no_stop    If set, do not generate a stop after transfer
- *
- * @retval NRF_SUCCESS             If the procedure was successful.
- * @retval NRF_ERROR_BUSY          If the driver is not ready for a new transfer.
- * @retval NRF_ERROR_INTERNAL      If an error was detected by hardware.
- */
-ret_code_t nrf_drv_twi_rx_ext(nrf_drv_twi_t const * p_instance,
-                              uint8_t               address,
-                              uint8_t *             p_data,
-                              uint8_t               length,
-                              bool                  no_stop);
-
-/**
- * @brief Function for preparing a TWI transfer.
- *
- * The following transfer types can be configured (@ref nrf_drv_twi_xfer_desc_t::type):
- * - @ref NRF_DRV_TWI_XFER_TXRX<span></span>: Write operation followed by a read operation (without STOP condition in between).
- * - @ref NRF_DRV_TWI_XFER_TXTX<span></span>: Write operation followed by a write operation (without STOP condition in between).
- * - @ref NRF_DRV_TWI_XFER_TX<span></span>:   Write operation (with or without STOP condition).
- * - @ref NRF_DRV_TWI_XFER_RX<span></span>:   Read operation  (with STOP condition).
- *
- * Additional options are provided using the flags parameter:
- * - @ref NRF_DRV_TWI_FLAG_TX_POSTINC and @ref NRF_DRV_TWI_FLAG_RX_POSTINC<span></span>: Post-incrementation of buffer addresses. Supported only by TWIM.
- * - @ref NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER<span></span>: No user event handler after transfer completion. In most cases, this also means no interrupt at the end of the transfer.
- * - @ref NRF_DRV_TWI_FLAG_HOLD_XFER<span></span>: Driver is not starting the transfer. Use this flag if the transfer is triggered externally by PPI. Supported only by TWIM.
- *   Use @ref nrf_drv_twi_start_task_get to get the address of the start task.
- * - @ref NRF_DRV_TWI_FLAG_REPEATED_XFER<span></span>: Prepare for repeated transfers. You can set up a number of transfers that will be triggered externally (for example by PPI).
- *   An example is a TXRX transfer with the options @ref NRF_DRV_TWI_FLAG_RX_POSTINC, @ref NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER, and @ref NRF_DRV_TWI_FLAG_REPEATED_XFER.
- *   After the transfer is set up, a set of transfers can be triggered by PPI that will read, for example, the same register of an
- *   external component and put it into a RAM buffer without any interrupts. @ref nrf_drv_twi_stopped_event_get can be used to get the
- *   address of the STOPPED event, which can be used to count the number of transfers. If @ref NRF_DRV_TWI_FLAG_REPEATED_XFER is used,
- *   the driver does not set the instance into busy state, so you must ensure that the next transfers are set up
- *   when TWIM is not active. Supported only by TWIM.
- * - @ref NRF_DRV_TWI_FLAG_TX_NO_STOP<span></span>: No stop condition after TX transfer.
- *
- * @note
- * Some flag combinations are invalid:
- * - @ref NRF_DRV_TWI_FLAG_TX_NO_STOP with @ref nrf_drv_twi_xfer_desc_t::type different than @ref NRF_DRV_TWI_XFER_TX
- * - @ref NRF_DRV_TWI_FLAG_REPEATED_XFER with @ref nrf_drv_twi_xfer_desc_t::type set to @ref NRF_DRV_TWI_XFER_TXTX
- *
- * If @ref nrf_drv_twi_xfer_desc_t::type is set to @ref NRF_DRV_TWI_XFER_TX and the @ref NRF_DRV_TWI_FLAG_TX_NO_STOP and @ref NRF_DRV_TWI_FLAG_REPEATED_XFER
- * flags are set, two tasks must be used to trigger a transfer: TASKS_RESUME followed by TASKS_STARTTX. If no stop condition is generated,
- * TWIM is in SUSPENDED state. Therefore, it must be resumed before the transfer can be started.
- *
- * @note
- * This function should be used only if the instance is configured to work in non-blocking mode. If the function is used in blocking mode, the driver asserts.
- * @note If you are using this function with TWI, the only supported flag is @ref NRF_DRV_TWI_FLAG_TX_NO_STOP. All other flags require TWIM.
-  *
- * @param[in] p_instance        TWI instance.
- * @param[in] p_xfer_desc       Pointer to the transfer descriptor.
- * @param[in] flags             Transfer options (0 for default settings).
- *
- * @retval NRF_SUCCESS             If the procedure was successful.
- * @retval NRF_ERROR_BUSY          If the driver is not ready for a new transfer.
- * @retval NRF_ERROR_NOT_SUPPORTED If the provided parameters are not supported.
- */
-ret_code_t nrf_drv_twi_xfer(nrf_drv_twi_t           const * p_instance,
-                            nrf_drv_twi_xfer_desc_t const * p_xfer_desc,
-                            uint32_t                        flags);
-
-/**
- * @brief Function for getting the transferred data count.
- *
- * This function provides valid results only in legacy mode.
- *
- * @param[in] p_instance TWI instance.
- *
- * @return     Data count.
- */
-uint32_t nrf_drv_twi_data_count_get(nrf_drv_twi_t const * const p_instance);
-
-/**
- * @brief Function for returning the address of a TWI/TWIM start task.
- *
- * This function should be used if @ref nrf_drv_twi_xfer was called with the flag @ref NRF_DRV_TWI_FLAG_HOLD_XFER.
- * In that case, the transfer is not started by the driver, but it must be started externally by PPI.
- *
- * @param[in]  p_instance TWI instance.
- * @param[in]  xfer_type  Transfer type used in the last call of the @ref nrf_drv_twi_xfer function.
- *
- * @return     Start task address (TX or RX) depending on the value of xfer_type.
- */
-uint32_t nrf_drv_twi_start_task_get(nrf_drv_twi_t const * p_instance, nrf_drv_twi_xfer_type_t xfer_type);
-
-/**
- * @brief Function for returning the address of a STOPPED TWI/TWIM event.
- *
- * A STOPPED event can be used to detect the end of a transfer if the @ref NRF_DRV_TWI_FLAG_NO_XFER_EVT_HANDLER
- * option is used.
- *
- * @param[in]  p_instance  TWI instance.
- *
- * @return     STOPPED event address.
- */
-uint32_t nrf_drv_twi_stopped_event_get(nrf_drv_twi_t const * p_instance);
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_TWI_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/twis_slave/nrf_drv_twis.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis.c
deleted file mode 100644
index 21f98ed..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis.c
+++ /dev/null
@@ -1,881 +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_twis.h"
-#include "nrf_assert.h"
-#include "nordic_common.h"
-#include "app_util_platform.h"
-#include "nrf_gpio.h"
-
-#if TWIS_COUNT == 0
-#error "TWIS driver included but none of TWIS devices is activated in the configuration file"
-#endif
-
-/**
- * @internal
- * @ingroup lib_twis_drv
- * @defgroup lib_twis_drv_ivars Software controlled TWI Slave internal variables
- *
- * Internal variables for TWIS.
- * @{
- */
-
-/**
- * @brief Actual state of internal state machine
- *
- * Current substate of powered on state.
- */
-typedef enum
-{
-    NRF_DRV_TWIS_SUBSTATE_IDLE,          ///< No ongoing transmission
-    NRF_DRV_TWIS_SUBSTATE_READ_WAITING,  ///< Read request received, waiting for data
-    NRF_DRV_TWIS_SUBSTATE_READ_PENDING,  ///< Reading is actually pending (data sending)
-    NRF_DRV_TWIS_SUBSTATE_WRITE_WAITING, ///< Write request received, waiting for data buffer
-    NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING, ///< Writing is actually pending (data receiving)
-}nrf_drv_twis_substate_t;
-
-/**
- * @brief Constant instance part
- *
- * Instance data that have not to change.
- * It may be placed in FLASH memory.
- */
-typedef struct
-{
-    NRF_TWIS_Type * const p_reg; ///< Peripheral registry address
-} nrf_drv_twis_const_inst_t;
-
-/**
- * @brief Variable instance part
- *
- * There are all informations for the instance that may change.
- */
-typedef struct
-{
-    nrf_drv_state_t                  state;      ///< Actual driver state
-    volatile nrf_drv_twis_substate_t substate;   ///< Actual driver substate
-    nrf_drv_twis_event_handler_t     ev_handler; ///< Event handler functiomn
-    volatile uint32_t                error;      ///< Internal error flags
-                                                 /**< Internal copy of hardware errors flags merged
-                                                  *   with specific internal driver errors flags.
-                                                  *
-                                                  *   @note This value can be changed in the interrupt
-                                                  *   and cleared in the main program.
-                                                  *   Always use Atomic load-store when updating
-                                                  *   this value in main loop.
-                                                  */
-}nrf_drv_twis_var_inst_t;
-
-
-/** The constant instance part implementation */
-static const nrf_drv_twis_const_inst_t m_const_inst[TWIS_COUNT] =
-{
-    #define X(n)  { .p_reg = NRF_TWIS##n },
-    #include "nrf_drv_twis_inst.def"
-};
-
-/** The variable instance part implementation */
-static nrf_drv_twis_var_inst_t m_var_inst[TWIS_COUNT] =
-{
-    #define X(n) { .state      = NRF_DRV_STATE_UNINITIALIZED, \
-                   .substate   = NRF_DRV_TWIS_SUBSTATE_IDLE, \
-                   .ev_handler = NULL, \
-                   .error      = 0 },
-    #include "nrf_drv_twis_inst.def"
-};
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n
-    #define IRQ_HANDLER(n)      static void IRQ_HANDLER_NAME(n)(void)
-
-    #if TWIS0_ENABLED
-        IRQ_HANDLER(0);
-    #endif
-    #if TWIS1_ENABLED
-        IRQ_HANDLER(1);
-    #endif
-    static nrf_drv_irq_handler_t const m_irq_handlers[TWIS_COUNT] = {
-    #if TWIS0_ENABLED
-        IRQ_HANDLER_NAME(0),
-    #endif
-    #if TWIS1_ENABLED
-        IRQ_HANDLER_NAME(1),
-    #endif
-    };
-#else
-    #define IRQ_HANDLER(n) \
-        void SPIM##n##_SPIS##n##_TWIM##n##_TWIS##n##_SPI##n##_TWI##n##_IRQHandler(void)
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-/**
- * @brief State processing semaphore
- *
- * There are semaphores used when when working in synchronous mode (without interrupts activated).
- * @note
- * In synchronous mode before every state checking the state machine is executed.
- * But the situation where state checking function is called from main task and in the same from
- * interrupt task has to be considered.
- * In such a situation the @ref nrf_drv_twis_state_machine function may be interrupted by second
- * call to the same function.
- * If in this second call any event will be detected it may be lost because new substate would be
- * overwritten when interrupted function finishes.
- * In the same time information about event would be lost because it is cleared in interrupting
- * function.
- * @note
- * To make situation described above safe, simple semaphore is implemented.
- * It is just a binary flag that informs that state machine is actually executing and should not
- * be processed in any interrupting function.
- * Because of how it is used no atomic instructions are required to support this kind of semaphore.
- * It is not waitable semaphore - function executed or not depending of its state.
- */
-static uint8_t m_sm_semaphore[TWIS_COUNT];
-
-/**
- * @brief Default configuration
- *
- * Array with default configurations for each driver instance.
- */
-static const nrf_drv_twis_config_t m_config_default[TWIS_COUNT] =
-{
-    #define X(n) NRF_DRV_TWIS_DEFAULT_CONFIG(n),
-    #include "nrf_drv_twis_inst.def"
-};
-
-/**
- * @brief Used interrupts mask
- *
- * Mask for all interrupts used by this library
- */
-static const uint32_t m_used_ints_mask =
-        NRF_TWIS_INT_STOPPED_MASK   |
-        NRF_TWIS_INT_ERROR_MASK     |
-        NRF_TWIS_INT_RXSTARTED_MASK |
-        NRF_TWIS_INT_TXSTARTED_MASK |
-        NRF_TWIS_INT_WRITE_MASK     |
-        NRF_TWIS_INT_READ_MASK;
-
-
-/** @} */ /* End  of lib_driver_twis_slave_ivars */
-
-/**
- * @internal
- * @ingroup lib_twis_drv
- * @defgroup lib_twis_drv_ifunc Software controlled TWI Slave auxiliary internal functions
- *
- * Internal variables for TWIS.
- * @{
- */
-
-/**
- * @brief Clear all  events
- *
- * Function clears all actually pending events
- */
-static void nrf_drv_twis_clear_all_events(NRF_TWIS_Type * const p_reg)
-{
-    /* Clear all events */
-    nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_STOPPED);
-    nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_ERROR);
-    nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_RXSTARTED);
-    nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_TXSTARTED);
-    nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_WRITE);
-    nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_READ);
-}
-
-/**
- * @brief Reset all the registers to known state
- *
- * This function clears all registers that requires it to known state.
- * TWIS is left disabled after this function.
- * All events are cleared.
- * @param[out] p_reg TWIS to reset register address
- */
-static inline void nrf_drv_twis_swreset(NRF_TWIS_Type * const p_reg)
-{
-    /* Disable TWIS */
-    nrf_twis_disable(p_reg);
-
-    /* Disconnect pins */
-    nrf_twis_pins_set(p_reg, ~0U, ~0U);
-
-    /* Disable interrupt global for the instance */
-    nrf_drv_common_irq_disable(nrf_drv_get_IRQn(p_reg));
-
-    /* Disable interrupts */
-    nrf_twis_int_disable(p_reg, ~0U);
-}
-
-/**
- * @brief Configure pin
- *
- * Function configures selected for work as SDA or SCL.
- * @param pin Pin number to configure
- */
-static inline void nrf_drv_twis_config_pin(uint32_t pin)
-{
-    nrf_gpio_cfg(pin,
-                 NRF_GPIO_PIN_DIR_INPUT,
-                 NRF_GPIO_PIN_INPUT_DISCONNECT,
-                 NRF_GPIO_PIN_NOPULL,
-                 NRF_GPIO_PIN_S0D1,
-                 NRF_GPIO_PIN_NOSENSE);
-}
-
-/**
- * @brief Call event handler
- *
- * Function that calls event handler.
- * The event handler would be only called if its value is != NULL.
- * @param     instNr Driver instance number that has called this runtime.
- * @param[in] pev    Event structure to pass to event handler
- * @note
- * Remember about possible multithreading.
- * It is acceptable to call old event function if it was already disabled.
- * What is unacceptable is jump into NULL pointer.
- */
-static void nrf_drv_call_event_handler(uint8_t instNr, nrf_drv_twis_evt_t const * const pev)
-{
-    nrf_drv_twis_event_handler_t evh = m_var_inst[instNr].ev_handler;
-    if(NULL != evh)
-    {
-        evh(pev);
-    }
-}
-
-/**
- * @brief Auxiliary function for getting event state on right bit possition
- *
- * This function calls @ref nrf_twis_event_get function but the the result
- * is shifted to match INTEN register scheme.
- *
- * @param[in,out] p_reg TWIS to read  event from
- * @param ev  Event code
- *
- * @return Selected event state shifted by @ref nrf_drv_event_to_bitpos
- *
- * @sa nrf_twis_event_get
- * @sa nrf_drv_event_to_bitpos
- */
-static inline uint32_t nrf_drv_twis_event_bit_get(NRF_TWIS_Type * const p_reg, nrf_twis_event_t ev)
-{
-    return (uint32_t)nrf_twis_event_get_and_clear(p_reg, ev) << nrf_drv_event_to_bitpos(ev);
-}
-
-/**
- * @brief Auxiliary function for checking event bit inside given flags value
- *
- * Function used here to check presence of the event inside given flags value.
- * It transforms given event to bit possition and then checks if in given variable it is cleared.
- *
- * @param flags Flags to test
- * @param ev Event code
- *
- * @retval true Flag for selected event is set
- * @retval false Flag for selected event is cleared
- */
-static inline bool nrf_drv_twis_check_bit(uint32_t flags, nrf_twis_event_t ev)
-{
-    return 0 != (flags & (1U<<nrf_drv_event_to_bitpos(ev)));
-}
-
-/**
- * @brief Auxiliary function for clearing event bit in given flags value
- *
- * Function used to clear selected event bit.
- *
- * @param flags Flags to process
- * @param ev    Event code to clear
- *
- * @return Value @em flags with cleared event bit that matches given @em ev
- */
-static inline uint32_t nrf_drv_twis_clear_bit(uint32_t flags, nrf_twis_event_t ev)
-{
-    return flags & ~(1U<<nrf_drv_event_to_bitpos(ev));
-}
-
-/**
- * @brief Auxiliary function for error processing
- *
- * Function called when in current substate the event apears and it cannot be processed.
- * It should be called also on ERROR event.
- * If given @em error parameter has zero value the @ref NRF_DRV_TWIS_ERROR_UNEXPECTED_EVENT
- * would be set.
- *
- * @param instNr Instance number
- * @param ev     What error event raport to event handler
- * @param error  Error flags
- */
-static inline void nrf_drv_twis_process_error(
-        uint8_t instNr,
-        nrf_drv_twis_evt_type_t ev,
-        uint32_t error)
-{
-    if(0 == error)
-        error = NRF_DRV_TWIS_ERROR_UNEXPECTED_EVENT;
-    nrf_drv_twis_evt_t evdata;
-    evdata.type = ev;
-    evdata.data.error = error;
-
-    m_var_inst[instNr].error |= error;
-
-    nrf_drv_call_event_handler(instNr, &evdata);
-}
-
-
-/**
- * @brief State machine main function
- *
- * State machine function that reacts on events.
- * This function gets all events and reacts on them only if there is any event detected.
- * It makes it possible to use it either in interrupt or in polling mode.
- * @param instNr Driver instance number that has called this runtime.
- */
-static void nrf_drv_twis_state_machine(uint8_t instNr)
-{
-    if(!TWIS_NO_SYNC_MODE)
-    {
-        /* Exclude parallel processing of this function */
-        if(m_sm_semaphore[instNr])
-        {
-            return;
-        }
-        m_sm_semaphore[instNr] = 1;
-    }
-
-    NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg;
-    /* Event data structure to be passed into event handler */
-    nrf_drv_twis_evt_t evdata;
-    /* Current substate copy  */
-    nrf_drv_twis_substate_t substate = m_var_inst[instNr].substate;
-    /* Event flags */
-    uint32_t ev = 0;
-
-    /* Get all events */
-    ev |= nrf_drv_twis_event_bit_get(p_reg, NRF_TWIS_EVENT_STOPPED);
-    ev |= nrf_drv_twis_event_bit_get(p_reg, NRF_TWIS_EVENT_ERROR);
-    ev |= nrf_drv_twis_event_bit_get(p_reg, NRF_TWIS_EVENT_RXSTARTED);
-    ev |= nrf_drv_twis_event_bit_get(p_reg, NRF_TWIS_EVENT_TXSTARTED);
-    ev |= nrf_drv_twis_event_bit_get(p_reg, NRF_TWIS_EVENT_WRITE);
-    ev |= nrf_drv_twis_event_bit_get(p_reg, NRF_TWIS_EVENT_READ);
-
-    /* State machine */
-    while(0 != ev)
-    {
-        switch(substate)
-        {
-        case NRF_DRV_TWIS_SUBSTATE_IDLE:
-            if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_STOPPED))
-            {
-                /* Stopped event is always allowed in IDLE state - just ignore */
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_STOPPED);
-            }
-            else if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_READ))
-            {
-                evdata.type = TWIS_EVT_READ_REQ;
-                if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_TXSTARTED))
-                {
-                    substate = NRF_DRV_TWIS_SUBSTATE_READ_PENDING;
-                    evdata.data.buf_req = false;
-                }
-                else
-                {
-                    substate = NRF_DRV_TWIS_SUBSTATE_READ_WAITING;
-                    evdata.data.buf_req = true;
-                }
-                nrf_drv_call_event_handler(instNr, &evdata);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_READ);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_TXSTARTED);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_WRITE);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_RXSTARTED);
-            }
-            else if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_WRITE))
-            {
-                evdata.type = TWIS_EVT_WRITE_REQ;
-                if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_RXSTARTED))
-                {
-                    substate = NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING;
-                    evdata.data.buf_req = false;
-                }
-                else
-                {
-                    substate = NRF_DRV_TWIS_SUBSTATE_WRITE_WAITING;
-                    evdata.data.buf_req = true;
-                }
-                nrf_drv_call_event_handler(instNr, &evdata);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_READ);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_TXSTARTED);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_WRITE);
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_RXSTARTED);
-            }
-            else
-            {
-                nrf_drv_twis_process_error(instNr, TWIS_EVT_GENERAL_ERROR, nrf_twis_error_source_get_and_clear(p_reg));
-                ev = 0;
-            }
-            break;
-        case NRF_DRV_TWIS_SUBSTATE_READ_WAITING:
-            if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_TXSTARTED) ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_WRITE)     ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_READ)      ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_STOPPED))
-            {
-                substate = NRF_DRV_TWIS_SUBSTATE_READ_PENDING;
-                /* Any other bits requires further processing in PENDING substate */
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_TXSTARTED);
-            }
-            else
-            {
-                nrf_drv_twis_process_error(instNr, TWIS_EVT_READ_ERROR, nrf_twis_error_source_get_and_clear(p_reg));
-                substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-                ev = 0;
-            }
-            break;
-        case NRF_DRV_TWIS_SUBSTATE_READ_PENDING:
-            if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_WRITE)||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_READ) ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_STOPPED))
-            {
-                evdata.type = TWIS_EVT_READ_DONE;
-                evdata.data.tx_amount = nrf_twis_tx_amount_get(p_reg);
-                nrf_drv_call_event_handler(instNr, &evdata);
-                /* Go to idle and repeat the state machine if READ or WRITE events detected.
-                 * This time READ or WRITE would be started */
-                substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_STOPPED);
-            }
-            else
-            {
-                nrf_drv_twis_process_error(instNr, TWIS_EVT_READ_ERROR, nrf_twis_error_source_get_and_clear(p_reg));
-                substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-                ev = 0;
-            }
-            break;
-        case NRF_DRV_TWIS_SUBSTATE_WRITE_WAITING:
-            if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_RXSTARTED) ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_WRITE)     ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_READ)      ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_STOPPED))
-            {
-                substate = NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING;
-                /* Any other bits requires further processing in PENDING substate */
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_RXSTARTED);
-            }
-            else
-            {
-                nrf_drv_twis_process_error(instNr, TWIS_EVT_WRITE_ERROR, nrf_twis_error_source_get_and_clear(p_reg));
-                substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-                ev = 0;
-            }
-            break;
-        case NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING:
-            if(nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_WRITE)||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_READ) ||
-               nrf_drv_twis_check_bit(ev, NRF_TWIS_EVENT_STOPPED))
-            {
-                evdata.type = TWIS_EVT_WRITE_DONE;
-                evdata.data.rx_amount = nrf_twis_rx_amount_get(p_reg);
-                nrf_drv_call_event_handler(instNr, &evdata);
-                /* Go to idle and repeat the state machine if READ or WRITE events detected.
-                 * This time READ or WRITE would be started */
-                substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-                ev = nrf_drv_twis_clear_bit(ev, NRF_TWIS_EVENT_STOPPED);
-            }
-            else
-            {
-                nrf_drv_twis_process_error(instNr, TWIS_EVT_WRITE_ERROR, nrf_twis_error_source_get_and_clear(p_reg));
-                substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-                ev = 0;
-            }
-            break;
-        default:
-            substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-            /* Do not clear any events and repeat the machine */
-            break;
-        }
-    }
-
-    m_var_inst[instNr].substate = substate;
-    if(!TWIS_NO_SYNC_MODE)
-    {
-        m_sm_semaphore[instNr] = 0;
-    }
-}
-
-/**
- * @brief This function
- */
-static inline void nrf_drv_twis_preprocess_status(uint8_t instNr)
-{
-    if(!TWIS_NO_SYNC_MODE)
-    {
-        if(NULL == m_var_inst[instNr].ev_handler)
-        {
-            nrf_drv_twis_state_machine(instNr);
-        }
-    }
-}
-
-/**
- * @brief Interrupt service
- *
- * This function is called by all interrupts runtime for instances enabled in this library.
- * @param instNr Driver instance number that has called this runtime.
- */
-static inline void nrf_drv_twis_on_ISR(uint8_t instNr)
-{
-    nrf_drv_twis_state_machine(instNr);
-}
-
-/** @} */ /* End  of lib_driver_twis_slave_ifunc */
-
-
-/* -------------------------------------------------------------------------
- * Implementation of IRQ Handlers
- */
-#define X(n) \
-    IRQ_HANDLER(n) \
-    { \
-        nrf_drv_twis_on_ISR(TWIS##n##_INSTANCE_INDEX); \
-    }
-#include "nrf_drv_twis_inst.def"
-
-/* -------------------------------------------------------------------------
- * Implementation of interface functions
- *
- */
-
-
-ret_code_t nrf_drv_twis_init(
-        nrf_drv_twis_t          const * const p_inst,
-        nrf_drv_twis_config_t   const * p_config,
-        nrf_drv_twis_event_handler_t    const event_handler)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg;
-    nrf_twis_config_addr_mask_t addr_mask = (nrf_twis_config_addr_mask_t)0;
-
-    if( m_var_inst[instNr].state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    if (nrf_drv_common_per_res_acquire(p_reg, m_irq_handlers[instNr]) !=
-            NRF_SUCCESS)
-    {
-        return NRF_ERROR_BUSY;
-    }
-#endif
-
-    if(NULL == p_config)
-    {
-        p_config = &m_config_default[instNr];
-    }
-
-    if(!TWIS_ASSUME_INIT_AFTER_RESET_ONLY)
-    {
-        nrf_drv_twis_swreset(p_reg);
-    }
-    
-    nrf_drv_twis_config_pin(p_config->scl);
-    nrf_drv_twis_config_pin(p_config->sda);
-
-    if(0 == (p_config->addr[0] | p_config->addr[1]))
-        addr_mask = NRF_TWIS_CONFIG_ADDRESS0_MASK;
-    else
-    {
-        if(0 != p_config->addr[0])
-        {
-            addr_mask |= NRF_TWIS_CONFIG_ADDRESS0_MASK;
-        }
-        if(0 != p_config->addr[1])
-        {
-            addr_mask |= NRF_TWIS_CONFIG_ADDRESS1_MASK;
-        }
-    }
-
-    /* Peripheral interrupt configure
-     * (note - interrupts still needs to be configured in INTEN register.
-     * This is done in enable function) */
-    nrf_drv_common_irq_enable(nrf_drv_get_IRQn(p_reg), p_config->interrupt_priority);
-
-    /* Configure */
-    nrf_twis_pins_set          (p_reg, p_config->scl, p_config->sda);
-    nrf_twis_address_set       (p_reg, 0, p_config->addr[0]);
-    nrf_twis_address_set       (p_reg, 1, p_config->addr[1]);
-    nrf_twis_config_address_set(p_reg, addr_mask);
-
-    /* Clear semaphore */
-    if(!TWIS_NO_SYNC_MODE)
-    {
-        m_sm_semaphore[instNr] = 0;
-    }
-    /* Set internal instance variables */
-    m_var_inst[instNr].substate   = NRF_DRV_TWIS_SUBSTATE_IDLE;
-    m_var_inst[instNr].ev_handler = event_handler;
-    m_var_inst[instNr].state      = NRF_DRV_STATE_INITIALIZED;
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_twis_uninit(nrf_drv_twis_t const * const p_inst)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg;
-    TWIS_PSEL_Type psel = p_reg->PSEL;
-
-    ASSERT(m_var_inst[instNr].state != NRF_DRV_STATE_UNINITIALIZED);
-
-    nrf_drv_twis_swreset(p_reg);
-
-    /* Clear pins state if */
-    if(!(TWIS_PSEL_SCL_CONNECT_Msk & psel.SCL))
-    {
-        nrf_gpio_cfg_default(psel.SCL);
-    }
-    if(!(TWIS_PSEL_SDA_CONNECT_Msk & psel.SDA))
-    {
-        nrf_gpio_cfg_default(psel.SDA);
-    }
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    nrf_drv_common_per_res_release(p_reg);
-#endif
-
-    /* Clear variables */
-    m_var_inst[instNr].ev_handler = NULL;
-    m_var_inst[instNr].state      = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-
-void nrf_drv_twis_enable(nrf_drv_twis_t const * const p_inst)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg;
-    nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[instNr];
-
-    ASSERT(m_var_inst[instNr].state == NRF_DRV_STATE_INITIALIZED);
-
-    nrf_drv_twis_clear_all_events(p_reg);
-
-    /* Enable interrupts */
-    if(NULL != p_var_inst->ev_handler)
-    {
-        nrf_twis_int_enable(p_reg, m_used_ints_mask);
-    }
-
-    nrf_twis_enable(p_reg);
-    p_var_inst->error    = 0;
-    p_var_inst->state    = NRF_DRV_STATE_POWERED_ON;
-    p_var_inst->substate = NRF_DRV_TWIS_SUBSTATE_IDLE;
-}
-
-
-void nrf_drv_twis_disable(nrf_drv_twis_t const * const p_inst)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg;
-
-    ASSERT(m_var_inst[instNr].state != NRF_DRV_STATE_UNINITIALIZED);
-
-    nrf_twis_int_disable(p_reg, m_used_ints_mask);
-
-    nrf_twis_disable(p_reg);
-    m_var_inst[instNr].state    = NRF_DRV_STATE_INITIALIZED;
-}
-
-/* ARM recommends not using the LDREX and STREX instructions in C code.
- * This is because the compiler might generate loads and stores between
- * LDREX and STREX, potentially clearing the exclusive monitor set by LDREX.
- * This recommendation also applies to the byte, halfword, and doubleword
- * variants LDREXB, STREXB, LDREXH, STREXH, LDREXD, and STREXD.
- *
- * This is the reason for the function below to be implemented in assembly.
- */
-//lint -save -e578
-#if defined (__CC_ARM )
-static __asm uint32_t nrf_drv_twis_error_get_and_clear_internal(uint32_t volatile * const perror)
-{
-    mov   r3, r0
-    mov   r1, #0
-nrf_drv_twis_error_get_and_clear_internal_try
-    ldrex r0, [r3]
-    strex r2, r1, [r3]
-    cmp   r2, r1                                        /* did this succeed?       */
-    bne   nrf_drv_twis_error_get_and_clear_internal_try /* no \u2013 try again          */
-    bx    lr
-}
-#elif defined ( __GNUC__ )
-static uint32_t nrf_drv_twis_error_get_and_clear_internal(uint32_t volatile * const perror)
-{
-    uint32_t ret;
-    uint32_t temp;
-    asm volatile(
-        "   .syntax unified           \n"
-        "nrf_drv_twis_error_get_and_clear_internal_try:         \n"
-        "   ldrex %[ret], [%[perror]]                           \n"
-        "   strex %[temp], %[zero], [%[perror]]                 \n"
-        "   cmp   %[temp], %[zero]                              \n"
-        "   bne   nrf_drv_twis_error_get_and_clear_internal_try \n"
-    : /* Output */
-        [ret]"=&l"(ret),
-        [temp]"=&l"(temp)
-    : /* Input */
-        [zero]"l"(0),
-        [perror]"l"(perror)
-    );
-    UNUSED_VARIABLE(temp);
-    return ret;
-}
-#elif defined ( __ICCARM__ )
-static uint32_t nrf_drv_twis_error_get_and_clear_internal(uint32_t volatile * const perror)
-{
-    uint32_t ret;
-    uint32_t temp;
-    asm volatile(
-        "1:         \n"
-        "   ldrex %[ret], [%[perror]]                           \n"
-        "   strex %[temp], %[zero], [%[perror]]                 \n"
-        "   cmp   %[temp], %[zero]                              \n"
-        "   bne.n 1b \n"
-    : /* Output */
-        [ret]"=&l"(ret),
-        [temp]"=&l"(temp)
-    : /* Input */
-        [zero]"l"(0),
-        [perror]"l"(perror)
-    );
-    UNUSED_VARIABLE(temp);
-    return ret;
-}
-#else
-    #error Unknown compiler
-#endif
-//lint -restore
-
-uint32_t nrf_drv_twis_error_get_and_clear(nrf_drv_twis_t const * const p_inst)
-{
-    nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[p_inst->instNr];
-    nrf_drv_twis_preprocess_status(p_inst->instNr);
-    /* Make sure that access to error member is atomic
-     * so there is no bit that is cleared if it is not copied to local variable already. */
-    return nrf_drv_twis_error_get_and_clear_internal(&p_var_inst->error);
-}
-
-
-ret_code_t nrf_drv_twis_tx_prepare(
-        nrf_drv_twis_t const * const p_inst,
-        void const * const p_buf,
-        size_t size)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg;
-    nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[instNr];
-
-    /* Check power state*/
-    if(p_var_inst->state != NRF_DRV_STATE_POWERED_ON)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    /* Check data address */
-    if(!nrf_drv_is_in_RAM(p_buf))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-    /* Check data size */
-    if((size & TWIS_TXD_MAXCNT_MAXCNT_Msk) != size)
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    nrf_twis_tx_prepare(p_reg, (uint8_t const *)p_buf, (nrf_twis_amount_t)size);
-    return NRF_SUCCESS;
-
-}
-
-
-size_t nrf_drv_twis_tx_amount(nrf_drv_twis_t const * const p_inst)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type const * const p_reg = m_const_inst[instNr].p_reg;
-
-    return nrf_twis_tx_amount_get(p_reg);
-}
-
-
-ret_code_t nrf_drv_twis_rx_prepare(
-        nrf_drv_twis_t const * const p_inst,
-        void * const p_buf,
-        size_t size)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type * const p_reg = m_const_inst[instNr].p_reg;
-    nrf_drv_twis_var_inst_t * const p_var_inst = &m_var_inst[instNr];
-
-    /* Check power state*/
-    if(p_var_inst->state != NRF_DRV_STATE_POWERED_ON)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    /* Check data address */
-    if(!nrf_drv_is_in_RAM(p_buf))
-    {
-        return NRF_ERROR_INVALID_ADDR;
-    }
-    /* Check data size */
-    if((size & TWIS_RXD_MAXCNT_MAXCNT_Msk) != size)
-    {
-        return NRF_ERROR_INVALID_LENGTH;
-    }
-
-    nrf_twis_rx_prepare(p_reg, (uint8_t *)p_buf, (nrf_twis_amount_t)size);
-    return NRF_SUCCESS;
-}
-
-
-size_t nrf_drv_twis_rx_amount(nrf_drv_twis_t const * const p_inst)
-{
-    uint8_t instNr = p_inst->instNr;
-    NRF_TWIS_Type const * const p_reg = m_const_inst[instNr].p_reg;
-
-    return nrf_twis_rx_amount_get(p_reg);
-}
-
-
-bool nrf_drv_twis_is_busy(nrf_drv_twis_t const * const p_inst)
-{
-    nrf_drv_twis_preprocess_status(p_inst->instNr);
-    return NRF_DRV_TWIS_SUBSTATE_IDLE != m_var_inst[(p_inst->instNr)].substate;
-}
-
-bool nrf_drv_twis_is_waiting_tx_buff(nrf_drv_twis_t const * const p_inst)
-{
-    nrf_drv_twis_preprocess_status(p_inst->instNr);
-    return NRF_DRV_TWIS_SUBSTATE_READ_WAITING == m_var_inst[(p_inst->instNr)].substate;
-}
-
-bool nrf_drv_twis_is_waiting_rx_buff(nrf_drv_twis_t const * const p_inst)
-{
-    nrf_drv_twis_preprocess_status(p_inst->instNr);
-    return NRF_DRV_TWIS_SUBSTATE_WRITE_WAITING == m_var_inst[(p_inst->instNr)].substate;
-}
-
-bool nrf_drv_twis_is_pending_tx(nrf_drv_twis_t const * const p_inst)
-{
-    nrf_drv_twis_preprocess_status(p_inst->instNr);
-    return NRF_DRV_TWIS_SUBSTATE_READ_PENDING == m_var_inst[(p_inst->instNr)].substate;
-}
-
-bool nrf_drv_twis_is_pending_rx(nrf_drv_twis_t const * const p_inst)
-{
-    nrf_drv_twis_preprocess_status(p_inst->instNr);
-    return NRF_DRV_TWIS_SUBSTATE_WRITE_PENDING == m_var_inst[(p_inst->instNr)].substate;
-}

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/twis_slave/nrf_drv_twis.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis.h
deleted file mode 100644
index c8d95f6..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis.h
+++ /dev/null
@@ -1,406 +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.
- *
- */
-#ifndef NRF_DRV_TWIS_H__
-#define NRF_DRV_TWIS_H__
-
-#include "nrf_drv_config.h"
-#include "nrf_drv_common.h"
-#include "sdk_errors.h"
-#include "nrf_twis.h"
-#include <stdint.h>
-#include "app_util.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @ingroup  nrf_twi
- * @defgroup nrf_twis TWI slave HAL and driver
- * @brief @tagAPI52 TWI slave APIs.
- * @details The TWIS HAL provides basic APIs for accessing the registers of the TWIS.
- * The TWIS driver provides APIs on a higher level.
- */
-
-/**
- * @ingroup  nrf_twis
- * @defgroup nrf_twis_drv TWI slave with EasyDMA driver
- * 
- * @brief @tagAPI52 TWI slave with EasyDMA driver.
- * @{
- */
-
-/**
- * @defgroup nrf_twis_drv_config TWIS driver global configuration
- *
- * @brief This configuration is placed in the global configuration file @c nrf_drv_config.h.
- * @{
- */
-
-    /**
-     * @def TWIS_ASSUME_INIT_AFTER_RESET_ONLY
-     * @brief Assume that any instance would be initialized only once
-     *
-     * Optimization flag.
-     * Registers used by TWIS are shared by other peripherals.
-     * Normally, during initialization driver tries to clear all registers to known state before
-     * doing the initialization itself.
-     * This gives initialization safe procedure, no matter when it would be called.
-     * If you activate TWIS only once and do never uninitialize it - set this flag to 1 what gives
-     * more optimal code.
-     */
-
-    /**
-     * @def TWIS_NO_SYNC_MODE
-     * @brief Remove support for synchronous mode
-     *
-     * Synchronous mode would be used in specific situations.
-     * And it uses some additional code and data memory to safely process state machine
-     * by polling it in status functions.
-     * If this functionality is not required it may be disabled to free some resources.
-     */
-/** @} */
-
-/**
- * @brief Event callback function event definitions.
- */
-typedef enum
-{
-    TWIS_EVT_READ_REQ,     ///< Read request detected
-                           /**< If there is no buffer prepared, buf_req flag in the even will be set.
-                                Call then @ref nrf_drv_twis_tx_prepare to give parameters for buffer.
-                                */
-    TWIS_EVT_READ_DONE,    ///< Read request has finished - free any data
-    TWIS_EVT_READ_ERROR,   ///< Read request finished with error
-    TWIS_EVT_WRITE_REQ,    ///< Write request detected
-                           /**< If there is no buffer prepared, buf_req flag in the even will be set.
-                                Call then @ref nrf_drv_twis_rx_prepare to give parameters for buffer.
-                                */
-    TWIS_EVT_WRITE_DONE,   ///< Write request has finished - process data
-    TWIS_EVT_WRITE_ERROR,  ///< Write request finished with error
-    TWIS_EVT_GENERAL_ERROR ///< Error that happens not inside WRITE or READ transaction
-} nrf_drv_twis_evt_type_t;
-
-/**
- * @brief TWIS driver instance structure
- *
- * @note We only need instance number here so we could really use just a number
- * that would be send to every driver function.
- * But for compatibility reason this number is inserted into the structure.
- */
-typedef struct
-{
-    uint8_t instNr; /**< Instance number */
-}nrf_drv_twis_t;
-
-/**
- * @brief TWIS driver event structure
- */
-typedef struct
-{
-    nrf_drv_twis_evt_type_t type; ///< Event type
-    union
-    {
-        bool buf_req;       ///< Flag for @ref TWIS_EVT_READ_REQ and @ref TWIS_EVT_WRITE_REQ
-                            /**< Information if transmission buffer requires to be prepared */
-        uint32_t tx_amount; ///< Data for @ref TWIS_EVT_READ_DONE
-        uint32_t rx_amount; ///< Data for @ref TWIS_EVT_WRITE_DONE
-        uint32_t error;     ///< Data for @ref TWIS_EVT_GENERAL_ERROR
-    }data;
-}nrf_drv_twis_evt_t;
-
-/**
- * @brief TWI slave event callback function type.
- *
- * @param[in] p_event Event information structure.
- */
-typedef void (*nrf_drv_twis_event_handler_t)(nrf_drv_twis_evt_t const * const p_event);
-
-/**
- * @brief Structure for TWIS configuration
- */
-typedef struct
-{
-    uint32_t addr[2];            //!< Set addresses that this slave should respond. Set 0 to disable.
-    uint32_t scl;                //!< SCL pin number
-    uint32_t sda;                //!< SDA pin number
-    uint8_t  interrupt_priority; //!< The priority of interrupt for the module to set
-}nrf_drv_twis_config_t;
-
-/**
- * @brief Possible error sources
- *
- * This is flag enum - values from this enum can be connected using logical or operator.
- * @note
- * We could use directly @ref nrf_twis_error_t. Error type enum is redefined here becouse
- * of possible future extension (eg. supporting timeouts and synchronous mode).
- */
-typedef enum
-{
-    NRF_DRV_TWIS_ERROR_OVERFLOW         = NRF_TWIS_ERROR_OVERFLOW,  /**< RX buffer overflow detected, and prevented */
-    NRF_DRV_TWIS_ERROR_DATA_NACK        = NRF_TWIS_ERROR_DATA_NACK, /**< NACK sent after receiving a data byte */
-    NRF_DRV_TWIS_ERROR_OVERREAD         = NRF_TWIS_ERROR_OVERREAD,  /**< TX buffer over-read detected, and prevented */
-    NRF_DRV_TWIS_ERROR_UNEXPECTED_EVENT = 1 << 8                    /**< Unexpected event detected by state machine */
-}nrf_drv_twis_error_t;
-
-/**
- * @internal
- * @brief Internal macro for creating TWIS driver instance
- *
- * Second level of indirection in creating the instance.
- * Do not use this macro directly.
- * Use @ref NRF_DRV_TWIS_INSTANCE instead.
- */
-#define NRF_DRV_TWIS_INSTANCE_x(id) \
-    { \
-        TWIS##id##_INSTANCE_INDEX \
-    }
-
-/**
- * @brief Macro for creating TWIS driver instance
- *
- * @param[in] id Instance index. Use 0 for TWIS0 and 1 for TWIS1
- */
-#define NRF_DRV_TWIS_INSTANCE(id) NRF_DRV_TWIS_INSTANCE_x(id)
-
-/**
- * @internal
- * @brief Internal macro for creating TWIS driver default configuration
- *
- * Second level of indirection in creating the instance.
- * Do not use this macro directly.
- * Use @ref NRF_DRV_TWIS_SLAVE_DEFAULT_CONFIG instead.
- */
-#define NRF_DRV_TWIS_DEFAULT_CONFIG_x(id) \
-{ \
-    .addr               = { TWIS##id##_CONFIG_ADDR0, TWIS##id##_CONFIG_ADDR1 }, \
-    .scl                = TWIS##id##_CONFIG_SCL, \
-    .sda                = TWIS##id##_CONFIG_SDA, \
-    .interrupt_priority = TWIS##id##_CONFIG_IRQ_PRIORITY \
-}
-
-/**
- * @brief Generate default configuration for TWIS driver instance
- *
- * @param[in] id Instance index. Use 0 for TWIS0 and 1 for TWIS1
- */
-#define NRF_DRV_TWIS_DEFAULT_CONFIG(id) NRF_DRV_TWIS_DEFAULT_CONFIG_x(id)
-
-/**
- * @brief Function for initializing the TWIS driver instance.
- *
- * Function initializes and enables TWIS driver.
- * @attention After driver initialization enable it by @ref nrf_drv_twis_enable
- *
- * @param[in] p_inst          TWIS driver instance.
- * @attention                 @em p_inst has to be global object.
- *                            It would be used by interrupts so make it sure that object
- *                            would not be destroyed when function is leaving.
- * @param[in] p_config        Initial configuration. If NULL, the default configuration is used.
- * @param[in] event_handler   Event handler provided by the user.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the driver is already initialized.
- * @retval NRF_ERROR_BUSY          If some other peripheral with the same
- *                                 instance ID is already in use. This is 
- *                                 possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED 
- *                                 is set to a value other than zero.
- */
-ret_code_t nrf_drv_twis_init(
-        nrf_drv_twis_t          const * const p_inst,
-        nrf_drv_twis_config_t   const * p_config,
-        nrf_drv_twis_event_handler_t    const event_handler);
-
-/**
- * @brief Function for uninitializing the TWIS driver instance.
- *
- * Function initializes the peripheral and resets all registers to default values.
- * 
- * @param[in] p_inst TWIS driver instance to uninitialize.
- * @note
- * It is safe to call nrf_drv_twis_uninit even before initialization.
- * Actually @ref nrf_drv_twis_init function calls this function to
- * make sure that TWIS state is known.
- * @note
- * If TWIS driver was in uninitialized state before calling this function,
- * selected pins would not be reset to default configuration.
- */
-void nrf_drv_twis_uninit(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Enable TWIS instance
- *
- * This function enables TWIS instance.
- * Function defined if there is needs for dynamically enabling and disabling the peripheral.
- * Use @ref nrf_drv_twis_enable and @ref nrf_drv_twis_disable functions.
- * They do not change any configuration registers.
- * 
- * @param p_inst TWIS driver instance.
- */
-void nrf_drv_twis_enable(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Disable TWIS instance
- *
- * Disabling TWIS instance gives possibility to turn off the TWIS while 
- * holding configuration done by @ref nrf_drv_twis_init
- * 
- * @param p_inst TWIS driver instance.
- */
-void nrf_drv_twis_disable(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Get and clear last error flags
- *
- * Function gets information about errors.
- * This is also the only possibility to exit from error substate of the internal state machine.
- *
- * @param[in] p_inst TWIS driver instance.
- * @return Error flags defined in @ref nrf_drv_twis_error_t
- * @attention
- * This function clears error state and flags.
- */
-uint32_t nrf_drv_twis_error_get_and_clear(nrf_drv_twis_t const * const p_inst);
-
-
-/**
- * @brief Prepare data for sending
- *
- * This function should be used in response for @ref TWIS_EVT_READ_REQ event.
- * 
- * @param[in] p_inst TWIS driver instance.
- * @param[in] p_buf Transmission buffer
- * @attention       Transmission buffer has to be placed in RAM.
- * @param     size  Maximum number of bytes that master may read from buffer given.
- *
- * @retval NRF_SUCCESS              Preparation finished properly
- * @retval NRF_ERROR_INVALID_ADDR   Given @em p_buf is not placed inside the RAM
- * @retval NRF_ERROR_INVALID_LENGTH Wrong value in @em size parameter
- * @retval NRF_ERROR_INVALID_STATE  Module not initialized or not enabled
- */
-ret_code_t nrf_drv_twis_tx_prepare(
-        nrf_drv_twis_t const * const p_inst,
-        void const * const p_buf,
-        size_t size);
-
-/**
- * @brief Get number of transmitted bytes
- *
- * Function returns number of bytes sent.
- * This function may be called after @ref TWIS_EVT_READ_DONE or @ref TWIS_EVT_READ_ERROR events.
- *
- * @param[in] p_inst TWIS driver instance.
- *
- * @return Number of bytes sent.
- */
-size_t nrf_drv_twis_tx_amount(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Prepare data for receiving
- *
- * This function should be used in response for @ref TWIS_EVT_WRITE_REQ event.
- * 
- * @param[in] p_inst TWIS driver instance.
- * @param[in] p_buf Buffer that would be filled with received data
- * @attention       Receiving buffer has to be placed in RAM.
- * @param     size  Size of the buffer (maximum amount of data to receive)
- *
- * @retval NRF_SUCCESS              Preparation finished properly
- * @retval NRF_ERROR_INVALID_ADDR   Given @em p_buf is not placed inside the RAM
- * @retval NRF_ERROR_INVALID_LENGTH Wrong value in @em size parameter
- * @retval NRF_ERROR_INVALID_STATE  Module not initialized or not enabled
- */
-ret_code_t nrf_drv_twis_rx_prepare(
-        nrf_drv_twis_t const * const p_inst,
-        void * const p_buf,
-        size_t size);
-
-/**
- * @brief Get number of received bytes
- *
- * Function returns number of bytes received.
- * This function may be called after @ref TWIS_EVT_WRITE_DONE or @ref TWIS_EVT_WRITE_ERROR events.
- *
- * @param[in] p_inst TWIS driver instance.
- *
- * @return Number of bytes received.
- */
-size_t nrf_drv_twis_rx_amount(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Function checks if driver is busy right now
- *
- * Actual driver substate is tested.
- * If driver is in any other state than IDLE or ERROR this function returns true.
- *
- * @param[in] p_inst TWIS driver instance.
- *
- * @retval true  Driver is in state other than ERROR or IDLE
- * @retval false There is no transmission pending.
- */
-bool nrf_drv_twis_is_busy(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Function checks if driver is waiting for tx buffer
- *
- * If this function returns true, it means that driver is stalled expecting
- * of the @ref nrf_drv_twis_tx_prepare function call.
- *
- * @param[in] p_inst TWIS driver instance.
- *
- * @retval true Driver waits for @ref nrf_drv_twis_tx_prepare
- * @retval false Driver is not in the state where it waits for preparing tx buffer.
- */
-bool nrf_drv_twis_is_waiting_tx_buff(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Function checks if driver is waiting for rx buffer
- *
- * If this function returns true, it means that driver is staled expecting
- * of the @ref nrf_drv_twis_rx_prepare function call.
- *
- * @param[in] p_inst TWIS driver instance.
- *
- * @retval true Driver waits for @ref nrf_drv_twis_rx_prepare
- * @retval false Driver is not in the state where it waits for preparing rx buffer.
- */
-bool nrf_drv_twis_is_waiting_rx_buff(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Check if driver is sending data
- *
- * If this function returns true, it means that there is ongoing output transmission.
- *
- * @param[in] p_inst TWIS driver instance.
- *
- * @retval true There is ongoing output transmission.
- * @retval false Driver is in other state.
- */
-bool nrf_drv_twis_is_pending_tx(nrf_drv_twis_t const * const p_inst);
-
-/**
- * @brief Check if driver is receiving data
- *
- * If this function returns true, it means that there is ongoing input transmission.
- *
- * @param[in] p_inst TWIS driver instance.
- *
- * @retval true There is ongoing input transmission.
- * @retval false Driver is in other state.
- */
-bool nrf_drv_twis_is_pending_rx(nrf_drv_twis_t const * const p_inst);
-
-/** @} */ /* End of lib_twis_drv group */
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_DRV_TWIS_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/twis_slave/nrf_drv_twis_inst.def
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis_inst.def b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis_inst.def
deleted file mode 100644
index c2f642a..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/twis_slave/nrf_drv_twis_inst.def
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * @brief Xmacro file with contains enumeration of TWIS instances to implement
- * 
- * Use this file everywhere where anything has to be generated for all active TWIS instances.
- * Xmacro format:
- * 
- * @code
-   X(n)
- * @endcode
- * 
- * Where @em n is number of the instance itself (0 for NRF_TWIS0).
- */
-#if (TWIS0_ENABLED == 1)
-    X(0)
-#endif
-#if (TWIS1_ENABLED == 1)
-    X(1)
-#endif
-#undef X


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

Posted by cc...@apache.org.
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/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c
deleted file mode 100644
index e091691..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_5W_slave.c
+++ /dev/null
@@ -1,618 +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 ser_phy_spi_5W_phy_driver_slave ser_phy_nrf51_spi_5W_slave.c
- * @{
- * @ingroup ser_phy_spi_5W_phy_driver_slave
- *
- * @brief SPI_5W_RAW PHY slave driver.
- */
-
-
-#include <stddef.h>
-#include <string.h>
-
-
-#include "boards.h"
-#include "nrf_drv_spis.h"
-#include "ser_phy.h"
-#include "ser_config.h"
-#include "nrf_gpio.h"
-#include "nrf_delay.h"
-#include "nrf_gpiote.h"
-#include "nrf_soc.h"
-#include "app_error.h"
-#include "app_util.h"
-#include "ser_phy_config_conn_nrf51.h"
-#include "ser_phy_debug_conn.h"
-#include "app_error.h"
-
-#define _static static
-
-#define SER_PHY_SPI_5W_MTU_SIZE SER_PHY_SPI_MTU_SIZE
-
-#define SER_PHY_SPI_DEF_CHARACTER 0xFF //SPI default character. Character clocked out in case of an ignored transaction
-#define SER_PHY_SPI_ORC_CHARACTER 0xFF //SPI over-read character. Character clocked out after an over-read of the transmit buffer
-
-static nrf_drv_spis_t m_spis = NRF_DRV_SPIS_INSTANCE(SER_PHY_SPI_SLAVE_INSTANCE);
-
-#define _SPI_5W_
-
-//SPI raw peripheral device configuration data
-typedef struct
-{
-    int32_t pin_req;       //SPI /REQ pin. -1 for not using
-    int32_t pin_rdy;       //SPI /RDY pin. -1 for not using
-    int32_t ppi_rdy_ch;    //SPI /RDY ppi ready channel
-    int32_t gpiote_rdy_ch; //SPI /RDY pin ready channel
-} spi_slave_raw_trasp_cfg_t;
-
-/**@brief States of the SPI transaction state machine. */
-typedef enum
-{
-    SPI_RAW_STATE_UNKNOWN,
-    SPI_RAW_STATE_SETUP_HEADER,
-    SPI_RAW_STATE_RX_HEADER,
-    SPI_RAW_STATE_MEM_REQUESTED,
-    SPI_RAW_STATE_RX_PAYLOAD,
-    SPI_RAW_STATE_TX_HEADER,
-    SPI_RAW_STATE_TX_PAYLOAD,
-} trans_state_t;
-
-_static spi_slave_raw_trasp_cfg_t m_spi_slave_raw_config;
-
-_static uint16_t m_accumulated_rx_packet_length;
-_static uint16_t m_rx_packet_length;
-_static uint16_t m_current_rx_frame_length;
-
-_static uint16_t m_accumulated_tx_packet_length;
-_static uint16_t m_tx_packet_length;
-_static uint16_t m_current_tx_frame_length;
-
-_static uint8_t m_header_rx_buffer[SER_PHY_HEADER_SIZE + 1]; //+1 for '0' guard in SPI_5W
-_static uint8_t m_header_tx_buffer[SER_PHY_HEADER_SIZE + 1]; //+1 for '0' guard in SPI_5W
-
-_static uint8_t m_tx_frame_buffer[SER_PHY_SPI_5W_MTU_SIZE];
-_static uint8_t m_rx_frame_buffer[SER_PHY_SPI_5W_MTU_SIZE];
-_static uint8_t m_zero_buff[SER_PHY_SPI_5W_MTU_SIZE] = {  0  }; //ROM'able declaration - all guard bytes
-
-_static uint8_t * volatile       m_p_rx_buffer = NULL;
-_static const uint8_t * volatile m_p_tx_buffer = NULL;
-
-_static bool m_trash_payload_flag;
-_static bool m_buffer_reqested_flag;
-
-_static trans_state_t            m_trans_state      = SPI_RAW_STATE_UNKNOWN;
-_static ser_phy_events_handler_t m_ser_phy_callback = NULL;
-
-static void spi_slave_raw_assert(bool cond)
-{
-    APP_ERROR_CHECK_BOOL(cond);
-}
-
-static void callback_ser_phy_event(ser_phy_evt_t event)
-{
-    if (m_ser_phy_callback)
-    {
-        m_ser_phy_callback(event);
-    }
-    return;
-}
-
-static void callback_memory_request(uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    event.evt_type                               = SER_PHY_EVT_RX_BUF_REQUEST;
-    event.evt_params.rx_buf_request.num_of_bytes = size;
-    callback_ser_phy_event(event);
-    return;
-
-}
-
-static void callback_packet_received(uint8_t * pBuffer, uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-    event.evt_params.rx_pkt_received.num_of_bytes = size;
-    event.evt_params.rx_pkt_received.p_buffer     = pBuffer;
-    callback_ser_phy_event(event);
-    return;
-}
-
-static void callback_packet_dropped()
-{
-    ser_phy_evt_t event;
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-    callback_ser_phy_event(event);
-    return;
-}
-
-static void callback_packet_transmitted(void)
-{
-    ser_phy_evt_t event;
-
-    event.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    callback_ser_phy_event(event);
-    return;
-}
-
-static void copy_buff(uint8_t * const p_dest, uint8_t const * const p_src, uint16_t len)
-{
-    uint16_t index;
-
-    for (index = 0; index < len; index++)
-    {
-        p_dest[index] = p_src[index];
-    }
-    return;
-}
-
-/* Function computes current packet length */
-static uint16_t compute_current_frame_length(const uint16_t packet_length,
-                                             const uint16_t accumulated_packet_length)
-{
-    uint16_t current_packet_length = packet_length - accumulated_packet_length;
-
-    if (current_packet_length > SER_PHY_SPI_5W_MTU_SIZE)
-    {
-        current_packet_length = SER_PHY_SPI_5W_MTU_SIZE;
-    }
-
-    return current_packet_length;
-}
-
-static uint32_t header_get()
-{
-    uint32_t err_code;
-
-    err_code = nrf_drv_spis_buffers_set(&m_spis,
-                                        (uint8_t *) m_zero_buff,
-                                        SER_PHY_HEADER_SIZE,
-                                        m_header_rx_buffer,
-                                        SER_PHY_HEADER_SIZE);
-    return err_code;
-}
-
-static uint32_t frame_get()
-{
-    uint32_t err_code;
-
-    m_current_rx_frame_length = compute_current_frame_length(m_rx_packet_length,
-                                                             m_accumulated_rx_packet_length);
-
-    if (!m_trash_payload_flag)
-    {
-        err_code =
-            nrf_drv_spis_buffers_set(&m_spis,
-                                     (uint8_t *) m_zero_buff,
-                                     m_current_rx_frame_length,
-                                     &(m_p_rx_buffer[m_accumulated_rx_packet_length]),
-                                     m_current_rx_frame_length);
-    }
-    else
-    {
-        err_code = nrf_drv_spis_buffers_set(&m_spis,
-                                            (uint8_t *) m_zero_buff,
-                                            m_current_rx_frame_length,
-                                            m_rx_frame_buffer,
-                                            m_current_rx_frame_length);
-    }
-    return err_code;
-}
-
-static uint32_t header_send(uint16_t len)
-{
-    uint32_t err_code;
-
-    m_header_tx_buffer[0] = (uint8_t) 0; //this is guard byte
-    (void)uint16_encode(len, &(m_header_tx_buffer[1]));
-    err_code = nrf_drv_spis_buffers_set(&m_spis,
-                                        m_header_tx_buffer,
-                                        SER_PHY_HEADER_SIZE + 1,
-                                        m_header_rx_buffer,
-                                        SER_PHY_HEADER_SIZE + 1);
-    return err_code;
-}
-
-static uint32_t frame_send()
-{
-    uint32_t err_code;
-
-    m_current_tx_frame_length = compute_current_frame_length(m_tx_packet_length,
-                                                             m_accumulated_tx_packet_length);
-
-    if (m_current_tx_frame_length == SER_PHY_SPI_5W_MTU_SIZE)
-    {
-        m_current_tx_frame_length -= 1; //extra space for guard byte must be taken into account for MTU
-    }
-    m_tx_frame_buffer[0] = 0; //guard byte
-    copy_buff(&(m_tx_frame_buffer[1]),
-              &(m_p_tx_buffer[m_accumulated_tx_packet_length]),
-              m_current_tx_frame_length);
-    err_code = nrf_drv_spis_buffers_set(&m_spis,
-                                        m_tx_frame_buffer,
-                                        m_current_tx_frame_length + 1,
-                                        m_rx_frame_buffer,
-                                        m_current_tx_frame_length + 1);
-
-    return err_code;
-}
-
-static void set_ready_line(void)
-{
-#ifndef _SPI_5W_
-    //toggle - this should go high - but toggle is unsafe
-    uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.gpiote_rdy_ch);
-    *(uint32_t *)rdy_task = 1;
-#endif
-    return;
-}
-
-static void set_request_line(void)
-{
-    //active low logic - set is 0
-    nrf_gpio_pin_clear(m_spi_slave_raw_config.pin_req);
-    DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(0);
-    return;
-}
-
-static void clear_request_line(void)
-{
-    //active low logic - clear is 1
-    nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req);
-    DEBUG_EVT_SPI_SLAVE_RAW_REQ_CLEARED(0);
-    return;
-}
-
-/**
- * \brief Slave driver main state machine
- * For UML graph, please refer to SDK documentation
-*/
-static void spi_slave_event_handle(nrf_drv_spis_event_t event)
-{
-    static uint32_t err_code = NRF_SUCCESS;
-    static uint16_t packetLength;
-
-    switch (m_trans_state)
-    {
-        case SPI_RAW_STATE_SETUP_HEADER:
-            m_trans_state = SPI_RAW_STATE_RX_HEADER;
-            err_code      = header_get();
-            break;
-
-        case SPI_RAW_STATE_RX_HEADER:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount);
-                spi_slave_raw_assert(event.rx_amount == SER_PHY_HEADER_SIZE);
-                packetLength = uint16_decode(m_header_rx_buffer);
-
-                if (packetLength != 0 )
-                {
-                    m_trans_state          = SPI_RAW_STATE_MEM_REQUESTED;
-                    m_buffer_reqested_flag = true;
-                    m_rx_packet_length     = packetLength;
-                    callback_memory_request(packetLength);
-                }
-                else
-                {
-                    if (m_p_tx_buffer)
-                    {
-                        clear_request_line();
-                        m_trans_state = SPI_RAW_STATE_TX_HEADER;
-                        err_code      = header_send(m_tx_packet_length);
-                    }
-                    else
-                    {
-                        //there is nothing to send - zero response facilitates pooling - but perhaps, it should be assert
-                        err_code = header_send(0);
-                    }
-                }
-            }
-
-            break;
-
-        case SPI_RAW_STATE_MEM_REQUESTED:
-
-            if (event.evt_type == NRF_DRV_SPIS_EVT_TYPE_MAX) //This is API dummy event
-            {
-                m_buffer_reqested_flag         = false;
-                m_trans_state                  = SPI_RAW_STATE_RX_PAYLOAD;
-                m_accumulated_rx_packet_length = 0;
-                err_code                       = frame_get();
-            }
-            break;
-
-
-        case SPI_RAW_STATE_RX_PAYLOAD:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount);
-                spi_slave_raw_assert(event.rx_amount == m_current_rx_frame_length);
-                m_accumulated_rx_packet_length += m_current_rx_frame_length;
-
-                if (m_accumulated_rx_packet_length < m_rx_packet_length )
-                {
-                    err_code = frame_get();
-                }
-                else
-                {
-                    spi_slave_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length);
-                    m_trans_state = SPI_RAW_STATE_RX_HEADER;
-                    err_code      = header_get();
-
-                    if (!m_trash_payload_flag)
-                    {
-                        callback_packet_received(m_p_rx_buffer, m_accumulated_rx_packet_length);
-                    }
-                    else
-                    {
-                        callback_packet_dropped();
-                    }
-                }
-            }
-            break;
-
-        case SPI_RAW_STATE_TX_HEADER:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount);
-                spi_slave_raw_assert(event.tx_amount == SER_PHY_HEADER_SIZE + 1);
-                m_trans_state                  = SPI_RAW_STATE_TX_PAYLOAD;
-                m_accumulated_tx_packet_length = 0;
-                err_code                       = frame_send();
-            }
-
-            break;
-
-        case SPI_RAW_STATE_TX_PAYLOAD:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount);
-                spi_slave_raw_assert(event.tx_amount == m_current_tx_frame_length + 1);
-                m_accumulated_tx_packet_length += m_current_tx_frame_length;
-
-                if ( m_accumulated_tx_packet_length < m_tx_packet_length )
-                {
-                    err_code = frame_send();
-                }
-                else
-                {
-                    spi_slave_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length);
-                    //clear pointer before callback
-                    m_p_tx_buffer = NULL;
-                    callback_packet_transmitted();
-                    //spi slave TX transfer is possible only when RX is ready, so return to waiting for a header
-                    m_trans_state = SPI_RAW_STATE_RX_HEADER;
-                    err_code      = header_get();
-                }
-            }
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-    APP_ERROR_CHECK(err_code);
-}
-
-#ifndef _SPI_5W_
-static void spi_slave_gpiote_init(void)
-{
-    if (!nrf_drv_gpiote_is_init())
-    {
-        (void)nrf_drv_gpiote_init();
-    }
-    nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(true);
-    (void)nrf_drv_gpiote_out_init(m_spi_slave_raw_config.gpiote_rdy_ch, &config);
-    return;
-}
-
-static void spi_slave_ppi_init(void)
-{
-    uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.gpiote_rdy_ch);
-    //Configure PPI channel  to clear /RDY line
-    NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].EEP = (uint32_t)(&NRF_SPIS1->EVENTS_END);
-    NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].TEP = rdy_task;
-
-    //this works only for channels 0..15 - but soft device is using 8-15 anyway
-    NRF_PPI->CHEN |= (1 << m_spi_slave_raw_config.ppi_rdy_ch);
-    return;
-}
-#endif
-
-static void spi_slave_gpio_init(void)
-{
-    nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_req);
-    nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req);
-#ifndef _SPI_5W_
-    nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_rdy);
-    nrf_gpio_pin_set(m_spi_slave_raw_config.pin_rdy);
-#endif
-    return;
-}
-
-/* ser_phy API function */
-void ser_phy_interrupts_enable(void)
-{
-    NVIC_EnableIRQ(m_spis.irq);
-}
-
-/* ser_phy API function */
-void ser_phy_interrupts_disable(void)
-{
-    NVIC_DisableIRQ(m_spis.irq);
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    uint32_t             status = NRF_SUCCESS;
-    nrf_drv_spis_event_t event;
-
-    ser_phy_interrupts_disable();
-
-    if (m_buffer_reqested_flag && (m_trans_state == SPI_RAW_STATE_MEM_REQUESTED))
-    {
-        m_p_rx_buffer = p_buffer;
-
-        if (m_p_rx_buffer)
-        {
-            m_trash_payload_flag = false;
-        }
-        else
-        {
-            m_trash_payload_flag = true;
-        }
-
-        event.evt_type  = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition with dummy event
-        event.rx_amount = 0;
-        event.tx_amount = 0;
-        spi_slave_event_handle(event);
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-    ser_phy_interrupts_enable();
-
-    return status;
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    uint32_t status = NRF_SUCCESS;
-
-    if ( p_buffer == NULL || num_of_bytes == 0)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    ser_phy_interrupts_disable();
-
-    if ( m_p_tx_buffer == NULL)
-    {
-        m_tx_packet_length = num_of_bytes;
-        m_p_tx_buffer      = p_buffer;
-        set_request_line();
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-    ser_phy_interrupts_enable();
-
-    return status;
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    uint32_t              err_code;
-    nrf_drv_spis_config_t spi_slave_config;
-    nrf_drv_spis_event_t  event;
-
-    if (m_trans_state != SPI_RAW_STATE_UNKNOWN)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    //one ppi channel and one gpiote channel are used to drive RDY line
-    m_spi_slave_raw_config.pin_req       = SER_PHY_SPI_SLAVE_REQ_PIN;
-    m_spi_slave_raw_config.pin_rdy       = SER_PHY_SPI_SLAVE_RDY_PIN;
-    m_spi_slave_raw_config.ppi_rdy_ch    = SER_PHY_SPI_PPI_RDY_CH;
-    m_spi_slave_raw_config.gpiote_rdy_ch = SER_PHY_SPI_GPIOTE_RDY_CH;
-
-    spi_slave_gpio_init();
-#ifndef _SPI_5W_
-    spi_slave_gpiote_init();
-    spi_slave_ppi_init();
-#endif
-
-    spi_slave_config.miso_pin         = SER_CON_SPIS_MISO_PIN;
-    spi_slave_config.mosi_pin         = SER_CON_SPIS_MOSI_PIN;
-    spi_slave_config.sck_pin          = SER_CON_SPIS_SCK_PIN;
-    spi_slave_config.csn_pin          = SER_CON_SPIS_CSN_PIN;
-    spi_slave_config.mode             = NRF_DRV_SPIS_MODE_0;
-    spi_slave_config.bit_order        = NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST;
-    spi_slave_config.def              = SER_PHY_SPI_DEF_CHARACTER;
-    spi_slave_config.orc              = SER_PHY_SPI_ORC_CHARACTER;
-    spi_slave_config.csn_pullup       = NRF_GPIO_PIN_PULLUP;
-    spi_slave_config.irq_priority     = APP_IRQ_PRIORITY_LOW;
-
-    //keep /CS high when init
-    nrf_gpio_cfg_input(spi_slave_config.csn_pin, NRF_GPIO_PIN_PULLUP);
-
-    err_code = nrf_drv_spis_init(&m_spis, &spi_slave_config, spi_slave_event_handle);
-    APP_ERROR_CHECK(err_code);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        m_ser_phy_callback = events_handler;
-
-        m_trans_state   = SPI_RAW_STATE_SETUP_HEADER;
-        event.evt_type  = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition for dummy event
-        event.rx_amount = 0;
-        event.tx_amount = 0;
-        spi_slave_event_handle(event);
-
-    }
-    
-    return err_code;
-}
-
-/* ser_phy API function */
-void ser_phy_close(void)
-{
-    nrf_drv_spis_uninit(&m_spis);
-    m_ser_phy_callback = NULL;
-    m_trans_state      = SPI_RAW_STATE_UNKNOWN;
-}

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/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c
deleted file mode 100644
index 21eaff7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_spi_slave.c
+++ /dev/null
@@ -1,580 +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 ser_phy_spi_phy_driver_slave ser_phy_nrf51_spi_slave.c
- * @{
- * @ingroup ser_phy_spi_phy_driver_slave
- *
- * @brief SPI_RAW PHY slave driver.
- */
-
-#include <stddef.h>
-#include <string.h>
-
-#include "app_error.h"
-#include "app_util.h"
-#include "boards.h"
-#include "nrf_gpio.h"
-#include "nrf_drv_gpiote.h"
-#include "nrf_soc.h"
-#include "nrf_drv_spis.h"
-#include "ser_config.h"
-#include "ser_phy.h"
-#include "ser_phy_config_conn_nrf51.h"
-#include "ser_phy_debug_conn.h"
-
-#define SER_PHY_SPI_DEF_CHARACTER 0xFF //SPI default character. Character clocked out in case of an ignored transaction
-#define SER_PHY_SPI_ORC_CHARACTER 0xFF //SPI over-read character. Character clocked out after an over-read of the transmit buffer
-
-static nrf_drv_spis_t m_spis = NRF_DRV_SPIS_INSTANCE(SER_PHY_SPI_SLAVE_INSTANCE);
-
-//SPI raw peripheral device configuration data
-typedef struct
-{
-    int32_t pin_req;       //SPI /REQ pin. -1 for not using
-    int32_t pin_rdy;       //SPI /RDY pin. -1 for not using
-    int32_t ppi_rdy_ch;    //SPI /RDY ppi ready channel
-    int32_t gpiote_rdy_ch; //SPI /RDY pin ready channel
-} spi_slave_raw_trasp_cfg_t;
-
-/**@brief States of the SPI transaction state machine. */
-typedef enum
-{
-    SPI_RAW_STATE_UNKNOWN,
-    SPI_RAW_STATE_SETUP_HEADER,
-    SPI_RAW_STATE_RX_HEADER,
-    SPI_RAW_STATE_MEM_REQUESTED,
-    SPI_RAW_STATE_RX_PAYLOAD,
-    SPI_RAW_STATE_TX_HEADER,
-    SPI_RAW_STATE_TX_PAYLOAD,
-} trans_state_t;
-
-#define _static static
-
-static spi_slave_raw_trasp_cfg_t m_spi_slave_raw_config;
-
-_static uint16_t m_accumulated_rx_packet_length;
-_static uint16_t m_rx_packet_length;
-_static uint16_t m_current_rx_frame_length;
-
-_static uint16_t m_accumulated_tx_packet_length;
-_static uint16_t m_tx_packet_length;
-_static uint16_t m_current_tx_frame_length;
-
-_static uint8_t m_header_rx_buffer[SER_PHY_HEADER_SIZE];
-_static uint8_t m_header_tx_buffer[SER_PHY_HEADER_SIZE];
-
-_static uint8_t m_frame_buffer[SER_PHY_SPI_MTU_SIZE];          //trash storage
-_static uint8_t m_zero_buffer[SER_PHY_SPI_MTU_SIZE] = {  0  }; //ROM'able declaration
-
-_static uint8_t * volatile       m_p_rx_buffer = NULL;
-_static const uint8_t * volatile m_p_tx_buffer = NULL;
-
-_static bool m_trash_payload_flag;
-_static bool m_buffer_reqested_flag;
-
-_static trans_state_t            m_trans_state      = SPI_RAW_STATE_UNKNOWN;
-_static ser_phy_events_handler_t m_ser_phy_callback = NULL;
-
-static void spi_slave_raw_assert(bool cond)
-{
-    APP_ERROR_CHECK_BOOL(cond);
-}
-
-static void callback_ser_phy_event(ser_phy_evt_t event)
-{
-    if (m_ser_phy_callback)
-    {
-        m_ser_phy_callback(event);
-    }
-}
-
-static void callback_memory_request(uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_SLAVE_PHY_BUF_REQUEST(0);
-
-    event.evt_type                               = SER_PHY_EVT_RX_BUF_REQUEST;
-    event.evt_params.rx_buf_request.num_of_bytes = size;
-    callback_ser_phy_event(event);
-}
-
-static void callback_packet_received(uint8_t * pBuffer, uint16_t size)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_SLAVE_PHY_PKT_RECEIVED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-    event.evt_params.rx_pkt_received.num_of_bytes = size;
-    event.evt_params.rx_pkt_received.p_buffer     = pBuffer;
-    callback_ser_phy_event(event);
-}
-
-static void callback_packet_dropped()
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_SLAVE_PHY_PKT_DROPPED(0);
-
-    event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-    callback_ser_phy_event(event);
-}
-
-static void callback_packet_transmitted(void)
-{
-    ser_phy_evt_t event;
-
-    DEBUG_EVT_SPI_SLAVE_PHY_PKT_SENT(0);
-
-    event.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    callback_ser_phy_event(event);
-}
-
-/* Function computes current packet length */
-static uint16_t compute_current_frame_length(const uint16_t packet_length,
-                                             const uint16_t accumulated_packet_length)
-{
-    uint16_t current_packet_length = packet_length - accumulated_packet_length;
-
-    if (current_packet_length > SER_PHY_SPI_MTU_SIZE)
-    {
-        current_packet_length = SER_PHY_SPI_MTU_SIZE;
-    }
-
-    return current_packet_length;
-}
-
-static uint32_t header_get()
-{
-    uint32_t err_code;
-
-    err_code = nrf_drv_spis_buffers_set(&m_spis,
-                                        (uint8_t *) m_zero_buffer,
-                                        SER_PHY_HEADER_SIZE,
-                                        m_header_rx_buffer,
-                                        SER_PHY_HEADER_SIZE);
-    return err_code;
-}
-
-static uint32_t frame_get()
-{
-    uint32_t err_code;
-
-    m_current_rx_frame_length = compute_current_frame_length(m_rx_packet_length,
-                                                             m_accumulated_rx_packet_length);
-
-    if (!m_trash_payload_flag)
-    {
-        err_code =
-            nrf_drv_spis_buffers_set(&m_spis,
-                                     (uint8_t *) m_zero_buffer,
-                                     m_current_rx_frame_length,
-                                     &(m_p_rx_buffer[m_accumulated_rx_packet_length]),
-                                     m_current_rx_frame_length);
-    }
-    else
-    {
-        err_code = nrf_drv_spis_buffers_set(&m_spis,
-                                            (uint8_t *) m_zero_buffer,
-                                            m_current_rx_frame_length,
-                                            m_frame_buffer,
-                                            m_current_rx_frame_length);
-    }
-    return err_code;
-}
-
-static uint32_t header_send(uint16_t len)
-{
-    uint32_t err_code;
-
-    (void) uint16_encode(len, m_header_tx_buffer);
-    err_code =
-        nrf_drv_spis_buffers_set(&m_spis,
-                                 m_header_tx_buffer,
-                                 sizeof (m_header_tx_buffer),
-                                 m_header_rx_buffer,
-                                 sizeof (m_header_tx_buffer));
-    return err_code;
-}
-
-static uint32_t frame_send()
-{
-    uint32_t err_code;
-
-    m_current_tx_frame_length = compute_current_frame_length(m_tx_packet_length,
-                                                             m_accumulated_tx_packet_length);
-    err_code                     =
-        nrf_drv_spis_buffers_set(&m_spis,
-                                 (uint8_t *) &(m_p_tx_buffer[m_accumulated_tx_packet_length]),
-                                 m_current_tx_frame_length,
-                                 m_frame_buffer,
-                                 m_current_tx_frame_length);
-    return err_code;
-}
-
-static void set_ready_line(void)
-{
-    //toggle - this should go high - but toggle is unsafe
-    uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.pin_rdy);
-    *(uint32_t *)rdy_task = 1;
-    return;
-}
-
-static void set_request_line(void)
-{
-    //active low logic - set is 0
-    nrf_gpio_pin_clear(m_spi_slave_raw_config.pin_req);
-    DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(0);
-}
-
-static void clear_request_line(void)
-{
-    //active low logic - clear is 1
-    nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req);
-    DEBUG_EVT_SPI_SLAVE_RAW_REQ_SET(0);
-}
-
-/**
- * \brief Slave driver main state machine
- * For UML graph, please refer to SDK documentation
-*/
-static void spi_slave_event_handle(nrf_drv_spis_event_t event)
-{
-    uint32_t        err_code = NRF_SUCCESS;
-    static uint16_t packetLength;
-
-    switch (m_trans_state)
-    {
-        case SPI_RAW_STATE_SETUP_HEADER:
-            m_trans_state = SPI_RAW_STATE_RX_HEADER;
-            err_code      = header_get();
-            break;
-
-        case SPI_RAW_STATE_RX_HEADER:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount);
-                spi_slave_raw_assert(event.rx_amount == SER_PHY_HEADER_SIZE);
-                packetLength = uint16_decode(m_header_rx_buffer);
-
-                if (packetLength != 0 )
-                {
-                    m_trans_state          = SPI_RAW_STATE_MEM_REQUESTED;
-                    m_buffer_reqested_flag = true;
-                    m_rx_packet_length     = packetLength;
-                    callback_memory_request(packetLength);
-                }
-                else
-                {
-                    if (m_p_tx_buffer)
-                    {
-                        clear_request_line();
-                        m_trans_state = SPI_RAW_STATE_TX_HEADER;
-                        err_code      = header_send(m_tx_packet_length);
-                    }
-                    else
-                    {
-                        //there is nothing to send - zero response facilitates pooling - but perhaps, it should be assert
-                        err_code = header_send(0);
-                    }
-                }
-            }
-
-            break;
-
-        case SPI_RAW_STATE_MEM_REQUESTED:
-
-            if (event.evt_type == NRF_DRV_SPIS_EVT_TYPE_MAX) //This is API dummy event
-            {
-                m_buffer_reqested_flag         = false;
-                m_trans_state                  = SPI_RAW_STATE_RX_PAYLOAD;
-                m_accumulated_rx_packet_length = 0;
-                err_code                       = frame_get();
-            }
-            break;
-
-        case SPI_RAW_STATE_RX_PAYLOAD:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_RX_XFER_DONE(event.rx_amount);
-                spi_slave_raw_assert(event.rx_amount == m_current_rx_frame_length);
-                m_accumulated_rx_packet_length += m_current_rx_frame_length;
-
-                if (m_accumulated_rx_packet_length < m_rx_packet_length )
-                {
-                    err_code = frame_get();
-                }
-                else
-                {
-                    spi_slave_raw_assert(m_accumulated_rx_packet_length == m_rx_packet_length);
-                    m_trans_state = SPI_RAW_STATE_RX_HEADER;
-                    err_code      = header_get();
-
-                    if (!m_trash_payload_flag)
-                    {
-                        callback_packet_received(m_p_rx_buffer, m_accumulated_rx_packet_length);
-                    }
-                    else
-                    {
-                        callback_packet_dropped();
-                    }
-                }
-            }
-            break;
-
-        case SPI_RAW_STATE_TX_HEADER:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount);
-                spi_slave_raw_assert(event.tx_amount == SER_PHY_HEADER_SIZE);
-                m_trans_state                  = SPI_RAW_STATE_TX_PAYLOAD;
-                m_accumulated_tx_packet_length = 0;
-                err_code                       = frame_send();
-            }
-
-            break;
-
-        case SPI_RAW_STATE_TX_PAYLOAD:
-
-            if (event.evt_type == NRF_DRV_SPIS_BUFFERS_SET_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_BUFFERS_SET(0);
-                set_ready_line();
-            }
-
-            if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
-            {
-                DEBUG_EVT_SPI_SLAVE_RAW_TX_XFER_DONE(event.tx_amount);
-                spi_slave_raw_assert(event.tx_amount == m_current_tx_frame_length);
-                m_accumulated_tx_packet_length += m_current_tx_frame_length;
-
-                if ( m_accumulated_tx_packet_length < m_tx_packet_length )
-                {
-                    err_code = frame_send();
-                }
-                else
-                {
-                    spi_slave_raw_assert(m_accumulated_tx_packet_length == m_tx_packet_length);
-                    //clear pointer before callback
-                    m_p_tx_buffer = NULL;
-                    callback_packet_transmitted();
-                    //spi slave TX transfer is possible only when RX is ready, so return to waiting for a header
-                    m_trans_state = SPI_RAW_STATE_RX_HEADER;
-                    err_code      = header_get();
-                }
-            }
-            break;
-
-        default:
-            err_code = NRF_ERROR_INVALID_STATE;
-            break;
-    }
-    APP_ERROR_CHECK(err_code);
-}
-
-static void spi_slave_gpiote_init(void)
-{
-    if (!nrf_drv_gpiote_is_init())
-    {
-        (void)nrf_drv_gpiote_init();
-    }
-    nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(true);
-    (void) nrf_drv_gpiote_out_init(m_spi_slave_raw_config.pin_rdy, &config);
-    (void) nrf_drv_gpiote_out_task_enable(m_spi_slave_raw_config.pin_rdy);
-    return;
-}
-
-static void spi_slave_ppi_init(void)
-{
-    uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.pin_rdy);
-    //Configure PPI channel  to clear /RDY line
-    NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].EEP = (uint32_t)(&NRF_SPIS1->EVENTS_END);
-    NRF_PPI->CH[m_spi_slave_raw_config.ppi_rdy_ch].TEP = rdy_task;
-
-    //this works only for channels 0..15 - but soft device is using 8-15 anyway
-    NRF_PPI->CHEN |= (1 << m_spi_slave_raw_config.ppi_rdy_ch);
-    return;
-}
-
-static void spi_slave_gpio_init(void)
-{
-    nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_req);
-    nrf_gpio_pin_set(m_spi_slave_raw_config.pin_req);
-    nrf_gpio_cfg_output(m_spi_slave_raw_config.pin_rdy);
-    nrf_gpio_pin_set(m_spi_slave_raw_config.pin_rdy);
-}
-
-/* ser_phy API function */
-void ser_phy_interrupts_enable(void)
-{
-    (void)sd_nvic_EnableIRQ(m_spis.irq);
-}
-
-/* ser_phy API function */
-void ser_phy_interrupts_disable(void)
-{
-    (void)sd_nvic_DisableIRQ(m_spis.irq);
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    uint32_t             status = NRF_SUCCESS;
-    nrf_drv_spis_event_t event;
-
-    ser_phy_interrupts_disable();
-
-    if (m_buffer_reqested_flag && (m_trans_state == SPI_RAW_STATE_MEM_REQUESTED))
-    {
-        m_p_rx_buffer = p_buffer;
-
-        if (m_p_rx_buffer)
-        {
-            m_trash_payload_flag = false;
-        }
-        else
-        {
-            m_trash_payload_flag = true;
-        }
-        event.evt_type  = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition with dummy event
-        event.rx_amount = 0;
-        event.tx_amount = 0;
-        spi_slave_event_handle(event);
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-    ser_phy_interrupts_enable();
-
-    return status;
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    uint32_t status = NRF_SUCCESS;
-
-    if ( p_buffer == NULL || num_of_bytes == 0)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    ser_phy_interrupts_disable();
-
-    if ( m_p_tx_buffer == NULL)
-    {
-        m_tx_packet_length = num_of_bytes;
-        m_p_tx_buffer      = p_buffer;
-        set_request_line();
-    }
-    else
-    {
-        status = NRF_ERROR_BUSY;
-    }
-    ser_phy_interrupts_enable();
-
-    return status;
-}
-
-/* ser_phy API function */
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    uint32_t              err_code;
-    nrf_drv_spis_config_t spi_slave_config;
-    nrf_drv_spis_event_t  event;
-
-    if (m_trans_state != SPI_RAW_STATE_UNKNOWN)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    //one ppi channel and one gpiote channel are used to drive RDY line
-    m_spi_slave_raw_config.pin_req       = SER_PHY_SPI_SLAVE_REQ_PIN;
-    m_spi_slave_raw_config.pin_rdy       = SER_PHY_SPI_SLAVE_RDY_PIN;
-    m_spi_slave_raw_config.ppi_rdy_ch    = SER_PHY_SPI_PPI_RDY_CH;
-    m_spi_slave_raw_config.gpiote_rdy_ch = SER_PHY_SPI_GPIOTE_RDY_CH;
-
-    spi_slave_gpio_init();
-    spi_slave_gpiote_init();
-    spi_slave_ppi_init();
-
-    spi_slave_config.miso_pin         = SER_PHY_SPI_SLAVE_MISO_PIN;
-    spi_slave_config.mosi_pin         = SER_PHY_SPI_SLAVE_MOSI_PIN;
-    spi_slave_config.sck_pin          = SER_PHY_SPI_SLAVE_SCK_PIN;
-    spi_slave_config.csn_pin          = SER_PHY_SPI_SLAVE_SS_PIN;
-    spi_slave_config.mode             = NRF_DRV_SPIS_MODE_0;
-    spi_slave_config.bit_order        = NRF_DRV_SPIS_BIT_ORDER_LSB_FIRST;
-    spi_slave_config.def              = SER_PHY_SPI_DEF_CHARACTER;
-    spi_slave_config.orc              = SER_PHY_SPI_ORC_CHARACTER;        
-    spi_slave_config.irq_priority     = APP_IRQ_PRIORITY_LOW;
-    spi_slave_config.miso_drive       = NRF_DRV_SPIS_DEFAULT_MISO_DRIVE;
-    //use /CS pullup because state of the line might be undefined when master redefines PIO lines
-    spi_slave_config.csn_pullup       = NRF_GPIO_PIN_PULLUP;
-
-    //keep /CS high when init
-    nrf_gpio_cfg_input(spi_slave_config.csn_pin, NRF_GPIO_PIN_PULLUP);
-
-    err_code = nrf_drv_spis_init(&m_spis, &spi_slave_config, spi_slave_event_handle);
-    APP_ERROR_CHECK(err_code);
-
-    if (err_code == NRF_SUCCESS)
-    {
-        m_ser_phy_callback = events_handler;
-
-        m_trans_state   = SPI_RAW_STATE_SETUP_HEADER;
-        event.evt_type  = NRF_DRV_SPIS_EVT_TYPE_MAX; //force transition for dummy event
-        event.rx_amount = 0;
-        event.tx_amount = 0;
-        spi_slave_event_handle(event);
-
-    }
-    return err_code;
-}
-
-/* ser_phy API function */
-void ser_phy_close(void)
-{
-    nrf_drv_spis_uninit(&m_spis);
-    m_ser_phy_callback = NULL;
-    m_trans_state      = SPI_RAW_STATE_UNKNOWN;
-}

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/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c
deleted file mode 100644
index 083d2dd..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart.c
+++ /dev/null
@@ -1,440 +0,0 @@
-
-/* Copyright (c) Nordic Semiconductor ASA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. This software must only be used in a processor manufactured by Nordic
- * Semiconductor ASA, or in a processor manufactured by a third party that
- * is used in combination with a processor manufactured by Nordic Semiconductor.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "ser_phy.h"
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "nordic_common.h"
-#include "nrf.h"
-#include "nrf_error.h"
-#include "nrf_gpio.h"
-#include "app_util.h"
-#include "app_uart.h"
-#include "app_error.h"
-
-#ifdef SER_CONNECTIVITY
-#include "ser_phy_config_conn_nrf51.h"
-#else
-#include "ser_phy_config_app_nrf51.h"
-#endif /* SER_CONNECTIVITY */
-
-#include "boards.h"
-
-#ifdef NRF51
-#define SER_UART_IRQ UART0_IRQn
-#elif defined NRF52
-#define SER_UART_IRQ UARTE0_UART0_IRQn
-#endif /* NRF51 */
-
-static uint8_t * mp_tx_stream;                         /**< Pointer to Tx data */
-static uint16_t  m_tx_stream_length;                   /**< Length of Tx data including SER_PHY
-                                                        *   header */
-static uint16_t  m_tx_stream_index;                    /**< Byte index in Tx data */
-static uint8_t   m_tx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer for header of Tx packet */
-
-static uint8_t * mp_rx_stream;                         /**< Pointer to Rx buffer */
-static uint16_t  m_rx_stream_length;                   /**< Length of Rx data including SER_PHY
-                                                        *   header*/
-static uint16_t  m_rx_stream_index;                    /**< Byte index in Rx data */
-static uint8_t   m_rx_length_buf[SER_PHY_HEADER_SIZE]; /**< Buffer for header of Rx packet */
-static uint8_t   m_rx_drop_buf[1];                     /**< 1-byte buffer used to trash incoming
-                                                        *   data */
-static uint8_t   m_rx_byte;                            /**< Rx byte passed from low-level driver */
-
-static ser_phy_events_handler_t m_ser_phy_event_handler; /**< Event handler for upper layer */
-static ser_phy_evt_t            m_ser_phy_rx_event;      /**< Rx event for upper layer
-                                                          *   notification */
-static ser_phy_evt_t            m_ser_phy_tx_event;      /**< Tx event for upper layer
-                                                          *   notification */
-
-static bool m_other_side_active = false; /* Flag indicating that the other side is running */
-
-/**
- *@breif UART configuration structure, values are defined in SER_PHY config files:
- *  ser_phy_config_conn_nrf51.h for connectivity and ser_phy_config_app_nrf51.h for application.
- */
-static const app_uart_comm_params_t comm_params =
-{
-    .rx_pin_no  = SER_PHY_UART_RX,
-    .tx_pin_no  = SER_PHY_UART_TX,
-    .rts_pin_no = SER_PHY_UART_RTS,
-    .cts_pin_no = SER_PHY_UART_CTS,
-    //Below values are defined in ser_config.h common for application and connectivity
-    .flow_control = SER_PHY_UART_FLOW_CTRL,
-    .use_parity   = SER_PHY_UART_PARITY,
-    .baud_rate    = SER_PHY_UART_BAUDRATE
-};
-
-/** FUNCTION DECLARATIONS */
-
-static __INLINE void callback_ser_phy_event(ser_phy_evt_t event);
-static __INLINE void callback_packet_received(void);
-static __INLINE void callback_packet_sent(void);
-static __INLINE void callback_mem_request(void);
-static __INLINE void callback_hw_error(uint32_t error_src);
-
-static void ser_phy_uart_tx(void);
-static void ser_phy_uart_rx(uint8_t rx_byte);
-static void ser_phy_uart_evt_callback(app_uart_evt_t * uart_evt);
-
-
-/** STATIC FUNCTION DEFINITIONS */
-
-/**
- *@brief Callback for calling ser phy event handler to notify higher layer with appropriate event.
- * Handler is called only wen it was previously registered.
- */
-static __INLINE void callback_ser_phy_event(ser_phy_evt_t event)
-{
-    if (m_ser_phy_event_handler)
-    {
-        m_ser_phy_event_handler(event);
-    }
-    return;
-}
-
-/**
- *@brief Callback for notifying upper layer that either a packet was succesfully received or it was
- * dropped.
- */
-static __INLINE void callback_packet_received(void)
-{
-    if (mp_rx_stream == m_rx_drop_buf)
-    {
-        m_ser_phy_rx_event.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-    }
-    else
-    {
-        m_ser_phy_rx_event.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-        m_ser_phy_rx_event.evt_params.rx_pkt_received.num_of_bytes =
-            m_rx_stream_index - SER_PHY_HEADER_SIZE;
-        m_ser_phy_rx_event.evt_params.rx_pkt_received.p_buffer =
-            mp_rx_stream;
-    }
-
-    mp_rx_stream       = NULL;
-    m_rx_stream_length = 0;
-    m_rx_stream_index  = 0;
-
-    callback_ser_phy_event(m_ser_phy_rx_event);
-}
-
-/**
- *@brief Callback for notifying upper layer that a packet was succesfully transmitted
- */
-static __INLINE void callback_packet_sent(void)
-{
-    mp_tx_stream       = NULL;
-    m_tx_stream_length = 0;
-    m_tx_stream_index  = 0;
-
-    m_ser_phy_tx_event.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-
-    callback_ser_phy_event(m_ser_phy_tx_event);
-}
-
-/**
- *@brief Callback for requesting from upper layer memory for an incomming packet.
- */
-static __INLINE void callback_mem_request(void)
-{
-    m_rx_stream_length          = uint16_decode(m_rx_length_buf) + SER_PHY_HEADER_SIZE;
-    m_ser_phy_rx_event.evt_type = SER_PHY_EVT_RX_BUF_REQUEST;
-    m_ser_phy_rx_event.evt_params.rx_buf_request.num_of_bytes =
-        m_rx_stream_length - SER_PHY_HEADER_SIZE;
-
-    callback_ser_phy_event(m_ser_phy_rx_event);
-}
-
-/**
- *@brief Callback for notifying upper layer of a HW error that occured.
- */
-static __INLINE void callback_hw_error(uint32_t error_src)
-{
-    mp_rx_stream                = NULL;
-    m_rx_stream_length          = 0;
-    m_rx_stream_index           = 0;
-    m_ser_phy_rx_event.evt_type = SER_PHY_EVT_HW_ERROR;
-
-    //Pass error source to upper layer
-    m_ser_phy_rx_event.evt_params.hw_error.error_code = error_src;
-    callback_ser_phy_event(m_ser_phy_rx_event);
-}
-
-/**
- *@brief Function for handling Tx procedure.
- */
-static void ser_phy_uart_tx(void)
-{
-    if (mp_tx_stream != NULL)
-    {
-        bool     tx_done_flag = false;       /**< Local flag for indicating that TX is completed */
-        uint32_t err_code     = NRF_SUCCESS; /**< Error code for storing result of app_uart_put */
-
-        //Blocking TXRDY interrupt is done to avoid interrupting when this procedure is
-        //triggered from main context
-        NRF_UART0->INTENCLR = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos);
-
-        //Notify upper layer if whole packet has been transmitted
-        if (m_tx_stream_index == m_tx_stream_length)
-        {
-            callback_packet_sent();
-            tx_done_flag = true;
-        }
-        //First transmit 2 bytes of packet length
-        else if (m_tx_stream_index < SER_PHY_HEADER_SIZE)
-        {
-            err_code = app_uart_put(m_tx_length_buf[m_tx_stream_index]);
-        }
-        //Then transmit payload
-        else if (m_tx_stream_index < m_tx_stream_length)
-        {
-            err_code = app_uart_put(mp_tx_stream[m_tx_stream_index - SER_PHY_HEADER_SIZE]);
-        }
-
-        //Increment index only if byte was sent without errors
-        if ((err_code == NRF_SUCCESS) && !tx_done_flag)
-        {
-            m_tx_stream_index++;
-        }
-
-        //Unblock TXRDY interrupts
-        NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos);
-    }
-
-}
-
-/**
- *@brief Function for handling Rx procedure.
- */
-static void ser_phy_uart_rx(uint8_t rx_byte)
-{
-
-    if (mp_rx_stream == NULL )
-    {
-        //Receive length value and request rx buffer from higher layer
-        if (m_rx_stream_index < SER_PHY_HEADER_SIZE)
-        {
-            m_rx_length_buf[m_rx_stream_index++] = rx_byte;
-
-            if (m_rx_stream_index == SER_PHY_HEADER_SIZE)
-            {
-                //Block RXRDY interrupts at this point to not handle incoming bytes until upper
-                //layer provides memory for payload
-                NRF_UART0->INTENCLR = (UART_INTENCLR_RXDRDY_Clear << UART_INTENCLR_RXDRDY_Pos);
-
-                //Request rx buffer from upper layer
-                callback_mem_request();
-            }
-        }
-    }
-    else if (m_rx_stream_index < m_rx_stream_length)
-    {
-        //Receive or drop payload
-        if (mp_rx_stream == m_rx_drop_buf)
-        {
-            //Drop incoming data to the one-element drop buffer
-            *mp_rx_stream = rx_byte;
-            m_rx_stream_index++;
-        }
-        else
-        {
-            mp_rx_stream[m_rx_stream_index - SER_PHY_HEADER_SIZE] = rx_byte;
-            m_rx_stream_index++;
-        }
-    }
-
-    //Process RX packet, notify higher layer
-    if (m_rx_stream_index == m_rx_stream_length)
-    {
-        callback_packet_received();
-    }
-}
-
-/**
- *@brief Callback for processing events from low-level UART driver.
- */
-static void ser_phy_uart_evt_callback(app_uart_evt_t * uart_evt)
-{
-    if (uart_evt == NULL)
-    {
-        return;
-    }
-
-    switch (uart_evt->evt_type)
-    {
-        case APP_UART_COMMUNICATION_ERROR:
-
-            //Process error only if this is parity or overrun error.
-            //Break and framing error is always present when app side is not active
-            if (uart_evt->data.error_communication &
-                (UART_ERRORSRC_PARITY_Msk | UART_ERRORSRC_OVERRUN_Msk))
-            {
-                callback_hw_error(uart_evt->data.error_communication);
-            }
-            break;
-
-        case APP_UART_TX_EMPTY:
-            ser_phy_uart_tx();
-            break;
-
-        case APP_UART_DATA:
-
-            //After first reception disable pulldown - it was only needed before start
-            //of the other side
-            if (!m_other_side_active)
-            {
-                nrf_gpio_cfg_input(comm_params.rx_pin_no, NRF_GPIO_PIN_NOPULL);
-                m_other_side_active = true;
-            }
-
-            m_rx_byte = uart_evt->data.value;
-            ser_phy_uart_rx(m_rx_byte);
-            break;
-
-        default:
-            APP_ERROR_CHECK(NRF_ERROR_INTERNAL);
-            break;
-    }
-}
-
-/** API FUNCTIONS */
-
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    //Check if function was not called before
-    if (m_ser_phy_event_handler != NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    //Configure UART and register handler
-    //uart_evt_handler is used to handle events produced by low-level uart driver
-    APP_UART_INIT(&comm_params, ser_phy_uart_evt_callback, UART_IRQ_PRIORITY, err_code);
-
-//    //Pull down Rx pin until another side gets up to avoid receiving false bytes due to glitches
-//    //on Rx line
-//    nrf_gpio_cfg_input(comm_params.rx_pin_no, NRF_GPIO_PIN_PULLDOWN);
-
-    m_ser_phy_event_handler = events_handler;
-
-    //If intialization did not go alright return error
-    if (err_code != NRF_SUCCESS)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    return err_code;
-}
-
-
-
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-    else if (num_of_bytes == 0)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    //Check if there is no ongoing transmission at the moment
-    if ((mp_tx_stream == NULL) && (m_tx_stream_length == 0) && (m_tx_stream_index == 0))
-    {
-        (void) uint16_encode(num_of_bytes, m_tx_length_buf);
-        mp_tx_stream       = (uint8_t *)p_buffer;
-        m_tx_stream_length = num_of_bytes + SER_PHY_HEADER_SIZE;
-
-        //Call tx procedure to start transmission of a packet
-        ser_phy_uart_tx();
-    }
-    else
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    return NRF_SUCCESS;
-}
-
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-
-    if (m_ser_phy_rx_event.evt_type != SER_PHY_EVT_RX_BUF_REQUEST)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_buffer != NULL)
-    {
-        mp_rx_stream = p_buffer;
-    }
-    else
-    {
-        mp_rx_stream = m_rx_drop_buf;
-    }
-
-    //Unblock RXRDY interrupts as higher layer has responded (with a valid or NULL pointer)
-    NRF_UART0->INTENSET = (UART_INTENSET_RXDRDY_Set << UART_INTENSET_RXDRDY_Pos);
-
-    return NRF_SUCCESS;
-}
-
-void ser_phy_close(void)
-{
-    m_ser_phy_event_handler = NULL;
-    (void)app_uart_close();
-}
-
-void ser_phy_interrupts_enable(void)
-{
-    NVIC_EnableIRQ(SER_UART_IRQ);
-}
-
-void ser_phy_interrupts_disable(void)
-{
-    NVIC_DisableIRQ(SER_UART_IRQ);
-}
-

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/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c
deleted file mode 100644
index 7963d5f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/transport/ser_phy/ser_phy_nrf51_uart_stm_app.c
+++ /dev/null
@@ -1,754 +0,0 @@
-/* Copyright (c) Nordic Semiconductor ASA
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- *
- * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
- * contributors to this software may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 4. This software must only be used in a processor manufactured by Nordic
- * Semiconductor ASA, or in a processor manufactured by STMicroelectronics that
- * is used in combination with a processor manufactured by Nordic Semiconductor
- * or in a processor manufactured by STMicroelectronics.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "nordic_common.h"
-#include "boards.h"
-#include "nrf.h"
-#include "nrf_error.h"
-#include "nrf_gpio.h"
-#include "nrf_delay.h"
-#include "nrf_gpiote.h"
-#include "app_gpiote.h"
-#include "app_util.h"
-#include "app_util_platform.h"
-
-#include "ser_phy.h"
-#include "ser_phy_config_app_nrf51.h"
-
-#define UART_PIN_DISCONNECTED 0xFFFFFFFF /**< Value indicating that no pin is connected to this UART register. */
-
-/** @brief States for the app_uart state machine. */
-typedef enum
-{
-    UART_IDLE,              /**< Indicating that the current status for either RX or TX is idle. When both RX and TX is idle the UART will be disabled in order to save power. */
-    UART_RX,                /**< Used to indicate that a packet is currently being received on RX. */
-    UART_RX_PENDING,        /**< Used to indicate that byte is ready at RXD register but no buffer was available when the byte was received. The byte will be pulled when a buffer is set. */
-    UART_TX_COMPLETE,       /**< Used on TX to indicate that final byte has been put on TXD register. Next TXDRDY interrupt will indicate that last byte has been transmitted. */
-    UART_TX_SEND,           /**< Used to indicate that a packet is currently being transmitted on TX. */
-    UART_TX_LAST_BYTE_WAIT, /**< Used to indicate that the last byte on a TX packet is currently waiting to be transmitted when CTS goes low. Note that flow control is off when tranmitting final byte. */
-    UART_STALL,             /**< Indicates that TX is stalled because final byte is being received on the UART. */
-} uart_states_t;
-
-static volatile uint32_t m_pin_cts_mask; /**< CTS pin mask for UART module. */
-
-static volatile uint8_t * mp_tx_stream;                          /**< Pointer to array of data packet to be transmitted. */
-static volatile uint16_t  m_tx_stream_length;                    /**< Total length of data packet to be transmitted. */
-static volatile uint16_t  m_tx_stream_index;                     /**< Index in data packet for next byte to be transmitted. */
-static          uint8_t   m_tx_length_buf[SER_PHY_HEADER_SIZE];  /**< Buffer needed in transmission of packet length */
-
-static          uint8_t * mp_rx_stream;                          /**< Pointer to current receive buffer. */
-static volatile uint16_t  m_rx_stream_length;                    /**< Length of receive buffer. */
-static volatile uint16_t  m_rx_stream_index;                     /**< Index in receive buffer where the next byte will be placed. */
-static volatile bool      m_rx_stream_header;                    /**< Indication of whether header data (true) or payload data (false) is currently being received. */
-static          uint8_t   m_rx_length_buf[SER_PHY_HEADER_SIZE];  /**< Buffer needed in reception of packet length */
-static          uint8_t   m_rx_drop_buf[1];                      /**< Additional buffer, needed by packet dropping functionality. */
-
-static volatile uart_states_t m_rx_state            = UART_IDLE; /**< State of the RX state machine. */
-static volatile uart_states_t m_tx_state            = UART_IDLE; /**< State of the TX state machine. */
-static volatile bool          m_tx_pending          = false;     /**< If TX state is UART_STALL and a byte is ready for tranmission the pending flag is set to true. */
-static volatile bool          m_cts_high_disconnect = false;     /**< If CTS was sampled low when last byte was transmitted this flag is set to true to indicate that a switch from low->high on CTS should be interpreted as transmission has completed and UART is to be disabled to save power. */
-
-static volatile ser_phy_events_handler_t m_ser_phy_event_handler;
-static volatile ser_phy_evt_t            m_ser_phy_event_rx;
-static volatile ser_phy_evt_t            m_ser_phy_event_tx;
-
-
-static void uart_peripheral_disconnect_flow(void)
-{
-    NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-    nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-
-    NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED;
-    NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED;
-    NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-}
-
-
-static void uart_peripheral_connect_flow(void)
-{
-    NRF_UART0->PSELCTS = SER_PHY_UART_CTS;
-    NRF_UART0->PSELRTS = SER_PHY_UART_RTS;
-    NRF_UART0->CONFIG |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-}
-
-
-static void uart_peripheral_enable(void)
-{
-    if (!(NRF_UART0->ENABLE & (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos)))
-    {
-        NRF_UART0->PSELCTS       = SER_PHY_UART_CTS;
-        NRF_UART0->PSELRTS       = SER_PHY_UART_RTS;
-        NRF_UART0->CONFIG       |= (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-        NRF_UART0->TASKS_STARTRX = 1;
-        NRF_UART0->TASKS_STARTTX = 1;
-        NRF_UART0->ENABLE        = (UART_ENABLE_ENABLE_Enabled << UART_ENABLE_ENABLE_Pos);
-    }
-}
-
-
-static void uart_peripheral_disable(void)
-{
-    if ((m_tx_state == UART_IDLE || m_tx_state == UART_STALL) &&
-        (m_rx_state == UART_IDLE))
-    {
-        NRF_UART0->TASKS_STOPTX = 1;
-        NRF_UART0->TASKS_STOPRX = 1;
-        NRF_UART0->PSELCTS      = UART_PIN_DISCONNECTED;
-        NRF_UART0->PSELRTS      = UART_PIN_DISCONNECTED;
-        NRF_UART0->ENABLE       = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos);
-
-        nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL);
-
-        nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE);
-
-        if (!nrf_gpio_pin_read(SER_PHY_UART_CTS))
-        {
-            NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-            nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-            uart_peripheral_enable();
-        }
-    }
-}
-
-
-static void uart_tx_start(void)
-{
-    if (mp_tx_stream != NULL)
-    {
-        //If RX is already ongoing then no wakeup signal is required.
-        if (m_rx_state == UART_IDLE)
-        {
-            nrf_gpiote_event_disable(0);
-            NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-            nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-            uart_peripheral_connect_flow();
-            uart_peripheral_enable();
-        }
-    }
-}
-
-
-static void uart_tx_send(void)
-{
-    //First send 2 bytes of header then payload
-    if (m_tx_stream_index < SER_PHY_HEADER_SIZE)
-    {
-        NRF_UART0->TXD = m_tx_length_buf[m_tx_stream_index++];
-    }
-    else if (m_tx_stream_index < m_tx_stream_length)
-    {
-        NRF_UART0->TXD = mp_tx_stream[m_tx_stream_index++ - SER_PHY_HEADER_SIZE];
-    }
-}
-
-
-static void uart_tx_last_byte(void)
-{
-    uart_peripheral_disconnect_flow();
-    m_tx_state = UART_TX_LAST_BYTE_WAIT;
-
-    //Configure event in case CTS is going low during this function execution
-    nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE);
-
-    if (!nrf_gpio_pin_read(SER_PHY_UART_CTS)) //All pins are low --> last byte can be transmitted.
-    {
-        //Re-check state as it might have changed due to preemption of current interrupt.
-        nrf_gpiote_event_disable(0);
-
-        if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-        {
-            m_tx_state = UART_TX_COMPLETE;
-            uart_tx_send();
-        }
-    }
-}
-
-
-static void tx_complete_event_send(void)
-{
-    mp_tx_stream       = NULL;
-    m_tx_stream_length = 0;
-    m_tx_stream_index  = 0;
-
-    m_ser_phy_event_tx.evt_type = SER_PHY_EVT_TX_PKT_SENT;
-    m_ser_phy_event_handler(m_ser_phy_event_tx);
-}
-
-
-static void uart_txdrdy_handle(void)
-{
-    NRF_UART0->EVENTS_TXDRDY = 0;
-
-    if (m_tx_state == UART_TX_SEND || m_tx_state == UART_IDLE)
-    {
-        if (m_tx_stream_index < (m_tx_stream_length - 1))
-        {
-            m_tx_state = UART_TX_SEND;
-            uart_tx_send();
-            //Keep same state.
-        }
-        else if (m_tx_stream_index == m_tx_stream_length)
-        {
-            m_tx_state = UART_IDLE;
-            tx_complete_event_send();
-        }
-        else
-        {
-            uart_tx_last_byte();
-        }
-    }
-    else if (m_tx_state == UART_TX_COMPLETE)
-    {
-        m_tx_state = UART_IDLE;
-
-        if (m_rx_state == UART_IDLE)
-        {
-            nrf_delay_us(15);
-            nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE);
-
-            if (nrf_gpio_pin_read(SER_PHY_UART_CTS))
-            {
-                uart_peripheral_disable();
-            }
-            else
-            {
-                uart_peripheral_connect_flow();
-                m_cts_high_disconnect = true;
-                nrf_gpiote_event_configure(0, SER_PHY_UART_CTS, NRF_GPIOTE_POLARITY_TOGGLE);
-
-                if (nrf_gpio_pin_read(SER_PHY_UART_CTS))
-                {
-                    //If second sample show CTS high it either
-                    //1) happened BEFORE gpiote enable and uart should be disabled.
-                    //(m_cts_high_disconnect == true).
-                    //2) happened AFTER gpiote enable and an interrupt low->high has occured then
-                    //uart should NOT be disabled as the ISR has disabled the UART.
-                    //(m_cts_high_disconnect == false).
-                    if (m_cts_high_disconnect == true)
-                    {
-                        m_cts_high_disconnect = false;
-                        uart_peripheral_disable();
-                    }
-                }
-            }
-        }
-        else
-        {
-            uart_peripheral_connect_flow();
-        }
-
-        tx_complete_event_send();
-    }
-    else if (m_tx_state == UART_STALL)
-    {
-        if (m_tx_stream_index == m_tx_stream_length)
-        {
-            tx_complete_event_send();
-        }
-        else
-        {
-            m_tx_pending = true;
-        }
-    }
-    else
-    {
-        //Do nothing.
-    }
-}
-
-
-static __INLINE void on_cts_high(void)
-{
-    if (m_cts_high_disconnect == true)
-    {
-        m_cts_high_disconnect = false;
-
-        if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE)
-        {
-            if (m_tx_stream_index == m_tx_stream_length)
-            {
-                uart_peripheral_disable();
-            }
-        }
-    }
-}
-
-
-static __INLINE void on_cts_low(void)
-{
-    m_cts_high_disconnect = false;
-    nrf_gpiote_event_disable(0);
-
-    if (m_tx_state == UART_STALL)
-    {
-        m_tx_pending = true;
-    }
-    else if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-    {
-        m_tx_state = UART_TX_COMPLETE;
-        uart_tx_send();
-    }
-    else if (m_rx_state == UART_IDLE && m_tx_state == UART_IDLE)
-    {
-        NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-        nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-        uart_peripheral_enable();
-    }
-}
-
-
-static void uart_rxdrdy_handle(void)
-{
-    if (m_rx_state == UART_IDLE)
-    {
-        m_rx_state = UART_RX;
-    }
-
-    //Set proper size and buff at the beginning of receiving header
-    if ((m_rx_stream_header == true) && !m_rx_stream_index)
-    {
-        m_rx_stream_length = SER_PHY_HEADER_SIZE;
-        mp_rx_stream       = m_rx_length_buf;
-    }
-
-    if (mp_rx_stream != NULL)
-    {
-        bool tx_dual_end = false;
-
-        NRF_UART0->EVENTS_RXDRDY = 0;
-
-        //Second last byte received.
-        //Disconnect CTS before pulling the byte and receiving the final byte.
-        if ((m_rx_stream_header == false) && ((m_rx_stream_index) == (m_rx_stream_length - 2)))
-        {
-            nrf_gpio_cfg_output(SER_PHY_UART_RTS);
-
-            //Last byte is waiting for tansmission. Thus dual end TX case.
-            //
-            if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-            {
-                m_tx_state = UART_STALL;
-                nrf_gpiote_event_disable(0);
-
-                //Checking pending state.
-                //- If pending is true then CTS have become low after we stalled the UART and final byte should be transmitted here.
-                //- If pending is false we should check if final byte was tranmitted and if not, the do the transmission her.
-                if ((m_tx_pending == true) || (m_tx_stream_index == (m_tx_stream_length - 1)))
-                {
-                    //tx_dual_end = true;
-                    NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-                    uart_tx_send();
-                }
-            }
-
-            if (!tx_dual_end)
-            {
-                NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS;
-            }
-            m_tx_state = UART_STALL;
-
-            NRF_UART0->PSELCTS = UART_PIN_DISCONNECTED;
-            NRF_UART0->PSELRTS = UART_PIN_DISCONNECTED;
-            NRF_UART0->CONFIG &= ~(UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-        }
-
-        if (m_rx_stream_index < (m_rx_stream_length - 1))
-        {
-            if (mp_rx_stream != m_rx_drop_buf)
-            {
-                mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD;
-            }
-            else
-            {
-                mp_rx_stream[0] = NRF_UART0->RXD;
-                m_rx_stream_index++;
-            }
-
-            if (m_tx_stream_index == (m_tx_stream_length - 1))
-            {
-                //Toggle CTS line to indicate ack.
-                //If CTS is connected to UART this code will have no effect.
-                //But on edge case on bi-directional last byte transfer this avoids lock-up.
-                NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-                nrf_delay_us(8);
-                NRF_GPIO->OUTCLR = 1 << SER_PHY_UART_RTS;
-            }
-        }
-        else
-        {
-            if (m_rx_stream_header == false)
-            {
-                NRF_GPIO->OUTSET = 1 << SER_PHY_UART_RTS;
-
-                if (mp_rx_stream != m_rx_drop_buf)
-                {
-                    mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD;
-                }
-                else
-                {
-                    mp_rx_stream[0] = NRF_UART0->RXD;
-                    m_rx_stream_index++;
-                }
-                m_rx_state = UART_IDLE;
-
-                //Last byte of payload received - notify that next transmission will be header
-                m_rx_stream_header = true;
-
-                //Prepare event
-                if (mp_rx_stream != m_rx_drop_buf)
-                {
-                    m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_RECEIVED;
-                    m_ser_phy_event_rx.evt_params.rx_pkt_received.num_of_bytes = m_rx_stream_index;
-                    m_ser_phy_event_rx.evt_params.rx_pkt_received.p_buffer     = mp_rx_stream;
-                }
-                else
-                {
-                    m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_PKT_DROPPED;
-                }
-
-                m_rx_stream_length = 0;
-                m_rx_stream_index  = 0;
-            }
-            else
-            {
-                mp_rx_stream[m_rx_stream_index++] = NRF_UART0->RXD;
-
-                //Last byte of header received - notify that next transmission will be payload
-                m_rx_stream_header = false;
-
-                mp_rx_stream = NULL;
-
-                //Clear index before receiving payload
-                m_rx_stream_index = 0;
-
-                //Prepare event
-                m_rx_stream_length = uint16_decode(m_rx_length_buf);
-                m_ser_phy_event_rx.evt_type = SER_PHY_EVT_RX_BUF_REQUEST;
-                m_ser_phy_event_rx.evt_params.rx_buf_request.num_of_bytes = m_rx_stream_length;
-            }
-
-            //Notify upwards
-            m_ser_phy_event_handler(m_ser_phy_event_rx);
-
-            //UART TX was stalled while receiving final byte. Restart tx.
-            if (m_tx_state == UART_STALL)
-            {
-                if (m_tx_stream_length == m_tx_stream_index)
-                {
-                    m_tx_state = UART_IDLE;
-                }
-                else if (m_tx_stream_index == (m_tx_stream_length - 1))
-                {
-                    m_tx_state = UART_TX_LAST_BYTE_WAIT;
-                }
-                else
-                {
-                    m_tx_state = UART_TX_SEND;
-                }
-
-                //Critical region for avoiding timing issues in 'simultaneous RX end and TX start'
-                CRITICAL_REGION_ENTER();
-                if (m_tx_pending == true)
-                {
-                    m_tx_pending = false;
-                    uart_tx_start();
-
-                    if (m_tx_state == UART_TX_SEND)
-                    {
-                        uart_tx_send();
-                    }
-                    else if (m_tx_state == UART_TX_LAST_BYTE_WAIT)
-                    {
-                        uart_tx_last_byte();
-                    }
-                }
-                CRITICAL_REGION_EXIT();
-
-                if (m_tx_state == UART_IDLE)
-                {
-                    uart_peripheral_disable();
-                }
-            }
-        }
-    }
-    else
-    {
-        m_rx_state = UART_RX_PENDING;
-    }
-}
-
-
-static __INLINE void uart_error_handle(void)
-{
-    uint32_t error_source;
-
-    //Clear UART ERROR event flag.
-    NRF_UART0->EVENTS_ERROR = 0;
-
-    //Clear error source.
-    error_source        = NRF_UART0->ERRORSRC;
-    NRF_UART0->ERRORSRC = error_source;
-
-    m_ser_phy_event_rx.evt_type                       = SER_PHY_EVT_HW_ERROR;
-    m_ser_phy_event_rx.evt_params.hw_error.error_code = error_source;
-
-    m_ser_phy_event_handler(m_ser_phy_event_rx);
-}
-
-
-/**@brief app_gpiote_fast_detect event handler.
- *
- */
-static void gpiote_evt_handler(void)
-{
-    if ( m_pin_cts_mask)
-    {
-        if ( nrf_gpio_pin_read(SER_PHY_UART_CTS) )
-        {
-            on_cts_high();
-        }
-        else
-        {
-            on_cts_low();
-        }
-    }
-}
-
-/**@brief Function for handling the UART Interrupt.
- *
- * @details UART interrupt handler to process TX Ready when TXD is available, RX Ready when a byte
- *          is received, or in case of error when receiving a byte.
- */
-void UART0_IRQHandler(void)
-{
-    //Handle Reception.
-    if (NRF_UART0->EVENTS_RXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_RXDRDY_Msk))
-    {
-        uart_rxdrdy_handle();
-    }
-
-    //Handle transmission.
-    if (NRF_UART0->EVENTS_TXDRDY != 0 && (NRF_UART0->INTENSET & UART_INTENSET_TXDRDY_Msk))
-    {
-        uart_txdrdy_handle();
-    }
-
-    //Handle errors.
-    if (NRF_UART0->EVENTS_ERROR != 0 && (NRF_UART0->INTENSET & UART_INTENSET_ERROR_Msk))
-    {
-        uart_error_handle();
-    }
-}
-
-
-uint32_t ser_phy_open(ser_phy_events_handler_t events_handler)
-{
-    if (events_handler == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    //Check if function was not called before
-    if (m_ser_phy_event_handler != NULL)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    //GPIO Setup
-    nrf_gpio_cfg_input(SER_PHY_UART_RTS, NRF_GPIO_PIN_NOPULL);
-
-    NRF_GPIO->OUTSET = 1 << SER_PHY_UART_TX;
-    nrf_gpio_cfg_output(SER_PHY_UART_TX);
-
-    //Setup the gpiote to handle pin events on cts-pin.
-    //For the UART we want to detect both low->high and high->low transitions in order to
-    //know when to activate/de-activate the TX/RX in the UART.
-    //Configure pin.
-    m_pin_cts_mask = (1 << SER_PHY_UART_CTS);
-    nrf_gpio_cfg_sense_input(SER_PHY_UART_CTS,
-                             NRF_GPIO_PIN_PULLUP,
-                             NRF_GPIO_PIN_SENSE_LOW);
-
-    nrf_gpio_cfg_sense_input(SER_PHY_UART_RX,
-                             NRF_GPIO_PIN_PULLUP,
-                             NRF_GPIO_PIN_NOSENSE);
-
-    (void)app_gpiote_input_event_handler_register(0,
-                                                  SER_PHY_UART_CTS,
-                                                  GPIOTE_CONFIG_POLARITY_Toggle,
-                                                  gpiote_evt_handler);
-    (void)app_gpiote_enable_interrupts();
-
-    NVIC_ClearPendingIRQ(PendSV_IRQn);
-
-    m_rx_state = UART_IDLE;
-    m_tx_state = UART_IDLE;
-
-    //Set header flag
-    m_rx_stream_header = true;
-
-    //UART setup
-    NRF_UART0->PSELRXD  = SER_PHY_UART_RX;
-    NRF_UART0->PSELTXD  = SER_PHY_UART_TX;
-    NRF_UART0->PSELCTS  = UART_PIN_DISCONNECTED;
-    NRF_UART0->PSELRTS  = UART_PIN_DISCONNECTED;
-    NRF_UART0->BAUDRATE = SER_PHY_UART_BAUDRATE;
-    NRF_UART0->CONFIG   = (UART_CONFIG_HWFC_Enabled << UART_CONFIG_HWFC_Pos);
-    NRF_UART0->ENABLE   = (UART_ENABLE_ENABLE_Disabled << UART_ENABLE_ENABLE_Pos);
-
-    //Enable UART interrupt
-    NRF_UART0->INTENCLR = 0xFFFFFFFF;
-    NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos) |
-                          (UART_INTENSET_RXDRDY_Set << UART_INTENSET_RXDRDY_Pos) |
-                          (UART_INTENSET_ERROR_Set << UART_INTENSET_ERROR_Pos);
-
-    NVIC_ClearPendingIRQ(UART0_IRQn);
-    NVIC_SetPriority(UART0_IRQn, APP_IRQ_PRIORITY_MID);
-    NVIC_EnableIRQ(UART0_IRQn);
-
-    m_ser_phy_event_handler = events_handler;
-
-    return NRF_SUCCESS;
-}
-
-
-void ser_phy_close(void)
-{
-    //Disable UART interrupt.
-    NRF_UART0->INTENCLR = 0xFFFFFFFF;
-
-    //Unregister callback.
-    m_ser_phy_event_handler = NULL;
-
-    //Will not check err_code here as we will still continue with closure of UART despite errors.
-    //Note that any error will still be reported back in the system.
-    nrf_gpiote_event_disable(0);
-
-    uart_peripheral_disable();
-
-    //Clear internal UART states
-    m_rx_state = UART_IDLE;
-    m_tx_state = UART_IDLE;
-
-    mp_tx_stream       = NULL;
-    m_tx_stream_length = 0;
-    m_tx_stream_index  = 0;
-
-    mp_rx_stream       = NULL;
-    m_rx_stream_length = 0;
-    m_rx_stream_index  = 0;
-}
-
-
-uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes)
-{
-    if (p_buffer == NULL)
-    {
-        return NRF_ERROR_NULL;
-    }
-
-    if (num_of_bytes == 0)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (mp_tx_stream != NULL)
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    m_tx_pending = true;
-
-    (void) uint16_encode(num_of_bytes, m_tx_length_buf);
-    mp_tx_stream       = (uint8_t *)p_buffer;
-    m_tx_stream_length = num_of_bytes + SER_PHY_HEADER_SIZE;
-
-    //Critical region for avoiding timing issues in 'simultaneous RX end and TX start'
-    CRITICAL_REGION_ENTER();
-    if ((!m_rx_stream_length) || (m_rx_stream_index < (m_rx_stream_length - 2)))
-    {
-        if (m_tx_state != UART_STALL)
-        {
-            if (m_tx_pending == true)
-            {
-                m_tx_pending = false;
-                uart_tx_start();
-                //As no tx can be ongoing, then it is safe to call tx_send here.
-                uart_tx_send();
-            }
-        }
-    }
-    CRITICAL_REGION_EXIT();
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ser_phy_rx_buf_set(uint8_t * p_buffer)
-{
-    if (m_ser_phy_event_rx.evt_type != SER_PHY_EVT_RX_BUF_REQUEST)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    if (p_buffer != NULL)
-    {
-        mp_rx_stream = p_buffer;
-    }
-    else
-    {
-        mp_rx_stream = m_rx_drop_buf;
-    }
-
-    return NRF_SUCCESS;
-}
-
-
-void ser_phy_interrupts_enable(void)
-{
-    NVIC_EnableIRQ(UART0_IRQn);
-    NVIC_EnableIRQ(GPIOTE_IRQn);
-}
-
-
-void ser_phy_interrupts_disable(void)
-{
-    NVIC_DisableIRQ(UART0_IRQn);
-    NVIC_DisableIRQ(GPIOTE_IRQn);
-}


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

Posted by cc...@apache.org.
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/serialization/application/codecs/s130/serializers/ble_gap_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_app.h
deleted file mode 100644
index 0d791eb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_app.h
+++ /dev/null
@@ -1,1328 +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.
- *
- */
-#ifndef BLE_GAP_APP_H__
-#define BLE_GAP_APP_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup ser_codecs Serialization codecs
- * @ingroup ble_sdk_lib_serialization
- */
-
-/**
- * @addtogroup ser_app_s130_codecs Application s130 codecs
- * @ingroup ser_codecs
- */
-
-/**@file
- *
- * @defgroup ble_gap_app GAP Application command request encoders and command response decoders
- * @{
- * @ingroup  ser_app_s130_codecs
- *
- * @brief    GAP Application command request encoders and command response decoders.
- */
-#include "ble.h"
-#include "ble_gap.h"
-
-/**
- * @brief Encodes @ref sd_ble_gap_address_get command request.
- *
- * @sa @ref nrf51_address_get_encoding for packet format,
- *     @ref ble_gap_address_get_rsp_dec for command response decoder.
- *
- * @param[in] p_address      Pointer to address.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_address  will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gap_address_get_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address,
-                                     uint8_t * const              p_buf,
-                                     uint32_t * const             p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_address_get command.
- *
- * @sa @ref nrf51_address_get_encoding for packet format,
- *     @ref ble_gap_address_get_req_enc for command request encoder.
- *
- * @param[in] p_buf           Pointer to beginning of command response packet.
- * @param[in] packet_len      Length (in bytes) of response packet.
- * @param[out] p_address      Pointer to address.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const  p_buf,
-                                     uint32_t               packet_len,
-                                     ble_gap_addr_t * const p_address,
-                                     uint32_t * const       p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_address_set command request.
- *
- * @sa @ref nrf51_gap_address_set_encoding for packet format,
- *     @ref ble_gap_address_set_rsp_dec for command response decoder.
- *
- * @param[in]     addr_cycle_mode      Address cycle mode.
- * @param[in]     p_addr               Pointer to address structure.
- * @param[in,out] p_buf                Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len            \c in: size of \p p_buf buffer.
- *                                     \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS               Encoding success.
- * @retval NRF_ERROR_NULL            Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_address_set_req_enc(uint8_t                      addr_cycle_mode,
-                                     ble_gap_addr_t const * const p_addr,
-                                     uint8_t * const              p_buf,
-                                     uint32_t * const             p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_address_set command.
- *
- * @sa @ref nrf51_gap_address_set_encoding for packet format,
- *     @ref ble_gap_address_set_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf,
-                                     uint32_t              packet_len,
-                                     uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_adv_data_set command request.
- *
- * @sa @ref nrf51_adv_set_encoding for packet format,
- *     @ref ble_gap_adv_data_set_rsp_dec for command response decoder.
- *
- * @param[in] p_data         Raw data to be placed in advertisement packet. If NULL, no changes
- *                           are made to the current advertisement packet data.
- * @param[in] dlen           Data length for p_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets.
- *                           Should be 0 if p_data is NULL, can be 0 if p_data is not NULL.
- * @param[in] p_sr_data      Raw data to be placed in scan response packet. If NULL,
- *                           no changes are made to the current scan response packet data.
- * @param[in] srdlen         Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets.
- *                           Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data,
-                                      uint8_t               dlen,
-                                      uint8_t const * const p_sr_data,
-                                      uint8_t               srdlen,
-                                      uint8_t * const       p_buf,
-                                      uint32_t * const      p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_adv_data_set command.
- *
- * @sa @ref nrf51_adv_set_encoding for packet format,
- *     @ref ble_gap_adv_data_set_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_adv_start command request.
- *
- * @sa @ref nrf51_adv_start_encoding for packet format,
- *     @ref ble_gap_adv_start_rsp_dec for command response decoder.
- *
- * @param[in] p_adv_params   Pointer to advertising parameters structure.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params,
-                                   uint8_t * const                    p_buf,
-                                   uint32_t * const                   p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_adv_start command.
- *
- * @sa @ref nrf51_adv_start_encoding for packet format,
- *     @ref ble_gap_adv_start_req_enc for command request encoder.
- *
- * @param[in]  p_buf          Pointer to beginning of command response packet.
- * @param[in]  packet_len     Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_tx_power_set command request.
- *
- * @sa @ref nrf51_tx_power_set_encoding for packet format,
- *     @ref ble_gap_tx_power_set_rsp_dec for command response decoder.
- *
- * @param[in]     tx_power   Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).
- * @param[in]     p_buf      Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_tx_power_set_req_enc(int8_t           tx_power,
-                                      uint8_t * const  p_buf,
-                                      uint32_t * const p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_tx_power_set command.
- *
- * @sa @ref nrf51_tx_power_set_encoding for packet format,
- *     @ref ble_gap_tx_power_set_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_appearance_get command request.
- *
- * @sa @ref nrf51_appearance_get_encoding for packet format,
- *     @ref ble_gap_appearance_get_rsp_dec for command response decoder.
- *
- * @param[in] p_appearance   Appearance (16-bit), see @ref BLE_APPEARANCES
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_appearance  will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gap_appearance_get_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance,
-                                        uint8_t * const        p_buf,
-                                        uint32_t * const       p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_appearance_get command.
- *
- * @sa @ref nrf51_appearance_get_encoding for packet format,
- *     @ref ble_gap_appearance_get_req_enc for command request encoder.
- *
- * @param[in] p_buf           Pointer to beginning of command response packet.
- * @param[in] packet_len      Length (in bytes) of response packet.
- * @param[out] p_appearance   Appearance (16-bit), see @ref BLE_APPEARANCES.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint16_t * const      p_appearance,
-                                        uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_appearance_set command request.
- *
- * @sa @ref nrf51_appearance_set_encoding for packet format,
- *     @ref ble_gap_appearance_set_rsp_dec for command response decoder.
- *
- * @param[in] appearance   Appearance (16-bit), see @ref BLE_APPEARANCES.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_appearance_set_req_enc(uint16_t         appearance,
-                                        uint8_t * const  p_buf,
-                                        uint32_t * const p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_appearance_set command.
- *
- * @sa @ref nrf51_appearance_set_encoding for packet format,
- *     @ref ble_gap_appearance_set_req_enc for command request encoder.
- *
- * @param[in] p_buf           Pointer to beginning of command response packet.
- * @param[in] packet_len      Length (in bytes) of response packet.
- * @param[out] p_result_code  Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_device_name_get command request.
- *
- * @sa @ref nrf51_device_name_get_encoding for packet format,
- *     @ref ble_gap_device_name_get_rsp_dec for command response decoder.
- *
- * @param[in] p_dev_name     Pointer to an empty buffer where the UTF-8 <b>non NULL-terminated</b>
- *                           string will be placed. Set to NULL to obtain the complete device
- *                           name length.
- * @param[in] p_dev_name_len          Length of the buffer pointed by p_dev_name.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @note  \p p_dev_name and \p  p_len will not be updated by the command
- *        request encoder. Updated values are set by @ref ble_gap_device_name_get_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const  p_dev_name,
-                                         uint16_t const * const p_dev_name_len,
-                                         uint8_t * const        p_buf,
-                                         uint32_t * const       p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_device_name_get command.
- *
- * @sa @ref nrf51_device_name_get_encoding for packet format,
- *     @ref ble_gap_device_name_get_req_enc for command request encoder.
- *
- * @param[in] p_buf              Pointer to beginning of command response packet.
- * @param[in] packet_len         Length (in bytes) of response packet.
- * @param[out] p_dev_name        Pointer to an empty buffer where the UTF-8
- *                               <b>non NULL-terminated</b> string will be placed.
- * @param[in,out] p_dev_name_len  Length of the buffer pointed by p_dev_name, complete device name
- *                               length on output.
- * @param[out] p_result_code     Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         uint8_t * const       p_dev_name,
-                                         uint16_t * const      p_dev_name_len,
-                                         uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_device_name_set command request.
- *
- * @sa @ref nrf51_device_name_set_encoding for packet format,
- *     @ref ble_gap_device_name_set_rsp_dec for command response decoder.
- *
- * @param[in] p_write_perm   Write permissions for the Device Name characteristic see
- *                           @ref ble_gap_conn_sec_mode_t.
- * @param[in] p_dev_name     Pointer to a UTF-8 encoded, <b>non NULL-terminated</b> string.
- * @param[in] len            Length of the UTF-8, <b>non NULL-terminated</b> string pointed
- *                           to by p_dev_name in octets (must be smaller or equal
- *                           than @ref BLE_GAP_DEVNAME_MAX_LEN).
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm,
-                                         uint8_t const * const                 p_dev_name,
-                                         uint16_t                              len,
-                                         uint8_t * const                       p_buf,
-                                         uint32_t * const                      p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_device_name_set command.
- *
- * @sa @ref nrf51_device_name_set_encoding for packet format,
- *     @ref ble_gap_device_name_set_req_enc for command request encoder.
- *
- * @param[in] p_buf              Pointer to beginning of command response packet.
- * @param[in] packet_len         Length (in bytes) of response packet.
- * @param[out] p_result_code     Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf,
-                                         uint32_t              packet_len,
-                                         uint32_t * const      p_result_code);
-
-/**
- * @brief Encodes @ref sd_ble_gap_ppcp_set command request.
- *
- * @sa @ref nrf51_ppcp_set_encoding for packet format,
- *     @ref ble_gap_ppcp_set_rsp_dec for command response decoder.
- *
- * @param[in] p_conn_params  Pointer to a @ref ble_gap_conn_params_t structure with the
- *                           desired parameters.
- * @param[in] p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in,out] p_buf_len  \c in: Size of \p p_buf buffer.
- *                           \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params,
-                                  uint8_t * const                     p_buf,
-                                  uint32_t * const                    p_buf_len);
-
-/**
- * @brief Decodes response to @ref sd_ble_gap_ppcp_set command.
- *
- * @sa @ref nrf51_ppcp_set_encoding for packet format,
- *     @ref ble_gap_ppcp_set_req_enc for command request encoder.
- *
- * @param[in] p_buf              Pointer to beginning of command response packet.
- * @param[in] packet_len         Length (in bytes) of response packet.
- * @param[out] p_result_code     Command result code.
- *
- * @retval NRF_SUCCESS               Decoding success.
- * @retval NRF_ERROR_NULL            Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH  Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA    Decoding failure. Decoded operation code does not match
- *                                   expected operation code.
- */
-uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_conn_param_update command request.
- *
- * @sa @ref nrf51_gap_conn_param_update_encoding for packet format,
- *     @ref ble_gap_conn_param_update_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle     Connection handle of the connection.
- * @param[in]      p_conn_params   Pointer to desired connection parameters..
- * @param[in]      p_buf           Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len       \c in: size of \p p_buf buffer.
- *                                 \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_conn_param_update_req_enc(uint16_t                            conn_handle,
-                                           ble_gap_conn_params_t const * const p_conn_params,
-                                           uint8_t * const                     p_buf,
-                                           uint32_t * const                    p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_conn_param_update command.
- *
- * @sa @ref nrf51_gap_conn_param_update_encoding for packet format,
- *     @ref ble_gap_conn_param_update_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf,
-                                           uint32_t              packet_len,
-                                           uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_disconnect command request.
- *
- * @sa @ref nrf51_disconnect_encoding for packet format,
- *     @ref ble_gap_disconnect_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle       Connection handle of the connection.
- * @param[in]      hci_status_code   HCI status code, see @ref BLE_HCI_STATUS_CODES.
- * @param[in]      p_buf             Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len         \c in: size of \p p_buf buffer.
- *                                   \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_disconnect_req_enc(uint16_t         conn_handle,
-                                    uint8_t          hci_status_code,
-                                    uint8_t * const  p_buf,
-                                    uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_disconnect command.
- *
- * @sa @ref nrf51_disconnect_encoding for packet format,
- *     @ref ble_gap_disconnect_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t * const      p_result_code);
-
-
-/**@brief Encodes @ref sd_ble_gap_rssi_stop command request.
- *
- * @sa @ref nrf51_rssi_stop_encoding for packet format,
- *     @ref ble_gap_rssi_stop_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle       Connection handle of the connection.
- * @param[in]      p_buf             Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len         \c in: size of \p p_buf buffer.
- *                                   \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_rssi_stop_req_enc(uint16_t         conn_handle,
-                                   uint8_t * const  p_buf,
-                                   uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_rssi_stop command.
- *
- * @sa @ref nrf51_rssi_stop_encoding for packet format,
- *     @ref ble_gap_rssi_stop_rsp_dec for command response decoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   uint32_t * const      p_result_code);
-
-
-
-
-/**@brief Encodes @ref sd_ble_gap_ppcp_get command request.
- *
- * @sa @ref nrf51_gap_ppcp_get_encoding for packet format,
- *     @ref ble_gap_ppcp_get_rsp_dec for command response decoder.
- *
- * @param[in]      p_conn_params  Pointer to a @ref ble_gap_conn_params_t structure where the
- *                                parameters will be stored.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @note  \p p_conn_params will not be updated by the command request encoder. Updated values are
- *        set by @ref ble_gap_ppcp_get_rsp_dec.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params,
-                                  uint8_t * const                     p_buf,
-                                  uint32_t * const                    p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_ppcp_get command.
- *
- * @sa @ref nrf51_gap_ppcp_get_encoding for packet format,
- *     @ref ble_gap_ppcp_get_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters
- *                           will be stored.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const         p_buf,
-                                  uint32_t                      packet_len,
-                                  ble_gap_conn_params_t * const p_conn_params,
-                                  uint32_t * const              p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_auth_key_reply command request.
- *
- * @sa @ref nrf51_auth_key_reply_encoding for packet format,
- *     @ref ble_gap_auth_key_reply_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      key_type       Key type which defines length of key data as defined for
- *                                @ref sd_ble_gap_auth_key_reply .
- * @param[in]      p_key          Pointer to a buffer which contains key
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_PARAM    Encoding failure. Incorrect param provided (key_type).
- */
-uint32_t ble_gap_auth_key_reply_req_enc(uint16_t              conn_handle,
-                                        uint8_t               key_type,
-                                        uint8_t const * const p_key,
-                                        uint8_t * const       p_buf,
-                                        uint32_t * const      p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_auth_key_reply command.
- *
- * @sa @ref nrf51_auth_key_reply_encoding for packet format,
- *     @ref ble_gap_auth_key_reply_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_sec_info_reply command request.
- *
- * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format,
- *     @ref ble_gap_sec_info_reply_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_enc_info     Pointer to a @ref ble_gap_enc_info_t encryption information
- *                                structure.
- * @param[in]      p_id_info      Pointer to a @ref ble_gap_irk_t id information
- *                                structure.
- * @param[in]      p_sign_info    Pointer to a @ref ble_gap_sign_info_t signing information
- *                                structure.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_sec_info_reply_req_enc(uint16_t                    conn_handle,
-                                        ble_gap_enc_info_t  const * p_enc_info,
-                                        ble_gap_irk_t       const * p_id_info, 
-                                        ble_gap_sign_info_t const * p_sign_info,
-                                        uint8_t * const             p_buf,
-                                        uint32_t * const            p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_sec_info_reply command.
- *
- * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format,
- *     @ref ble_gap_sec_info_reply_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_sec_params_reply command request.
- *
- * @sa @ref nrf51_sec_params_reply_encoding for packet format,
- *     @ref ble_gap_sec_params_reply_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      sec_status     Security status, see @ref BLE_GAP_SEC_STATUS.
- * @param[in]      p_sec_params   Pointer to @ref ble_gap_sec_params_t security parameters
- *                                structure.
- * @param[in]      p_sec_keyset   Pointer to @ref ble_gap_sec_keyset_t security keys
- *                                structure.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_sec_params_reply_req_enc(uint16_t                           conn_handle,
-                                          uint8_t                            sec_status,
-                                          ble_gap_sec_params_t const * const p_sec_params,
-                                          ble_gap_sec_keyset_t const * const p_sec_keyset,
-                                          uint8_t * const                    p_buf,
-                                          uint32_t * const                   p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_sec_params_reply command.
- *
- * @sa @ref nrf51_sec_params_reply_encoding for packet format,
- *     @ref ble_gap_sec_params_reply_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[in]  p_sec_keyset  Pointer to @ref ble_gap_sec_keyset_t security keys
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const        p_buf,
-                                          uint32_t                     packet_len,
-                                          ble_gap_sec_keyset_t const * const p_sec_keyset,
-                                          uint32_t * const             p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_authenticate command request.
- *
- * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format,
- *     @ref ble_gap_authenticate_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle of the connection.
- * @param[in]      p_sec_params   Pointer to a @ref ble_gap_sec_params_t security parameters
- *                                structure.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_authenticate_req_enc(uint16_t                           conn_handle,
-                                      ble_gap_sec_params_t const * const p_sec_params,
-                                      uint8_t * const                    p_buf,
-                                      uint32_t * const                   p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_authenticate command.
- *
- * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format,
- *     @ref ble_gap_authenticate_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_adv_stop command request.
- *
- * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format,
- *     @ref ble_gap_adv_stop_rsp_dec for command response decoder.
- *
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_adv_stop command.
- *
- * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format,
- *     @ref ble_gap_adv_stop_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_conn_sec_get command request.
- *
- * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format,
- *     @ref ble_gap_conn_sec_get_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle       Connection handle of the connection.
- * @param[in]      p_conn_sec        Pointer to \ref ble_gap_conn_sec_t which will be filled in
- *                                   response.
- * @param[in]      p_buf             Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len         \c in: size of \p p_buf buffer.
- *                                   \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_conn_sec_get_req_enc(uint16_t                         conn_handle,
-                                      ble_gap_conn_sec_t const * const p_conn_sec,
-                                      uint8_t * const                  p_buf,
-                                      uint32_t * const                 p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_conn_sec_get command.
- *
- * @sa @ref nrf51_gap_conn_sec_get_encoding for packet format,
- *     @ref ble_gap_conn_sec_get_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] pp_conn_sec   Pointer to pointer to \ref ble_gap_conn_sec_t which will be filled by
- *                           the decoded data (if present).
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const        p_buf,
-                                      uint32_t                     packet_len,
-                                      ble_gap_conn_sec_t * * const pp_conn_sec,
-                                      uint32_t * const             p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_rssi_start command request.
- *
- * @sa @ref nrf51_rssi_start_encoding for packet format,
- *     @ref ble_gap_rssi_start_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle       Connection handle of the connection.
- * @param[in]      threshold_dbm     Threshold in dBm.
- * @param[in]      skip_count        Sample skip count.
- * @param[in]      p_buf             Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len         \c in: size of \p p_buf buffer.
- *                                   \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_rssi_start_req_enc(uint16_t         conn_handle,
-                                    uint8_t          threshold_dbm,
-                                    uint8_t          skip_count,
-                                    uint8_t * const  p_buf,
-                                    uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_rssi_start command.
- *
- * @sa @ref nrf51_rssi_start_encoding for packet format,
- *     @ref ble_gap_rssi_start_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_scan_stop command request.
- *
- * @sa @ref nrf51_scan_stop_encoding for packet format,
- *     @ref ble_gap_scan_stop_rsp_dec for command response decoder.
- *
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_scan_stop command.
- *
- * @sa @ref nrf51_scan_stop_encoding for packet format,
- *     @ref ble_gap_scan_stop_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf,
-                                   uint32_t              packet_len,
-                                   uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_scan_start command request.
- *
- * @sa @ref nrf51_scan_start_encoding for packet format,
- *     @ref ble_gap_scan_start_rsp_dec for command response decoder.
- *
- * @param[in]      p_scan_params  Pointer to scan params structure.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const *  p_scan_params,
-                                    uint8_t * const                p_buf,
-                                    uint32_t * const               p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_scan_start command.
- *
- * @sa @ref nrf51_scan_start_encoding for packet format,
- *     @ref ble_gap_scan_start_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf,
-                                    uint32_t              packet_len,
-                                    uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_connect command request.
- *
- * @sa @ref nrf51_connect_encoding for packet format,
- *     @ref ble_gap_connect_rsp_dec for command response decoder.
- *
- * @param[in]      p_peer_addr    Pointer to peer address.
- * @param[in]      p_scan_params  Pointer to scan params structure.
- * @param[in]      p_conn_params  Pointer to desired connection parameters.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const        p_peer_addr,
-                                 ble_gap_scan_params_t const * const p_scan_params,
-                                 ble_gap_conn_params_t const * const p_conn_params,
-                                 uint8_t * const                     p_buf,
-                                 uint32_t * const                    p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_connect command.
- *
- * @sa @ref nrf51_connect_encoding for packet format,
- *     @ref ble_gap_connect_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 uint32_t * const      p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_connect_cancel command request.
- *
- * @sa @ref nrf51_connect_cancel_encoding for packet format,
- *     @ref ble_gap_connect_cancel_rsp_dec for command response decoder.
- *
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const  p_buf,
-                                        uint32_t * const p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_connect_cancel command.
- *
- * @sa @ref nrf51_connect_cancel_encoding for packet format,
- *     @ref ble_gap_connect_cancel_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code);
-
-
-/**@brief Encodes @ref sd_ble_gap_encrypt command request.
- *
- * @sa @ref nrf51_gap_encrypt_encoding for packet format,
- *     @ref ble_gap_encrypt_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle.
- * @param[in]      p_master_id    Pointer to a master identification structure.
- * @param[in]      p_enc_info     Pointer to desired connection parameters.
- * @param[in]      p_buf          Pointer to a ble_gap_enc_info_t encryption information structure.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-
-uint32_t ble_gap_encrypt_req_enc( uint16_t                          conn_handle,
-                                  ble_gap_master_id_t const * const p_master_id,
-                                  ble_gap_enc_info_t const  * const p_enc_info,
-                                  uint8_t                   * const p_buf,
-                                  uint32_t                  * const p_buf_len);
-
-
-/**@brief Decodes response to @ref sd_ble_gap_encrypt command.
- *
- * @sa @ref nrf51_gap_encrypt_encoding for packet format,
- *     @ref ble_gap_encrypt_req_enc for command request encoder.
- *
- * @param[in]  p_buf         Pointer to beginning of command response packet.
- * @param[in]  packet_len    Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf,
-                                 uint32_t              packet_len,
-                                 uint32_t      * const p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_rssi_get command request.
- *
- * @sa @ref nrf51_rssi_get_encoding for packet format,
- *     @ref ble_gap_rssi_get_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle.
- * @param[in]      p_rssi         Pointer to the rssi value.
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_rssi_get_req_enc(uint16_t             conn_handle,
-                                  int8_t const * const p_rssi,
-                                  uint8_t  * const     p_buf,
-                                  uint32_t * const     p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_rssi_get command.
- *
- * @sa @ref nrf51_rssi_get_encoding for packet format,
- *     @ref ble_gap_rssi_get_req_enc for command request encoder.
- *
- * @param[in]  p_buf           Pointer to beginning of command response packet.
- * @param[in]  packet_len      Length (in bytes) of response packet.
- * @param[out] p_rssi          Pointer to rssi value.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf,
-                                  uint32_t              packet_len,
-                                  int8_t * const        p_rssi,
-                                  uint32_t      * const p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_keypress_notify command request.
- *
- * @sa @ref nrf51_keypress_notify_encoding for packet format,
- *     @ref ble_gap_keypress_notify_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle.
- * @param[in]      kp_not         See @ref sd_ble_gap_keypress_notify
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_keypress_notify_req_enc(uint16_t                           conn_handle,
-                                          uint8_t                           kp_not,
-                                          uint8_t * const                   p_buf,
-                                          uint32_t * const                  p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_keypress_notify command.
- *
- * @sa @ref nrf51_keypress_notify_encoding for packet format,
- *     @ref ble_gap_keypress_notify_req_enc for command request encoder.
- *
- * @param[in]  p_buf           Pointer to beginning of command response packet.
- * @param[in]  packet_len      Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_keypress_notify_rsp_dec(uint8_t const * const              p_buf,
-                                        uint32_t                           packet_len,
-                                        uint32_t * const                   p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_lesc_dhkey_reply command request.
- *
- * @sa @ref nrf51_lesc_dhkey_reply_encoding for packet format,
- *     @ref ble_gap_lesc_dhkey_reply_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle.
- * @param[in]      p_dhkey        See @ref sd_ble_gap_lesc_dhkey_reply
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_lesc_dhkey_reply_req_enc(uint16_t             conn_handle,
-                                          ble_gap_lesc_dhkey_t const *p_dhkey,
-                                          uint8_t * const      p_buf,
-                                          uint32_t * const     p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_lesc_dhkey_reply command.
- *
- * @sa @ref nrf51_lesc_dhkey_reply_encoding for packet format,
- *     @ref ble_gap_lesc_dhkey_reply_req_enc for command request encoder.
- *
- * @param[in]  p_buf           Pointer to beginning of command response packet.
- * @param[in]  packet_len      Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_lesc_dhkey_reply_rsp_dec(uint8_t const * const              p_buf,
-                                        uint32_t                           packet_len,
-                                        uint32_t * const                   p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_lesc_oob_data_set command request.
- *
- * @sa @ref nrf51_lesc_oob_data_set_encoding for packet format,
- *     @ref ble_gap_lesc_oob_data_set_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle.
- * @param[in]      p_oobd_own     See @ref sd_ble_gap_lesc_oob_data_set
- * @param[in]      p_oobd_peer    See @ref sd_ble_gap_lesc_oob_data_set
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_lesc_oob_data_set_req_enc(uint16_t             conn_handle,
-                                           ble_gap_lesc_oob_data_t const *p_oobd_own,
-                                           ble_gap_lesc_oob_data_t const *p_oobd_peer,
-                                           uint8_t * const      p_buf,
-                                           uint32_t * const     p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_lesc_oob_data_set command.
- *
- * @sa @ref nrf51_lesc_oob_data_set_encoding for packet format,
- *     @ref ble_gap_lesc_oob_data_set_req_enc for command request encoder.
- *
- * @param[in]  p_buf           Pointer to beginning of command response packet.
- * @param[in]  packet_len      Length (in bytes) of response packet.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_lesc_oob_data_set_rsp_dec(uint8_t const * const              p_buf,
-                                           uint32_t                           packet_len,
-                                           uint32_t * const                   p_result_code);
-
-/**@brief Encodes @ref sd_ble_gap_lesc_oob_data_get command request.
- *
- * @sa @ref nrf51_lesc_oob_data_get_encoding for packet format,
- *     @ref ble_gap_lesc_oob_data_get_rsp_dec for command response decoder.
- *
- * @param[in]      conn_handle    Connection handle.
- * @param[in]      p_pk_own       See @ref sd_ble_gap_lesc_oob_data_get
- * @param[in]      p_oobd_own     See @ref sd_ble_gap_lesc_oob_data_get
- * @param[in]      p_buf          Pointer to buffer where encoded data command will be returned.
- * @param[in, out] p_buf_len      \c in: size of \p p_buf buffer.
- *                                \c out: Length of encoded command packet.
- *
- * @retval NRF_SUCCESS                Encoding success.
- * @retval NRF_ERROR_NULL             Encoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_INVALID_LENGTH   Encoding failure. Incorrect buffer length.
- */
-uint32_t ble_gap_lesc_oob_data_get_req_enc(uint16_t                      conn_handle,
-                                           ble_gap_lesc_p256_pk_t const *p_pk_own,
-                                           ble_gap_lesc_oob_data_t      *p_oobd_own,
-                                           uint8_t * const               p_buf,
-                                           uint32_t * const              p_buf_len);
-
-/**@brief Decodes response to @ref sd_ble_gap_lesc_oob_data_get command.
- *
- * @sa @ref nrf51_lesc_oob_data_get_encoding for packet format,
- *     @ref ble_gap_lesc_oob_data_get_req_enc for command request encoder.
- *
- * @param[in]  p_buf           Pointer to beginning of command response packet.
- * @param[in]  packet_len      Length (in bytes) of response packet.
- * @param[out] pp_oobd_own     Pointer to pointer to location where OOB data is decoded.
- * @param[out] p_result_code   Command response result code.
- *
- * @retval NRF_SUCCESS              Decoding success.
- * @retval NRF_ERROR_NULL           Decoding failure. NULL pointer supplied.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_INVALID_DATA   Decoding failure. Decoded operation code does not match expected
- *                                  operation code.
- */
-uint32_t ble_gap_lesc_oob_data_get_rsp_dec(uint8_t const * const       p_buf,
-                                           uint32_t                    packet_len,
-                                           ble_gap_lesc_oob_data_t  * *pp_oobd_own,
-                                           uint32_t * const            p_result_code);
-/** @} */
-#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/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c
deleted file mode 100644
index 6756d33..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_get.c
+++ /dev/null
@@ -1,70 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance,
-                                        uint8_t * const        p_buf,
-                                        uint32_t * const       p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_APPEARANCE_GET;
-    p_buf[index++] = (p_appearance == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint16_t * const      p_appearance,
-                                        uint32_t * const      p_result_code)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_result_code);
-
-    uint32_t index         = 0;
-    uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
-                                                             SD_BLE_GAP_APPEARANCE_GET,
-                                                             p_result_code);
-
-    if (decode_result != NRF_SUCCESS)
-    {
-        return decode_result;
-    }
-
-    if (*p_result_code != NRF_SUCCESS)
-    {
-        SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-        return NRF_SUCCESS;
-    }
-
-    SER_ASSERT_LENGTH_LEQ(index + sizeof (uint16_t), packet_len);
-
-    uint16_dec(p_buf, packet_len, &index, p_appearance);
-
-    SER_ASSERT_LENGTH_EQ(index, packet_len);
-
-    return NRF_SUCCESS;
-}

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/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c
deleted file mode 100644
index 061ea01..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_appearance_set.c
+++ /dev/null
@@ -1,44 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_appearance_set_req_enc(uint16_t         appearance,
-                                        uint8_t * const  p_buf,
-                                        uint32_t * const p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 2, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_APPEARANCE_SET;
-    index         += uint16_encode(appearance, &p_buf[index]);
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_APPEARANCE_SET, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c
deleted file mode 100644
index 6d43d45..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_auth_key_reply.c
+++ /dev/null
@@ -1,76 +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.
- *
- */
-
-#include "ble_gap_app.h"
-#include <string.h>
-#include "ble_serialization.h"
-#include "ble_gap.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_auth_key_reply_req_enc(uint16_t              conn_handle,
-                                        uint8_t               key_type,
-                                        uint8_t const * const p_key,
-                                        uint8_t * const       p_buf,
-                                        uint32_t * const      p_buf_len)
-{
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    uint32_t index    = 0;
-    uint32_t buf_len  = *p_buf_len;
-    uint8_t  opcode   = SD_BLE_GAP_AUTH_KEY_REPLY;
-    uint32_t err_code = NRF_SUCCESS;
-    uint8_t  key_len;
-
-    err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = uint8_t_enc(&key_type, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    switch (key_type)
-    {
-        case BLE_GAP_AUTH_KEY_TYPE_NONE:
-            key_len = 0;
-            break;
-
-        case BLE_GAP_AUTH_KEY_TYPE_PASSKEY:
-            key_len = 6;
-            break;
-
-        case BLE_GAP_AUTH_KEY_TYPE_OOB:
-            key_len = 16;
-            break;
-
-        default:
-            return NRF_ERROR_INVALID_PARAM;
-    }
-
-    err_code = buf_enc(p_key, key_len, p_buf, buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf,
-                                        uint32_t              packet_len,
-                                        uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTH_KEY_REPLY, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c
deleted file mode 100644
index f6e5084..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_authenticate.c
+++ /dev/null
@@ -1,52 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "ble_gap_struct_serialization.h"
-#include "cond_field_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_authenticate_req_enc(uint16_t                           conn_handle,
-                                      ble_gap_sec_params_t const * const p_sec_params,
-                                      uint8_t * const                    p_buf,
-                                      uint32_t * const                   p_buf_len)
-{
-    uint32_t index = 0;
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_AUTHENTICATE;
-
-    err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    err_code = cond_field_enc(p_sec_params, p_buf, *p_buf_len, &index, ble_gap_sec_params_t_enc);
-    SER_ASSERT(err_code == NRF_SUCCESS, err_code);
-
-    *p_buf_len = index;
-
-    return err_code;
-}
-
-
-uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf,
-                                      uint32_t              packet_len,
-                                      uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_AUTHENTICATE, p_result_code);
-}

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/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c
deleted file mode 100644
index feb58d0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_param_update.c
+++ /dev/null
@@ -1,55 +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 "ble_gap_app.h"
-#include "ble_serialization.h"
-#include "app_util.h"
-
-
-uint32_t ble_gap_conn_param_update_req_enc(uint16_t                            conn_handle,
-                                           ble_gap_conn_params_t const * const p_conn_params,
-                                           uint8_t * const                     p_buf,
-                                           uint32_t * const                    p_buf_len)
-{
-    uint32_t index = 0;
-
-    SER_ASSERT_NOT_NULL(p_buf);
-    SER_ASSERT_NOT_NULL(p_buf_len);
-
-    SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len);
-
-    p_buf[index++] = SD_BLE_GAP_CONN_PARAM_UPDATE;
-    index         += uint16_encode(conn_handle, &p_buf[index]);
-
-    p_buf[index++] = (p_conn_params != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
-
-    if (p_conn_params != NULL)
-    {
-        SER_ASSERT_LENGTH_LEQ(index + 1 + 2 * 4, *p_buf_len);
-        index += uint16_encode(p_conn_params->min_conn_interval, &p_buf[index]);
-        index += uint16_encode(p_conn_params->max_conn_interval, &p_buf[index]);
-        index += uint16_encode(p_conn_params->slave_latency, &p_buf[index]);
-        index += uint16_encode(p_conn_params->conn_sup_timeout, &p_buf[index]);
-    }
-
-    *p_buf_len = index;
-
-    return NRF_SUCCESS;
-}
-
-
-uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf,
-                                           uint32_t              packet_len,
-                                           uint32_t * const      p_result_code)
-{
-    return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONN_PARAM_UPDATE, p_result_code);
-}


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

Posted by cc...@apache.org.
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/saadc/nrf_drv_saadc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/saadc/nrf_drv_saadc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/saadc/nrf_drv_saadc.c
deleted file mode 100644
index 89a04de..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/saadc/nrf_drv_saadc.c
+++ /dev/null
@@ -1,509 +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_saadc.h"
-#include "nrf_assert.h"
-#include "nordic_common.h"
-#include "nrf_drv_common.h"
-#include "app_util_platform.h"
-
-
-typedef enum
-{
-    NRF_SAADC_STATE_IDLE = 0,
-    NRF_SAADC_STATE_BUSY = 1
-} nrf_saadc_state_t;
-
-
-typedef struct
-{
-    nrf_saadc_input_t pselp;
-    nrf_saadc_input_t pseln;
-} nrf_saadc_psel_buffer;
-
-static const nrf_drv_saadc_config_t m_default_config = NRF_DRV_SAADC_DEFAULT_CONFIG;
-
-/** @brief SAADC control block.*/
-typedef struct
-{
-    nrf_drv_saadc_event_handler_t event_handler;                 ///< Event handler function pointer.
-    volatile nrf_saadc_value_t *  p_buffer;                        ///< Sample buffer.
-    volatile uint16_t             buffer_size;                   ///< Size of the sample buffer.
-#ifdef NRF52_PAN_28
-    volatile uint16_t             buffer_pos;                    ///< Current sample buffer position.
-#endif
-    volatile nrf_saadc_value_t *  p_secondary_buffer;            ///< Secondary sample buffer.
-    uint32_t                      limits_enabled_flags;          ///< Enabled limits flags.
-    uint16_t                      secondary_buffer_size;         ///< Size of the secondary buffer.
-    nrf_saadc_psel_buffer         psel[NRF_SAADC_CHANNEL_COUNT]; ///< Pin configurations of SAADC channels.
-    nrf_drv_state_t               state;                         ///< Driver initialization state.
-    nrf_saadc_state_t             adc_state;                     ///< State of the SAADC.
-#ifdef NRF52_PAN_28
-    uint8_t                       scan_pos;                      ///< Current channel scanning position.
-#endif
-    uint8_t                       active_channels;               ///< Number of enabled SAADC channels.
-} nrf_drv_saadc_cb_t;
-
-static nrf_drv_saadc_cb_t m_cb;
-
-#define LOW_LIMIT_TO_FLAG(channel)  ((2*channel+1))
-#define HIGH_LIMIT_TO_FLAG(channel) ((2*channel))
-#define FLAG_IDX_TO_EVENT(idx) ((nrf_saadc_event_t)((uint32_t)NRF_SAADC_EVENT_CH0_LIMITH+4*idx))
-#define LIMIT_EVENT_TO_CHANNEL(event)(uint8_t)(((uint32_t)event-(uint32_t)NRF_SAADC_EVENT_CH0_LIMITH)/8)
-#define LIMIT_EVENT_TO_LIMIT_TYPE(event)((((uint32_t)event-(uint32_t)NRF_SAADC_EVENT_CH0_LIMITH) & 4) ? \
-                                                          NRF_SAADC_LIMIT_LOW : NRF_SAADC_LIMIT_HIGH)
-#define HW_TIMEOUT 10000
-
-
-void SAADC_IRQHandler(void)
-{
-    if (nrf_saadc_event_check(NRF_SAADC_EVENT_END))
-    {
-        nrf_saadc_event_clear(NRF_SAADC_EVENT_END);
-#ifdef NRF52_PAN_28
-        if (m_cb.active_channels == 1)
-        {
-#endif
-            nrf_drv_saadc_evt_t evt;
-            evt.type = NRF_DRV_SAADC_EVT_DONE;
-            evt.data.done.p_buffer = (nrf_saadc_value_t *)m_cb.p_buffer;
-            evt.data.done.size = nrf_saadc_amount_get();
-
-            if (m_cb.p_secondary_buffer == NULL)
-            {
-                m_cb.adc_state = NRF_SAADC_STATE_IDLE;
-            }
-            else
-            {
-                m_cb.p_buffer = m_cb.p_secondary_buffer;
-                m_cb.buffer_size = m_cb.secondary_buffer_size;
-                m_cb.p_secondary_buffer = NULL;
-                nrf_saadc_task_trigger(NRF_SAADC_TASK_START);
-            }
-
-            m_cb.event_handler(&evt);
-#ifdef NRF52_PAN_28
-        }
-        else
-        {
-            //PAN-28: scan mode is not working correctly, emulated by interrupts
-            ++(m_cb.buffer_pos);
-            uint16_t buffer_pos = m_cb.buffer_pos;
-            if (buffer_pos == m_cb.buffer_size)
-            {
-                nrf_drv_saadc_evt_t evt;
-                evt.type = NRF_DRV_SAADC_EVT_DONE;
-                evt.data.done.p_buffer = (nrf_saadc_value_t *)(m_cb.p_buffer);
-                evt.data.done.size = m_cb.buffer_size;
-
-                m_cb.adc_state = NRF_SAADC_STATE_IDLE;
-                if (m_cb.p_secondary_buffer == NULL)
-                {
-                    m_cb.adc_state = NRF_SAADC_STATE_IDLE;
-                }
-                else
-                {
-                    (void)nrf_drv_saadc_buffer_convert((nrf_saadc_value_t *)m_cb.p_secondary_buffer, (uint16_t)m_cb.secondary_buffer_size);
-                }
-                m_cb.event_handler(&evt);
-            }
-            else
-            {
-                uint8_t current_scan_pos = m_cb.scan_pos;
-
-                nrf_saadc_channel_input_set(current_scan_pos,
-                                            NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED);
-
-                nrf_saadc_buffer_init((nrf_saadc_value_t *)(m_cb.p_buffer + m_cb.buffer_pos), 1);
-                // Find the next enabled channel.
-                for (++m_cb.scan_pos; m_cb.scan_pos < NRF_SAADC_CHANNEL_COUNT; ++m_cb.scan_pos)
-                {
-                    if (m_cb.psel[m_cb.scan_pos].pselp)
-                    {
-                        nrf_saadc_channel_input_set(m_cb.scan_pos,
-                                    m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln);
-                        nrf_saadc_task_trigger(NRF_SAADC_TASK_START);
-                        nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE);
-                        return;
-                    }
-                }
-                //if scanning is done prepare for next round.
-                for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i)
-                {
-                    if (m_cb.psel[i].pselp)
-                    {
-                        m_cb.scan_pos = i;
-                        break;
-                    }
-                }
-                nrf_saadc_channel_input_set(m_cb.scan_pos,
-                                    m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln);
-                nrf_saadc_task_trigger(NRF_SAADC_TASK_START);
-            }
-        }
-#endif
-    }
-    if (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED))
-    {
-        nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED);
-        m_cb.adc_state = NRF_SAADC_STATE_IDLE;
-    }
-    else
-    {
-        uint32_t limit_flags = m_cb.limits_enabled_flags;
-        uint32_t flag_idx;
-        nrf_saadc_event_t event;
-        while (limit_flags)
-        {
-            flag_idx = __CLZ(limit_flags);
-            limit_flags &= ~((1UL<<31) >> flag_idx);
-            event = FLAG_IDX_TO_EVENT(flag_idx);
-            if (nrf_saadc_event_check(event))
-            {
-                nrf_saadc_event_clear(event);
-                nrf_drv_saadc_evt_t evt;
-                evt.type = NRF_DRV_SAADC_EVT_LIMIT;
-                evt.data.limit.channel = LIMIT_EVENT_TO_CHANNEL(event);
-                evt.data.limit.limit_type = LIMIT_EVENT_TO_LIMIT_TYPE(event);
-                m_cb.event_handler(&evt);
-            }
-        }
-    }
-}
-
-
-ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config,
-                              nrf_drv_saadc_event_handler_t event_handler)
-{
-    if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-    if (event_handler == NULL)
-    {
-        return NRF_ERROR_INVALID_PARAM;
-    }
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config;
-    }
-
-    m_cb.event_handler = event_handler;
-    nrf_saadc_resolution_set(p_config->resolution);
-    nrf_saadc_oversample_set(p_config->oversample);
-    m_cb.state = NRF_DRV_STATE_INITIALIZED;
-    m_cb.adc_state = NRF_SAADC_STATE_IDLE;
-    m_cb.active_channels = 0;
-    m_cb.limits_enabled_flags = 0;
-#ifdef NRF52_PAN_28
-    m_cb.buffer_pos = 0;
-#endif
-
-    nrf_saadc_int_disable(NRF_SAADC_INT_ALL);
-    nrf_saadc_event_clear(NRF_SAADC_EVENT_END);
-    nrf_drv_common_irq_enable(SAADC_IRQn, p_config->interrupt_priority);
-    nrf_saadc_int_enable(NRF_SAADC_INT_END);
-
-    nrf_saadc_enable();
-
-    return NRF_SUCCESS;
-}
-
-
-void nrf_drv_saadc_uninit(void)
-{
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-    nrf_drv_common_irq_disable(SAADC_IRQn);
-    nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP);
-
-    // Wait for ADC being stopped.
-    uint32_t timeout = HW_TIMEOUT;
-    while (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED) == 0 && timeout > 0)
-    {
-        --timeout;
-    }
-    ASSERT(timeout > 0);
-    
-    nrf_saadc_disable();
-    nrf_saadc_int_disable(NRF_SAADC_INT_ALL);
-
-    m_cb.adc_state = NRF_SAADC_STATE_IDLE;
-
-    for (uint8_t channel = 0; channel < NRF_SAADC_CHANNEL_COUNT; ++channel)
-    {
-        if (m_cb.psel[channel].pselp != NRF_SAADC_INPUT_DISABLED)
-        {
-            (void)nrf_drv_saadc_channel_uninit(channel);
-        }
-    }
-
-    m_cb.state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-
-ret_code_t nrf_drv_saadc_channel_init(uint8_t channel,
-                                      nrf_saadc_channel_config_t const * const p_config)
-{
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(channel < NRF_SAADC_CHANNEL_COUNT);
-    //Oversampling can be used only with one channel.
-    ASSERT((nrf_saadc_oversample_get()==NRF_SAADC_OVERSAMPLE_DISABLED) || (m_cb.active_channels == 0));
-    ASSERT((p_config->pin_p <= NRF_SAADC_INPUT_VDD) && (p_config->pin_p > NRF_SAADC_INPUT_DISABLED));
-    ASSERT(p_config->pin_n <= NRF_SAADC_INPUT_VDD);
-
-    // A channel can only be initialized if the driver is in the idle state.
-    if (m_cb.adc_state == NRF_SAADC_STATE_BUSY)
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    if (!m_cb.psel[channel].pselp)
-    {
-        ++m_cb.active_channels;
-    }
-    m_cb.psel[channel].pselp = p_config->pin_p;
-    m_cb.psel[channel].pseln = p_config->pin_n;
-    nrf_saadc_channel_init(channel, p_config);
-
-#ifdef NRF52_PAN_28
-    nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED);
-#else
-    nrf_saadc_channel_input_set(channel, p_config->pin_p, p_config->pin_n);
-#endif
-    return NRF_SUCCESS;
-}
-
-
-ret_code_t nrf_drv_saadc_channel_uninit(uint8_t channel)
-{
-    ASSERT(channel <= NRF_SAADC_CHANNEL_COUNT)
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-
-    // A channel can only be uninitialized if the driver is in the idle state.
-    if (m_cb.adc_state == NRF_SAADC_STATE_BUSY)
-    {
-        return NRF_ERROR_BUSY;
-    }
-
-    if (m_cb.psel[channel].pselp)
-    {
-        --m_cb.active_channels;
-    }
-    m_cb.psel[channel].pselp = NRF_SAADC_INPUT_DISABLED;
-    m_cb.psel[channel].pseln = NRF_SAADC_INPUT_DISABLED;
-    nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED);
-    nrf_drv_saadc_limits_set(channel, NRF_DRV_SAADC_LIMITL_DISABLED, NRF_DRV_SAADC_LIMITH_DISABLED);
-
-    return NRF_SUCCESS;
-}
-
-ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_value)
-{
-    if (m_cb.adc_state != NRF_SAADC_STATE_IDLE)
-    {
-        return NRF_ERROR_BUSY;
-    }
-    m_cb.adc_state = NRF_SAADC_STATE_BUSY;
-    nrf_saadc_int_disable(NRF_SAADC_INT_END);
-    nrf_saadc_buffer_init(p_value, 1);
-#ifndef NRF52_PAN_28
-    if (m_cb.active_channels > 1)
-    {
-        for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i)
-        {
-            nrf_saadc_channel_input_set(i, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED);
-        }
-    }
-#endif
-    nrf_saadc_channel_input_set(channel,
-                            m_cb.psel[channel].pselp, m_cb.psel[channel].pseln);
-    nrf_saadc_task_trigger(NRF_SAADC_TASK_START);
-    nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE);
-
-    uint32_t timeout = HW_TIMEOUT;
-    while (0 == nrf_saadc_event_check(NRF_SAADC_EVENT_END) && timeout > 0)
-    {
-        timeout--;
-    }
-    nrf_saadc_event_clear(NRF_SAADC_EVENT_END);
-
-#ifdef NRF52_PAN_28
-    nrf_saadc_channel_input_set(channel, NRF_SAADC_INPUT_DISABLED, NRF_SAADC_INPUT_DISABLED);
-#else
-    if (m_cb.active_channels > 1)
-    {
-        for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i)
-        {
-            nrf_saadc_channel_input_set(i, m_cb.psel[i].pselp, m_cb.psel[i].pseln);
-        }
-    }
-#endif
-
-    nrf_saadc_int_enable(NRF_SAADC_INT_END);
-    m_cb.adc_state = NRF_SAADC_STATE_IDLE;
-
-    return NRF_SUCCESS;
-}
-
-ret_code_t nrf_drv_saadc_buffer_convert(nrf_saadc_value_t * p_buffer, uint16_t size)
-{
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-
-    nrf_saadc_int_disable(NRF_SAADC_INT_END);
-    if (m_cb.adc_state == NRF_SAADC_STATE_BUSY)
-    {
-        if ( m_cb.p_secondary_buffer)
-        {
-            nrf_saadc_int_enable(NRF_SAADC_INT_END);
-            return NRF_ERROR_BUSY;
-        }
-        else
-        {
-            m_cb.p_secondary_buffer = p_buffer;
-            m_cb.secondary_buffer_size = size;
-#ifdef NRF52_PAN_28
-            if (m_cb.active_channels == 1)
-#endif
-            {
-                while (nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED) == 0);
-                nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED);
-                nrf_saadc_buffer_init(p_buffer, size);
-            }
-            nrf_saadc_int_enable(NRF_SAADC_INT_END);
-            return NRF_SUCCESS;
-        }
-    }
-    nrf_saadc_int_enable(NRF_SAADC_INT_END);
-    m_cb.adc_state = NRF_SAADC_STATE_BUSY;
-
-#ifdef NRF52_PAN_28
-    m_cb.scan_pos = NRF_SAADC_CHANNEL_COUNT;
-    for (uint8_t i = 0; i < NRF_SAADC_CHANNEL_COUNT; ++i)
-    {
-        if (m_cb.psel[i].pselp)
-        {
-            m_cb.scan_pos = i;
-            break;
-        }
-    }
-
-    // Find the first enabled channel.
-    if (m_cb.scan_pos >= NRF_SAADC_CHANNEL_COUNT)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    m_cb.buffer_pos = 0;
-#endif
-    m_cb.p_buffer = p_buffer;
-    m_cb.buffer_size = size;
-    m_cb.p_secondary_buffer = NULL;
-
-#ifdef NRF52_PAN_28
-    nrf_saadc_channel_input_set(m_cb.scan_pos,
-                                m_cb.psel[m_cb.scan_pos].pselp, m_cb.psel[m_cb.scan_pos].pseln);
-
-    if (m_cb.active_channels == 1)
-    {
-        nrf_saadc_buffer_init(p_buffer, size);
-    }
-    else
-    {
-        nrf_saadc_buffer_init(p_buffer, 1);
-    }
-#else
-    nrf_saadc_buffer_init(p_buffer, size);
-#endif
-
-    nrf_saadc_event_clear(NRF_SAADC_EVENT_STARTED);
-    nrf_saadc_task_trigger(NRF_SAADC_TASK_START);
-
-    return NRF_SUCCESS;
-}
-
-ret_code_t nrf_drv_saadc_sample()
-{
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-
-    ret_code_t err_code = NRF_SUCCESS;
-    if (m_cb.adc_state == NRF_SAADC_STATE_IDLE)
-    {
-        err_code = NRF_ERROR_BUSY;
-    }
-    else
-    {
-        nrf_saadc_task_trigger(NRF_SAADC_TASK_SAMPLE);
-    }
-    
-    return err_code;
-}
-
-
-bool nrf_drv_saadc_is_busy(void)
-{
-    return (m_cb.adc_state == NRF_SAADC_STATE_BUSY);
-}
-
-void nrf_drv_saadc_abort(void)
-{
-    if (nrf_drv_saadc_is_busy())
-    {
-        nrf_saadc_event_clear(NRF_SAADC_EVENT_STOPPED);
-        nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP);
-        
-        // Wait for ADC being stopped.
-        uint32_t timeout = HW_TIMEOUT;
-        while ((m_cb.adc_state != NRF_SAADC_STATE_IDLE) && (timeout > 0))
-        {
-            --timeout;
-        }
-        ASSERT(timeout > 0);
-        
-        m_cb.p_buffer = 0;
-        m_cb.p_secondary_buffer = 0;
-    }
-}
-
-void nrf_drv_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_high)
-{
-    ASSERT(m_cb.state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(m_cb.event_handler); // only non blocking mode supported
-    ASSERT(limit_low>=NRF_DRV_SAADC_LIMITL_DISABLED);
-    ASSERT(limit_high<=NRF_DRV_SAADC_LIMITH_DISABLED);
-    ASSERT(limit_low<limit_high);
-    nrf_saadc_channel_limits_set(channel, limit_low, limit_high);
-
-    uint32_t int_mask = nrf_saadc_limit_int_get(channel, NRF_SAADC_LIMIT_LOW);
-    if (limit_low == NRF_DRV_SAADC_LIMITL_DISABLED)
-    {
-        m_cb.limits_enabled_flags &= ~(0x80000000 >> LOW_LIMIT_TO_FLAG(channel));
-        nrf_saadc_int_disable(int_mask);
-    }
-    else
-    {
-        m_cb.limits_enabled_flags |= (0x80000000 >> LOW_LIMIT_TO_FLAG(channel));
-        nrf_saadc_int_enable(int_mask);
-    }
-
-    int_mask = nrf_saadc_limit_int_get(channel, NRF_SAADC_LIMIT_HIGH);
-    if (limit_high == NRF_DRV_SAADC_LIMITH_DISABLED)
-    {
-        m_cb.limits_enabled_flags &= ~(0x80000000 >> HIGH_LIMIT_TO_FLAG(channel));
-        nrf_saadc_int_disable(int_mask);
-    }
-    else
-    {
-        m_cb.limits_enabled_flags |= (0x80000000 >> HIGH_LIMIT_TO_FLAG(channel));
-        nrf_saadc_int_enable(int_mask);
-    }
-}

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/saadc/nrf_drv_saadc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/saadc/nrf_drv_saadc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/saadc/nrf_drv_saadc.h
deleted file mode 100644
index 35fdc01..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/saadc/nrf_drv_saadc.h
+++ /dev/null
@@ -1,311 +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.
- *
- */
-
-/**
- * @addtogroup nrf_saadc SAADC HAL and driver
- * @ingroup    nrf_drivers
- * @brief      @tagAPI52 Successive Approximation Analog-to-Digital Converter (SAADC) APIs.
- * @details The SAADC HAL provides basic APIs for accessing the registers of the SAADC peripheral. 
- * The SAADC driver provides APIs on a higher level.
- *
- * @defgroup nrf_drv_saadc SAADC driver
- * @{
- * @ingroup  nrf_saadc
- *
- * @brief    @tagAPI52 Successive Approximation Analog-to-Digital Converter (SAADC) driver.
- */
-
-#ifndef NRF_DRV_SAADC_H__
-#define NRF_DRV_SAADC_H__
-
-#include "nrf_drv_config.h"
-#include "nrf_saadc.h"
-#include "sdk_errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Value that should be set as high limit to disable limit detection.
- */
-#define NRF_DRV_SAADC_LIMITH_DISABLED (2047)
-/**
- * @brief Value that should be set as low limit to disable limit detection.
- */
-#define NRF_DRV_SAADC_LIMITL_DISABLED (-2048)
-
-/**
- * @brief Macro for setting @ref nrf_drv_saadc_config_t to default settings.
- */
-#define NRF_DRV_SAADC_DEFAULT_CONFIG                \
-{                                                   \
-    .resolution         = SAADC_CONFIG_RESOLUTION,  \
-    .oversample         = SAADC_CONFIG_OVERSAMPLE,  \
-    .interrupt_priority = SAADC_CONFIG_IRQ_PRIORITY \
-}
-
-/**
- * @brief Macro for setting @ref nrf_saadc_channel_config_t to default settings
- *        in single ended mode.
- *
- * @param PIN_P Analog input.
- */
-#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P) \
-{                                                      \
-    .resistor_p = NRF_SAADC_RESISTOR_DISABLED,         \
-    .resistor_n = NRF_SAADC_RESISTOR_DISABLED,         \
-    .gain       = NRF_SAADC_GAIN1_6,                   \
-    .reference  = NRF_SAADC_REFERENCE_INTERNAL,        \
-    .acq_time   = NRF_SAADC_ACQTIME_10US,              \
-    .mode       = NRF_SAADC_MODE_SINGLE_ENDED,         \
-    .pin_p      = (nrf_saadc_input_t)(PIN_P),          \
-    .pin_n      = NRF_SAADC_INPUT_DISABLED             \
-}
-
-/**
- * @brief Macro for setting @ref nrf_saadc_channel_config_t to default settings
- *        in differential mode.
- *
- * @param PIN_P Positive analog input.
- * @param PIN_N Negative analog input.
- */
-#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(PIN_P, PIN_N) \
-{                                                                       \
-    .resistor_p = NRF_SAADC_RESISTOR_DISABLED,                          \
-    .resistor_n = NRF_SAADC_RESISTOR_DISABLED,                          \
-    .gain       = NRF_SAADC_GAIN1_6,                                    \
-    .reference  = NRF_SAADC_REFERENCE_INTERNAL,                         \
-    .acq_time   = NRF_SAADC_ACQTIME_10US,                               \
-    .mode       = NRF_SAADC_MODE_DIFFERENTIAL,                          \
-    .pin_p      = (nrf_saadc_input_t)(PIN_P),                           \
-    .pin_n      = (nrf_saadc_input_t)(PIN_N)                            \
-}
-
-/**
- * @brief Analog-to-digital converter driver configuration structure.
- */
-typedef struct
-{
-    nrf_saadc_resolution_t resolution;         ///< Resolution configuration.
-    nrf_saadc_oversample_t oversample;         ///< Oversampling configuration.
-    uint8_t                interrupt_priority; ///< Interrupt priority.
-} nrf_drv_saadc_config_t;
-
-/**
- * @brief Driver event types.
- */
-typedef enum
-{
-    NRF_DRV_SAADC_EVT_DONE,    ///< Event generated when the buffer is filled with samples.
-    NRF_DRV_SAADC_EVT_LIMIT,   ///< Event generated after one of the limits is reached.
-} nrf_drv_saadc_evt_type_t;
-
-/**
- * @brief Analog-to-digital converter driver done event data.
- */
-typedef struct
-{
-    nrf_saadc_value_t *      p_buffer; ///< Pointer to buffer with converted samples.
-    uint16_t                 size;     ///< Number of samples in the buffer.
-} nrf_drv_saadc_done_evt_t;
-
-/**
- * @brief Analog-to-digital converter driver limit event data.
- */
-typedef struct
-{
-    uint8_t                  channel;    ///< Channel on which the limit was detected.
-    nrf_saadc_limit_t        limit_type; ///< Type of limit detected.
-} nrf_drv_saadc_limit_evt_t;
-
-/**
- * @brief Analog-to-digital converter driver event structure.
- */
-typedef struct
-{
-    nrf_drv_saadc_evt_type_t type;      ///< Event type.
-    union
-    {
-        nrf_drv_saadc_done_evt_t  done; ///< Data for @ref NRF_DRV_SAADC_EVT_DONE event.
-        nrf_drv_saadc_limit_evt_t limit;///< Data for @ref NRF_DRV_SAADC_EVT_LIMIT event.
-    } data;
-} nrf_drv_saadc_evt_t;
-
-/**
- * @brief ADC event handler.
- *
- * @param[in] p_event     Pointer to an ADC event. The event structure is allocated on
- *                        the stack, so it is valid only within the context of
- *                        the event handler.
- */
-typedef void (*nrf_drv_saadc_event_handler_t)(nrf_drv_saadc_evt_t const * p_event);
-
-/**
- * @brief Function for initializing the SAADC.
- *
- * @param[in] p_config      Pointer to a configuration structure. If NULL, the default one is used.
- * @param[in] event_handler Event handler provided by the user.
- *
- * @retval    NRF_SUCCESS If initialization was successful.
- * @retval    NRF_ERROR_INVALID_STATE If the driver is already initialized.
- * @retval    NRF_ERROR_INVALID_PARAM If event_handler is NULL.
- */
-ret_code_t nrf_drv_saadc_init(nrf_drv_saadc_config_t const * p_config,
-                              nrf_drv_saadc_event_handler_t event_handler);
-
-/**
- * @brief Function for uninitializing the SAADC.
- *
- * This function stops all ongoing conversions and disables all channels.
- */
-void nrf_drv_saadc_uninit(void);
-
-/**
- * @brief Function for getting the address of a SAMPLE SAADC task.
- *
- * @return     Task address.
- */
-__STATIC_INLINE uint32_t nrf_drv_saadc_sample_task_get(void)
-{
-    return nrf_saadc_task_address_get(NRF_SAADC_TASK_SAMPLE);
-}
-
-
-/**
- * @brief Function for initializing an SAADC channel.
- *
- * This function configures and enables the channel.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the ADC was not initialized.
- * @retval NRF_ERROR_NO_MEM        If the specified channel was already allocated.
- */
-ret_code_t nrf_drv_saadc_channel_init(uint8_t channel, 
-                                      nrf_saadc_channel_config_t const * const p_config);
-
-
-/**
- * @brief Function for uninitializing an SAADC channel.
- *
- * @retval NRF_SUCCESS    If uninitialization was successful.
- * @retval NRF_ERROR_BUSY If the ADC is busy.
- */
-ret_code_t nrf_drv_saadc_channel_uninit(uint8_t channel);
-
-/**
- * @brief Function for starting SAADC sampling.
- *
- * @retval NRF_SUCCESS    If ADC sampling was triggered.
- * @retval NRF_ERROR_BUSY If ADC is in idle state.
- */
-ret_code_t nrf_drv_saadc_sample(void);
-
-/**
- * @brief Blocking function for executing a single ADC conversion.
- *
- * This function selects the desired input, starts a single conversion,
- * waits for it to finish, and returns the result.
- *
- * The function will fail if ADC is busy.
- *
- * @param[in]  channel Channel.
- * @param[out] p_value Pointer to the location where the result should be placed.
- *
- * @retval NRF_SUCCESS    If conversion was successful.
- * @retval NRF_ERROR_BUSY If the ADC driver is busy.
- */
-ret_code_t nrf_drv_saadc_sample_convert(uint8_t channel, nrf_saadc_value_t * p_value);
-
-/**
- * @brief Function for issuing conversion of data to the buffer.
- *
- * This function is non-blocking. The application is notified about filling the buffer by the event handler.
- * Conversion will be done on all enabled channels. If the ADC is in idle state, the function will set up Easy
- * DMA for the conversion. The ADC will be ready for sampling and wait for the SAMPLE task. It can be
- * triggered manually by the @ref nrf_drv_saadc_sample function or by PPI using the @ref NRF_SAADC_TASK_SAMPLE
- * task. If one buffer is already set and the conversion is ongoing, calling this function will
- * result in queuing the given buffer. The driver will start filling the issued buffer when the first one is
- * completed. If the function is called again before the first buffer is filled, it will return with error.
- *
- * @param[in] buffer Result buffer.
- * @param[in] size   Buffer size in words.
- *
- * @retval NRF_SUCCESS    If conversion was successful.
- * @retval NRF_ERROR_BUSY If the driver already has two buffers set.
- */
-ret_code_t nrf_drv_saadc_buffer_convert(nrf_saadc_value_t * buffer, uint16_t size);
-
-/**
- * @brief Function for retrieving the SAADC state.
- *
- * @retval true  If the ADC is busy.
- * @retval false If the ADC is ready.
- */
-bool nrf_drv_saadc_is_busy(void);
-
-/**
- * @brief Function for aborting ongoing and buffered conversions.
- * @note @ref NRF_DRV_SAADC_EVT_DONE event will be generated if there is a conversion in progress.
- *       Event will contain number of words in the sample buffer.
- */
-void nrf_drv_saadc_abort(void);
-
-/**
- * @brief Function for setting the SAADC channel limits.
- *        When limits are enabled and the result exceeds the defined bounds, the limit handler function is called.
- *
- * @param[in] channel SAADC channel number.
- * @param[in] limit_low Lower limit (valid values from @ref NRF_DRV_SAADC_LIMITL_DISABLED to
- *            @ref NRF_DRV_SAADC_LIMITH_DISABLED). Conversion results below this value will trigger
- *            the handler function. Set to @ref NRF_DRV_SAADC_LIMITL_DISABLED to disable this limit.
- * @param[in] limit_high Upper limit (valid values from @ref NRF_DRV_SAADC_LIMITL_DISABLED to
- *            @ref NRF_DRV_SAADC_LIMITH_DISABLED). Conversion results above this value will trigger
- *            the handler function. Set to @ref NRF_DRV_SAADC_LIMITH_DISABLED to disable this limit.
- */
-void nrf_drv_saadc_limits_set(uint8_t channel, int16_t limit_low, int16_t limit_high);
-
-/**
- * @brief Function for converting a GPIO pin number to an analog input pin number used in the channel
- *        configuration.
- *
- * @param[in]  pin GPIO pin.
- *
- * @return     Value representing an analog input pin. The function returns @ref NRF_SAADC_INPUT_DISABLED
- *             if the specified pin is not an analog input.
- */
-__STATIC_INLINE nrf_saadc_input_t nrf_drv_saadc_gpio_to_ain(uint32_t pin)
-{
-    // AIN0 - AIN3
-    if (pin >= 2 && pin <= 5)
-    {
-        //0 means "not connected", hence this "+ 1"
-        return (nrf_saadc_input_t)(pin - 2 + 1);
-    }
-    // AIN4 - AIN7
-    else if (pin >= 28 && pin <= 31)
-    {
-        return (nrf_saadc_input_t)(pin - 24 + 1);
-    }
-    else
-    {
-        return NRF_SAADC_INPUT_DISABLED;
-    }
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_SAADC_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/sdio/config/sdio_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/config/sdio_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/config/sdio_config.h
deleted file mode 100644
index 715280b..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/config/sdio_config.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (c) 2012 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.
- *
- */
-#ifndef SDIO_CONFIG_H
-#define SDIO_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SDIO_CONFIG_CLOCK_PIN_NUMBER 24
-#define SDIO_CONFIG_DATA_PIN_NUMBER 25
-
-#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/drivers_nrf/sdio/sdio.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/sdio.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/sdio.c
deleted file mode 100644
index cc479a0..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/sdio.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* Copyright (c) 2009 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 <stdint.h>
-
-#include "nrf.h"
-#include "nrf_delay.h"
-#include "sdio.h"
-#include "nrf_gpio.h"
-
-#include "sdio_config.h"
-
-/*lint ++flb "Enter library region" */
-
-/*lint -e717 -save "Suppress do {} while (0) for these macros" */
-#define SDIO_CLOCK_HIGH()   do { NRF_GPIO->OUTSET = (1UL << SDIO_CONFIG_CLOCK_PIN_NUMBER); } while (0) /*!< Pulls SCL line high */
-#define SDIO_CLOCK_LOW()    do { NRF_GPIO->OUTCLR = (1UL << SDIO_CONFIG_CLOCK_PIN_NUMBER); } while (0) /*!< Pulls SCL line low */
-#define SDIO_DATA_HIGH()    do { NRF_GPIO->OUTSET = (1UL << SDIO_CONFIG_DATA_PIN_NUMBER); } while (0)  /*!< Pulls SDA line high */
-#define SDIO_DATA_LOW()     do { NRF_GPIO->OUTCLR = (1UL << SDIO_CONFIG_DATA_PIN_NUMBER); } while (0)  /*!< Pulls SDA line low */
-#define SDIO_DATA_OUTPUT()  do { NRF_GPIO->DIRSET = (1UL << SDIO_CONFIG_DATA_PIN_NUMBER); } while (0)  /*!< Configures SDA pin as output */
-#define SDIO_CLOCK_OUTPUT() do { NRF_GPIO->DIRSET = (1UL << SDIO_CONFIG_CLOCK_PIN_NUMBER); } while (0) /*!< Configures SCL pin as output */
-/*lint -restore */
-
-/*lint -emacro(845,SDIO_DATA_INPUT) // A zero has been given as right argument to operator '|'" */
-
-#define SDIO_DATA_INPUT() do {                       \
-        nrf_gpio_cfg_input(25, NRF_GPIO_PIN_NOPULL); \
-} while (0)
-
-#define SDIO_DATA_READ()  ((NRF_GPIO->IN >> SDIO_CONFIG_DATA_PIN_NUMBER) & 0x1UL)  /*!< Reads current state of SDA */
-#define SDIO_CLOCK_READ() ((NRF_GPIO->IN >> SDIO_CONFIG_CLOCK_PIN_NUMBER) & 0x1UL) /*!< Reads current state of SCL */
-#define SDIO_DELAY()      nrf_delay_us(10)                                         /*!< Time to wait when pin states are changed. For fast-mode the delay can be zero and for standard-mode 4 us delay is sufficient. */
-
-void sdio_init(void)
-{
-    SDIO_CLOCK_HIGH();
-    SDIO_DATA_HIGH();
-    SDIO_CLOCK_OUTPUT();
-    SDIO_DATA_INPUT();
-
-    // If slave is stuck in the middle of transfer, clock out bits until the slave ACKs the transfer
-    for (uint_fast8_t i = 16; i--;)
-    {
-        SDIO_DELAY();
-        SDIO_CLOCK_LOW();
-        SDIO_DELAY();
-        SDIO_CLOCK_HIGH();
-        SDIO_DELAY();
-
-        if (SDIO_DATA_READ())
-        {
-            break;
-        }
-    }
-
-    for (uint_fast8_t i = 5; i--;)
-    {
-        SDIO_DELAY();
-        SDIO_CLOCK_LOW();
-        SDIO_DELAY();
-        SDIO_CLOCK_HIGH();
-    }
-
-    SDIO_DATA_OUTPUT();
-    SDIO_DATA_HIGH();
-
-    SDIO_DELAY();
-}
-
-uint8_t sdio_read_byte(uint8_t address)
-{
-    uint8_t data_byte = 0;
-
-    SDIO_DATA_OUTPUT();
-
-    for (uint_fast8_t i = 8; i--;)
-    {
-        SDIO_DELAY();
-
-        SDIO_CLOCK_LOW();
-
-        if (address & (1U << i))
-        {
-            SDIO_DATA_HIGH();
-        }
-        else
-        {
-            SDIO_DATA_LOW();
-        }
-
-        SDIO_DELAY();
-
-        SDIO_CLOCK_HIGH();
-    }
-
-    nrf_delay_us(20);
-
-    SDIO_DATA_INPUT();
-
-    for (uint_fast8_t i = 8; i--;)
-    {
-        SDIO_CLOCK_LOW();
-        SDIO_DELAY();
-        SDIO_CLOCK_HIGH();
-        SDIO_DELAY();
-        data_byte |= (uint8_t)(SDIO_DATA_READ() << i);
-    }
-
-    SDIO_DATA_HIGH();
-    SDIO_DATA_OUTPUT();
-
-    SDIO_DELAY();
-
-    return data_byte;
-}
-
-void sdio_read_burst(uint8_t * target_buffer, uint8_t target_buffer_size)
-{
-    uint_fast8_t address = 0x63;
-
-    SDIO_DATA_OUTPUT();
-
-    for (uint_fast8_t bit_index=8; bit_index--;)
-    {
-        SDIO_CLOCK_LOW();
-
-        if (address & (1U << bit_index))
-        {
-            SDIO_DATA_HIGH();
-        }
-        else
-        {
-            SDIO_DATA_LOW();
-        }
-
-        SDIO_CLOCK_HIGH();
-    }
-
-    SDIO_DATA_INPUT();
-
-    for (uint_fast8_t target_buffer_index = 0; target_buffer_index < target_buffer_size; target_buffer_index++)
-    {
-        target_buffer[target_buffer_index] = 0;
-
-        for (uint_fast8_t bit_index = 8; bit_index--;)
-        {
-            SDIO_CLOCK_LOW();
-            SDIO_CLOCK_HIGH();
-            target_buffer[target_buffer_index] |= (uint8_t)(SDIO_DATA_READ() << bit_index);
-        }
-    }
-}
-
-void sdio_write_byte(uint8_t address, uint8_t data_byte)
-{
-    // Add write indication bit
-    address |= 0x80;
-
-    SDIO_DATA_OUTPUT();
-
-    for (uint_fast8_t i = 8; i--;)
-    {
-        SDIO_DELAY();
-
-        SDIO_CLOCK_LOW();
-
-        if (address & (1U << i))
-        {
-            SDIO_DATA_HIGH();
-        }
-        else
-        {
-            SDIO_DATA_LOW();
-        }
-
-        SDIO_DELAY();
-
-        SDIO_CLOCK_HIGH();
-    }
-
-    SDIO_DELAY();
-
-    for (uint_fast8_t i = 8; i--;)
-    {
-        SDIO_CLOCK_LOW();
-
-        if (data_byte & (1U << i))
-        {
-            SDIO_DATA_HIGH();
-        }
-        else
-        {
-            SDIO_DATA_LOW();
-        }
-
-        SDIO_DELAY();
-
-        SDIO_CLOCK_HIGH();
-
-        SDIO_DELAY();
-    }
-
-    SDIO_DATA_HIGH();
-
-    SDIO_DELAY();
-}
-
-/*lint --flb "Leave library region" */

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/sdio/sdio.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/sdio.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/sdio.h
deleted file mode 100644
index ffbde5c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/sdio/sdio.h
+++ /dev/null
@@ -1,77 +0,0 @@
- /* Copyright (c) 2009 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.
- *
- */
-
-#ifndef SDIO_H
-#define SDIO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*lint ++flb "Enter library region" */
-
-#include <stdbool.h>
-#include <stdint.h>
-
-/** @file
-* @brief 2-wire serial interface driver (compatible with ADNS2080 mouse sensor driver)
-*
-*
-* @defgroup nrf_drivers_sdio SDIO driver
-* @{
-* @ingroup nrf_drivers
-* @brief 2-wire serial interface driver.
-*/
-
-/**
- * @brief Function for initializing 2-wire serial interface and trying to handle stuck slaves.
- * 
- */
-void sdio_init(void);
-
-/**
- * @brief Function for reading a byte over 2-wire serial interface.
- * 
- * Developer needs to implement this function in a way that suits the hardware.
- * @param address Register address to read from
- * @return Byte read
- */
-uint8_t sdio_read_byte(uint8_t address);
-
-/**
- * @brief Function for reading several bytes over 2-wire serial interface using burst mode.
- * 
- * Developer needs to implement this function in a way that suits the hardware.
- * @param target_buffer Buffer location to store read bytes to
- * @param target_buffer_size Bytes allocated for target_buffer
- */
-void sdio_read_burst(uint8_t *target_buffer, uint8_t target_buffer_size);
-
-/**
- * @brief Function for writing a byte over 2-wire serial interface.
- * 
- * Developer needs to implement this function in a way that suits the hardware.
- * @param address Register address to write to
- * @param data_byte Data byte to write
- */
-void sdio_write_byte(uint8_t address, uint8_t data_byte);
-
-/**
- *@}
- **/
-
-/*lint --flb "Leave library region" */ 
-#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/drivers_nrf/spi_master/nrf_drv_spi.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/nrf_drv_spi.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/nrf_drv_spi.c
deleted file mode 100644
index fa68a7d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/nrf_drv_spi.c
+++ /dev/null
@@ -1,655 +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_spi.h"
-#include "nrf_drv_common.h"
-#include "nrf_gpio.h"
-#include "nrf_assert.h"
-#include "app_util_platform.h"
-
-
-#ifndef NRF52
-    // Make sure SPIx_USE_EASY_DMA is 0 for nRF51 (if a common
-    // "nrf_drv_config.h" file is provided for nRF51 and nRF52).
-    #undef  SPI0_USE_EASY_DMA
-    #define SPI0_USE_EASY_DMA 0
-    #undef  SPI1_USE_EASY_DMA
-    #define SPI1_USE_EASY_DMA 0
-    #undef  SPI2_USE_EASY_DMA
-    #define SPI2_USE_EASY_DMA 0
-#endif
-
-// This set of macros makes it possible to exclude parts of code when one type
-// of supported peripherals is not used.
-#if ((SPI0_ENABLED && SPI0_USE_EASY_DMA) || \
-     (SPI1_ENABLED && SPI1_USE_EASY_DMA) || \
-     (SPI2_ENABLED && SPI2_USE_EASY_DMA))
-    #define SPIM_IN_USE
-#endif
-#if ((SPI0_ENABLED && !SPI0_USE_EASY_DMA) || \
-     (SPI1_ENABLED && !SPI1_USE_EASY_DMA) || \
-     (SPI2_ENABLED && !SPI2_USE_EASY_DMA))
-    #define SPI_IN_USE
-#endif
-#if defined(SPIM_IN_USE) && defined(SPI_IN_USE)
-    // SPIM and SPI combined
-    #define CODE_FOR_SPIM(code) if (p_instance->use_easy_dma) { code }
-    #define CODE_FOR_SPI(code)  else { code }
-#elif defined(SPIM_IN_USE) && !defined(SPI_IN_USE)
-    // SPIM only
-    #define CODE_FOR_SPIM(code) { code }
-    #define CODE_FOR_SPI(code)
-#elif !defined(SPIM_IN_USE) && defined(SPI_IN_USE)
-    // SPI only
-    #define CODE_FOR_SPIM(code)
-    #define CODE_FOR_SPI(code)  { code }
-#else
-    #error "Wrong configuration."
-#endif
-
-#ifdef SPIM_IN_USE
-#ifdef NRF52_PAN_23
-#define END_INT_MASK     (NRF_SPIM_INT_ENDTX_MASK | NRF_SPIM_INT_ENDRX_MASK)
-#else
-#define END_INT_MASK     NRF_SPIM_INT_END_MASK
-#endif
-#endif
-
-// Control block - driver instance local data.
-typedef struct
-{
-    nrf_drv_spi_handler_t handler;
-    nrf_drv_spi_evt_t     evt;  // Keep the struct that is ready for event handler. Less memcpy.
-    nrf_drv_state_t       state;
-    volatile bool         transfer_in_progress;
-
-    // [no need for 'volatile' attribute for the following members, as they
-    //  are not concurrently used in IRQ handlers and main line code]
-    uint8_t         ss_pin;
-    uint8_t         orc;
-    uint8_t         bytes_transferred;
-
-    bool tx_done : 1;
-    bool rx_done : 1;
-} spi_control_block_t;
-static spi_control_block_t m_cb[SPI_COUNT];
-
-static nrf_drv_spi_config_t const m_default_config[SPI_COUNT] = {
-#if SPI0_ENABLED
-    NRF_DRV_SPI_DEFAULT_CONFIG(0),
-#endif
-#if SPI1_ENABLED
-    NRF_DRV_SPI_DEFAULT_CONFIG(1),
-#endif
-#if SPI2_ENABLED
-    NRF_DRV_SPI_DEFAULT_CONFIG(2),
-#endif
-};
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    #define IRQ_HANDLER_NAME(n) irq_handler_for_instance_##n
-    #define IRQ_HANDLER(n)      static void IRQ_HANDLER_NAME(n)(void)
-
-    #if SPI0_ENABLED
-        IRQ_HANDLER(0);
-    #endif
-    #if SPI1_ENABLED
-        IRQ_HANDLER(1);
-    #endif
-    #if SPI2_ENABLED
-        IRQ_HANDLER(2);
-    #endif
-    static nrf_drv_irq_handler_t const m_irq_handlers[SPI_COUNT] = {
-    #if SPI0_ENABLED
-        IRQ_HANDLER_NAME(0),
-    #endif
-    #if SPI1_ENABLED
-        IRQ_HANDLER_NAME(1),
-    #endif
-    #if SPI2_ENABLED
-        IRQ_HANDLER_NAME(2),
-    #endif
-    };
-#else
-    #define IRQ_HANDLER(n) void SPI##n##_IRQ_HANDLER(void)
-#endif // PERIPHERAL_RESOURCE_SHARING_ENABLED
-
-
-ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance,
-                            nrf_drv_spi_config_t const * p_config,
-                            nrf_drv_spi_handler_t handler)
-{
-    spi_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-
-    if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    if (nrf_drv_common_per_res_acquire(p_instance->p_registers,
-            m_irq_handlers[p_instance->drv_inst_idx]) != NRF_SUCCESS)
-    {
-        return NRF_ERROR_BUSY;
-    }
-#endif
-
-    if (p_config == NULL)
-    {
-        p_config = &m_default_config[p_instance->drv_inst_idx];
-    }
-
-    p_cb->handler = handler;
-
-    uint32_t mosi_pin;
-    uint32_t miso_pin;
-    // Configure pins used by the peripheral:
-    // - SCK - output with initial value corresponding with the SPI mode used:
-    //   0 - for modes 0 and 1 (CPOL = 0), 1 - for modes 2 and 3 (CPOL = 1);
-    //   according to the reference manual guidelines this pin and its input
-    //   buffer must always be connected for the SPI to work.
-    if (p_config->mode <= NRF_DRV_SPI_MODE_1)
-    {
-        nrf_gpio_pin_clear(p_config->sck_pin);
-    }
-    else
-    {
-        nrf_gpio_pin_set(p_config->sck_pin);
-    }
-    NRF_GPIO->PIN_CNF[p_config->sck_pin] =
-        (GPIO_PIN_CNF_DIR_Output        << GPIO_PIN_CNF_DIR_Pos)
-      | (GPIO_PIN_CNF_INPUT_Connect     << GPIO_PIN_CNF_INPUT_Pos)
-      | (GPIO_PIN_CNF_PULL_Disabled     << GPIO_PIN_CNF_PULL_Pos)
-      | (GPIO_PIN_CNF_DRIVE_S0S1        << GPIO_PIN_CNF_DRIVE_Pos)
-      | (GPIO_PIN_CNF_SENSE_Disabled    << GPIO_PIN_CNF_SENSE_Pos);
-    // - MOSI (optional) - output with initial value 0,
-    if (p_config->mosi_pin != NRF_DRV_SPI_PIN_NOT_USED)
-    {
-        mosi_pin = p_config->mosi_pin;
-        nrf_gpio_pin_clear(mosi_pin);
-        nrf_gpio_cfg_output(mosi_pin);
-    }
-    else
-    {
-        mosi_pin = NRF_SPI_PIN_NOT_CONNECTED;
-    }
-    // - MISO (optional) - input,
-    if (p_config->miso_pin != NRF_DRV_SPI_PIN_NOT_USED)
-    {
-        miso_pin = p_config->miso_pin;
-        nrf_gpio_cfg_input(miso_pin, NRF_GPIO_PIN_NOPULL);
-    }
-    else
-    {
-        miso_pin = NRF_SPI_PIN_NOT_CONNECTED;
-    }
-    // - Slave Select (optional) - output with initial value 1 (inactive).
-    if (p_config->ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
-    {
-        nrf_gpio_pin_set(p_config->ss_pin);
-        nrf_gpio_cfg_output(p_config->ss_pin);
-    }
-    m_cb[p_instance->drv_inst_idx].ss_pin = p_config->ss_pin;
-
-    CODE_FOR_SPIM
-    (
-        NRF_SPIM_Type * p_spim = p_instance->p_registers;
-        nrf_spim_pins_set(p_spim, p_config->sck_pin, mosi_pin, miso_pin);
-        nrf_spim_frequency_set(p_spim,
-            (nrf_spim_frequency_t)p_config->frequency);
-        nrf_spim_configure(p_spim,
-            (nrf_spim_mode_t)p_config->mode,
-            (nrf_spim_bit_order_t)p_config->bit_order);
-
-        nrf_spim_orc_set(p_spim, p_config->orc);
-
-        if (p_cb->handler)
-        {
-            nrf_spim_int_enable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK);
-        }
-
-        nrf_spim_enable(p_spim);
-    )
-    CODE_FOR_SPI
-    (
-        NRF_SPI_Type * p_spi = p_instance->p_registers;
-        nrf_spi_pins_set(p_spi, p_config->sck_pin, mosi_pin, miso_pin);
-        nrf_spi_frequency_set(p_spi,
-            (nrf_spi_frequency_t)p_config->frequency);
-        nrf_spi_configure(p_spi,
-            (nrf_spi_mode_t)p_config->mode,
-            (nrf_spi_bit_order_t)p_config->bit_order);
-
-        m_cb[p_instance->drv_inst_idx].orc = p_config->orc;
-
-        if (p_cb->handler)
-        {
-            nrf_spi_int_enable(p_spi, NRF_SPI_INT_READY_MASK);
-        }
-
-        nrf_spi_enable(p_spi);
-    )
-
-    if (p_cb->handler)
-    {
-        nrf_drv_common_irq_enable(p_instance->irq, p_config->irq_priority);
-    }
-
-    p_cb->transfer_in_progress = false;
-    p_cb->state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-void nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance)
-{
-    spi_control_block_t * p_cb = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-
-    if (p_cb->handler)
-    {
-        nrf_drv_common_irq_disable(p_instance->irq);
-    }
-
-    #define DISABLE_ALL  0xFFFFFFFF
-
-    CODE_FOR_SPIM
-    (
-        NRF_SPIM_Type * p_spim = p_instance->p_registers;
-        if (p_cb->handler)
-        {
-            nrf_spim_int_disable(p_spim, DISABLE_ALL);
-            if (p_cb->transfer_in_progress)
-            {
-                // Ensure that SPI is not performing any transfer.
-                nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP);
-                while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) {}
-                p_cb->transfer_in_progress = false;
-            }
-        }
-        nrf_spim_disable(p_spim);
-    )
-    CODE_FOR_SPI
-    (
-        NRF_SPI_Type * p_spi = p_instance->p_registers;
-        if (p_cb->handler)
-        {
-            nrf_spi_int_disable(p_spi, DISABLE_ALL);
-        }
-        nrf_spi_disable(p_spi);
-    )
-    #undef DISABLE_ALL
-
-#if PERIPHERAL_RESOURCE_SHARING_ENABLED
-    nrf_drv_common_per_res_release(p_instance->p_registers);
-#endif
-
-    p_cb->state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-ret_code_t nrf_drv_spi_transfer(nrf_drv_spi_t const * const p_instance,
-                                uint8_t const * p_tx_buffer,
-                                uint8_t         tx_buffer_length,
-                                uint8_t       * p_rx_buffer,
-                                uint8_t         rx_buffer_length)
-{
-    nrf_drv_spi_xfer_desc_t xfer_desc;
-    xfer_desc.p_tx_buffer = p_tx_buffer;
-    xfer_desc.p_rx_buffer = p_rx_buffer;
-    xfer_desc.tx_length   = tx_buffer_length;
-    xfer_desc.rx_length   = rx_buffer_length;
-
-    return nrf_drv_spi_xfer(p_instance, &xfer_desc, 0);
-}
-
-static void finish_transfer(spi_control_block_t * p_cb)
-{
-    // If Slave Select signal is used, this is the time to deactivate it.
-    if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
-    {
-        nrf_gpio_pin_set(p_cb->ss_pin);
-    }
-
-    // By clearing this flag before calling the handler we allow subsequent
-    // transfers to be started directly from the handler function.
-    p_cb->transfer_in_progress = false;
-    p_cb->evt.type = NRF_DRV_SPI_EVENT_DONE;
-    p_cb->handler(&p_cb->evt);
-}
-
-#ifdef SPI_IN_USE
-// This function is called from IRQ handler or, in blocking mode, directly
-// from the 'nrf_drv_spi_transfer' function.
-// It returns true as long as the transfer should be continued, otherwise (when
-// there is nothing more to send/receive) it returns false.
-static bool transfer_byte(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb)
-{
-    // Read the data byte received in this transfer and store it in RX buffer,
-    // if needed.
-    volatile uint8_t rx_data = nrf_spi_rxd_get(p_spi);
-    if (p_cb->bytes_transferred < p_cb->evt.data.done.rx_length)
-    {
-        p_cb->evt.data.done.p_rx_buffer[p_cb->bytes_transferred] = rx_data;
-    }
-
-    ++p_cb->bytes_transferred;
-
-    // Check if there are more bytes to send or receive and write proper data
-    // byte (next one from TX buffer or over-run character) to the TXD register
-    // when needed.
-    // NOTE - we've already used 'p_cb->bytes_transferred + 1' bytes from our
-    //        buffers, because we take advantage of double buffering of TXD
-    //        register (so in effect one byte is still being transmitted now);
-    //        see how the transfer is started in the 'nrf_drv_spi_transfer'
-    //        function.
-    uint16_t bytes_used = p_cb->bytes_transferred + 1;
-    if (bytes_used < p_cb->evt.data.done.tx_length)
-    {
-        nrf_spi_txd_set(p_spi, p_cb->evt.data.done.p_tx_buffer[bytes_used]);
-        return true;
-    }
-    else if (bytes_used < p_cb->evt.data.done.rx_length)
-    {
-        nrf_spi_txd_set(p_spi, p_cb->orc);
-        return true;
-    }
-
-    return (p_cb->bytes_transferred < p_cb->evt.data.done.tx_length ||
-            p_cb->bytes_transferred < p_cb->evt.data.done.rx_length);
-}
-
-static void spi_xfer(NRF_SPI_Type                  * p_spi,
-                     spi_control_block_t           * p_cb,
-                     nrf_drv_spi_xfer_desc_t const * p_xfer_desc)
-{
-    p_cb->bytes_transferred = 0;
-    nrf_spi_int_disable(p_spi, NRF_SPI_INT_READY_MASK);
-
-    nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY);
-
-    // Start the transfer by writing some byte to the TXD register;
-    // if TX buffer is not empty, take the first byte from this buffer,
-    // otherwise - use over-run character.
-    nrf_spi_txd_set(p_spi,
-        (p_xfer_desc->tx_length > 0 ?  p_xfer_desc->p_tx_buffer[0] : p_cb->orc));
-
-    // TXD register is double buffered, so next byte to be transmitted can
-    // be written immediately, if needed, i.e. if TX or RX transfer is to
-    // be more that 1 byte long. Again - if there is something more in TX
-    // buffer send it, otherwise use over-run character.
-    if (p_xfer_desc->tx_length > 1)
-    {
-        nrf_spi_txd_set(p_spi, p_xfer_desc->p_tx_buffer[1]);
-    }
-    else if (p_xfer_desc->rx_length > 1)
-    {
-        nrf_spi_txd_set(p_spi, p_cb->orc);
-    }
-
-    // For blocking mode (user handler not provided) wait here for READY
-    // events (indicating that the byte from TXD register was transmitted
-    // and a new incoming byte was moved to the RXD register) and continue
-    // transaction until all requested bytes are transferred.
-    // In non-blocking mode - IRQ service routine will do this stuff.
-    if (p_cb->handler)
-    {
-        nrf_spi_int_enable(p_spi, NRF_SPI_INT_READY_MASK);
-    }
-    else
-    {
-        do {
-            while (!nrf_spi_event_check(p_spi, NRF_SPI_EVENT_READY)) {}
-            nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY);
-        } while (transfer_byte(p_spi, p_cb));
-        if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
-        {
-            nrf_gpio_pin_set(p_cb->ss_pin);
-        }
-    }
-}
-#endif // SPI_IN_USE
-
-#ifdef SPIM_IN_USE
-__STATIC_INLINE void spim_int_enable(NRF_SPIM_Type * p_spim, bool enable)
-{
-    if (!enable)
-    {
-        nrf_spim_int_disable(p_spim, END_INT_MASK | NRF_SPIM_INT_STOPPED_MASK);
-    }
-    else
-    {
-        nrf_spim_int_enable(p_spim, END_INT_MASK |  NRF_SPIM_INT_STOPPED_MASK);
-    }
-}
-
-__STATIC_INLINE void spim_list_enable_handle(NRF_SPIM_Type * p_spim, uint32_t flags)
-{
-#ifndef NRF52_PAN_46
-    if (NRF_DRV_SPI_FLAG_TX_POSTINC & flags)
-    {
-        nrf_spim_tx_list_enable(p_spim);
-    }
-    else
-    {
-        nrf_spim_tx_list_disable(p_spim);
-    }
-
-    if (NRF_DRV_SPI_FLAG_RX_POSTINC & flags)
-    {
-        nrf_spim_rx_list_enable(p_spim);
-    }
-    else
-    {
-        nrf_spim_rx_list_disable(p_spim);
-    }
-#endif
-}
-
-static ret_code_t spim_xfer(NRF_SPIM_Type                * p_spim,
-                           spi_control_block_t           * p_cb,
-                           nrf_drv_spi_xfer_desc_t const * p_xfer_desc,
-                           uint32_t                        flags)
-{
-    // EasyDMA requires that transfer buffers are placed in Data RAM region;
-    // signal error if they are not.
-    if ((p_xfer_desc->p_tx_buffer != NULL && !nrf_drv_is_in_RAM(p_xfer_desc->p_tx_buffer)) ||
-        (p_xfer_desc->p_rx_buffer != NULL && !nrf_drv_is_in_RAM(p_xfer_desc->p_rx_buffer)))
-    {
-        p_cb->transfer_in_progress = false;
-        return NRF_ERROR_INVALID_ADDR;
-    }
-
-    nrf_spim_tx_buffer_set(p_spim, p_xfer_desc->p_tx_buffer, p_xfer_desc->tx_length);
-    nrf_spim_rx_buffer_set(p_spim, p_xfer_desc->p_rx_buffer, p_xfer_desc->rx_length);
-
-#ifdef NRF52_PAN_23
-    nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDTX);
-    nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDRX);
-#else
-    nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END);
-#endif
-    nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_STOPPED);
-
-    spim_list_enable_handle(p_spim, flags);
-
-    if (!(flags & NRF_DRV_SPI_FLAG_HOLD_XFER))
-    {
-        nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_START);
-    }
-
-    if (!p_cb->handler)
-    {
-#ifdef NRF52_PAN_23
-        while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDTX) ||
-               !nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDRX)) {}
-#else
-        while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){}
-#endif
-        // Stop the peripheral after transaction is finished.
-        nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP);
-        while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED)) {}
-        if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
-        {
-            nrf_gpio_pin_set(p_cb->ss_pin);
-        }
-    }
-		else
-		{
-				spim_int_enable(p_spim, !(flags & NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER));
-		}
-    return NRF_SUCCESS;
-}
-#endif
-
-ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t     const * const p_instance,
-                            nrf_drv_spi_xfer_desc_t const * p_xfer_desc,
-                            uint32_t                        flags)
-{
-    spi_control_block_t * p_cb  = &m_cb[p_instance->drv_inst_idx];
-    ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
-    ASSERT(p_tx_buffer != NULL || tx_buffer_length == 0);
-    ASSERT(p_rx_buffer != NULL || rx_buffer_length == 0);
-
-    if (p_cb->transfer_in_progress)
-    {
-        return NRF_ERROR_BUSY;
-    }
-    else
-    {
-        if (p_cb->handler && !(flags & (NRF_DRV_SPI_FLAG_REPEATED_XFER | NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER)))
-        {
-            p_cb->transfer_in_progress = true;
-        }
-    }
-
-    p_cb->evt.data.done = *p_xfer_desc;
-    p_cb->tx_done = false;
-    p_cb->rx_done = false;
-
-    if (p_cb->ss_pin != NRF_DRV_SPI_PIN_NOT_USED)
-    {
-        nrf_gpio_pin_clear(p_cb->ss_pin);
-    }
-    CODE_FOR_SPIM
-    (
-        return spim_xfer(p_instance->p_registers, p_cb,  p_xfer_desc, flags);
-    )
-    CODE_FOR_SPI
-    (
-        if (flags)
-        {
-            p_cb->transfer_in_progress = false;
-            return NRF_ERROR_NOT_SUPPORTED;
-        }
-        spi_xfer(p_instance->p_registers, p_cb, p_xfer_desc);
-        return NRF_SUCCESS;
-    )
-}
-#ifdef SPIM_IN_USE
-static void irq_handler_spim(NRF_SPIM_Type * p_spim, spi_control_block_t * p_cb)
-{
-    ASSERT(p_cb->handler);
-
-#ifdef NRF52_PAN_23
-    if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_STOPPED))
-    {
-        nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_STOPPED);
-        finish_transfer(p_cb);
-    }
-    else
-    {
-        if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDTX))
-        {
-            nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDTX);
-            p_cb->tx_done = true;
-        }
-        if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_ENDRX))
-        {
-            nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_ENDRX);
-            p_cb->rx_done = true;
-        }
-        if (p_cb->tx_done && p_cb->rx_done)
-        {
-            nrf_spim_task_trigger(p_spim, NRF_SPIM_TASK_STOP);
-        }
-    }
-#else
-    if (nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END))
-    {
-        nrf_spim_event_clear(p_spim, NRF_SPIM_EVENT_END);
-        finish_transfer(p_cb);
-    }
-#endif
-}
-
-uint32_t nrf_drv_spi_start_task_get(nrf_drv_spi_t const * p_instance)
-{
-    NRF_SPIM_Type * p_spim = (NRF_SPIM_Type *)p_instance->p_registers;
-    return nrf_spim_task_address_get(p_spim, NRF_SPIM_TASK_START);
-}
-
-uint32_t nrf_drv_spi_end_event_get(nrf_drv_spi_t const * p_instance)
-{
-    NRF_SPIM_Type * p_spim = (NRF_SPIM_Type *)p_instance->p_registers;
-    return nrf_spim_event_address_get(p_spim, NRF_SPIM_EVENT_END);
-}
-#endif // SPIM_IN_USE
-
-#ifdef SPI_IN_USE
-static void irq_handler_spi(NRF_SPI_Type * p_spi, spi_control_block_t * p_cb)
-{
-    ASSERT(p_cb->handler);
-
-    nrf_spi_event_clear(p_spi, NRF_SPI_EVENT_READY);
-
-    if (!transfer_byte(p_spi, p_cb))
-    {
-        finish_transfer(p_cb);
-    }
-}
-#endif // SPI_IN_USE
-
-#if SPI0_ENABLED
-IRQ_HANDLER(0)
-{
-    spi_control_block_t * p_cb  = &m_cb[SPI0_INSTANCE_INDEX];
-    #if SPI0_USE_EASY_DMA
-        irq_handler_spim(NRF_SPIM0, p_cb);
-    #else
-        irq_handler_spi(NRF_SPI0, p_cb);
-    #endif
-}
-#endif // SPI0_ENABLED
-
-#if SPI1_ENABLED
-IRQ_HANDLER(1)
-{
-    spi_control_block_t * p_cb  = &m_cb[SPI1_INSTANCE_INDEX];
-    #if SPI1_USE_EASY_DMA
-        irq_handler_spim(NRF_SPIM1, p_cb);
-    #else
-        irq_handler_spi(NRF_SPI1, p_cb);
-    #endif
-}
-#endif // SPI1_ENABLED
-
-#if SPI2_ENABLED
-IRQ_HANDLER(2)
-{
-    spi_control_block_t * p_cb  = &m_cb[SPI2_INSTANCE_INDEX];
-    #if SPI2_USE_EASY_DMA
-        irq_handler_spim(NRF_SPIM2, p_cb);
-    #else
-        irq_handler_spi(NRF_SPI2, p_cb);
-    #endif
-}
-#endif // SPI2_ENABLED

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/spi_master/nrf_drv_spi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/nrf_drv_spi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/nrf_drv_spi.h
deleted file mode 100644
index 1e0c900..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/spi_master/nrf_drv_spi.h
+++ /dev/null
@@ -1,376 +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_spi Serial peripheral interface (SPI)
- * @ingroup    nrf_drivers
- * @brief      Serial peripheral interface (SPI) APIs.
- *
- *
- * @addtogroup nrf_spi_master SPI master HAL and driver
- * @ingroup    nrf_spi
- * @brief      SPI master APIs.
- */
-
-#ifndef NRF_DRV_SPI_H__
-#define NRF_DRV_SPI_H__
-
-#include "nordic_common.h"
-#include "nrf_drv_config.h"
-#include "nrf_spi.h"
-#include "nrf_spim.h"
-#include "sdk_errors.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(NRF52)
-    #define NRF_DRV_SPI_PERIPHERAL(id)           \
-        (CONCAT_3(SPI, id, _USE_EASY_DMA) == 1 ? \
-            (void *)CONCAT_2(NRF_SPIM, id)       \
-          : (void *)CONCAT_2(NRF_SPI, id))
-    #define SPI2_IRQ            SPIM2_SPIS2_SPI2_IRQn
-    #define SPI2_IRQ_HANDLER    SPIM2_SPIS2_SPI2_IRQHandler
-#else
-    #define NRF_DRV_SPI_PERIPHERAL(id)  (void *)CONCAT_2(NRF_SPI, id)
-#endif
-#define SPI0_IRQ            SPI0_TWI0_IRQn
-#define SPI0_IRQ_HANDLER    SPI0_TWI0_IRQHandler
-#define SPI1_IRQ            SPI1_TWI1_IRQn
-#define SPI1_IRQ_HANDLER    SPI1_TWI1_IRQHandler
-
-
-/**
- * @defgroup nrf_drv_spi_master SPI master driver
- * @{
- * @ingroup  nrf_spi_master
- *
- * @brief    Multi-instance SPI master driver.
- */
-
-/**
- * @brief SPI master driver instance data structure.
- */
-typedef struct
-{
-    void *    p_registers;  ///< Pointer to the structure with SPI/SPIM peripheral instance registers.
-    IRQn_Type irq;          ///< SPI/SPIM peripheral instance IRQ number.
-    uint8_t   drv_inst_idx; ///< Driver instance index.
-    bool      use_easy_dma; ///< True if the peripheral with EasyDMA (SPIM) shall be used.
-} nrf_drv_spi_t;
-
-/**
- * @brief Macro for creating an SPI master driver instance.
- */
-#define NRF_DRV_SPI_INSTANCE(id)                        \
-{                                                       \
-    .p_registers  = NRF_DRV_SPI_PERIPHERAL(id),         \
-    .irq          = CONCAT_3(SPI, id, _IRQ),            \
-    .drv_inst_idx = CONCAT_3(SPI, id, _INSTANCE_INDEX), \
-    .use_easy_dma = CONCAT_3(SPI, id, _USE_EASY_DMA)    \
-}
-
-/**
- * @brief This value can be provided instead of a pin number for signals MOSI,
- *        MISO, and Slave Select to specify that the given signal is not used and
- *        therefore does not need to be connected to a pin.
- */
-#define NRF_DRV_SPI_PIN_NOT_USED  0xFF
-
-/**
- * @brief SPI data rates.
- */
-typedef enum
-{
-    NRF_DRV_SPI_FREQ_125K = NRF_SPI_FREQ_125K, ///< 125 kbps.
-    NRF_DRV_SPI_FREQ_250K = NRF_SPI_FREQ_250K, ///< 250 kbps.
-    NRF_DRV_SPI_FREQ_500K = NRF_SPI_FREQ_500K, ///< 500 kbps.
-    NRF_DRV_SPI_FREQ_1M   = NRF_SPI_FREQ_1M,   ///< 1 Mbps.
-    NRF_DRV_SPI_FREQ_2M   = NRF_SPI_FREQ_2M,   ///< 2 Mbps.
-    NRF_DRV_SPI_FREQ_4M   = NRF_SPI_FREQ_4M,   ///< 4 Mbps.
-    NRF_DRV_SPI_FREQ_8M   = NRF_SPI_FREQ_8M    ///< 8 Mbps.
-} nrf_drv_spi_frequency_t;
-
-/**
- * @brief SPI modes.
- */
-typedef enum
-{
-    NRF_DRV_SPI_MODE_0 = NRF_SPI_MODE_0, ///< SCK active high, sample on leading edge of clock.
-    NRF_DRV_SPI_MODE_1 = NRF_SPI_MODE_1, ///< SCK active high, sample on trailing edge of clock.
-    NRF_DRV_SPI_MODE_2 = NRF_SPI_MODE_2, ///< SCK active low, sample on leading edge of clock.
-    NRF_DRV_SPI_MODE_3 = NRF_SPI_MODE_3  ///< SCK active low, sample on trailing edge of clock.
-} nrf_drv_spi_mode_t;
-
-/**
- * @brief SPI bit orders.
- */
-typedef enum
-{
-    NRF_DRV_SPI_BIT_ORDER_MSB_FIRST = NRF_SPI_BIT_ORDER_MSB_FIRST, ///< Most significant bit shifted out first.
-    NRF_DRV_SPI_BIT_ORDER_LSB_FIRST = NRF_SPI_BIT_ORDER_LSB_FIRST  ///< Least significant bit shifted out first.
-} nrf_drv_spi_bit_order_t;
-
-/**
- * @brief SPI master driver instance configuration structure.
- */
-typedef struct
-{
-    uint8_t sck_pin;      ///< SCK pin number.
-    uint8_t mosi_pin;     ///< MOSI pin number (optional).
-                          /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED
-                           *   if this signal is not needed. */
-    uint8_t miso_pin;     ///< MISO pin number (optional).
-                          /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED
-                           *   if this signal is not needed. */
-    uint8_t ss_pin;       ///< Slave Select pin number (optional).
-                          /**< Set to @ref NRF_DRV_SPI_PIN_NOT_USED
-                           *   if this signal is not needed. The driver 
-                           *   supports only active low for this signal. 
-                           *   If the signal should be active high,
-                           *   it must be controlled externally. */
-    uint8_t irq_priority; ///< Interrupt priority.
-    uint8_t orc;          ///< Over-run character.
-                          /**< This character is used when all bytes from the TX buffer are sent,
-                               but the transfer continues due to RX. */
-    nrf_drv_spi_frequency_t frequency; ///< SPI frequency.
-    nrf_drv_spi_mode_t      mode;      ///< SPI mode.
-    nrf_drv_spi_bit_order_t bit_order; ///< SPI bit order.
-} nrf_drv_spi_config_t;
-
-/**
- * @brief SPI master instance default configuration.
- */
-#define NRF_DRV_SPI_DEFAULT_CONFIG(id)                       \
-{                                                            \
-    .sck_pin      = CONCAT_3(SPI, id, _CONFIG_SCK_PIN),      \
-    .mosi_pin     = CONCAT_3(SPI, id, _CONFIG_MOSI_PIN),     \
-    .miso_pin     = CONCAT_3(SPI, id, _CONFIG_MISO_PIN),     \
-    .ss_pin       = NRF_DRV_SPI_PIN_NOT_USED,                \
-    .irq_priority = CONCAT_3(SPI, id, _CONFIG_IRQ_PRIORITY), \
-    .orc          = 0xFF,                                    \
-    .frequency    = NRF_DRV_SPI_FREQ_4M,                     \
-    .mode         = NRF_DRV_SPI_MODE_0,                      \
-    .bit_order    = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST,         \
-}
-
-#define NRF_DRV_SPI_FLAG_TX_POSTINC          (1UL << 0) /**< TX buffer address incremented after transfer. */
-#define NRF_DRV_SPI_FLAG_RX_POSTINC          (1UL << 1) /**< RX buffer address incremented after transfer. */
-#define NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER (1UL << 2) /**< Interrupt after each transfer is suppressed, and the event handler is not called. */
-#define NRF_DRV_SPI_FLAG_HOLD_XFER           (1UL << 3) /**< Set up the transfer but do not start it. */
-#define NRF_DRV_SPI_FLAG_REPEATED_XFER       (1UL << 4) /**< Flag indicating that the transfer will be executed multiple times. */
-
-/**
- * @brief Single transfer descriptor structure.
- */
-typedef struct
-{
-    uint8_t const * p_tx_buffer; ///< Pointer to TX buffer.
-    uint8_t         tx_length;   ///< TX buffer length.
-    uint8_t       * p_rx_buffer; ///< Pointer to RX buffer.
-    uint8_t         rx_length;   ///< RX buffer length.
-}nrf_drv_spi_xfer_desc_t;
-
-
-/**
- * @brief Macro for setting up single transfer descriptor.
- *
- * This macro is for internal use only.
- */
-#define NRF_DRV_SPI_SINGLE_XFER(p_tx, tx_len, p_rx, rx_len)  \
-    {                                                        \
-    .p_tx_buffer = (uint8_t const *)(p_tx),                  \
-    .tx_length = (tx_len),                                   \
-    .p_rx_buffer = (p_rx),                                   \
-    .rx_length = (rx_len),                                   \
-    }
-
-/**
- * @brief Macro for setting duplex TX RX transfer.
- */
-#define NRF_DRV_SPI_XFER_TRX(p_tx_buf, tx_length, p_rx_buf, rx_length)                    \
-        NRF_DRV_SPI_SINGLE_XFER(p_tx_buf, tx_length, p_rx_buf, rx_length)
-
-/**
- * @brief Macro for setting TX transfer.
- */
-#define NRF_DRV_SPI_XFER_TX(p_buf, length) \
-        NRF_DRV_SPI_SINGLE_XFER(p_buf, length, NULL, 0)
-
-/**
- * @brief Macro for setting RX transfer.
- */
-#define NRF_DRV_SPI_XFER_RX(p_buf, length) \
-        NRF_DRV_SPI_SINGLE_XFER(NULL, 0, p_buf, length)
-
-/**
- * @brief SPI master driver event types, passed to the handler routine provided
- *        during initialization.
- */
-typedef enum
-{
-    NRF_DRV_SPI_EVENT_DONE, ///< Transfer done.
-} nrf_drv_spi_evt_type_t;
-
-typedef struct
-{
-    nrf_drv_spi_evt_type_t  type;      ///< Event type.
-    union
-    {
-        nrf_drv_spi_xfer_desc_t done;  ///< Event data for DONE event.
-    } data;
-} nrf_drv_spi_evt_t;
-
-/**
- * @brief SPI master driver event handler type.
- */
-typedef void (*nrf_drv_spi_handler_t)(nrf_drv_spi_evt_t const * p_event);
-
-
-/**
- * @brief Function for initializing the SPI master driver instance.
- *
- * This function configures and enables the specified peripheral.
- *
- * @param[in] p_instance Pointer to the instance structure.
- * @param[in] p_config   Pointer to the structure with the initial configuration.
- *                       If NULL, the default configuration is used.
- * @param     handler    Event handler provided by the user. If NULL, transfers
- *                       will be performed in blocking mode.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the driver was already initialized.
- * @retval NRF_ERROR_BUSY          If some other peripheral with the same
- *                                 instance ID is already in use. This is 
- *                                 possible only if PERIPHERAL_RESOURCE_SHARING_ENABLED 
- *                                 is set to a value other than zero.
- */
-ret_code_t nrf_drv_spi_init(nrf_drv_spi_t const * const p_instance,
-                            nrf_drv_spi_config_t const * p_config,
-                            nrf_drv_spi_handler_t handler);
-
-/**
- * @brief Function for uninitializing the SPI master driver instance.
- *
- * @param[in] p_instance Pointer to the instance structure.
- */
-void       nrf_drv_spi_uninit(nrf_drv_spi_t const * const p_instance);
-
-/**
- * @brief Function for starting the SPI data transfer.
- *
- * If an event handler was provided in the @ref nrf_drv_spi_init call, this function
- * returns immediately and the handler is called when the transfer is done.
- * Otherwise, the transfer is performed in blocking mode, which means that this function
- * returns when the transfer is finished.
- *
- * @note Peripherals using EasyDMA (for example, SPIM) require the transfer buffers
- *       to be placed in the Data RAM region. If they are not and an SPIM instance is
- *       used, this function will fail with the error code NRF_ERROR_INVALID_ADDR.
- *
- * @param[in] p_instance       Pointer to the instance structure.
- * @param[in] p_tx_buffer      Pointer to the transmit buffer. Can be NULL
- *                             if there is nothing to send.
- * @param     tx_buffer_length Length of the transmit buffer.
- * @param[in] p_rx_buffer      Pointer to the receive buffer. Can be NULL
- *                             if there is nothing to receive.
- * @param     rx_buffer_length Length of the receive buffer.
- *
- * @retval NRF_SUCCESS            If the operation was successful.
- * @retval NRF_ERROR_BUSY         If a previously started transfer has not finished
- *                                yet.
- * @retval NRF_ERROR_INVALID_ADDR If the provided buffers are not placed in the Data
- *                                RAM region.
- */
-ret_code_t nrf_drv_spi_transfer(nrf_drv_spi_t const * const p_instance,
-                                uint8_t const * p_tx_buffer,
-                                uint8_t         tx_buffer_length,
-                                uint8_t       * p_rx_buffer,
-                                uint8_t         rx_buffer_length);
-
-
-/**
- * @brief Function for starting the SPI data transfer with additional option flags.
- *
- * Function enables customizing the transfer by using option flags.
- *
- * Additional options are provided using the flags parameter:
- *
- * - @ref NRF_DRV_SPI_FLAG_TX_POSTINC and @ref NRF_DRV_SPI_FLAG_RX_POSTINC<span></span>:
- *   Post-incrementation of buffer addresses. Supported only by SPIM.
- * - @ref NRF_DRV_SPI_FLAG_HOLD_XFER<span></span>: Driver is not starting the transfer. Use this
- *   flag if the transfer is triggered externally by PPI. Supported only by SPIM. Use
- *   @ref nrf_drv_twi_start_task_get to get the address of the start task.
- * - @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER<span></span>: No user event handler after transfer
- *   completion. This also means no interrupt at the end of the transfer. Supported only by SPIM.
- *   If @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER is used, the driver does not set the instance into
- *   busy state, so you must ensure that the next transfers are set up when SPIM is not active.
- *   @ref nrf_drv_spi_end_event_get function can be used to detect end of transfer. Option can be used
- *   together with @ref NRF_DRV_SPI_FLAG_REPEATED_XFER to prepare a sequence of SPI transfers
- *   without interruptions.
- * - @ref NRF_DRV_SPI_FLAG_REPEATED_XFER<span></span>: Prepare for repeated transfers. You can set
- *   up a number of transfers that will be triggered externally (for example by PPI). An example is
- *   a TXRX transfer with the options @ref NRF_DRV_SPI_FLAG_RX_POSTINC,
- *   @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER, and @ref NRF_DRV_SPI_FLAG_REPEATED_XFER. After the
- *   transfer is set up, a set of transfers can be triggered by PPI that will read, for example,
- *   the same register of an external component and put it into a RAM buffer without any interrupts.
- *   @ref nrf_drv_spi_end_event_get can be used to get the address of the END event, which can be
- *   used to count the number of transfers. If @ref NRF_DRV_SPI_FLAG_REPEATED_XFER is used,
- *   the driver does not set the instance into busy state, so you must ensure that the next
- *   transfers are set up when SPIM is not active. Supported only by SPIM.
- * @note Function is intended to be used only in non-blocking mode.
- *
- * @param p_instance  SPI instance.
- * @param p_xfer_desc Pointer to the transfer descriptor.
- * @param flags       Transfer options (0 for default settings).
- *
- * @retval NRF_SUCCESS             If the procedure was successful.
- * @retval NRF_ERROR_BUSY          If the driver is not ready for a new transfer.
- * @retval NRF_ERROR_NOT_SUPPORTED If the provided parameters are not supported.
- * @retval NRF_ERROR_INVALID_ADDR  If the provided buffers are not placed in the Data
- *                                 RAM region.
- */
-ret_code_t nrf_drv_spi_xfer(nrf_drv_spi_t     const * const p_instance,
-                            nrf_drv_spi_xfer_desc_t const * p_xfer_desc,
-                            uint32_t                        flags);
-
-/**
- * @brief Function for returning the address of a SPIM start task.
- *
- * This function should be used if @ref nrf_drv_spi_xfer was called with the flag @ref NRF_DRV_SPI_FLAG_HOLD_XFER.
- * In that case, the transfer is not started by the driver, but it must be started externally by PPI.
- *
- * @param[in]  p_instance SPI instance.
- *
- * @return     Start task address.
- */
-uint32_t nrf_drv_spi_start_task_get(nrf_drv_spi_t const * p_instance);
-
-/**
- * @brief Function for returning the address of a END SPIM event.
- *
- * A END event can be used to detect the end of a transfer if the @ref NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER
- * option is used.
- *
- * @param[in]  p_instance  SPI instance.
- *
- * @return     END event address.
- */
-uint32_t nrf_drv_spi_end_event_get(nrf_drv_spi_t const * p_instance);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_SPI_H__
-
-/** @} */


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

Posted by cc...@apache.org.
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/config/nrf_drv_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/config/nrf_drv_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/config/nrf_drv_config.h
deleted file mode 100644
index e823d6c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/config/nrf_drv_config.h
+++ /dev/null
@@ -1,472 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_H
-#define NRF_DRV_CONFIG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * Provide a non-zero value here in applications that need to use several
- * peripherals with the same ID that are sharing certain resources
- * (for example, SPI0 and TWI0). Obviously, such peripherals cannot be used
- * simultaneously. Therefore, this definition allows to initialize the driver
- * for another peripheral from a given group only after the previously used one
- * is uninitialized. Normally, this is not possible, because interrupt handlers
- * are implemented in individual drivers.
- * This functionality requires a more complicated interrupt handling and driver
- * initialization, hence it is not always desirable to use it.
- */
-#define PERIPHERAL_RESOURCE_SHARING_ENABLED  0
-
-/* CLOCK */
-#define CLOCK_ENABLED 0
-
-#if (CLOCK_ENABLED == 1)
-#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
-#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LFCLK_Xtal
-#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
-#endif
-
-/* GPIOTE */
-#define GPIOTE_ENABLED 0
-
-#if (GPIOTE_ENABLED == 1)
-#define GPIOTE_CONFIG_USE_SWI_EGU false
-#define GPIOTE_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 1
-#endif
-
-/* TIMER */
-#define TIMER0_ENABLED 0
-
-#if (TIMER0_ENABLED == 1)
-#define TIMER0_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER0_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER0_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_32Bit
-#define TIMER0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER0_INSTANCE_INDEX      0
-#endif
-
-#define TIMER1_ENABLED 0
-
-#if (TIMER1_ENABLED == 1)
-#define TIMER1_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER1_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER1_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER1_INSTANCE_INDEX      (TIMER0_ENABLED)
-#endif
- 
-#define TIMER2_ENABLED 0
-
-#if (TIMER2_ENABLED == 1)
-#define TIMER2_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER2_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER2_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER2_INSTANCE_INDEX      (TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER3_ENABLED 0
-
-#if (TIMER3_ENABLED == 1)
-#define TIMER3_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER3_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER3_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER3_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER3_INSTANCE_INDEX      (TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-#define TIMER4_ENABLED 0
-
-#if (TIMER4_ENABLED == 1)
-#define TIMER4_CONFIG_FREQUENCY    NRF_TIMER_FREQ_16MHz
-#define TIMER4_CONFIG_MODE         TIMER_MODE_MODE_Timer
-#define TIMER4_CONFIG_BIT_WIDTH    TIMER_BITMODE_BITMODE_16Bit
-#define TIMER4_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TIMER4_INSTANCE_INDEX      (TIMER3_ENABLED+TIMER2_ENABLED+TIMER1_ENABLED+TIMER0_ENABLED)
-#endif
-
-
-#define TIMER_COUNT (TIMER0_ENABLED + TIMER1_ENABLED + TIMER2_ENABLED + TIMER3_ENABLED + TIMER4_ENABLED)
-
-/* RTC */
-#define RTC0_ENABLED 0
-
-#if (RTC0_ENABLED == 1)
-#define RTC0_CONFIG_FREQUENCY    32678
-#define RTC0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC0_CONFIG_RELIABLE     false
-
-#define RTC0_INSTANCE_INDEX      0
-#endif
-
-#define RTC1_ENABLED 0
-
-#if (RTC1_ENABLED == 1)
-#define RTC1_CONFIG_FREQUENCY    32768
-#define RTC1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC1_CONFIG_RELIABLE     false
-
-#define RTC1_INSTANCE_INDEX      (RTC0_ENABLED)
-#endif
-
-#define RTC2_ENABLED 0
-
-#if (RTC2_ENABLED == 1)
-#define RTC2_CONFIG_FREQUENCY    32768
-#define RTC2_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define RTC2_CONFIG_RELIABLE     false
-
-#define RTC2_INSTANCE_INDEX      (RTC0_ENABLED+RTC1_ENABLED)
-#endif
-
-
-#define RTC_COUNT                (RTC0_ENABLED+RTC1_ENABLED+RTC2_ENABLED)
-
-#define NRF_MAXIMUM_LATENCY_US 2000
-
-/* RNG */
-#define RNG_ENABLED 0
-
-#if (RNG_ENABLED == 1)
-#define RNG_CONFIG_ERROR_CORRECTION true
-#define RNG_CONFIG_POOL_SIZE        8
-#define RNG_CONFIG_IRQ_PRIORITY     APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PWM */
-
-#define PWM0_ENABLED 0
-
-#if (PWM0_ENABLED == 1)
-#define PWM0_CONFIG_OUT0_PIN        2
-#define PWM0_CONFIG_OUT1_PIN        3
-#define PWM0_CONFIG_OUT2_PIN        4
-#define PWM0_CONFIG_OUT3_PIN        5
-#define PWM0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM0_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM0_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM0_CONFIG_TOP_VALUE       1000
-#define PWM0_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM0_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM0_INSTANCE_INDEX 0
-#endif
-
-#define PWM1_ENABLED 0
-
-#if (PWM1_ENABLED == 1)
-#define PWM1_CONFIG_OUT0_PIN        2
-#define PWM1_CONFIG_OUT1_PIN        3
-#define PWM1_CONFIG_OUT2_PIN        4
-#define PWM1_CONFIG_OUT3_PIN        5
-#define PWM1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM1_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM1_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM1_CONFIG_TOP_VALUE       1000
-#define PWM1_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM1_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM1_INSTANCE_INDEX (PWM0_ENABLED)
-#endif
-
-#define PWM2_ENABLED 0
-
-#if (PWM2_ENABLED == 1)
-#define PWM2_CONFIG_OUT0_PIN        2
-#define PWM2_CONFIG_OUT1_PIN        3
-#define PWM2_CONFIG_OUT2_PIN        4
-#define PWM2_CONFIG_OUT3_PIN        5
-#define PWM2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#define PWM2_CONFIG_BASE_CLOCK      NRF_PWM_CLK_1MHz
-#define PWM2_CONFIG_COUNT_MODE      NRF_PWM_MODE_UP
-#define PWM2_CONFIG_TOP_VALUE       1000
-#define PWM2_CONFIG_LOAD_MODE       NRF_PWM_LOAD_COMMON
-#define PWM2_CONFIG_STEP_MODE       NRF_PWM_STEP_AUTO
-
-#define PWM2_INSTANCE_INDEX (PWM0_ENABLED + PWM1_ENABLED)
-#endif
-
-#define PWM_COUNT   (PWM0_ENABLED + PWM1_ENABLED + PWM2_ENABLED)
-
-/* SPI */
-#define SPI0_ENABLED 0
-
-#if (SPI0_ENABLED == 1)
-#define SPI0_USE_EASY_DMA 0
-
-#define SPI0_CONFIG_SCK_PIN         2
-#define SPI0_CONFIG_MOSI_PIN        3
-#define SPI0_CONFIG_MISO_PIN        4
-#define SPI0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI0_INSTANCE_INDEX 0
-#endif
-
-#define SPI1_ENABLED 0
-
-#if (SPI1_ENABLED == 1)
-#define SPI1_USE_EASY_DMA 0
-
-#define SPI1_CONFIG_SCK_PIN         2
-#define SPI1_CONFIG_MOSI_PIN        3
-#define SPI1_CONFIG_MISO_PIN        4
-#define SPI1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI1_INSTANCE_INDEX (SPI0_ENABLED)
-#endif
-
-#define SPI2_ENABLED 0
-
-#if (SPI2_ENABLED == 1)
-#define SPI2_USE_EASY_DMA 0
-
-#define SPI2_CONFIG_SCK_PIN         2
-#define SPI2_CONFIG_MOSI_PIN        3
-#define SPI2_CONFIG_MISO_PIN        4
-#define SPI2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPI2_INSTANCE_INDEX (SPI0_ENABLED + SPI1_ENABLED)
-#endif
-
-#define SPI_COUNT   (SPI0_ENABLED + SPI1_ENABLED + SPI2_ENABLED)
-
-/* SPIS */
-#define SPIS0_ENABLED 0
-
-#if (SPIS0_ENABLED == 1)
-#define SPIS0_CONFIG_SCK_PIN         2
-#define SPIS0_CONFIG_MOSI_PIN        3
-#define SPIS0_CONFIG_MISO_PIN        4
-#define SPIS0_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS0_INSTANCE_INDEX 0
-#endif
-
-#define SPIS1_ENABLED 0
-
-#if (SPIS1_ENABLED == 1)
-#define SPIS1_CONFIG_SCK_PIN         2
-#define SPIS1_CONFIG_MOSI_PIN        3
-#define SPIS1_CONFIG_MISO_PIN        4
-#define SPIS1_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS1_INSTANCE_INDEX SPIS0_ENABLED
-#endif
-
-#define SPIS2_ENABLED 0
-
-#if (SPIS2_ENABLED == 1)
-#define SPIS2_CONFIG_SCK_PIN         2
-#define SPIS2_CONFIG_MOSI_PIN        3
-#define SPIS2_CONFIG_MISO_PIN        4
-#define SPIS2_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-
-#define SPIS2_INSTANCE_INDEX (SPIS0_ENABLED + SPIS1_ENABLED)
-#endif
-
-#define SPIS_COUNT   (SPIS0_ENABLED + SPIS1_ENABLED + SPIS2_ENABLED)
-
-/* UART */
-#define UART0_ENABLED 0
-
-#if (UART0_ENABLED == 1)
-#define UART0_CONFIG_HWFC         NRF_UART_HWFC_DISABLED
-#define UART0_CONFIG_PARITY       NRF_UART_PARITY_EXCLUDED
-#define UART0_CONFIG_BAUDRATE     NRF_UART_BAUDRATE_115200
-#define UART0_CONFIG_PSEL_TXD     0
-#define UART0_CONFIG_PSEL_RXD     0
-#define UART0_CONFIG_PSEL_CTS     0
-#define UART0_CONFIG_PSEL_RTS     0
-#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#ifdef NRF52
-#define UART0_CONFIG_USE_EASY_DMA false
-//Compile time flag
-#define UART_EASY_DMA_SUPPORT     1
-#define UART_LEGACY_SUPPORT       1
-#endif //NRF52
-#endif
-
-#define TWI0_ENABLED 0
-
-#if (TWI0_ENABLED == 1)
-#define TWI0_USE_EASY_DMA 0
-
-#define TWI0_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI0_CONFIG_SCL          0
-#define TWI0_CONFIG_SDA          1
-#define TWI0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI0_INSTANCE_INDEX      0
-#endif
-
-#define TWI1_ENABLED 0
-
-#if (TWI1_ENABLED == 1)
-#define TWI1_USE_EASY_DMA 0
-
-#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
-#define TWI1_CONFIG_SCL          0
-#define TWI1_CONFIG_SDA          1
-#define TWI1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
-#endif
-
-#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
-
-/* TWIS */
-#define TWIS0_ENABLED 0
-
-#if (TWIS0_ENABLED == 1)
-    #define TWIS0_CONFIG_ADDR0        0
-    #define TWIS0_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS0_CONFIG_SCL          0
-    #define TWIS0_CONFIG_SDA          1
-    #define TWIS0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS0_INSTANCE_INDEX      0
-#endif
-
-#define TWIS1_ENABLED 0
-
-#if (TWIS1_ENABLED ==  1)
-    #define TWIS1_CONFIG_ADDR0        0
-    #define TWIS1_CONFIG_ADDR1        0 /* 0: Disabled */
-    #define TWIS1_CONFIG_SCL          0
-    #define TWIS1_CONFIG_SDA          1
-    #define TWIS1_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-
-    #define TWIS1_INSTANCE_INDEX      (TWIS0_ENABLED)
-#endif
-
-#define TWIS_COUNT (TWIS0_ENABLED + TWIS1_ENABLED)
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0
-/* For more documentation see nrf_drv_twis.h file */
-#define TWIS_NO_SYNC_MODE 0
-
-/* QDEC */
-#define QDEC_ENABLED 0
-
-#if (QDEC_ENABLED == 1)
-#define QDEC_CONFIG_REPORTPER    NRF_QDEC_REPORTPER_10
-#define QDEC_CONFIG_SAMPLEPER    NRF_QDEC_SAMPLEPER_16384us
-#define QDEC_CONFIG_PIO_A        1
-#define QDEC_CONFIG_PIO_B        2
-#define QDEC_CONFIG_PIO_LED      3
-#define QDEC_CONFIG_LEDPRE       511
-#define QDEC_CONFIG_LEDPOL       NRF_QDEC_LEPOL_ACTIVE_HIGH
-#define QDEC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define QDEC_CONFIG_DBFEN        false
-#define QDEC_CONFIG_SAMPLE_INTEN false
-#endif
-
-/* ADC */
-#define ADC_ENABLED 0
-
-#if (ADC_ENABLED == 1)
-#define ADC_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#endif
-
-
-/* SAADC */
-#define SAADC_ENABLED 0
-
-#if (SAADC_ENABLED == 1)
-#define SAADC_CONFIG_RESOLUTION      NRF_SAADC_RESOLUTION_10BIT
-#define SAADC_CONFIG_OVERSAMPLE      NRF_SAADC_OVERSAMPLE_DISABLED
-#define SAADC_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* PDM */
-#define PDM_ENABLED 0
-
-#if (PDM_ENABLED == 1)
-#define PDM_CONFIG_MODE            NRF_PDM_MODE_MONO
-#define PDM_CONFIG_EDGE            NRF_PDM_EDGE_LEFTFALLING
-#define PDM_CONFIG_CLOCK_FREQ      NRF_PDM_FREQ_1032K
-#define PDM_CONFIG_IRQ_PRIORITY    APP_IRQ_PRIORITY_LOW
-#endif
-
-/* COMP */
-#define COMP_ENABLED 0
-
-#if (COMP_ENABLED == 1)
-#define COMP_CONFIG_REF     		NRF_COMP_REF_Int1V8
-#define COMP_CONFIG_MAIN_MODE		NRF_COMP_MAIN_MODE_SE
-#define COMP_CONFIG_SPEED_MODE		NRF_COMP_SP_MODE_High
-#define COMP_CONFIG_HYST			NRF_COMP_HYST_NoHyst
-#define COMP_CONFIG_ISOURCE			NRF_COMP_ISOURCE_Off
-#define COMP_CONFIG_IRQ_PRIORITY 	APP_IRQ_PRIORITY_LOW
-#define COMP_CONFIG_INPUT        	NRF_COMP_INPUT_0
-#endif
-
-/* LPCOMP */
-#define LPCOMP_ENABLED 0
-
-#if (LPCOMP_ENABLED == 1)
-#define LPCOMP_CONFIG_REFERENCE    NRF_LPCOMP_REF_SUPPLY_4_8
-#define LPCOMP_CONFIG_DETECTION    NRF_LPCOMP_DETECT_DOWN
-#define LPCOMP_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
-#define LPCOMP_CONFIG_INPUT        NRF_LPCOMP_INPUT_0
-#endif
-
-/* WDT */
-#define WDT_ENABLED 0
-
-#if (WDT_ENABLED == 1)
-#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_RUN_SLEEP
-#define WDT_CONFIG_RELOAD_VALUE  2000
-#define WDT_CONFIG_IRQ_PRIORITY  APP_IRQ_PRIORITY_HIGH
-#endif
-
-/* SWI EGU */
-#ifdef NRF52
-    #define EGU_ENABLED 0
-#endif
-
-/* I2S */
-#define I2S_ENABLED 0
-
-#if (I2S_ENABLED == 1)
-#define I2S_CONFIG_SCK_PIN      22
-#define I2S_CONFIG_LRCK_PIN     23
-#define I2S_CONFIG_MCK_PIN      NRF_DRV_I2S_PIN_NOT_USED
-#define I2S_CONFIG_SDOUT_PIN    24
-#define I2S_CONFIG_SDIN_PIN     25
-#define I2S_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_HIGH
-#define I2S_CONFIG_MASTER       NRF_I2S_MODE_MASTER
-#define I2S_CONFIG_FORMAT       NRF_I2S_FORMAT_I2S
-#define I2S_CONFIG_ALIGN        NRF_I2S_ALIGN_LEFT
-#define I2S_CONFIG_SWIDTH       NRF_I2S_SWIDTH_16BIT
-#define I2S_CONFIG_CHANNELS     NRF_I2S_CHANNELS_STEREO
-#define I2S_CONFIG_MCK_SETUP    NRF_I2S_MCK_32MDIV8
-#define I2S_CONFIG_RATIO        NRF_I2S_RATIO_256X
-#endif
-
-#include "nrf_drv_config_validation.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_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/config/nrf_drv_config_validation.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/config/nrf_drv_config_validation.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/config/nrf_drv_config_validation.h
deleted file mode 100644
index fa1bb8f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/config/nrf_drv_config_validation.h
+++ /dev/null
@@ -1,91 +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.
- *
- */
-
-#ifndef NRF_DRV_CONFIG_VALIDATION_H
-#define NRF_DRV_CONFIG_VALIDATION_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef NRF52
-
-#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \
-    ((SPI0_ENABLED + SPIS0_ENABLED + TWI0_ENABLED + TWIS0_ENABLED) > 1)
-#error "Peripherals overlap. SPI0, SPIS0, TWI0, TWIS0 - only one of these can be enabled."
-#endif
-
-#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \
-    ((SPI1_ENABLED + SPIS1_ENABLED + TWI1_ENABLED + TWIS1_ENABLED) > 1)
-#error "Peripherals overlap. SPI1, SPIS1, TWI1, TWIS1 - only one of these can be enabled."
-#endif
-
-#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \
-    ((SPI2_ENABLED + SPIS2_ENABLED) > 1)
-#error "Peripherals overlap. SPI2, SPIS2 - only one of these can be enabled."
-#endif
-
-#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \
-    ((COMP_ENABLED + LPCOMP_ENABLED) > 1)
-#error "COMP and LPCOMP cannot be enabled together. Peripherals overlap."
-#endif
-
-#else //NRF51
-
-#if (TWIS0_ENABLED + TWIS1_ENABLED) > 0
-#error "TWIS not present in nRF51."
-#endif
-
-#if SPIS0_ENABLED > 0
-#error "SPIS0 instance not present in nRF51."
-#endif 
-
-#if (SPI2_ENABLED + SPIS2_ENABLED) > 0
-#error "SPI2/SPIS2 instance not present in nRF51."
-#endif 
-
-#if RTC2_ENABLED
-#error "RTC2 not present in NRF51."
-#endif
-
-#if (TIMER3_ENABLED + TIMER4_ENABLED) > 0
-#error "TIMER3 and TIMER4 not present in nRF51."
-#endif
-
-#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \
-    ((SPI0_ENABLED + TWI0_ENABLED) > 1)
-#error "Peripherals overlap. SPI0, TWI0 - only one of these can be enabled."
-#endif
-
-#if (!PERIPHERAL_RESOURCE_SHARING_ENABLED) && \
-    ((SPI1_ENABLED + SPIS1_ENABLED + TWI1_ENABLED) > 1)
-#error "Peripherals overlap. SPI1, SPIS1, TWI1 - only one of these can be enabled."
-#endif
-
-#if SAADC_ENABLED > 0
-#error "SAADC not present in nRF51."
-#endif
-
-#if I2S_ENABLED > 0
-#error "I2S not present in nRF51."
-#endif
-#if COMP_ENABLED > 0
-#error "COMP not present in nRF51."
-#endif
-
-#endif //NRF51
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_DRV_CONFIG_VALIDATION_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/delay/nrf_delay.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/delay/nrf_delay.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/delay/nrf_delay.c
deleted file mode 100644
index a77e641..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/delay/nrf_delay.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (c) 2012 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 <stdio.h> 
-#include "compiler_abstraction.h"
-#include "nrf.h"
-#include "nrf_delay.h"
-
-/*lint --e{438} "Variable not used" */
-void nrf_delay_ms(uint32_t volatile number_of_ms)
-{
-    while(number_of_ms != 0)
-    {
-        number_of_ms--;
-        nrf_delay_us(999);
-    }
-}

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/delay/nrf_delay.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/delay/nrf_delay.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/delay/nrf_delay.h
deleted file mode 100644
index 5114df7..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/delay/nrf_delay.h
+++ /dev/null
@@ -1,250 +0,0 @@
-#ifndef _NRF_DELAY_H
-#define _NRF_DELAY_H
-
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Function for delaying execution for number of microseconds.
- *
- * @note NRF52 has instruction cache and because of that delay is not precise.
- *
- * @param number_of_ms
- */
-/*lint --e{438, 522} "Variable not used" "Function lacks side-effects" */
-#if defined ( __CC_ARM   )
-
-static __ASM void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
-{
-loop
-        SUBS    R0, R0, #1
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-#ifdef NRF52
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-        NOP
-#endif
-        BNE    loop
-        BX     LR
-}
-
-#elif defined ( __ICCARM__ )
-
-static void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
-{
-__ASM (
-"loop:\n\t"
-       " SUBS R0, R0, #1\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-       " NOP\n\t"
-#ifdef NRF52
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-        " NOP\n\t"
-#endif
-       " BNE.n loop\n\t");
-}
-
-#elif defined ( _WIN32 ) || defined ( __unix ) || defined( __APPLE__ )
-
-__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us);
-
-#ifndef CUSTOM_NRF_DELAY_US
-__STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us)
-{}
-#endif
-
-#elif defined ( __GNUC__ )
-
-static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline));
-static void __INLINE nrf_delay_us(uint32_t volatile number_of_us)
-{
-register uint32_t delay __ASM ("r0") = number_of_us;
-__ASM volatile (
-#ifdef NRF51
-        ".syntax unified\n"
-#endif
-    "1:\n"
-    " SUBS %0, %0, #1\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"   
-    " NOP\n"  
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-#ifdef NRF52
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-    " NOP\n"
-#endif
-    " BNE 1b\n"
-#ifdef NRF51
-    ".syntax divided\n"
-#endif
-    : "+r" (delay));
-}
-#endif
-
-void nrf_delay_ms(uint32_t volatile number_of_ms);
-
-#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/drivers_nrf/gpiote/nrf_drv_gpiote.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/gpiote/nrf_drv_gpiote.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/gpiote/nrf_drv_gpiote.c
deleted file mode 100644
index 2a665c8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/gpiote/nrf_drv_gpiote.c
+++ /dev/null
@@ -1,580 +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_gpiote.h"
-#include "nrf_drv_common.h"
-#include "nrf_drv_config.h"
-#include "app_util_platform.h"
-#include "nrf_assert.h"
-
-#define FORBIDDEN_HANDLER_ADDRESS ((nrf_drv_gpiote_evt_handler_t)UINT32_MAX)
-#define PIN_NOT_USED              (-1)
-#define PIN_USED                  (-2)
-#define NO_CHANNELS               (-1)
-#define SENSE_FIELD_POS           (6)
-#define SENSE_FIELD_MASK          (0xC0)
-
-/**
- * @brief Macro for conveting task-event index to an address of an event register.
- *
- * Macro utilizes the fact that registers are grouped together in ascending order.
- */
-#define TE_IDX_TO_EVENT_ADDR(idx)   (nrf_gpiote_events_t)((uint32_t)NRF_GPIOTE_EVENTS_IN_0+(sizeof(uint32_t)*(idx)))
-
-/**
- * @brief Macro for conveting task-event index to an address of a task register.
- *
- * Macro utilizes the fact that registers are grouped together in ascending order.
- */
-#define TE_IDX_TO_TASK_ADDR(idx)   (nrf_gpiote_tasks_t)((uint32_t)NRF_GPIOTE_TASKS_OUT_0+(sizeof(uint32_t)*(idx)))
-
-//lint -save -e661
-typedef struct
-{
-    nrf_drv_gpiote_evt_handler_t handlers[NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS];
-    int8_t                       pin_assignments[NUMBER_OF_PINS];
-    int8_t                       port_handlers_pins[GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS];
-    nrf_drv_state_t              state;
-} gpiote_control_block_t;
-
-static gpiote_control_block_t m_cb;
-
-__STATIC_INLINE bool pin_in_use(uint32_t pin)
-{
-    return (m_cb.pin_assignments[pin] != PIN_NOT_USED);
-}
-
-__STATIC_INLINE bool pin_in_use_as_non_task_out(uint32_t pin)
-{
-    return (m_cb.pin_assignments[pin] == PIN_USED);
-}
-
-__STATIC_INLINE bool pin_in_use_by_te(uint32_t pin)
-{
-    return (m_cb.pin_assignments[pin] >= 0 && m_cb.pin_assignments[pin] < NUMBER_OF_GPIO_TE) ? true : false;
-}
-
-__STATIC_INLINE bool pin_in_use_by_port(uint32_t pin)
-{
-    return (m_cb.pin_assignments[pin] >= NUMBER_OF_GPIO_TE);
-}
-
-__STATIC_INLINE bool pin_in_use_by_gpiote(uint32_t pin)
-{
-    return (m_cb.pin_assignments[pin] >= 0);
-}
-
-__STATIC_INLINE void pin_in_use_by_te_set(uint32_t pin,
-                                          uint32_t channel_id,
-                                          nrf_drv_gpiote_evt_handler_t handler,
-                                          bool is_channel)
-{
-    m_cb.pin_assignments[pin] = channel_id;
-    m_cb.handlers[channel_id] = handler;
-    if (!is_channel)
-    {
-        m_cb.port_handlers_pins[channel_id-NUMBER_OF_GPIO_TE] = (int8_t)pin;
-    }
-}
-
-__STATIC_INLINE void pin_in_use_set(uint32_t pin)
-{
-    m_cb.pin_assignments[pin] = PIN_USED;
-}
-
-__STATIC_INLINE void pin_in_use_clear(uint32_t pin)
-{
-    m_cb.pin_assignments[pin] = PIN_NOT_USED;
-}
-
-__STATIC_INLINE int8_t channel_port_get(uint32_t pin)
-{
-    return m_cb.pin_assignments[pin];
-}
-
-__STATIC_INLINE nrf_drv_gpiote_evt_handler_t channel_handler_get(uint32_t channel)
-{
-    return m_cb.handlers[channel];
-}
-
-static int8_t channel_port_alloc(uint32_t pin,nrf_drv_gpiote_evt_handler_t handler, bool channel)
-{
-    int8_t channel_id = NO_CHANNELS;
-    uint32_t i;
-
-    uint32_t start_idx = channel ? 0 : NUMBER_OF_GPIO_TE;
-    uint32_t end_idx = channel ? NUMBER_OF_GPIO_TE : (NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS);
-    //critical section
-
-    for (i = start_idx; i < end_idx; i++)
-    {
-        if (m_cb.handlers[i] == FORBIDDEN_HANDLER_ADDRESS)
-        {
-            pin_in_use_by_te_set(pin, i, handler, channel);
-            channel_id = i;
-            break;
-        }
-    }
-    //critical section
-    return channel_id;
-}
-
-static void channel_free(uint8_t channel_id)
-{
-    m_cb.handlers[channel_id] = FORBIDDEN_HANDLER_ADDRESS;
-    if (channel_id >= NUMBER_OF_GPIO_TE)
-    {
-        m_cb.port_handlers_pins[channel_id-NUMBER_OF_GPIO_TE] = (int8_t)PIN_NOT_USED;
-    }
-}
-
-ret_code_t nrf_drv_gpiote_init(void)
-{
-    if (m_cb.state != NRF_DRV_STATE_UNINITIALIZED)
-    {
-        return NRF_ERROR_INVALID_STATE;
-    }
-
-    uint8_t i;
-    for (i = 0; i < NUMBER_OF_PINS; i++)
-    {
-        pin_in_use_clear(i);
-    }
-    for (i = 0; i < (NUMBER_OF_GPIO_TE+GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS); i++)
-    {
-        channel_free(i);
-    }
-
-    nrf_drv_common_irq_enable(GPIOTE_IRQn, GPIOTE_CONFIG_IRQ_PRIORITY);
-    nrf_gpiote_int_enable(GPIOTE_INTENSET_PORT_Msk);
-    m_cb.state = NRF_DRV_STATE_INITIALIZED;
-
-    return NRF_SUCCESS;
-}
-
-bool nrf_drv_gpiote_is_init(void)
-{
-    return (m_cb.state != NRF_DRV_STATE_UNINITIALIZED) ? true : false;
-}
-
-void nrf_drv_gpiote_uninit(void)
-{
-    ASSERT(m_cb.state!=NRF_DRV_STATE_UNINITIALIZED);
-
-    uint32_t i;
-    for (i = 0; i < NUMBER_OF_PINS; i++)
-    {
-        if (pin_in_use_as_non_task_out(i))
-        {
-            nrf_drv_gpiote_out_uninit(i);
-        }
-        else if( pin_in_use_by_gpiote(i))
-        {
-            /* Disable gpiote_in is having the same effect on out pin as gpiote_out_uninit on
-             * so it can be called on all pins used by GPIOTE.
-             */
-            nrf_drv_gpiote_in_uninit(i);
-        }
-    }
-    m_cb.state = NRF_DRV_STATE_UNINITIALIZED;
-}
-
-ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin, 
-                                   nrf_drv_gpiote_out_config_t const * p_config)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(m_cb.state == NRF_DRV_STATE_INITIALIZED);
-    ASSERT(p_config);
-
-    ret_code_t result = NRF_SUCCESS;
-
-    if (pin_in_use(pin))
-    {
-        result = NRF_ERROR_INVALID_STATE;
-    }
-    else
-    {
-        if (p_config->task_pin)
-        {
-            int8_t channel = channel_port_alloc(pin, NULL, true);
-
-            if (channel != NO_CHANNELS)
-            {
-                nrf_gpiote_task_configure(channel, pin, p_config->action, p_config->init_state);
-            }
-            else
-            {
-                result = NRF_ERROR_NO_MEM;
-            }
-        }
-        else
-        {
-            pin_in_use_set(pin);
-        }
-
-        if (result == NRF_SUCCESS)
-        {
-            if (p_config->init_state == NRF_GPIOTE_INITIAL_VALUE_HIGH)
-            {
-                nrf_gpio_pin_set(pin);
-            }
-            else
-            {
-                nrf_gpio_pin_clear(pin);
-            }
-            
-            nrf_gpio_cfg_output(pin);
-        }
-    }
-
-    return result;
-}
-
-void nrf_drv_gpiote_out_uninit(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-
-    if (pin_in_use_by_te(pin))
-    {
-        channel_free((uint8_t)channel_port_get(pin));
-        nrf_gpiote_te_default(channel_port_get(pin));
-    }
-    pin_in_use_clear(pin);
-
-    nrf_gpio_cfg_default(pin);
-}
-
-void nrf_drv_gpiote_out_set(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-    ASSERT(!pin_in_use_by_te(pin))
-
-    nrf_gpio_pin_set(pin);
-}
-
-void nrf_drv_gpiote_out_clear(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-    ASSERT(!pin_in_use_by_te(pin))
-
-    nrf_gpio_pin_clear(pin);
-}
-
-void nrf_drv_gpiote_out_toggle(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-    ASSERT(!pin_in_use_by_te(pin))
-
-    nrf_gpio_pin_toggle(pin);
-}
-
-void nrf_drv_gpiote_out_task_enable(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-    ASSERT(pin_in_use_by_te(pin))
-
-    nrf_gpiote_task_enable(m_cb.pin_assignments[pin]);
-}
-
-void nrf_drv_gpiote_out_task_disable(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-    ASSERT(pin_in_use_by_te(pin))
-
-    nrf_gpiote_task_disable(m_cb.pin_assignments[pin]);
-}
-
-uint32_t nrf_drv_gpiote_out_task_addr_get(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use_by_te(pin));
-    
-    nrf_gpiote_tasks_t task = TE_IDX_TO_TASK_ADDR(channel_port_get(pin));
-    return nrf_gpiote_task_addr_get(task);
-}
-
-void nrf_drv_gpiote_out_task_force(nrf_drv_gpiote_pin_t pin, uint8_t state)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-    ASSERT(pin_in_use_by_te(pin));
-    
-    nrf_gpiote_outinit_t init_val = state ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW;
-    nrf_gpiote_task_force(m_cb.pin_assignments[pin], init_val);
-}
-
-void nrf_drv_gpiote_out_task_trigger(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use(pin));
-    ASSERT(pin_in_use_by_te(pin));
-
-    nrf_gpiote_tasks_t task = TE_IDX_TO_TASK_ADDR(channel_port_get(pin));;
-    nrf_gpiote_task_set(task);
-}
-
-ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin,
-                                  nrf_drv_gpiote_in_config_t const * p_config,
-                                  nrf_drv_gpiote_evt_handler_t evt_handler)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ret_code_t result = NRF_SUCCESS;
-    /* Only one GPIOTE channel can be assigned to one physical pin. */
-    if (pin_in_use_by_gpiote(pin))
-    {
-        result = NRF_ERROR_INVALID_STATE;
-    }
-    else
-    {
-        int8_t channel = channel_port_alloc(pin, evt_handler, p_config->hi_accuracy);
-        if (channel != NO_CHANNELS)
-        {
-            if (p_config->is_watcher)
-            {
-                nrf_gpio_cfg_watcher(pin);
-            }
-            else
-            {
-                nrf_gpio_cfg_input(pin,p_config->pull);
-            }
-
-            if (p_config->hi_accuracy)
-            {
-                nrf_gpiote_event_configure(channel, pin,p_config->sense);
-            }
-            else
-            {
-                m_cb.port_handlers_pins[channel-NUMBER_OF_GPIO_TE] |= (p_config->sense)<< SENSE_FIELD_POS;
-            }
-        }
-        else
-        {
-            result = NRF_ERROR_NO_MEM;
-        }
-    }
-    return result;
-}
-
-void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use_by_gpiote(pin));
-    if (pin_in_use_by_port(pin))
-    {
-        uint8_t pin_and_sense = m_cb.port_handlers_pins[channel_port_get(pin)-NUMBER_OF_GPIO_TE];
-        nrf_gpiote_polarity_t polarity = (nrf_gpiote_polarity_t)(pin_and_sense >> SENSE_FIELD_POS);
-        nrf_gpio_pin_sense_t sense;
-        if (polarity == NRF_GPIOTE_POLARITY_TOGGLE)
-        {
-            /* read current pin state and set for next sense to oposit */
-            sense = (nrf_gpio_pins_read() & (1 << pin)) ?
-                    NRF_GPIO_PIN_SENSE_LOW : NRF_GPIO_PIN_SENSE_HIGH;
-        }
-        else
-        {
-            sense = (polarity == NRF_GPIOTE_POLARITY_LOTOHI) ?
-                    NRF_GPIO_PIN_SENSE_HIGH : NRF_GPIO_PIN_SENSE_LOW;
-        }
-        nrf_gpio_cfg_sense_set(pin,sense);
-    }
-    else if(pin_in_use_by_te(pin))
-    {
-        int32_t channel = (int32_t)channel_port_get(pin);
-        nrf_gpiote_events_t event = TE_IDX_TO_EVENT_ADDR(channel);
-       
-        nrf_gpiote_event_enable(channel);
-
-        nrf_gpiote_event_clear(event);
-        if (int_enable)
-        {
-            nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(channel_port_get(pin));
-            // Enable the interrupt only if event handler was provided.
-            if (handler)
-            {
-                nrf_gpiote_int_enable(1 << channel);
-            }
-        }
-    }
-}
-
-void nrf_drv_gpiote_in_event_disable(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use_by_gpiote(pin));
-    if (pin_in_use_by_port(pin))
-    {
-        nrf_gpio_cfg_sense_set(pin,NRF_GPIO_PIN_NOSENSE);
-    }
-    else if(pin_in_use_by_te(pin))
-    {
-        int32_t channel = (int32_t)channel_port_get(pin);
-        nrf_gpiote_event_disable(channel);
-        nrf_gpiote_int_disable(1 << channel);
-    }
-}
-
-void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use_by_gpiote(pin));
-    nrf_drv_gpiote_in_event_disable(pin);
-    if(pin_in_use_by_te(pin))
-    {
-        nrf_gpiote_te_default(channel_port_get(pin));
-    }
-    nrf_gpio_cfg_default(pin);
-    channel_free((uint8_t)channel_port_get(pin));
-    pin_in_use_clear(pin);
-}
-
-bool nrf_drv_gpiote_in_is_set(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    return nrf_gpio_pin_read(pin) ? true : false;
-}
-
-uint32_t nrf_drv_gpiote_in_event_addr_get(nrf_drv_gpiote_pin_t pin)
-{
-    ASSERT(pin < NUMBER_OF_PINS);
-    ASSERT(pin_in_use_by_te(pin));
-    
-    nrf_gpiote_events_t event = TE_IDX_TO_EVENT_ADDR(channel_port_get(pin));
-    return nrf_gpiote_event_addr_get(event);
-}
-
-void GPIOTE_IRQHandler(void)
-{
-    uint32_t status = 0;
-    uint32_t input = 0;
-
-    /* collect status of all GPIOTE pin events. Processing is done once all are collected and cleared.*/
-    uint32_t i;
-    nrf_gpiote_events_t event = NRF_GPIOTE_EVENTS_IN_0;
-    uint32_t mask = (uint32_t)NRF_GPIOTE_INT_IN0_MASK;
-    for (i = 0; i < NUMBER_OF_GPIO_TE; i++)
-    {
-        if (nrf_gpiote_event_is_set(event) && nrf_gpiote_int_is_enabled(mask))
-        {
-            nrf_gpiote_event_clear(event);
-            status |= mask;
-        }
-        mask <<= 1;
-        /* Incrementing to next event, utilizing the fact that events are grouped together
-         * in ascending order. */
-        event = (nrf_gpiote_events_t)((uint32_t)event + sizeof(uint32_t));
-    }
-
-    /* collect PORT status event, if event is set read pins state. Processing is postponed to the
-     * end of interrupt. */
-    if (nrf_gpiote_event_is_set(NRF_GPIOTE_EVENTS_PORT))
-    {
-        nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_PORT);
-        status |= (uint32_t)NRF_GPIOTE_INT_PORT_MASK;
-        input = nrf_gpio_pins_read();
-    }
-
-    /* Process pin events. */
-    if (status & NRF_GPIOTE_INT_IN_MASK)
-    {
-        mask = (uint32_t)NRF_GPIOTE_INT_IN0_MASK;
-        for (i = 0; i < NUMBER_OF_GPIO_TE; i++)
-        {
-            if (mask & status)
-            {
-                nrf_drv_gpiote_pin_t pin = nrf_gpiote_event_pin_get(i);
-                nrf_gpiote_polarity_t polarity = nrf_gpiote_event_polarity_get(i);
-                nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(i);
-                handler(pin,polarity);
-            }
-            mask <<= 1;
-        }
-    }
-
-    if (status & (uint32_t)NRF_GPIOTE_INT_PORT_MASK)
-    {
-        /* Process port event. */
-        uint8_t repeat = 0;
-        uint32_t toggle_mask = 0;
-        uint32_t pins_to_check = 0xFFFFFFFFuL;
-
-        do
-        {
-            repeat = 0;
-            for (i = 0; i < GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS; i++)
-            {
-                uint8_t pin_and_sense = m_cb.port_handlers_pins[i];
-                nrf_drv_gpiote_pin_t pin = (pin_and_sense & ~SENSE_FIELD_MASK);
-
-                if ((m_cb.port_handlers_pins[i] != PIN_NOT_USED)
-                    && ((1UL << pin) & pins_to_check))
-                {
-                    nrf_gpiote_polarity_t polarity =
-                                (nrf_gpiote_polarity_t)((pin_and_sense & SENSE_FIELD_MASK) >> SENSE_FIELD_POS);
-                    nrf_drv_gpiote_evt_handler_t handler = channel_handler_get(channel_port_get(pin));
-                    if (handler || polarity == NRF_GPIOTE_POLARITY_TOGGLE)
-                    {
-                        mask = 1 << pin;
-                        if (polarity == NRF_GPIOTE_POLARITY_TOGGLE)
-                        {
-                            toggle_mask |= mask;
-                        }
-                        nrf_gpio_pin_sense_t sense = nrf_gpio_pin_sense_get(pin);
-
-                        if (((mask & input) && (sense==NRF_GPIO_PIN_SENSE_HIGH)) ||
-                           (!(mask & input) && (sense==NRF_GPIO_PIN_SENSE_LOW))  )
-                        {
-                            if (polarity == NRF_GPIOTE_POLARITY_TOGGLE)
-                            {
-                                nrf_gpio_pin_sense_t next_sense = (sense == NRF_GPIO_PIN_SENSE_HIGH) ?
-                                        NRF_GPIO_PIN_SENSE_LOW : NRF_GPIO_PIN_SENSE_HIGH;
-                                nrf_gpio_cfg_sense_set(pin, next_sense);
-                                ++repeat;
-                            }
-                            if (handler)
-                            {
-                                handler(pin, polarity);
-                            }
-                        }
-                    }
-                }
-            }
-
-            if (repeat)
-            {
-                // When one of the pins in low-accuracy and toggle mode becomes active,
-                // it's sense mode is inverted to clear the internal SENSE signal.
-                // State of any other enabled low-accuracy input in toggle mode must be checked
-                // explicitly, because it does not trigger the interrput when SENSE signal is active.
-                // For more information about SENSE functionality, refer to Product Specification.
-                uint32_t new_input = nrf_gpio_pins_read();
-                if (new_input == input)
-                {
-                    //No change.
-                    repeat = 0;
-                }
-                else
-                {
-                    input = new_input;
-                    pins_to_check = toggle_mask;
-                }
-            }
-        }
-        while (repeat);
-    }
-}
-//lint -restore

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/gpiote/nrf_drv_gpiote.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/gpiote/nrf_drv_gpiote.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/gpiote/nrf_drv_gpiote.h
deleted file mode 100644
index efb8bb8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/gpiote/nrf_drv_gpiote.h
+++ /dev/null
@@ -1,317 +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.
- *
- */
-
-#ifndef NRF_DRV_GPIOTE__
-#define NRF_DRV_GPIOTE__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup nrf_gpiote GPIOTE abstraction and driver
- * @ingroup nrf_drivers
- * @brief GPIOTE APIs.
- * @defgroup nrf_drv_gpiote GPIOTE driver
- * @{
- * @ingroup nrf_gpiote
- * @brief GPIOTE driver for managing input and output pins.
- */
-
-#include "nrf_gpiote.h"
-#include "nrf_gpio.h"
-#include "nrf_drv_config.h"
-#include "sdk_errors.h"
-#include <stdint.h>
-#include <stdbool.h>
-
-/**@brief Input pin configuration. */
-typedef struct
-{
-    nrf_gpiote_polarity_t sense;      /**< Transition that triggers interrupt. */
-    nrf_gpio_pin_pull_t   pull;       /**< Pulling mode. */
-    bool                  is_watcher; /**< True when the input pin is tracking an output pin. */
-    bool                  hi_accuracy;/**< True when high accuracy (IN_EVENT) is used. */
-} nrf_drv_gpiote_in_config_t;
-
-/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect low-to-high transition.
- * @details Set hi_accu to true to use IN_EVENT. */
-#define GPIOTE_CONFIG_IN_SENSE_LOTOHI(hi_accu)     \
-    {                                            \
-        .is_watcher = false,                     \
-        .hi_accuracy = hi_accu,                  \
-        .pull = NRF_GPIO_PIN_NOPULL,             \
-        .sense = NRF_GPIOTE_POLARITY_LOTOHI,     \
-    }
-
-/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect high-to-low transition.
- * @details Set hi_accu to true to use IN_EVENT. */
-#define GPIOTE_CONFIG_IN_SENSE_HITOLO(hi_accu)      \
-    {                                            \
-        .is_watcher = false,                     \
-        .hi_accuracy = hi_accu,                  \
-        .pull = NRF_GPIO_PIN_NOPULL,             \
-        .sense = NRF_GPIOTE_POLARITY_HITOLO,     \
-    }
-
-/**@brief Macro for configuring a pin to use a GPIO IN or PORT EVENT to detect any change on the pin.
- * @details Set hi_accu to true to use IN_EVENT.*/
-#define GPIOTE_CONFIG_IN_SENSE_TOGGLE(hi_accu)   \
-    {                                            \
-        .is_watcher = false,                     \
-        .hi_accuracy = hi_accu,                  \
-        .pull = NRF_GPIO_PIN_NOPULL,             \
-        .sense = NRF_GPIOTE_POLARITY_TOGGLE,     \
-    }
-
-/**@brief Output pin configuration. */
-typedef struct
-{
-    nrf_gpiote_polarity_t action;    /**< Configuration of the pin task. */
-    nrf_gpiote_outinit_t  init_state; /**< Initial state of the output pin. */
-    bool                  task_pin;  /**< True if the pin is controlled by a GPIOTE task. */
-} nrf_drv_gpiote_out_config_t;
-
-/**@brief Macro for configuring a pin to use as output. GPIOTE is not used for the pin. */
-#define GPIOTE_CONFIG_OUT_SIMPLE(init_high)                                                        \
-    {                                                                                              \
-        .init_state = init_high ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW,    \
-        .task_pin = false,                                                                         \
-    }
-
-/**@brief Macro for configuring a pin to use the GPIO OUT TASK to change the state from high to low.
- * @details The task will clear the pin. Therefore, the pin is set initially.  */
-#define GPIOTE_CONFIG_OUT_TASK_LOW                                                                 \
-    {                                                                                              \
-        .init_state = NRF_GPIOTE_INITIAL_VALUE_HIGH,                                               \
-        .task_pin   = true,                                                                        \
-        .action     = NRF_GPIOTE_POLARITY_HITOLO,                                                  \
-    }
-
-/**@brief Macro for configuring a pin to use the GPIO OUT TASK to change the state from low to high.
- * @details The task will set the pin. Therefore, the pin is cleared initially.  */
-#define GPIOTE_CONFIG_OUT_TASK_HIGH                                                                \
-    {                                                                                              \
-        .init_state = NRF_GPIOTE_INITIAL_VALUE_LOW,                                                \
-        .task_pin   = true,                                                                        \
-        .action     = NRF_GPIOTE_POLARITY_LOTOHI,                                                  \
-    }
-
-/**@brief Macro for configuring a pin to use the GPIO OUT TASK to toggle the pin state.
- * @details The initial pin state must be provided.  */
-#define GPIOTE_CONFIG_OUT_TASK_TOGGLE(init_high)                                                   \
-    {                                                                                              \
-        .init_state = init_high ? NRF_GPIOTE_INITIAL_VALUE_HIGH : NRF_GPIOTE_INITIAL_VALUE_LOW,    \
-        .task_pin   = true,                                                                        \
-        .action     = NRF_GPIOTE_POLARITY_TOGGLE,                                                  \
-    }
-
-/** @brief Pin. */
-typedef uint32_t nrf_drv_gpiote_pin_t;
-
-/**
- * @brief Pin event handler prototype.
- * @param pin    Pin that triggered this event.
- * @param action Action that lead to triggering this event.
- */
-typedef void (*nrf_drv_gpiote_evt_handler_t)(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action);
-
-/**
- * @brief Function for initializing the GPIOTE module.
- *
- * @details Only static configuration is supported to prevent the shared 
- * resource being customized by the initiator.
- *
- * @retval    NRF_SUCCESS If initialization was successful.
- * @retval    NRF_ERROR_INVALID_STATE If the driver was already initialized.
- */
-ret_code_t nrf_drv_gpiote_init(void);
-
-/**
- * @brief Function for checking if the GPIOTE module is initialized.
- *
- * @details The GPIOTE module is a shared module. Therefore, you should check if
- * the module is already initialized and skip initialization if it is.
- *
- * @retval    true  If the module is already initialized.
- * @retval    false If the module is not initialized.
- */
-bool nrf_drv_gpiote_is_init(void);
-
-/**
- * @brief Function for uninitializing the GPIOTE module.
- */
-void nrf_drv_gpiote_uninit(void);
-
-/**
- * @brief Function for initializing a GPIOTE output pin.
- * @details The output pin can be controlled by the CPU or by PPI. The initial 
- * configuration specifies which mode is used. If PPI mode is used, the driver 
- * attempts to allocate one of the available GPIOTE channels. If no channel is
- * available, an error is returned.
- *
- * @param[in] pin       Pin.
- * @param[in] p_config  Initial configuration.
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the driver is not initialized or the pin is already used.
- * @retval NRF_ERROR_NO_MEM        If no GPIOTE channel is available.
- */
-ret_code_t nrf_drv_gpiote_out_init(nrf_drv_gpiote_pin_t pin,
-                                   nrf_drv_gpiote_out_config_t const * p_config);
-
-/**
- * @brief Function for uninitializing a GPIOTE output pin.
- * @details The driver frees the GPIOTE channel if the output pin was using one.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_out_uninit(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for setting a GPIOTE output pin.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_out_set(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for clearing a GPIOTE output pin.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_out_clear(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for toggling a GPIOTE output pin.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_out_toggle(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for enabling a GPIOTE output pin task.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_out_task_enable(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for disabling a GPIOTE output pin task.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_out_task_disable(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for getting the address of a configurable GPIOTE task.
- *
- * @param[in] pin       Pin. 
- */
-uint32_t nrf_drv_gpiote_out_task_addr_get(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for initializing a GPIOTE input pin.
- * @details The input pin can act in two ways: 
- * - lower accuracy but low power (high frequency clock not needed)
- * - higher accuracy (high frequency clock required)
- *
- * The initial configuration specifies which mode is used.
- * If high-accuracy mode is used, the driver attempts to allocate one 
- * of the available GPIOTE channels. If no channel is 
- * available, an error is returned.
- * In low accuracy mode SENSE feature is used. In this case only one active pin
- * can be detected at a time. It can be worked around by setting all of the used
- * low accuracy pins to toggle mode.
- * For more information about SENSE functionality, refer to Product Specification.
- *
- * @param[in] pin       Pin. 
- * @param[in] p_config    Initial configuration. 
- * @param[in] evt_handler User function to be called when the configured transition occurs. 
- *
- * @retval NRF_SUCCESS             If initialization was successful.
- * @retval NRF_ERROR_INVALID_STATE If the driver is not initialized or the pin is already used.
- * @retval NRF_ERROR_NO_MEM        If no GPIOTE channel is available.
- */
-ret_code_t nrf_drv_gpiote_in_init(nrf_drv_gpiote_pin_t pin, 
-                                  nrf_drv_gpiote_in_config_t const * p_config,
-                                  nrf_drv_gpiote_evt_handler_t evt_handler);
-
-/**
- * @brief Function for uninitializing a GPIOTE input pin.
- * @details The driver frees the GPIOTE channel if the input pin was using one.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_in_uninit(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for enabling sensing of a GPIOTE input pin.
- *
- * @details If the input pin is configured as high-accuracy pin, the function 
- * enables an IN_EVENT. Otherwise, the function enables the GPIO sense mechanism.
- * Note that a PORT event is shared between multiple pins, therefore the 
- * interrupt is always enabled.
- *
- * @param[in] pin       Pin. 
- * @param[in] int_enable  True to enable the interrupt. Always valid for a high-accuracy pin.
- */
-void nrf_drv_gpiote_in_event_enable(nrf_drv_gpiote_pin_t pin, bool int_enable);
-
-/**
- * @brief Function for disabling a GPIOTE input pin.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_in_event_disable(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for checking if a GPIOTE input pin is set.
- *
- * @param[in] pin       Pin. 
- * @retval    true If the input pin is set.
- * @retval    false If the input pin is not set.
- */
-bool nrf_drv_gpiote_in_is_set(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for getting the address of a GPIOTE input pin event.
- * @details If the pin is configured to use low-accuracy mode, the address of the PORT event is returned.
- *
- * @param[in] pin       Pin. 
- */
-uint32_t nrf_drv_gpiote_in_event_addr_get(nrf_drv_gpiote_pin_t pin);
-
-/**
- * @brief Function for forcing a specific state on the pin configured as task.
- *
- * @param[in] pin       Pin. 
- * @param[in] state     Pin state.
- */
-void nrf_drv_gpiote_out_task_force(nrf_drv_gpiote_pin_t pin, uint8_t state);
-
-/**
- * @brief Function for triggering the task manually.
- *
- * @param[in] pin       Pin. 
- */
-void nrf_drv_gpiote_out_task_trigger(nrf_drv_gpiote_pin_t pin);
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //NRF_DRV_GPIOTE__

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/hal/nrf_adc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_adc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_adc.c
deleted file mode 100644
index 259db2c..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_adc.c
+++ /dev/null
@@ -1,78 +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
- * @brief ADC HAL implementation
- */
-
-#include "nrf_adc.h"
-
-#ifndef NRF52
-
-/**
- * @brief Function for configuring ADC.
- *
- * This function powers on ADC and configures it. ADC is in DISABLE state after configuration,
- * so it should be enabled before using it.
- *
- * @param[in] config  Requested configuration.
- */
-void nrf_adc_configure(nrf_adc_config_t * config)
-{
-    uint32_t config_reg = 0;
-
-    config_reg |= ((uint32_t)config->resolution << ADC_CONFIG_RES_Pos) & ADC_CONFIG_RES_Msk;
-    config_reg |= ((uint32_t)config->scaling << ADC_CONFIG_INPSEL_Pos) & ADC_CONFIG_INPSEL_Msk;
-    config_reg |= ((uint32_t)config->reference << ADC_CONFIG_REFSEL_Pos) & ADC_CONFIG_REFSEL_Msk;
-
-    if (config->reference & ADC_CONFIG_EXTREFSEL_Msk)
-    {
-        config_reg |= config->reference & ADC_CONFIG_EXTREFSEL_Msk;
-    }
-
-    /* select input */
-    nrf_adc_input_select(NRF_ADC_CONFIG_INPUT_DISABLED);
-
-    /* set new configuration keeping selected input */
-    NRF_ADC->CONFIG = config_reg | (NRF_ADC->CONFIG & ADC_CONFIG_PSEL_Msk);
-}
-
-
-/**
- * @brief Blocking function for executing single ADC conversion.
- *
- * This function selects the desired input, starts a single conversion,
- * waits for it to finish, and returns the result.
- * ADC is left in STOP state, the given input is selected.
- * This function does not check if ADC is initialized and powered.
- *
- * @param[in] input Requested input to be selected.
- *
- * @return Conversion result
- */
-int32_t nrf_adc_convert_single(nrf_adc_config_input_t input)
-{
-    int32_t val;
-
-    nrf_adc_input_select(input);
-    nrf_adc_start();
-
-    while (!nrf_adc_conversion_finished())
-    {
-    }
-    nrf_adc_conversion_event_clean();
-    val = nrf_adc_result_get();
-    nrf_adc_stop();
-    return val;
-}
-#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/drivers_nrf/hal/nrf_adc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_adc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_adc.h
deleted file mode 100644
index 56fce31..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_adc.h
+++ /dev/null
@@ -1,424 +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.
- *
- */
-
-#ifndef NRF_ADC_H_
-#define NRF_ADC_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_adc_hal ADC HAL
- * @{
- * @ingroup nrf_adc
- * @brief @tagAPI51 Hardware access layer for managing the analog-to-digital converter (ADC).
- */
-
-#include <stdbool.h>
-#include <stddef.h>
-
-#include "nrf.h"
-
-#ifndef NRF52
-/**
- * @enum  nrf_adc_config_resolution_t
- * @brief Resolution of the analog-to-digital converter.
- */
-
-/**
- * @brief ADC interrupts.
- */
-typedef enum
-{
-    NRF_ADC_INT_END_MASK  = ADC_INTENSET_END_Msk,   /**< ADC interrupt on END event. */
-} nrf_adc_int_mask_t;
-
-typedef enum
-{
-    NRF_ADC_CONFIG_RES_8BIT  = ADC_CONFIG_RES_8bit,  /**< 8 bit resolution. */
-    NRF_ADC_CONFIG_RES_9BIT  = ADC_CONFIG_RES_9bit,  /**< 9 bit resolution. */
-    NRF_ADC_CONFIG_RES_10BIT = ADC_CONFIG_RES_10bit, /**< 10 bit resolution. */
-} nrf_adc_config_resolution_t;
-
-
-/**
- * @enum nrf_adc_config_scaling_t
- * @brief Scaling factor of the analog-to-digital conversion.
- */
-typedef enum
-{
-    NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE  = ADC_CONFIG_INPSEL_AnalogInputNoPrescaling,        /**< Full scale input. */
-    NRF_ADC_CONFIG_SCALING_INPUT_TWO_THIRDS  = ADC_CONFIG_INPSEL_AnalogInputTwoThirdsPrescaling, /**< 2/3 scale input. */
-    NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD   = ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling,  /**< 1/3 scale input. */
-    NRF_ADC_CONFIG_SCALING_SUPPLY_TWO_THIRDS = ADC_CONFIG_INPSEL_SupplyTwoThirdsPrescaling,      /**< 2/3 of supply. */
-    NRF_ADC_CONFIG_SCALING_SUPPLY_ONE_THIRD  = ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling        /**< 1/3 of supply. */
-} nrf_adc_config_scaling_t;
-
-/**
- * @enum nrf_adc_config_reference_t
- * @brief Reference selection of the analog-to-digital converter.
- */
-typedef enum
-{
-    NRF_ADC_CONFIG_REF_VBG              = ADC_CONFIG_REFSEL_VBG,                      /**< 1.2 V reference. */
-    NRF_ADC_CONFIG_REF_SUPPLY_ONE_HALF  = ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling,  /**< 1/2 of power supply. */
-    NRF_ADC_CONFIG_REF_SUPPLY_ONE_THIRD = ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling, /**< 1/3 of power supply. */
-    NRF_ADC_CONFIG_REF_EXT_REF0         = ADC_CONFIG_REFSEL_External |
-                                          ADC_CONFIG_EXTREFSEL_AnalogReference0 <<
-    ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */
-        NRF_ADC_CONFIG_REF_EXT_REF1 = ADC_CONFIG_REFSEL_External |
-                                  ADC_CONFIG_EXTREFSEL_AnalogReference1 << ADC_CONFIG_EXTREFSEL_Pos, /**< External reference 0. */
-} nrf_adc_config_reference_t;
-
-/**
- * @enum nrf_adc_config_input_t
- * @brief Input selection of the analog-to-digital converter.
- */
-typedef enum
-{
-    NRF_ADC_CONFIG_INPUT_DISABLED = ADC_CONFIG_PSEL_Disabled,     /**< No input selected. */
-    NRF_ADC_CONFIG_INPUT_0        = ADC_CONFIG_PSEL_AnalogInput0, /**< Input 0. */
-    NRF_ADC_CONFIG_INPUT_1        = ADC_CONFIG_PSEL_AnalogInput1, /**< Input 1. */
-    NRF_ADC_CONFIG_INPUT_2        = ADC_CONFIG_PSEL_AnalogInput2, /**< Input 2. */
-    NRF_ADC_CONFIG_INPUT_3        = ADC_CONFIG_PSEL_AnalogInput3, /**< Input 3. */
-    NRF_ADC_CONFIG_INPUT_4        = ADC_CONFIG_PSEL_AnalogInput4, /**< Input 4. */
-    NRF_ADC_CONFIG_INPUT_5        = ADC_CONFIG_PSEL_AnalogInput5, /**< Input 5. */
-    NRF_ADC_CONFIG_INPUT_6        = ADC_CONFIG_PSEL_AnalogInput6, /**< Input 6. */
-    NRF_ADC_CONFIG_INPUT_7        = ADC_CONFIG_PSEL_AnalogInput7, /**< Input 7. */
-} nrf_adc_config_input_t;
-
-/**
- * @enum nrf_adc_task_t
- * @brief Analog-to-digital converter tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_ADC_TASK_START = offsetof(NRF_ADC_Type, TASKS_START), /**< ADC start sampling task. */
-    NRF_ADC_TASK_STOP  = offsetof(NRF_ADC_Type, TASKS_STOP)   /**< ADC stop sampling task. */
-    /*lint -restore*/
-} nrf_adc_task_t;
-
-/**
- * @enum nrf_adc_event_t
- * @brief Analog-to-digital converter events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    /*lint -save -e30*/
-    NRF_ADC_EVENT_END = offsetof(NRF_ADC_Type, EVENTS_END) /**< End of conversion event. */
-    /*lint -restore*/
-} nrf_adc_event_t;
-
-/**@brief Analog-to-digital converter configuration. */
-typedef struct
-{
-    nrf_adc_config_resolution_t resolution; /**< ADC resolution. */
-    nrf_adc_config_scaling_t    scaling;    /**< ADC scaling factor. */
-    nrf_adc_config_reference_t  reference;  /**< ADC reference. */
-} nrf_adc_config_t;
-
-/** Default ADC configuration. */
-#define NRF_ADC_CONFIG_DEFAULT { NRF_ADC_CONFIG_RES_10BIT,               \
-                                 NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD, \
-                                 NRF_ADC_CONFIG_REF_VBG }
-
-/**
- * @brief Function for configuring ADC.
- *
- * This function powers on the analog-to-digital converter and configures it. 
- * After the configuration, the ADC is in DISABLE state and must be
- * enabled before using it.
- *
- * @param[in] config Configuration parameters.
- */
-void nrf_adc_configure(nrf_adc_config_t * config);
-
-/**
- * @brief Blocking function for executing a single ADC conversion.
- *
- * This function selects the desired input, starts a single conversion,
- * waits for it to finish, and returns the result.
- * After the input is selected, the analog-to-digital converter
- * is left in STOP state.
- * The function does not check if the ADC is initialized and powered.
- *
- * @param[in] input Input to be selected.
- *
- * @return Conversion result.
- */
-int32_t nrf_adc_convert_single(nrf_adc_config_input_t input);
-
-/**
- * @brief Function for selecting ADC input.
- *
- * This function selects the active input of ADC. Ensure that
- * the ADC is powered on and in IDLE state before calling this function.
- *
- * @param[in] input Input to be selected.
- */
-__STATIC_INLINE void nrf_adc_input_select(nrf_adc_config_input_t input)
-{
-    NRF_ADC->CONFIG =
-        ((uint32_t)input << ADC_CONFIG_PSEL_Pos) | (NRF_ADC->CONFIG & ~ADC_CONFIG_PSEL_Msk);
-
-    if (input != NRF_ADC_CONFIG_INPUT_DISABLED)
-    {
-        NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled << ADC_ENABLE_ENABLE_Pos;
-    }
-    else
-    {
-        NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled << ADC_ENABLE_ENABLE_Pos;
-    }
-}
-
-
-/**
- * @brief Function for retrieving the ADC conversion result.
- *
- * This function retrieves and returns the last analog-to-digital conversion result.
- *
- * @return Last conversion result.
- */
-__STATIC_INLINE int32_t nrf_adc_result_get(void)
-{
-    return (int32_t)NRF_ADC->RESULT;
-}
-
-
-/**
- * @brief Function for checking whether the ADC is busy.
- *
- * This function checks whether the analog-to-digital converter is busy with a conversion.
- *
- * @retval true If the ADC is busy.
- * @retval false If the ADC is not busy.
- */
-__STATIC_INLINE bool nrf_adc_is_busy(void)
-{
-    return ( (NRF_ADC->BUSY & ADC_BUSY_BUSY_Msk) == ADC_BUSY_BUSY_Msk);
-}
-
-/**
- * @brief Function for getting the ADC's enabled interrupts.
- *
- * @param[in] mask Mask of interrupts to check.
- *
- * @return State of the interrupts selected by the mask.
- *
- * @sa nrf_adc_int_enable()
- * @sa nrf_adc_int_disable()
- */
-__STATIC_INLINE uint32_t nrf_adc_int_get(uint32_t mask)
-{
-    return (NRF_ADC->INTENSET & mask); // when read this register will return the value of INTEN.
-}
-
-
-/**
- * @brief Function for starting conversion.
- *
- * @sa nrf_adc_stop()
- *
- */
-__STATIC_INLINE void nrf_adc_start(void)
-{
-    NRF_ADC->TASKS_START = 1;
-}
-
-
-/**
- * @brief Function for stopping conversion. 
- *
- * If the analog-to-digital converter is in inactive state, power consumption is reduced.
- *
- * @sa nrf_adc_start()
- *
- */
-__STATIC_INLINE void nrf_adc_stop(void)
-{
-    NRF_ADC->TASKS_STOP = 1;
-}
-
-
-/**
- * @brief Function for checking if the requested ADC conversion has ended.
- *
- * @retval true If the task has finished.
- * @retval false If the task is still running.
- */
-__STATIC_INLINE bool nrf_adc_conversion_finished(void)
-{
-    return ((bool)NRF_ADC->EVENTS_END);
-}
-
-/**
- * @brief Function for clearing the conversion END event.
- */
-__STATIC_INLINE void nrf_adc_conversion_event_clean(void)
-{
-    NRF_ADC->EVENTS_END = 0;
-}
-
-/**
- * @brief Function for getting the address of an ADC task register.
- *
- * @param[in] adc_task ADC task.
- *
- * @return Address of the specified ADC task.
- */
-__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task);
-
-/**
- * @brief Function for getting the address of a specific ADC event register.
- *
- * @param[in] adc_event ADC event.
- *
- * @return Address of the specified ADC event.
- */
-__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event);
-
-/**
- * @brief Function for setting the CONFIG register in ADC.
- *
- * @param[in] configuration Value to be written to the CONFIG register.
- */
-__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration);
-
-/**
- * @brief Function for clearing an ADC event.
- *
- * @param[in] event Event to clear.
- */
-__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event);
-
-/**
- * @brief Function for checking state of an ADC event.
- *
- * @param[in] event Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] int_mask  Interrupts to enable.
- */
-__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] int_mask  Interrupts to disable.
- */
-__STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] int_mask Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask);
-
-/**
- * @brief Function for activating a specific ADC task.
- *
- * @param[in] task Task to activate.
- */
-__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task);
-
-/**
- * @brief Function for enabling ADC.
- *
- */
-__STATIC_INLINE void nrf_adc_enable(void);
-
-/**
- * @brief Function for disabling ADC.
- *
- */
-__STATIC_INLINE void nrf_adc_disable(void);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE uint32_t nrf_adc_task_address_get(nrf_adc_task_t adc_task)
-{
-    return (uint32_t)((uint8_t *)NRF_ADC + adc_task);
-}
-
-__STATIC_INLINE uint32_t nrf_adc_event_address_get(nrf_adc_event_t adc_event)
-{
-    return (uint32_t)((uint8_t *)NRF_ADC + adc_event);
-}
-
-__STATIC_INLINE void nrf_adc_config_set(uint32_t configuration)
-{
-    NRF_ADC->CONFIG = configuration;
-}
-
-__STATIC_INLINE void nrf_adc_event_clear(nrf_adc_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_adc_event_check(nrf_adc_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_adc_int_enable(uint32_t int_mask)
-{
-    NRF_ADC->INTENSET = int_mask;
-}
-
-__STATIC_INLINE void nrf_adc_int_disable(uint32_t int_mask)
-{
-    NRF_ADC->INTENCLR = int_mask;
-}
-
-__STATIC_INLINE bool nrf_adc_int_enable_check(nrf_adc_int_mask_t int_mask)
-{
-    return (bool)(NRF_ADC->INTENSET & int_mask);
-}
-
-__STATIC_INLINE void nrf_adc_task_trigger(nrf_adc_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_ADC + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE void nrf_adc_enable(void)
-{
-    NRF_ADC->ENABLE = 1;
-}
-
-__STATIC_INLINE void nrf_adc_disable(void)
-{
-    NRF_ADC->ENABLE = 0;
-}
-#endif
-#endif /* NRF52 */
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_ADC_H_ */


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

Posted by cc...@apache.org.
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/serialization/common/ble_serialization.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ble_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ble_serialization.h
deleted file mode 100644
index b093fcc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ble_serialization.h
+++ /dev/null
@@ -1,590 +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.
- *
- */
-
-#ifndef BLE_SERIALIZATION_H__
-#define BLE_SERIALIZATION_H__
-
-#include "nordic_common.h"
-#include "nrf_error.h"
-#include <stdint.h>
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**@brief The types of serialization packets. */
-typedef enum
-{
-    SER_PKT_TYPE_CMD = 0,     /**< Command packet type. */
-    SER_PKT_TYPE_RESP,        /**< Command Response packet type. */
-    SER_PKT_TYPE_EVT,         /**< Event packet type. */
-    SER_PKT_TYPE_DTM_CMD,     /**< DTM Command packet type. */
-    SER_PKT_TYPE_DTM_RESP,    /**< DTM Response packet type. */
-    SER_PKT_TYPE_RESET_CMD,   /**< System Reset Command packet type. */
-    SER_PKT_TYPE_MAX          /**< Upper bound. */
-} ser_pkt_type_t;
-
-#define  LOW16(a) ((uint16_t)((a & 0x0000FFFF) >> 0))
-#define HIGH16(a) ((uint16_t)((a & 0xFFFF0000) >> 16))
-
-//lint -esym(516,__INTADDR__) Symbol '__INTADDR__()' has arg. type conflict
-//lint -esym(628,__INTADDR__) no argument information provided for function '__INTADDR__()'
-
-/** Size in bytes of the Error Code field in a Command Response packet. */
-#define SER_ERR_CODE_SIZE              4
-/** Size in bytes of the Packet Type field (@ref ser_pkt_type_t). */
-#define SER_PKT_TYPE_SIZE              1
-/** Size in bytes of the Operation Code field. */
-#define SER_OP_CODE_SIZE               1
-
-/** Position of the Packet Type field in a serialized packet buffer. */
-#define SER_PKT_TYPE_POS               0
-/** Position of the Operation Code field in a serialized packet buffer. */
-#define SER_PKT_OP_CODE_POS            (SER_PKT_TYPE_SIZE)
-/** Position of the Data in a serialized packet buffer. */
-#define SER_PKT_DATA_POS               (SER_PKT_TYPE_SIZE + SER_OP_CODE_SIZE)
-
-/** Position of the Operation Code field in a command buffer. */
-#define SER_CMD_OP_CODE_POS            0
-/** Position of the Data in a command buffer.*/
-#define SER_CMD_DATA_POS               (SER_OP_CODE_SIZE)
-/** Size of the Command header. */
-#define SER_CMD_HEADER_SIZE            (SER_OP_CODE_SIZE)
-/** Size of the Command Response header. */
-#define SER_CMD_RSP_HEADER_SIZE        (SER_OP_CODE_SIZE + SER_ERR_CODE_SIZE)
-/** Position of the Command Response code. */
-#define SER_CMD_RSP_STATUS_CODE_POS    (SER_OP_CODE_SIZE)
-
-/** Size of event ID field. */
-#define SER_EVT_ID_SIZE                2
-/** Position of event ID field. */
-#define SER_EVT_ID_POS                 0
-/** Size of event header. */
-#define SER_EVT_HEADER_SIZE            (SER_EVT_ID_SIZE)
-/** Size of event connection handler. */
-#define SER_EVT_CONN_HANDLE_SIZE       2
-
-/** Position of the Op Code in the DTM command buffer.*/
-#define SER_DTM_CMD_OP_CODE_POS        0
-/** Position of the data in the DTM command buffer.*/
-#define SER_DTM_CMD_DATA_POS           1
-
-/** Position of the Op Code in the DTM command response buffer.*/
-#define SER_DTM_RESP_OP_CODE_POS       1
-/** Position of the status field in the DTM command response buffer.*/
-#define SER_DTM_RESP_STATUS_POS        2
-
-/** Value to indicate that an optional field is encoded in the serialized packet, e.g. white list.*/
-#define SER_FIELD_PRESENT              0x01
-/** Value to indicate that an optional field is not encoded in the serialized packet. */
-#define SER_FIELD_NOT_PRESENT          0x00
-
-
-/** Enable SER_ASSERT<*> assserts */
-#define SER_ASSERTS_ENABLED 1
-
-/** Returns with error code if expr is not true. It is used for checking error which should be
- * checked even when SER_ASSERTS_ENABLED is not set. */
-#define SER_ERROR_CHECK(expr, error_code) do { if (!(expr)) return (error_code); } while (0)
-
-#ifdef SER_ASSERTS_ENABLED
-/** Returns with error code if expr is not true. */
-#define SER_ASSERT(expr, error_code) SER_ERROR_CHECK(expr, error_code)
-/** Returns with  if expr is not true. */
-#define SER_ASSERT_VOID_RETURN(expr) do { if (!(expr)) return; } while (0)
-/** Returns with  \ref NRF_ERROR_INVALID_LENGTH if len is not less or equal to maxlen. */
-#define SER_ASSERT_LENGTH_LEQ(len, maxlen) \
-    SER_ASSERT((len) <= (maxlen), NRF_ERROR_INVALID_LENGTH)
-/** Returns with  \ref NRF_ERROR_INVALID_LENGTH if actual_len is not equal to expected_len. */
-#define SER_ASSERT_LENGTH_EQ(actual_len, expected_len) \
-    SER_ASSERT((actual_len) == (expected_len), NRF_ERROR_INVALID_LENGTH)
-/** Returns with  \ref NRF_ERROR_NULL if pointer is null. */
-#define SER_ASSERT_NOT_NULL(ptr) SER_ASSERT((ptr) != NULL, NRF_ERROR_NULL)
-#else
-#define SER_ASSERT(expr, error_code)
-#define SER_ASSERT_VOID_RETURN(expr)
-#define SER_ASSERT_LENGTH_LEQ(len, maxlen) UNUSED_VARIABLE(maxlen)
-#define SER_ASSERT_LENGTH_EQ(actual_len, expected_len)
-#define SER_ASSERT_NOT_NULL(ptr)
-#endif
-
-/** Maximum length of p_value in \ref ble_gattc_write_params_t. See Bluetooth 4.0 spec: 3.4.5.1 and
- *  3.4.5.3. */
-#define BLE_GATTC_WRITE_P_VALUE_LEN_MAX    (GATT_MTU_SIZE_DEFAULT - 3)
-
-/** See Bluetooth 4.0 spec: 3.4.4.7. */
-#define BLE_GATTC_HANDLE_COUNT_LEN_MAX     ((GATT_MTU_SIZE_DEFAULT - 1) / 2)
-
-/** Generic command response status code encoder. */
-uint32_t ser_ble_cmd_rsp_status_code_enc(uint8_t          op_code,
-                                         uint32_t         command_status,
-                                         uint8_t * const  p_buf,
-                                         uint32_t * const p_buf_len);
-
-/** Generic command response result code decoder. */
-uint32_t ser_ble_cmd_rsp_result_code_dec(uint8_t const * const p_buf,
-                                         uint32_t * const      p_pos,
-                                         uint32_t              packet_len,
-                                         uint8_t               op_code,
-                                         uint32_t * const      p_result_code);
-
-/** Generic command response decoder. */
-uint32_t ser_ble_cmd_rsp_dec(uint8_t const * const p_buf,
-                             uint32_t              packet_len,
-                             uint8_t               op_code,
-                             uint32_t * const      p_result_code);
-
-/**@brief Function for safe encoding an uint16 value.
- *
- * Safe decoding of an uint16 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_field          Uint16 value to be encoded.
- * @param[out]     p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint16 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t uint16_t_enc(const void * const p_field,
-                      uint8_t * const    p_buf,
-                      uint32_t           buf_len,
-                      uint32_t * const   p_index);
-
-/**@brief Function for safe decoding an uint16 value.
- *
- * Safe decoding of an uint16 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint16 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     p_field          Pointer to the location where uint16 value will be decoded.
- */
-uint32_t uint16_t_dec(uint8_t const * const p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index,
-                      void *                p_field);
-
-/**@brief Function for safe decoding an uint16 value.
- *
- * Safe decoding of an uint16 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  index            \c in: Index to start of uint16 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     value            Decoded uint16 value.
- */
-void uint16_dec(uint8_t const * const p_buf,
-                uint32_t              packet_len,
-                uint32_t * const      index,
-                uint16_t * const      value);
-
-/**@brief Function for safe encoding an uint18 value.
- *
- * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index            \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     p_field          Pointer to uint8 value to be encoded.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t uint8_t_enc(const void * const p_field,
-                     uint8_t * const    p_buf,
-                     uint32_t           buf_len,
-                     uint32_t * const   p_index);
-
-/**@brief Function for safe decoding an uint8 value.
- *
- * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     p_field          Pointer to the location for decoded uint8 value.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t uint8_t_dec(uint8_t const * const p_buf,
-                     uint32_t              buf_len,
-                     uint32_t * const      p_index,
-                     void *                p_field);
-
-/**@brief Function for safe decoding an uint8 value.
- *
- * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  index            \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     value            Decoded uint8 value.
- */
-void uint8_dec(uint8_t const * const p_buf,
-               uint32_t              packet_len,
-               uint32_t * const      index,
-               uint8_t * const       value);
-
-/**@brief Function for safe decoding an uint18 value.
- *
- * Safe decoding of an uint8 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  index            \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     value            Decoded uint8 value.
- */
-void int8_dec(uint8_t const * const p_buf,
-              uint32_t              packet_len,
-              uint32_t * const      index,
-              int8_t * const        value);
-
-/**@brief Function for safe encoding variable length field encoded as length(8bit)+data.
- *
- * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[out]     p_data           Pointer to data to encode.
- * @param[in]      dlen             Length of data to encode (0-255).
- * @param[out]     p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t len8data_enc(uint8_t const * const p_data,
-                      uint8_t const         dlen,
-                      uint8_t * const       p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index);
-
-/**@brief Function for safe decoding variable length field encoded as length(8bit)+data.
- *
- * Safe decoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     pp_data          Pointer to pointer to decoded data (p_data is set to NULL in
- *                                  case data is not present in the buffer).
- * @param[out]     p_len            Decoded length (0-255).
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t len8data_dec(uint8_t const * const p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index,
-                      uint8_t * * const     pp_data,
-                      uint8_t * const       p_len);
-
-/**@brief Function for safe encoding variable length field encoded as length(16bit)+data.
- *
- * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * It is possible that provided p_data is NULL in that case length is encoded and it's followed by
- * SER_FIELD_NOT_PRESENT flag. SER_FIELD_PRESENT flag preceeds data otherwise.
- *
- * @param[in]      p_data           Data to encode.
- * @param[in]      dlen             Input data length (16bit).
- * @param[in]      p_buf            Pointer to the beginning of the output buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the encoded data.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t len16data_enc(uint8_t const * const p_data,
-                       uint16_t const        dlen,
-                       uint8_t * const       p_buf,
-                       uint32_t              buf_len,
-                       uint32_t * const      p_index);
-
-/**@brief Function for safe decoding variable length field encoded as length(16bit)+data.
- *
- * Safe decoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * Encoded data consist of length field, presence flag and conditional data (present only is presence flag
- * is set). p_data pointer is required to be not NULL only is presence flag is set.
- *
- * @param[in]      p_buf            Pointer to the beginning of the input buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded data.
- * @param[in]      pp_data          Pointer to pointer to decoded data.
- * @param[in]      p_dlen             data length (16bit).
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t len16data_dec(uint8_t const * const p_buf,
-                       uint32_t              buf_len,
-                       uint32_t * const      p_index,
-                       uint8_t * * const     pp_data,
-                       uint16_t * const      p_dlen);
-
-
-/**@brief Function for safe encoding of uint16 table with a given element count.
- *
- * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * It is possible that provided p_data is NULL in that case length is encoded and it's followed by
- * SER_FIELD_NOT_PRESENT flag. SER_FIELD_PRESENT flag precedes data otherwise.
- *
- * @param[in]      p_data           Data table to encode.
- * @param[in]      count            Table element count.
- * @param[in]      p_buf            Pointer to the beginning of the output buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the encoded data.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-
-uint32_t count16_cond_data16_enc(uint16_t const * const p_data,
-                                 uint16_t const         count,
-                                 uint8_t * const        p_buf,
-                                 uint32_t               buf_len,
-                                 uint32_t * const       p_index);
-
-/**@brief Function for safe decoding of uint16 table with a given element count.
- *
- * Safe encoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * It is possible that provided p_data is NULL in that case length is encoded and it's followed by
- * SER_FIELD_NOT_PRESENT flag. SER_FIELD_PRESENT flag precedes data otherwise.
- *
- * @param[in]      p_buf            Pointer to the beginning of the output buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the encoded data.
- * @param[in]      pp_data           Pointer to pointer to the table to encode.
- * @param[in,out]  p_count           Pointer to table element count - initialised with max count
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_DATA_SIZE      Decoding failure. Initial count is smaller than actual.
- */
-
-uint32_t count16_cond_data16_dec(uint8_t const * const p_buf,
-                                 uint32_t              buf_len,
-                                 uint32_t * const      p_index,
-                                 uint16_t * * const    pp_data,
-                                 uint16_t * const      p_count);
-
-
-/**@brief Function for safe decoding of variable length field encoded as length(16bit)+data.
- *
- * Safe decoding of an variable length field. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * Encoded data consist of presence flag, optional length field, second presence flag and optional data.
- *
- *
- * @param[in]      p_buf            Pointer to the beginning of the input buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded data.
- * @param[out]     pp_data           Pointer to decoded data.
- * @param[out]     pp_len            data length (16bit).
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-
-uint32_t cond_len16_cond_data_dec(uint8_t const * const p_buf,
-                                  uint32_t              buf_len,
-                                  uint32_t * const      p_index,
-                                  uint8_t * * const     pp_data,
-                                  uint16_t * * const    pp_len);
-
-
-/**@brief Command response encoder - replacement of - ser_ble_cmd_rsp_status_code_enc
- * with layout aligned to the rest of encoder functions
- *
- * @param[in]      op_code          Operation code - see BLE_GAP_SVCS
- * @param[in]      return_code      nRF Error Code.
- * @param[in]      p_buff           pointer to the start of pointer to decoded data.
- * @param[in,out]  p_buff_len       \c in: size of buffer
- *                                  \c out: used bytes in buffer
- * @param[in,out]  p_buff_len       \c in: initial offset in buffer
- *                                  \c out: final offset in buffer
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_NULL           Invalid pointer
- */
-uint32_t op_status_enc(uint8_t          op_code,
-                       uint32_t         return_code,
-                       uint8_t * const  p_buff,
-                       uint32_t * const p_buff_len,
-                       uint32_t * const p_index);
-
-/**@brief command response encoder with conditional 16bit field
- *
- * @param[in]      op_code          Operation code - see BLE_GAP_SVCS
- * @param[in]      return_code      nRF Error Code.
- * @param[in]      value            optional 16bit field encoded for return code == NRF_SUCCESS
- * @param[in]      p_buff           pointer to the start of pointer to decoded data.
- * @param[in,out]  p_buff_len       \c in: size of buffer
- *                                  \c out: used bytes in buffer
- * @param[in,out]  p_buff_len       \c in: initial offset in buffer
- *                                  \c out: final offset in buffer
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- * @retval NRF_ERROR_NULL           Invalid pointer
- */
-
-uint32_t op_status_cond_uint16_enc(uint8_t          op_code,
-                                   uint32_t         return_code,
-                                   uint16_t         value,
-                                   uint8_t * const  p_buff,
-                                   uint32_t * const p_buff_len,
-                                   uint32_t * const p_index);
-
-/**@brief Function for safe encoding a buffer of known size.
- *
- * Safe encoding of a buffer. Encoder assumes that size is known to the decoder and it is not
- * encoded here. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_data           Data to encode.
- * @param[in]      dlen             Input data length (16bit).
- * @param[in]      p_buf            Pointer to the beginning of the output buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the encoded data.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t buf_enc(uint8_t const * const p_data,
-                 uint16_t const        dlen,
-                 uint8_t * const       p_buf,
-                 uint32_t              buf_len,
-                 uint32_t * const      p_index);
-
-/**@brief Function for safe decoding a buffer of known size.
- *
- * Safe decoding of buffer of known size. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * Encoded data consist of presence flag and conditional data (present only is presence flag
- * is set). p_data pointer is required to be not NULL only is presence flag is set. Length is provided
- * as an input to the function.
- *
- * @param[in]      p_buf            Pointer to the beginning of the input buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded data.
- * @param[in]      pp_data          Pointer to pointer to decoded data.
- * @param[in]      data_len         Length of buffer for decoded data (16bit).
- * @param[in]      dlen             Length of data to decode (16bit).
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t buf_dec(uint8_t const * const p_buf,
-                 uint32_t              buf_len,
-                 uint32_t * const      p_index,
-                 uint8_t * * const     pp_data,
-                 uint16_t              data_len,
-                 uint16_t              dlen);
-
-/**@brief Function for safe encoding an uint32 value.
- *
- * Safe decoding of an uint32 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_field          uint32 value to be encoded.
- * @param[out]     p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint32 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t uint32_t_enc(void const * const p_field,
-                      uint8_t * const    p_buf,
-                      uint32_t           buf_len,
-                      uint32_t * const   p_index);
-
-/**@brief Function for safe decoding an uint32 value.
- *
- * Safe decoding of an uint32 value. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- *
- * @param[in]      p_buf            Buffer containing the value.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint32 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded value.
- * @param[out]     value            Decoded uint32 value.
- */
-uint32_t uint32_t_dec(uint8_t const * const p_buf,
-                      uint32_t              buf_len,
-                      uint32_t * const      p_index,
-                      void *                p_field);
-
-/**@brief Function for safe encoding of an uint8 vector.
- *
- * Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * *
- * @param[in]      p_data           Data to encode.
- * @param[in]      dlen             Input data length (16bit).
- * @param[in]      p_buf            Pointer to the beginning of the output buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the encoded data.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t uint8_vector_enc(uint8_t const * const p_data,
-                          uint16_t const        dlen,
-                          uint8_t * const       p_buf,
-                          uint32_t              buf_len,
-                          uint32_t * const      p_index);
-
-/**@brief Function for safe decoding a an uint8 vector.
- *
- * Safe decoding of buffer of known size. Range checks will be done if @ref SER_ASSERTS_ENABLED is set.
- * Vector length is provided as an input to the function.
- *
- * @param[in]      p_buf            Pointer to the beginning of the input buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded data.
- * @param[in]      p_data           Pointer to decoded data.
- * @param[in]      dlen             Length of data to decode (16bit).
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t uint8_vector_dec(uint8_t const * const p_buf,
-                 uint32_t              buf_len,
-                 uint32_t * const      p_index,
-                 uint8_t  * const      p_data,
-                 uint16_t              dlen);
-
-
-#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/serialization/common/cond_field_serialization.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/cond_field_serialization.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/cond_field_serialization.c
deleted file mode 100644
index 711533f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/cond_field_serialization.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "nrf_error.h"
-#include "cond_field_serialization.h"
-#include "ble_serialization.h"
-#include <stddef.h>
-
-uint32_t cond_field_enc(void const * const      p_field,
-                        uint8_t * const         p_buf,
-                        uint32_t                buf_len,
-                        uint32_t * const        p_index,
-                        field_encoder_handler_t fp_field_encoder)
-{
-    uint32_t err_code = NRF_SUCCESS;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    p_buf[*p_index] = (p_field == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
-    *p_index       += 1;
-
-    if (p_field && (fp_field_encoder != NULL))
-    {
-        err_code = fp_field_encoder(p_field, p_buf, buf_len, p_index);
-    }
-
-    return err_code;
-}
-
-
-uint32_t cond_field_dec(uint8_t const * const   p_buf,
-                        uint32_t                buf_len,
-                        uint32_t * const        p_index,
-                        void * * const          pp_field,
-                        field_decoder_handler_t fp_field_parser)
-{
-    uint32_t err_code = NRF_SUCCESS;
-    uint8_t  is_present;
-
-    SER_ASSERT_LENGTH_LEQ(1, buf_len - *p_index);
-    uint8_dec(p_buf, buf_len, p_index, &is_present);
-
-    if (is_present == SER_FIELD_PRESENT)
-    {
-        SER_ASSERT_NOT_NULL(pp_field);
-        SER_ASSERT_NOT_NULL(*pp_field);
-
-        if (fp_field_parser != NULL)
-        {
-            err_code = fp_field_parser(p_buf, buf_len, p_index, *pp_field);
-        }
-    }
-    else if (is_present == SER_FIELD_NOT_PRESENT)
-    {
-        if (pp_field != NULL)
-        {
-            *pp_field = NULL;
-        }
-    }
-    else
-    {
-        err_code = NRF_ERROR_INVALID_DATA;
-    }
-
-    return err_code;
-}

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/serialization/common/cond_field_serialization.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/cond_field_serialization.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/cond_field_serialization.h
deleted file mode 100644
index 8d9abd5..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/cond_field_serialization.h
+++ /dev/null
@@ -1,64 +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.
- *
- */
-#include <stdint.h>
-
-typedef uint32_t (*field_encoder_handler_t)(void const * const p_field,
-                                            uint8_t * const    p_buf,
-                                            uint32_t           buf_len,
-                                            uint32_t * const   p_index);
-
-typedef uint32_t (*field_decoder_handler_t)(uint8_t const * const p_buf,
-                                            uint32_t              buf_len,
-                                            uint32_t * const      p_index,
-                                            void *                p_field);
-
-/**@brief Function for safe encoding conditional field.
- *
- * Function sets 'presence flag' and checks if conditional field is provided and if it is not NULL
- * it calls provided parser function which attempts to encode field content to the buffer stream.
- *
- * @param[in]      p_field          Pointer to input struct.
- * @param[in]      p_buf            Pointer to the beginning of the output buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the encoded data.
- * @param[in]      fp_field_encoder Pointer to the function which implements fields encoding.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t cond_field_enc(void const * const      p_field,
-                        uint8_t * const         p_buf,
-                        uint32_t                buf_len,
-                        uint32_t * const        p_index,
-                        field_encoder_handler_t field_parser);
-
-/**@brief Function for safe decoding conditional field.
- *
- * Function checks if conditional field is present in the input buffer and if it is set it calls
- * provided parser function which attempts to parse buffer content to the known field.
- *
- * @param[in]      p_buf            Pointer to the beginning of the input buffer.
- * @param[in]      buf_len          Size of buffer.
- * @param[in,out]  p_index          \c in: Index to start of uint8 value in buffer.
- *                                  \c out: Index in buffer to first byte after the decoded data.
- * @param[in]      pp_field         Pointer to pointer to output location.
- * @param[in]      fp_field_decoder Pointer to the function which implements field decoding.
- *
- * @return NRF_SUCCESS              Fields decoded successfully.
- * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
- */
-uint32_t cond_field_dec(uint8_t const * const   p_buf,
-                        uint32_t                buf_len,
-                        uint32_t * const        p_index,
-                        void * * const          pp_field,
-                        field_decoder_handler_t field_parser);

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/serialization/common/ser_config.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ser_config.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ser_config.h
deleted file mode 100644
index 6b387d8..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/common/ser_config.h
+++ /dev/null
@@ -1,121 +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.
- *
- */
-
-#ifndef SER_CONFIG_H__
-#define SER_CONFIG_H__
-
-#include <stdint.h>
-
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/***********************************************************************************************//**
- * General parameters configuration.
- **************************************************************************************************/
-
-/** Value used as error code on SoftDevice stack dump. Can be used to identify stack location on
- *  stack unwind.*/
-#define SER_SD_ERROR_CODE    (uint32_t)(0xDEADBEEF)
-
-/** Value used as error code indicating warning - unusual situation but not critical so system
- *  should NOT be reseted. */
-#define SER_WARNING_CODE     (uint32_t)(0xBADDCAFE)
-
-/***********************************************************************************************//**
- * HAL Transport layer configuration.
- **************************************************************************************************/
-
-/** Max packets size in serialization HAL Transport layer (packets before adding PHY header i.e.
- *  packet length). */
-#define SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE    (uint32_t)(384)
-#define SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE    (uint32_t)(384)
-
-#define SER_HAL_TRANSPORT_MAX_PKT_SIZE ((SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE) >= \
-                                        (SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE)    \
-                                        ?                                               \
-                                        (SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE) :  \
-                                        (SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE))
-#ifdef SER_CONNECTIVITY
-    #define SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE         SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE
-    #define SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE         SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE
-
-#else /* APPLICATION SIDE */
-    #define SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE         SER_HAL_TRANSPORT_APP_TO_CONN_MAX_PKT_SIZE
-    #define SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE         SER_HAL_TRANSPORT_CONN_TO_APP_MAX_PKT_SIZE
-#endif /* SER_CONNECTIVITY */
-
-
-/***********************************************************************************************//**
- * SER_PHY layer configuration.
- **************************************************************************************************/
-
-#define SER_PHY_HEADER_SIZE             2
-
-#define SER_PHY_SPI_FREQUENCY           NRF_DRV_SPI_FREQ_1M
-
-/** Max transfer unit for SPI MASTER and SPI SLAVE. */
-#define SER_PHY_SPI_MTU_SIZE            255
-
-/** UART transmission parameters */
-#define SER_PHY_UART_FLOW_CTRL          APP_UART_FLOW_CONTROL_ENABLED
-#define SER_PHY_UART_PARITY             true
-#define SER_PHY_UART_BAUDRATE           UART_BAUDRATE_BAUDRATE_Baud1M
-
-/** Find UART baudrate value based on chosen register setting. */
-#if (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud1200)
-    #define SER_PHY_UART_BAUDRATE_VAL 1200uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud2400)
-    #define SER_PHY_UART_BAUDRATE_VAL 2400uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud4800)
-    #define SER_PHY_UART_BAUDRATE_VAL 4800uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud9600)
-    #define SER_PHY_UART_BAUDRATE_VAL 9600uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud14400)
-    #define SER_PHY_UART_BAUDRATE_VAL 14400uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud19200)
-    #define SER_PHY_UART_BAUDRATE_VAL 19200uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud28800)
-    #define SER_PHY_UART_BAUDRATE_VAL 28800uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud38400)
-    #define SER_PHY_UART_BAUDRATE_VAL 38400uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud57600)
-    #define SER_PHY_UART_BAUDRATE_VAL 57600uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud76800)
-    #define SER_PHY_UART_BAUDRATE_VAL 76800uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud115200)
-    #define SER_PHY_UART_BAUDRATE_VAL 115200uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud230400)
-    #define SER_PHY_UART_BAUDRATE_VAL 230400uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud250000)
-    #define SER_PHY_UART_BAUDRATE_VAL 250000uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud460800)
-    #define SER_PHY_UART_BAUDRATE_VAL 460800uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud921600)
-    #define SER_PHY_UART_BAUDRATE_VAL 921600uL
-#elif (SER_PHY_UART_BAUDRATE == UART_BAUDRATE_BAUDRATE_Baud1M)
-    #define SER_PHY_UART_BAUDRATE_VAL 1000000uL
-#endif /* SER_PHY_UART_BAUDRATE */
-
-/** Configuration timeouts of connectivity MCU */
-#define CONN_CHIP_RESET_TIME            50      /**< The time to keep the reset line to the nRF51822 low (in milliseconds). */
-#define CONN_CHIP_WAKEUP_TIME           500     /**< The time for nRF51822 to reset and become ready to receive serialized commands (in milliseconds). */
-
-#define SER_MAX_CONNECTIONS 8
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SER_CONFIG_H__ */



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

Posted by cc...@apache.org.
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/hal/nrf_gpiote.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_gpiote.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_gpiote.h
deleted file mode 100644
index e493f44..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_gpiote.h
+++ /dev/null
@@ -1,399 +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.
- *
- */
-#ifndef NRF_GPIOTE_H__
-#define NRF_GPIOTE_H__
-
-#include "nrf.h"
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
-* @defgroup nrf_gpiote_abs GPIOTE abstraction
-* @{
-* @ingroup nrf_gpiote
-* @brief GPIOTE abstraction for configuration of channels.
-*/
-#ifdef NRF51
-#define NUMBER_OF_GPIO_TE 4
-#elif defined(NRF52)
-#define NUMBER_OF_GPIO_TE 8
-#else
-#error "Chip family not specified"
-#endif
-
- /**
- * @enum nrf_gpiote_polarity_t
- * @brief Polarity for the GPIOTE channel.
- */
-typedef enum
-{
-  NRF_GPIOTE_POLARITY_LOTOHI = GPIOTE_CONFIG_POLARITY_LoToHi,       ///<  Low to high.
-  NRF_GPIOTE_POLARITY_HITOLO = GPIOTE_CONFIG_POLARITY_HiToLo,       ///<  High to low.
-  NRF_GPIOTE_POLARITY_TOGGLE = GPIOTE_CONFIG_POLARITY_Toggle        ///<  Toggle.
-} nrf_gpiote_polarity_t;
-
-
- /**
- * @enum nrf_gpiote_outinit_t
- * @brief Initial output value for the GPIOTE channel.
- */
-typedef enum
-{
-  NRF_GPIOTE_INITIAL_VALUE_LOW  = GPIOTE_CONFIG_OUTINIT_Low,       ///<  Low to high.
-  NRF_GPIOTE_INITIAL_VALUE_HIGH = GPIOTE_CONFIG_OUTINIT_High       ///<  High to low.
-} nrf_gpiote_outinit_t;
-
-/**
- * @brief Tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_GPIOTE_TASKS_OUT_0     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[0]), /**< Out task 0.*/
-    NRF_GPIOTE_TASKS_OUT_1     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[1]), /**< Out task 1.*/
-    NRF_GPIOTE_TASKS_OUT_2     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[2]), /**< Out task 2.*/
-    NRF_GPIOTE_TASKS_OUT_3     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[3]), /**< Out task 3.*/
-#if (NUMBER_OF_GPIO_TE == 8)
-    NRF_GPIOTE_TASKS_OUT_4     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[4]), /**< Out task 4.*/
-    NRF_GPIOTE_TASKS_OUT_5     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[5]), /**< Out task 5.*/
-    NRF_GPIOTE_TASKS_OUT_6     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[6]), /**< Out task 6.*/
-    NRF_GPIOTE_TASKS_OUT_7     = offsetof(NRF_GPIOTE_Type, TASKS_OUT[7]), /**< Out task 7.*/
-#endif
-#ifdef NRF52
-    NRF_GPIOTE_TASKS_SET_0     = offsetof(NRF_GPIOTE_Type, TASKS_SET[0]), /**< Set task 0.*/
-    NRF_GPIOTE_TASKS_SET_1     = offsetof(NRF_GPIOTE_Type, TASKS_SET[1]), /**< Set task 1.*/
-    NRF_GPIOTE_TASKS_SET_2     = offsetof(NRF_GPIOTE_Type, TASKS_SET[2]), /**< Set task 2.*/
-    NRF_GPIOTE_TASKS_SET_3     = offsetof(NRF_GPIOTE_Type, TASKS_SET[3]), /**< Set task 3.*/
-    NRF_GPIOTE_TASKS_SET_4     = offsetof(NRF_GPIOTE_Type, TASKS_SET[4]), /**< Set task 4.*/
-    NRF_GPIOTE_TASKS_SET_5     = offsetof(NRF_GPIOTE_Type, TASKS_SET[5]), /**< Set task 5.*/
-    NRF_GPIOTE_TASKS_SET_6     = offsetof(NRF_GPIOTE_Type, TASKS_SET[6]), /**< Set task 6.*/
-    NRF_GPIOTE_TASKS_SET_7     = offsetof(NRF_GPIOTE_Type, TASKS_SET[7]), /**< Set task 7.*/
-    NRF_GPIOTE_TASKS_CLR_0     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[0]), /**< Clear task 0.*/
-    NRF_GPIOTE_TASKS_CLR_1     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[1]), /**< Clear task 1.*/
-    NRF_GPIOTE_TASKS_CLR_2     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[2]), /**< Clear task 2.*/
-    NRF_GPIOTE_TASKS_CLR_3     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[3]), /**< Clear task 3.*/
-    NRF_GPIOTE_TASKS_CLR_4     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[4]), /**< Clear task 4.*/
-    NRF_GPIOTE_TASKS_CLR_5     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[5]), /**< Clear task 5.*/
-    NRF_GPIOTE_TASKS_CLR_6     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[6]), /**< Clear task 6.*/
-    NRF_GPIOTE_TASKS_CLR_7     = offsetof(NRF_GPIOTE_Type, TASKS_CLR[7]), /**< Clear task 7.*/
-#endif
-    /*lint -restore*/
-} nrf_gpiote_tasks_t;
-
-/**
- * @brief Events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_GPIOTE_EVENTS_IN_0     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[0]), /**< In event 0.*/
-    NRF_GPIOTE_EVENTS_IN_1     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[1]), /**< In event 1.*/
-    NRF_GPIOTE_EVENTS_IN_2     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[2]), /**< In event 2.*/
-    NRF_GPIOTE_EVENTS_IN_3     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[3]), /**< In event 3.*/
-#if (NUMBER_OF_GPIO_TE == 8)
-    NRF_GPIOTE_EVENTS_IN_4     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[4]), /**< In event 4.*/
-    NRF_GPIOTE_EVENTS_IN_5     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[5]), /**< In event 5.*/
-    NRF_GPIOTE_EVENTS_IN_6     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[6]), /**< In event 6.*/
-    NRF_GPIOTE_EVENTS_IN_7     = offsetof(NRF_GPIOTE_Type, EVENTS_IN[7]), /**< In event 7.*/
-#endif
-    NRF_GPIOTE_EVENTS_PORT     = offsetof(NRF_GPIOTE_Type, EVENTS_PORT), /**<  Port event.*/
-    /*lint -restore*/
-} nrf_gpiote_events_t;
-
-/**
- * @enum nrf_gpiote_int_t
- * @brief GPIOTE interrupts.
- */
-typedef enum
-{
-    NRF_GPIOTE_INT_IN0_MASK  = GPIOTE_INTENSET_IN0_Msk,  /**< GPIOTE interrupt from IN0. */
-    NRF_GPIOTE_INT_IN1_MASK  = GPIOTE_INTENSET_IN1_Msk,  /**< GPIOTE interrupt from IN1. */
-    NRF_GPIOTE_INT_IN2_MASK  = GPIOTE_INTENSET_IN2_Msk,  /**< GPIOTE interrupt from IN2. */
-    NRF_GPIOTE_INT_IN3_MASK  = GPIOTE_INTENSET_IN3_Msk,  /**< GPIOTE interrupt from IN3. */
-#if (NUMBER_OF_GPIO_TE == 8)
-    NRF_GPIOTE_INT_IN4_MASK  = GPIOTE_INTENSET_IN4_Msk,  /**< GPIOTE interrupt from IN4. */
-    NRF_GPIOTE_INT_IN5_MASK  = GPIOTE_INTENSET_IN5_Msk,  /**< GPIOTE interrupt from IN5. */
-    NRF_GPIOTE_INT_IN6_MASK  = GPIOTE_INTENSET_IN6_Msk,  /**< GPIOTE interrupt from IN6. */
-    NRF_GPIOTE_INT_IN7_MASK  = GPIOTE_INTENSET_IN7_Msk,  /**< GPIOTE interrupt from IN7. */
-#endif
-    NRF_GPIOTE_INT_PORT_MASK = (int)GPIOTE_INTENSET_PORT_Msk, /**< GPIOTE interrupt from PORT event. */
-} nrf_gpiote_int_t;
-
-#if (NUMBER_OF_GPIO_TE == 4)
-#define NRF_GPIOTE_INT_IN_MASK (NRF_GPIOTE_INT_IN0_MASK | NRF_GPIOTE_INT_IN1_MASK |\
-                                NRF_GPIOTE_INT_IN2_MASK | NRF_GPIOTE_INT_IN3_MASK)
-#elif (NUMBER_OF_GPIO_TE == 8)
-#define NRF_GPIOTE_INT_IN_MASK (NRF_GPIOTE_INT_IN0_MASK | NRF_GPIOTE_INT_IN1_MASK |\
-                                NRF_GPIOTE_INT_IN2_MASK | NRF_GPIOTE_INT_IN3_MASK |\
-                                NRF_GPIOTE_INT_IN4_MASK | NRF_GPIOTE_INT_IN5_MASK |\
-                                NRF_GPIOTE_INT_IN6_MASK | NRF_GPIOTE_INT_IN7_MASK)
-#else
-#error "Unexpected number of GPIO Tasks and Events"
-#endif
-/**
- * @brief Function for activating a specific GPIOTE task.
- *
- * @param[in]  task Task.
- */
-__STATIC_INLINE void nrf_gpiote_task_set(nrf_gpiote_tasks_t task);
-
-/**
- * @brief Function for getting the address of a specific GPIOTE task.
- *
- * @param[in] task Task.
- *
- * @returns Address.
- */
-__STATIC_INLINE uint32_t nrf_gpiote_task_addr_get(nrf_gpiote_tasks_t task);
-
-/**
- * @brief Function for getting the state of a specific GPIOTE event.
- *
- * @param[in] event Event.
- */
-__STATIC_INLINE bool nrf_gpiote_event_is_set(nrf_gpiote_events_t event);
-
-/**
- * @brief Function for clearing a specific GPIOTE event.
- *
- * @param[in] event Event.
- */
-__STATIC_INLINE void nrf_gpiote_event_clear(nrf_gpiote_events_t event);
-
-/**
- * @brief Function for getting the address of a specific GPIOTE event.
- *
- * @param[in] event Event.
- *
- * @return Address
- */
-__STATIC_INLINE uint32_t nrf_gpiote_event_addr_get(nrf_gpiote_events_t event);
-
-/**@brief Function for enabling interrupts.
- *
- * @param[in]  mask          Interrupt mask to be enabled.
- */
-__STATIC_INLINE void nrf_gpiote_int_enable(uint32_t mask);
-
-/**@brief Function for disabling interrupts.
- *
- * @param[in]  mask          Interrupt mask to be disabled.
- */
-__STATIC_INLINE void nrf_gpiote_int_disable(uint32_t mask);
-
-/**@brief Function for checking if interrupts are enabled.
- *
- * @param[in]  mask          Mask of interrupt flags to check.
- *
- * @return                   Mask with enabled interrupts.
- */
-__STATIC_INLINE uint32_t nrf_gpiote_int_is_enabled(uint32_t mask);
-
-/**@brief Function for enabling a GPIOTE event.
- *
- * @param[in]  idx        Task-Event index.
- */
-__STATIC_INLINE void nrf_gpiote_event_enable(uint32_t idx);
-
-/**@brief Function for disabling a GPIOTE event.
- *
- * @param[in]  idx        Task-Event index.
- */
-__STATIC_INLINE void nrf_gpiote_event_disable(uint32_t idx);
-
-/**@brief Function for configuring a GPIOTE event.
- *
- * @param[in]  idx        Task-Event index.
- * @param[in]  pin        Pin associated with event.
- * @param[in]  polarity   Transition that should generate an event.
- */
-__STATIC_INLINE void nrf_gpiote_event_configure(uint32_t idx, uint32_t pin,
-                                                nrf_gpiote_polarity_t polarity);
-
-/**@brief Function for getting the pin associated with a GPIOTE event.
- *
- * @param[in]  idx        Task-Event index.
- *
- * @return Pin number.
- */
-__STATIC_INLINE uint32_t nrf_gpiote_event_pin_get(uint32_t idx);
-
-/**@brief Function for getting the polarity associated with a GPIOTE event.
- *
- * @param[in]  idx        Task-Event index.
- *
- * @return Polarity.
- */
-__STATIC_INLINE nrf_gpiote_polarity_t nrf_gpiote_event_polarity_get(uint32_t idx);
-
-/**@brief Function for enabling a GPIOTE task.
- *
- * @param[in]  idx        Task-Event index.
- */
-__STATIC_INLINE void nrf_gpiote_task_enable(uint32_t idx);
-
-/**@brief Function for disabling a GPIOTE task.
- *
- * @param[in]  idx        Task-Event index.
- */
-__STATIC_INLINE void nrf_gpiote_task_disable(uint32_t idx);
-
-/**@brief Function for configuring a GPIOTE task.
- * @note  Function is not configuring mode field so task is disabled after this function is called.
- *
- * @param[in]  idx        Task-Event index.
- * @param[in]  pin        Pin associated with event.
- * @param[in]  polarity   Transition that should generate an event.
- * @param[in]  init_val   Initial value of pin.
- */
-__STATIC_INLINE void nrf_gpiote_task_configure(uint32_t idx, uint32_t pin,
-                                               nrf_gpiote_polarity_t polarity,
-                                               nrf_gpiote_outinit_t  init_val);
-
-/**@brief Function for forcing a specific state on the pin connected to GPIOTE.
- *
- * @param[in]  idx        Task-Event index.
- * @param[in]  init_val   Pin state.
- */
-__STATIC_INLINE void nrf_gpiote_task_force(uint32_t idx, nrf_gpiote_outinit_t init_val);
-
-/**@brief Function for resetting a GPIOTE task event configuration to the default state.
- *
- * @param[in]  idx        Task-Event index.
- */
-__STATIC_INLINE void nrf_gpiote_te_default(uint32_t idx);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-__STATIC_INLINE void nrf_gpiote_task_set(nrf_gpiote_tasks_t task)
-{
-    *(__IO uint32_t *)((uint32_t)NRF_GPIOTE + task) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_gpiote_task_addr_get(nrf_gpiote_tasks_t task)
-{
-    return ((uint32_t)NRF_GPIOTE + task);
-}
-
-__STATIC_INLINE bool nrf_gpiote_event_is_set(nrf_gpiote_events_t event)
-{
-    return (*(uint32_t *)nrf_gpiote_event_addr_get(event) == 0x1UL) ? true : false;
-}
-
-__STATIC_INLINE void nrf_gpiote_event_clear(nrf_gpiote_events_t event)
-{
-    *(uint32_t *)nrf_gpiote_event_addr_get(event) = 0;
-#if __CORTEX_M == 0x04
-    volatile uint32_t dummy = *((volatile uint32_t *)nrf_gpiote_event_addr_get(event));
-    (void)dummy;
-#endif
-}
-
-__STATIC_INLINE uint32_t nrf_gpiote_event_addr_get(nrf_gpiote_events_t event)
-{
-    return ((uint32_t)NRF_GPIOTE + event);
-}
-
-__STATIC_INLINE void nrf_gpiote_int_enable(uint32_t mask)
-{
-    NRF_GPIOTE->INTENSET = mask;
-}
-
-__STATIC_INLINE void nrf_gpiote_int_disable(uint32_t mask)
-{
-    NRF_GPIOTE->INTENCLR = mask;
-}
-
-__STATIC_INLINE uint32_t nrf_gpiote_int_is_enabled(uint32_t mask)
-{
-    return (NRF_GPIOTE->INTENSET & mask);
-}
-
-__STATIC_INLINE void nrf_gpiote_event_enable(uint32_t idx)
-{
-   NRF_GPIOTE->CONFIG[idx] |= GPIOTE_CONFIG_MODE_Event;
-}
-
-__STATIC_INLINE void nrf_gpiote_event_disable(uint32_t idx)
-{
-   NRF_GPIOTE->CONFIG[idx] &= ~GPIOTE_CONFIG_MODE_Event;
-}
-
-__STATIC_INLINE void nrf_gpiote_event_configure(uint32_t idx, uint32_t pin, nrf_gpiote_polarity_t polarity)
-{
-  NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PSEL_Msk | GPIOTE_CONFIG_POLARITY_Msk);
-  NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk) |
-                              ((polarity << GPIOTE_CONFIG_POLARITY_Pos) & GPIOTE_CONFIG_POLARITY_Msk);
-}
-
-__STATIC_INLINE uint32_t nrf_gpiote_event_pin_get(uint32_t idx)
-{
-    return ((NRF_GPIOTE->CONFIG[idx] & GPIOTE_CONFIG_PSEL_Msk) >> GPIOTE_CONFIG_PSEL_Pos);
-}
-
-__STATIC_INLINE nrf_gpiote_polarity_t nrf_gpiote_event_polarity_get(uint32_t idx)
-{
-    return (nrf_gpiote_polarity_t)((NRF_GPIOTE->CONFIG[idx] & GPIOTE_CONFIG_POLARITY_Msk) >> GPIOTE_CONFIG_POLARITY_Pos);
-}
-
-__STATIC_INLINE void nrf_gpiote_task_enable(uint32_t idx)
-{
-    uint32_t final_config = NRF_GPIOTE->CONFIG[idx] | GPIOTE_CONFIG_MODE_Task;
-    /* Workaround for the OUTINIT PAN. When nrf_gpiote_task_config() is called a glitch happens
-    on the GPIO if the GPIO in question is already assigned to GPIOTE and the pin is in the
-    correct state in GPIOTE but not in the OUT register. */
-    /* Configure channel to Pin31, not connected to the pin, and configure as a tasks that will set it to proper level */
-    NRF_GPIOTE->CONFIG[idx] = final_config | ((31 << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk);
-    __NOP();
-    __NOP();
-    __NOP();
-    NRF_GPIOTE->CONFIG[idx] = final_config;
-}
-
-__STATIC_INLINE void nrf_gpiote_task_disable(uint32_t idx)
-{
-    NRF_GPIOTE->CONFIG[idx] &= ~GPIOTE_CONFIG_MODE_Task;
-}
-
-__STATIC_INLINE void nrf_gpiote_task_configure(uint32_t idx, uint32_t pin,
-                                                nrf_gpiote_polarity_t polarity,
-                                                nrf_gpiote_outinit_t  init_val)
-{
-  NRF_GPIOTE->CONFIG[idx] &= ~(GPIOTE_CONFIG_PSEL_Msk |
-                               GPIOTE_CONFIG_POLARITY_Msk |
-                               GPIOTE_CONFIG_OUTINIT_Msk);
-
-  NRF_GPIOTE->CONFIG[idx] |= ((pin << GPIOTE_CONFIG_PSEL_Pos) & GPIOTE_CONFIG_PSEL_Msk) |
-                             ((polarity << GPIOTE_CONFIG_POLARITY_Pos) & GPIOTE_CONFIG_POLARITY_Msk) |
-                             ((init_val << GPIOTE_CONFIG_OUTINIT_Pos) & GPIOTE_CONFIG_OUTINIT_Msk);
-}
-
-__STATIC_INLINE void nrf_gpiote_task_force(uint32_t idx, nrf_gpiote_outinit_t init_val)
-{
-    NRF_GPIOTE->CONFIG[idx] = (NRF_GPIOTE->CONFIG[idx] & ~GPIOTE_CONFIG_OUTINIT_Msk) 
-                              | ((init_val << GPIOTE_CONFIG_OUTINIT_Pos) & GPIOTE_CONFIG_OUTINIT_Msk);
-}
-
-__STATIC_INLINE void nrf_gpiote_te_default(uint32_t idx)
-{
-    NRF_GPIOTE->CONFIG[idx] = 0;
-}
-#endif //SUPPRESS_INLINE_IMPLEMENTATION
-/** @} */
-
-#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/drivers_nrf/hal/nrf_i2s.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_i2s.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_i2s.h
deleted file mode 100644
index 2dca3a2..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_i2s.h
+++ /dev/null
@@ -1,531 +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.
- *
- */
-
-/**
- * @defgroup nrf_i2s_hal I2S HAL
- * @{
- * @ingroup nrf_i2s
- *
- * @brief @tagAPI52 Hardware access layer for managing the Inter-IC Sound (I2S) peripheral.
- */
-
-#ifndef NRF_I2S_H__
-#define NRF_I2S_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief This value can be provided as a parameter for the @ref nrf_i2s_pins_set
- *        function call to specify that a given I2S signal (SDOUT, SDIN, or MCK)
- *        shall not be connected to a physical pin.
- */
-#define NRF_I2S_PIN_NOT_CONNECTED  0xFFFFFFFF
-
-
-/**
- * @brief I2S tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_I2S_TASK_START = offsetof(NRF_I2S_Type, TASKS_START), ///< Starts continuous I2S transfer. Also starts the MCK generator if this is enabled.
-    NRF_I2S_TASK_STOP  = offsetof(NRF_I2S_Type, TASKS_STOP)   ///< Stops I2S transfer. Also stops the MCK generator.
-    /*lint -restore*/
-} nrf_i2s_task_t;
-
-/**
- * @brief I2S events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_I2S_EVENT_RXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_RXPTRUPD), ///< The RXD.PTR register has been copied to internal double-buffers.
-    NRF_I2S_EVENT_TXPTRUPD = offsetof(NRF_I2S_Type, EVENTS_TXPTRUPD), ///< The TXD.PTR register has been copied to internal double-buffers.
-    NRF_I2S_EVENT_STOPPED  = offsetof(NRF_I2S_Type, EVENTS_STOPPED)   ///< I2S transfer stopped.
-    /*lint -restore*/
-} nrf_i2s_event_t;
-
-/**
- * @brief I2S interrupts.
- */
-typedef enum
-{
-    NRF_I2S_INT_RXPTRUPD_MASK = I2S_INTENSET_RXPTRUPD_Msk, ///< Interrupt on RXPTRUPD event.
-    NRF_I2S_INT_TXPTRUPD_MASK = I2S_INTENSET_TXPTRUPD_Msk, ///< Interrupt on TXPTRUPD event.
-    NRF_I2S_INT_STOPPED_MASK  = I2S_INTENSET_STOPPED_Msk   ///< Interrupt on STOPPED event.
-} nrf_i2s_int_mask_t;
-
-/**
- * @brief I2S modes of operation.
- */
-typedef enum
-{
-    NRF_I2S_MODE_MASTER = I2S_CONFIG_MODE_MODE_Master, ///< Master mode.
-    NRF_I2S_MODE_SLAVE  = I2S_CONFIG_MODE_MODE_Slave   ///< Slave mode.
-} nrf_i2s_mode_t;
-
-/**
- * @brief I2S master clock generator settings.
- */
-typedef enum
-{
-    NRF_I2S_MCK_DISABLED  = 0,                                       ///< MCK disabled.
-    // [conversion to 'int' needed to prevent compilers from complaining
-    //  that the provided value (0x80000000UL) is out of range of "int"]
-    NRF_I2S_MCK_32MDIV2   = (int)I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV2, ///< 32 MHz / 2 = 16.0 MHz.
-    NRF_I2S_MCK_32MDIV3   = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV3,      ///< 32 MHz / 3 = 10.6666667 MHz.
-    NRF_I2S_MCK_32MDIV4   = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV4,      ///< 32 MHz / 4 = 8.0 MHz.
-    NRF_I2S_MCK_32MDIV5   = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV5,      ///< 32 MHz / 5 = 6.4 MHz.
-    NRF_I2S_MCK_32MDIV6   = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV6,      ///< 32 MHz / 6 = 5.3333333 MHz.
-    NRF_I2S_MCK_32MDIV8   = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV8,      ///< 32 MHz / 8 = 4.0 MHz.
-    NRF_I2S_MCK_32MDIV10  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV10,     ///< 32 MHz / 10 = 3.2 MHz.
-    NRF_I2S_MCK_32MDIV11  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV11,     ///< 32 MHz / 11 = 2.9090909 MHz.
-    NRF_I2S_MCK_32MDIV15  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV15,     ///< 32 MHz / 15 = 2.1333333 MHz.
-    NRF_I2S_MCK_32MDIV16  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV16,     ///< 32 MHz / 16 = 2.0 MHz.
-    NRF_I2S_MCK_32MDIV21  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV21,     ///< 32 MHz / 21 = 1.5238095 MHz.
-    NRF_I2S_MCK_32MDIV23  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV23,     ///< 32 MHz / 23 = 1.3913043 MHz.
-    NRF_I2S_MCK_32MDIV31  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV31,     ///< 32 MHz / 31 = 1.0322581 MHz.
-    NRF_I2S_MCK_32MDIV42  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV42,     ///< 32 MHz / 42 = 0.7619048 MHz.
-    NRF_I2S_MCK_32MDIV63  = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV63,     ///< 32 MHz / 63 = 0.5079365 MHz.
-    NRF_I2S_MCK_32MDIV125 = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV125     ///< 32 MHz / 125 = 0.256 MHz.
-} nrf_i2s_mck_t;
-
-/**
- * @brief I2S MCK/LRCK ratios.
- */
-typedef enum
-{
-    NRF_I2S_RATIO_32X  = I2S_CONFIG_RATIO_RATIO_32X,  ///< LRCK = MCK / 32.
-    NRF_I2S_RATIO_48X  = I2S_CONFIG_RATIO_RATIO_48X,  ///< LRCK = MCK / 48.
-    NRF_I2S_RATIO_64X  = I2S_CONFIG_RATIO_RATIO_64X,  ///< LRCK = MCK / 64.
-    NRF_I2S_RATIO_96X  = I2S_CONFIG_RATIO_RATIO_96X,  ///< LRCK = MCK / 96.
-    NRF_I2S_RATIO_128X = I2S_CONFIG_RATIO_RATIO_128X, ///< LRCK = MCK / 128.
-    NRF_I2S_RATIO_192X = I2S_CONFIG_RATIO_RATIO_192X, ///< LRCK = MCK / 192.
-    NRF_I2S_RATIO_256X = I2S_CONFIG_RATIO_RATIO_256X, ///< LRCK = MCK / 256.
-    NRF_I2S_RATIO_384X = I2S_CONFIG_RATIO_RATIO_384X, ///< LRCK = MCK / 384.
-    NRF_I2S_RATIO_512X = I2S_CONFIG_RATIO_RATIO_512X  ///< LRCK = MCK / 512.
-} nrf_i2s_ratio_t;
-
-/**
- * @brief I2S sample widths.
- */
-typedef enum
-{
-    NRF_I2S_SWIDTH_8BIT  = I2S_CONFIG_SWIDTH_SWIDTH_8Bit,  ///< 8 bit.
-    NRF_I2S_SWIDTH_16BIT = I2S_CONFIG_SWIDTH_SWIDTH_16Bit, ///< 16 bit.
-    NRF_I2S_SWIDTH_24BIT = I2S_CONFIG_SWIDTH_SWIDTH_24Bit  ///< 24 bit.
-} nrf_i2s_swidth_t;
-
-/**
- * @brief I2S alignments of sample within a frame.
- */
-typedef enum
-{
-    NRF_I2S_ALIGN_LEFT  = I2S_CONFIG_ALIGN_ALIGN_Left, ///< Left-aligned.
-    NRF_I2S_ALIGN_RIGHT = I2S_CONFIG_ALIGN_ALIGN_Right ///< Right-aligned.
-} nrf_i2s_align_t;
-
-/**
- * @brief I2S frame formats.
- */
-typedef enum
-{
-    NRF_I2S_FORMAT_I2S     = I2S_CONFIG_FORMAT_FORMAT_I2S,    ///< Original I2S format.
-    NRF_I2S_FORMAT_ALIGNED = I2S_CONFIG_FORMAT_FORMAT_Aligned ///< Alternate (left- or right-aligned) format.
-} nrf_i2s_format_t;
-
-/**
- * @brief I2S enabled channels.
- */
-typedef enum
-{
-    NRF_I2S_CHANNELS_STEREO = I2S_CONFIG_CHANNELS_CHANNELS_Stereo, ///< Stereo.
-    NRF_I2S_CHANNELS_LEFT   = I2S_CONFIG_CHANNELS_CHANNELS_Left,   ///< Left only.
-    NRF_I2S_CHANNELS_RIGHT  = I2S_CONFIG_CHANNELS_CHANNELS_Right   ///< Right only.
-} nrf_i2s_channels_t;
-
-
-/**
- * @brief Function for activating a specific I2S task.
- *
- * @param[in] p_i2s I2S instance.
- * @param[in] task  Task to activate.
- */
-__STATIC_INLINE void nrf_i2s_task_trigger(NRF_I2S_Type * p_i2s,
-                                          nrf_i2s_task_t task);
-
-/**
- * @brief Function for getting the address of a specific I2S task register.
- *
- * @param[in] p_i2s I2S instance.
- * @param[in] task  Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t nrf_i2s_task_address_get(NRF_I2S_Type const * p_i2s,
-                                                  nrf_i2s_task_t task);
-
-/**
- * @brief Function for clearing a specific I2S event.
- *
- * @param[in] p_i2s I2S instance.
- * @param[in] event Event to clear.
- */
-__STATIC_INLINE void nrf_i2s_event_clear(NRF_I2S_Type * p_i2s,
-                                         nrf_i2s_event_t event);
-
-/**
- * @brief Function for checking the state of a specific I2S event.
- *
- * @param[in] p_i2s I2S instance.
- * @param[in] event Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_i2s_event_check(NRF_I2S_Type const * p_i2s,
-                                         nrf_i2s_event_t event);
-
-/**
- * @brief Function for getting the address of a specific I2S event register.
- *
- * @param[in] p_i2s I2S instance.
- * @param[in] event Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t nrf_i2s_event_address_get(NRF_I2S_Type const * p_i2s,
-                                                   nrf_i2s_event_t event);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_i2s I2S instance.
- * @param[in] mask  Interrupts to enable.
- */
-__STATIC_INLINE void nrf_i2s_int_enable(NRF_I2S_Type * p_i2s, uint32_t mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_i2s I2S instance.
- * @param[in] mask  Interrupts to disable.
- */
-__STATIC_INLINE void nrf_i2s_int_disable(NRF_I2S_Type * p_i2s, uint32_t mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param[in] p_i2s   I2S instance.
- * @param[in] i2s_int Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_i2s_int_enable_check(NRF_I2S_Type const * p_i2s,
-                                              nrf_i2s_int_mask_t i2s_int);
-
-/**
- * @brief Function for enabling the I2S peripheral.
- *
- * @param[in] p_i2s I2S instance.
- */
-__STATIC_INLINE void nrf_i2s_enable(NRF_I2S_Type * p_i2s);
-
-/**
- * @brief Function for disabling the I2S peripheral.
- *
- * @param[in] p_i2s I2S instance.
- */
-__STATIC_INLINE void nrf_i2s_disable(NRF_I2S_Type * p_i2s);
-
-/**
- * @brief Function for configuring I2S pins.
- *
- * Usage of the SDOUT, SDIN, and MCK signals is optional.
- * If a given signal is not needed, pass the @ref NRF_I2S_PIN_NOT_CONNECTED
- * value instead of its pin number.
- *
- * @param[in] p_i2s     I2S instance.
- * @param[in] sck_pin   SCK pin number.
- * @param[in] lrck_pin  LRCK pin number.
- * @param[in] mck_pin   MCK pin number.
- * @param[in] sdout_pin SDOUT pin number.
- * @param[in] sdin_pin  SDIN pin number.
- */
-__STATIC_INLINE void nrf_i2s_pins_set(NRF_I2S_Type * p_i2s,
-                                      uint32_t sck_pin,
-                                      uint32_t lrck_pin,
-                                      uint32_t mck_pin,
-                                      uint32_t sdout_pin,
-                                      uint32_t sdin_pin);
-
-/**
- * @brief Function for setting the I2S peripheral configuration.
- *
- * @param[in] p_i2s        I2S instance.
- * @param[in] mode         Mode of operation (master or slave).
- * @param[in] format       I2S frame format.
- * @param[in] alignment    Alignment of sample within a frame.
- * @param[in] sample_width Sample width.
- * @param[in] channels     Enabled channels.
- * @param[in] mck_setup    Master clock generator setup.
- * @param[in] ratio        MCK/LRCK ratio.
- *
- * @retval true  If the configuration has been set successfully.
- * @retval false If the requested configuration is not allowed.
- */
-__STATIC_INLINE bool nrf_i2s_configure(NRF_I2S_Type * p_i2s,
-                                       nrf_i2s_mode_t     mode,
-                                       nrf_i2s_format_t   format,
-                                       nrf_i2s_align_t    alignment,
-                                       nrf_i2s_swidth_t   sample_width,
-                                       nrf_i2s_channels_t channels,
-                                       nrf_i2s_mck_t      mck_setup,
-                                       nrf_i2s_ratio_t    ratio);
-
-/**
- * @brief Function for setting up the I2S transfer.
- *
- * This function sets up the RX and TX buffers and enables reception and/or
- * transmission accordingly. If the transfer in a given direction is not
- * required, pass NULL instead of the pointer to the corresponding buffer.
- *
- * @param[in] p_i2s       I2S instance.
- * @param[in] size        Size of the buffers (in 32-bit words).
- * @param[in] p_rx_buffer Pointer to the receive buffer.
- *                        Pass NULL to disable reception.
- * @param[in] p_tx_buffer Pointer to the transmit buffer.
- *                        Pass NULL to disable transmission.
- */
-__STATIC_INLINE void nrf_i2s_transfer_set(NRF_I2S_Type * p_i2s,
-                                          uint16_t         size,
-                                          uint32_t *       p_rx_buffer,
-                                          uint32_t const * p_tx_buffer);
-
-/**
- * @brief Function for setting the pointer to the receive buffer.
- *
- * @note The size of the buffer can be set only by calling
- *       @ref nrf_i2s_transfer_set.
- *
- * @param[in] p_i2s    I2S instance.
- * @param[in] p_buffer Pointer to the receive buffer.
- */
-__STATIC_INLINE void nrf_i2s_rx_buffer_set(NRF_I2S_Type * p_i2s,
-                                           uint32_t * p_buffer);
-
-/**
- * @brief Function for getting the pointer to the receive buffer.
- *
- * @param[in] p_i2s I2S instance.
- *
- * @return Pointer to the receive buffer.
- */
-__STATIC_INLINE uint32_t * nrf_i2s_rx_buffer_get(NRF_I2S_Type const * p_i2s);
-
-/**
- * @brief Function for setting the pointer to the transmit buffer.
- *
- * @note The size of the buffer can be set only by calling
- *       @ref nrf_i2s_transfer_set.
- *
- * @param[in] p_i2s    I2S instance.
- * @param[in] p_buffer Pointer to the transmit buffer.
- */
-__STATIC_INLINE void nrf_i2s_tx_buffer_set(NRF_I2S_Type * p_i2s,
-                                           uint32_t const * p_buffer);
-
-/**
- * @brief Function for getting the pointer to the transmit buffer.
- *
- * @param[in] p_i2s I2S instance.
- *
- * @return Pointer to the transmit buffer.
- */
-__STATIC_INLINE uint32_t * nrf_i2s_tx_buffer_get(NRF_I2S_Type const * p_i2s);
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_i2s_task_trigger(NRF_I2S_Type * p_i2s,
-                                          nrf_i2s_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_i2s + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_i2s_task_address_get(NRF_I2S_Type const * p_i2s,
-                                                  nrf_i2s_task_t task)
-{
-    return ((uint32_t)p_i2s + (uint32_t)task);
-}
-
-__STATIC_INLINE void nrf_i2s_event_clear(NRF_I2S_Type * p_i2s,
-                                         nrf_i2s_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_i2s + (uint32_t)event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_i2s_event_check(NRF_I2S_Type const * p_i2s,
-                                         nrf_i2s_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_i2s + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t nrf_i2s_event_address_get(NRF_I2S_Type const * p_i2s,
-                                                   nrf_i2s_event_t event)
-{
-    return ((uint32_t)p_i2s + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_i2s_int_enable(NRF_I2S_Type * p_i2s, uint32_t mask)
-{
-    p_i2s->INTENSET = mask;
-}
-
-__STATIC_INLINE void nrf_i2s_int_disable(NRF_I2S_Type * p_i2s, uint32_t mask)
-{
-    p_i2s->INTENCLR = mask;
-}
-
-__STATIC_INLINE bool nrf_i2s_int_enable_check(NRF_I2S_Type const * p_i2s,
-                                              nrf_i2s_int_mask_t i2s_int)
-{
-    return (bool)(p_i2s->INTENSET & i2s_int);
-}
-
-__STATIC_INLINE void nrf_i2s_enable(NRF_I2S_Type * p_i2s)
-{
-    p_i2s->ENABLE = (I2S_ENABLE_ENABLE_Enabled << I2S_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_i2s_disable(NRF_I2S_Type * p_i2s)
-{
-    p_i2s->ENABLE = (I2S_ENABLE_ENABLE_Disabled << I2S_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_i2s_pins_set(NRF_I2S_Type * p_i2s,
-                                      uint32_t sck_pin,
-                                      uint32_t lrck_pin,
-                                      uint32_t mck_pin,
-                                      uint32_t sdout_pin,
-                                      uint32_t sdin_pin)
-{
-    p_i2s->PSEL.SCK   = sck_pin;
-    p_i2s->PSEL.LRCK  = lrck_pin;
-    p_i2s->PSEL.MCK   = mck_pin;
-    p_i2s->PSEL.SDOUT = sdout_pin;
-    p_i2s->PSEL.SDIN  = sdin_pin;
-}
-
-__STATIC_INLINE bool nrf_i2s_configure(NRF_I2S_Type * p_i2s,
-                                       nrf_i2s_mode_t     mode,
-                                       nrf_i2s_format_t   format,
-                                       nrf_i2s_align_t    alignment,
-                                       nrf_i2s_swidth_t   sample_width,
-                                       nrf_i2s_channels_t channels,
-                                       nrf_i2s_mck_t      mck_setup,
-                                       nrf_i2s_ratio_t    ratio)
-{
-    if (mode == NRF_I2S_MODE_MASTER)
-    {
-        // The MCK/LRCK ratio shall be a multiple of 2 * sample width.
-        if (((sample_width == NRF_I2S_SWIDTH_16BIT) &&
-                 (ratio == NRF_I2S_RATIO_48X))
-            ||
-            ((sample_width == NRF_I2S_SWIDTH_24BIT) &&
-                ((ratio == NRF_I2S_RATIO_32X)  ||
-                 (ratio == NRF_I2S_RATIO_64X)  ||
-                 (ratio == NRF_I2S_RATIO_128X) ||
-                 (ratio == NRF_I2S_RATIO_256X) ||
-                 (ratio == NRF_I2S_RATIO_512X))))
-        {
-            return false;
-        }
-    }
-
-    p_i2s->CONFIG.MODE     = mode;
-    p_i2s->CONFIG.FORMAT   = format;
-    p_i2s->CONFIG.ALIGN    = alignment;
-    p_i2s->CONFIG.SWIDTH   = sample_width;
-    p_i2s->CONFIG.CHANNELS = channels;
-    p_i2s->CONFIG.RATIO    = ratio;
-
-    if (mck_setup == NRF_I2S_MCK_DISABLED)
-    {
-        p_i2s->CONFIG.MCKEN =
-            (I2S_CONFIG_MCKEN_MCKEN_Disabled << I2S_CONFIG_MCKEN_MCKEN_Pos);
-    }
-    else
-    {
-        p_i2s->CONFIG.MCKFREQ = mck_setup;
-        p_i2s->CONFIG.MCKEN =
-            (I2S_CONFIG_MCKEN_MCKEN_Enabled << I2S_CONFIG_MCKEN_MCKEN_Pos);
-    }
-
-    return true;
-}
-
-__STATIC_INLINE void nrf_i2s_transfer_set(NRF_I2S_Type * p_i2s,
-                                          uint16_t         size,
-                                          uint32_t *       p_buffer_rx,
-                                          uint32_t const * p_buffer_tx)
-{
-    p_i2s->RXTXD.MAXCNT = size;
-
-    nrf_i2s_rx_buffer_set(p_i2s, p_buffer_rx);
-    p_i2s->CONFIG.RXEN = (p_buffer_rx != NULL) ? 1 : 0;
-
-    nrf_i2s_tx_buffer_set(p_i2s, p_buffer_tx);
-    p_i2s->CONFIG.TXEN = (p_buffer_tx != NULL) ? 1 : 0;
-}
-
-__STATIC_INLINE void nrf_i2s_rx_buffer_set(NRF_I2S_Type * p_i2s,
-                                           uint32_t * p_buffer)
-{
-    p_i2s->RXD.PTR = (uint32_t)p_buffer;
-}
-
-__STATIC_INLINE uint32_t * nrf_i2s_rx_buffer_get(NRF_I2S_Type const * p_i2s)
-{
-    return (uint32_t *)(p_i2s->RXD.PTR);
-}
-
-__STATIC_INLINE void nrf_i2s_tx_buffer_set(NRF_I2S_Type * p_i2s,
-                                           uint32_t const * p_buffer)
-{
-    p_i2s->TXD.PTR = (uint32_t)p_buffer;
-}
-
-__STATIC_INLINE uint32_t * nrf_i2s_tx_buffer_get(NRF_I2S_Type const * p_i2s)
-{
-    return (uint32_t *)(p_i2s->TXD.PTR);
-}
-
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_I2S_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/hal/nrf_lpcomp.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_lpcomp.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_lpcomp.h
deleted file mode 100644
index 7056dfb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_lpcomp.h
+++ /dev/null
@@ -1,375 +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
- * @brief LPCOMP HAL API.
- */
-
-#ifndef NRF_LPCOMP_H_
-#define NRF_LPCOMP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_lpcomp_hal LPCOMP HAL
- * @{
- * @ingroup nrf_lpcomp
- * @brief Hardware access layer for managing the Low Power Comparator (LPCOMP).
- */
-
-#include "nrf.h"
-
-#include <stdbool.h>
-#include <stddef.h>
-#include <stdint.h>
-
-/**
- * @enum nrf_lpcomp_ref_t
- * @brief LPCOMP reference selection.
- */
-typedef enum
-{
-#ifdef NRF51
-    NRF_LPCOMP_REF_SUPPLY_1_8   = LPCOMP_REFSEL_REFSEL_SupplyOneEighthPrescaling,    /**< Use supply with a 1/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_2_8   = LPCOMP_REFSEL_REFSEL_SupplyTwoEighthsPrescaling,   /**< Use supply with a 2/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_3_8   = LPCOMP_REFSEL_REFSEL_SupplyThreeEighthsPrescaling, /**< Use supply with a 3/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_4_8   = LPCOMP_REFSEL_REFSEL_SupplyFourEighthsPrescaling,  /**< Use supply with a 4/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_5_8   = LPCOMP_REFSEL_REFSEL_SupplyFiveEighthsPrescaling,  /**< Use supply with a 5/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_6_8   = LPCOMP_REFSEL_REFSEL_SupplySixEighthsPrescaling,   /**< Use supply with a 6/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_7_8   = LPCOMP_REFSEL_REFSEL_SupplySevenEighthsPrescaling, /**< Use supply with a 7/8 prescaler as reference. */
-#elif defined NRF52
-    NRF_LPCOMP_REF_SUPPLY_1_8   = LPCOMP_REFSEL_REFSEL_Ref1_8Vdd, /**< Use supply with a 1/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_2_8   = LPCOMP_REFSEL_REFSEL_Ref2_8Vdd, /**< Use supply with a 2/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_3_8   = LPCOMP_REFSEL_REFSEL_Ref3_8Vdd, /**< Use supply with a 3/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_4_8   = LPCOMP_REFSEL_REFSEL_Ref4_8Vdd, /**< Use supply with a 4/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_5_8   = LPCOMP_REFSEL_REFSEL_Ref5_8Vdd, /**< Use supply with a 5/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_6_8   = LPCOMP_REFSEL_REFSEL_Ref6_8Vdd, /**< Use supply with a 6/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_7_8   = LPCOMP_REFSEL_REFSEL_Ref7_8Vdd, /**< Use supply with a 7/8 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_1_16  = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 1/16 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_3_16  = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 3/16 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_5_16  = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 5/16 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_7_16  = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 7/16 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_9_16  = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 9/16 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_11_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 11/16 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_13_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 13/16 prescaler as reference. */
-    NRF_LPCOMP_REF_SUPPLY_15_16 = LPCOMP_REFSEL_REFSEL_Ref1_16Vdd, /**< Use supply with a 15/16 prescaler as reference. */
-#endif
-    NRF_LPCOMP_REF_EXT_REF0        = LPCOMP_REFSEL_REFSEL_ARef |
-                       (LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference0 << 16), /**< External reference 0. */
-    NRF_LPCOMP_CONFIG_REF_EXT_REF1 = LPCOMP_REFSEL_REFSEL_ARef |
-                        (LPCOMP_EXTREFSEL_EXTREFSEL_AnalogReference1 << 16), /**< External reference 1. */
-} nrf_lpcomp_ref_t;
-
-/**
- * @enum nrf_lpcomp_input_t
- * @brief LPCOMP input selection.
- */
-typedef enum
-{
-    NRF_LPCOMP_INPUT_0 = LPCOMP_PSEL_PSEL_AnalogInput0, /**< Input 0. */
-    NRF_LPCOMP_INPUT_1 = LPCOMP_PSEL_PSEL_AnalogInput1, /**< Input 1. */
-    NRF_LPCOMP_INPUT_2 = LPCOMP_PSEL_PSEL_AnalogInput2, /**< Input 2. */
-    NRF_LPCOMP_INPUT_3 = LPCOMP_PSEL_PSEL_AnalogInput3, /**< Input 3. */
-    NRF_LPCOMP_INPUT_4 = LPCOMP_PSEL_PSEL_AnalogInput4, /**< Input 4. */
-    NRF_LPCOMP_INPUT_5 = LPCOMP_PSEL_PSEL_AnalogInput5, /**< Input 5. */
-    NRF_LPCOMP_INPUT_6 = LPCOMP_PSEL_PSEL_AnalogInput6, /**< Input 6. */
-    NRF_LPCOMP_INPUT_7 = LPCOMP_PSEL_PSEL_AnalogInput7  /**< Input 7. */
-} nrf_lpcomp_input_t;
-
-/**
- * @enum nrf_lpcomp_detect_t
- * @brief LPCOMP detection type selection.
- */
-typedef enum
-{
-    NRF_LPCOMP_DETECT_CROSS = LPCOMP_ANADETECT_ANADETECT_Cross, /**< Generate ANADETEC on crossing, both upwards and downwards crossing. */
-    NRF_LPCOMP_DETECT_UP    = LPCOMP_ANADETECT_ANADETECT_Up,    /**< Generate ANADETEC on upwards crossing only. */
-    NRF_LPCOMP_DETECT_DOWN  = LPCOMP_ANADETECT_ANADETECT_Down   /**< Generate ANADETEC on downwards crossing only. */
-} nrf_lpcomp_detect_t;
-
-/**
- * @enum nrf_lpcomp_task_t
- * @brief LPCOMP tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_LPCOMP_TASK_START  = offsetof(NRF_LPCOMP_Type, TASKS_START), /**< LPCOMP start sampling task. */
-    NRF_LPCOMP_TASK_STOP   = offsetof(NRF_LPCOMP_Type, TASKS_STOP),  /**< LPCOMP stop sampling task. */
-    NRF_LPCOMP_TASK_SAMPLE = offsetof(NRF_LPCOMP_Type, TASKS_SAMPLE) /**< Sample comparator value. */
-} nrf_lpcomp_task_t;                                                 /*lint -restore*/
-
-
-/**
- * @enum nrf_lpcomp_event_t
- * @brief LPCOMP events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_LPCOMP_EVENT_READY = offsetof(NRF_LPCOMP_Type, EVENTS_READY), /**< LPCOMP is ready and output is valid. */
-    NRF_LPCOMP_EVENT_DOWN  = offsetof(NRF_LPCOMP_Type, EVENTS_DOWN),  /**< Input voltage crossed the threshold going down. */
-    NRF_LPCOMP_EVENT_UP    = offsetof(NRF_LPCOMP_Type, EVENTS_UP),    /**< Input voltage crossed the threshold going up. */
-    NRF_LPCOMP_EVENT_CROSS = offsetof(NRF_LPCOMP_Type, EVENTS_CROSS)  /**< Input voltage crossed the threshold in any direction. */
-} nrf_lpcomp_event_t;                                                 /*lint -restore*/
-
-/**
- * @enum nrf_lpcomp_short_mask_t
- * @brief LPCOMP shorts masks.
- */
-typedef enum
-{
-    NRF_LPCOMP_SHORT_CROSS_STOP_MASK   = LPCOMP_SHORTS_CROSS_STOP_Msk,  /*!< Short between CROSS event and STOP task. */
-    NRF_LPCOMP_SHORT_UP_STOP_MASK      = LPCOMP_SHORTS_UP_STOP_Msk,     /*!< Short between UP event and STOP task. */
-    NRF_LPCOMP_SHORT_DOWN_STOP_MASK    = LPCOMP_SHORTS_DOWN_STOP_Msk,   /*!< Short between DOWN event and STOP task. */
-    NRF_LPCOMP_SHORT_READY_STOP_MASK   = LPCOMP_SHORTS_READY_STOP_Msk,  /*!< Short between READY event and STOP task. */
-    NRF_LPCOMP_SHORT_READY_SAMPLE_MASK = LPCOMP_SHORTS_READY_SAMPLE_Msk /*!< Short between READY event and SAMPLE task. */
-} nrf_lpcomp_short_mask_t;
-
-
-/** @brief LPCOMP configuration. */
-typedef struct
-{
-    nrf_lpcomp_ref_t    reference; /**< LPCOMP reference. */
-    nrf_lpcomp_detect_t detection; /**< LPCOMP detection type. */
-} nrf_lpcomp_config_t;
-
-/** Default LPCOMP configuration. */
-#define NRF_LPCOMP_CONFIG_DEFAULT { NRF_LPCOMP_REF_SUPPLY_FOUR_EIGHT, NRF_LPCOMP_DETECT_DOWN }
-
-/**
- * @brief Function for configuring LPCOMP.
- *
- * This function powers on LPCOMP and configures it. LPCOMP is in DISABLE state after configuration,
- * so it must be enabled before using it. All shorts are inactive, events are cleared, and LPCOMP is stopped.
- *
- * @param[in] p_config Configuration.
- */
-__STATIC_INLINE void nrf_lpcomp_configure(const nrf_lpcomp_config_t * p_config)
-{
-    NRF_LPCOMP->TASKS_STOP = 1;
-    NRF_LPCOMP->ENABLE     = LPCOMP_ENABLE_ENABLE_Disabled << LPCOMP_ENABLE_ENABLE_Pos;
-    NRF_LPCOMP->REFSEL     =
-        (p_config->reference << LPCOMP_REFSEL_REFSEL_Pos) & LPCOMP_REFSEL_REFSEL_Msk;
-
-    //If external source is choosen extract analog reference index.
-    if ((p_config->reference & LPCOMP_REFSEL_REFSEL_ARef)==LPCOMP_REFSEL_REFSEL_ARef)
-    {
-        uint32_t extref       = p_config->reference >> 16;
-        NRF_LPCOMP->EXTREFSEL = (extref << LPCOMP_EXTREFSEL_EXTREFSEL_Pos) & LPCOMP_EXTREFSEL_EXTREFSEL_Msk;
-    }
-
-    NRF_LPCOMP->ANADETECT =
-        (p_config->detection << LPCOMP_ANADETECT_ANADETECT_Pos) & LPCOMP_ANADETECT_ANADETECT_Msk;
-    NRF_LPCOMP->SHORTS   = 0;
-    NRF_LPCOMP->INTENCLR = LPCOMP_INTENCLR_CROSS_Msk | LPCOMP_INTENCLR_UP_Msk |
-                           LPCOMP_INTENCLR_DOWN_Msk | LPCOMP_INTENCLR_READY_Msk;
-}
-
-
-/**
- * @brief Function for selecting the LPCOMP input.
- *
- * This function selects the active input of LPCOMP.
- *
- * @param[in] input Input to be selected.
- */
-__STATIC_INLINE void nrf_lpcomp_input_select(nrf_lpcomp_input_t input)
-{
-    uint32_t lpcomp_enable_state = NRF_LPCOMP->ENABLE;
-
-    NRF_LPCOMP->ENABLE = LPCOMP_ENABLE_ENABLE_Disabled << LPCOMP_ENABLE_ENABLE_Pos;
-    NRF_LPCOMP->PSEL   =
-        ((uint32_t)input << LPCOMP_PSEL_PSEL_Pos) | (NRF_LPCOMP->PSEL & ~LPCOMP_PSEL_PSEL_Msk);
-    NRF_LPCOMP->ENABLE = lpcomp_enable_state;
-}
-
-
-/**
- * @brief Function for enabling the Low Power Comparator.
- *
- * This function enables LPCOMP.
- *
- */
-__STATIC_INLINE void nrf_lpcomp_enable(void)
-{
-    NRF_LPCOMP->ENABLE = LPCOMP_ENABLE_ENABLE_Enabled << LPCOMP_ENABLE_ENABLE_Pos;
-    NRF_LPCOMP->EVENTS_READY = 0;
-    NRF_LPCOMP->EVENTS_DOWN  = 0;
-    NRF_LPCOMP->EVENTS_UP    = 0;
-    NRF_LPCOMP->EVENTS_CROSS = 0;
-}
-
-
-/**
- * @brief Function for disabling the Low Power Comparator.
- *
- * This function disables LPCOMP.
- *
- */
-__STATIC_INLINE void nrf_lpcomp_disable(void)
-{
-    NRF_LPCOMP->ENABLE     = LPCOMP_ENABLE_ENABLE_Disabled << LPCOMP_ENABLE_ENABLE_Pos;
-}
-
-
-/**
- * @brief Function for getting the last LPCOMP compare result.
- *
- * @return The last compare result. If 0 then VIN+ < VIN-, if 1 then the opposite.
- */
-__STATIC_INLINE uint32_t nrf_lpcomp_result_get(void)
-{
-    return (uint32_t)NRF_LPCOMP->RESULT;
-}
-
-
-/**
- * @brief Function for enabling interrupts from LPCOMP.
- *
- * @param[in] lpcomp_int_mask Mask of interrupts to be enabled.
- *
- * @sa nrf_lpcomp_int_disable()
- * @sa nrf_lpcomp_int_enable_check()
- */
-__STATIC_INLINE void nrf_lpcomp_int_enable(uint32_t lpcomp_int_mask)
-{
-    NRF_LPCOMP->INTENSET = lpcomp_int_mask;
-}
-
-
-/**
- * @brief Function for disabling interrupts from LPCOMP.
- *
- * @param[in] lpcomp_int_mask Mask of interrupts to be disabled.
- *
- * @sa nrf_lpcomp_int_enable()
- * @sa nrf_lpcomp_int_enable_check()
- */
-__STATIC_INLINE void nrf_lpcomp_int_disable(uint32_t lpcomp_int_mask)
-{
-    NRF_LPCOMP->INTENCLR = lpcomp_int_mask;
-}
-
-
-/**
- * @brief Function for getting the enabled interrupts of LPCOMP.
- *
- * @param[in] lpcomp_int_mask Mask of interrupts to be checked.
- *
- * @retval true If any of interrupts of the specified mask are enabled.
- *
- * @sa nrf_lpcomp_int_enable()
- * @sa nrf_lpcomp_int_disable()
- */
-__STATIC_INLINE bool nrf_lpcomp_int_enable_check(uint32_t lpcomp_int_mask)
-{
-    return (NRF_LPCOMP->INTENSET & lpcomp_int_mask); // when read this register will return the value of INTEN.
-}
-
-
-/**
- * @brief Function for getting the address of a specific LPCOMP task register.
- *
- * @param[in] lpcomp_task LPCOMP task.
- *
- * @return The address of the specified LPCOMP task.
- */
-__STATIC_INLINE uint32_t * nrf_lpcomp_task_address_get(nrf_lpcomp_task_t lpcomp_task)
-{
-    return (uint32_t *)((uint8_t *)NRF_LPCOMP + lpcomp_task);
-}
-
-
-/**
- * @brief Function for getting the address of a specific LPCOMP event register.
- *
- * @param[in] lpcomp_event LPCOMP event.
- *
- * @return The address of the specified LPCOMP event.
- */
-__STATIC_INLINE uint32_t * nrf_lpcomp_event_address_get(nrf_lpcomp_event_t lpcomp_event)
-{
-    return (uint32_t *)((uint8_t *)NRF_LPCOMP + lpcomp_event);
-}
-
-
-/**
- * @brief  Function for setting LPCOMP shorts.
- *
- * @param[in] lpcomp_short_mask LPCOMP shorts by mask.
- *
- */
-__STATIC_INLINE void nrf_lpcomp_shorts_enable(uint32_t lpcomp_short_mask)
-{
-    NRF_LPCOMP->SHORTS |= lpcomp_short_mask;
-}
-
-
-/**
- * @brief Function for clearing LPCOMP shorts by mask.
- *
- * @param[in] lpcomp_short_mask LPCOMP shorts to be cleared.
- *
- */
-__STATIC_INLINE void nrf_lpcomp_shorts_disable(uint32_t lpcomp_short_mask)
-{
-    NRF_LPCOMP->SHORTS &= ~lpcomp_short_mask;
-}
-
-
-/**
- * @brief Function for setting a specific LPCOMP task.
- *
- * @param[in] lpcomp_task LPCOMP task to be set.
- *
- */
-__STATIC_INLINE void nrf_lpcomp_task_trigger(nrf_lpcomp_task_t lpcomp_task)
-{
-    *( (volatile uint32_t *)( (uint8_t *)NRF_LPCOMP + lpcomp_task) ) = 1;
-}
-
-
-/**
- * @brief Function for clearing a specific LPCOMP event.
- *
- * @param[in] lpcomp_event LPCOMP event to be cleared.
- *
- */
-__STATIC_INLINE void nrf_lpcomp_event_clear(nrf_lpcomp_event_t lpcomp_event)
-{
-    *( (volatile uint32_t *)( (uint8_t *)NRF_LPCOMP + lpcomp_event) ) = 0;
-}
-
-
-/**
- * @brief Function for getting the state of a specific LPCOMP event.
- *
- * @retval true If the specified LPCOMP event is active.
- *
- */
-__STATIC_INLINE bool nrf_lpcomp_event_check(nrf_lpcomp_event_t lpcomp_event)
-{
-    return (bool) (*(volatile uint32_t *)( (uint8_t *)NRF_LPCOMP + lpcomp_event));
-}
-
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_LPCOMP_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/hal/nrf_nvmc.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_nvmc.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_nvmc.c
deleted file mode 100644
index 312795f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_nvmc.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Copyright (c) 2012 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.
-*
-* $LastChangedRevision: 17685 $
-*/ 
-
-/** 
- *@file
- *@brief NMVC driver implementation 
- */
-
-#include <stdbool.h>
-#include "nrf.h"
-#include "nrf_nvmc.h"
-
-
-void nrf_nvmc_page_erase(uint32_t address)
-{ 
-  // Enable erase.
-  NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Een;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-
-  // Erase the page
-  NRF_NVMC->ERASEPAGE = address;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-  
-  NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-}
-
-
-void nrf_nvmc_write_byte(uint32_t address, uint8_t value)
-{
-  uint32_t byte_shift = address & (uint32_t)0x03;
-  uint32_t address32 = address & ~byte_shift; // Address to the word this byte is in.
-  uint32_t value32 = (*(uint32_t*)address32 & ~((uint32_t)0xFF << (byte_shift << (uint32_t)3)));
-  value32 = value32 + ((uint32_t)value << (byte_shift << 3));
-
-  // Enable write.
-  NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-
-  *(uint32_t*)address32 = value32;
-  while(NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-
-  NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
-  {
-  }
-}
-
-void nrf_nvmc_write_word(uint32_t address, uint32_t value)
-{
-  // Enable write.
-  NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
-  }
-
-  *(uint32_t*)address = value;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy){
-  }
-
-  NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-}
-
-void nrf_nvmc_write_bytes(uint32_t address, const uint8_t * src, uint32_t num_bytes)
-{
-  uint32_t i;
-  for(i=0;i<num_bytes;i++)
-  {
-     nrf_nvmc_write_byte(address+i,src[i]);
-  }
-}
-
-void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words)
-{
-  uint32_t i;
-
-  // Enable write.
-  NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-
-  for(i=0;i<num_words;i++)
-  {
-    ((uint32_t*)address)[i] = src[i];
-    while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-    {
-    }
-  }
-
-  NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
-  while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
-  {
-  }
-}
-

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/hal/nrf_nvmc.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_nvmc.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_nvmc.h
deleted file mode 100644
index a975f5f..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_nvmc.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is confidential 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.
- *              
- * $LastChangedRevision: 17685 $
- */
-
-/**
- * @file
- * @brief NMVC driver API.
- */
-
-#ifndef NRF_NVMC_H__
-#define NRF_NVMC_H__
-
-#include <stdint.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_nvmc Non-volatile memory controller
- * @{
- * @ingroup nrf_drivers
- * @brief Driver for the NVMC peripheral.
- *
- * This driver allows writing to the non-volatile memory (NVM) regions
- * of the chip. In order to write to NVM the controller must be powered
- * on and the relevant page must be erased.
- *
- */
-
-
-/**
- * @brief Erase a page in flash. This is required before writing to any
- * address in the page.
- *
- * @param address Start address of the page. 
- */
-void nrf_nvmc_page_erase(uint32_t address);
-
-
-/**
- * @brief Write a single byte to flash.
- *
- * The function reads the word containing the byte, and then
- * rewrites the entire word.
- *
- * @param address Address to write to.
- * @param value   Value to write.
- */
-void nrf_nvmc_write_byte(uint32_t address , uint8_t value);
-
-
-/**
- * @brief Write a 32-bit word to flash. 
- * @param address Address to write to.
- * @param value   Value to write.
- */
-void nrf_nvmc_write_word(uint32_t address, uint32_t value);
-
-
-/**
- * @brief Write consecutive bytes to flash.
- *
- * @param address   Address to write to.
- * @param src       Pointer to data to copy from.
- * @param num_bytes Number of bytes in src to write.
- */
-void nrf_nvmc_write_bytes(uint32_t  address, const uint8_t * src, uint32_t num_bytes);
-
-
-/**
- * @brief Write consecutive words to flash.
- * 
- * @param address   Address to write to.
- * @param src       Pointer to data to copy from.
- * @param num_words Number of bytes in src to write.
- */
-void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_NVMC_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/hal/nrf_pdm.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pdm.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pdm.h
deleted file mode 100644
index 9b07545..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_pdm.h
+++ /dev/null
@@ -1,367 +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.
- *
- */
-
-
-#ifndef NRF_PDM_H_
-#define NRF_PDM_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_pdm_hal PDM HAL
- * @{
- * @ingroup nrf_pdm
- *
- * @brief @tagAPI52 Hardware abstraction layer for accessing the pulse density modulation (PDM) peripheral.
- */
-
-#include <stdbool.h>
-#include <stddef.h>
-#include "nrf.h"
-#include "nrf_assert.h"
-
-
-#define NRF_PDM_GAIN_MINIMUM  0x00
-#define NRF_PDM_GAIN_DEFAULT  0x28
-#define NRF_PDM_GAIN_MAXIMUM  0x50
-
-typedef uint8_t nrf_pdm_gain_t;
-
-
-/**
- * @brief PDM tasks.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_PDM_TASK_START           = offsetof(NRF_PDM_Type, TASKS_START),           ///< Starts continuous PDM transfer.
-    NRF_PDM_TASK_STOP            = offsetof(NRF_PDM_Type, TASKS_STOP)             ///< Stops PDM transfer.
-} nrf_pdm_task_t;
-
-
-/**
- * @brief PDM events.
- */
-typedef enum /*lint -save -e30 -esym(628,__INTADDR__) */
-{
-    NRF_PDM_EVENT_STARTED       = offsetof(NRF_PDM_Type, EVENTS_STARTED),       ///< PDM transfer has started.
-    NRF_PDM_EVENT_STOPPED       = offsetof(NRF_PDM_Type, EVENTS_STOPPED),       ///< PDM transfer has finished.
-    NRF_PDM_EVENT_END           = offsetof(NRF_PDM_Type, EVENTS_END)            ///< The PDM has written the last sample specified by SAMPLE.MAXCNT (or the last sample after a STOP task has been received) to Data RAM.
-} nrf_pdm_event_t;
-
-
-/**
- * @brief PDM interrupt masks.
- */
-typedef enum
-{
-    NRF_PDM_INT_STARTED = PDM_INTENSET_STARTED_Msk,   ///< Interrupt on EVENTS_STARTED event.
-    NRF_PDM_INT_STOPPED = PDM_INTENSET_STOPPED_Msk,   ///< Interrupt on EVENTS_STOPPED event.
-    NRF_PDM_INT_END     = PDM_INTENSET_END_Msk        ///< Interrupt on EVENTS_END event.
-} nrf_pdm_int_mask_t;
-
-/**
- * @brief PDM clock frequency.
- */
-typedef enum
-{
-    NRF_PDM_FREQ_1000K = PDM_PDMCLKCTRL_FREQ_1000K,  ///< PDM_CLK = 1.000 MHz.
-    NRF_PDM_FREQ_1032K = PDM_PDMCLKCTRL_FREQ_Default,  ///< PDM_CLK = 1.032 MHz.
-    NRF_PDM_FREQ_1067K = PDM_PDMCLKCTRL_FREQ_1067K   ///< PDM_CLK = 1.067 MHz.
-} nrf_pdm_freq_t;
-
-
-/**
- * @brief PDM operation mode.
- */
-typedef enum
-{
-    NRF_PDM_MODE_STEREO = PDM_MODE_OPERATION_Stereo,  ///< Sample and store one pair (Left + Right) of 16-bit samples per RAM word.
-    NRF_PDM_MODE_MONO   = PDM_MODE_OPERATION_Mono     ///< Sample and store two successive Left samples (16 bit each) per RAM word.
-} nrf_pdm_mode_t;
-
-
-/**
- * @brief PDM sampling mode.
- */
-typedef enum
-{
-    NRF_PDM_EDGE_LEFTFALLING = PDM_MODE_EDGE_LeftFalling,  ///< Left (or mono) is sampled on falling edge of PDM_CLK.
-    NRF_PDM_EDGE_LEFTRISING  = PDM_MODE_EDGE_LeftRising    ///< Left (or mono) is sampled on rising edge of PDM_CLK.
-} nrf_pdm_edge_t;
-
-
-/**
- * @brief Function for triggering a PDM task.
- *
- * @param[in] pdm_task PDM task.
- */
-__STATIC_INLINE void nrf_pdm_task_trigger(nrf_pdm_task_t pdm_task)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_task)) = 0x1UL;
-}
-
-
-/**
- * @brief Function for getting the address of a PDM task register.
- *
- * @param[in] pdm_task PDM task.
- *
- * @return Address of the specified PDM task.
- */
-__STATIC_INLINE uint32_t nrf_pdm_task_address_get(nrf_pdm_task_t pdm_task)
-{
-    return (uint32_t)((uint8_t *)NRF_PDM + (uint32_t)pdm_task);
-}
-
-
-/**
- * @brief Function for getting the state of a PDM event.
- *
- * @param[in] pdm_event PDM event.
- *
- * @return State of the specified PDM event.
- */
-__STATIC_INLINE bool nrf_pdm_event_check(nrf_pdm_event_t pdm_event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event);
-}
-
-
-/**
- * @brief Function for clearing a PDM event.
- *
- * @param[in] pdm_event PDM event.
- */
-__STATIC_INLINE void nrf_pdm_event_clear(nrf_pdm_event_t pdm_event)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event)) = 0x0UL;
-}
-
-
-/**
- * @brief Function for getting the address of a PDM event register.
- *
- * @param[in] pdm_event PDM event.
- *
- * @return Address of the specified PDM event.
- */
-__STATIC_INLINE volatile uint32_t * nrf_pdm_event_address_get(nrf_pdm_event_t pdm_event)
-{
-    return (volatile uint32_t *)((uint8_t *)NRF_PDM + (uint32_t)pdm_event);
-}
-
-
-/**
- * @brief Function for enabling PDM interrupts.
- *
- * @param[in] pdm_int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_pdm_int_enable(uint32_t pdm_int_mask)
-{
-    NRF_PDM->INTENSET = pdm_int_mask;
-}
-
-
-/**
- * @brief Function for retrieving the state of PDM interrupts.
- *
- * @param[in] pdm_int_mask Interrupts to check.
- *
- * @retval true  If all specified interrupts are enabled.
- * @retval false If at least one of the given interrupts is not enabled.
- */
-__STATIC_INLINE bool nrf_pdm_int_enable_check(uint32_t pdm_int_mask)
-{
-    return (bool)(NRF_PDM->INTENSET & pdm_int_mask);
-}
-
-
-/**
- * @brief Function for disabling interrupts.
- *
- * @param pdm_int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_pdm_int_disable(uint32_t pdm_int_mask)
-{
-    NRF_PDM->INTENCLR = pdm_int_mask;
-}
-
-
-/**
- * @brief Function for enabling the PDM peripheral.
- *
- * The PDM peripheral must be enabled before use.
- */
-__STATIC_INLINE void nrf_pdm_enable(void)
-{
-    NRF_PDM->ENABLE = (PDM_ENABLE_ENABLE_Enabled << PDM_ENABLE_ENABLE_Pos);
-}
-
-
-/**
- * @brief Function for disabling the PDM peripheral.
- */
-__STATIC_INLINE void nrf_pdm_disable(void)
-{
-    NRF_PDM->ENABLE = (PDM_ENABLE_ENABLE_Disabled << PDM_ENABLE_ENABLE_Pos);
-}
-
-
-/**
- * @brief Function for checking if the PDM peripheral is enabled.
- *
- * @retval true  If the PDM peripheral is enabled.
- * @retval false If the PDM peripheral is not enabled.
- */
-__STATIC_INLINE bool nrf_pdm_enable_check(void)
-{
-    return (NRF_PDM->ENABLE == (PDM_ENABLE_ENABLE_Enabled << PDM_ENABLE_ENABLE_Pos));
-}
-
-
-/**
- * @brief Function for setting the PDM operation mode.
- *
- * @param[in] pdm_mode PDM operation mode.
- * @param[in] pdm_edge PDM sampling mode.
- */
-__STATIC_INLINE void nrf_pdm_mode_set(nrf_pdm_mode_t pdm_mode, nrf_pdm_edge_t pdm_edge)
-{
-    NRF_PDM->MODE = ((pdm_mode << PDM_MODE_OPERATION_Pos) & PDM_MODE_OPERATION_Msk)
-                    | ((pdm_edge << PDM_MODE_EDGE_Pos) & PDM_MODE_EDGE_Msk);
-}
-
-
-/**
- * @brief Function for getting the PDM operation mode.
- *
- * @param[out] p_pdm_mode PDM operation mode.
- * @param[out] p_pdm_edge PDM sampling mode.
- */
-__STATIC_INLINE void nrf_pdm_mode_get(nrf_pdm_mode_t * p_pdm_mode, nrf_pdm_edge_t * p_pdm_edge)
-{
-    uint32_t mode = NRF_PDM->MODE;
-    *p_pdm_mode = (nrf_pdm_mode_t)((mode & PDM_MODE_OPERATION_Msk ) >> PDM_MODE_OPERATION_Pos);
-    *p_pdm_edge = (nrf_pdm_edge_t)((mode & PDM_MODE_EDGE_Msk ) >> PDM_MODE_EDGE_Pos);
-}
-
-
-/**
- * @brief Function for setting the PDM clock frequency.
- *
- * @param[in] pdm_freq PDM clock frequency.
- */
-__STATIC_INLINE void nrf_pdm_clock_set(nrf_pdm_freq_t pdm_freq)
-{
-    NRF_PDM->PDMCLKCTRL = ((pdm_freq << PDM_PDMCLKCTRL_FREQ_Pos) & PDM_PDMCLKCTRL_FREQ_Msk);
-}
-
-
-/**
- * @brief Function for getting the PDM clock frequency.
- */
-__STATIC_INLINE nrf_pdm_freq_t nrf_pdm_clock_get(void)
-{
-     return (nrf_pdm_freq_t) ((NRF_PDM->PDMCLKCTRL << PDM_PDMCLKCTRL_FREQ_Pos) & PDM_PDMCLKCTRL_FREQ_Msk);
-}
-
-
-/**
- * @brief Function for setting up the PDM pins.
- *
- * @param[in] psel_clk CLK pin number.
- * @param[in] psel_din DIN pin number.
- */
-__STATIC_INLINE void nrf_pdm_psel_connect(uint32_t psel_clk, uint32_t psel_din)
-{
-    NRF_PDM->PSEL.CLK = ((psel_clk << PDM_PSEL_CLK_PIN_Pos) & PDM_PSEL_CLK_PIN_Msk)
-            | ((PDM_PSEL_CLK_CONNECT_Connected << PDM_PSEL_CLK_CONNECT_Pos) & PDM_PSEL_CLK_CONNECT_Msk);
-    NRF_PDM->PSEL.DIN = ((psel_din << PDM_PSEL_DIN_PIN_Pos) & PDM_PSEL_DIN_PIN_Msk)
-            | ((PDM_PSEL_DIN_CONNECT_Connected << PDM_PSEL_CLK_CONNECT_Pos) & PDM_PSEL_DIN_CONNECT_Msk);
-}
-
-/**
- * @brief Function for disconnecting the PDM pins.
- */
-__STATIC_INLINE void nrf_pdm_psel_disconnect()
-{
-    NRF_PDM->PSEL.CLK = ((PDM_PSEL_CLK_CONNECT_Disconnected << PDM_PSEL_CLK_CONNECT_Pos) 
-                         & PDM_PSEL_CLK_CONNECT_Msk);
-    NRF_PDM->PSEL.DIN = ((PDM_PSEL_DIN_CONNECT_Disconnected << PDM_PSEL_DIN_CONNECT_Pos) 
-                         & PDM_PSEL_DIN_CONNECT_Msk);
-}
-
-
-/**
- * @brief Function for setting the PDM gain.
- *
- * @param[in] gain_l Left channel gain.
- * @param[in] gain_r Right channel gain.
- */
-__STATIC_INLINE void nrf_pdm_gain_set(nrf_pdm_gain_t gain_l, nrf_pdm_gain_t gain_r)
-{
-    NRF_PDM->GAINL = gain_l;
-    NRF_PDM->GAINR = gain_r;
-}
-
-
-/**
- * @brief Function for getting the PDM gain.
- *
- * @param[out] p_gain_l Left channel gain.
- * @param[out] p_gain_r Right channel gain.
- */
-__STATIC_INLINE void nrf_pdm_gain_get(nrf_pdm_gain_t * p_gain_l, nrf_pdm_gain_t * p_gain_r)
-{
-    *p_gain_l = NRF_PDM->GAINL;
-    *p_gain_r = NRF_PDM->GAINR;
-}
-
-
-/**
- * @brief Function for setting the PDM sample buffer.
- *
- * @param[in] p_buffer Pointer to the RAM address where samples should be written with EasyDMA.
- * @param[in] num    Number of samples to allocate memory for in EasyDMA mode.
- *
- * The amount of allocated RAM depends on the operation mode.
- * - For stereo mode: N 32-bit words.
- * - For mono mode: Ceil(N/2) 32-bit words.
- */
-__STATIC_INLINE void nrf_pdm_buffer_set(uint32_t * p_buffer, uint32_t num)
-{
-    NRF_PDM->SAMPLE.PTR = (uint32_t)p_buffer;
-    NRF_PDM->SAMPLE.MAXCNT = num;
-}
-
-/**
- * @brief Function for getting the current PDM sample buffer address.
- *
- * @return Pointer to the current sample buffer.
- */
-__STATIC_INLINE uint32_t * nrf_pdm_buffer_get()
-{
-    return (uint32_t *)NRF_PDM->SAMPLE.PTR;
-}
-
-
-/**
- *@}
- **/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_PDM_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/hal/nrf_ppi.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ppi.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ppi.h
deleted file mode 100644
index c7d8dbe..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_ppi.h
+++ /dev/null
@@ -1,410 +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.
- *
- */
-
-#ifndef NRF_PPI_H__
-#define NRF_PPI_H__
-
-#include <stddef.h>
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_ppi_hal PPI HAL
- * @{
- * @ingroup nrf_ppi
- * @brief Hardware access layer for setting up Programmable Peripheral Interconnect (PPI) channels.
- */
-
-#define NRF_PPI_TASK_SET    (1UL)
-
-/**
- * @enum nrf_ppi_channel_t
- * @brief PPI channels.
- */
-typedef enum
-{
-    NRF_PPI_CHANNEL0  = PPI_CHEN_CH0_Pos,  /**< Channel 0. */
-    NRF_PPI_CHANNEL1  = PPI_CHEN_CH1_Pos,  /**< Channel 1. */
-    NRF_PPI_CHANNEL2  = PPI_CHEN_CH2_Pos,  /**< Channel 2. */
-    NRF_PPI_CHANNEL3  = PPI_CHEN_CH3_Pos,  /**< Channel 3. */
-    NRF_PPI_CHANNEL4  = PPI_CHEN_CH4_Pos,  /**< Channel 4. */
-    NRF_PPI_CHANNEL5  = PPI_CHEN_CH5_Pos,  /**< Channel 5. */
-    NRF_PPI_CHANNEL6  = PPI_CHEN_CH6_Pos,  /**< Channel 6. */
-    NRF_PPI_CHANNEL7  = PPI_CHEN_CH7_Pos,  /**< Channel 7. */
-    NRF_PPI_CHANNEL8  = PPI_CHEN_CH8_Pos,  /**< Channel 8. */
-    NRF_PPI_CHANNEL9  = PPI_CHEN_CH9_Pos,  /**< Channel 9. */
-    NRF_PPI_CHANNEL10 = PPI_CHEN_CH10_Pos, /**< Channel 10. */
-    NRF_PPI_CHANNEL11 = PPI_CHEN_CH11_Pos, /**< Channel 11. */
-    NRF_PPI_CHANNEL12 = PPI_CHEN_CH12_Pos, /**< Channel 12. */
-    NRF_PPI_CHANNEL13 = PPI_CHEN_CH13_Pos, /**< Channel 13. */
-    NRF_PPI_CHANNEL14 = PPI_CHEN_CH14_Pos, /**< Channel 14. */
-    NRF_PPI_CHANNEL15 = PPI_CHEN_CH15_Pos, /**< Channel 15. */
-#ifdef NRF52
-    NRF_PPI_CHANNEL16 = PPI_CHEN_CH16_Pos, /**< Channel 16. */
-    NRF_PPI_CHANNEL17 = PPI_CHEN_CH17_Pos, /**< Channel 17. */
-    NRF_PPI_CHANNEL18 = PPI_CHEN_CH18_Pos, /**< Channel 18. */
-    NRF_PPI_CHANNEL19 = PPI_CHEN_CH19_Pos, /**< Channel 19. */
-#endif
-    NRF_PPI_CHANNEL20 = PPI_CHEN_CH20_Pos, /**< Channel 20. */
-    NRF_PPI_CHANNEL21 = PPI_CHEN_CH21_Pos, /**< Channel 21. */
-    NRF_PPI_CHANNEL22 = PPI_CHEN_CH22_Pos, /**< Channel 22. */
-    NRF_PPI_CHANNEL23 = PPI_CHEN_CH23_Pos, /**< Channel 23. */
-    NRF_PPI_CHANNEL24 = PPI_CHEN_CH24_Pos, /**< Channel 24. */
-    NRF_PPI_CHANNEL25 = PPI_CHEN_CH25_Pos, /**< Channel 25. */
-    NRF_PPI_CHANNEL26 = PPI_CHEN_CH26_Pos, /**< Channel 26. */
-    NRF_PPI_CHANNEL27 = PPI_CHEN_CH27_Pos, /**< Channel 27. */
-    NRF_PPI_CHANNEL28 = PPI_CHEN_CH28_Pos, /**< Channel 28. */
-    NRF_PPI_CHANNEL29 = PPI_CHEN_CH29_Pos, /**< Channel 29. */
-    NRF_PPI_CHANNEL30 = PPI_CHEN_CH30_Pos, /**< Channel 30. */
-    NRF_PPI_CHANNEL31 = PPI_CHEN_CH31_Pos  /**< Channel 31. */
-} nrf_ppi_channel_t;
-
-/**
- * @enum nrf_ppi_channel_group_t
- * @brief PPI channel groups.
- */
-typedef enum
-{
-    NRF_PPI_CHANNEL_GROUP0 = 0, /**< Channel group 0. */
-    NRF_PPI_CHANNEL_GROUP1 = 1, /**< Channel group 1. */
-    NRF_PPI_CHANNEL_GROUP2 = 2, /**< Channel group 2. */
-    NRF_PPI_CHANNEL_GROUP3 = 3, /**< Channel group 3. */
-#ifdef NRF52
-    NRF_PPI_CHANNEL_GROUP4 = 4, /**< Channel group 4. */
-    NRF_PPI_CHANNEL_GROUP5 = 5  /**< Channel group 5. */
-#endif
-} nrf_ppi_channel_group_t;
-
-/**
- * @enum nrf_ppi_channel_include_t
- * @brief Definition of which PPI channels belong to a group.
- */
-typedef enum
-{
-    NRF_PPI_CHANNEL_EXCLUDE = PPI_CHG_CH0_Excluded, /**< Channel excluded from a group. */
-    NRF_PPI_CHANNEL_INCLUDE = PPI_CHG_CH0_Included  /**< Channel included in a group. */
-} nrf_ppi_channel_include_t;
-
-/**
- * @enum nrf_ppi_channel_enable_t
- * @brief Definition if a PPI channel is enabled.
- */
-typedef enum
-{
-    NRF_PPI_CHANNEL_DISABLED = PPI_CHEN_CH0_Disabled, /**< Channel disabled. */
-    NRF_PPI_CHANNEL_ENABLED  = PPI_CHEN_CH0_Enabled   /**< Channel enabled. */
-} nrf_ppi_channel_enable_t;
-
-/**
- * @enum nrf_ppi_task_t
- * @brief PPI tasks.
- */
-typedef enum
-{
-    /*lint -save -e30 -esym(628,__INTADDR__)*/
-    NRF_PPI_TASK_CHG0_EN  = offsetof(NRF_PPI_Type, TASKS_CHG[0].EN),  /**< Task for enabling channel group 0 */
-    NRF_PPI_TASK_CHG0_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[0].DIS), /**< Task for disabling channel group 0 */
-    NRF_PPI_TASK_CHG1_EN  = offsetof(NRF_PPI_Type, TASKS_CHG[1].EN),  /**< Task for enabling channel group 1 */
-    NRF_PPI_TASK_CHG1_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[1].DIS), /**< Task for disabling channel group 1 */
-    NRF_PPI_TASK_CHG2_EN  = offsetof(NRF_PPI_Type, TASKS_CHG[2].EN),  /**< Task for enabling channel group 2 */
-    NRF_PPI_TASK_CHG2_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[2].DIS), /**< Task for disabling channel group 2 */
-    NRF_PPI_TASK_CHG3_EN  = offsetof(NRF_PPI_Type, TASKS_CHG[3].EN),  /**< Task for enabling channel group 3 */
-    NRF_PPI_TASK_CHG3_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[3].DIS), /**< Task for disabling channel group 3 */
-#ifdef NRF52
-    NRF_PPI_TASK_CHG4_EN  = offsetof(NRF_PPI_Type, TASKS_CHG[4].EN),  /**< Task for enabling channel group 4 */
-    NRF_PPI_TASK_CHG4_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[4].DIS), /**< Task for disabling channel group 4 */
-    NRF_PPI_TASK_CHG5_EN  = offsetof(NRF_PPI_Type, TASKS_CHG[5].EN),  /**< Task for enabling channel group 5 */
-    NRF_PPI_TASK_CHG5_DIS = offsetof(NRF_PPI_Type, TASKS_CHG[5].DIS)  /**< Task for disabling channel group 5 */
-#endif
-    /*lint -restore*/
-} nrf_ppi_task_t;
-
-/**
- * @brief Function for enabling a given PPI channel.
- *
- * @details This function enables only one channel.
- *
- * @param[in] channel Channel to enable.
- *
- *  */
-__STATIC_INLINE void nrf_ppi_channel_enable(nrf_ppi_channel_t channel)
-{
-    NRF_PPI->CHENSET = PPI_CHENSET_CH0_Set << ((uint32_t) channel);
-}
-
-
-/**
- * @brief Function for disabling a given PPI channel.
- *
- * @details This function disables only one channel.
- *
- * @param[in] channel Channel to disable.
- */
-__STATIC_INLINE void nrf_ppi_channel_disable(nrf_ppi_channel_t channel)
-{
-    NRF_PPI->CHENCLR = PPI_CHENCLR_CH0_Clear << ((uint32_t) channel);
-}
-
-
-/**
- * @brief Function for checking if a given PPI channel is enabled.
- *
- * @details This function checks only one channel.
- *
- * @param[in] channel Channel to check.
- *
- * @retval     NRF_PPI_CHANNEL_ENABLED     If the channel is enabled.
- * @retval     NRF_PPI_CHANNEL_DISABLED    If the channel is not enabled.
- *
- */
-__STATIC_INLINE nrf_ppi_channel_enable_t nrf_ppi_channel_enable_get(nrf_ppi_channel_t channel)
-{
-    if (NRF_PPI->CHEN & (PPI_CHEN_CH0_Msk << ((uint32_t) channel)))
-    {
-        return NRF_PPI_CHANNEL_ENABLED;
-    }
-    else
-    {
-        return NRF_PPI_CHANNEL_DISABLED;
-    }
-}
-
-
-/**
- * @brief Function for disabling all PPI channels.
- */
-__STATIC_INLINE void nrf_ppi_channel_disable_all(void)
-{
-    NRF_PPI->CHENCLR = ((uint32_t)0xFFFFFFFFuL);
-}
-
-/**
- * @brief Function for disabling multiple PPI channels.
- *
- * @param[in] mask Channel mask.
- */
-__STATIC_INLINE void nrf_ppi_channels_disable(uint32_t mask)
-{
-    NRF_PPI->CHENCLR = mask;
-}
-
-/**
- * @brief Function for setting up event and task endpoints for a given PPI channel.
- *
- * @param[in] eep Event register address.
- *
- * @param[in] tep Task register address.
- *
- * @param[in] channel Channel to which the given endpoints are assigned.
- */
-__STATIC_INLINE void nrf_ppi_channel_endpoint_setup(nrf_ppi_channel_t channel,
-                                                    uint32_t          eep,
-                                                    uint32_t          tep)
-{
-    NRF_PPI->CH[(uint32_t) channel].EEP = eep;
-    NRF_PPI->CH[(uint32_t) channel].TEP = tep;
-}
-
-#ifdef NRF52
-/**
- * @brief Function for setting up task endpoint for a given PPI fork.
- *
- * @param[in] fork_tep Task register address.
- *
- * @param[in] channel Channel to which the given fork endpoint is assigned.
- */
-__STATIC_INLINE void nrf_ppi_fork_endpoint_setup(nrf_ppi_channel_t channel,
-                                                 uint32_t          fork_tep)
-{
-    NRF_PPI->FORK[(uint32_t) channel].TEP = fork_tep;
-}
-
-/**
- * @brief Function for setting up event and task endpoints for a given PPI channel and fork.
- *
- * @param[in] eep Event register address.
- *
- * @param[in] tep Task register address.
- *
- * @param[in] fork_tep Fork task register address (register value).
- *
- * @param[in] channel Channel to which the given endpoints are assigned.
- */
-__STATIC_INLINE void nrf_ppi_channel_and_fork_endpoint_setup(nrf_ppi_channel_t channel,
-                                                             uint32_t          eep,
-                                                             uint32_t          tep,
-                                                             uint32_t          fork_tep)
-{
-    nrf_ppi_channel_endpoint_setup(channel, eep, tep);
-    nrf_ppi_fork_endpoint_setup(channel, fork_tep);
-}
-#endif
-
-/**
- * @brief Function for including a PPI channel in a channel group.
- *
- * @details This function adds only one channel to the group.
- *
- * @param[in] channel       Channel to be included in the group.
- *
- * @param[in] channel_group Channel group.
- *
- */
-__STATIC_INLINE void nrf_ppi_channel_include_in_group(nrf_ppi_channel_t       channel,
-                                                      nrf_ppi_channel_group_t channel_group)
-{
-    NRF_PPI->CHG[(uint32_t) channel_group] =
-        NRF_PPI->CHG[(uint32_t) channel_group] | (PPI_CHG_CH0_Included << ((uint32_t)  channel));
-}
-
-/**
- * @brief Function for including multiple PPI channels in a channel group.
- *
- * @details This function adds all specified channels to the group.
- *
- * @param[in] channel_mask  Channels to be included in the group.
- *
- * @param[in] channel_group Channel group.
- *
- */
-__STATIC_INLINE void nrf_ppi_channels_include_in_group(uint32_t                channel_mask,
-                                                       nrf_ppi_channel_group_t channel_group)
-{
-    NRF_PPI->CHG[(uint32_t) channel_group] =
-        NRF_PPI->CHG[(uint32_t) channel_group] | (channel_mask);
-}
-
-
-/**
- * @brief Function for removing a PPI channel from a channel group.
- *
- * @details This function removes only one channel from the group.
- *
- * @param[in] channel       Channel to be removed from the group.
- *
- * @param[in] channel_group Channel group.
- */
-__STATIC_INLINE void nrf_ppi_channel_remove_from_group(nrf_ppi_channel_t       channel,
-                                                       nrf_ppi_channel_group_t channel_group)
-{
-    NRF_PPI->CHG[(uint32_t) channel_group] =
-        NRF_PPI->CHG[(uint32_t) channel_group] & ~(PPI_CHG_CH0_Included << ((uint32_t) channel));
-}
-
-/**
- * @brief Function for removing multiple PPI channels from a channel group.
- *
- * @details This function removes all specified channels from the group.
- *
- * @param[in] channel_mask  Channels to be removed from the group.
- *
- * @param[in] channel_group Channel group.
- */
-__STATIC_INLINE void nrf_ppi_channels_remove_from_group(uint32_t                channel_mask,
-                                                        nrf_ppi_channel_group_t channel_group)
-{
-    NRF_PPI->CHG[(uint32_t) channel_group] =
-        NRF_PPI->CHG[(uint32_t) channel_group] & ~(channel_mask);
-}
-
-
-/**
- * @brief Function for removing all PPI channels from a channel group.
- *
- * @param[in] group Channel group.
- *
- */
-__STATIC_INLINE void nrf_ppi_channel_group_clear(nrf_ppi_channel_group_t group)
-{
-    NRF_PPI->CHG[(uint32_t) group] = 0;
-}
-
-
-/**
- * @brief Function for enabling a channel group.
- *
- * @param[in] group Channel group.
- *
- */
-__STATIC_INLINE void nrf_ppi_group_enable(nrf_ppi_channel_group_t group)
-{
-    NRF_PPI->TASKS_CHG[(uint32_t) group].EN = NRF_PPI_TASK_SET;
-}
-
-
-/**
- * @brief Function for disabling a channel group.
- *
- * @param[in] group Channel group.
- *
- */
-__STATIC_INLINE void nrf_ppi_group_disable(nrf_ppi_channel_group_t group)
-{
-    NRF_PPI->TASKS_CHG[(uint32_t) group].DIS = NRF_PPI_TASK_SET;
-}
-
-
-/**
- * @brief Function for setting a PPI task.
- *
- * @param[in] ppi_task PPI task to set.
- */
-__STATIC_INLINE void nrf_ppi_task_trigger(nrf_ppi_task_t ppi_task)
-{
-    *((volatile uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task)) = NRF_PPI_TASK_SET;
-}
-
-
-/**
- * @brief Function for returning the address of a specific PPI task register.
- *
- * @param[in] ppi_task PPI task.
- */
-__STATIC_INLINE uint32_t * nrf_ppi_task_address_get(nrf_ppi_task_t ppi_task)
-{
-    return (uint32_t *) ((uint8_t *) NRF_PPI_BASE + (uint32_t) ppi_task);
-}
-
-/**
- * @brief Function for returning the PPI enable task address of a specific group.
- *
- * @param[in] group  PPI group.
- */
-__STATIC_INLINE uint32_t * nrf_ppi_task_group_enable_address_get(nrf_ppi_channel_group_t group)
-{
-    return (uint32_t *) &NRF_PPI->TASKS_CHG[(uint32_t) group].EN;
-}
-
-/**
- * @brief Function for returning the PPI disable task address of a specific group.
- *
- * @param[in] group  PPI group.
- */
-__STATIC_INLINE uint32_t * nrf_ppi_task_group_disable_address_get(nrf_ppi_channel_group_t group)
-{
-    return (uint32_t *) &NRF_PPI->TASKS_CHG[(uint32_t) group].DIS;
-}
-
-
-/**
- *@}
- **/
-
-/*lint --flb "Leave library region" */
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_PPI_H__


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

Posted by cc...@apache.org.
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/hal/nrf_twim.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twim.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twim.h
deleted file mode 100644
index 7d4e5cc..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twim.h
+++ /dev/null
@@ -1,486 +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.
- *
- */
-
-#ifndef NRF_TWIM_H__
-#define NRF_TWIM_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_twim_hal TWIM HAL
- * @{
- * @ingroup nrf_twi_master
- *
- * @brief Hardware access layer for managing the TWIM peripheral.
- */
-
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-#include "nrf.h"
-
-/**
- * @brief TWIM tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_TWIM_TASK_STARTRX = offsetof(NRF_TWIM_Type, TASKS_STARTRX), ///< Start TWI receive sequence.
-    NRF_TWIM_TASK_STARTTX = offsetof(NRF_TWIM_Type, TASKS_STARTTX), ///< Start TWI transmit sequence.
-    NRF_TWIM_TASK_STOP    = offsetof(NRF_TWIM_Type, TASKS_STOP),    ///< Stop TWI transaction.
-    NRF_TWIM_TASK_SUSPEND = offsetof(NRF_TWIM_Type, TASKS_SUSPEND), ///< Suspend TWI transaction.
-    NRF_TWIM_TASK_RESUME  = offsetof(NRF_TWIM_Type, TASKS_RESUME)   ///< Resume TWI transaction.
-    /*lint -restore*/
-} nrf_twim_task_t;
-
-/**
- * @brief TWIM events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_TWIM_EVENT_STOPPED   = offsetof(NRF_TWIM_Type, EVENTS_STOPPED),   ///< TWI stopped.
-    NRF_TWIM_EVENT_ERROR     = offsetof(NRF_TWIM_Type, EVENTS_ERROR),     ///< TWI error.
-    NRF_TWIM_EVENT_SUSPENDED = 0x148,                                     ///< TWI suspended.
-    NRF_TWIM_EVENT_RXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_RXSTARTED), ///< Receive sequence started.
-    NRF_TWIM_EVENT_TXSTARTED = offsetof(NRF_TWIM_Type, EVENTS_TXSTARTED), ///< Transmit sequence started.
-    NRF_TWIM_EVENT_LASTRX    = offsetof(NRF_TWIM_Type, EVENTS_LASTRX),    ///< Byte boundary, starting to receive the last byte.
-    NRF_TWIM_EVENT_LASTTX    = offsetof(NRF_TWIM_Type, EVENTS_LASTTX)     ///< Byte boundary, starting to transmit the last byte.
-    /*lint -restore*/
-} nrf_twim_event_t;
-
-/**
- * @brief TWIM shortcuts.
- */
-typedef enum
-{
-    NRF_TWIM_SHORT_LASTTX_STARTRX_MASK = TWIM_SHORTS_LASTTX_STARTRX_Msk, ///< Shortcut between LASTTX event and STARTRX task.
-    NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK = TWIM_SHORTS_LASTTX_SUSPEND_Msk, ///< Shortcut between LASTTX event and SUSPEND task.
-    NRF_TWIM_SHORT_LASTTX_STOP_MASK    = TWIM_SHORTS_LASTTX_STOP_Msk,    ///< Shortcut between LASTTX event and STOP task.
-    NRF_TWIM_SHORT_LASTRX_STARTTX_MASK = TWIM_SHORTS_LASTRX_STARTTX_Msk, ///< Shortcut between LASTRX event and STARTTX task.
-    NRF_TWIM_SHORT_LASTRX_STOP_MASK    = TWIM_SHORTS_LASTRX_STOP_Msk     ///< Shortcut between LASTRX event and STOP task.
-} nrf_twim_short_mask_t;
-
-/**
- * @brief TWIM interrupts.
- */
-typedef enum
-{
-    NRF_TWIM_INT_STOPPED_MASK   = TWIM_INTENSET_STOPPED_Msk,   ///< Interrupt on STOPPED event.
-    NRF_TWIM_INT_ERROR_MASK     = TWIM_INTENSET_ERROR_Msk,     ///< Interrupt on ERROR event.
-    NRF_TWIM_INT_SUSPENDED_MASK = (1 << 18),                   ///< Interrupt on SUSPENDED event.
-    NRF_TWIM_INT_RXSTARTED_MASK = TWIM_INTENSET_RXSTARTED_Msk, ///< Interrupt on RXSTARTED event.
-    NRF_TWIM_INT_TXSTARTED_MASK = TWIM_INTENSET_TXSTARTED_Msk, ///< Interrupt on TXSTARTED event.
-    NRF_TWIM_INT_LASTRX_MASK    = TWIM_INTENSET_LASTRX_Msk,    ///< Interrupt on LASTRX event.
-    NRF_TWIM_INT_LASTTX_MASK    = TWIM_INTENSET_LASTTX_Msk     ///< Interrupt on LASTTX event.
-} nrf_twim_int_mask_t;
-
-/**
- * @brief TWIM master clock frequency.
- */
-typedef enum
-{
-    NRF_TWIM_FREQ_100K = TWIM_FREQUENCY_FREQUENCY_K100, ///< 100 kbps.
-    NRF_TWIM_FREQ_250K = TWIM_FREQUENCY_FREQUENCY_K250, ///< 250 kbps.
-    NRF_TWIM_FREQ_400K = TWIM_FREQUENCY_FREQUENCY_K400  ///< 400 kbps.
-} nrf_twim_frequency_t;
-
-/**
- * @brief TWIM error source.
- */
-typedef enum
-{
-    NRF_TWIM_ERROR_ADDRESS_NACK = TWIM_ERRORSRC_ANACK_Msk, ///< NACK received after sending the address.
-    NRF_TWIM_ERROR_DATA_NACK    = TWIM_ERRORSRC_DNACK_Msk  ///< NACK received after sending a data byte.
-} nrf_twim_error_t;
-
-
-/**
- * @brief Function for activating a specific TWIM task.
- *
- * @param[in] p_twim TWIM instance.
- * @param[in] task   Task to activate.
- */
-__STATIC_INLINE void nrf_twim_task_trigger(NRF_TWIM_Type * p_twim,
-                                           nrf_twim_task_t task);
-
-/**
- * @brief Function for getting the address of a specific TWIM task register.
- *
- * @param[in] p_twim TWIM instance.
- * @param[in] task   Requested task.
- *
- * @return Address of the specified task register.
- */
-__STATIC_INLINE uint32_t * nrf_twim_task_address_get(NRF_TWIM_Type * p_twim,
-                                                     nrf_twim_task_t task);
-
-/**
- * @brief Function for clearing a specific TWIM event.
- *
- * @param[in] p_twim TWIM instance.
- * @param[in] event  Event to clear.
- */
-__STATIC_INLINE void nrf_twim_event_clear(NRF_TWIM_Type * p_twim,
-                                          nrf_twim_event_t event);
-
-/**
- * @brief Function for checking the state of a specific TWIM event.
- *
- * @param[in] p_twim TWIM instance.
- * @param[in] event  Event to check.
- *
- * @retval true  If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_twim_event_check(NRF_TWIM_Type * p_twim,
-                                          nrf_twim_event_t event);
-
-/**
- * @brief Function for getting the address of a specific TWIM event register.
- *
- * @param[in] p_twim TWIM instance.
- * @param[in] event  Requested event.
- *
- * @return Address of the specified event register.
- */
-__STATIC_INLINE uint32_t * nrf_twim_event_address_get(NRF_TWIM_Type  * p_twim,
-                                                      nrf_twim_event_t event);
-
-/**
- * @brief Function for enabling specified shortcuts.
- *
- * @param[in] p_twim      TWIM instance.
- * @param[in] shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_twim_shorts_enable(NRF_TWIM_Type * p_twim,
-                                            uint32_t shorts_mask);
-
-/**
- * @brief Function for disabling specified shortcuts.
- *
- * @param[in] p_twim      TWIM instance.
- * @param[in] shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_twim_shorts_disable(NRF_TWIM_Type * p_twim,
-                                             uint32_t shorts_mask);
-
-/**
- * @brief Function for enabling specified interrupts.
- *
- * @param[in] p_twim   TWIM instance.
- * @param[in] int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_twim_int_enable(NRF_TWIM_Type * p_twim,
-                                         uint32_t int_mask);
-
-/**
- * @brief Function for disabling specified interrupts.
- *
- * @param[in] p_twim   TWIM instance.
- * @param[in] int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_twim_int_disable(NRF_TWIM_Type * p_twim,
-                                          uint32_t int_mask);
-
-/**
- * @brief Function for checking the state of a given interrupt.
- *
- * @param[in] p_twim   TWIM instance.
- * @param[in] int_mask Interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_twim_int_enable_check(NRF_TWIM_Type * p_twim,
-                                               nrf_twim_int_mask_t int_mask);
-
-/**
- * @brief Function for enabling the TWIM peripheral.
- *
- * @param[in] p_twim TWIM instance.
- */
-__STATIC_INLINE void nrf_twim_enable(NRF_TWIM_Type * p_twim);
-
-/**
- * @brief Function for disabling the TWIM peripheral.
- *
- * @param[in] p_twim TWIM instance.
- */
-__STATIC_INLINE void nrf_twim_disable(NRF_TWIM_Type * p_twim);
-
-/**
- * @brief Function for configuring TWI pins.
- *
- *
- * @param[in] p_twim  TWIM instance.
- * @param[in] scl_pin SCL pin number.
- * @param[in] sda_pin SDA pin number.
- */
-__STATIC_INLINE void nrf_twim_pins_set(NRF_TWIM_Type * p_twim,
-                                       uint32_t scl_pin,
-                                       uint32_t sda_pin);
-
-/**
- * @brief Function for setting the TWI master clock frequency.
- *
- * @param[in] p_twim    TWIM instance.
- * @param[in] frequency TWI frequency.
- */
-__STATIC_INLINE void nrf_twim_frequency_set(NRF_TWIM_Type * p_twim,
-                                            nrf_twim_frequency_t frequency);
-
-/**
- * @brief Function for checking the TWI error source.
- *
- * The error flags are cleared after reading.
- *
- * @param[in] p_twim TWIM instance.
- *
- * @return Mask with error source flags.
- */
-__STATIC_INLINE uint32_t nrf_twim_errorsrc_get_and_clear(NRF_TWIM_Type * p_twim);
-
-/**
- * @brief Function for setting the address to be used in TWI transfers.
- *
- * @param[in] p_twim  TWIM instance.
- * @param[in] address Address to be used in transfers.
- */
-__STATIC_INLINE void nrf_twim_address_set(NRF_TWIM_Type * p_twim,
-                                          uint8_t address);
-
-/**
- * @brief Function for setting the transmit buffer.
- *
- * @param[in]  p_twim   TWIM instance.
- * @param[in]  p_buffer Pointer to the buffer with data to send.
- * @param[in]  length   Maximum number of data bytes to transmit.
- */
-__STATIC_INLINE void nrf_twim_tx_buffer_set(NRF_TWIM_Type * p_twim,
-                                            uint8_t const * p_buffer,
-                                            uint8_t         length);
-
-/**
- * @brief Function for setting the receive buffer.
- *
- * @param[in] p_twim   TWIM instance.
- * @param[in] p_buffer Pointer to the buffer for received data.
- * @param[in] length   Maximum number of data bytes to receive.
- */
-__STATIC_INLINE void nrf_twim_rx_buffer_set(NRF_TWIM_Type * p_twim,
-                                            uint8_t * p_buffer,
-                                            uint8_t   length);
-
-__STATIC_INLINE void nrf_twim_shorts_set(NRF_TWIM_Type * p_twim,
-                                         uint32_t shorts_mask);
-
-__STATIC_INLINE uint32_t nrf_twim_txd_amount_get(NRF_TWIM_Type * p_twim);
-
-__STATIC_INLINE uint32_t nrf_twim_rxd_amount_get(NRF_TWIM_Type * p_twim);
-
-/**
- * @brief Function for enabling the TX list feature.
- *
- * @param[in] p_twim TWIM instance.
- */
-__STATIC_INLINE void nrf_twim_tx_list_enable(NRF_TWIM_Type * p_twim);
-
-/**
- * @brief Function for disabling the TX list feature.
- *
- * @param[in] p_twim TWIM instance.
- */
-__STATIC_INLINE void nrf_twim_tx_list_disable(NRF_TWIM_Type * p_twim);
-
-/**
- * @brief Function for enabling the RX list feature.
- *
- * @param[in] p_twim TWIM instance.
- */
-__STATIC_INLINE void nrf_twim_rx_list_enable(NRF_TWIM_Type * p_twim);
-
-/**
- * @brief Function for disabling the RX list feature.
- *
- * @param[in] p_twim TWIM instance.
- */
-__STATIC_INLINE void nrf_twim_rx_list_disable(NRF_TWIM_Type * p_twim);
-
-/**
- * @}
- */
-
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-__STATIC_INLINE void nrf_twim_task_trigger(NRF_TWIM_Type * p_twim,
-                                           nrf_twim_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_twim + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t * nrf_twim_task_address_get(NRF_TWIM_Type * p_twim,
-                                                     nrf_twim_task_t task)
-{
-    return (uint32_t *)((uint8_t *)p_twim + (uint32_t)task);
-}
-
-__STATIC_INLINE void nrf_twim_event_clear(NRF_TWIM_Type * p_twim,
-                                          nrf_twim_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_twim + (uint32_t)event)) = 0x0UL;
-}
-
-__STATIC_INLINE bool nrf_twim_event_check(NRF_TWIM_Type * p_twim,
-                                          nrf_twim_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_twim + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t * nrf_twim_event_address_get(NRF_TWIM_Type  * p_twim,
-                                                      nrf_twim_event_t event)
-{
-    return (uint32_t *)((uint8_t *)p_twim + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_twim_shorts_enable(NRF_TWIM_Type * p_twim,
-                                            uint32_t shorts_mask)
-{
-    p_twim->SHORTS |= shorts_mask;
-}
-
-__STATIC_INLINE void nrf_twim_shorts_disable(NRF_TWIM_Type * p_twim,
-                                             uint32_t shorts_mask)
-{
-    p_twim->SHORTS &= ~(shorts_mask);
-}
-
-__STATIC_INLINE void nrf_twim_int_enable(NRF_TWIM_Type * p_twim,
-                                         uint32_t int_mask)
-{
-    p_twim->INTENSET = int_mask;
-}
-
-__STATIC_INLINE void nrf_twim_int_disable(NRF_TWIM_Type * p_twim,
-                                          uint32_t int_mask)
-{
-    p_twim->INTENCLR = int_mask;
-}
-
-__STATIC_INLINE bool nrf_twim_int_enable_check(NRF_TWIM_Type * p_twim,
-                                               nrf_twim_int_mask_t int_mask)
-{
-    return (bool)(p_twim->INTENSET & int_mask);
-}
-
-__STATIC_INLINE void nrf_twim_enable(NRF_TWIM_Type * p_twim)
-{
-    p_twim->ENABLE = (TWIM_ENABLE_ENABLE_Enabled << TWIM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_twim_disable(NRF_TWIM_Type * p_twim)
-{
-    p_twim->ENABLE = (TWIM_ENABLE_ENABLE_Disabled << TWIM_ENABLE_ENABLE_Pos);
-}
-
-__STATIC_INLINE void nrf_twim_pins_set(NRF_TWIM_Type * p_twim,
-                                       uint32_t scl_pin,
-                                       uint32_t sda_pin)
-{
-    p_twim->PSEL.SCL = scl_pin;
-    p_twim->PSEL.SDA = sda_pin;
-}
-
-__STATIC_INLINE void nrf_twim_frequency_set(NRF_TWIM_Type * p_twim,
-                                            nrf_twim_frequency_t frequency)
-{
-    p_twim->FREQUENCY = frequency;
-}
-
-__STATIC_INLINE uint32_t nrf_twim_errorsrc_get_and_clear(NRF_TWIM_Type * p_twim)
-{
-    uint32_t error_source = p_twim->ERRORSRC;
-
-    // [error flags are cleared by writing '1' on their position]
-    p_twim->ERRORSRC = error_source;
-
-    return error_source;
-}
-
-__STATIC_INLINE void nrf_twim_address_set(NRF_TWIM_Type * p_twim,
-                                          uint8_t address)
-{
-    p_twim->ADDRESS = address;
-}
-
-__STATIC_INLINE void nrf_twim_tx_buffer_set(NRF_TWIM_Type * p_twim,
-                                            uint8_t const * p_buffer,
-                                            uint8_t         length)
-{
-    p_twim->TXD.PTR    = (uint32_t)p_buffer;
-    p_twim->TXD.MAXCNT = length;
-}
-
-__STATIC_INLINE void nrf_twim_rx_buffer_set(NRF_TWIM_Type * p_twim,
-                                            uint8_t * p_buffer,
-                                            uint8_t   length)
-{
-    p_twim->RXD.PTR    = (uint32_t)p_buffer;
-    p_twim->RXD.MAXCNT = length;
-}
-
-__STATIC_INLINE void nrf_twim_shorts_set(NRF_TWIM_Type * p_twim,
-                                         uint32_t shorts_mask)
-{
-    p_twim->SHORTS = shorts_mask;
-}
-
-__STATIC_INLINE uint32_t nrf_twim_txd_amount_get(NRF_TWIM_Type * p_twim)
-{
-    return p_twim->TXD.AMOUNT;
-}
-
-__STATIC_INLINE uint32_t nrf_twim_rxd_amount_get(NRF_TWIM_Type * p_twim)
-{
-    return p_twim->RXD.AMOUNT;
-}
-
-__STATIC_INLINE void nrf_twim_tx_list_enable(NRF_TWIM_Type * p_twim)
-{
-    p_twim->TXD.LIST = 1;
-}
-
-__STATIC_INLINE void nrf_twim_tx_list_disable(NRF_TWIM_Type * p_twim)
-{
-    p_twim->TXD.LIST = 0;
-}
-
-__STATIC_INLINE void nrf_twim_rx_list_enable(NRF_TWIM_Type * p_twim)
-{
-    p_twim->RXD.LIST = 1;
-}
-
-__STATIC_INLINE void nrf_twim_rx_list_disable(NRF_TWIM_Type * p_twim)
-{
-    p_twim->RXD.LIST = 0;
-}
-#endif // SUPPRESS_INLINE_IMPLEMENTATION
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // NRF_TWIM_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/hal/nrf_twis.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twis.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twis.h
deleted file mode 100644
index a7b7a1d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_twis.h
+++ /dev/null
@@ -1,684 +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.
- *
- */
-
-/**
- * @ingroup nrf_twis
- * @defgroup nrf_twis_hal TWIS HAL
- * @{
- *
- * @brief @tagAPI52 Hardware access layer for Two Wire Interface Slave with EasyDMA
- * (TWIS) peripheral.
- */
-#ifndef NRF_TWIS_H__
-#define NRF_TWIS_H__
-
-#include "nrf.h"
-#include "nrf_drv_config.h"
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief TWIS tasks
- */
-typedef enum
-{
-    /*lint -save -e30*/
-#ifndef NRF52_PAN_30 /* STOP task is not functional in MPW3 (PAN-30) */
-    /* Stop task is not working properly for first release */
-    NRF_TWIS_TASK_STOP      = offsetof(NRF_TWIS_Type, TASKS_STOP),      /**< Stop TWIS transaction */
-#endif
-    NRF_TWIS_TASK_SUSPEND   = offsetof(NRF_TWIS_Type, TASKS_SUSPEND),   /**< Suspend TWIS transaction */
-    NRF_TWIS_TASK_RESUME    = offsetof(NRF_TWIS_Type, TASKS_RESUME),    /**< Resume TWIS transaction */
-    NRF_TWIS_TASK_PREPARERX = offsetof(NRF_TWIS_Type, TASKS_PREPARERX), /**< Prepare the TWIS slave to respond to a write command */
-    NRF_TWIS_TASK_PREPARETX = offsetof(NRF_TWIS_Type, TASKS_PREPARETX)  /**< Prepare the TWIS slave to respond to a read command */
-    /*lint -restore*/
-} nrf_twis_task_t;
-
-/**
- * @brief TWIS events
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_TWIS_EVENT_STOPPED   = offsetof(NRF_TWIS_Type, EVENTS_STOPPED),   /**< TWIS stopped */
-    NRF_TWIS_EVENT_ERROR     = offsetof(NRF_TWIS_Type, EVENTS_ERROR),     /**< TWIS error */
-    NRF_TWIS_EVENT_RXSTARTED = offsetof(NRF_TWIS_Type, EVENTS_RXSTARTED), /**< Receive sequence started */
-    NRF_TWIS_EVENT_TXSTARTED = offsetof(NRF_TWIS_Type, EVENTS_TXSTARTED), /**< Transmit sequence started */
-    NRF_TWIS_EVENT_WRITE     = offsetof(NRF_TWIS_Type, EVENTS_WRITE),     /**< Write command received */
-    NRF_TWIS_EVENT_READ      = offsetof(NRF_TWIS_Type, EVENTS_READ)       /**< Read command received */
-    /*lint -restore*/
-} nrf_twis_event_t;
-
-/**
- * @brief TWIS shortcuts
- */
-typedef enum
-{
-    NRF_TWIS_SHORT_WRITE_SUSPEND_MASK   = TWIS_SHORTS_WRITE_SUSPEND_Msk,   /**< Shortcut between WRITE event and SUSPEND task */
-    NRF_TWIS_SHORT_READ_SUSPEND_MASK    = TWIS_SHORTS_READ_SUSPEND_Msk,    /**< Shortcut between READ event and SUSPEND task */
-} nrf_twis_short_mask_t;
-
-/**
- * @brief TWIS interrupts
- */
-typedef enum
-{
-    NRF_TWIS_INT_STOPPED_MASK   = TWIS_INTEN_STOPPED_Msk,   /**< Interrupt on STOPPED event */
-    NRF_TWIS_INT_ERROR_MASK     = TWIS_INTEN_ERROR_Msk,     /**< Interrupt on ERROR event */
-    NRF_TWIS_INT_RXSTARTED_MASK = TWIS_INTEN_RXSTARTED_Msk, /**< Interrupt on RXSTARTED event */
-    NRF_TWIS_INT_TXSTARTED_MASK = TWIS_INTEN_TXSTARTED_Msk, /**< Interrupt on TXSTARTED event */
-    NRF_TWIS_INT_WRITE_MASK     = TWIS_INTEN_WRITE_Msk,     /**< Interrupt on WRITE event */
-    NRF_TWIS_INT_READ_MASK      = TWIS_INTEN_READ_Msk,      /**< Interrupt on READ event */
-} nrf_twis_int_mask_t;
-
-/**
- * @brief TWIS error source
- */
-typedef enum
-{
-    NRF_TWIS_ERROR_OVERFLOW  = TWIS_ERRORSRC_OVERFLOW_Msk, /**< RX buffer overflow detected, and prevented */
-#ifdef NRF52_PAN_29
-    /* Patched version of bit positions in ERRORSRC register (PAN-29) */
-    NRF_TWIS_ERROR_DATA_NACK = 1U << 1,                    /**< NACK sent after receiving a data byte */
-    NRF_TWIS_ERROR_OVERREAD  = 1U << 2                     /**< TX buffer over-read detected, and prevented */
-#else
-    /* Code that meets current documentation */
-    NRF_TWIS_ERROR_DATA_NACK = TWIS_ERRORSRC_DNACK_Msk,    /**< NACK sent after receiving a data byte */
-    NRF_TWIS_ERROR_OVERREAD  = TWIS_ERRORSRC_OVERREAD_Msk  /**< TX buffer over-read detected, and prevented */
-#endif
-} nrf_twis_error_t;
-
-/**
- * @brief TWIS address matching configuration
- */
-typedef enum
-{
-    NRF_TWIS_CONFIG_ADDRESS0_MASK  = TWIS_CONFIG_ADDRESS0_Msk, /**< Enable or disable address matching on ADDRESS[0] */
-    NRF_TWIS_CONFIG_ADDRESS1_MASK  = TWIS_CONFIG_ADDRESS1_Msk, /**< Enable or disable address matching on ADDRESS[1] */
-    NRF_TWIS_CONFIG_ADDRESS01_MASK = TWIS_CONFIG_ADDRESS0_Msk | TWIS_CONFIG_ADDRESS1_Msk /**< Enable both address matching */
-} nrf_twis_config_addr_mask_t;
-
-/**
- * @brief Variable type to hold amount of data for EasyDMA
- *
- * Variable of the minimum size that can hold the amount of data to transfer.
- *
- * @note
- * Defined to make it simple to change if EasyDMA would be updated to support more data in
- * the future devices to.
- */
-typedef uint8_t nrf_twis_amount_t;
-
-/**
- * @brief Smallest variable type to hold TWI address
- *
- * Variable of the minimum size that can hold single TWI address.
- *
- * @note
- * Defined to make it simple to change if new TWI would support for example
- * 10 bit addressing mode.
- */
-typedef uint8_t nrf_twis_address_t;
-
-
-/**
- * @brief Function for activating a specific TWIS task.
- *
- * @param[in] p_twis TWIS instance.
- * @param     task   Task.
- */
-__STATIC_INLINE void nrf_twis_task_trigger(NRF_TWIS_Type * const p_twis, nrf_twis_task_t task);
-
-/**
- * @brief Function for returning the address of a specific TWIS task register.
- *
- * @param[in]  p_twis TWIS instance.
- * @param      task   Task.
- *
- * @return Task address.
- */
-__STATIC_INLINE uint32_t nrf_twis_task_address_get(
-        NRF_TWIS_Type const * const p_twis,
-        nrf_twis_task_t      task);
-
-/**
- * @brief Function for clearing a specific event.
- *
- * @param[in] p_twis TWIS instance.
- * @param     event  Event.
- */
-__STATIC_INLINE void nrf_twis_event_clear(
-        NRF_TWIS_Type     * const p_twis,
-        nrf_twis_event_t   event);
-/**
- * @brief Function for returning the state of a specific event.
- *
- * @param[in] p_twis TWIS instance.
- * @param     event  Event.
- *
- * @retval true If the event is set.
- * @retval false If the event is not set.
- */
-__STATIC_INLINE bool nrf_twis_event_check(
-        NRF_TWIS_Type const * const p_twis,
-        nrf_twis_event_t     event);
-
-
-/**
- * @brief Function for getting and clearing the state of specific event
- *
- * This function checks the state of the event and clears it.
- * @param[in,out] p_twis TWIS instance
- * @param         event Event.
- *
- * @retval true If the event was set.
- * @retval false If the event was not set.
- */
-__STATIC_INLINE bool nrf_twis_event_get_and_clear(
-        NRF_TWIS_Type    * const p_twis,
-        nrf_twis_event_t   event);
-
-
-/**
- * @brief Function for returning the address of a specific TWIS event register.
- *
- * @param[in] p_twis TWIS instance.
- * @param     event  Event.
- *
- * @return Address.
- */
-__STATIC_INLINE uint32_t nrf_twis_event_address_get(
-        NRF_TWIS_Type const * const p_twis,
-        nrf_twis_event_t     event);
-
-/**
- * @brief Function for setting a shortcut.
- *
- * @param[in] p_twis     TWIS instance.
- * @param     short_mask Shortcuts mask.
- */
-__STATIC_INLINE void nrf_twis_shorts_enable(NRF_TWIS_Type * const p_twis, uint32_t short_mask);
-
-/**
- * @brief Function for clearing shortcuts.
- *
- * @param[in] p_twis     TWIS instance.
- * @param     short_mask Shortcuts mask.
- */
-__STATIC_INLINE void nrf_twis_shorts_disable(NRF_TWIS_Type * const p_twis, uint32_t short_mask);
-
-/**
- * @brief Get the shorts mask
- *
- * Function returns shorts register.
- * @param[in] p_twis     TWIS instance.
- * @return Flags of currently enabled shortcuts
- */
-__STATIC_INLINE uint32_t nrf_twis_shorts_get(NRF_TWIS_Type * const p_twis);
-
-/**
- * @brief Function for enabling selected interrupts.
- *
- * @param[in] p_twis   TWIS instance.
- * @param     int_mask Interrupts mask.
- */
-__STATIC_INLINE void nrf_twis_int_enable(NRF_TWIS_Type * const p_twis, uint32_t int_mask);
-
-/**
- * @brief Function for retrieving the state of selected interrupts.
- *
- * @param[in] p_twis   TWIS instance.
- * @param     int_mask Interrupts mask.
- *
- * @retval true If any of selected interrupts is enabled.
- * @retval false If none of selected interrupts is enabled.
- */
-__STATIC_INLINE bool nrf_twis_int_enable_check(NRF_TWIS_Type const * const p_twis, uint32_t int_mask);
-
-/**
- * @brief Function for disabling selected interrupts.
- *
- * @param[in] p_twis   TWIS instance.
- * @param     int_mask Interrupts mask.
- */
-__STATIC_INLINE void nrf_twis_int_disable(NRF_TWIS_Type * const p_twis, uint32_t int_mask);
-
-/**
- * @brief Function for retrieving and clearing the TWIS error source.
- *
- * @attention Error sources are cleared after read.
- * @param[in] p_twis TWIS instance
- * @return Error source mask with values from @ref nrf_twis_error_t.
- */
-__STATIC_INLINE uint32_t nrf_twis_error_source_get_and_clear(NRF_TWIS_Type * const p_twis);
-
-/**
- * @brief Get information which of addresses matched
- *
- * Function returns index in the address table
- * that points to the address that already matched.
- * @param[in] p_twis TWIS instance
- * @return Index of matched address
- */
-__STATIC_INLINE uint_fast8_t nrf_twis_match_get(NRF_TWIS_Type const * p_twis);
-
-/**
- * @brief Function for enabling TWIS.
- *
- * @param[in] p_twis TWIS instance.
- */
-__STATIC_INLINE void nrf_twis_enable(NRF_TWIS_Type * const p_twis);
-
-/**
- * @brief Function for disabling TWIS.
- *
- * @param[in] p_twis TWIS instance.
- */
-__STATIC_INLINE void nrf_twis_disable(NRF_TWIS_Type * const p_twis);
-
-/**
- * @brief Function for configuring TWIS pins.
- *
- * @param[in] p_twis TWIS instance.
- * @param scl SCL pin number.
- * @param sda SDA pin number.
- */
-__STATIC_INLINE void nrf_twis_pins_set(NRF_TWIS_Type * const p_twis, uint32_t scl, uint32_t sda);
-
-/**
- * @brief Function for setting the receive buffer.
- *
- * @param[in] p_twis TWIS instance.
- * @param     p_buf  Pointer to the buffer for received data.
- * @param     length Maximum number of data bytes to receive.
- */
-__STATIC_INLINE void nrf_twis_rx_buffer_set(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t           * p_buf,
-        nrf_twis_amount_t   length);
-
-/**
- * @brief Function that prepares TWIS for receiving
- *
- * This function sets receive buffer and then sets NRF_TWIS_TASK_PREPARERX task.
- * @param[in] p_twis TWIS instance.
- * @param     p_buf  Pointer to the buffer for received data.
- * @param     length Maximum number of data bytes to receive.
- */
-__STATIC_INLINE void nrf_twis_rx_prepare(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t           * p_buf,
-        nrf_twis_amount_t   length);
-
-/**
- * @brief Function for getting number of bytes received in the last transaction.
- *
- * @param[in] p_twis TWIS instance.
- * @return Amount of bytes received.
- * */
-__STATIC_INLINE nrf_twis_amount_t nrf_twis_rx_amount_get(NRF_TWIS_Type const * const p_twis);
-
-/**
- * @brief Function for setting the transmit buffer.
- *
- * @param[in] p_twis TWIS instance.
- * @param     p_buf  Pointer to the buffer with data to send.
- * @param     length Maximum number of data bytes to transmit.
- */
-__STATIC_INLINE void nrf_twis_tx_buffer_set(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t const     * p_buf,
-        nrf_twis_amount_t   length);
-
-/**
- * @brief Function that prepares TWIS for transmitting
- *
- * This function sets transmit buffer and then sets NRF_TWIS_TASK_PREPARETX task.
- * @param[in] p_twis TWIS instance.
- * @param     p_buf  Pointer to the buffer with data to send.
- * @param     length Maximum number of data bytes to transmit.
- */
-__STATIC_INLINE void nrf_twis_tx_prepare(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t const     * p_buf,
-        nrf_twis_amount_t   length);
-
-/**
- * @brief Function for getting number of bytes transmitted in the last transaction.
- *
- * @param[in] p_twis TWIS instance.
- * @return Amount of bytes transmitted.
- */
-__STATIC_INLINE nrf_twis_amount_t nrf_twis_tx_amount_get(NRF_TWIS_Type const * const p_twis);
-
-/**
- * @brief Function for setting slave address
- *
- * Function sets the selected address for this TWI interface.
- * @param[in] p_twis TWIS instance.
- * @param     n Index of address to set
- * @param     addr Addres to set
- * @sa nrf_twis_config_address_set
- * @sa nrf_twis_config_address_get
- */
-__STATIC_INLINE void nrf_twis_address_set(
-        NRF_TWIS_Type      * const p_twis,
-        uint_fast8_t         n,
-        nrf_twis_address_t   addr);
-
-/**
- * @brief Function for retrieving configured slave address
- *
- * Function gets the selected address for this TWI interface.
- * @param[in] p_twis TWIS instance.
- * @param n   Index of address to get
- */
-__STATIC_INLINE nrf_twis_address_t nrf_twis_address_get(
-        NRF_TWIS_Type const * const p_twis,
-        uint_fast8_t          n);
-
-/**
- * @brief Function for setting the device address configuration.
- *
- * @param[in] p_twis    TWIS instance.
- * @param     addr_mask Mask of address indexes of what device should answer to.
- *
- * @sa nrf_twis_address_set
- */
-__STATIC_INLINE void nrf_twis_config_address_set(
-        NRF_TWIS_Type              * const p_twis,
-        nrf_twis_config_addr_mask_t        addr_mask);
-
-/**
- * @brief Function for retrieving the device address configuration.
- *
- * @param[in] p_twis TWIS instance.
- *
- * @return Mask of address indexes of what device should answer to.
- */
-__STATIC_INLINE nrf_twis_config_addr_mask_t nrf_twis_config_address_get(
-        NRF_TWIS_Type const * const p_twis);
-
-/**
- * @brief Function for setting the over-read character.
- *
- * @param[in] p_twis TWIS instance.
- * @param[in] orc       Over-read character. Character clocked out in case of
- *                      over-read of the TXD buffer.
- */
-__STATIC_INLINE void nrf_twis_orc_set(
-        NRF_TWIS_Type * const p_twis,
-        uint8_t         orc);
-
-/**
- * @brief Function for setting the over-read character.
- *
- * @param[in] p_twis TWIS instance.
- *
- * @return Over-read character configured for selected instance.
- */
-__STATIC_INLINE uint8_t nrf_twis_orc_get(NRF_TWIS_Type const * const p_twis);
-
-
-/** @} */ /*  End of nrf_twis_hal */
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-
-/* ------------------------------------------------------------------------------------------------
- *  Internal functions
- */
-
-/**
- * @internal
- * @brief Internal function for getting task/event register address
- *
- * @param[in] p_twis TWIS instance.
- * @oaram     offset Offset of the register from the instance beginning
- *
- * @attention offset has to be modulo 4 value. In other case we can get hardware fault.
- * @return Pointer to the register
- */
-__STATIC_INLINE volatile uint32_t* nrf_twis_getRegPtr(NRF_TWIS_Type * const p_twis, uint32_t offset)
-{
-    return (volatile uint32_t*)((uint8_t *)p_twis + (uint32_t)offset);
-}
-
-/**
- * @internal
- * @brief Internal function for getting task/event register address - constant version
- *
- * @param[in] p_twis TWIS instance.
- * @oaram     offset Offset of the register from the instance beginning
- *
- * @attention offset has to be modulo 4 value. In other case we can get hardware fault.
- * @return Pointer to the register
- */
-__STATIC_INLINE volatile const uint32_t* nrf_twis_getRegPtr_c(NRF_TWIS_Type const * const p_twis, uint32_t offset)
-{
-    return (volatile const uint32_t*)((uint8_t *)p_twis + (uint32_t)offset);
-}
-
-
-/* ------------------------------------------------------------------------------------------------
- *  Interface functions definitions
- */
-
-
-void nrf_twis_task_trigger(NRF_TWIS_Type * const p_twis, nrf_twis_task_t task)
-{
-    *(nrf_twis_getRegPtr(p_twis, (uint32_t)task)) = 1UL;
-}
-
-uint32_t nrf_twis_task_address_get(
-        NRF_TWIS_Type const * const p_twis,
-        nrf_twis_task_t       task)
-{
-    return (uint32_t)nrf_twis_getRegPtr_c(p_twis, (uint32_t)task);
-}
-
-void nrf_twis_event_clear(
-        NRF_TWIS_Type     * const p_twis,
-        nrf_twis_event_t    event)
-{
-    *(nrf_twis_getRegPtr(p_twis, (uint32_t)event)) = 0UL;
-}
-
-bool nrf_twis_event_check(
-        NRF_TWIS_Type const * const p_twis,
-        nrf_twis_event_t      event)
-{
-    return (bool)*nrf_twis_getRegPtr_c(p_twis, (uint32_t)event);
-}
-
-bool nrf_twis_event_get_and_clear(
-        NRF_TWIS_Type    * const p_twis,
-        nrf_twis_event_t   event)
-{
-    bool ret = nrf_twis_event_check(p_twis, event);
-    if(ret)
-    {
-        nrf_twis_event_clear(p_twis, event);
-    }
-    return ret;
-}
-
-uint32_t nrf_twis_event_address_get(
-        NRF_TWIS_Type const * const p_twis,
-        nrf_twis_event_t      event)
-{
-    return (uint32_t)nrf_twis_getRegPtr_c(p_twis, (uint32_t)event);
-}
-
-void nrf_twis_shorts_enable(NRF_TWIS_Type * const p_twis, uint32_t short_mask)
-{
-    p_twis->SHORTS |= short_mask;
-}
-
-void nrf_twis_shorts_disable(NRF_TWIS_Type * const p_twis, uint32_t short_mask)
-{
-    if(~0U == short_mask)
-    {
-        /* Optimized version for "disable all" */
-        p_twis->SHORTS = 0;
-    }
-    else
-    {
-        p_twis->SHORTS &= ~short_mask;
-    }
-}
-
-uint32_t nrf_twis_shorts_get(NRF_TWIS_Type * const p_twis)
-{
-    return p_twis->SHORTS;
-}
-
-void nrf_twis_int_enable(NRF_TWIS_Type * const p_twis, uint32_t int_mask)
-{
-    p_twis->INTENSET = int_mask;
-}
-
-bool nrf_twis_int_enable_check(NRF_TWIS_Type const * const p_twis, uint32_t int_mask)
-{
-    return (bool)(p_twis->INTENSET & int_mask);
-}
-
-void nrf_twis_int_disable(NRF_TWIS_Type * const p_twis, uint32_t int_mask)
-{
-    p_twis->INTENCLR = int_mask;
-}
-
-uint32_t nrf_twis_error_source_get_and_clear(NRF_TWIS_Type * const p_twis)
-{
-    uint32_t ret = p_twis->ERRORSRC;
-    p_twis->ERRORSRC = ret;
-    return ret;
-}
-
-uint_fast8_t nrf_twis_match_get(NRF_TWIS_Type const * p_twis)
-{
-    return (uint_fast8_t)p_twis->MATCH;
-}
-
-void nrf_twis_enable(NRF_TWIS_Type * const p_twis)
-{
-    p_twis->ENABLE = (TWIS_ENABLE_ENABLE_Enabled << TWIS_ENABLE_ENABLE_Pos);
-}
-
-void nrf_twis_disable(NRF_TWIS_Type * const p_twis)
-{
-    p_twis->ENABLE = (TWIS_ENABLE_ENABLE_Disabled << TWIS_ENABLE_ENABLE_Pos);
-}
-
-void nrf_twis_pins_set(NRF_TWIS_Type * const p_twis, uint32_t scl, uint32_t sda)
-{
-    p_twis->PSEL.SCL = scl;
-    p_twis->PSEL.SDA = sda;
-}
-
-void nrf_twis_rx_buffer_set(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t           * p_buf,
-        nrf_twis_amount_t   length)
-{
-    p_twis->RXD.PTR    = (uint32_t)p_buf;
-    p_twis->RXD.MAXCNT = length;
-}
-
-__STATIC_INLINE void nrf_twis_rx_prepare(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t           * p_buf,
-        nrf_twis_amount_t   length)
-{
-    nrf_twis_rx_buffer_set(p_twis, p_buf, length);
-    nrf_twis_task_trigger(p_twis, NRF_TWIS_TASK_PREPARERX);
-}
-
-nrf_twis_amount_t nrf_twis_rx_amount_get(NRF_TWIS_Type const * const p_twis)
-{
-    return (nrf_twis_amount_t)p_twis->RXD.AMOUNT;
-}
-
-void nrf_twis_tx_buffer_set(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t const     * p_buf,
-        nrf_twis_amount_t   length)
-{
-    p_twis->TXD.PTR    = (uint32_t)p_buf;
-    p_twis->TXD.MAXCNT = length;
-}
-
-__STATIC_INLINE void nrf_twis_tx_prepare(
-        NRF_TWIS_Type     * const p_twis,
-        uint8_t const     * p_buf,
-        nrf_twis_amount_t   length)
-{
-    nrf_twis_tx_buffer_set(p_twis, p_buf, length);
-    nrf_twis_task_trigger(p_twis, NRF_TWIS_TASK_PREPARETX);
-}
-
-nrf_twis_amount_t nrf_twis_tx_amount_get(NRF_TWIS_Type const * const p_twis)
-{
-    return (nrf_twis_amount_t)p_twis->TXD.AMOUNT;
-}
-
-void nrf_twis_address_set(
-        NRF_TWIS_Type      * const p_twis,
-        uint_fast8_t         n,
-        nrf_twis_address_t   addr)
-{
-    p_twis->ADDRESS[n] = addr;
-}
-
-nrf_twis_address_t nrf_twis_address_get(
-        NRF_TWIS_Type const * const p_twis,
-        uint_fast8_t          n)
-{
-    return (nrf_twis_address_t)p_twis->ADDRESS[n];
-}
-void nrf_twis_config_address_set(
-        NRF_TWIS_Type              * const p_twis,
-        nrf_twis_config_addr_mask_t        addr_mask)
-{
-    /* This is the only configuration in TWIS - just write it without masking */
-    p_twis->CONFIG = addr_mask;
-}
-
-nrf_twis_config_addr_mask_t nrf_twis_config_address_get(NRF_TWIS_Type const * const p_twis)
-{
-    return (nrf_twis_config_addr_mask_t)(p_twis->CONFIG & TWIS_ADDRESS_ADDRESS_Msk);
-}
-
-void nrf_twis_orc_set(
-        NRF_TWIS_Type * const p_twis,
-        uint8_t         orc)
-{
-    p_twis->ORC = orc;
-}
-
-uint8_t nrf_twis_orc_get(NRF_TWIS_Type const * const p_twis)
-{
-    return (uint8_t)p_twis->ORC;
-}
-
-#endif /* SUPPRESS_INLINE_IMPLEMENTATION */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NRF_TWIS_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/hal/nrf_uart.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_uart.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_uart.h
deleted file mode 100644
index cc82f40..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_uart.h
+++ /dev/null
@@ -1,479 +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.
- *
- */
-#ifndef NRF_UART_H__
-#define NRF_UART_H__
-
-#include "nrf.h"
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @defgroup nrf_uart_hal UART HAL
- * @{
- * @ingroup nrf_uart
- *
- * @brief Hardware access layer for accessing the UART peripheral.
- */
-
-#define NRF_UART_PSEL_DISCONNECTED 0xFFFFFFFF
-
-/**
- * @enum nrf_uart_task_t
- * @brief UART tasks.
- */
-typedef enum
-{
-    /*lint -save -e30 -esym(628,__INTADDR__)*/
-    NRF_UART_TASK_STARTRX = offsetof(NRF_UART_Type, TASKS_STARTRX), /**< Task for starting reception. */
-    NRF_UART_TASK_STOPRX  = offsetof(NRF_UART_Type, TASKS_STOPRX),  /**< Task for stopping reception. */
-    NRF_UART_TASK_STARTTX = offsetof(NRF_UART_Type, TASKS_STARTTX), /**< Task for starting transmission. */
-    NRF_UART_TASK_STOPTX  = offsetof(NRF_UART_Type, TASKS_STOPTX),  /**< Task for stopping transmission. */
-    NRF_UART_TASK_SUSPEND = offsetof(NRF_UART_Type, TASKS_SUSPEND), /**< Task for suspending UART. */
-    /*lint -restore*/
-} nrf_uart_task_t;
-
-/**
- * @enum nrf_uart_event_t
- * @brief UART events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_UART_EVENT_CTS    = offsetof(NRF_UART_Type, EVENTS_CTS),   /**< Event from CTS line activation. */
-    NRF_UART_EVENT_NCTS   = offsetof(NRF_UART_Type, EVENTS_NCTS),  /**< Event from CTS line deactivation. */
-    NRF_UART_EVENT_RXDRDY = offsetof(NRF_UART_Type, EVENTS_RXDRDY),/**< Event from data ready in RXD. */
-    NRF_UART_EVENT_TXDRDY = offsetof(NRF_UART_Type, EVENTS_TXDRDY),/**< Event from data sent from TXD. */
-    NRF_UART_EVENT_ERROR  = offsetof(NRF_UART_Type, EVENTS_ERROR), /**< Event from error detection. */
-    NRF_UART_EVENT_RXTO   = offsetof(NRF_UART_Type, EVENTS_RXTO)   /**< Event from receiver timeout. */
-    /*lint -restore*/
-} nrf_uart_event_t;
-
-/**
- * @enum nrf_uart_int_mask_t
- * @brief UART interrupts.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_UART_INT_MASK_CTS    = UART_INTENCLR_CTS_Msk,    /**< CTS line activation interrupt. */
-    NRF_UART_INT_MASK_NCTS   = UART_INTENCLR_NCTS_Msk,   /**< CTS line deactivation interrupt. */
-    NRF_UART_INT_MASK_RXDRDY = UART_INTENCLR_RXDRDY_Msk, /**< Data ready in RXD interrupt. */
-    NRF_UART_INT_MASK_TXDRDY = UART_INTENCLR_TXDRDY_Msk,  /**< Data sent from TXD interrupt. */
-    NRF_UART_INT_MASK_ERROR  = UART_INTENCLR_ERROR_Msk,  /**< Error detection interrupt. */
-    NRF_UART_INT_MASK_RXTO   = UART_INTENCLR_RXTO_Msk    /**< Receiver timeout interrupt. */
-    /*lint -restore*/
-} nrf_uart_int_mask_t;
-
-/**
- * @enum nrf_uart_baudrate_t
- * @brief Baudrates supported by UART.
- */
-typedef enum
-{
-#ifdef NRF52
-    NRF_UART_BAUDRATE_1200   =  UARTE_BAUDRATE_BAUDRATE_Baud1200, /**< 1200 baud. */
-    NRF_UART_BAUDRATE_2400   =  UARTE_BAUDRATE_BAUDRATE_Baud2400, /**< 2400 baud. */
-    NRF_UART_BAUDRATE_4800   =  UARTE_BAUDRATE_BAUDRATE_Baud4800, /**< 4800 baud. */
-    NRF_UART_BAUDRATE_9600   =  UARTE_BAUDRATE_BAUDRATE_Baud9600, /**< 9600 baud. */
-    NRF_UART_BAUDRATE_14400  =  UARTE_BAUDRATE_BAUDRATE_Baud14400, /**< 14400 baud. */
-    NRF_UART_BAUDRATE_19200  =  UARTE_BAUDRATE_BAUDRATE_Baud19200, /**< 19200 baud. */
-    NRF_UART_BAUDRATE_28800  =  UARTE_BAUDRATE_BAUDRATE_Baud28800, /**< 28800 baud. */
-    NRF_UART_BAUDRATE_38400  =  UARTE_BAUDRATE_BAUDRATE_Baud38400, /**< 38400 baud. */
-    NRF_UART_BAUDRATE_57600  =  UARTE_BAUDRATE_BAUDRATE_Baud57600, /**< 57600 baud. */
-    NRF_UART_BAUDRATE_76800  =  UARTE_BAUDRATE_BAUDRATE_Baud76800, /**< 76800 baud. */
-    NRF_UART_BAUDRATE_115200 =  UARTE_BAUDRATE_BAUDRATE_Baud115200, /**< 115200 baud. */
-    NRF_UART_BAUDRATE_230400 =  UARTE_BAUDRATE_BAUDRATE_Baud230400, /**< 230400 baud. */
-    NRF_UART_BAUDRATE_250000 =  UARTE_BAUDRATE_BAUDRATE_Baud250000, /**< 250000 baud. */
-    NRF_UART_BAUDRATE_460800 =  UARTE_BAUDRATE_BAUDRATE_Baud460800, /**< 460800 baud. */
-    NRF_UART_BAUDRATE_921600 =  UARTE_BAUDRATE_BAUDRATE_Baud921600, /**< 921600 baud. */
-    NRF_UART_BAUDRATE_1000000 =  UARTE_BAUDRATE_BAUDRATE_Baud1M, /**< 1000000 baud. */
-#else
-    NRF_UART_BAUDRATE_1200   =  UART_BAUDRATE_BAUDRATE_Baud1200, /**< 1200 baud. */
-    NRF_UART_BAUDRATE_2400   =  UART_BAUDRATE_BAUDRATE_Baud2400, /**< 2400 baud. */
-    NRF_UART_BAUDRATE_4800   =  UART_BAUDRATE_BAUDRATE_Baud4800, /**< 4800 baud. */
-    NRF_UART_BAUDRATE_9600   =  UART_BAUDRATE_BAUDRATE_Baud9600, /**< 9600 baud. */
-    NRF_UART_BAUDRATE_14400  =  UART_BAUDRATE_BAUDRATE_Baud14400, /**< 14400 baud. */
-    NRF_UART_BAUDRATE_19200  =  UART_BAUDRATE_BAUDRATE_Baud19200, /**< 19200 baud. */
-    NRF_UART_BAUDRATE_28800  =  UART_BAUDRATE_BAUDRATE_Baud28800, /**< 28800 baud. */
-    NRF_UART_BAUDRATE_38400  =  UART_BAUDRATE_BAUDRATE_Baud38400, /**< 38400 baud. */
-    NRF_UART_BAUDRATE_57600  =  UART_BAUDRATE_BAUDRATE_Baud57600, /**< 57600 baud. */
-    NRF_UART_BAUDRATE_76800  =  UART_BAUDRATE_BAUDRATE_Baud76800, /**< 76800 baud. */
-    NRF_UART_BAUDRATE_115200 =  UART_BAUDRATE_BAUDRATE_Baud115200, /**< 115200 baud. */
-    NRF_UART_BAUDRATE_230400 =  UART_BAUDRATE_BAUDRATE_Baud230400, /**< 230400 baud. */
-    NRF_UART_BAUDRATE_250000 =  UART_BAUDRATE_BAUDRATE_Baud250000, /**< 250000 baud. */
-    NRF_UART_BAUDRATE_460800 =  UART_BAUDRATE_BAUDRATE_Baud460800, /**< 460800 baud. */
-    NRF_UART_BAUDRATE_921600 =  UART_BAUDRATE_BAUDRATE_Baud921600, /**< 921600 baud. */
-    NRF_UART_BAUDRATE_1000000 =  UART_BAUDRATE_BAUDRATE_Baud1M, /**< 1000000 baud. */
-#endif
-} nrf_uart_baudrate_t;
-
-/**
- * @enum nrf_uart_error_mask_t
- * @brief Types of UART error masks.
- */
-typedef enum
-{
-    NRF_UART_ERROR_OVERRUN_MASK = UART_ERRORSRC_OVERRUN_Msk,   /**< Overrun error. */
-    NRF_UART_ERROR_PARITY_MASK  = UART_ERRORSRC_PARITY_Msk,    /**< Parity error. */
-    NRF_UART_ERROR_FRAMING_MASK = UART_ERRORSRC_FRAMING_Msk,   /**< Framing error. */
-    NRF_UART_ERROR_BREAK_MASK   = UART_ERRORSRC_BREAK_Msk,     /**< Break error. */
-} nrf_uart_error_mask_t;
-
-/**
- * @enum nrf_uart_parity_t
- * @brief Types of UART parity modes.
- */
-typedef enum
-{
-    NRF_UART_PARITY_EXCLUDED = UART_CONFIG_PARITY_Excluded << UART_CONFIG_PARITY_Pos, /**< Parity excluded. */
-    NRF_UART_PARITY_INCLUDED = UART_CONFIG_PARITY_Included << UART_CONFIG_PARITY_Pos, /**< Parity included. */
-} nrf_uart_parity_t;
-
-/**
- * @enum nrf_uart_hwfc_t
- * @brief Types of UART flow control modes.
- */
-typedef enum
-{
-    NRF_UART_HWFC_DISABLED = UART_CONFIG_HWFC_Disabled, /**< HW flow control disabled. */
-    NRF_UART_HWFC_ENABLED  = UART_CONFIG_HWFC_Enabled,  /**< HW flow control enabled. */
-} nrf_uart_hwfc_t;
-
-/**
- * @brief Function for clearing a specific UART event.
- *
- * @param[in] p_reg  UART instance.
- * @param[in] event  Event to clear.
- */
-__STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event);
-
-/**
- * @brief Function for checking the state of a specific UART event.
- *
- * @param[in] p_reg  UART instance.
- * @param[in] event  Event to check.
- *
- * @retval True if event is set, False otherwise.
- */
-__STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_t event);
-
-/**
- * @brief Function for returning the address of a specific UART event register.
- *
- * @param[in] p_reg  UART instance.
- * @param[in] event  Desired event.
- *
- * @retval Address of specified event register.
- */
-__STATIC_INLINE uint32_t nrf_uart_event_address_get(NRF_UART_Type  * p_reg,
-                                                    nrf_uart_event_t  event);
-
-/**
- * @brief Function for enabling a specific interrupt.
- *
- * @param p_reg     Instance.
- * @param int_mask Interrupts to enable.
- */
-__STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param p_reg     Instance.
- * @param int_mask  Mask of interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_uart_int_enable_check(NRF_UART_Type * p_reg, uint32_t int_mask);
-
-/**
- * @brief Function for disabling specific interrupts.
- *
- * @param p_reg    Instance.
- * @param int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_mask);
-
-/**
- * @brief Function for getting error source mask. Function is clearing error source flags after reading.
- *
- * @param p_reg    Instance.
- * @return         Mask with error source flags.
- */
-__STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for enabling UART.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uart_enable(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for disabling UART.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for configuring TX/RX pins.
- *
- * @param p_reg    Instance.
- * @param pseltxd  TXD pin number.
- * @param pselrxd  RXD pin number.
- */
-__STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd);
-
-/**
- * @brief Function for disconnecting TX/RX pins.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for getting TX pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for getting RX pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for getting RTS pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for getting CTS pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg);
-
-
-/**
- * @brief Function for configuring flow control pins.
- *
- * @param p_reg    Instance.
- * @param pselrts  RTS pin number.
- * @param pselcts  CTS pin number.
- */
-__STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg,
-                                            uint32_t        pselrts,
-                                            uint32_t        pselcts);
-
-/**
- * @brief Function for disconnecting flow control pins.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for reading RX data.
- *
- * @param p_reg    Instance.
- * @return         Received byte.
- */
-__STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg);
-
-/**
- * @brief Function for setting Tx data.
- *
- * @param p_reg    Instance.
- * @param txd      Byte.
- */
-__STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd);
-
-/**
- * @brief Function for starting an UART task.
- *
- * @param p_reg    Instance.
- * @param task     Task.
- */
-__STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_t task);
-
-/**
- * @brief Function for returning the address of a specific task register.
- *
- * @param p_reg Instance.
- * @param task  Task.
- *
- * @return      Task address.
- */
-__STATIC_INLINE uint32_t nrf_uart_task_address_get(NRF_UART_Type * p_reg, nrf_uart_task_t task);
-
-/**
- * @brief Function for configuring UART.
- *
- * @param p_reg  Instance.
- * @param hwfc   Hardware flow control. Enabled if true.
- * @param parity Parity. Included if true.
- */
-__STATIC_INLINE void nrf_uart_configure(NRF_UART_Type   * p_reg,
-                                            nrf_uart_parity_t parity,
-                                            nrf_uart_hwfc_t   hwfc);
-
-/**
- * @brief Function for setting UART baudrate.
- *
- * @param p_reg    Instance.
- * @param baudrate Baudrate.
- */
-__STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type   * p_reg, nrf_uart_baudrate_t baudrate);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-__STATIC_INLINE void nrf_uart_event_clear(NRF_UART_Type * p_reg, nrf_uart_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
-
-}
-
-__STATIC_INLINE bool nrf_uart_event_check(NRF_UART_Type * p_reg, nrf_uart_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t nrf_uart_event_address_get(NRF_UART_Type  * p_reg,
-                                                    nrf_uart_event_t  event)
-{
-    return (uint32_t)((uint8_t *)p_reg + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_uart_int_enable(NRF_UART_Type * p_reg, uint32_t int_mask)
-{
-    p_reg->INTENSET = int_mask;
-}
-
-__STATIC_INLINE bool nrf_uart_int_enable_check(NRF_UART_Type * p_reg, uint32_t int_mask)
-{
-    return (bool)(p_reg->INTENSET & int_mask);
-}
-
-__STATIC_INLINE void nrf_uart_int_disable(NRF_UART_Type * p_reg, uint32_t int_mask)
-{
-    p_reg->INTENCLR = int_mask;
-}
-
-__STATIC_INLINE uint32_t nrf_uart_errorsrc_get_and_clear(NRF_UART_Type * p_reg)
-{
-    uint32_t errsrc_mask = p_reg->ERRORSRC;
-    p_reg->ERRORSRC = errsrc_mask;
-    return errsrc_mask;
-}
-
-__STATIC_INLINE void nrf_uart_enable(NRF_UART_Type * p_reg)
-{
-    p_reg->ENABLE = UART_ENABLE_ENABLE_Enabled;
-}
-
-__STATIC_INLINE void nrf_uart_disable(NRF_UART_Type * p_reg)
-{
-    p_reg->ENABLE = UART_ENABLE_ENABLE_Disabled;
-}
-
-__STATIC_INLINE void nrf_uart_txrx_pins_set(NRF_UART_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd)
-{
-    p_reg->PSELTXD = pseltxd;
-    p_reg->PSELRXD = pselrxd;
-}
-
-__STATIC_INLINE void nrf_uart_txrx_pins_disconnect(NRF_UART_Type * p_reg)
-{
-    nrf_uart_txrx_pins_set(p_reg, NRF_UART_PSEL_DISCONNECTED, NRF_UART_PSEL_DISCONNECTED);
-}
-
-__STATIC_INLINE uint32_t nrf_uart_tx_pin_get(NRF_UART_Type * p_reg)
-{
-    return p_reg->PSELTXD;
-}
-
-__STATIC_INLINE uint32_t nrf_uart_rx_pin_get(NRF_UART_Type * p_reg)
-{
-    return p_reg->PSELRXD;
-}
-
-__STATIC_INLINE uint32_t nrf_uart_rts_pin_get(NRF_UART_Type * p_reg)
-{
-    return p_reg->PSELRTS;
-}
-
-__STATIC_INLINE uint32_t nrf_uart_cts_pin_get(NRF_UART_Type * p_reg)
-{
-    return p_reg->PSELCTS;
-}
-
-__STATIC_INLINE void nrf_uart_hwfc_pins_set(NRF_UART_Type * p_reg, uint32_t pselrts, uint32_t pselcts)
-{
-    p_reg->PSELRTS = pselrts;
-    p_reg->PSELCTS = pselcts;
-}
-
-__STATIC_INLINE void nrf_uart_hwfc_pins_disconnect(NRF_UART_Type * p_reg)
-{
-    nrf_uart_hwfc_pins_set(p_reg, NRF_UART_PSEL_DISCONNECTED, NRF_UART_PSEL_DISCONNECTED);
-}
-
-__STATIC_INLINE uint8_t nrf_uart_rxd_get(NRF_UART_Type * p_reg)
-{
-    return p_reg->RXD;
-}
-
-__STATIC_INLINE void nrf_uart_txd_set(NRF_UART_Type * p_reg, uint8_t txd)
-{
-    p_reg->TXD = txd;
-}
-
-__STATIC_INLINE void nrf_uart_task_trigger(NRF_UART_Type * p_reg, nrf_uart_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_uart_task_address_get(NRF_UART_Type * p_reg, nrf_uart_task_t task)
-{
-    return (uint32_t)p_reg + (uint32_t)task;
-}
-
-__STATIC_INLINE void nrf_uart_configure(NRF_UART_Type   * p_reg,
-                                            nrf_uart_parity_t parity,
-                                            nrf_uart_hwfc_t   hwfc)
-{
-    p_reg->CONFIG = (uint32_t)parity | (uint32_t)hwfc;
-}
-
-__STATIC_INLINE void nrf_uart_baudrate_set(NRF_UART_Type   * p_reg, nrf_uart_baudrate_t baudrate)
-{
-    p_reg->BAUDRATE = baudrate;
-}
-#endif //SUPPRESS_INLINE_IMPLEMENTATION
-/** @} */
-#ifdef __cplusplus
-}
-#endif
-
-#endif //NRF_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/hal/nrf_uarte.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_uarte.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_uarte.h
deleted file mode 100644
index b1c560d..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_uarte.h
+++ /dev/null
@@ -1,542 +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.
- *
- */
-#ifndef NRF_UARTE_H__
-#define NRF_UARTE_H__
-
-#include "nrf.h"
-#include <stdint.h>
-#include <stddef.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define NRF_UARTE_PSEL_DISCONNECTED 0xFFFFFFFF
-
-/**
- * @defgroup nrf_uarte_hal UARTE HAL
- * @{
- * @ingroup nrf_uart
- *
- * @brief Hardware access layer for accessing the UARTE peripheral.
- */
-
-/**
- * @enum  nrf_uarte_task_t
- * @brief UARTE tasks.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_UARTE_TASK_STARTRX   = offsetof(NRF_UARTE_Type, TASKS_STARTRX),///< Start UART receiver.
-    NRF_UARTE_TASK_STOPRX    = offsetof(NRF_UARTE_Type, TASKS_STOPRX), ///< Stop UART receiver.
-    NRF_UARTE_TASK_STARTTX   = offsetof(NRF_UARTE_Type, TASKS_STARTTX),///< Start UART transmitter.
-    NRF_UARTE_TASK_STOPTX    = offsetof(NRF_UARTE_Type, TASKS_STOPTX), ///< Stop UART transmitter.
-    NRF_UARTE_TASK_FLUSHRX   = offsetof(NRF_UARTE_Type, TASKS_FLUSHRX) ///< Flush RX FIFO in RX buffer.
-    /*lint -restore*/
-} nrf_uarte_task_t;
-
-/**
- * @enum  nrf_uarte_event_t
- * @brief UARTE events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_UARTE_EVENT_CTS       = offsetof(NRF_UARTE_Type, EVENTS_CTS),      ///< CTS is activated.
-    NRF_UARTE_EVENT_NCTS      = offsetof(NRF_UARTE_Type, EVENTS_NCTS),     ///< CTS is deactivated.
-    NRF_UARTE_EVENT_ENDRX     = offsetof(NRF_UARTE_Type, EVENTS_ENDRX),    ///< Receive buffer is filled up.
-    NRF_UARTE_EVENT_ENDTX     = offsetof(NRF_UARTE_Type, EVENTS_ENDTX),    ///< Last TX byte transmitted.
-    NRF_UARTE_EVENT_ERROR     = offsetof(NRF_UARTE_Type, EVENTS_ERROR),    ///< Error detected.
-    NRF_UARTE_EVENT_RXTO      = offsetof(NRF_UARTE_Type, EVENTS_RXTO),     ///< Receiver timeout.
-    NRF_UARTE_EVENT_RXSTARTED = offsetof(NRF_UARTE_Type, EVENTS_RXSTARTED),///< Receiver has started.
-    NRF_UARTE_EVENT_TXSTARTED = offsetof(NRF_UARTE_Type, EVENTS_TXSTARTED),///< Transmitter has started.
-    NRF_UARTE_EVENT_TXSTOPPED = offsetof(NRF_UARTE_Type, EVENTS_TXSTOPPED) ///< Transmitted stopped.
-    /*lint -restore*/
-} nrf_uarte_event_t;
-
-/**
- * @brief Types of UARTE shortcuts.
- */
-typedef enum
-{
-    NRF_UARTE_SHORT_ENDRX_STARTRX = UARTE_SHORTS_ENDRX_STARTRX_Msk,///< Shortcut between ENDRX event and STARTRX task.
-    NRF_UARTE_SHORT_ENDRX_STOPRX  = UARTE_SHORTS_ENDRX_STOPRX_Msk, ///< Shortcut between ENDRX event and STOPRX task.
-} nrf_uarte_short_t;
-
-
-/**
- * @enum  nrf_uarte_int_mask_t
- * @brief UARTE interrupts.
- */
-typedef enum
-{
-    NRF_UARTE_INT_CTS_MASK       = UARTE_INTENSET_CTS_Msk,      ///< Interrupt on CTS event.
-    NRF_UARTE_INT_NCTSRX_MASK    = UARTE_INTENSET_NCTS_Msk,     ///< Interrupt on NCTS event.
-    NRF_UARTE_INT_ENDRX_MASK     = UARTE_INTENSET_ENDRX_Msk,    ///< Interrupt on ENDRX event.
-    NRF_UARTE_INT_ENDTX_MASK     = UARTE_INTENSET_ENDTX_Msk,    ///< Interrupt on ENDTX event.
-    NRF_UARTE_INT_ERROR_MASK     = UARTE_INTENSET_ERROR_Msk,    ///< Interrupt on ERROR event.
-    NRF_UARTE_INT_RXTO_MASK      = UARTE_INTENSET_RXTO_Msk,     ///< Interrupt on RXTO event.
-    NRF_UARTE_INT_RXSTARTED_MASK = UARTE_INTENSET_RXSTARTED_Msk,///< Interrupt on RXSTARTED event.
-    NRF_UARTE_INT_TXSTARTED_MASK = UARTE_INTENSET_TXSTARTED_Msk,///< Interrupt on TXSTARTED event.
-    NRF_UARTE_INT_TXSTOPPED_MASK = UARTE_INTENSET_TXSTOPPED_Msk ///< Interrupt on TXSTOPPED event.
-} nrf_uarte_int_mask_t;
-
-/**
- * @enum nrf_uarte_baudrate_t
- * @brief Baudrates supported by UARTE.
- */
-typedef enum
-{
-    NRF_UARTE_BAUDRATE_1200   =  UARTE_BAUDRATE_BAUDRATE_Baud1200,   ///< 1200 baud.
-    NRF_UARTE_BAUDRATE_2400   =  UARTE_BAUDRATE_BAUDRATE_Baud2400,   ///< 2400 baud.
-    NRF_UARTE_BAUDRATE_4800   =  UARTE_BAUDRATE_BAUDRATE_Baud4800,   ///< 4800 baud.
-    NRF_UARTE_BAUDRATE_9600   =  UARTE_BAUDRATE_BAUDRATE_Baud9600,   ///< 9600 baud.
-    NRF_UARTE_BAUDRATE_14400  =  UARTE_BAUDRATE_BAUDRATE_Baud14400,  ///< 14400 baud.
-    NRF_UARTE_BAUDRATE_19200  =  UARTE_BAUDRATE_BAUDRATE_Baud19200,  ///< 19200 baud.
-    NRF_UARTE_BAUDRATE_28800  =  UARTE_BAUDRATE_BAUDRATE_Baud28800,  ///< 28800 baud.
-    NRF_UARTE_BAUDRATE_38400  =  UARTE_BAUDRATE_BAUDRATE_Baud38400,  ///< 38400 baud.
-    NRF_UARTE_BAUDRATE_57600  =  UARTE_BAUDRATE_BAUDRATE_Baud57600,  ///< 57600 baud.
-    NRF_UARTE_BAUDRATE_76800  =  UARTE_BAUDRATE_BAUDRATE_Baud76800,  ///< 76800 baud.
-    NRF_UARTE_BAUDRATE_115200 =  UARTE_BAUDRATE_BAUDRATE_Baud115200, ///< 115200 baud.
-    NRF_UARTE_BAUDRATE_230400 =  UARTE_BAUDRATE_BAUDRATE_Baud230400, ///< 230400 baud.
-    NRF_UARTE_BAUDRATE_250000 =  UARTE_BAUDRATE_BAUDRATE_Baud250000, ///< 250000 baud.
-    NRF_UARTE_BAUDRATE_460800 =  UARTE_BAUDRATE_BAUDRATE_Baud460800, ///< 460800 baud.
-    NRF_UARTE_BAUDRATE_921600 =  UARTE_BAUDRATE_BAUDRATE_Baud921600, ///< 921600 baud.
-    NRF_UARTE_BAUDRATE_1000000 =  UARTE_BAUDRATE_BAUDRATE_Baud1M,    ///< 1000000 baud.
-} nrf_uarte_baudrate_t;
-
-/**
- * @enum nrf_uarte_error_mask_t
- * @brief Types of UARTE error masks.
- */
-typedef enum
-{
-    NRF_UARTE_ERROR_OVERRUN_MASK = UARTE_ERRORSRC_OVERRUN_Msk,   ///< Overrun error.
-    NRF_UARTE_ERROR_PARITY_MASK  = UARTE_ERRORSRC_PARITY_Msk,    ///< Parity error.
-    NRF_UARTE_ERROR_FRAMING_MASK = UARTE_ERRORSRC_FRAMING_Msk,   ///< Framing error.
-    NRF_UARTE_ERROR_BREAK_MASK   = UARTE_ERRORSRC_BREAK_Msk,     ///< Break error.
-} nrf_uarte_error_mask_t;
-
-/**
- * @enum nrf_uarte_parity_t
- * @brief Types of UARTE parity modes.
- */
-typedef enum
-{
-    NRF_UARTE_PARITY_EXCLUDED = UARTE_CONFIG_PARITY_Excluded << UARTE_CONFIG_PARITY_Pos, ///< Parity excluded.
-    NRF_UARTE_PARITY_INCLUDED = UARTE_CONFIG_PARITY_Included << UARTE_CONFIG_PARITY_Pos, ///< Parity included.
-} nrf_uarte_parity_t;
-
-/**
- * @enum nrf_uarte_hwfc_t
- * @brief Types of UARTE flow control modes.
- */
-typedef enum
-{
-    NRF_UARTE_HWFC_DISABLED = UARTE_CONFIG_HWFC_Disabled << UARTE_CONFIG_HWFC_Pos, ///< HW flow control disabled.
-    NRF_UARTE_HWFC_ENABLED  = UARTE_CONFIG_HWFC_Enabled  << UARTE_CONFIG_HWFC_Pos, ///< HW flow control enabled.
-} nrf_uarte_hwfc_t;
-
-
-/**
- * @brief Function for clearing a specific UARTE event.
- *
- * @param[in] p_reg  UARTE instance.
- * @param[in] event  Event to clear.
- */
-__STATIC_INLINE void nrf_uarte_event_clear(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event);
-
-/**
- * @brief Function for checking the state of a specific UARTE event.
- *
- * @param[in] p_reg  UARTE instance.
- * @param[in] event  Event to check.
- *
- * @retval True if event is set, False otherwise.
- */
-__STATIC_INLINE bool nrf_uarte_event_check(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event);
-
-/**
- * @brief Function for returning the address of a specific UARTE event register.
- *
- * @param[in] p_reg  UARTE instance.
- * @param[in] event  Desired event.
- *
- * @retval Address of specified event register.
- */
-__STATIC_INLINE uint32_t nrf_uarte_event_address_get(NRF_UARTE_Type  * p_reg,
-                                                    nrf_uarte_event_t  event);
-
-/**
- * @brief Function for enabling UARTE shortcuts.
- *
- * @param p_reg       UARTE instance.
- * @param shorts_mask Shortcuts to enable.
- */
-__STATIC_INLINE void nrf_uarte_shorts_enable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask);
-
-/**
- * @brief Function for disabling UARTE shortcuts.
- *
- * @param p_reg       UARTE instance.
- * @param shorts_mask Shortcuts to disable.
- */
-__STATIC_INLINE void nrf_uarte_shorts_disable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask);
-
-/**
- * @brief Function for enabling UARTE interrupts.
- *
- * @param p_reg     Instance.
- * @param int_mask  Interrupts to enable.
- */
-__STATIC_INLINE void nrf_uarte_int_enable(NRF_UARTE_Type * p_reg, uint32_t int_mask);
-
-/**
- * @brief Function for retrieving the state of a given interrupt.
- *
- * @param p_reg     Instance.
- * @param int_mask  Mask of interrupt to check.
- *
- * @retval true  If the interrupt is enabled.
- * @retval false If the interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_uarte_int_enable_check(NRF_UARTE_Type * p_reg, nrf_uarte_int_mask_t int_mask);
-
-/**
- * @brief Function for disabling specific interrupts.
- *
- * @param p_reg    Instance.
- * @param int_mask Interrupts to disable.
- */
-__STATIC_INLINE void nrf_uarte_int_disable(NRF_UARTE_Type * p_reg, uint32_t int_mask);
-
-/**
- * @brief Function for getting error source mask. Function is clearing error source flags after reading.
- *
- * @param p_reg    Instance.
- * @return         Mask with error source flags.
- */
-__STATIC_INLINE uint32_t nrf_uarte_errorsrc_get_and_clear(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for enabling UARTE.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uarte_enable(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for disabling UARTE.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uarte_disable(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for configuring TX/RX pins.
- *
- * @param p_reg    Instance.
- * @param pseltxd  TXD pin number.
- * @param pselrxd  RXD pin number.
- */
-__STATIC_INLINE void nrf_uarte_txrx_pins_set(NRF_UARTE_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd);
-
-/**
- * @brief Function for disconnecting TX/RX pins.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uarte_txrx_pins_disconnect(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for getting TX pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uarte_tx_pin_get(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for getting RX pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uarte_rx_pin_get(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for getting RTS pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uarte_rts_pin_get(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for getting CTS pin.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE uint32_t nrf_uarte_cts_pin_get(NRF_UARTE_Type * p_reg);
-
-
-/**
- * @brief Function for configuring flow control pins.
- *
- * @param p_reg    Instance.
- * @param pselrts  RTS pin number.
- * @param pselcts  CTS pin number.
- */
-__STATIC_INLINE void nrf_uarte_hwfc_pins_set(NRF_UARTE_Type * p_reg,
-                                                uint32_t        pselrts,
-                                                uint32_t        pselcts);
-
-/**
- * @brief Function for disconnecting flow control pins.
- *
- * @param p_reg    Instance.
- */
-__STATIC_INLINE void nrf_uarte_hwfc_pins_disconnect(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for starting an UARTE task.
- *
- * @param p_reg    Instance.
- * @param task     Task.
- */
-__STATIC_INLINE void nrf_uarte_task_trigger(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task);
-
-/**
- * @brief Function for returning the address of a specific task register.
- *
- * @param p_reg Instance.
- * @param task  Task.
- *
- * @return      Task address.
- */
-__STATIC_INLINE uint32_t nrf_uarte_task_address_get(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task);
-
-/**
- * @brief Function for configuring UARTE.
- *
- * @param p_reg  Instance.
- * @param hwfc   Hardware flow control. Enabled if true.
- * @param parity Parity. Included if true.
- */
-__STATIC_INLINE void nrf_uarte_configure(NRF_UARTE_Type   * p_reg,
-                                            nrf_uarte_parity_t parity,
-                                            nrf_uarte_hwfc_t   hwfc);
-
-
-/**
- * @brief Function for setting UARTE baudrate.
- *
- * @param p_reg    Instance.
- * @param baudrate Baudrate.
- */
-__STATIC_INLINE void nrf_uarte_baudrate_set(NRF_UARTE_Type   * p_reg, nrf_uarte_baudrate_t baudrate);
-
-/**
- * @brief Function for setting the transmit buffer.
- *
- * @param[in] p_reg     Instance.
- * @param[in] p_buffer  Pointer to the buffer with data to send.
- * @param[in] length    Maximum number of data bytes to transmit.
- */
-__STATIC_INLINE void nrf_uarte_tx_buffer_set(NRF_UARTE_Type * p_reg,
-                                             uint8_t  const * p_buffer,
-                                             uint8_t          length);
-
-/**
- * @brief Function for getting number of bytes transmitted in the last transaction.
- *
- * @param[in] p_reg     Instance.
- *
- * @retval Amount of bytes transmitted.
- */
-__STATIC_INLINE uint32_t nrf_uarte_tx_amount_get(NRF_UARTE_Type * p_reg);
-
-/**
- * @brief Function for setting the receive buffer.
- *
- * @param[in] p_reg     Instance.
- * @param[in] p_buffer  Pointer to the buffer for received data.
- * @param[in] length    Maximum number of data bytes to receive.
- */
-__STATIC_INLINE void nrf_uarte_rx_buffer_set(NRF_UARTE_Type * p_reg,
-                                             uint8_t * p_buffer,
-                                             uint8_t   length);
-
-/**
- * @brief Function for getting number of bytes received in the last transaction.
- *
- * @param[in] p_reg     Instance.
- *
- * @retval Amount of bytes received.
- */
-__STATIC_INLINE uint32_t nrf_uarte_rx_amount_get(NRF_UARTE_Type * p_reg);
-
-#ifndef SUPPRESS_INLINE_IMPLEMENTATION
-__STATIC_INLINE void nrf_uarte_event_clear(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event)) = 0x0UL;
-
-}
-
-__STATIC_INLINE bool nrf_uarte_event_check(NRF_UARTE_Type * p_reg, nrf_uarte_event_t event)
-{
-    return (bool)*(volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)event);
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_event_address_get(NRF_UARTE_Type  * p_reg,
-                                                    nrf_uarte_event_t  event)
-{
-    return (uint32_t)((uint8_t *)p_reg + (uint32_t)event);
-}
-
-__STATIC_INLINE void nrf_uarte_shorts_enable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask)
-{
-    p_reg->SHORTS |= shorts_mask;
-}
-
-__STATIC_INLINE void nrf_uarte_shorts_disable(NRF_UARTE_Type * p_reg, uint32_t shorts_mask)
-{
-    p_reg->SHORTS &= ~(shorts_mask);
-}
-
-__STATIC_INLINE void nrf_uarte_int_enable(NRF_UARTE_Type * p_reg, uint32_t int_mask)
-{
-    p_reg->INTENSET = int_mask;
-}
-
-__STATIC_INLINE bool nrf_uarte_int_enable_check(NRF_UARTE_Type * p_reg, nrf_uarte_int_mask_t int_mask)
-{
-    return (bool)(p_reg->INTENSET & int_mask);
-}
-
-__STATIC_INLINE void nrf_uarte_int_disable(NRF_UARTE_Type * p_reg, uint32_t int_mask)
-{
-    p_reg->INTENCLR = int_mask;
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_errorsrc_get_and_clear(NRF_UARTE_Type * p_reg)
-{
-    uint32_t errsrc_mask = p_reg->ERRORSRC;
-    p_reg->ERRORSRC = errsrc_mask;
-    return errsrc_mask;
-}
-
-__STATIC_INLINE void nrf_uarte_enable(NRF_UARTE_Type * p_reg)
-{
-    p_reg->ENABLE = UARTE_ENABLE_ENABLE_Enabled;
-}
-
-__STATIC_INLINE void nrf_uarte_disable(NRF_UARTE_Type * p_reg)
-{
-    p_reg->ENABLE = UARTE_ENABLE_ENABLE_Disabled;
-}
-
-__STATIC_INLINE void nrf_uarte_txrx_pins_set(NRF_UARTE_Type * p_reg, uint32_t pseltxd, uint32_t pselrxd)
-{
-    p_reg->PSEL.TXD = pseltxd;
-    p_reg->PSEL.RXD = pselrxd;
-}
-
-__STATIC_INLINE void nrf_uarte_txrx_pins_disconnect(NRF_UARTE_Type * p_reg)
-{
-    nrf_uarte_txrx_pins_set(p_reg, NRF_UARTE_PSEL_DISCONNECTED, NRF_UARTE_PSEL_DISCONNECTED);
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_tx_pin_get(NRF_UARTE_Type * p_reg)
-{
-    return p_reg->PSEL.TXD;
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_rx_pin_get(NRF_UARTE_Type * p_reg)
-{
-    return p_reg->PSEL.RXD;
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_rts_pin_get(NRF_UARTE_Type * p_reg)
-{
-    return p_reg->PSEL.RTS;
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_cts_pin_get(NRF_UARTE_Type * p_reg)
-{
-    return p_reg->PSEL.CTS;
-}
-
-__STATIC_INLINE void nrf_uarte_hwfc_pins_set(NRF_UARTE_Type * p_reg, uint32_t pselrts, uint32_t pselcts)
-{
-    p_reg->PSEL.RTS = pselrts;
-    p_reg->PSEL.CTS = pselcts;
-}
-
-__STATIC_INLINE void nrf_uarte_hwfc_pins_disconnect(NRF_UARTE_Type * p_reg)
-{
-    nrf_uarte_hwfc_pins_set(p_reg, NRF_UARTE_PSEL_DISCONNECTED, NRF_UARTE_PSEL_DISCONNECTED);
-}
-
-__STATIC_INLINE void nrf_uarte_task_trigger(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)p_reg + (uint32_t)task)) = 0x1UL;
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_task_address_get(NRF_UARTE_Type * p_reg, nrf_uarte_task_t task)
-{
-    return (uint32_t)p_reg + (uint32_t)task;
-}
-
-__STATIC_INLINE void nrf_uarte_configure(NRF_UARTE_Type   * p_reg,
-                                            nrf_uarte_parity_t parity,
-                                            nrf_uarte_hwfc_t   hwfc)
-{
-    p_reg->CONFIG = (uint32_t)parity | (uint32_t)hwfc;
-}
-
-__STATIC_INLINE void nrf_uarte_baudrate_set(NRF_UARTE_Type   * p_reg, nrf_uarte_baudrate_t baudrate)
-{
-    p_reg->BAUDRATE = baudrate;
-}
-
-__STATIC_INLINE void nrf_uarte_tx_buffer_set(NRF_UARTE_Type * p_reg,
-                                             uint8_t  const * p_buffer,
-                                             uint8_t          length)
-{
-    p_reg->TXD.PTR    = (uint32_t)p_buffer;
-    p_reg->TXD.MAXCNT = length;
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_tx_amount_get(NRF_UARTE_Type * p_reg)
-{
-    return p_reg->TXD.AMOUNT;
-}
-
-__STATIC_INLINE void nrf_uarte_rx_buffer_set(NRF_UARTE_Type * p_reg,
-                                             uint8_t * p_buffer,
-                                             uint8_t   length)
-{
-    p_reg->RXD.PTR    = (uint32_t)p_buffer;
-    p_reg->RXD.MAXCNT = length;
-}
-
-__STATIC_INLINE uint32_t nrf_uarte_rx_amount_get(NRF_UARTE_Type * p_reg)
-{
-    return p_reg->RXD.AMOUNT;
-}
-#endif //SUPPRESS_INLINE_IMPLEMENTATION
-/** @} */
-#ifdef __cplusplus
-}
-#endif
-
-#endif //NRF_UARTE_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/hal/nrf_wdt.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_wdt.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_wdt.h
deleted file mode 100644
index 63bc2fb..0000000
--- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/hal/nrf_wdt.h
+++ /dev/null
@@ -1,307 +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.
- *
- */
-
-/**
- * @defgroup nrf_wdt_hal WDT HAL
- * @{
- * @ingroup nrf_wdt
- *
- * @brief Hardware access layer for accessing the watchdog timer (WDT) peripheral.
- */
-
-#ifndef NRF_WDT_H__
-#define NRF_WDT_H__
-
-#include <stddef.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "nrf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define NRF_WDT_CHANNEL_NUMBER 0x8UL
-#define NRF_WDT_RR_VALUE       0x6E524635UL /* Fixed value, shouldn't be modified.*/
-
-#define NRF_WDT_TASK_SET       1UL
-#define NRF_WDT_EVENT_CLEAR    0UL
-
-/**
- * @enum nrf_wdt_task_t
- * @brief WDT tasks.
- */
-typedef enum
-{
-    /*lint -save -e30 -esym(628,__INTADDR__)*/
-    NRF_WDT_TASK_START = offsetof(NRF_WDT_Type, TASKS_START), /**< Task for starting WDT. */
-    /*lint -restore*/
-} nrf_wdt_task_t;
-
-/**
- * @enum nrf_wdt_event_t
- * @brief WDT events.
- */
-typedef enum
-{
-    /*lint -save -e30*/
-    NRF_WDT_EVENT_TIMEOUT = offsetof(NRF_WDT_Type, EVENTS_TIMEOUT), /**< Event from WDT time-out. */
-    /*lint -restore*/
-} nrf_wdt_event_t;
-
-/**
- * @enum nrf_wdt_behaviour_t
- * @brief WDT behavior in CPU SLEEP or HALT mode.
- */
-typedef enum
-{
-    NRF_WDT_BEHAVIOUR_RUN_SLEEP        = WDT_CONFIG_SLEEP_Msk,                       /**< WDT will run when CPU is in SLEEP mode. */
-    NRF_WDT_BEHAVIOUR_RUN_HALT         = WDT_CONFIG_HALT_Msk,                        /**< WDT will run when CPU is in HALT mode. */
-    NRF_WDT_BEHAVIOUR_RUN_SLEEP_HALT   = WDT_CONFIG_SLEEP_Msk | WDT_CONFIG_HALT_Msk, /**< WDT will run when CPU is in SLEEP or HALT mode. */
-    NRF_WDT_BEHAVIOUR_PAUSE_SLEEP_HALT = 0,                                          /**< WDT will be paused when CPU is in SLEEP or HALT mode. */
-} nrf_wdt_behaviour_t;
-
-/**
- * @enum nrf_wdt_rr_register_t
- * @brief WDT reload request registers.
- */
-typedef enum
-{
-    NRF_WDT_RR0 = 0, /**< Reload request register 0. */
-    NRF_WDT_RR1,     /**< Reload request register 1. */
-    NRF_WDT_RR2,     /**< Reload request register 2. */
-    NRF_WDT_RR3,     /**< Reload request register 3. */
-    NRF_WDT_RR4,     /**< Reload request register 4. */
-    NRF_WDT_RR5,     /**< Reload request register 5. */
-    NRF_WDT_RR6,     /**< Reload request register 6. */
-    NRF_WDT_RR7      /**< Reload request register 7. */
-} nrf_wdt_rr_register_t;
-
-/**
- * @enum nrf_wdt_int_mask_t
- * @brief WDT interrupts.
- */
-typedef enum
-{
-    NRF_WDT_INT_TIMEOUT_MASK = WDT_INTENSET_TIMEOUT_Msk, /**< WDT interrupt from time-out event. */
-} nrf_wdt_int_mask_t;
-
-/**
- * @brief Function for configuring the watchdog behavior when the CPU is sleeping or halted.
- *
- * @param behaviour Watchdog behavior when CPU is in SLEEP or HALT mode.
- */
-__STATIC_INLINE void nrf_wdt_behaviour_set(nrf_wdt_behaviour_t behaviour)
-{
-    NRF_WDT->CONFIG = behaviour;
-}
-
-
-/**
- * @brief Function for starting the watchdog.
- *
- * @param[in]  task             Task.
- */
-__STATIC_INLINE void nrf_wdt_task_trigger(nrf_wdt_task_t task)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_WDT + task)) = NRF_WDT_TASK_SET;
-}
-
-
-/**
- * @brief Function for clearing the WDT event.
- *
- * @param[in]  event       Event.
- */
-__STATIC_INLINE void nrf_wdt_event_clear(nrf_wdt_event_t event)
-{
-    *((volatile uint32_t *)((uint8_t *)NRF_WDT + (uint32_t)event)) = NRF_WDT_EVENT_CLEAR;
-}
-
-
-/**
- * @brief Function for retrieving the state of the WDT event.
- *
- * @param[in]  event       Event.
- *
- * @retval     true              If the event is set.
- * @retval     false             If the event is not set.
- */
-__STATIC_INLINE bool nrf_wdt_event_check(nrf_wdt_event_t event)
-{
-    return (bool)*((volatile uint32_t *)((uint8_t *)NRF_WDT + event));
-}
-
-
-/**
- * @brief Function for enabling a specific interrupt.
- *
- * @param[in]  int_mask         Interrupt.
- */
-__STATIC_INLINE void nrf_wdt_int_enable(uint32_t int_mask)
-{
-    NRF_WDT->INTENSET = int_mask;
-}
-
-
-/**
- * @brief Function for retrieving the state of given interrupt.
- *
- * @param[in]  int_mask         Interrupt.
- *
- * @retval     true                   Interrupt is enabled.
- * @retval     false                  Interrupt is not enabled.
- */
-__STATIC_INLINE bool nrf_wdt_int_enable_check(uint32_t int_mask)
-{
-    return (bool)(NRF_WDT->INTENSET & int_mask);
-}
-
-
-/**
- * @brief Function for disabling a specific interrupt.
- *
- * @param[in]  int_mask         Interrupt.
- */
-__STATIC_INLINE void nrf_wdt_int_disable(uint32_t int_mask)
-{
-    NRF_WDT->INTENCLR = int_mask;
-}
-
-
-/**
- * @brief Function for returning the address of a specific WDT task register.
- *
- * @param[in]  task             Task.
- */
-__STATIC_INLINE uint32_t nrf_wdt_task_address_get(nrf_wdt_task_t task)
-{
-    return ((uint32_t)NRF_WDT + task);
-}
-
-
-/**
- * @brief Function for returning the address of a specific WDT event register.
- *
- * @param[in]  event       Event.
- *
- * @retval     address of requested event register
- */
-__STATIC_INLINE uint32_t nrf_wdt_event_address_get(nrf_wdt_event_t event)
-{
-    return ((uint32_t)NRF_WDT + event);
-}
-
-
-/**
- * @brief Function for retrieving the watchdog status.
- *
- * @retval     true             If the watchdog is started.
- * @retval     false            If the watchdog is not started.
- */
-__STATIC_INLINE bool nrf_wdt_started(void)
-{
-    return (bool)(NRF_WDT->RUNSTATUS);
-}
-
-
-/**
- * @brief Function for retrieving the watchdog reload request status.
- *
- * @param[in]  rr_register      Reload request register to check.
- *
- * @retval     true             If a reload request is running.
- * @retval     false            If no reload request is running.
- */
-__STATIC_INLINE bool nrf_wdt_request_status(nrf_wdt_rr_register_t rr_register)
-{
-    return (bool)(((NRF_WDT->REQSTATUS) >> rr_register) & 0x1UL);
-}
-
-
-/**
- * @brief Function for setting the watchdog reload value.
- *
- * @param[in]  reload_value     Watchdog counter initial value.
- */
-__STATIC_INLINE void nrf_wdt_reload_value_set(uint32_t reload_value)
-{
-    NRF_WDT->CRV = reload_value;
-}
-
-
-/**
- * @brief Function for retrieving the watchdog reload value.
- *
- * @retval                      Reload value.
- */
-__STATIC_INLINE uint32_t nrf_wdt_reload_value_get(void)
-{
-    return (uint32_t)NRF_WDT->CRV;
-}
-
-
-/**
- * @brief Function for enabling a specific reload request register.
- *
- * @param[in]  rr_register       Reload request register to enable.
- */
-__STATIC_INLINE void nrf_wdt_reload_request_enable(nrf_wdt_rr_register_t rr_register)
-{
-    NRF_WDT->RREN |= 0x1UL << rr_register;
-}
-
-
-/**
- * @brief Function for disabling a specific reload request register.
- *
- * @param[in]  rr_register       Reload request register to disable.
- */
-__STATIC_INLINE void nrf_wdt_reload_request_disable(nrf_wdt_rr_register_t rr_register)
-{
-    NRF_WDT->RREN &= ~(0x1UL << rr_register);
-}
-
-
-/**
- * @brief Function for retrieving the status of a specific reload request register.
- *
- * @param[in]  rr_register       Reload request register to check.
- *
- * @retval     true              If the reload request register is enabled.
- * @retval     false             If the reload request register is not enabled.
- */
-__STATIC_INLINE bool nrf_wdt_reload_request_is_enabled(nrf_wdt_rr_register_t rr_register)
-{
-    return (bool)(NRF_WDT->RREN & (0x1UL << rr_register));
-}
-
-
-/**
- * @brief Function for setting a specific reload request register.
- *
- * @param[in]  rr_register       Reload request register to set.
- */
-__STATIC_INLINE void nrf_wdt_reload_request_set(nrf_wdt_rr_register_t rr_register)
-{
-    NRF_WDT->RR[rr_register] = NRF_WDT_RR_VALUE;
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/** @} */