sa

Fork of nRF51822 by Nordic Semiconductor

Committer:
nakamae
Date:
Thu Dec 29 07:05:48 2016 +0000
Revision:
639:fdeb2820ef26
Parent:
638:c90ae1400bf2
new;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vincent Coubard 638:c90ae1400bf2 1 /**************************************************************************/
Vincent Coubard 638:c90ae1400bf2 2 /*!
Vincent Coubard 638:c90ae1400bf2 3 @file ble_error.h
Vincent Coubard 638:c90ae1400bf2 4 @author hathach (tinyusb.org)
Vincent Coubard 638:c90ae1400bf2 5
Vincent Coubard 638:c90ae1400bf2 6 @section LICENSE
Vincent Coubard 638:c90ae1400bf2 7
Vincent Coubard 638:c90ae1400bf2 8 Software License Agreement (BSD License)
Vincent Coubard 638:c90ae1400bf2 9
Vincent Coubard 638:c90ae1400bf2 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
Vincent Coubard 638:c90ae1400bf2 11 All rights reserved.
Vincent Coubard 638:c90ae1400bf2 12
Vincent Coubard 638:c90ae1400bf2 13 Redistribution and use in source and binary forms, with or without
Vincent Coubard 638:c90ae1400bf2 14 modification, are permitted provided that the following conditions are met:
Vincent Coubard 638:c90ae1400bf2 15 1. Redistributions of source code must retain the above copyright
Vincent Coubard 638:c90ae1400bf2 16 notice, this list of conditions and the following disclaimer.
Vincent Coubard 638:c90ae1400bf2 17 2. Redistributions in binary form must reproduce the above copyright
Vincent Coubard 638:c90ae1400bf2 18 notice, this list of conditions and the following disclaimer in the
Vincent Coubard 638:c90ae1400bf2 19 documentation and/or other materials provided with the distribution.
Vincent Coubard 638:c90ae1400bf2 20 3. Neither the name of the copyright holders nor the
Vincent Coubard 638:c90ae1400bf2 21 names of its contributors may be used to endorse or promote products
Vincent Coubard 638:c90ae1400bf2 22 derived from this software without specific prior written permission.
Vincent Coubard 638:c90ae1400bf2 23
Vincent Coubard 638:c90ae1400bf2 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
Vincent Coubard 638:c90ae1400bf2 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Vincent Coubard 638:c90ae1400bf2 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Vincent Coubard 638:c90ae1400bf2 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
Vincent Coubard 638:c90ae1400bf2 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Vincent Coubard 638:c90ae1400bf2 29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Vincent Coubard 638:c90ae1400bf2 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
Vincent Coubard 638:c90ae1400bf2 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Vincent Coubard 638:c90ae1400bf2 32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Vincent Coubard 638:c90ae1400bf2 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Vincent Coubard 638:c90ae1400bf2 34 */
Vincent Coubard 638:c90ae1400bf2 35 /**************************************************************************/
Vincent Coubard 638:c90ae1400bf2 36
Vincent Coubard 638:c90ae1400bf2 37 /** \file
Vincent Coubard 638:c90ae1400bf2 38 * \brief Error Header
Vincent Coubard 638:c90ae1400bf2 39 *
Vincent Coubard 638:c90ae1400bf2 40 * \note TBD
Vincent Coubard 638:c90ae1400bf2 41 */
Vincent Coubard 638:c90ae1400bf2 42
Vincent Coubard 638:c90ae1400bf2 43 /** \ingroup Group_Common
Vincent Coubard 638:c90ae1400bf2 44 * \defgroup Group_Error Error Codes
Vincent Coubard 638:c90ae1400bf2 45 * @{
Vincent Coubard 638:c90ae1400bf2 46 */
Vincent Coubard 638:c90ae1400bf2 47
Vincent Coubard 638:c90ae1400bf2 48 #ifndef _BLE_ERROR_H_
Vincent Coubard 638:c90ae1400bf2 49 #define _BLE_ERROR_H_
Vincent Coubard 638:c90ae1400bf2 50
Vincent Coubard 638:c90ae1400bf2 51 #include "projectconfig.h"
Vincent Coubard 638:c90ae1400bf2 52
Vincent Coubard 638:c90ae1400bf2 53 #ifdef __cplusplus
Vincent Coubard 638:c90ae1400bf2 54 extern "C" {
Vincent Coubard 638:c90ae1400bf2 55 #endif
Vincent Coubard 638:c90ae1400bf2 56
Vincent Coubard 638:c90ae1400bf2 57 typedef enum
Vincent Coubard 638:c90ae1400bf2 58 {
Vincent Coubard 638:c90ae1400bf2 59 /*=======================================================================
Vincent Coubard 638:c90ae1400bf2 60 NORDIC GLOBAL ERRORS 0x0000 .. 0x00FF
Vincent Coubard 638:c90ae1400bf2 61 -----------------------------------------------------------------------
Vincent Coubard 638:c90ae1400bf2 62 Errors mapped from nrf_error.h
Vincent Coubard 638:c90ae1400bf2 63 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 64 ERROR_NONE = 0x0000 , ///< Successful command
Vincent Coubard 638:c90ae1400bf2 65 ERROR_SVC_HANDLER_MISSING = 0x0001 , ///< SVC handler is missing
Vincent Coubard 638:c90ae1400bf2 66 ERROR_SOFTDEVICE_NOT_ENABLED = 0x0002 , ///< SoftDevice has not been enabled
Vincent Coubard 638:c90ae1400bf2 67 ERROR_INTERNAL = 0x0003 , ///< Internal Error
Vincent Coubard 638:c90ae1400bf2 68 ERROR_NO_MEM = 0x0004 , ///< No Memory for operation
Vincent Coubard 638:c90ae1400bf2 69 ERROR_NOT_FOUND = 0x0005 , ///< Not found
Vincent Coubard 638:c90ae1400bf2 70 ERROR_NOT_SUPPORTED = 0x0006 , ///< Not supported
Vincent Coubard 638:c90ae1400bf2 71 ERROR_INVALID_PARAM = 0x0007 , ///< Invalid Parameter
Vincent Coubard 638:c90ae1400bf2 72 ERROR_INVALID_STATE = 0x0008 , ///< Invalid state, operation disallowed in this state
Vincent Coubard 638:c90ae1400bf2 73 ERROR_INVALID_LENGTH = 0x0009 , ///< Invalid Length
Vincent Coubard 638:c90ae1400bf2 74 ERROR_INVALID_FLAGS = 0x000A , ///< Invalid Flags
Vincent Coubard 638:c90ae1400bf2 75 ERROR_INVALID_DATA = 0x000B , ///< Invalid Data
Vincent Coubard 638:c90ae1400bf2 76 ERROR_DATA_SIZE = 0x000C , ///< Data size exceeds limit
Vincent Coubard 638:c90ae1400bf2 77 ERROR_TIMEOUT = 0x000D , ///< Operation timed out
Vincent Coubard 638:c90ae1400bf2 78 ERROR_NULL = 0x000E , ///< Null Pointer
Vincent Coubard 638:c90ae1400bf2 79 ERROR_FORBIDDEN = 0x000F , ///< Forbidden Operation
Vincent Coubard 638:c90ae1400bf2 80 ERROR_INVALID_ADDR = 0x0010 , ///< Bad Memory Address
Vincent Coubard 638:c90ae1400bf2 81 ERROR_BUSY = 0x0011 , ///< Busy
Vincent Coubard 638:c90ae1400bf2 82 /*=======================================================================*/
Vincent Coubard 638:c90ae1400bf2 83
Vincent Coubard 638:c90ae1400bf2 84 ERROR_INVALIDPARAMETER = 0x0100 , /**< An invalid parameter value was provided */
Vincent Coubard 638:c90ae1400bf2 85 ERROR_I2C_XFER_FAILED = 0x0101 , /**< an failed attempt to make I2C transfer */
Vincent Coubard 638:c90ae1400bf2 86
Vincent Coubard 638:c90ae1400bf2 87 /*=======================================================================
Vincent Coubard 638:c90ae1400bf2 88 SIMPLE BINARY PROTOCOL ERRORS 0x0120 .. 0x013F
Vincent Coubard 638:c90ae1400bf2 89 -----------------------------------------------------------------------
Vincent Coubard 638:c90ae1400bf2 90 Errors relating to the simple binary protocol (/src//protocol)
Vincent Coubard 638:c90ae1400bf2 91 -----------------------------------------------------------------------*/
Vincent Coubard 638:c90ae1400bf2 92 ERROR_PROT_INVALIDMSGTYPE = 0x121, /**< Unexpected msg type encountered */
Vincent Coubard 638:c90ae1400bf2 93 ERROR_PROT_INVALIDCOMMANDID = 0x122, /**< Unknown or out of range command ID */
Vincent Coubard 638:c90ae1400bf2 94 ERROR_PROT_INVALIDPAYLOAD = 0x123, /**< Message payload has a problem (invalid len, etc.) */
Vincent Coubard 638:c90ae1400bf2 95 /*=======================================================================*/
Vincent Coubard 638:c90ae1400bf2 96
Vincent Coubard 638:c90ae1400bf2 97 //------------- based on Nordic SDM nrf_error_sdm.h -------------//
Vincent Coubard 638:c90ae1400bf2 98 ERROR_SDM_LFCLK_SOURCE_UNKNOWN = 0x1000 , ///< Unknown lfclk source
Vincent Coubard 638:c90ae1400bf2 99 ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION = 0x1001 , ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts)
Vincent Coubard 638:c90ae1400bf2 100 ERROR_SDM_INCORRECT_CLENR0 = 0x1002 , ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing)
Vincent Coubard 638:c90ae1400bf2 101
Vincent Coubard 638:c90ae1400bf2 102 //------------- based on Nordic SOC nrf_error_soc.h -------------//
Vincent Coubard 638:c90ae1400bf2 103 /* Mutex Errors */
Vincent Coubard 638:c90ae1400bf2 104 ERROR_SOC_MUTEX_ALREADY_TAKEN = 0x2000 , ///< Mutex already taken
Vincent Coubard 638:c90ae1400bf2 105
Vincent Coubard 638:c90ae1400bf2 106 /* NVIC errors */
Vincent Coubard 638:c90ae1400bf2 107 ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE = 0x2001 , ///< NVIC interrupt not available
Vincent Coubard 638:c90ae1400bf2 108 ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED = 0x2002 , ///< NVIC interrupt priority not allowed
Vincent Coubard 638:c90ae1400bf2 109 ERROR_SOC_NVIC_SHOULD_NOT_RETURN = 0x2003 , ///< NVIC should not return
Vincent Coubard 638:c90ae1400bf2 110
Vincent Coubard 638:c90ae1400bf2 111 /* Power errors */
Vincent Coubard 638:c90ae1400bf2 112 ERROR_SOC_POWER_MODE_UNKNOWN = 0x2004 , ///< Power mode unknown
Vincent Coubard 638:c90ae1400bf2 113 ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN = 0x2005 , ///< Power POF threshold unknown
Vincent Coubard 638:c90ae1400bf2 114 ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN = 0x2006 , ///< Power off should not return
Vincent Coubard 638:c90ae1400bf2 115
Vincent Coubard 638:c90ae1400bf2 116 /* Rand errors */
Vincent Coubard 638:c90ae1400bf2 117 ERROR_SOC_RAND_NOT_ENOUGH_VALUES = 0x2007 , ///< RAND not enough values
Vincent Coubard 638:c90ae1400bf2 118
Vincent Coubard 638:c90ae1400bf2 119 /* PPI errors */
Vincent Coubard 638:c90ae1400bf2 120 ERROR_SOC_PPI_INVALID_CHANNEL = 0x2008 , ///< Invalid PPI Channel
Vincent Coubard 638:c90ae1400bf2 121 ERROR_SOC_PPI_INVALID_GROUP = 0x2009 , ///< Invalid PPI Group
Vincent Coubard 638:c90ae1400bf2 122
Vincent Coubard 638:c90ae1400bf2 123 //------------- based on Nordic STK (ble) ble_err.h -------------//
Vincent Coubard 638:c90ae1400bf2 124 ERROR_BLE_INVALID_CONN_HANDLE = 0x3001 , /**< Invalid connection handle. */
Vincent Coubard 638:c90ae1400bf2 125 ERROR_BLE_INVALID_ATTR_HANDLE = 0x3002 , /**< Invalid attribute handle. */
Vincent Coubard 638:c90ae1400bf2 126 ERROR_BLE_NO_TX_BUFFERS = 0x3003 , /**< Buffer capacity exceeded. */
Vincent Coubard 638:c90ae1400bf2 127
Vincent Coubard 638:c90ae1400bf2 128 // L2CAP
Vincent Coubard 638:c90ae1400bf2 129 ERROR_BLE_L2CAP_CID_IN_USE = 0x3100 , /**< CID already in use. */
Vincent Coubard 638:c90ae1400bf2 130
Vincent Coubard 638:c90ae1400bf2 131 // GAP
Vincent Coubard 638:c90ae1400bf2 132 ERROR_BLE_GAP_UUID_LIST_MISMATCH = 0x3200 , /**< UUID list does not contain an integral number of UUIDs. */
Vincent Coubard 638:c90ae1400bf2 133 ERROR_BLE_GAP_DISCOVERABLE_WITH_WHITELIST = 0x3201 , /**< Use of Whitelist not permitted with discoverable advertising. */
Vincent Coubard 638:c90ae1400bf2 134 ERROR_BLE_GAP_INVALID_BLE_ADDR = 0x3202 , /**< The upper two bits of the address do not correspond to the specified address type. */
Vincent Coubard 638:c90ae1400bf2 135
Vincent Coubard 638:c90ae1400bf2 136 // GATTC
Vincent Coubard 638:c90ae1400bf2 137 ERROR_BLE_GATTC_PROC_NOT_PERMITTED = 0x3300 ,
Vincent Coubard 638:c90ae1400bf2 138
Vincent Coubard 638:c90ae1400bf2 139 // GATTS
Vincent Coubard 638:c90ae1400bf2 140 ERROR_BLEGATTS_INVALID_ATTR_TYPE = 0x3400 , /**< Invalid attribute type. */
Vincent Coubard 638:c90ae1400bf2 141 ERROR_BLEGATTS_SYS_ATTR_MISSING = 0x3401 , /**< System Attributes missing. */
Vincent Coubard 638:c90ae1400bf2 142
Vincent Coubard 638:c90ae1400bf2 143 }error_t;
Vincent Coubard 638:c90ae1400bf2 144
Vincent Coubard 638:c90ae1400bf2 145 #ifdef __cplusplus
Vincent Coubard 638:c90ae1400bf2 146 }
Vincent Coubard 638:c90ae1400bf2 147 #endif
Vincent Coubard 638:c90ae1400bf2 148
Vincent Coubard 638:c90ae1400bf2 149 #endif /* _BLE_ERROR_H_ */
Vincent Coubard 638:c90ae1400bf2 150
Vincent Coubard 638:c90ae1400bf2 151 /** @} */