The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_11/libraries/util/sdk_errors.h@169:a7c7b631e539
mbed library. Release version 164

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 143:86740a56073b 1 /*
AnnaBridge 143:86740a56073b 2 * Copyright (c) 2013 Nordic Semiconductor ASA
AnnaBridge 143:86740a56073b 3 * All rights reserved.
AnnaBridge 143:86740a56073b 4 *
AnnaBridge 143:86740a56073b 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 143:86740a56073b 6 * are permitted provided that the following conditions are met:
AnnaBridge 143:86740a56073b 7 *
AnnaBridge 143:86740a56073b 8 * 1. Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 143:86740a56073b 9 * of conditions and the following disclaimer.
AnnaBridge 143:86740a56073b 10 *
AnnaBridge 143:86740a56073b 11 * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
AnnaBridge 143:86740a56073b 12 * integrated circuit in a product or a software update for such product, must reproduce
AnnaBridge 143:86740a56073b 13 * the above copyright notice, this list of conditions and the following disclaimer in
AnnaBridge 143:86740a56073b 14 * the documentation and/or other materials provided with the distribution.
AnnaBridge 143:86740a56073b 15 *
AnnaBridge 143:86740a56073b 16 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
AnnaBridge 143:86740a56073b 17 * used to endorse or promote products derived from this software without specific prior
AnnaBridge 143:86740a56073b 18 * written permission.
AnnaBridge 143:86740a56073b 19 *
AnnaBridge 143:86740a56073b 20 * 4. This software, with or without modification, must only be used with a
AnnaBridge 143:86740a56073b 21 * Nordic Semiconductor ASA integrated circuit.
AnnaBridge 143:86740a56073b 22 *
AnnaBridge 143:86740a56073b 23 * 5. Any software provided in binary or object form under this license must not be reverse
AnnaBridge 143:86740a56073b 24 * engineered, decompiled, modified and/or disassembled.
AnnaBridge 143:86740a56073b 25 *
AnnaBridge 143:86740a56073b 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 143:86740a56073b 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 143:86740a56073b 28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 143:86740a56073b 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 143:86740a56073b 30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 143:86740a56073b 31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 143:86740a56073b 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 143:86740a56073b 33 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 143:86740a56073b 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 143:86740a56073b 35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 143:86740a56073b 36 *
AnnaBridge 143:86740a56073b 37 */
AnnaBridge 143:86740a56073b 38
AnnaBridge 143:86740a56073b 39
AnnaBridge 143:86740a56073b 40 /**@file
AnnaBridge 143:86740a56073b 41 *
AnnaBridge 143:86740a56073b 42 * @defgroup sdk_error SDK Error codes
AnnaBridge 143:86740a56073b 43 * @{
AnnaBridge 143:86740a56073b 44 * @ingroup app_common
AnnaBridge 143:86740a56073b 45 * @{
AnnaBridge 143:86740a56073b 46 * @details Error codes are 32-bit unsigned integers with the most significant 16-bit reserved for
AnnaBridge 143:86740a56073b 47 * identifying the module where the error occurred while the least least significant LSB
AnnaBridge 143:86740a56073b 48 * are used to provide the cause or nature of error. Each module is assigned a 16-bit
AnnaBridge 143:86740a56073b 49 * unsigned integer. Which it will use to identify all errors that occurred in it. 16-bit
AnnaBridge 143:86740a56073b 50 * LSB range is with module id as the MSB in the 32-bit error code is reserved for the
AnnaBridge 143:86740a56073b 51 * module. As an example, if 0x8800 identifies a certain SDK module, all values from
AnnaBridge 143:86740a56073b 52 * 0x88000000 - 0x8800FFFF are reserved for this module.
AnnaBridge 143:86740a56073b 53 * It should be noted that common error reasons have been assigned values to make it
AnnaBridge 143:86740a56073b 54 * possible to decode error reason easily. As an example, lets module uninitialized has
AnnaBridge 143:86740a56073b 55 * been assigned an error code 0x000A0. Then, if application encounters an error code
AnnaBridge 143:86740a56073b 56 * 0xZZZZ00A0, it knows that it accessing a certain module without initializing it.
AnnaBridge 143:86740a56073b 57 * Apart from this, each module is allowed to define error codes that are not covered by
AnnaBridge 143:86740a56073b 58 * the common ones, however, these values are defined in a range that does not conflict
AnnaBridge 143:86740a56073b 59 * with common error values. For module, specific error however, it is possible that the
AnnaBridge 143:86740a56073b 60 * same error value is used by two different modules to indicated errors of very different
AnnaBridge 143:86740a56073b 61 * nature. If error is already defined by the NRF common error codes, these are reused.
AnnaBridge 143:86740a56073b 62 * A range is reserved for application as well, it can use this range for defining
AnnaBridge 143:86740a56073b 63 * application specific errors.
AnnaBridge 143:86740a56073b 64 *
AnnaBridge 143:86740a56073b 65 * @note Success code, NRF_SUCCESS, does not include any module identifier.
AnnaBridge 143:86740a56073b 66
AnnaBridge 143:86740a56073b 67 */
AnnaBridge 143:86740a56073b 68
AnnaBridge 143:86740a56073b 69 #ifndef SDK_ERRORS_H__
AnnaBridge 143:86740a56073b 70 #define SDK_ERRORS_H__
AnnaBridge 143:86740a56073b 71
AnnaBridge 143:86740a56073b 72 #include <stdint.h>
AnnaBridge 143:86740a56073b 73 #include "nrf_error.h"
AnnaBridge 143:86740a56073b 74
AnnaBridge 143:86740a56073b 75 /**
AnnaBridge 143:86740a56073b 76 * @defgroup sdk_err_base Base defined for SDK Modules
AnnaBridge 143:86740a56073b 77 * @{
AnnaBridge 143:86740a56073b 78 */
AnnaBridge 143:86740a56073b 79 #define SDK_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x8000) /**< Base value defined for SDK module identifiers. */
AnnaBridge 143:86740a56073b 80 #define SDK_COMMON_ERROR_BASE (NRF_ERROR_BASE_NUM + 0x0080) /**< Base error value to be used for SDK error values. */
AnnaBridge 143:86740a56073b 81 /* @} */
AnnaBridge 143:86740a56073b 82
AnnaBridge 143:86740a56073b 83 /**
AnnaBridge 143:86740a56073b 84 * @defgroup sdk_module_codes Codes reserved as identification for module where the error occurred.
AnnaBridge 143:86740a56073b 85 * @{
AnnaBridge 143:86740a56073b 86 */
AnnaBridge 143:86740a56073b 87 #define DEVICE_MANAGER_ERR_BASE (0x8000)
AnnaBridge 143:86740a56073b 88 #define MEMORY_MANAGER_ERR_BASE (0x8100)
AnnaBridge 143:86740a56073b 89 /* @} */
AnnaBridge 143:86740a56073b 90
AnnaBridge 143:86740a56073b 91
AnnaBridge 143:86740a56073b 92 /**
AnnaBridge 143:86740a56073b 93 * @defgroup sdk_iot_errors Codes reserved as identification for IoT errors.
AnnaBridge 143:86740a56073b 94 * @{
AnnaBridge 143:86740a56073b 95 */
AnnaBridge 143:86740a56073b 96 #define IOT_ERR_BASE_START (0xA000)
AnnaBridge 143:86740a56073b 97 #define IOT_ERR_BASE_STOP (0xAFFF)
AnnaBridge 143:86740a56073b 98 /* @} */
AnnaBridge 143:86740a56073b 99
AnnaBridge 143:86740a56073b 100
AnnaBridge 143:86740a56073b 101 /**
AnnaBridge 143:86740a56073b 102 * @defgroup sdk_common_errors Codes reserved as identification for common errors.
AnnaBridge 143:86740a56073b 103 * @{
AnnaBridge 143:86740a56073b 104 */
AnnaBridge 143:86740a56073b 105 #define MODULE_NOT_INITIALZED (SDK_COMMON_ERROR_BASE + 0x0000)
AnnaBridge 143:86740a56073b 106 #define MUTEX_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0001)
AnnaBridge 143:86740a56073b 107 #define MUTEX_LOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0002)
AnnaBridge 143:86740a56073b 108 #define MUTEX_UNLOCK_FAILED (SDK_COMMON_ERROR_BASE + 0x0003)
AnnaBridge 143:86740a56073b 109 #define MUTEX_COND_INIT_FAILED (SDK_COMMON_ERROR_BASE + 0x0004)
AnnaBridge 143:86740a56073b 110 #define MODULE_ALREADY_INITIALIZED (SDK_COMMON_ERROR_BASE + 0x0005)
AnnaBridge 143:86740a56073b 111 #define API_NOT_IMPLEMENTED (SDK_COMMON_ERROR_BASE + 0x0010)
AnnaBridge 143:86740a56073b 112 #define FEATURE_NOT_ENABLED (SDK_COMMON_ERROR_BASE + 0x0011)
AnnaBridge 143:86740a56073b 113 /* @} */
AnnaBridge 143:86740a56073b 114
AnnaBridge 143:86740a56073b 115
AnnaBridge 143:86740a56073b 116 /**
AnnaBridge 143:86740a56073b 117 * @defgroup dm_specific_errors Error / status codes specific to device manager.
AnnaBridge 143:86740a56073b 118 * @{
AnnaBridge 143:86740a56073b 119 */
AnnaBridge 143:86740a56073b 120 #define DM_NO_APP_CONTEXT (DEVICE_MANAGER_ERR_BASE + 0x0040)
AnnaBridge 143:86740a56073b 121 #define DM_SERVICE_CONTEXT_NOT_APPLIED (DEVICE_MANAGER_ERR_BASE + 0x0041)
AnnaBridge 143:86740a56073b 122 #define DM_CONTEXT_INFO_LOST (DEVICE_MANAGER_ERR_BASE + 0x0042)
AnnaBridge 143:86740a56073b 123 #define DM_DEVICE_CONTEXT_FULL (DEVICE_MANAGER_ERR_BASE + 0x0043)
AnnaBridge 143:86740a56073b 124 /* @} */
AnnaBridge 143:86740a56073b 125
AnnaBridge 143:86740a56073b 126 /**
AnnaBridge 143:86740a56073b 127 * @brief API Result.
AnnaBridge 143:86740a56073b 128 *
AnnaBridge 143:86740a56073b 129 * @details Indicates success or failure of an API procedure. In case of failure, a comprehensive
AnnaBridge 143:86740a56073b 130 * error code indicating cause or reason for failure is provided.
AnnaBridge 143:86740a56073b 131 *
AnnaBridge 143:86740a56073b 132 * Though called an API result, it could used in Asynchronous notifications callback along
AnnaBridge 143:86740a56073b 133 * with asynchronous callback as event result. This mechanism is employed when an event
AnnaBridge 143:86740a56073b 134 * marks the end of procedure initiated using API. API result, in this case, will only be
AnnaBridge 143:86740a56073b 135 * an indicative of whether the procedure has been requested successfully.
AnnaBridge 143:86740a56073b 136 */
AnnaBridge 143:86740a56073b 137 typedef uint32_t ret_code_t;
AnnaBridge 143:86740a56073b 138 /** @} */
AnnaBridge 143:86740a56073b 139 /** @} */
AnnaBridge 143:86740a56073b 140
AnnaBridge 143:86740a56073b 141 #endif // SDK_ERRORS_H__
AnnaBridge 143:86740a56073b 142