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

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

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/drivers_nrf/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 */