Nordic stack and drivers for the mbed BLE API

Dependents:   BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate writable_gatt ... more

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?

UserRevisionLine numberNew contents of line
Vincent Coubard 638:c90ae1400bf2 1 /*
Vincent Coubard 638:c90ae1400bf2 2 * Copyright (c) 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
Vincent Coubard 638:c90ae1400bf2 9 * list of conditions and the following disclaimer.
Vincent Coubard 638:c90ae1400bf2 10 *
Vincent Coubard 638:c90ae1400bf2 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this
Vincent Coubard 638:c90ae1400bf2 12 * list of conditions and the following disclaimer in the documentation and/or
Vincent Coubard 638:c90ae1400bf2 13 * other materials provided with the distribution.
Vincent Coubard 638:c90ae1400bf2 14 *
Vincent Coubard 638:c90ae1400bf2 15 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
Vincent Coubard 638:c90ae1400bf2 16 * contributors to this software may be used to endorse or promote products
Vincent Coubard 638:c90ae1400bf2 17 * derived from this software without specific prior written permission.
Vincent Coubard 638:c90ae1400bf2 18 *
Vincent Coubard 638:c90ae1400bf2 19 *
Vincent Coubard 638:c90ae1400bf2 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Vincent Coubard 638:c90ae1400bf2 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Vincent Coubard 638:c90ae1400bf2 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Vincent Coubard 638:c90ae1400bf2 23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
Vincent Coubard 638:c90ae1400bf2 24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Vincent Coubard 638:c90ae1400bf2 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Vincent Coubard 638:c90ae1400bf2 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
Vincent Coubard 638:c90ae1400bf2 27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Vincent Coubard 638:c90ae1400bf2 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Vincent Coubard 638:c90ae1400bf2 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Vincent Coubard 638:c90ae1400bf2 30 *
Vincent Coubard 638:c90ae1400bf2 31 */
Vincent Coubard 638:c90ae1400bf2 32
Vincent Coubard 638:c90ae1400bf2 33 /** @file
Vincent Coubard 638:c90ae1400bf2 34 * @brief Utilities for verifying program logic
Vincent Coubard 638:c90ae1400bf2 35 */
Vincent Coubard 638:c90ae1400bf2 36
Vincent Coubard 638:c90ae1400bf2 37 #ifndef NRF_ASSERT_H_
Vincent Coubard 638:c90ae1400bf2 38 #define NRF_ASSERT_H_
Vincent Coubard 638:c90ae1400bf2 39
Vincent Coubard 638:c90ae1400bf2 40 #include <stdint.h>
Vincent Coubard 638:c90ae1400bf2 41 #include "compiler_abstraction.h"
Vincent Coubard 638:c90ae1400bf2 42
Vincent Coubard 638:c90ae1400bf2 43 #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
Vincent Coubard 638:c90ae1400bf2 44
Vincent Coubard 638:c90ae1400bf2 45 /** @brief Function for handling assertions.
Vincent Coubard 638:c90ae1400bf2 46 *
Vincent Coubard 638:c90ae1400bf2 47 *
Vincent Coubard 638:c90ae1400bf2 48 * @note
Vincent Coubard 638:c90ae1400bf2 49 * This function is called when an assertion has triggered.
Vincent Coubard 638:c90ae1400bf2 50 *
Vincent Coubard 638:c90ae1400bf2 51 *
Vincent Coubard 638:c90ae1400bf2 52 * @post
Vincent Coubard 638:c90ae1400bf2 53 * All hardware is put into an idle non-emitting state (in particular the radio is highly
Vincent Coubard 638:c90ae1400bf2 54 * important to switch off since the radio might be in a state that makes it send
Vincent Coubard 638:c90ae1400bf2 55 * packets continiously while a typical final infinit ASSERT loop is executing).
Vincent Coubard 638:c90ae1400bf2 56 *
Vincent Coubard 638:c90ae1400bf2 57 *
Vincent Coubard 638:c90ae1400bf2 58 * @param line_num The line number where the assertion is called
Vincent Coubard 638:c90ae1400bf2 59 * @param file_name Pointer to the file name
Vincent Coubard 638:c90ae1400bf2 60 */
Vincent Coubard 638:c90ae1400bf2 61 void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
Vincent Coubard 638:c90ae1400bf2 62
Vincent Coubard 638:c90ae1400bf2 63 /*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
Vincent Coubard 638:c90ae1400bf2 64 /*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \
Vincent Coubard 638:c90ae1400bf2 65
Vincent Coubard 638:c90ae1400bf2 66 /** @brief Function for checking intended for production code.
Vincent Coubard 638:c90ae1400bf2 67 *
Vincent Coubard 638:c90ae1400bf2 68 * Check passes if "expr" evaluates to true. */
Vincent Coubard 638:c90ae1400bf2 69 #define ASSERT(expr) \
Vincent Coubard 638:c90ae1400bf2 70 if (expr) \
Vincent Coubard 638:c90ae1400bf2 71 { \
Vincent Coubard 638:c90ae1400bf2 72 } \
Vincent Coubard 638:c90ae1400bf2 73 else \
Vincent Coubard 638:c90ae1400bf2 74 { \
Vincent Coubard 638:c90ae1400bf2 75 assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \
Vincent Coubard 638:c90ae1400bf2 76 }
Vincent Coubard 638:c90ae1400bf2 77 #else
Vincent Coubard 638:c90ae1400bf2 78 #define ASSERT(expr) //!< Assert empty when disabled
Vincent Coubard 638:c90ae1400bf2 79 __WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
Vincent Coubard 638:c90ae1400bf2 80 #endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */
Vincent Coubard 638:c90ae1400bf2 81
Vincent Coubard 638:c90ae1400bf2 82 #endif /* NRF_ASSERT_H_ */