Nordic stack and drivers for the mbed BLE API

Dependents:   idd_hw5_bleFanProto

Fork of nRF51822 by Nordic Semiconductor

Committer:
bogdanm
Date:
Wed Mar 26 14:38:17 2014 +0000
Revision:
0:eff01767de02
Initial import of the nRF51822 code

Who changed what in which revision?

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