Nordic stack and drivers for the mbed BLE API
Dependents: BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate writable_gatt ... more
TARGET_MCU_NRF51822/sdk/source/libraries/util/sdk_errors.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) 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 | * |
Vincent Coubard |
638:c90ae1400bf2 | 35 | * @defgroup sdk_error SDK Error codes |
Vincent Coubard |
638:c90ae1400bf2 | 36 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 37 | * @ingroup app_common |
Vincent Coubard |
638:c90ae1400bf2 | 38 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 39 | * @details Error codes are 32-bit unsigned integers with the most significant 16-bit reserved for |
Vincent Coubard |
638:c90ae1400bf2 | 40 | * identifying the module where the error occurred while the least least significant LSB |
Vincent Coubard |
638:c90ae1400bf2 | 41 | * are used to provide the cause or nature of error. Each module is assigned a 16-bit |
Vincent Coubard |
638:c90ae1400bf2 | 42 | * unsigned integer. Which it will use to identify all errors that occurred in it. 16-bit |
Vincent Coubard |
638:c90ae1400bf2 | 43 | * LSB range is with module id as the MSB in the 32-bit error code is reserved for the |
Vincent Coubard |
638:c90ae1400bf2 | 44 | * module. As an example, if 0x8800 identifies a certain SDK module, all values from |
Vincent Coubard |
638:c90ae1400bf2 | 45 | * 0x88000000 - 0x8800FFFF are reserved for this module. |
Vincent Coubard |
638:c90ae1400bf2 | 46 | * It should be noted that common error reasons have been assigned values to make it |
Vincent Coubard |
638:c90ae1400bf2 | 47 | * possible to decode error reason easily. As an example, lets module uninitialized has |
Vincent Coubard |
638:c90ae1400bf2 | 48 | * been assigned an error code 0x000A0. Then, if application encounters an error code |
Vincent Coubard |
638:c90ae1400bf2 | 49 | * 0xZZZZ00A0, it knows that it accessing a certain module without initializing it. |
Vincent Coubard |
638:c90ae1400bf2 | 50 | * Apart from this, each module is allowed to define error codes that are not covered by |
Vincent Coubard |
638:c90ae1400bf2 | 51 | * the common ones, however, these values are defined in a range that does not conflict |
Vincent Coubard |
638:c90ae1400bf2 | 52 | * with common error values. For module, specific error however, it is possible that the |
Vincent Coubard |
638:c90ae1400bf2 | 53 | * same error value is used by two different modules to indicated errors of very different |
Vincent Coubard |
638:c90ae1400bf2 | 54 | * nature. If error is already defined by the NRF common error codes, these are reused. |
Vincent Coubard |
638:c90ae1400bf2 | 55 | * A range is reserved for application as well, it can use this range for defining |
Vincent Coubard |
638:c90ae1400bf2 | 56 | * application specific errors. |
Vincent Coubard |
638:c90ae1400bf2 | 57 | * |
Vincent Coubard |
638:c90ae1400bf2 | 58 | * @note Success code, NRF_SUCCESS, does not include any module identifier. |
Vincent Coubard |
638:c90ae1400bf2 | 59 | |
Vincent Coubard |
638:c90ae1400bf2 | 60 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 61 | |
Vincent Coubard |
638:c90ae1400bf2 | 62 | #ifndef SDK_ERRORS_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 63 | #define SDK_ERRORS_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 64 | |
Vincent Coubard |
638:c90ae1400bf2 | 65 | #include <stdint.h> |
Vincent Coubard |
638:c90ae1400bf2 | 66 | #include "nrf_error.h" |
Vincent Coubard |
638:c90ae1400bf2 | 67 | |
Vincent Coubard |
638:c90ae1400bf2 | 68 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 69 | * @defgroup sdk_err_base Base defined for SDK Modules |
Vincent Coubard |
638:c90ae1400bf2 | 70 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 71 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 72 | #define SDK_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x8000) /**< Base value defined for SDK module identifiers. */ |
Vincent Coubard |
638:c90ae1400bf2 | 73 | #define SDK_COMMON_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x0080) /**< Base error value to be used for SDK error values. */ |
Vincent Coubard |
638:c90ae1400bf2 | 74 | /* @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 75 | |
Vincent Coubard |
638:c90ae1400bf2 | 76 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 77 | * @defgroup sdk_module_codes Codes reserved as identification for module where the error occurred. |
Vincent Coubard |
638:c90ae1400bf2 | 78 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 79 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 80 | #define DEVICE_MANAGER_ERR_BASE (0x8000) |
Vincent Coubard |
638:c90ae1400bf2 | 81 | #define MEMORY_MANAGER_ERR_BASE (0x8100) |
Vincent Coubard |
638:c90ae1400bf2 | 82 | /* @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 83 | |
Vincent Coubard |
638:c90ae1400bf2 | 84 | |
Vincent Coubard |
638:c90ae1400bf2 | 85 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 86 | * @defgroup sdk_iot_errors Codes reserved as identification for IoT errors. |
Vincent Coubard |
638:c90ae1400bf2 | 87 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 88 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 89 | #define IOT_ERR_BASE_START (0xA000) |
Vincent Coubard |
638:c90ae1400bf2 | 90 | #define IOT_ERR_BASE_STOP (0xAFFF) |
Vincent Coubard |
638:c90ae1400bf2 | 91 | /* @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 92 | |
Vincent Coubard |
638:c90ae1400bf2 | 93 | |
Vincent Coubard |
638:c90ae1400bf2 | 94 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 95 | * @defgroup sdk_common_errors Codes reserved as identification for common errors. |
Vincent Coubard |
638:c90ae1400bf2 | 96 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 97 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 98 | #define MODULE_NOT_INITIALZED (SDK_COMMON_ERROR_BASE + 0x0000) |
Vincent Coubard |
638:c90ae1400bf2 | 99 | #define MUTEX_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0001) |
Vincent Coubard |
638:c90ae1400bf2 | 100 | #define MUTEX_LOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0002) |
Vincent Coubard |
638:c90ae1400bf2 | 101 | #define MUTEX_UNLOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0003) |
Vincent Coubard |
638:c90ae1400bf2 | 102 | #define MUTEX_COND_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0004) |
Vincent Coubard |
638:c90ae1400bf2 | 103 | #define MODULE_ALREADY_INITIALIZED (SDK_COMMON_ERROR_BASE + 0x0005) |
Vincent Coubard |
638:c90ae1400bf2 | 104 | #define API_NOT_IMPLEMENTED (SDK_COMMON_ERROR_BASE + 0x0010) |
Vincent Coubard |
638:c90ae1400bf2 | 105 | #define FEATURE_NOT_ENABLED (SDK_COMMON_ERROR_BASE + 0x0011) |
Vincent Coubard |
638:c90ae1400bf2 | 106 | /* @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 107 | |
Vincent Coubard |
638:c90ae1400bf2 | 108 | |
Vincent Coubard |
638:c90ae1400bf2 | 109 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 110 | * @defgroup dm_specific_errors Error / status codes specific to device manager. |
Vincent Coubard |
638:c90ae1400bf2 | 111 | * @{ |
Vincent Coubard |
638:c90ae1400bf2 | 112 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 113 | #define DM_NO_APP_CONTEXT (DEVICE_MANAGER_ERR_BASE + 0x0040) |
Vincent Coubard |
638:c90ae1400bf2 | 114 | #define DM_SERVICE_CONTEXT_NOT_APPLIED (DEVICE_MANAGER_ERR_BASE + 0x0041) |
Vincent Coubard |
638:c90ae1400bf2 | 115 | #define DM_CONTEXT_INFO_LOST (DEVICE_MANAGER_ERR_BASE + 0x0042) |
Vincent Coubard |
638:c90ae1400bf2 | 116 | #define DM_DEVICE_CONTEXT_FULL (DEVICE_MANAGER_ERR_BASE + 0x0043) |
Vincent Coubard |
638:c90ae1400bf2 | 117 | /* @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 118 | |
Vincent Coubard |
638:c90ae1400bf2 | 119 | /** |
Vincent Coubard |
638:c90ae1400bf2 | 120 | * @brief API Result. |
Vincent Coubard |
638:c90ae1400bf2 | 121 | * |
Vincent Coubard |
638:c90ae1400bf2 | 122 | * @details Indicates success or failure of an API procedure. In case of failure, a comprehensive |
Vincent Coubard |
638:c90ae1400bf2 | 123 | * error code indicating cause or reason for failure is provided. |
Vincent Coubard |
638:c90ae1400bf2 | 124 | * |
Vincent Coubard |
638:c90ae1400bf2 | 125 | * Though called an API result, it could used in Asynchronous notifications callback along |
Vincent Coubard |
638:c90ae1400bf2 | 126 | * with asynchronous callback as event result. This mechanism is employed when an event |
Vincent Coubard |
638:c90ae1400bf2 | 127 | * marks the end of procedure initiated using API. API result, in this case, will only be |
Vincent Coubard |
638:c90ae1400bf2 | 128 | * an indicative of whether the procedure has been requested successfully. |
Vincent Coubard |
638:c90ae1400bf2 | 129 | */ |
Vincent Coubard |
638:c90ae1400bf2 | 130 | typedef uint32_t ret_code_t; |
Vincent Coubard |
638:c90ae1400bf2 | 131 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 132 | /** @} */ |
Vincent Coubard |
638:c90ae1400bf2 | 133 | |
Vincent Coubard |
638:c90ae1400bf2 | 134 | #endif // SDK_ERRORS_H__ |
Vincent Coubard |
638:c90ae1400bf2 | 135 |