nordic

Fork of nRF51822 by Nordic Semiconductor

Committer:
rgrover1
Date:
Mon Jul 06 10:21:00 2015 +0100
Revision:
373:758e9a3a346a
Synchronized with git rev 488e2462
Author: James Crosby
restructure to yotta module, with a few tweaks to get things building

Who changed what in which revision?

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