BLE_Nano nRF51 Central heart rate

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sdk_errors.h Source File

sdk_errors.h

Go to the documentation of this file.
00001 /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *
00011  */
00012 
00013 /**@file
00014  *
00015  * @defgroup sdk_error SDK Error codes
00016  * @{
00017  * @ingroup app_common
00018  * @{
00019  * @details Error codes are 32-bit unsigned integers with the most significant 16-bit reserved for
00020  *          identifying the module where the error occurred while the least least significant LSB
00021  *          are used to provide the cause or nature of error. Each module is assigned a 16-bit
00022  *          unsigned integer. Which it will use to identify all errors that occurred in it. 16-bit
00023  *          LSB range is with module id as the MSB in the 32-bit error code is reserved for the
00024  *          module. As an example, if 0x8800 identifies a certain SDK module, all values from 
00025  *          0x88000000 - 0x8800FFFF are reserved for this module.
00026  *          It should be noted that common error reasons have been assigned values to make it 
00027  *          possible to decode error reason easily. As an example, lets module uninitialized has
00028  *          been assigned an error code 0x000A0. Then, if application encounters an error code
00029  *          0xZZZZ00A0, it knows that it accessing a certain module without initializing it.
00030  *          Apart from this, each module is allowed to define error codes that are not covered by
00031  *          the common ones, however, these values are defined in a range that does not conflict
00032  *          with common error values. For module, specific error however, it is possible that the
00033  *          same error value is used by two different modules to indicated errors of very different
00034  *          nature. If error is already defined by the NRF common error codes, these are reused.
00035  *          A range is reserved for application as well, it can use this range for defining
00036  *          application specific errors.
00037  *
00038  * @note Success code, NRF_SUCCESS, does not include any module identifier.          
00039 
00040  */
00041 
00042 #ifndef SDK_ERRORS_H__
00043 #define SDK_ERRORS_H__
00044 
00045 #include <stdint.h>
00046 #include "nrf_error.h"
00047 
00048 /**
00049  * @defgroup sdk_err_base Base defined for SDK Modules
00050  * @{
00051  */
00052 #define SDK_ERROR_BASE         (NRF_ERROR_BASE_NUM + 0x8000)   /**< Base value defined for SDK module identifiers. */
00053 #define SDK_COMMON_ERROR_BASE  (NRF_ERROR_BASE_NUM + 0x0080)   /**< Base error value to be used for SDK error values. */
00054 /* @} */
00055 
00056 /**
00057  * @defgroup sdk_module_codes Codes reserved as identification for module where the error occurred.
00058  * @{
00059  */
00060 #define DEVICE_MANAGER_ERR_BASE   (0x8000)
00061 #define MEMORY_MANAGER_ERR_BASE   (0x8100)
00062 /* @} */
00063 
00064 
00065 /**
00066  * @defgroup sdk_iot_errors Codes reserved as identification for IoT errors.
00067  * @{
00068  */
00069 #define IOT_ERR_BASE_START        (0xA000)
00070 #define IOT_ERR_BASE_STOP         (0xAFFF)
00071 /* @} */
00072  
00073 
00074 /**
00075  * @defgroup sdk_common_errors Codes reserved as identification for common errors.
00076  * @{
00077  */
00078 #define MODULE_NOT_INITIALZED      (SDK_COMMON_ERROR_BASE + 0x0000)
00079 #define MUTEX_INIT_FAILED          (SDK_COMMON_ERROR_BASE + 0x0001)
00080 #define MUTEX_LOCK_FAILED          (SDK_COMMON_ERROR_BASE + 0x0002)
00081 #define MUTEX_UNLOCK_FAILED        (SDK_COMMON_ERROR_BASE + 0x0003)
00082 #define MUTEX_COND_INIT_FAILED     (SDK_COMMON_ERROR_BASE + 0x0004)
00083 #define MODULE_ALREADY_INITIALIZED (SDK_COMMON_ERROR_BASE + 0x0005)
00084 #define API_NOT_IMPLEMENTED        (SDK_COMMON_ERROR_BASE + 0x0010)
00085 #define FEATURE_NOT_ENABLED        (SDK_COMMON_ERROR_BASE + 0x0011)
00086 /* @} */
00087 
00088 
00089 /**
00090  * @defgroup dm_specific_errors Error / status codes specific to device manager.
00091  * @{
00092  */
00093 #define DM_NO_APP_CONTEXT                (DEVICE_MANAGER_ERR_BASE + 0x0040)
00094 #define DM_SERVICE_CONTEXT_NOT_APPLIED   (DEVICE_MANAGER_ERR_BASE + 0x0041)
00095 #define DM_CONTEXT_INFO_LOST             (DEVICE_MANAGER_ERR_BASE + 0x0042)
00096 #define DM_DEVICE_CONTEXT_FULL           (DEVICE_MANAGER_ERR_BASE + 0x0043)
00097 /* @} */
00098 
00099 /**
00100  * @brief API Result.
00101  *
00102  * @details Indicates success or failure of an API procedure. In case of failure, a comprehensive
00103  *          error code indicating cause or reason for failure is provided.
00104  *
00105  *          Though called an API result, it could used in Asynchronous notifications callback along
00106  *          with asynchronous callback as event result. This mechanism is employed when an event
00107  *          marks the end of procedure initiated using API. API result, in this case, will only be
00108  *          an indicative of whether the procedure has been requested successfully.
00109  */
00110 typedef uint32_t ret_code_t;
00111 /** @} */
00112 /** @} */
00113 
00114 #endif // SDK_ERRORS_H__
00115 
00116