config changes
Fork of nRF51822 by
TARGET_NRF5/source/btle/btle_clock.h@638:c90ae1400bf2, 2016-09-14 (annotated)
- Committer:
- Vincent Coubard
- Date:
- Wed Sep 14 14:39:43 2016 +0100
- Revision:
- 638:c90ae1400bf2
Sync with bdab10dc0f90748b6989c8b577771bb403ca6bd8 from ARMmbed/mbed-os.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Vincent Coubard |
638:c90ae1400bf2 | 1 | /* |
Vincent Coubard |
638:c90ae1400bf2 | 2 | * Copyright (c) 2016 Nordic Semiconductor ASA |
Vincent Coubard |
638:c90ae1400bf2 | 3 | * All rights reserved. |
Vincent Coubard |
638:c90ae1400bf2 | 4 | * |
Vincent Coubard |
638:c90ae1400bf2 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Vincent Coubard |
638:c90ae1400bf2 | 6 | * are permitted provided that the following conditions are met: |
Vincent Coubard |
638:c90ae1400bf2 | 7 | * |
Vincent Coubard |
638:c90ae1400bf2 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this list |
Vincent Coubard |
638:c90ae1400bf2 | 9 | * of conditions and the following disclaimer. |
Vincent Coubard |
638:c90ae1400bf2 | 10 | * |
Vincent Coubard |
638:c90ae1400bf2 | 11 | * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA |
Vincent Coubard |
638:c90ae1400bf2 | 12 | * integrated circuit in a product or a software update for such product, must reproduce |
Vincent Coubard |
638:c90ae1400bf2 | 13 | * the above copyright notice, this list of conditions and the following disclaimer in |
Vincent Coubard |
638:c90ae1400bf2 | 14 | * the documentation and/or other materials provided with the distribution. |
Vincent Coubard |
638:c90ae1400bf2 | 15 | * |
Vincent Coubard |
638:c90ae1400bf2 | 16 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be |
Vincent Coubard |
638:c90ae1400bf2 | 17 | * used to endorse or promote products derived from this software without specific prior |
Vincent Coubard |
638:c90ae1400bf2 | 18 | * written permission. |
Vincent Coubard |
638:c90ae1400bf2 | 19 | * |
Vincent Coubard |
638:c90ae1400bf2 | 20 | * 4. This software, with or without modification, must only be used with a |
Vincent Coubard |
638:c90ae1400bf2 | 21 | * Nordic Semiconductor ASA integrated circuit. |
Vincent Coubard |
638:c90ae1400bf2 | 22 | * |
Vincent Coubard |
638:c90ae1400bf2 | 23 | * 5. Any software provided in binary or object form under this license must not be reverse |
Vincent Coubard |
638:c90ae1400bf2 | 24 | * engineered, decompiled, modified and/or disassembled. |
Vincent Coubard |
638:c90ae1400bf2 | 25 | * |
Vincent Coubard |
638:c90ae1400bf2 | 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Vincent Coubard |
638:c90ae1400bf2 | 27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Vincent Coubard |
638:c90ae1400bf2 | 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Vincent Coubard |
638:c90ae1400bf2 | 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Vincent Coubard |
638:c90ae1400bf2 | 30 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Vincent Coubard |
638:c90ae1400bf2 | 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Vincent Coubard |
638:c90ae1400bf2 | 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Vincent Coubard |
638:c90ae1400bf2 | 33 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Vincent Coubard |
638:c90ae1400bf2 | 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Vincent Coubard |
638:c90ae1400bf2 | 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Vincent Coubard |
638:c90ae1400bf2 | 36 | * |
Vincent Coubard |
638:c90ae1400bf2 | 37 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 38 | |
Vincent Coubard |
638:c90ae1400bf2 | 39 | #ifndef _BTLE_CLOCK_H_ |
Vincent Coubard |
638:c90ae1400bf2 | 40 | #define _BTLE_CLOCK_H_ |
Vincent Coubard |
638:c90ae1400bf2 | 41 | |
Vincent Coubard |
638:c90ae1400bf2 | 42 | #include "nrf5x_lf_clk_helper.h" |
Vincent Coubard |
638:c90ae1400bf2 | 43 | |
Vincent Coubard |
638:c90ae1400bf2 | 44 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 45 | * @brief Module that generates settings for the low-frequency (LF) clock configuration. |
Vincent Coubard |
638:c90ae1400bf2 | 46 | * |
Vincent Coubard |
638:c90ae1400bf2 | 47 | * This module provides macros that are generated from the mbed config system macros. |
Vincent Coubard |
638:c90ae1400bf2 | 48 | * |
Vincent Coubard |
638:c90ae1400bf2 | 49 | * |
Vincent Coubard |
638:c90ae1400bf2 | 50 | * |
Vincent Coubard |
638:c90ae1400bf2 | 51 | * As a result, this module provides the following: @n |
Vincent Coubard |
638:c90ae1400bf2 | 52 | * - literal value LFCLK_CONF_SOURCE @n |
Vincent Coubard |
638:c90ae1400bf2 | 53 | * - literal value LFCLK_CONF_ACCURACY @n |
Vincent Coubard |
638:c90ae1400bf2 | 54 | * - literal value LFCLK_CONF_RC_CTIV @n |
Vincent Coubard |
638:c90ae1400bf2 | 55 | * - literal value LFCLK_CONF_RC_TEMP_CTIV |
Vincent Coubard |
638:c90ae1400bf2 | 56 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 57 | |
Vincent Coubard |
638:c90ae1400bf2 | 58 | |
Vincent Coubard |
638:c90ae1400bf2 | 59 | |
Vincent Coubard |
638:c90ae1400bf2 | 60 | #include "nrf_sdm.h" |
Vincent Coubard |
638:c90ae1400bf2 | 61 | |
Vincent Coubard |
638:c90ae1400bf2 | 62 | #define DEFAULT_LFCLK_CONF_ACCURACY NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM |
Vincent Coubard |
638:c90ae1400bf2 | 63 | |
Vincent Coubard |
638:c90ae1400bf2 | 64 | #ifdef NRF52 |
Vincent Coubard |
638:c90ae1400bf2 | 65 | #define MAX_LFCLK_CONF_RC_CTIV 32 |
Vincent Coubard |
638:c90ae1400bf2 | 66 | #else |
Vincent Coubard |
638:c90ae1400bf2 | 67 | #define MAX_LFCLK_CONF_RC_CTIV 64 |
Vincent Coubard |
638:c90ae1400bf2 | 68 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 69 | |
Vincent Coubard |
638:c90ae1400bf2 | 70 | #define MAX_LFCLK_CONF_RC_TEMP_CTIV 33 |
Vincent Coubard |
638:c90ae1400bf2 | 71 | |
Vincent Coubard |
638:c90ae1400bf2 | 72 | #define DEFAULT_LFCLK_CONF_RC_CTIV 16 // Check temperature every 16 * 250ms. |
Vincent Coubard |
638:c90ae1400bf2 | 73 | #define DEFAULT_LFCLK_CONF_RC_TEMP_CTIV 1 // Only calibrate if temperature has changed. |
Vincent Coubard |
638:c90ae1400bf2 | 74 | |
Vincent Coubard |
638:c90ae1400bf2 | 75 | #define NRF_LF_SRC_XTAL 2 |
Vincent Coubard |
638:c90ae1400bf2 | 76 | #define NRF_LF_SRC_SYNTH 3 |
Vincent Coubard |
638:c90ae1400bf2 | 77 | #define NRF_LF_SRC_RC 4 |
Vincent Coubard |
638:c90ae1400bf2 | 78 | |
Vincent Coubard |
638:c90ae1400bf2 | 79 | #if MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_RC |
Vincent Coubard |
638:c90ae1400bf2 | 80 | #define LFCLK_CONF_SOURCE NRF_CLOCK_LF_SRC_RC |
Vincent Coubard |
638:c90ae1400bf2 | 81 | |
Vincent Coubard |
638:c90ae1400bf2 | 82 | #ifdef MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL |
Vincent Coubard |
638:c90ae1400bf2 | 83 | #define LFCLK_CONF_RC_CTIV MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_TIMER_INTERVAL |
Vincent Coubard |
638:c90ae1400bf2 | 84 | #else |
Vincent Coubard |
638:c90ae1400bf2 | 85 | #define LFCLK_CONF_RC_CTIV DEFAULT_LFCLK_CONF_RC_CTIV |
Vincent Coubard |
638:c90ae1400bf2 | 86 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 87 | |
Vincent Coubard |
638:c90ae1400bf2 | 88 | #ifdef MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG |
Vincent Coubard |
638:c90ae1400bf2 | 89 | #define LFCLK_CONF_RC_TEMP_CTIV MBED_CONF_NORDIC_NRF_LF_CLOCK_CALIB_MODE_CONFIG |
Vincent Coubard |
638:c90ae1400bf2 | 90 | #else |
Vincent Coubard |
638:c90ae1400bf2 | 91 | #define LFCLK_CONF_RC_TEMP_CTIV DEFAULT_LFCLK_CONF_RC_TEMP_CTIV |
Vincent Coubard |
638:c90ae1400bf2 | 92 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 93 | |
Vincent Coubard |
638:c90ae1400bf2 | 94 | #if (LFCLK_CONF_RC_CTIV < 1) || (LFCLK_CONF_RC_CTIV > MAX_LFCLK_CONF_RC_CTIV) |
Vincent Coubard |
638:c90ae1400bf2 | 95 | #error Calibration timer interval out of range! |
Vincent Coubard |
638:c90ae1400bf2 | 96 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 97 | |
Vincent Coubard |
638:c90ae1400bf2 | 98 | #if (LFCLK_CONF_RC_TEMP_CTIV < 0 ) || (LFCLK_CONF_RC_TEMP_CTIV > 33) |
Vincent Coubard |
638:c90ae1400bf2 | 99 | #error Number/mode of LF RC calibration intervals out of range! |
Vincent Coubard |
638:c90ae1400bf2 | 100 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 101 | |
Vincent Coubard |
638:c90ae1400bf2 | 102 | #elif MBED_CONF_NORDIC_NRF_LF_CLOCK_SRC == NRF_LF_SRC_SYNTH |
Vincent Coubard |
638:c90ae1400bf2 | 103 | #define LFCLK_CONF_SOURCE NRF_CLOCK_LF_SRC_SYNTH |
Vincent Coubard |
638:c90ae1400bf2 | 104 | #define LFCLK_CONF_RC_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. |
Vincent Coubard |
638:c90ae1400bf2 | 105 | #define LFCLK_CONF_RC_TEMP_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. |
Vincent Coubard |
638:c90ae1400bf2 | 106 | |
Vincent Coubard |
638:c90ae1400bf2 | 107 | #ifdef MBED_CONF_NORDIC_LF_CLOCK_HF_SYNTH_ACCURACY |
Vincent Coubard |
638:c90ae1400bf2 | 108 | #define LFCLK_CONF_ACCURACY MBED_CONF_NORDIC_LF_CLOCK_HF_SYNTH_ACCURACY |
Vincent Coubard |
638:c90ae1400bf2 | 109 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 110 | |
Vincent Coubard |
638:c90ae1400bf2 | 111 | #else // default is NRF_LF_SRC_SYNTH |
Vincent Coubard |
638:c90ae1400bf2 | 112 | #define LFCLK_CONF_SOURCE NRF_CLOCK_LF_SRC_XTAL |
Vincent Coubard |
638:c90ae1400bf2 | 113 | #define LFCLK_CONF_RC_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. |
Vincent Coubard |
638:c90ae1400bf2 | 114 | #define LFCLK_CONF_RC_TEMP_CTIV 0 // Must be 0 if source is not NRF_CLOCK_LF_SRC_RC. |
Vincent Coubard |
638:c90ae1400bf2 | 115 | |
Vincent Coubard |
638:c90ae1400bf2 | 116 | #ifdef MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY |
Vincent Coubard |
638:c90ae1400bf2 | 117 | #define LFCLK_CONF_ACCURACY MBED_CONF_NORDIC_LF_CLOCK_XTAL_ACCURACY |
Vincent Coubard |
638:c90ae1400bf2 | 118 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 119 | |
Vincent Coubard |
638:c90ae1400bf2 | 120 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 121 | |
Vincent Coubard |
638:c90ae1400bf2 | 122 | #ifndef LFCLK_CONF_ACCURACY |
Vincent Coubard |
638:c90ae1400bf2 | 123 | #define LFCLK_CONF_ACCURACY DEFAULT_LFCLK_CONF_ACCURACY |
Vincent Coubard |
638:c90ae1400bf2 | 124 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 125 | |
Vincent Coubard |
638:c90ae1400bf2 | 126 | #if (LFCLK_CONF_ACCURACY > NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM) || (LFCLK_CONF_ACCURACY < NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM) |
Vincent Coubard |
638:c90ae1400bf2 | 127 | #error Low frequency clock accuracy out of range! |
Vincent Coubard |
638:c90ae1400bf2 | 128 | #endif |
Vincent Coubard |
638:c90ae1400bf2 | 129 | |
Vincent Coubard |
638:c90ae1400bf2 | 130 | |
Vincent Coubard |
638:c90ae1400bf2 | 131 | #endif //_BTLE_CLOCK_H_ |
Vincent Coubard |
638:c90ae1400bf2 | 132 | |
Vincent Coubard |
638:c90ae1400bf2 | 133 |